diff options
author | SupSuper | 2018-11-30 22:59:57 +0000 |
---|---|---|
committer | David Turner | 2018-12-13 06:34:12 +0000 |
commit | c2d5b3506209d92e421ad26e998633396cd4285d (patch) | |
tree | b274993d102ae1aae698dc6d1fa7e17e1540d6ef /backends/platform/sdl/win32 | |
parent | 98c559521cc0e448042e47d43ec12f093f0f1e41 (diff) | |
download | scummvm-rg350-c2d5b3506209d92e421ad26e998633396cd4285d.tar.gz scummvm-rg350-c2d5b3506209d92e421ad26e998633396cd4285d.tar.bz2 scummvm-rg350-c2d5b3506209d92e421ad26e998633396cd4285d.zip |
WIN32: Restore Windows 98 compatibility (bug #10613)
Replace calls to GetUserDefaultUILanguage and SHGetFolderPath which aren't supported in older Windows.
Diffstat (limited to 'backends/platform/sdl/win32')
-rw-r--r-- | backends/platform/sdl/win32/win32.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp index 930b453d24..3de1b9b35c 100644 --- a/backends/platform/sdl/win32/win32.cpp +++ b/backends/platform/sdl/win32/win32.cpp @@ -166,10 +166,8 @@ Common::String OSystem_Win32::getSystemLanguage() const { char langName[9]; char ctryName[9]; - const LCID languageIdentifier = GetUserDefaultUILanguage(); - - if (GetLocaleInfo(languageIdentifier, LOCALE_SISO639LANGNAME, langName, sizeof(langName)) != 0 && - GetLocaleInfo(languageIdentifier, LOCALE_SISO3166CTRYNAME, ctryName, sizeof(ctryName)) != 0) { + if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, langName, sizeof(langName)) != 0 && + GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, ctryName, sizeof(ctryName)) != 0) { Common::String localeName = langName; localeName += "_"; localeName += ctryName; @@ -189,12 +187,23 @@ Common::String OSystem_Win32::getScreenshotsPath() { return screenshotsPath; } + // Use the My Pictures folder. char picturesPath[MAXPATHLEN]; - // Use the My Pictures folder. - if (SHGetFolderPath(NULL, CSIDL_MYPICTURES, NULL, SHGFP_TYPE_CURRENT, picturesPath) != S_OK) { - warning("Unable to access My Pictures directory"); - return Common::String(); + // SHGetFolderPath didn't appear until Windows 2000, so we need to check for it at runtime + typedef HRESULT (WINAPI *SHGetFolderPathFunc)(HWND hwnd, int csidl, HANDLE hToken, DWORD dwFlags, LPSTR pszPath); + SHGetFolderPathFunc pSHGetFolderPath = (SHGetFolderPathFunc)GetProcAddress(GetModuleHandle(TEXT("shell32.dll")), "SHGetFolderPathA"); + + if (pSHGetFolderPath) { + if (pSHGetFolderPath(NULL, CSIDL_MYPICTURES, NULL, SHGFP_TYPE_CURRENT, picturesPath) != S_OK) { + warning("Unable to access My Pictures directory"); + return Common::String(); + } + } else { + if (!SHGetSpecialFolderPath(NULL, picturesPath, CSIDL_MYPICTURES, FALSE)) { + warning("Unable to access My Pictures directory"); + return Common::String(); + } } screenshotsPath = Common::String(picturesPath) + "\\ScummVM Screenshots\\"; |