Fixed using mutliple controller with the same vid/pid

This commit is contained in:
Maschell 2017-04-02 19:05:31 +02:00
parent f98014f354
commit 215f6952a6
3 changed files with 4 additions and 3 deletions

View File

@ -691,7 +691,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcher::gettingInputAllDevices(Inp
int buttons_hold = 0; int buttons_hold = 0;
for(int pad = 0;pad<deviceinfo->pad_count;pad++){ for(int pad = 0;pad<HID_MAX_PADS_COUNT;pad++){
buttons_hold = 0; buttons_hold = 0;
buttondata[pad].btn_h = 0; buttondata[pad].btn_h = 0;
buttondata[pad].btn_d = 0; buttondata[pad].btn_d = 0;

View File

@ -471,8 +471,9 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherHID::getHIDData(int hidmask,
if(device_slot < 0){ if(device_slot < 0){
return CONTROLLER_PATCHER_ERROR_DEVICE_SLOT_NOT_FOUND; return CONTROLLER_PATCHER_ERROR_DEVICE_SLOT_NOT_FOUND;
} }
int real_pad = pad; int real_pad = pad;
if(device_slot != gHID_SLOT_GC && config_controller[device_slot][CONTRPS_PAD_COUNT][0] != CONTROLLER_PATCHER_INVALIDVALUE){ if((device_slot != gHID_SLOT_GC) && config_controller[device_slot][CONTRPS_PAD_COUNT][0] != CONTROLLER_PATCHER_INVALIDVALUE){
int pad_count = config_controller[device_slot][CONTRPS_PAD_COUNT][1]; int pad_count = config_controller[device_slot][CONTRPS_PAD_COUNT][1];
if(pad_count > HID_MAX_PADS_COUNT) pad_count = HID_MAX_PADS_COUNT; if(pad_count > HID_MAX_PADS_COUNT) pad_count = HID_MAX_PADS_COUNT;
pad = (pad/(pad_count))*pad_count; pad = (pad/(pad_count))*pad_count;

View File

@ -301,7 +301,7 @@ CONTROLLER_PATCHER_RESULT_OR_ERROR ControllerPatcherUtils::checkActivePad(int hi
if(deviceslot < 0 ) return CONTROLLER_PATCHER_ERROR_DEVICE_SLOT_NOT_FOUND; if(deviceslot < 0 ) return CONTROLLER_PATCHER_ERROR_DEVICE_SLOT_NOT_FOUND;
int connected_pads = config_controller[deviceslot][CONTRPS_CONNECTED_PADS][1]; int connected_pads = config_controller[deviceslot][CONTRPS_CONNECTED_PADS][1];
if(connected_pads & (1 << pad)){ if((connected_pads & (1 << pad)) > 0){
return 1; return 1;
} }
} }