From 5482a8e75fe64ea3ccdbbe866bf041953af05cb5 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Tue, 3 Aug 2021 20:35:22 -0500 Subject: [PATCH] fix(apu): fix out of bounds error with channel 3 wave ram --- src/apu.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apu.rs b/src/apu.rs index f41b72e..2992bc1 100644 --- a/src/apu.rs +++ b/src/apu.rs @@ -663,7 +663,7 @@ pub(crate) struct Channel3 { impl BusIo for Channel3 { fn read_byte(&self, addr: u16) -> u8 { if self.enabled { - self.wave_ram[self.offset as usize] + self.wave_ram[self.offset as usize / 2] } else { self.wave_ram[(addr - Self::WAVE_RAM_START_ADDR) as usize] }