From 0c8743b1f778ad95bb67bbf92cde6a9e47e938a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=B6glinger-Stelzer?= Date: Fri, 23 Jul 2021 21:47:15 +0200 Subject: [PATCH] Fixed XI rumble value calculation --- sys/DsHidMiniDrv.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sys/DsHidMiniDrv.c b/sys/DsHidMiniDrv.c index a988dcb9..391118cb 100644 --- a/sys/DsHidMiniDrv.c +++ b/sys/DsHidMiniDrv.c @@ -1112,8 +1112,18 @@ DsHidMini_WriteReport( // if (Packet->reportId == 0x00 && pDevCtx->Configuration.HidDeviceMode == DsHidMiniDeviceModeXInputHIDCompatible) { - DS3_SET_LARGE_RUMBLE_STRENGTH(pDevCtx, Packet->reportBuffer[3] / 100 * UCHAR_MAX); - DS3_SET_SMALL_RUMBLE_STRENGTH(pDevCtx, Packet->reportBuffer[4] / 100 * UCHAR_MAX); + UCHAR lm = (UCHAR)(Packet->reportBuffer[3] / 100.0f * 255.0f); + UCHAR rm = (UCHAR)(Packet->reportBuffer[4] / 100.0f * 255.0f); + + TraceVerbose( + TRACE_DSHIDMINIDRV, + "-- XI FFB LM: %d, RM: %d", + lm, + rm + ); + + DS3_SET_LARGE_RUMBLE_STRENGTH(pDevCtx, lm); + DS3_SET_SMALL_RUMBLE_STRENGTH(pDevCtx, rm); (void)Ds_SendOutputReport(pDevCtx, Ds3OutputReportSourceXInputHID);