Emulation of NR43 bit 3 glitch on CGB-C and older

This commit is contained in:
Lior Halphon 2021-01-31 19:17:26 +02:00
parent d67580c964
commit 2d76698279
1 changed files with 9 additions and 1 deletions

View File

@ -1209,7 +1209,15 @@ void GB_apu_write(GB_gameboy_t *gb, uint8_t reg, uint8_t value)
} }
/* Step LFSR */ /* Step LFSR */
if (new_bit && (!old_bit || gb->model <= GB_MODEL_CGB_C)) { if (new_bit && (!old_bit || gb->model <= GB_MODEL_CGB_C)) {
if (gb->model <= GB_MODEL_CGB_C) {
bool previous_narrow = gb->apu.noise_channel.narrow;
gb->apu.noise_channel.narrow = true;
step_lfsr(gb, 0); step_lfsr(gb, 0);
gb->apu.noise_channel.narrow = previous_narrow;
}
else {
step_lfsr(gb, 0);
}
} }
break; break;
} }