winport - fix loading files named things like Splookékrong from commandline, fixes #238

This commit is contained in:
zeromus 2018-12-15 17:26:28 -05:00
parent 7ff5c5eece
commit 88d930ce82
1 changed files with 10 additions and 10 deletions

View File

@ -1880,6 +1880,15 @@ static void SyncGpuBpp()
GPU->SetColorFormat(NDSColorFormat_BGR888_Rev);
}
static BOOL OpenCoreSystemCP(const char* filename_syscp)
{
wchar_t wgarbage[1024];
char garbage[1024];
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, filename_syscp, -1, wgarbage, 1024);
int q = WideCharToMultiByte(CP_UTF8, 0, wgarbage, -1, garbage, 1024, NULL, NULL);
return OpenCore(garbage);
}
#define RENDERID_NULL_SAVED -1
#define GPU3D_DEFAULT GPU3D_SWRAST
@ -2482,7 +2491,7 @@ int _main()
if (cmdline.nds_file != "")
{
if(OpenCore(cmdline.nds_file.c_str()))
if(OpenCoreSystemCP(cmdline.nds_file.c_str()))
{
romloaded = TRUE;
}
@ -3548,15 +3557,6 @@ void SaveWindowPos(HWND hwnd)
WritePrivateProfileInt("Video", "WindowPosY", WndY/*MainWindowRect.top*/, IniName);
}
static BOOL OpenCoreSystemCP(const char* filename_syscp)
{
wchar_t wgarbage[1024];
char garbage[1024];
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, filename_syscp, -1, wgarbage, 1024);
int q = WideCharToMultiByte(CP_UTF8, 0, wgarbage, -1, garbage, 1024, NULL, NULL);
return OpenCore(garbage);
}
//========================================================================================
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{