git.y1.nz

SameBoy

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

commit a9c337264e783f234252929da3aeae089a1df8e2
parent b54a72d9b9a72dc243cd37216b3adb4c99511a44
Author: Lior Halphon <LIJI32@gmail.com>
Date:   Sat,  2 Jan 2021 16:23:34 +0200

Fix the last remaining APU test

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

diff --git a/Core/apu.c b/Core/apu.c @@ -821,7 +821,7 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value) case GB_IO_NR14: case GB_IO_NR24: { unsigned index = reg == GB_IO_NR24? GB_SQUARE_2: GB_SQUARE_1; - + bool was_active = gb->apu.is_active[index]; /* TODO: When the sample length changes right before being updated, the countdown should change to the old length, but the current sample should not change. Because our write timing isn't accurate to the T-cycle, we hack around it by stepping the sample index backwards. */ @@ -876,7 +876,7 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value) /* APU bug: if shift is nonzero, overflow check also occurs on trigger */ gb->apu.square_sweep_calculate_countdown = (gb->io_registers[GB_IO_NR10] & 0x7) * 2 + 5 - gb->apu.lf_div; gb->apu.unshifted_sweep = false; - if (gb->model > GB_MODEL_CGB_C) { + if (gb->model > GB_MODEL_CGB_C && !was_active) { gb->apu.square_sweep_calculate_countdown += 2; } gb->apu.sweep_length_addend = gb->apu.square_channels[GB_SQUARE_1].sample_length;

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