sh4: fix TMU regression

introduced by 05d51cc35c
fixes SA2 running too fast
This commit is contained in:
Flyinghead 2021-08-29 11:55:42 +02:00
parent ce68a9c708
commit 93eff7fac6
1 changed files with 2 additions and 1 deletions

View File

@ -233,7 +233,8 @@ static int sched_tmu_cb(int ch, int sch_cycl, int jitter)
//schedule next trigger by writing the TCNT register
u32 tcor = TMU_TCOR(ch);
write_TMU_TCNTch(ch, std::max((s32)(tcor + tcnt), 0));
// Don't miss an underflow if tcor is less than -tcnt
write_TMU_TCNTch(ch, (u32)std::max<s64>((u64)tcor + (s32)tcnt, 0));
}
else {