Skip to content

Commit

Permalink
Fixed overflow panic
Browse files Browse the repository at this point in the history
  • Loading branch information
Keny C authored and michelhe committed Feb 11, 2024
1 parent 1dfdec3 commit 27d5653
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/gba.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,15 @@ 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));
}
}

/// like frame() but stop if a breakpoint is reached
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));
}
}

Expand Down

0 comments on commit 27d5653

Please sign in to comment.