From ee9dc44059dd47cfce8ec3382d05310ec30cbc0b Mon Sep 17 00:00:00 2001 From: Megamouse Date: Thu, 11 Dec 2025 19:34:14 +0100 Subject: [PATCH] ps_move_handler: fix decoding of ZCM1 sensor values --- rpcs3/Input/ps_move_handler.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/rpcs3/Input/ps_move_handler.cpp b/rpcs3/Input/ps_move_handler.cpp index 4c5f34a309..cbb4613b6f 100644 --- a/rpcs3/Input/ps_move_handler.cpp +++ b/rpcs3/Input/ps_move_handler.cpp @@ -685,12 +685,19 @@ void ps_move_handler::get_extended_info(const pad_ensemble& binding) if (dev->model == ps_move_model::ZCM1) { - accel_x -= static_cast(zero_shift); - accel_y -= static_cast(zero_shift); - accel_z -= static_cast(zero_shift); - gyro_x -= static_cast(zero_shift); - gyro_y -= static_cast(zero_shift); - gyro_z -= static_cast(zero_shift); + const auto decode_16bit = [](s16 val) + { + const u8* data = reinterpret_cast(&val); + const u8 low = data[0] & 0xFF; + const u8 high = data[1] & 0xFF; + return (low | (high << 8)) - zero_shift; + }; + accel_x = decode_16bit(input.accel_x_1); + accel_y = decode_16bit(input.accel_y_1); + accel_z = decode_16bit(input.accel_z_1); + gyro_x = decode_16bit(input.gyro_x_1); + gyro_y = decode_16bit(input.gyro_y_1); + gyro_z = decode_16bit(input.gyro_z_1); } if (!device->config || !device->config->orientation_enabled)