[Scummvm-git-logs] scummvm master -> c2d5b3506209d92e421ad26e998633396cd4285d

digitall dgturner at iee.org
Thu Dec 13 07:34:16 CET 2018


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c2d5b35062 WIN32: Restore Windows 98 compatibility (bug #10613)


Commit: c2d5b3506209d92e421ad26e998633396cd4285d
    https://github.com/scummvm/scummvm/commit/c2d5b3506209d92e421ad26e998633396cd4285d
Author: SupSuper (supsuper at gmail.com)
Date: 2018-12-13T06:34:12Z

Commit Message:
WIN32: Restore Windows 98 compatibility (bug #10613)

Replace calls to GetUserDefaultUILanguage and SHGetFolderPath which aren't supported in older Windows.

Changed paths:
    backends/platform/sdl/win32/win32.cpp


diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index 930b453..3de1b9b 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\\";





More information about the Scummvm-git-logs mailing list