mirror of https://github.com/mgba-emu/mgba.git
GB Timer: Fix timing adjustments when writing to TAC (fixes #1340)
This commit is contained in:
parent
8796f75fd3
commit
3e178f3dd7
1
CHANGES
1
CHANGES
|
@ -17,6 +17,7 @@ Emulation fixes:
|
|||
- GBA DMA: Fix DMA0-2 lengths (fixes mgba.io/i/1344)
|
||||
- GB Video: Fix window y changing mid-window (fixes mgba.io/i/1345)
|
||||
- GB Video: Fix more window edge cases (fixes mgba.io/i/1346)
|
||||
- GB Timer: Fix timing adjustments when writing to TAC (fixes mgba.io/i/1340)
|
||||
Other fixes:
|
||||
- Qt: More app metadata fixes
|
||||
- Qt: Fix load recent from archive (fixes mgba.io/i/1325)
|
||||
|
|
|
@ -92,6 +92,10 @@ void GBTimerDivReset(struct GBTimer* timer) {
|
|||
|
||||
uint8_t GBTimerUpdateTAC(struct GBTimer* timer, GBRegisterTAC tac) {
|
||||
if (GBRegisterTACIsRun(tac)) {
|
||||
timer->nextDiv -= mTimingUntil(&timer->p->timing, &timer->event);
|
||||
mTimingDeschedule(&timer->p->timing, &timer->event);
|
||||
_GBTimerDivIncrement(timer, (timer->p->cpu->executionState + 2) & 3);
|
||||
|
||||
switch (GBRegisterTACGetClock(tac)) {
|
||||
case 0:
|
||||
timer->timaPeriod = 1024 >> 4;
|
||||
|
@ -107,9 +111,6 @@ uint8_t GBTimerUpdateTAC(struct GBTimer* timer, GBRegisterTAC tac) {
|
|||
break;
|
||||
}
|
||||
|
||||
timer->nextDiv -= mTimingUntil(&timer->p->timing, &timer->event);
|
||||
mTimingDeschedule(&timer->p->timing, &timer->event);
|
||||
_GBTimerDivIncrement(timer, (timer->p->cpu->executionState + 2) & 3);
|
||||
timer->nextDiv += GB_DMG_DIV_PERIOD;
|
||||
mTimingSchedule(&timer->p->timing, &timer->event, timer->nextDiv);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue