Windows: Support unicode arguments for console applications (thanks, Jorgen!).
Fixes Bugzilla #2864.main
parent
1b2cb70ca0
commit
e93ee5d7b1
|
@ -109,13 +109,16 @@ OutOfMemory(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
/* The VC++ compiler needs main defined */
|
/* The VC++ compiler needs main/wmain defined */
|
||||||
#define console_main main
|
# define console_utf8_main main
|
||||||
|
# if UNICODE
|
||||||
|
# define console_wmain wmain
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This is where execution begins [console apps] */
|
/* This is where execution begins [console apps, ansi] */
|
||||||
int
|
int
|
||||||
console_main(int argc, char *argv[])
|
console_utf8_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
SDL_SetMainReady();
|
SDL_SetMainReady();
|
||||||
|
|
||||||
|
@ -123,6 +126,22 @@ console_main(int argc, char *argv[])
|
||||||
return SDL_main(argc, argv);
|
return SDL_main(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNICODE
|
||||||
|
/* This is where execution begins [console apps, unicode] */
|
||||||
|
int
|
||||||
|
console_wmain(int argc, wchar_t *wargv[], wchar_t *wenvp)
|
||||||
|
{
|
||||||
|
char **argv = SDL_stack_alloc(char*, argc);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < argc; ++i) {
|
||||||
|
argv[i] = WIN_StringToUTF8(wargv[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return console_utf8_main(argc, argv);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This is where execution begins [windowed apps] */
|
/* This is where execution begins [windowed apps] */
|
||||||
int WINAPI
|
int WINAPI
|
||||||
WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
|
WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
|
||||||
|
@ -151,7 +170,7 @@ WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
|
||||||
ParseCommandLine(cmdline, argv);
|
ParseCommandLine(cmdline, argv);
|
||||||
|
|
||||||
/* Run the main program */
|
/* Run the main program */
|
||||||
console_main(argc, argv);
|
console_utf8_main(argc, argv);
|
||||||
|
|
||||||
SDL_stack_free(argv);
|
SDL_stack_free(argv);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue