From c37e89209081b1cabdaf993418359f1c97b71f85 Mon Sep 17 00:00:00 2001 From: rogerman Date: Sat, 1 Jul 2017 13:51:15 -0700 Subject: [PATCH] GPU: Partially reverts changes to the LCDC check, bringing back an optimization for display capture. - Revert commit abe2e619971cf0c1aa5b6bc4c8d128d736f60542. (But retains the comments about Mario Kart.) - Partially revert adf682eb23fbbcdb93f2f4045cd4aeb0d9a40e6c. (But retains the removal of the LCDC check in ResetDisplayCaptureEnable().) --- desmume/src/GPU.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/desmume/src/GPU.cpp b/desmume/src/GPU.cpp index 8d6f80a7a..6bdd363ef 100644 --- a/desmume/src/GPU.cpp +++ b/desmume/src/GPU.cpp @@ -5253,8 +5253,10 @@ bool GPUEngineA::WillCapture3DLayerDirect(const size_t l) bool GPUEngineA::WillDisplayCapture(const size_t l) { + //we must block captures when the capture dest is not mapped to LCDC. + //mario kart does this (maybe due to a programming bug, but maybe emulation timing error) when spamming confirm key during course intro and through black transition const IOREG_DISPCAPCNT &DISPCAPCNT = this->_IORegisterMap->DISPCAPCNT; - return this->_displayCaptureEnable && (l < this->_dispCapCnt.capy); + return this->_displayCaptureEnable && (vramConfiguration.banks[DISPCAPCNT.VRAMWriteBlock].purpose == VramConfiguration::LCDC) && (l < this->_dispCapCnt.capy); } void GPUEngineA::SetDisplayCaptureEnable() @@ -5554,11 +5556,6 @@ void GPUEngineA::_RenderLine_DisplayCapture(const u16 l) const size_t readLineIndexWithOffset = (this->_dispCapCnt.readOffset * 64) + l; bool newCaptureLineNativeState = true; u16 *renderedLineSrcA16 = NULL; - - //we must block captures when the capture dest is not mapped to LCDC. - //mario kart does this (maybe due to a programming bug, but maybe emulation timing error) when spamming confirm key during course intro and through black transition - if(vramConfiguration.banks[vramWriteBlock].purpose != VramConfiguration::LCDC) - return; //128-wide captures should write linearly into memory, with no gaps //this is tested by hotel dusk