From e34ce013dfc10ccf80c34ef5b1f5f3c69059c1e2 Mon Sep 17 00:00:00 2001 From: RSDuck Date: Wed, 9 Dec 2020 22:45:16 +0100 Subject: [PATCH] only start display capture on first line fixes Spearpillar in Pokemon D/P/Pt also fixes #782 and #474 --- src/GPU2D.cpp | 6 +++++- src/GPU2D.h | 1 + src/GPU2D_Soft.cpp | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/GPU2D.cpp b/src/GPU2D.cpp index 030936e1..d2a8b34c 100644 --- a/src/GPU2D.cpp +++ b/src/GPU2D.cpp @@ -581,7 +581,11 @@ void GPU2D::UpdateMosaicCounters(u32 line) void GPU2D::VBlank() { - CaptureCnt &= ~(1<<31); + if (CaptureLatch) + { + CaptureCnt &= ~(1<<31); + CaptureLatch = false; + } DispFIFOReadPtr = 0; DispFIFOWritePtr = 0; diff --git a/src/GPU2D.h b/src/GPU2D.h index 132a1bc0..0f59ae36 100644 --- a/src/GPU2D.h +++ b/src/GPU2D.h @@ -110,6 +110,7 @@ protected: u8 EVA, EVB; u8 EVY; + bool CaptureLatch; u32 CaptureCnt; u16 MasterBrightness; diff --git a/src/GPU2D_Soft.cpp b/src/GPU2D_Soft.cpp index ecc5016e..7345af9c 100644 --- a/src/GPU2D_Soft.cpp +++ b/src/GPU2D_Soft.cpp @@ -213,6 +213,9 @@ void GPU2D_Soft::DrawScanline(u32 line) } } + if (line == 0 && CaptureCnt & (1 << 31)) + CaptureLatch = true; + // always render regular graphics DrawScanline_BGOBJ(line); UpdateMosaicCounters(line); @@ -278,7 +281,7 @@ void GPU2D_Soft::DrawScanline(u32 line) } // capture - if ((Num == 0) && (CaptureCnt & (1<<31))) + if ((Num == 0) && CaptureLatch) { u32 capwidth, capheight; switch ((CaptureCnt >> 20) & 0x3)