From cec0f2fc052d910e5961ab5f3aead89b2ca076ef Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Mon, 27 Aug 2018 22:35:30 +0700 Subject: [PATCH] Update end address of the current frame buffer in gDPFullSync(). Fixed Ogre Battle 64 Opening Splash Screens Flicker. #1868 Details Problem: frame buffer end address set to minimal when buffer is allocated. It is updated on next call of gDPSetColorImage. In case of Ogre Battle 64 Opening next call of gDPSetColorImage occurs in next frame. VI can't find the buffer because REG.VI_ORIGIN points on buffer with some offset, which in this case is larger than diff between start and end address. VI allocates new buffer, which eventually replaces the current one and flickering happens. Solution: update current buffer's end address in gDPFullSync() to ensure that it will be correct at the moment when VI will search for buffer to draw. --- src/gDP.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gDP.cpp b/src/gDP.cpp index 739ba199..9b4801a9 100644 --- a/src/gDP.cpp +++ b/src/gDP.cpp @@ -844,11 +844,15 @@ void gDPFullSync() dwnd().getDrawer().flush(); + FrameBuffer * pCurrentBuffer = frameBufferList().getCurrent(); + if (pCurrentBuffer != nullptr) + pCurrentBuffer->updateEndAddress(); + const bool sync = config.frameBufferEmulation.copyToRDRAM == Config::ctSync; if ((config.frameBufferEmulation.copyToRDRAM != Config::ctDisable || (config.generalEmulation.hacks & hack_subscreen) != 0) && !FBInfo::fbInfo.isSupported() && - frameBufferList().getCurrent() != nullptr && - !frameBufferList().getCurrent()->isAuxiliary() + pCurrentBuffer != nullptr && + !pCurrentBuffer->isAuxiliary() ) FrameBuffer_CopyToRDRAM(gDP.colorImage.address, sync);