aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-06-26 13:39:42 +0200
committerStapleButter <thetotalworm@gmail.com>2017-06-26 13:39:42 +0200
commitfbc6ce5fa0cb0dcec3dfa2445d36efa455b75107 (patch)
tree5041ae03a4ddeb529bbe96523e633b66f64b74e6 /src
parent4afac282630317ae84c2060e6e62359987894701 (diff)
fix render/capture order, corrects interaction of capture and VRAM display. fixes #56.
Diffstat (limited to 'src')
-rw-r--r--src/GPU2D.cpp43
1 files changed, 24 insertions, 19 deletions
diff --git a/src/GPU2D.cpp b/src/GPU2D.cpp
index b0f1815..c3e4034 100644
--- a/src/GPU2D.cpp
+++ b/src/GPU2D.cpp
@@ -399,6 +399,7 @@ void GPU2D::Write32(u32 addr, u32 val)
void GPU2D::DrawScanline(u32 line)
{
u32* dst = &Framebuffer[256*line];
+ u32 mode1gfx[256];
// request each 3D scanline in advance
// this is required for the threaded mode of the software renderer
@@ -422,23 +423,7 @@ void GPU2D::DrawScanline(u32 line)
dispmode &= (Num ? 0x1 : 0x3);
// always render regular graphics
- DrawScanline_Mode1(line, dst);
-
- // capture
- if ((Num == 0) && (CaptureCnt & (1<<31)))
- {
- u32 capwidth, capheight;
- switch ((CaptureCnt >> 20) & 0x3)
- {
- case 0: capwidth = 128; capheight = 128; break;
- case 1: capwidth = 256; capheight = 64; break;
- case 2: capwidth = 256; capheight = 128; break;
- case 3: capwidth = 256; capheight = 192; break;
- }
-
- if (line < capheight)
- DoCapture(line, capwidth, dst);
- }
+ DrawScanline_Mode1(line, mode1gfx);
switch (dispmode)
{
@@ -449,7 +434,11 @@ void GPU2D::DrawScanline(u32 line)
}
break;
- case 1: // regular display, already taken care of
+ case 1: // regular display
+ {
+ for (int i = 0; i < 256; i++)
+ dst[i] = mode1gfx[i];
+ }
break;
case 2: // VRAM display
@@ -480,7 +469,7 @@ void GPU2D::DrawScanline(u32 line)
}
break;
- case 3: // FIFO display (grossly inaccurate)
+ case 3: // FIFO display
{
for (int i = 0; i < 256; i++)
{
@@ -495,6 +484,22 @@ void GPU2D::DrawScanline(u32 line)
break;
}
+ // capture
+ if ((Num == 0) && (CaptureCnt & (1<<31)))
+ {
+ u32 capwidth, capheight;
+ switch ((CaptureCnt >> 20) & 0x3)
+ {
+ case 0: capwidth = 128; capheight = 128; break;
+ case 1: capwidth = 256; capheight = 64; break;
+ case 2: capwidth = 256; capheight = 128; break;
+ case 3: capwidth = 256; capheight = 192; break;
+ }
+
+ if (line < capheight)
+ DoCapture(line, capwidth, mode1gfx);
+ }
+
// master brightness
if (dispmode != 0)
{