From 01f7036401816e53edb4ec3b1a733e5d51cd3f86 Mon Sep 17 00:00:00 2001 From: Jeffrey Pfau Date: Sat, 21 Feb 2015 10:58:24 -0800 Subject: [PATCH] GBA BIOS: Fix some regressions regarding signed 16-bit loads (fixes #196) --- src/gba/bios.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gba/bios.c b/src/gba/bios.c index 21987ae03..34c775bdc 100644 --- a/src/gba/bios.c +++ b/src/gba/bios.c @@ -129,8 +129,8 @@ static void _ObjAffineSet(struct GBA* gba) { while (i--) { // [ sx 0 ] [ cos(theta) -sin(theta) ] [ A B ] // [ 0 sy ] * [ sin(theta) cos(theta) ] = [ C D ] - sx = cpu->memory.load16(cpu, offset, 0) / 256.f; - sy = cpu->memory.load16(cpu, offset + 2, 0) / 256.f; + sx = (int16_t) cpu->memory.load16(cpu, offset, 0) / 256.f; + sy = (int16_t) cpu->memory.load16(cpu, offset + 2, 0) / 256.f; theta = (cpu->memory.load16(cpu, offset + 4, 0) >> 8) / 128.f * M_PI; offset += 8; // Rotation @@ -335,7 +335,7 @@ static void _unLz77(struct GBA* gba, int width) { while (bytes-- && remaining) { --remaining; if (width == 2) { - byte = cpu->memory.load16(cpu, disp & ~1, 0); + byte = (int16_t) cpu->memory.load16(cpu, disp & ~1, 0); if (dest & 1) { byte >>= (disp & 1) * 8; halfword |= byte << 8;