From 4c34e0a6e063ead12d89bb7e085e79d04702ba57 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sat, 1 Jun 2019 18:22:58 +0300 Subject: [PATCH] =?UTF-8?q?Turns=20out=20the=20AGB=20inverts=20Channel=203?= =?UTF-8?q?=E2=80=99s=20output?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/apu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Core/apu.c b/Core/apu.c index b4f4d752..d5537a6e 100644 --- a/Core/apu.c +++ b/Core/apu.c @@ -59,6 +59,11 @@ static void update_sample(GB_gameboy_t *gb, unsigned index, int8_t value, unsign unsigned right_volume = (gb->io_registers[GB_IO_NR50] & 7) + 1; unsigned left_volume = ((gb->io_registers[GB_IO_NR50] >> 4) & 7) + 1; + if (index == GB_WAVE) { + /* For some reason, channel 3 is inverted on the AGB */ + value ^= 0xF; + } + GB_sample_t output; if (gb->io_registers[GB_IO_NR51] & (1 << index)) { output.right = (0xf - value * 2) * right_volume;