GB Video: Delay LYC STAT check (fixes #1331)

This commit is contained in:
Vicki Pfau 2019-03-03 12:46:46 -08:00
parent 7233a28990
commit 1a007f6d28
2 changed files with 9 additions and 1 deletions

View File

@ -2,6 +2,7 @@
Bugfixes: Bugfixes:
- Qt: More app metadata fixes - Qt: More app metadata fixes
- Qt: Fix load recent from archive (fixes mgba.io/i/1325) - Qt: Fix load recent from archive (fixes mgba.io/i/1325)
- GB Video: Delay LYC STAT check (fixes mgba.io/i/1331)
Misc: Misc:
- Qt: Add missing HEVC NVENC option (fixes mgba.io/i/1323) - Qt: Add missing HEVC NVENC option (fixes mgba.io/i/1323)

View File

@ -224,7 +224,6 @@ void _endMode0(struct mTiming* timing, void* context, uint32_t cyclesLate) {
++video->ly; ++video->ly;
video->p->memory.io[REG_LY] = video->ly; video->p->memory.io[REG_LY] = video->ly;
GBRegisterSTAT oldStat = video->stat; GBRegisterSTAT oldStat = video->stat;
video->stat = GBRegisterSTATSetLYC(video->stat, lyc == video->ly);
if (video->ly < GB_VIDEO_VERTICAL_PIXELS) { if (video->ly < GB_VIDEO_VERTICAL_PIXELS) {
next = GB_VIDEO_MODE_2_LENGTH; next = GB_VIDEO_MODE_2_LENGTH;
video->mode = 2; video->mode = 2;
@ -246,6 +245,14 @@ void _endMode0(struct mTiming* timing, void* context, uint32_t cyclesLate) {
if (!_statIRQAsserted(video, oldStat) && _statIRQAsserted(video, video->stat)) { if (!_statIRQAsserted(video, oldStat) && _statIRQAsserted(video, video->stat)) {
video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT); video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT);
} }
// LYC stat is delayed 1 T-cycle
oldStat = video->stat;
video->stat = GBRegisterSTATSetLYC(video->stat, lyc == video->ly);
if (!_statIRQAsserted(video, oldStat) && _statIRQAsserted(video, video->stat)) {
video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT);
}
GBUpdateIRQs(video->p); GBUpdateIRQs(video->p);
video->p->memory.io[REG_STAT] = video->stat; video->p->memory.io[REG_STAT] = video->stat;
mTimingSchedule(timing, &video->modeEvent, (next << video->p->doubleSpeed) - cyclesLate); mTimingSchedule(timing, &video->modeEvent, (next << video->p->doubleSpeed) - cyclesLate);