From 7643e45212f5ad4a405de53348dc697017df086a Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Fri, 19 Aug 2016 19:14:56 -0700 Subject: [PATCH] GB: Fix reset not working properly --- src/gb/gb.c | 6 +++--- src/gb/video.c | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gb/gb.c b/src/gb/gb.c index 9d050867f..99a0f1b72 100644 --- a/src/gb/gb.c +++ b/src/gb/gb.c @@ -65,9 +65,6 @@ static void GBInit(void* cpu, struct mCPUComponent* component) { gb->yankedRomSize = 0; gb->stream = NULL; - - gb->eiPending = INT_MAX; - gb->doubleSpeed = 0; } bool GBLoadROM(struct GB* gb, struct VFile* vf) { @@ -245,6 +242,9 @@ void GBReset(struct LR35902Core* cpu) { cpu->b = 0; cpu->d = 0; + gb->eiPending = INT_MAX; + gb->doubleSpeed = 0; + cpu->memory.setActiveRegion(cpu, cpu->pc); if (gb->yankedRomSize) { diff --git a/src/gb/video.c b/src/gb/video.c index 14ddd2082..d439953bf 100644 --- a/src/gb/video.c +++ b/src/gb/video.c @@ -43,6 +43,7 @@ void GBVideoInit(struct GBVideo* video) { void GBVideoReset(struct GBVideo* video) { video->ly = 0; + video->x = 0; video->mode = 1; video->stat = 1;