Skip to content

Commit

Permalink
GBA Timers: Cascading timers don't tick when disabled (fixes #2812)
Browse files Browse the repository at this point in the history
  • Loading branch information
endrift committed Feb 3, 2023
1 parent e95bd06 commit e470795
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Emulation fixes:
- GBA Audio: Fix improperly deserializing GB audio registers (fixes mgba.io/i/2793)
- GBA Memory: Make VRAM access stalls only apply to BG RAM
- GBA SIO: Fix SIOCNT SI pin value after attaching player 2 (fixes mgba.io/i/2805)
- GBA Timers: Cascading timers don't tick when disabled (fixes mgba.io/i/2812)
- GBA Video: Disable BG target 1 blending when OBJ blending (fixes mgba.io/i/2722)
Other fixes:
- Core: Allow sending thread requests to a crashed core (fixes mgba.io/i/2784)
Expand Down
2 changes: 1 addition & 1 deletion src/gba/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static void GBATimerUpdate(struct GBA* gba, int timerId, uint32_t cyclesLate) {

if (timerId < 3) {
struct GBATimer* nextTimer = &gba->timers[timerId + 1];
if (GBATimerFlagsIsCountUp(nextTimer->flags)) { // TODO: Does this increment while disabled?
if (GBATimerFlagsIsCountUp(nextTimer->flags) && GBATimerFlagsIsEnable(nextTimer->flags)) {
++gba->memory.io[REG_TMCNT_LO(timerId + 1) >> 1];
if (!gba->memory.io[REG_TMCNT_LO(timerId + 1) >> 1] && GBATimerFlagsIsEnable(nextTimer->flags)) {
GBATimerUpdate(gba, timerId + 1, cyclesLate);
Expand Down

0 comments on commit e470795

Please sign in to comment.