Skip to content

armgit / gecko

Public Imported from GitHub
0

A GameCube/Wii emulator and debugger written in Rust.

fix accelerometer (tested on mario kart wii with ps5 controller)

Layle2b3ee1da0475
diff --git a/crates/gecko/src/hollywood/ipc/usb/wiimote.rs b/crates/gecko/src/hollywood/ipc/usb/wiimote.rs
index be6b70b..ca8edfe 100644
--- a/crates/gecko/src/hollywood/ipc/usb/wiimote.rs
+++ b/crates/gecko/src/hollywood/ipc/usb/wiimote.rs
@@ -321,11 +321,8 @@ impl WiimoteState {
pub(super) fn make_input_report(&self) -> Vec<u8> {
let [bb0, bb1] = self.button_bytes();
let accel = if self.sideways {
- [
- (2 * WIIMOTE_ACCEL_ZERO_G - self.accel[2] as i32).clamp(0, 255) as u8,
- self.accel[1],
- self.accel[0],
- ]
+ let flip = |v: u8| (2 * WIIMOTE_ACCEL_ZERO_G - v as i32).clamp(0, 255) as u8;
+ [flip(self.accel[2]), flip(self.accel[0]), self.accel[1]]
} else {
self.accel
};