Skip to content

Commit

Permalink
Fix broken GetRenderTargetData()
Browse files Browse the repository at this point in the history
  • Loading branch information
elishacloud committed Sep 4, 2024
1 parent 28a8d9e commit 36b50c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 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 7116
#define BUILD_NUMBER 7117
19 changes: 7 additions & 12 deletions d3d9/IDirect3DDevice9Ex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2044,7 +2044,7 @@ HRESULT m_IDirect3DDevice9Ex::GetRenderTargetData(THIS_ IDirect3DSurface9* pRend

if (pRenderTarget)
{
pRenderTarget = static_cast<m_IDirect3DSurface9*>(pDestSurface)->GetNonMultiSampledSurface(nullptr, 0);
pRenderTarget = static_cast<m_IDirect3DSurface9 *>(pRenderTarget)->GetNonMultiSampledSurface(nullptr, 0);
}

if (pDestSurface)
Expand All @@ -2064,20 +2064,15 @@ HRESULT m_IDirect3DDevice9Ex::UpdateSurface(THIS_ IDirect3DSurface9* pSourceSurf
pSourceSurface = static_cast<m_IDirect3DSurface9 *>(pSourceSurface)->GetProxyInterface();
}

m_IDirect3DSurface9* m_pDestinationSurface = static_cast<m_IDirect3DSurface9*>(pDestinationSurface);
IDirect3DSurface9* pDestinationMultiSample = nullptr;
if (m_pDestinationSurface)
m_IDirect3DSurface9* m_pDestinationSurface = static_cast<m_IDirect3DSurface9 *>(pDestinationSurface);
if (pDestinationSurface)
{
pDestinationSurface = m_pDestinationSurface->GetProxyInterface();
pDestinationMultiSample = m_pDestinationSurface->GetNonMultiSampledSurface(nullptr, 0);
RECT Rect = (pSourceRect && pDestPoint) ?
RECT{ pDestPoint->x, pDestPoint->y, pDestPoint->x + (pSourceRect->right - pSourceRect->left), pDestPoint->y + (pSourceRect->bottom - pSourceRect->top) } : RECT{};
pDestinationSurface = m_pDestinationSurface->GetNonMultiSampledSurface((pSourceRect && pDestPoint) ? &Rect : nullptr, 0);
}

if (pDestinationSurface == pDestinationMultiSample)
{
return ProxyInterface->UpdateSurface(pSourceSurface, pSourceRect, pDestinationSurface, pDestPoint);
}

HRESULT hr = ProxyInterface->UpdateSurface(pSourceSurface, pSourceRect, pDestinationMultiSample, pDestPoint);
HRESULT hr = ProxyInterface->UpdateSurface(pSourceSurface, pSourceRect, pDestinationSurface, pDestPoint);

if (SUCCEEDED(hr))
{
Expand Down

0 comments on commit 36b50c6

Please sign in to comment.