Skip to content

Commit a3c8359

Browse files
committed
Make multi-threaded and FPU preserve flags sticky
#66
1 parent 03574b2 commit a3c8359

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

Dllmain/BuildNo.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define BUILD_NUMBER 8117
1+
#define BUILD_NUMBER 8118

ddraw/IDirectDrawTypes.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ struct DEVICESETTINGS
160160
bool AntiAliasing;
161161
bool MultiThreaded;
162162
bool FPUPreserve;
163-
bool FPUSetup;
164163
bool NoWindowChanges;
165164
DWORD Width;
166165
DWORD Height;

ddraw/IDirectDrawX.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1642,7 +1642,7 @@ HRESULT m_IDirectDrawX::RestoreDisplayMode()
16421642

16431643
HRESULT 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

Comments
 (0)