GBA GPIO: Fix tilt scale and orientation (fixes #2703)

This commit is contained in:
Vicki Pfau 2023-07-23 22:47:47 -07:00
parent 5f35899ba3
commit 02ba4f2499
2 changed files with 3 additions and 2 deletions

View File

@ -17,6 +17,7 @@ Emulation fixes:
- GBA: Unhandled bkpt should be treated as an undefined exception
- 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)
- GBA Video: Disable BG target 1 blending when OBJ blending (fixes mgba.io/i/2722)

View File

@ -423,8 +423,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);
}