From 886363b398e739303be8d8133387fe0648b4d70b Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sun, 17 Oct 2021 12:52:08 +0300 Subject: [PATCH] Now this glitch makes more sense --- Core/apu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/apu.c b/Core/apu.c index c337aed..dc13e20 100644 --- a/Core/apu.c +++ b/Core/apu.c @@ -1159,10 +1159,10 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value) if (gb->apu.is_active[GB_WAVE]) { // Todo: I assume this happens on pre-CGB models; test this with an audible test if (gb->apu.wave_channel.sample_countdown == 0 && gb->model < GB_MODEL_AGB) { - gb->apu.wave_channel.current_sample_byte = gb->io_registers[GB_IO_WAV_START + 5]; // what the actual fuck? Why specifically this wave address ? + gb->apu.wave_channel.current_sample_byte = gb->io_registers[GB_IO_WAV_START + (gb->pc & 0xF)]; } else if (gb->apu.wave_channel.wave_form_just_read && gb->model <= GB_MODEL_CGB_C) { - gb->apu.wave_channel.current_sample_byte = gb->io_registers[GB_IO_WAV_START + 0xA]; // what the actual fuck? Why specifically this wave address? + gb->apu.wave_channel.current_sample_byte = gb->io_registers[GB_IO_WAV_START + (GB_IO_NR30 & 0xF) ]; } } gb->apu.is_active[GB_WAVE] = false;