mirror of
https://github.com/Maschell/controller_patcher.git
synced 2024-11-22 03:59:16 +01:00
Renamed the sleep functions, added option to disable rumble
This commit is contained in:
parent
5c7be021d0
commit
9119528a1b
@ -1049,3 +1049,13 @@ void ControllerPatcher::destroyConfigHelper(){
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::doSamplingForDeviceSlot(u16 device_slot){
|
||||
return ControllerPatcherUtils::doSampling(device_slot,0,true);
|
||||
}
|
||||
|
||||
CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::setRumbleActivated(bool value){
|
||||
gGlobalRumbleActivated = value;
|
||||
return CONTROLLER_PATCHER_ERROR_NONE;
|
||||
}
|
||||
|
||||
bool ControllerPatcher::isRumbleActivated(){
|
||||
return gGlobalRumbleActivated;
|
||||
}
|
||||
|
||||
|
@ -238,6 +238,10 @@ class ControllerPatcher{
|
||||
static void destroyConfigHelper();
|
||||
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR doSamplingForDeviceSlot(u16 device_slot);
|
||||
|
||||
static CONTROLLER_PATCHER_RESULT_OR_ERROR setRumbleActivated(bool value);
|
||||
|
||||
static bool isRumbleActivated();
|
||||
};
|
||||
|
||||
#endif /* _CONTROLLER_PATCHER_H_ */
|
||||
|
@ -123,7 +123,7 @@ s32 TCPServer::RunTCP(){
|
||||
ret = ControllerPatcherNet::checkbyte(clientfd);
|
||||
if (ret < 0) {
|
||||
if(wiiu_errno != 6) return ret;
|
||||
usleep(1000);
|
||||
os_usleep(1000);
|
||||
continue;
|
||||
}
|
||||
//log_printf("got byte from tcp! %01X\n",ret);
|
||||
@ -280,7 +280,7 @@ s32 TCPServer::RunTCP(){
|
||||
|
||||
void TCPServer::ErrorHandling(){
|
||||
CloseSockets();
|
||||
usleep(1000*1000*2);
|
||||
os_usleep(1000*1000*2);
|
||||
}
|
||||
|
||||
void TCPServer::DoTCPThreadInternal(){
|
||||
|
@ -102,7 +102,7 @@ void UDPServer::DoUDPThreadInternal(){
|
||||
n = recv(sockfd,buffer,MAX_UDP_SIZE,0);
|
||||
if (n < 0){
|
||||
s32 errno_ = wiiu_errno;
|
||||
usleep(2000);
|
||||
os_usleep(2000);
|
||||
if(errno_ != 11 && errno_ != 9){
|
||||
break;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ void ControllerPatcherHID::myHIDReadCallback(u32 handle, s32 error, unsigned cha
|
||||
HIDReadCallback(handle,buf,bytes_transfered,usr);
|
||||
|
||||
if(usr->slotdata.hidmask == gHID_LIST_DS4){
|
||||
usleep(1000*2); //DS4 is way tooo fast. sleeping to reduce lag. (need to check the other pads)
|
||||
os_usleep(1000*2); //DS4 is way tooo fast. sleeping to reduce lag. (need to check the other pads)
|
||||
}
|
||||
HIDRead(handle, usr->buf, bytes_transfered, myHIDReadCallback, usr);
|
||||
}
|
||||
@ -605,6 +605,8 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherHID::getHIDData(u32 hidmask,
|
||||
|
||||
void ControllerPatcherHID::HIDGCRumble(u32 handle,my_cb_user *usr){
|
||||
if(usr == NULL) return;
|
||||
if(!ControllerPatcher::isRumbleActivated()) return;
|
||||
|
||||
s32 rumblechanged = 0;
|
||||
|
||||
for(s32 i = 0;i<HID_GC_PAD_COUNT;i++){
|
||||
@ -625,6 +627,7 @@ void ControllerPatcherHID::HIDGCRumble(u32 handle,my_cb_user *usr){
|
||||
|
||||
void ControllerPatcherHID::HIDRumble(u32 handle,my_cb_user *usr,u32 pad){
|
||||
if(usr == NULL || pad > HID_MAX_PADS_COUNT) return;
|
||||
if(!ControllerPatcher::isRumbleActivated()) return;
|
||||
|
||||
s32 rumblechanged = 0;
|
||||
HID_Data * data_ptr = &(gHID_Devices[usr->slotdata.deviceslot].pad_data[pad]);
|
||||
|
@ -65,6 +65,8 @@ wpad_extension_callback_t gExtensionCallback[4] __attribute__((section(".data"))
|
||||
wpad_sampling_callback_t gSamplingCallback __attribute__((section(".data"))) = 0;
|
||||
u8 gCallbackCooldown __attribute__((section(".data"))) = 0;
|
||||
|
||||
u8 gGlobalRumbleActivated __attribute__((section(".data"))) = 0;
|
||||
|
||||
u32 gUDPClientip __attribute__((section(".data"))) = 0;
|
||||
ControllerMappingPADInfo* gProPadInfo[4] __attribute__((section(".data"))) = {&gControllerMapping.proController[0].pad_infos[0],
|
||||
&gControllerMapping.proController[1].pad_infos[0],
|
||||
|
@ -66,6 +66,7 @@ extern wpad_connect_callback_t gKPADConnectCallback[4];
|
||||
extern wpad_extension_callback_t gExtensionCallback[4];
|
||||
extern wpad_sampling_callback_t gSamplingCallback;
|
||||
extern u8 gCallbackCooldown;
|
||||
extern u8 gGlobalRumbleActivated;
|
||||
|
||||
extern u32 gUDPClientip;
|
||||
extern ControllerMappingPADInfo* gProPadInfo[4];
|
||||
|
Loading…
Reference in New Issue
Block a user