From 85766f7fbbd55b4cc68e0fe1a38efdc0fd580b01 Mon Sep 17 00:00:00 2001 From: Elisha Riedlinger Date: Sat, 7 Dec 2024 21:35:55 -0800 Subject: [PATCH] Better handling of surface and lock emulation --- Dllmain/BuildNo.rc | 2 +- ddraw/IDirectDrawSurfaceX.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Dllmain/BuildNo.rc b/Dllmain/BuildNo.rc index 9b49c4a7..3cbc178d 100644 --- a/Dllmain/BuildNo.rc +++ b/Dllmain/BuildNo.rc @@ -1 +1 @@ -#define BUILD_NUMBER 7367 +#define BUILD_NUMBER 7368 diff --git a/ddraw/IDirectDrawSurfaceX.cpp b/ddraw/IDirectDrawSurfaceX.cpp index ef8ff2b2..eb41bd32 100644 --- a/ddraw/IDirectDrawSurfaceX.cpp +++ b/ddraw/IDirectDrawSurfaceX.cpp @@ -4593,7 +4593,7 @@ HRESULT m_IDirectDrawSurfaceX::CreateD9Surface() // Get texture format surface.Format = GetDisplayFormat(surfaceDesc2.ddpfPixelFormat); surface.BitCount = GetBitCount(surface.Format); - const bool CanUseEmulation = (!IsDepthStencil() && !(surface.Format & 0xFF000000 /*FOURCC or D3DFMT_DXTx*/) && !surface.UsingSurfaceMemory); + const bool CanUseEmulation = (!IsSurface3D() && !IsDepthStencil() && !(surface.Format & 0xFF000000 /*FOURCC or D3DFMT_DXTx*/) && !surface.UsingSurfaceMemory); SurfaceRequiresEmulation = (CanUseEmulation && (Config.DdrawEmulateSurface || ShouldEmulate == SC_FORCE_EMULATED || surface.Format == D3DFMT_A8B8G8R8 || surface.Format == D3DFMT_X8B8G8R8 || surface.Format == D3DFMT_B8G8R8 || surface.Format == D3DFMT_R8G8B8)); const bool CreateSurfaceEmulated = (CanUseEmulation && (SurfaceRequiresEmulation || @@ -5762,7 +5762,7 @@ void m_IDirectDrawSurfaceX::LockEmuLock(LPRECT lpDestRect, LPDDSURFACEDESC2 lpDD DWORD BBP = surface.BitCount; LONG NewPitch = (BBP / 8) * lpDDSurfaceDesc->dwWidth; - bool LockOffPlain = (Config.DdrawEmulateLock && !IsSurfaceTexture() && (lpDDSurfaceDesc->ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY)); + bool LockOffPlain = Config.DdrawEmulateLock; bool LockByteAlign = (Config.DdrawFixByteAlignment && lpDDSurfaceDesc->lPitch != NewPitch); // Emulate lock for offscreen surfaces