mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2025-07-21 21:31:00 -06:00
fix #1556
This commit is contained in:
@ -3413,38 +3413,10 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
int CALLBACK WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR cmdline, int cmdshow)
|
int CALLBACK WinMain(HINSTANCE hinst, HINSTANCE hprev, LPSTR cmdline, int cmdshow)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int ret = main(__argc, __argv);
|
||||||
wchar_t** argv_w = CommandLineToArgvW(GetCommandLineW(), &argc);
|
|
||||||
char nullarg[] = {'\0'};
|
|
||||||
|
|
||||||
char** argv = new char*[argc];
|
|
||||||
for (int i = 0; i < argc; i++)
|
|
||||||
{
|
|
||||||
if (!argv_w) { argv[i] = nullarg; continue; }
|
|
||||||
int len = WideCharToMultiByte(CP_UTF8, 0, argv_w[i], -1, NULL, 0, NULL, NULL);
|
|
||||||
if (len < 1) { argv[i] = nullarg; continue; }
|
|
||||||
argv[i] = new char[len];
|
|
||||||
int res = WideCharToMultiByte(CP_UTF8, 0, argv_w[i], -1, argv[i], len, NULL, NULL);
|
|
||||||
if (res != len) { delete[] argv[i]; argv[i] = nullarg; }
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argv_w) LocalFree(argv_w);
|
|
||||||
|
|
||||||
//if (AttachConsole(ATTACH_PARENT_PROCESS))
|
|
||||||
/*if (AllocConsole())
|
|
||||||
{
|
|
||||||
freopen("CONOUT$", "w", stdout);
|
|
||||||
freopen("CONOUT$", "w", stderr);
|
|
||||||
printf("\n");
|
|
||||||
}*/
|
|
||||||
|
|
||||||
int ret = main(argc, argv);
|
|
||||||
|
|
||||||
printf("\n\n>");
|
printf("\n\n>");
|
||||||
|
|
||||||
for (int i = 0; i < argc; i++) if (argv[i] != nullarg) delete[] argv[i];
|
|
||||||
delete[] argv;
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user