From f946a82e38aeb37924d5f85b5bd225707b3784e4 Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Thu, 19 Feb 2015 18:50:02 +0600 Subject: [PATCH] Fix replay in Mario Golf: replay is copied to a area, which is used for depth buffer. Added check that found frame buffer is not depth buffer. --- DepthBuffer.cpp | 2 ++ FrameBuffer.cpp | 1 + FrameBuffer.h | 1 + gDP.cpp | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/DepthBuffer.cpp b/DepthBuffer.cpp index 90c3f3b1..5c2e6b0f 100644 --- a/DepthBuffer.cpp +++ b/DepthBuffer.cpp @@ -261,6 +261,8 @@ void DepthBufferList::saveBuffer(u32 _address) FrameBuffer * pFrameBuffer = frameBufferList().findBuffer(_address); if (pFrameBuffer == NULL) pFrameBuffer = frameBufferList().getCurrent(); + else + pFrameBuffer->m_isDepthBuffer = true; if (m_pCurrent == NULL || m_pCurrent->m_address != _address) m_pCurrent = findBuffer(_address); diff --git a/FrameBuffer.cpp b/FrameBuffer.cpp index 941c9fb0..6b320dfa 100644 --- a/FrameBuffer.cpp +++ b/FrameBuffer.cpp @@ -347,6 +347,7 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt *(u32*)&RDRAM[m_pCurrent->m_startAddress] = m_pCurrent->m_startAddress; m_pCurrent->m_cleared = false; + m_pCurrent->m_isDepthBuffer = false; gSP.changed |= CHANGED_TEXTURE; } diff --git a/FrameBuffer.h b/FrameBuffer.h index 9075da7e..09be97aa 100644 --- a/FrameBuffer.h +++ b/FrameBuffer.h @@ -22,6 +22,7 @@ struct FrameBuffer float m_scaleX, m_scaleY; bool m_cleared; bool m_cfb; + bool m_isDepthBuffer; GLuint m_FBO; gDPTile *m_pLoadTile; diff --git a/gDP.cpp b/gDP.cpp index eaa9d9b4..3b9176c0 100644 --- a/gDP.cpp +++ b/gDP.cpp @@ -512,7 +512,7 @@ bool CheckForFrameBufferTexture(u32 _address, u32 _bytes) return false; FrameBuffer *pBuffer = frameBufferList().findBuffer(_address); - bool bRes = pBuffer != NULL; + bool bRes = pBuffer != NULL && !pBuffer->m_isDepthBuffer; if ((bRes) //&& ((*(u32*)&RDRAM[pBuffer->startAddress] & 0xFFFEFFFE) == (pBuffer->startAddress & 0xFFFEFFFE)) // Does not work for Jet Force Gemini )