mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-11-12 17:20:07 +01:00
Local static initializers are evil, avoid them like plague.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4304 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
1 parent
4dac657c9b
commit
65fc196688
25 files changed
+337
-383
No files matched your search
@@ -525,6 +525,73 @@ EXPORT_C GSsetFrameLimit(int limit)
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
class Console
|
||||
{
|
||||
HANDLE m_console;
|
||||
string m_title;
|
||||
|
||||
public:
|
||||
Console::Console(LPCSTR title, bool open)
|
||||
: m_console(NULL)
|
||||
, m_title(title)
|
||||
{
|
||||
if(open) Open();
|
||||
}
|
||||
|
||||
Console::~Console()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
void Console::Open()
|
||||
{
|
||||
if(m_console == NULL)
|
||||
{
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
|
||||
|
||||
AllocConsole();
|
||||
|
||||
SetConsoleTitle(m_title.c_str());
|
||||
|
||||
m_console = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
COORD size;
|
||||
|
||||
size.X = 100;
|
||||
size.Y = 300;
|
||||
|
||||
SetConsoleScreenBufferSize(m_console, size);
|
||||
|
||||
GetConsoleScreenBufferInfo(m_console, &csbiInfo);
|
||||
|
||||
SMALL_RECT rect;
|
||||
|
||||
rect = csbiInfo.srWindow;
|
||||
rect.Right = rect.Left + 99;
|
||||
rect.Bottom = rect.Top + 64;
|
||||
|
||||
SetConsoleWindowInfo(m_console, TRUE, &rect);
|
||||
|
||||
*stdout = *_fdopen(_open_osfhandle((long)m_console, _O_TEXT), "w");
|
||||
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void Console::Close()
|
||||
{
|
||||
if(m_console != NULL)
|
||||
{
|
||||
FreeConsole();
|
||||
|
||||
m_console = NULL;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// lpszCmdLine:
|
||||
// First parameter is the renderer.
|
||||
// Second parameter is the gs file to load and run.
|
||||
@@ -547,6 +614,8 @@ EXPORT_C GSReplay(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow)
|
||||
|
||||
if(FILE* fp = fopen(lpszCmdLine, "rb"))
|
||||
{
|
||||
Console console("GSdx", true);
|
||||
|
||||
GSinit();
|
||||
|
||||
uint8 regs[0x2000];
|
||||
|
||||
Reference in new issue
Block a user