From c292aa16e8bcc2bfb96a2ac770d0b59732dd252a Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Mon, 7 Jan 2019 22:15:23 -0800 Subject: [PATCH] GBA BIOS: BitUnPack improvements --- CHANGES | 1 + src/gba/bios.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index ecbd0b5cc..d9f285676 100644 --- a/CHANGES +++ b/CHANGES @@ -64,6 +64,7 @@ Bugfixes: - GB Audio: Fix channel 1, 2 and 4 reset timing - Util: Fix wrapping edge cases in RingFIFO - GBA Hardware: Fix RTC handshake transition (fixes mgba.io/i/1134) + - GBA BIOS: Fix BitUnPack narrowing Misc: - GBA Timer: Use global cycles for timers - GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722) diff --git a/src/gba/bios.c b/src/gba/bios.c index ead5332c2..b696169b6 100644 --- a/src/gba/bios.c +++ b/src/gba/bios.c @@ -820,7 +820,6 @@ static void _unBitPack(struct GBA* gba) { in >>= sourceWidth; if (scaled || bias & 0x80000000) { scaled += bias & 0x7FFFFFFF; - scaled &= (1 << destWidth) - 1; } bitsRemaining -= sourceWidth; out |= scaled << bitsEaten; @@ -832,4 +831,6 @@ static void _unBitPack(struct GBA* gba) { dest += 4; } } + cpu->gprs[0] = source; + cpu->gprs[1] = dest; }