Added Win32 tiles command line parsing and connected console output for stdout/stderr.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3255 c06c8d41-db1a-0410-9941-cceddc491573
5DTGRF4G4T2CAUCZHTPNM6FF2XJHUYMWF74MATNVJC5QYSOPNOPQC
// after handing the controll to the main code,
// libgui_init , libgui_init_sys will be called
old_main(0, NULL);
// Redirect output to the console
AttachConsole(ATTACH_PARENT_PROCESS);
freopen("CONOUT$", "wb", stdout);
freopen("CONOUT$", "wb", stderr);
// I'll be damned if I have to parse lpCmdLine myself...
int argc;
LPWSTR *wargv = CommandLineToArgvW(GetCommandLineW(), &argc);
char **argv = new char*[argc];
int args_len = wcslen(GetCommandLineW()) + argc;
char *args = new char[args_len];
char *ptr = args;
for (int i = 0; i < argc; i++)
{
wsprintfA(ptr, "%S", wargv[i]);
argv[i] = ptr;
ptr += strlen(argv[i]) + 1;
}
ASSERT(ptr <= args + args_len);
old_main(argc, argv);
delete args;
delete argv;
FreeConsole();
} // dir!=0
else
if ( ch >= VK_PAUSE
&& !(ch >= VK_CAPITAL && ch <= VK_SPACE)
&& ch !=VK_PROCESSKEY
&& ch != VK_NUMLOCK
&& !(ch >=VK_LSHIFT && ch<= VK_RMENU)
&& !(ch >= 0x30 && ch<= 0x39)
&& !(ch >= 0x41 && ch<= 0x5a)
&& !(ch >= 0xa6 && ch<= 0xe4)
) result = 300+ch;
}
else if ( ch >= VK_PAUSE
&& !(ch >= VK_CAPITAL && ch <= VK_SPACE)
&& ch !=VK_PROCESSKEY
&& ch != VK_NUMLOCK
&& !(ch >=VK_LSHIFT && ch<= VK_RMENU)
&& !(ch >= 0x30 && ch<= 0x39)
&& !(ch >= 0x41 && ch<= 0x5a)
&& !(ch >= 0xa6 && ch<= 0xe4)
)
{
result = 300+ch;
}
if (result)
{
if (fs) result |= 512;
if (fc) result |= 1024;
if (fa) result |= 2048;
ev.key = result;
ev.type = EV_KEYIN;
ev_push(&ev);
}
if (result)
{
if (fs) result |= 512;
if (fc) result |= 1024;
if (fa) result |= 2048;
ev.key = result;
ev.type = EV_KEYIN;
ev_push(&ev);
}