From abe2e619971cf0c1aa5b6bc4c8d128d736f60542 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sun, 9 Apr 2017 17:27:50 -0500 Subject: [PATCH] fix possibility for display capture to VRAM block not-mapped-to-LCDC doing something which I guess can clobber important memory. Mario kart does this after course demo during black screen transition if buttons are pressed (maybe programming error or emulation timing bug). The functionality that used to block this was lost during HD revisions. Fixes #54 --- desmume/src/GPU.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/desmume/src/GPU.cpp b/desmume/src/GPU.cpp index 3e7fd2f31..8d6f80a7a 100644 --- a/desmume/src/GPU.cpp +++ b/desmume/src/GPU.cpp @@ -5554,6 +5554,11 @@ 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