diff --git a/CHANGES b/CHANGES index 8696acd5d..be86026f9 100644 --- a/CHANGES +++ b/CHANGES @@ -8,6 +8,7 @@ Emulation fixes: - GB SIO: Disabling SIO should cancel pending transfers (fixes mgba.io/i/2537) - GBA Audio: Fix sample timing drifting when changing sample interval - GBA Audio: Fix initial channel 3 wave RAM (fixes mgba.io/i/2947) + - GBA GPIO: Fix tilt scale and orientation (fixes mgba.io/i/2703) - GBA BIOS: Fix clobbering registers with word-sized CpuSet - GBA SIO: Fix normal mode SI/SO semantics (fixes mgba.io/i/2925) Other fixes: diff --git a/src/gba/cart/gpio.c b/src/gba/cart/gpio.c index 0bb7f3429..a5397ff98 100644 --- a/src/gba/cart/gpio.c +++ b/src/gba/cart/gpio.c @@ -421,8 +421,8 @@ void GBAHardwareTiltWrite(struct GBACartridgeHardware* hw, uint32_t address, uin int32_t x = rotationSource->readTiltX(rotationSource); int32_t y = rotationSource->readTiltY(rotationSource); // Normalize to ~12 bits, focused on 0x3A0 - hw->tiltX = (x >> 21) + 0x3A0; // Crop off an extra bit so that we can't go negative - hw->tiltY = (y >> 21) + 0x3A0; + hw->tiltX = 0x3A0 - (x >> 22); + hw->tiltY = 0x3A0 - (y >> 22); } else { mLOG(GBA_HW, GAME_ERROR, "Tilt sensor wrote wrong byte to %04x: %02x", address, value); }