Fixed overflow panic

Former-commit-id: 849c5917d53e91eecb3aaa7954f04362ae06b8cd
Former-commit-id: 056dbfa5911d74fb1fa5d99cbe47a642cc4edbd9
This commit is contained in:
Keny C 2024-01-06 22:33:47 +01:00 committed by MichelOS
parent e4e2c710be
commit cb64e01794

View file

@ -215,7 +215,7 @@ impl GameBoyAdvance {
pub fn frame(&mut self) {
static mut OVERSHOOT: usize = 0;
unsafe {
OVERSHOOT = CYCLES_FULL_REFRESH - self.run::<false>(CYCLES_FULL_REFRESH - OVERSHOOT);
OVERSHOOT = CYCLES_FULL_REFRESH.saturating_sub(self.run::<false>(CYCLES_FULL_REFRESH - OVERSHOOT));
}
}
@ -223,7 +223,7 @@ impl GameBoyAdvance {
fn frame_interruptible(&mut self) {
static mut OVERSHOOT: usize = 0;
unsafe {
OVERSHOOT = CYCLES_FULL_REFRESH - self.run::<true>(CYCLES_FULL_REFRESH - OVERSHOOT);
OVERSHOOT = CYCLES_FULL_REFRESH.saturating_sub(self.run::<true>(CYCLES_FULL_REFRESH - OVERSHOOT));
}
}