mirror of
https://github.com/libretro/ppsspp.git
synced 2024-12-13 03:19:25 +00:00
Attempt to determine lang/country on XP.
This will sometimes give numbers, but it's closer than assuming en_US.
This commit is contained in:
parent
d5219ebafc
commit
3fd67f9199
@ -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 <algorithm>
|
||||
#include <WinNls.h>
|
||||
#include <math.h>
|
||||
#include <Wbemidl.h>
|
||||
@ -332,6 +333,26 @@ bool System_InputBoxGetWString(const wchar_t *title, const std::wstring &default
|
||||
}
|
||||
}
|
||||
|
||||
static std::string GetDefaultLangRegion() {
|
||||
wchar_t lcLangName[256] = {};
|
||||
|
||||
// LOCALE_SNAME is only available in WinVista+
|
||||
if (0 != GetLocaleInfo(LOCALE_NAME_USER_DEFAULT, LOCALE_SNAME, lcLangName, ARRAY_SIZE(lcLangName))) {
|
||||
std::string result = ConvertWStringToUTF8(lcLangName);
|
||||
std::replace(result.begin(), result.end(), '-', '_');
|
||||
return result;
|
||||
} else {
|
||||
// This should work on XP, but we may get numbers for some countries.
|
||||
if (0 != GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, lcLangName, ARRAY_SIZE(lcLangName))) {
|
||||
wchar_t lcRegion[256] = {};
|
||||
if (0 != GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, lcRegion, ARRAY_SIZE(lcRegion))) {
|
||||
return ConvertWStringToUTF8(lcLangName) + "_" + ConvertWStringToUTF8(lcRegion);
|
||||
}
|
||||
}
|
||||
// Unfortunate default. We tried.
|
||||
return "en_US";
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::wstring> GetWideCmdLine() {
|
||||
wchar_t **wargv;
|
||||
@ -365,27 +386,14 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin
|
||||
#ifndef _DEBUG
|
||||
bool showLog = false;
|
||||
#else
|
||||
bool showLog = false;
|
||||
bool showLog = true;
|
||||
#endif
|
||||
|
||||
const std::string &exePath = File::GetExeDirectory();
|
||||
VFSRegister("", new DirectoryAssetReader((exePath + "/assets/").c_str()));
|
||||
VFSRegister("", new DirectoryAssetReader(exePath.c_str()));
|
||||
|
||||
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 (size_t i = 0; i < langRegion.size(); i++) {
|
||||
if (langRegion[i] == '-')
|
||||
langRegion[i] = '_';
|
||||
}
|
||||
} else {
|
||||
langRegion = "en_US";
|
||||
}
|
||||
|
||||
langRegion = GetDefaultLangRegion();
|
||||
osName = GetWindowsVersion() + " " + GetWindowsSystemArchitecture();
|
||||
|
||||
char configFilename[MAX_PATH] = { 0 };
|
||||
|
Loading…
Reference in New Issue
Block a user