From 0ca1ee6a35ad217c92aeacd8ef430bf796895ac9 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Thu, 2 Sep 2021 01:29:38 +0300 Subject: [PATCH] Minor APU clean ups --- Core/apu.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Core/apu.c b/Core/apu.c index 02f010bb..4b81dcb5 100644 --- a/Core/apu.c +++ b/Core/apu.c @@ -1060,7 +1060,6 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value) if (!(value & 4) && !(((gb->apu.square_channels[index].sample_countdown - 1) / 2) & 0x400)) { gb->apu.square_channels[index].current_sample_index++; gb->apu.square_channels[index].current_sample_index &= 0x7; - gb->apu.is_active[index] = true; } /* Todo: verify with the schematics what's going on in here */ else if (gb->apu.square_channels[index].sample_length == 0x7FF && @@ -1171,7 +1170,7 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value) case GB_IO_NR34: gb->apu.wave_channel.sample_length &= 0xFF; gb->apu.wave_channel.sample_length |= (value & 7) << 8; - if ((value & 0x80)) { + if ((value & 0x80) && gb->apu.wave_channel.enable) { /* DMG bug: wave RAM gets corrupted if the channel is retriggerred 1 cycle before the APU reads from it. */ if (!GB_is_cgb(gb) && @@ -1233,10 +1232,6 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value) } } gb->apu.wave_channel.length_enabled = value & 0x40; - if (gb->apu.is_active[GB_WAVE] && !gb->apu.wave_channel.enable) { - gb->apu.is_active[GB_WAVE] = false; - update_sample(gb, GB_WAVE, 0, 0); - } break;