diff --git a/src/core/gba.rs b/src/core/gba.rs index d9981c4..b80fe4e 100644 --- a/src/core/gba.rs +++ b/src/core/gba.rs @@ -111,15 +111,7 @@ impl GameBoyAdvance { io.timers.step(cycles, &mut self.sysbus, &mut irqs); - if let Some(new_gpu_state) = io.gpu.step(cycles, &mut self.sysbus, &mut irqs) { - match new_gpu_state { - GpuState::VBlank => { - io.dmac.notify_vblank(); - } - GpuState::HBlank => io.dmac.notify_hblank(), - _ => {} - } - } + io.gpu.step(cycles, &mut self.sysbus, &mut irqs); io.intc.request_irqs(irqs); io.sound.update(self.cpu.cycles); diff --git a/src/core/gpu/mod.rs b/src/core/gpu/mod.rs index 5a9d140..9e5d911 100644 --- a/src/core/gpu/mod.rs +++ b/src/core/gpu/mod.rs @@ -472,7 +472,7 @@ impl Gpu { cycles: usize, sb: &mut SysBus, irqs: &mut IrqBitmask, - ) -> Option { + ) { self.cycles += cycles; match self.state { @@ -485,7 +485,7 @@ impl Gpu { irqs.set_LCD_HBlank(true); }; self.state = HBlank; - return Some(HBlank); + sb.io.dmac.notify_hblank(); } } HBlank => { @@ -498,14 +498,13 @@ impl Gpu { if self.current_scanline < DISPLAY_HEIGHT { self.render_scanline(sb); self.state = HDraw; - return Some(HDraw); } else { self.state = VBlank; self.dispstat.set_vblank_flag(true); if self.dispstat.vblank_irq_enable() { irqs.set_LCD_VBlank(true); }; - return Some(VBlank); + sb.io.dmac.notify_vblank(); } } } @@ -515,19 +514,15 @@ impl Gpu { if self.current_scanline < DISPLAY_HEIGHT + VBLANK_LINES - 1 { self.update_vcount(self.current_scanline + 1, irqs); - return None; } else { self.update_vcount(0, irqs); self.dispstat.set_vblank_flag(false); self.render_scanline(sb); self.state = HDraw; - return Some(self.state); } } } } - - return None; } }