GB Video: Fix up timing after skipping BIOS

This commit is contained in:
Vicki Pfau 2020-05-13 19:58:23 -07:00
parent 9ddf82bebc
commit 7b34a0a63c
1 changed files with 7 additions and 1 deletions

View File

@ -218,10 +218,16 @@ void GBVideoSkipBIOS(struct GBVideo* video) {
video->mode = 1;
video->modeEvent.callback = _endMode1;
int32_t next;
if (video->p->model == GB_MODEL_CGB) {
video->ly = GB_VIDEO_VERTICAL_PIXELS;
video->p->memory.io[REG_LY] = video->ly;
video->stat = GBRegisterSTATClearLYC(video->stat);
next = 20;
} else {
video->ly = GB_VIDEO_VERTICAL_TOTAL_PIXELS;
video->p->memory.io[REG_LY] = 0;
next = 56;
}
video->stat = GBRegisterSTATSetMode(video->stat, video->mode);
@ -229,7 +235,7 @@ void GBVideoSkipBIOS(struct GBVideo* video) {
GBUpdateIRQs(video->p);
video->p->memory.io[REG_STAT] = video->stat;
mTimingDeschedule(&video->p->timing, &video->modeEvent);
mTimingSchedule(&video->p->timing, &video->modeEvent, GB_VIDEO_HORIZONTAL_LENGTH << video->p->doubleSpeed);
mTimingSchedule(&video->p->timing, &video->modeEvent, next);
}
void _endMode0(struct mTiming* timing, void* context, uint32_t cyclesLate) {