all repos — mgba @ c6cd179101609c5b15d512a1d953032b631cccfe

mGBA Game Boy Advance Emulator

Fix scanline rendering when parameters change mid-scanline
Jeffrey Pfau jeffrey@endrift.com
Sat, 19 Jul 2014 15:59:27 -0700
commit

c6cd179101609c5b15d512a1d953032b631cccfe

parent

79301a365f7f9fb58ca91beba38e4b413d0a9d56

1 files changed, 5 insertions(+), 5 deletions(-)

jump to
M src/gba/gba-video.csrc/gba/gba-video.c

@@ -38,7 +38,7 @@ video->hblankIRQ = 0;

video->vcounterIRQ = 0; video->vcountSetting = 0; - video->vcount = -1; + video->vcount = 0; video->lastHblank = 0; video->nextHblank = VIDEO_HDRAW_LENGTH;

@@ -124,10 +124,6 @@ if (video->vcounter && video->vcounterIRQ) {

GBARaiseIRQ(video->p, IRQ_VCOUNTER); video->nextVcounterIRQ += VIDEO_TOTAL_LENGTH; } - - if (video->vcount < VIDEO_VERTICAL_PIXELS && GBASyncDrawingFrame(video->p->sync)) { - video->renderer->drawScanline(video->renderer, video->vcount); - } } else { // Begin Hblank video->inHblank = 1;

@@ -135,6 +131,10 @@ video->lastHblank = video->nextHblank;

video->nextEvent = video->lastHblank + VIDEO_HBLANK_LENGTH; video->nextHblank = video->nextEvent + VIDEO_HDRAW_LENGTH; video->nextHblankIRQ = video->nextHblank; + + if (video->vcount < VIDEO_VERTICAL_PIXELS && GBASyncDrawingFrame(video->p->sync)) { + video->renderer->drawScanline(video->renderer, video->vcount); + } if (video->vcount < VIDEO_VERTICAL_PIXELS) { GBAMemoryRunHblankDMAs(video->p, lastEvent);