From e9b406d134cca9f30b6ff70203562375fd871a53 Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Mon, 9 Mar 2015 18:17:45 +0600 Subject: [PATCH] Add special frame buffer flag for Ogre Battle backgrounds. It should protect such buffers from being overwritten by FrameBufferToRDRAM::CopyToRDRAM. --- FrameBuffer.cpp | 4 ++-- FrameBuffer.h | 1 + gSP.cpp | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/FrameBuffer.cpp b/FrameBuffer.cpp index 6aa9b66f..f9e7c140 100644 --- a/FrameBuffer.cpp +++ b/FrameBuffer.cpp @@ -390,7 +390,7 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt m_pCurrent->m_cleared = false; m_pCurrent->m_isDepthBuffer = _address == gDP.depthImageAddress; - m_pCurrent->m_isPauseScreen = false; + m_pCurrent->m_isPauseScreen = m_pCurrent->m_isOBScreen = false; gSP.changed |= CHANGED_TEXTURE; } @@ -743,7 +743,7 @@ void FrameBufferToRDRAM::CopyToRDRAM(u32 _address) { if (VI.width == 0) // H width is zero. Don't copy return; FrameBuffer *pBuffer = frameBufferList().findBuffer(_address); - if (pBuffer == NULL || pBuffer->m_width < VI.width) + if (pBuffer == NULL || pBuffer->m_width < VI.width || pBuffer->m_isOBScreen) return; _address = pBuffer->m_startAddress; diff --git a/FrameBuffer.h b/FrameBuffer.h index e479765b..57e9a8cc 100644 --- a/FrameBuffer.h +++ b/FrameBuffer.h @@ -25,6 +25,7 @@ struct FrameBuffer bool m_cfb; bool m_isDepthBuffer; bool m_isPauseScreen; + bool m_isOBScreen; bool m_needHeightCorrection; GLuint m_FBO; diff --git a/gSP.cpp b/gSP.cpp index 86bc3cbd..9e28cdba 100644 --- a/gSP.cpp +++ b/gSP.cpp @@ -2105,6 +2105,9 @@ void _drawYUVImageToFrameBuffer(const ObjCoordinates & _objCoords) } dst += ci_width - 16; } + FrameBuffer *pBuffer = frameBufferList().getCurrent(); + if (pBuffer != NULL) + pBuffer->m_isOBScreen = true; } void gSPObjRectangle(u32 sp)