From fc701723271aba094acea76c524dc2ff328a9479 Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Thu, 25 Oct 2018 17:29:50 +0700 Subject: [PATCH] Refactor update of buffer end address. Add removeIntersections() after end address update. --- src/FrameBuffer.cpp | 7 +++++++ src/FrameBuffer.h | 1 + src/gDP.cpp | 8 +++----- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/FrameBuffer.cpp b/src/FrameBuffer.cpp index bdae54d4..148878cb 100644 --- a/src/FrameBuffer.cpp +++ b/src/FrameBuffer.cpp @@ -655,6 +655,13 @@ FrameBuffer * FrameBufferList::findTmpBuffer(u32 _address) return nullptr; } +void FrameBufferList::updateCurrentBufferEndAddress() +{ + if (m_pCurrent == nullptr) + return; + m_pCurrent->updateEndAddress(); + removeIntersections(); +} void FrameBufferList::_createScreenSizeBuffer() { diff --git a/src/FrameBuffer.h b/src/FrameBuffer.h index b1401c3c..0255399b 100644 --- a/src/FrameBuffer.h +++ b/src/FrameBuffer.h @@ -109,6 +109,7 @@ public: FrameBuffer * findTmpBuffer(u32 _address); FrameBuffer * getCurrent() const {return m_pCurrent;} void setCurrent(FrameBuffer * _pCurrent) { m_pCurrent = _pCurrent; } + void updateCurrentBufferEndAddress(); void renderBuffer(); void setBufferChanged(f32 _maxY); void clearBuffersChanged(); diff --git a/src/gDP.cpp b/src/gDP.cpp index dc03443a..a86c99ff 100644 --- a/src/gDP.cpp +++ b/src/gDP.cpp @@ -837,17 +837,15 @@ void gDPFullSync() dwnd().getDrawer().flush(); - FrameBuffer * pCurrentBuffer = frameBufferList().getCurrent(); - if (pCurrentBuffer != nullptr) - pCurrentBuffer->updateEndAddress(); + frameBufferList().updateCurrentBufferEndAddress(); - const bool sync = config.frameBufferEmulation.copyToRDRAM == Config::ctSync; + FrameBuffer * pCurrentBuffer = frameBufferList().getCurrent(); if ((config.frameBufferEmulation.copyToRDRAM != Config::ctDisable || (config.generalEmulation.hacks & hack_subscreen) != 0) && !FBInfo::fbInfo.isSupported() && pCurrentBuffer != nullptr && !pCurrentBuffer->isAuxiliary() ) - FrameBuffer_CopyToRDRAM(gDP.colorImage.address, sync); + FrameBuffer_CopyToRDRAM(gDP.colorImage.address, config.frameBufferEmulation.copyToRDRAM == Config::ctSync); if (RSP.LLE) { if (config.frameBufferEmulation.copyDepthToRDRAM != Config::cdDisable && !FBInfo::fbInfo.isSupported())