From 837908290eb99ce65719ccae468dfa6f2cd10204 Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 14 Apr 2017 16:49:21 +0200 Subject: [PATCH] Attempted to make the GC-Rumble working more reliable --- patcher/ControllerPatcherHID.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/patcher/ControllerPatcherHID.cpp b/patcher/ControllerPatcherHID.cpp index 17ed39d..fe3e4b8 100644 --- a/patcher/ControllerPatcherHID.cpp +++ b/patcher/ControllerPatcherHID.cpp @@ -491,19 +491,22 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherHID::getHIDData(u32 hidmask, void ControllerPatcherHID::HIDGCRumble(u32 handle,my_cb_user *usr){ + if(usr == NULL) return; s32 rumblechanged = 0; - for(s32 i = 0;islotdata.deviceslot].pad_data[i]); if(data_ptr->rumbleActive != usr->rumblestatus[i]){ - usr->rumblestatus[i] = data_ptr->rumbleActive; - usr->buf[i+1] = usr->rumblestatus[i]; rumblechanged = 1; } + usr->rumblestatus[i] = data_ptr->rumbleActive; + usr->buf[i+1] = usr->rumblestatus[i]; } - if(rumblechanged){ - usr->buf[0] = 0x11; - HIDWrite(handle, usr->buf, 5, NULL, NULL); + usr->rumbleForce[0]--; + if(rumblechanged || usr->rumbleForce[0] <= 0){ + usr->buf[0] = 0x11; + HIDWrite(handle, usr->buf, 5, NULL, NULL); + usr->rumbleForce[0] = 10; } }