mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-22 02:38:11 +00:00
Merge pull request #5559 from Maschell/master
[WII U] Fix for Issue #5556 - Fixed using multiple HID devices with the same vid/pad simoustanly
This commit is contained in:
commit
3ba4ba5c42
@ -93,7 +93,7 @@ static const char* wiiu_joypad_name(unsigned pad)
|
||||
if (pad < MAX_PADS)
|
||||
{
|
||||
s32 hid_index = pad-HID_OFFSET;
|
||||
sprintf(hidName[hid_index],"HID %04X/%04X",hid_data[hid_index].device_info.vidpid.vid,hid_data[hid_index].device_info.vidpid.pid);
|
||||
sprintf(hidName[hid_index],"HID %04X/%04X(%02X)",hid_data[hid_index].device_info.vidpid.vid,hid_data[hid_index].device_info.vidpid.pid,hid_data[hid_index].pad);
|
||||
return hidName[hid_index];
|
||||
}
|
||||
|
||||
|
@ -773,16 +773,18 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::gettingInputAllDevices(Inp
|
||||
for(s32 i = 0;i < gHIDMaxDevices;i++){
|
||||
u8 * status = &output[result].status;
|
||||
*status = 0;
|
||||
if(connectionOrderHelper[i] != NULL){
|
||||
if(connectionOrderHelper[i].usr != NULL){
|
||||
*status = 1;
|
||||
|
||||
my_cb_user * usr = connectionOrderHelper[i];
|
||||
my_cb_user * usr = connectionOrderHelper[i].usr;
|
||||
pad_count[usr] = pad_count[usr] +1;
|
||||
s32 hid = usr->slotdata.hidmask;
|
||||
//printf("result[%d] usr: %08X\n",result,usr);
|
||||
|
||||
s32 realpad = pad_count[usr] - 1;
|
||||
s32 realpad = connectionOrderHelper[i].pad_slot;
|
||||
|
||||
//printf("result[%d] usr: %08X hid: %08X realpad: %08X\n",result,usr,hid,realpad);
|
||||
|
||||
output[result].pad = realpad;
|
||||
output[result].device_info.pad_count = usr->pads_per_device;
|
||||
output[result].device_info.slotdata = usr->slotdata;
|
||||
output[result].device_info.vidpid = usr->vidpid;
|
||||
|
@ -246,6 +246,12 @@ typedef struct _my_cb_user{
|
||||
DeviceVIDPIDInfo vidpid; /**< The VID/PID of the device */
|
||||
}my_cb_user;
|
||||
|
||||
|
||||
typedef struct _ConnectionHelper{
|
||||
my_cb_user* usr;
|
||||
u8 pad_slot;
|
||||
}ConnectionHelper;
|
||||
|
||||
/**
|
||||
* @brief Stores data for the mouse
|
||||
*/
|
||||
@ -366,6 +372,7 @@ typedef struct _InputStickData{
|
||||
typedef struct _InputData{
|
||||
DeviceInfo device_info; /**< Infos about the device where the data is coming from */
|
||||
u8 status;
|
||||
u8 pad;
|
||||
InputButtonData button_data;
|
||||
InputStickData stick_data;
|
||||
}InputData;
|
||||
|
@ -223,12 +223,15 @@ s32 ControllerPatcherHID::AttachDetachCallback(HIDClient *p_client, HIDDevice *p
|
||||
|
||||
for(s32 j = 0;j < pads_per_device; j++){
|
||||
for(s32 i = 0;i < gHIDMaxDevices; i++){
|
||||
if(connectionOrderHelper[i] == NULL){
|
||||
connectionOrderHelper[i] = usr;
|
||||
if(connectionOrderHelper[i].usr == NULL){
|
||||
connectionOrderHelper[i].usr = usr;
|
||||
connectionOrderHelper[i].pad_slot = pad_slot+j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
DCFlushRange(connectionOrderHelper,sizeof(connectionOrderHelper));
|
||||
DCInvalidateRange(connectionOrderHelper,sizeof(connectionOrderHelper));
|
||||
|
||||
if(HID_DEBUG){ printf("ControllerPatcherHID::AttachDetachCallback(line %d): Device successfully attached\n",__LINE__); }
|
||||
|
||||
@ -311,12 +314,15 @@ s32 ControllerPatcherHID::AttachDetachCallback(HIDClient *p_client, HIDDevice *p
|
||||
if(user_data){
|
||||
for(s32 j = 0;j < user_data->pads_per_device; j++){
|
||||
for(s32 i = 0;i < gHIDMaxDevices; i++){
|
||||
if(connectionOrderHelper[i] == user_data){
|
||||
connectionOrderHelper[i] = NULL;
|
||||
if(connectionOrderHelper[i].usr == user_data){
|
||||
connectionOrderHelper[i].usr = NULL;
|
||||
connectionOrderHelper[i].pad_slot = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
DCFlushRange(connectionOrderHelper,sizeof(connectionOrderHelper));
|
||||
DCInvalidateRange(connectionOrderHelper,sizeof(connectionOrderHelper));
|
||||
|
||||
config_controller[slotdata->deviceslot][CONTRPS_CONNECTED_PADS][1] &= ~ (1 << user_data->pad_slot);
|
||||
DCFlushRange(&config_controller[slotdata->deviceslot][CONTRPS_CONNECTED_PADS][1],sizeof(config_controller[slotdata->deviceslot][CONTRPS_CONNECTED_PADS][1]));
|
||||
|
@ -64,7 +64,7 @@ u8 gCallbackCooldown __attribute__((section(".data"))) = 0;
|
||||
|
||||
u8 gGlobalRumbleActivated __attribute__((section(".data"))) = 0;
|
||||
|
||||
my_cb_user * connectionOrderHelper[gHIDMaxDevices] __attribute__((section(".data")));
|
||||
ConnectionHelper connectionOrderHelper[gHIDMaxDevices] __attribute__((section(".data")));
|
||||
|
||||
u32 gUDPClientip __attribute__((section(".data"))) = 0;
|
||||
ControllerMappingPADInfo* gProPadInfo[4] __attribute__((section(".data"))) = {&gControllerMapping.proController[0].pad_infos[0],
|
||||
|
@ -68,7 +68,7 @@ extern wpad_sampling_callback_t gSamplingCallback;
|
||||
extern u8 gCallbackCooldown;
|
||||
extern u8 gGlobalRumbleActivated;
|
||||
|
||||
extern my_cb_user * connectionOrderHelper[gHIDMaxDevices];
|
||||
extern ConnectionHelper connectionOrderHelper[gHIDMaxDevices];
|
||||
|
||||
extern u32 gUDPClientip;
|
||||
extern ControllerMappingPADInfo* gProPadInfo[4];
|
||||
|
Loading…
Reference in New Issue
Block a user