Win32: Use wide strings to parse most command-line arguments.

Also do a tiny bit of cleanup in main.cpp (replacing strcmps with simple string equality checks).
This commit is contained in:
The Dax committed 2014-08-31 02:47:25 -04:00
1 parent cdbcc12a4e
commit 3590352429
4 files changed
+65 -26

No files matched your search

+21 -1
View File
@@ -89,7 +89,27 @@ unsigned int WINAPI TheThread(void *)
Host *oldHost = host;
NativeInit(__argc, (const char **)__argv, "1234", "1234", "1234");
// Convert the command-line arguments to Unicode, then to proper UTF-8
// (the benefit being that we don't have to pollute the UI project with win32 ifdefs and lots of Convert<whatever>To<whatever>).
// This avoids issues with PPSSPP inadvertently destroying paths with Unicode glyphs
// (using the ANSI args resulted in Japanese/Chinese glyphs being turned into question marks, at least for me..).
// -TheDax
std::vector<std::wstring> wideArgs = GetWideCmdLine();
std::vector<std::string> argsUTF8;
for (auto& i : wideArgs)
{
argsUTF8.push_back(ConvertWStringToUTF8(i));
}
std::vector<const char *> args;
for (auto& string: argsUTF8)
{
args.push_back(string.c_str());
}
NativeInit(args.size(), &args[0], "1234", "1234", "1234");
Host *nativeHost = host;
host = oldHost;