Skip to content

Commit 10801af

Browse files
committed
Fix PCM34 read accuracy on CGB-C and older
1 parent 69ed0fc commit 10801af

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Core/apu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ static void tick_noise_envelope(GB_gameboy_t *gb)
568568
if (!(nr42 & 7)) return;
569569

570570
if (gb->cgb_double_speed) {
571-
gb->apu.pcm_mask[0] &= (gb->apu.noise_channel.current_volume << 4) | (gb->model == GB_MODEL_CGB_0? 0x3F : 0x1F);
571+
gb->apu.pcm_mask[1] &= (gb->apu.noise_channel.current_volume << 4) | 0x1F;
572572
}
573573

574574
if (nr42 & 8) {
@@ -1023,7 +1023,7 @@ restart:;
10231023

10241024
/* Step LFSR */
10251025
if (new_bit && !old_bit) {
1026-
if (cycles_left == 0 && gb->apu.samples[GB_NOISE] == 0) {
1026+
if (cycles_left == 0 && gb->apu.samples[GB_NOISE] == 0 && !gb->cgb_double_speed) {
10271027
gb->apu.pcm_mask[1] &= 0x0F;
10281028
}
10291029
step_lfsr(gb, cycles - cycles_left);

0 commit comments

Comments
 (0)