mirror of https://github.com/mgba-emu/mgba.git
GBA GPIO: Fix tilt scale and orientation (fixes #2703)
This commit is contained in:
parent
5f35899ba3
commit
02ba4f2499
1
CHANGES
1
CHANGES
|
@ -17,6 +17,7 @@ Emulation fixes:
|
||||||
- GBA: Unhandled bkpt should be treated as an undefined exception
|
- GBA: Unhandled bkpt should be treated as an undefined exception
|
||||||
- GBA Audio: Fix sample timing drifting when changing sample interval
|
- GBA Audio: Fix sample timing drifting when changing sample interval
|
||||||
- GBA Audio: Fix initial channel 3 wave RAM (fixes mgba.io/i/2947)
|
- 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 BIOS: Fix clobbering registers with word-sized CpuSet
|
||||||
- GBA SIO: Fix normal mode SI/SO semantics (fixes mgba.io/i/2925)
|
- 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)
|
- GBA Video: Disable BG target 1 blending when OBJ blending (fixes mgba.io/i/2722)
|
||||||
|
|
|
@ -423,8 +423,8 @@ void GBAHardwareTiltWrite(struct GBACartridgeHardware* hw, uint32_t address, uin
|
||||||
int32_t x = rotationSource->readTiltX(rotationSource);
|
int32_t x = rotationSource->readTiltX(rotationSource);
|
||||||
int32_t y = rotationSource->readTiltY(rotationSource);
|
int32_t y = rotationSource->readTiltY(rotationSource);
|
||||||
// Normalize to ~12 bits, focused on 0x3A0
|
// 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->tiltX = 0x3A0 - (x >> 22);
|
||||||
hw->tiltY = (y >> 21) + 0x3A0;
|
hw->tiltY = 0x3A0 - (y >> 22);
|
||||||
} else {
|
} else {
|
||||||
mLOG(GBA_HW, GAME_ERROR, "Tilt sensor wrote wrong byte to %04x: %02x", address, value);
|
mLOG(GBA_HW, GAME_ERROR, "Tilt sensor wrote wrong byte to %04x: %02x", address, value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue