GB Audio: Fix frame sequencer timing in double speed mode (fixes #2071)

This commit is contained in:
Vicki Pfau 2021-03-22 18:42:44 -07:00
parent 9eee7a7c7a
commit 601ece2e2a
1 changed files with 2 additions and 2 deletions

View File

@ -31,7 +31,7 @@ static void _GBTimerDivIncrement(struct GBTimer* timer, uint32_t cyclesLate) {
mTimingSchedule(&timer->p->timing, &timer->irq, 7 * tMultiplier - ((timer->p->cpu->executionState * tMultiplier - cyclesLate) & (3 * tMultiplier)));
}
}
unsigned timingFactor = 0x1FF;
unsigned timingFactor = (0x200 << timer->p->doubleSpeed) - 1;
if ((timer->internalDiv & timingFactor) == timingFactor) {
GBAudioUpdateFrame(&timer->p->audio);
}
@ -82,7 +82,7 @@ void GBTimerDivReset(struct GBTimer* timer) {
mTimingSchedule(&timer->p->timing, &timer->irq, (7 - (timer->p->cpu->executionState & 3)) * tMultiplier);
}
}
if (timer->internalDiv & 0x200) {
if (timer->internalDiv & (0x200 << timer->p->doubleSpeed)) {
GBAudioUpdateFrame(&timer->p->audio);
}
timer->p->memory.io[GB_REG_DIV] = 0;