@@ -1642,7 +1642,7 @@ HRESULT m_IDirectDrawX::RestoreDisplayMode()
16421642
16431643HRESULT m_IDirectDrawX::SetCooperativeLevel (HWND hWnd, DWORD dwFlags, DWORD DirectXVersion)
16441644{
1645- Logging::LogDebug () << __FUNCTION__ << " (" << this << " ) " << hWnd << " " << Logging::hex (dwFlags);
1645+ Logging::LogDebug () << __FUNCTION__ << " (" << this << " ) " << hWnd << " " << Logging::hex (dwFlags) << " " << DirectXVersion ;
16461646
16471647 if (Config.Dd7to9 )
16481648 {
@@ -1762,15 +1762,9 @@ HRESULT m_IDirectDrawX::SetCooperativeLevel(HWND hWnd, DWORD dwFlags, DWORD Dire
17621762
17631763 // Set device flags
17641764 Device.MultiThreaded = Device.MultiThreaded || (dwFlags & DDSCL_MULTITHREADED);
1765+ // The flag (DDSCL_FPUSETUP) is assumed by default in DirectX 7.
17651766 // The flag (DDSCL_FPUPRESERVE) is assumed by default in DirectX 6 and earlier.
1766- Device.FPUPreserve = Device.FPUPreserve || (dwFlags & DDSCL_FPUPRESERVE) || DirectXVersion < 7 ;
1767- // / The flag (DDSCL_FPUSETUP) is assumed by default in DirectX 6 and earlier.
1768- if (!Device.FPUSetup && !d3d9Device && ((dwFlags & DDSCL_FPUSETUP) || DirectXVersion < 7 ))
1769- {
1770- Logging::Log () << __FUNCTION__ << " Setting single precision FPU and disabling FPU exceptions!" ;
1771- Utils::ApplyFPUSetup ();
1772- Device.FPUSetup = true ;
1773- }
1767+ Device.FPUPreserve = Device.FPUPreserve || (!(dwFlags & DDSCL_FPUSETUP) && ((dwFlags & DDSCL_FPUPRESERVE) || DirectXVersion < 7 ));
17741768 // The flag (DDSCL_NOWINDOWCHANGES) means DirectDraw is not allowed to minimize or restore the application window on activation.
17751769 Device.NoWindowChanges = (DisplayMode.hWnd == LasthWnd && Device.NoWindowChanges ) || (dwFlags & DDSCL_NOWINDOWCHANGES);
17761770
@@ -2448,8 +2442,15 @@ void m_IDirectDrawX::InitInterface(DWORD DirectXVersion)
24482442 LastSetBPP = 0 ;
24492443
24502444 // Device settings
2451- Device = {};
2452- Device.IsWindowed = true ;
2445+ {
2446+ // Make multi-threaded and FPU preserve flags sticky across calls once initiated
2447+ bool MultiThreaded = Device.MultiThreaded ;
2448+ bool FPUPreserve = Device.FPUPreserve ;
2449+ Device = {};
2450+ Device.IsWindowed = true ;
2451+ Device.MultiThreaded = MultiThreaded;
2452+ Device.FPUPreserve = FPUPreserve;
2453+ }
24532454
24542455 // Default gamma
24552456 IsGammaSet = false ;
0 commit comments