From d1fbd84319ccb0506e219e30845d2eaab42f8e3c Mon Sep 17 00:00:00 2001 From: Elisha Riedlinger Date: Sat, 13 Apr 2024 13:33:40 -0700 Subject: [PATCH] Revert 16bit default and fix texture pool #260 --- Dllmain/BuildNo.rc | 2 +- ddraw/IDirectDrawSurfaceX.cpp | 3 ++- ddraw/IDirectDrawX.cpp | 24 +++++++++++------------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Dllmain/BuildNo.rc b/Dllmain/BuildNo.rc index a304d617..adf179d9 100644 --- a/Dllmain/BuildNo.rc +++ b/Dllmain/BuildNo.rc @@ -1 +1 @@ -#define BUILD_NUMBER 6998 +#define BUILD_NUMBER 6999 diff --git a/ddraw/IDirectDrawSurfaceX.cpp b/ddraw/IDirectDrawSurfaceX.cpp index 3388787b..aca3dc88 100644 --- a/ddraw/IDirectDrawSurfaceX.cpp +++ b/ddraw/IDirectDrawSurfaceX.cpp @@ -3701,7 +3701,8 @@ HRESULT m_IDirectDrawSurfaceX::CreateD3d9Surface() const D3DFORMAT TextureFormat = (surfaceFormat == D3DFMT_P8) ? D3DFMT_L8 : Format; // Get texture memory pool - surface.TexturePool = (IsPrimaryOrBackBuffer() || (surfaceDesc2.ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD) || attached3DTexture) ? D3DPOOL_MANAGED : + surface.TexturePool = (IsPrimaryOrBackBuffer() && surface.IsUsingWindowedMode && !Using3D) ? D3DPOOL_SYSTEMMEM : + (IsPrimaryOrBackBuffer() || (surfaceDesc2.ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD) || attached3DTexture) ? D3DPOOL_MANAGED : (surfaceDesc2.ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY) ? D3DPOOL_SYSTEMMEM : D3DPOOL_MANAGED; // Adjust Width to be byte-aligned diff --git a/ddraw/IDirectDrawX.cpp b/ddraw/IDirectDrawX.cpp index 33389816..f4b58485 100644 --- a/ddraw/IDirectDrawX.cpp +++ b/ddraw/IDirectDrawX.cpp @@ -2640,8 +2640,7 @@ HDC m_IDirectDrawX::GetDC() DWORD m_IDirectDrawX::GetDisplayBPP(HWND hWnd) { - // Default to 16 bit if SetDisplayMode() has not been called - return (ExclusiveMode && Exclusive.BPP) ? Exclusive.BPP : (!DisplayMode.BPP) ? 16 : Utils::GetBitCount(hWnd); + return (ExclusiveMode && Exclusive.BPP) ? Exclusive.BPP : Utils::GetBitCount(hWnd); } void m_IDirectDrawX::ClearDepthStencilSurface() @@ -4203,24 +4202,23 @@ HRESULT m_IDirectDrawX::Present(RECT* pSourceRect, RECT* pDestRect) DWORD GetDDrawBitsPixel(HWND hWnd) { - bool isMenu = false; if (hWnd) { char name[256] = {}; GetClassNameA(hWnd, name, sizeof(name)); - isMenu = ((DWORD)hWnd == 0x00010010 || strcmp(name, "#32769") == S_OK); - } - if (!isMenu) - { - if (Config.DdrawOverrideBitMode) + if ((DWORD)hWnd == 0x00010010 || strcmp(name, "#32769") == S_OK) // Is menu { - return Config.DdrawOverrideBitMode; - } - if (!DDrawVector.empty() && DisplayMode.hWnd) - { - return (Exclusive.BPP) ? Exclusive.BPP : (DisplayMode.BPP) ? DisplayMode.BPP : DDrawVector.data()[0]->GetDisplayBPP(hWnd); + return 0; } } + if (Config.DdrawOverrideBitMode) + { + return Config.DdrawOverrideBitMode; + } + if (!DDrawVector.empty() && DisplayMode.hWnd) + { + return (Exclusive.BPP) ? Exclusive.BPP : (DisplayMode.BPP) ? DisplayMode.BPP : DDrawVector.data()[0]->GetDisplayBPP(hWnd); + } return 0; }