From d490f9a013a1a76856dfc8f83e0b10637eab86f0 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Mon, 5 Oct 2015 19:21:21 -0700 Subject: [PATCH] GBA Video: Remove lastHblank, as it is implied --- CHANGES | 1 + src/gba/video.c | 8 ++------ src/gba/video.h | 1 - 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index 5e7e79100..bca461710 100644 --- a/CHANGES +++ b/CHANGES @@ -36,6 +36,7 @@ Misc: - GBA BIOS: Implement RegisterRamReset for SIO registers - GBA: Additional savestate sanity checks - All: Reset next event to cycles instead of zero to interrupt + - GBA Video: Remove lastHblank, as it is implied 0.3.0: (2015-08-16) Features: diff --git a/src/gba/video.c b/src/gba/video.c index 054476b51..2450ebb41 100644 --- a/src/gba/video.c +++ b/src/gba/video.c @@ -71,7 +71,6 @@ void GBAVideoReset(struct GBAVideo* video) { } video->p->memory.io[REG_VCOUNT >> 1] = video->vcount; - video->lastHblank = 0; video->nextHblank = VIDEO_HDRAW_LENGTH; video->nextEvent = video->nextHblank; video->eventDiff = 0; @@ -120,7 +119,6 @@ int32_t GBAVideoProcessEvents(struct GBAVideo* video, int32_t cycles) { video->eventDiff += cycles; if (video->nextEvent <= 0) { int32_t lastEvent = video->nextEvent; - video->lastHblank -= video->eventDiff; video->nextHblank -= video->eventDiff; video->nextHblankIRQ -= video->eventDiff; video->nextVcounterIRQ -= video->eventDiff; @@ -178,8 +176,7 @@ int32_t GBAVideoProcessEvents(struct GBAVideo* video, int32_t cycles) { } else { // Begin Hblank dispstat = GBARegisterDISPSTATFillInHblank(dispstat); - video->lastHblank = video->nextHblank; - video->nextEvent = video->lastHblank + VIDEO_HBLANK_LENGTH; + video->nextEvent = video->nextHblank + VIDEO_HBLANK_LENGTH; video->nextHblank = video->nextEvent + VIDEO_HDRAW_LENGTH; video->nextHblankIRQ = video->nextHblank; @@ -278,7 +275,7 @@ void GBAVideoSerialize(const struct GBAVideo* video, struct GBASerializedState* memcpy(state->pram, video->palette, SIZE_PALETTE_RAM); state->video.nextEvent = video->nextEvent; state->video.eventDiff = video->eventDiff; - state->video.lastHblank = video->lastHblank; + state->video.lastHblank = video->nextHblank - VIDEO_HBLANK_LENGTH; state->video.nextHblank = video->nextHblank; state->video.nextHblankIRQ = video->nextHblankIRQ; state->video.nextVblankIRQ = video->nextVblankIRQ; @@ -300,7 +297,6 @@ void GBAVideoDeserialize(struct GBAVideo* video, const struct GBASerializedState } video->nextEvent = state->video.nextEvent; video->eventDiff = state->video.eventDiff; - video->lastHblank = state->video.lastHblank; video->nextHblank = state->video.nextHblank; video->nextHblankIRQ = state->video.nextHblankIRQ; video->nextVblankIRQ = state->video.nextVblankIRQ; diff --git a/src/gba/video.h b/src/gba/video.h index 5250c123e..0be6b177e 100644 --- a/src/gba/video.h +++ b/src/gba/video.h @@ -185,7 +185,6 @@ struct GBAVideo { // VCOUNT int vcount; - int32_t lastHblank; int32_t nextHblank; int32_t nextEvent; int32_t eventDiff;