Reset timers when enabling them (fixes #78)

This commit is contained in:
Jeffrey Pfau 2014-07-02 00:48:20 -07:00
parent 2693f9d09b
commit e5245b6cbb
1 changed files with 1 additions and 0 deletions

View File

@ -434,6 +434,7 @@ void GBATimerWriteTMCNT_HI(struct GBA* gba, int timer, uint16_t control) {
} }
gba->memory.io[(REG_TM0CNT_LO + (timer << 2)) >> 1] = currentTimer->reload; gba->memory.io[(REG_TM0CNT_LO + (timer << 2)) >> 1] = currentTimer->reload;
currentTimer->oldReload = currentTimer->reload; currentTimer->oldReload = currentTimer->reload;
currentTimer->lastEvent = 0;
gba->timersEnabled |= 1 << timer; gba->timersEnabled |= 1 << timer;
} else if (wasEnabled && !currentTimer->enable) { } else if (wasEnabled && !currentTimer->enable) {
if (!currentTimer->countUp) { if (!currentTimer->countUp) {