Skip to content

Commit

Permalink
Revert 16bit default and fix texture pool
Browse files Browse the repository at this point in the history
  • Loading branch information
elishacloud committed Apr 13, 2024
1 parent 80e00fc commit d1fbd84
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Dllmain/BuildNo.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD_NUMBER 6998
#define BUILD_NUMBER 6999
3 changes: 2 additions & 1 deletion ddraw/IDirectDrawSurfaceX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 11 additions & 13 deletions ddraw/IDirectDrawX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit d1fbd84

Please sign in to comment.