[Scummvm-git-logs] scummvm branch-2-7 -> eb7056d14085321792feaac637f36859af750f16

sluicebox noreply at scummvm.org
Thu Jan 26 22:06:35 UTC 2023


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:
eb7056d140 WIN32: Disable libjpeg-turbo SSE usage on Win95


Commit: eb7056d14085321792feaac637f36859af750f16
    https://github.com/scummvm/scummvm/commit/eb7056d14085321792feaac637f36859af750f16
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2023-01-26T14:05:57-08:00

Commit Message:
WIN32: Disable libjpeg-turbo SSE usage on Win95

Fixes bug #13643

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


diff --git a/backends/platform/sdl/win32/win32.cpp b/backends/platform/sdl/win32/win32.cpp
index 2ca0b6f546d..4f1084ec09a 100644
--- a/backends/platform/sdl/win32/win32.cpp
+++ b/backends/platform/sdl/win32/win32.cpp
@@ -80,6 +80,10 @@ void OSystem_Win32::init() {
 	_dialogManager = new Win32DialogManager((SdlWindow_Win32*)_window);
 #endif
 
+#if defined(USE_JPEG)
+	initializeJpegLibraryForWin95();
+#endif
+
 	// Invoke parent implementation of this method
 	OSystem_SDL::init();
 }
@@ -501,4 +505,22 @@ AudioCDManager *OSystem_Win32::createAudioCDManager() {
 	return createWin32AudioCDManager();
 }
 
+// libjpeg-turbo uses SSE instructions that error on at least some Win95 machines.
+// These can be disabled with an environment variable. Fixes bug #13643
+#if defined(USE_JPEG)
+void OSystem_Win32::initializeJpegLibraryForWin95() {
+	OSVERSIONINFO versionInfo;
+	ZeroMemory(&versionInfo, sizeof(versionInfo));
+	versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
+	GetVersionEx(&versionInfo);
+
+	// Is Win95?
+	if (versionInfo.dwMajorVersion == 4 && versionInfo.dwMinorVersion == 0) {
+		// Disable SSE instructions in libjpeg-turbo.
+		// This limits detected extensions to 3DNOW and MMX.
+		_tputenv(TEXT("JSIMD_FORCE3DNOW=1"));
+	}
+}
+#endif
+
 #endif
diff --git a/backends/platform/sdl/win32/win32.h b/backends/platform/sdl/win32/win32.h
index c39f4d7b9ea..4ac05e60464 100644
--- a/backends/platform/sdl/win32/win32.h
+++ b/backends/platform/sdl/win32/win32.h
@@ -65,6 +65,10 @@ protected:
 private:
 	bool _isPortable;
 	bool detectPortableConfigFile();
+
+#if defined(USE_JPEG)
+	void initializeJpegLibraryForWin95();
+#endif
 };
 
 #endif




More information about the Scummvm-git-logs mailing list