Windows: Make a distinction between ANSI mainline and UTF-8 mainline.

This commit is contained in:
Ryan C. Gordon 2015-02-19 21:49:15 -05:00
parent e93ee5d7b1
commit f7c4c3d010
1 changed files with 15 additions and 6 deletions

View File

@ -110,15 +110,15 @@ OutOfMemory(void)
#if defined(_MSC_VER) #if defined(_MSC_VER)
/* The VC++ compiler needs main/wmain defined */ /* The VC++ compiler needs main/wmain defined */
# define console_utf8_main main # define console_ansi_main main
# if UNICODE # if UNICODE
# define console_wmain wmain # define console_wmain wmain
# endif # endif
#endif #endif
/* This is where execution begins [console apps, ansi] */ /* WinMain, main, and wmain eventually call into here. */
int static int
console_utf8_main(int argc, char *argv[]) main_utf8(int argc, char *argv[])
{ {
SDL_SetMainReady(); SDL_SetMainReady();
@ -126,6 +126,15 @@ console_utf8_main(int argc, char *argv[])
return SDL_main(argc, argv); return SDL_main(argc, argv);
} }
/* This is where execution begins [console apps, ansi] */
int
console_ansi_main(int argc, char *argv[])
{
/* !!! FIXME: are these in the system codepage? We need to convert to UTF-8. */
return main_utf8(argc, argv);
}
#if UNICODE #if UNICODE
/* This is where execution begins [console apps, unicode] */ /* This is where execution begins [console apps, unicode] */
int int
@ -138,7 +147,7 @@ console_wmain(int argc, wchar_t *wargv[], wchar_t *wenvp)
argv[i] = WIN_StringToUTF8(wargv[i]); argv[i] = WIN_StringToUTF8(wargv[i]);
} }
return console_utf8_main(argc, argv); return main_utf8(argc, argv);
} }
#endif #endif
@ -170,7 +179,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_utf8_main(argc, argv); main_utf8(argc, argv);
SDL_stack_free(argv); SDL_stack_free(argv);