From b5c350bc5bfdf3845779b430496712d7b6ebf004 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 17 May 2017 00:00:29 -0700 Subject: [PATCH] GB Video: Improved video timings (again) --- CHANGES | 1 + include/mgba/internal/gb/video.h | 6 +++--- src/gb/video.c | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 36f78ebdd..069d8fac6 100644 --- a/CHANGES +++ b/CHANGES @@ -117,6 +117,7 @@ Misc: - Core: Move rewind diffing to its own thread - Util: Tune patch-fast extent sizes - Qt: Relax hard dependency on OpenGL + - GB Video: Improved video timings 0.5.2: (2016-12-31) Bugfixes: diff --git a/include/mgba/internal/gb/video.h b/include/mgba/internal/gb/video.h index ce111662d..60534636b 100644 --- a/include/mgba/internal/gb/video.h +++ b/include/mgba/internal/gb/video.h @@ -20,9 +20,9 @@ enum { GB_VIDEO_VERTICAL_TOTAL_PIXELS = 154, // TODO: Figure out exact lengths - GB_VIDEO_MODE_2_LENGTH = 76, - GB_VIDEO_MODE_3_LENGTH_BASE = 171, - GB_VIDEO_MODE_0_LENGTH_BASE = 209, + GB_VIDEO_MODE_2_LENGTH = 80, + GB_VIDEO_MODE_3_LENGTH_BASE = 172, + GB_VIDEO_MODE_0_LENGTH_BASE = 204, GB_VIDEO_HORIZONTAL_LENGTH = 456, diff --git a/src/gb/video.c b/src/gb/video.c index 6b4ec735f..8794a953c 100644 --- a/src/gb/video.c +++ b/src/gb/video.c @@ -215,7 +215,7 @@ void _endMode2(struct mTiming* timing, void* context, uint32_t cyclesLate) { _cleanOAM(video, video->ly); video->x = 0; video->dotClock = timing->masterCycles - cyclesLate; - int32_t next = GB_VIDEO_MODE_3_LENGTH_BASE + video->objMax * 11 - (video->p->memory.io[REG_SCX] & 7); + int32_t next = GB_VIDEO_MODE_3_LENGTH_BASE + video->objMax * 6 - (video->p->memory.io[REG_SCX] & 7); video->mode = 3; video->modeEvent.callback = _endMode3; GBRegisterSTAT oldStat = video->stat; @@ -245,7 +245,7 @@ void _endMode3(struct mTiming* timing, void* context, uint32_t cyclesLate) { GBUpdateIRQs(video->p); } video->p->memory.io[REG_STAT] = video->stat; - int32_t next = GB_VIDEO_MODE_0_LENGTH_BASE - video->objMax * 11; + int32_t next = GB_VIDEO_MODE_0_LENGTH_BASE - video->objMax * 6; mTimingSchedule(timing, &video->modeEvent, (next << video->p->doubleSpeed) - cyclesLate); }