git.y1.nz

SameBoy

Accurate GB/GBC emulator
download: https://git.y1.nz/archives/sameboy.tar.gz
README | Files | Log | Refs | LICENSE

commit 10801af8e3d633bbc097b7ca8e6a9994c32b33d4
parent 69ed0fcf9c2bbb2ac84226ecea49d45fcf6af33a
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Thu, 16 Oct 2025 00:23:28 +0300

Fix PCM34 read accuracy on CGB-C and older

Diffstat:
MCore/apu.c4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Core/apu.c b/Core/apu.c @@ -568,7 +568,7 @@ static void tick_noise_envelope(GB_gameboy_t *gb) if (!(nr42 & 7)) return; if (gb->cgb_double_speed) { - gb->apu.pcm_mask[0] &= (gb->apu.noise_channel.current_volume << 4) | (gb->model == GB_MODEL_CGB_0? 0x3F : 0x1F); + gb->apu.pcm_mask[1] &= (gb->apu.noise_channel.current_volume << 4) | 0x1F; } if (nr42 & 8) { @@ -1023,7 +1023,7 @@ restart:; /* Step LFSR */ if (new_bit && !old_bit) { - if (cycles_left == 0 && gb->apu.samples[GB_NOISE] == 0) { + if (cycles_left == 0 && gb->apu.samples[GB_NOISE] == 0 && !gb->cgb_double_speed) { gb->apu.pcm_mask[1] &= 0x0F; } step_lfsr(gb, cycles - cycles_left);

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.