From a20e8a82204c36f292c6d5bba12b5a10eceab3e6 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sat, 6 Jan 2018 12:17:06 +0200 Subject: [PATCH] Fixed bug in NR42 write that also caused memory corruption --- Core/apu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Core/apu.c b/Core/apu.c index 4e417d7..06eb979 100755 --- a/Core/apu.c +++ b/Core/apu.c @@ -718,7 +718,10 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value) } else if (gb->apu.is_active[GB_NOISE]){ nrx2_glitch(&gb->apu.noise_channel.current_volume, value, gb->io_registers[reg]); - update_square_sample(gb, GB_NOISE); + update_sample(gb, GB_NOISE, + (gb->apu.noise_channel.lfsr & 1) ? + gb->apu.noise_channel.current_volume : 0, + 0); } break; }