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

This commit is contained in:
zeromus 2017-04-09 17:27:50 -05:00
parent e7d7c08455
commit abe2e61997
1 changed files with 5 additions and 0 deletions

View File

@ -5555,6 +5555,11 @@ void GPUEngineA::_RenderLine_DisplayCapture(const u16 l)
bool newCaptureLineNativeState = true; bool newCaptureLineNativeState = true;
u16 *renderedLineSrcA16 = NULL; 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 //128-wide captures should write linearly into memory, with no gaps
//this is tested by hotel dusk //this is tested by hotel dusk
size_t cap_dst_adr = (DISPCAPCNT.VRAMWriteOffset * 64 * GPU_FRAMEBUFFER_NATIVE_WIDTH) + (l * CAPTURELENGTH); size_t cap_dst_adr = (DISPCAPCNT.VRAMWriteOffset * 64 * GPU_FRAMEBUFFER_NATIVE_WIDTH) + (l * CAPTURELENGTH);