Detect language on first boot on Windows (Vista+) and Android

This commit is contained in:
Henrik Rydgard committed 2013-09-04 12:08:22 +02:00
1 parent 8e6b031d9b
commit ad620e463a
6 files changed
+40 -8

No files matched your search

+21 -4
View File
@@ -15,6 +15,7 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include <WinNls.h>
#include "Common/CommonWindows.h"
#include "file/vfs.h"
@@ -51,6 +52,8 @@
CDisasm *disasmWindow[MAX_CPUCOUNT] = {0};
CMemoryDlg *memoryWindow[MAX_CPUCOUNT] = {0};
static std::string langRegion;
void LaunchBrowser(const char *url) {
ShellExecute(NULL, L"open", ConvertUTF8ToWString(url).c_str(), NULL, NULL, SW_SHOWNORMAL);
}
@@ -60,7 +63,7 @@ std::string System_GetProperty(SystemProperty prop) {
case SYSPROP_NAME:
return "PC:Windows";
case SYSPROP_LANGREGION:
return "en_US";
return langRegion;
default:
return "";
}
@@ -87,7 +90,6 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
hideLog = false;
#endif
// The rest is handled in NativeInit().
for (int i = 1; i < __argc; ++i)
{
@@ -109,14 +111,29 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
}
}
VFSRegister("", new DirectoryAssetReader("assets/"));
VFSRegister("", new DirectoryAssetReader(""));
wchar_t lcCountry[256];
// LOCALE_SNAME is only available in WinVista+
// Really should find a way to do this in XP too :/
if (0 != GetLocaleInfo(LOCALE_NAME_USER_DEFAULT, LOCALE_SNAME, lcCountry, 256)) {
langRegion = ConvertWStringToUTF8(lcCountry);
for (int i = 0; i < langRegion.size(); i++) {
if (langRegion[i] == '-')
langRegion[i] = '_';
}
} else {
langRegion = "en_US";
}
g_Config.Load();
LogManager::Init();
LogManager::GetInstance()->GetConsoleListener()->Open(hideLog, 150, 120, "PPSSPP Debug Console");
LogManager::GetInstance()->SetLogLevel(LogTypes::G3D, LogTypes::LERROR);
VFSRegister("", new DirectoryAssetReader("assets/"));
VFSRegister("", new DirectoryAssetReader(""));
//Windows, API init stuff
INITCOMMONCONTROLSEX comm;