input: fix player id if handler has 2 or more pads

This commit is contained in:
Megamouse 2021-08-09 23:41:49 +02:00
parent 6e1c7a2c16
commit 5816505e61
18 changed files with 41 additions and 40 deletions

View file

@ -197,7 +197,7 @@ u32 ds4_pad_handler::get_battery_level(const std::string& padId)
return std::min<u32>(device->battery_level * 10, 100);
}
void ds4_pad_handler::SetPadData(const std::string& padId, u32 largeMotor, u32 smallMotor, s32 r, s32 g, s32 b, bool battery_led, u32 battery_led_brightness)
void ds4_pad_handler::SetPadData(const std::string& padId, u8 player_id, u32 largeMotor, u32 smallMotor, s32 r, s32 g, s32 b, bool battery_led, u32 battery_led_brightness)
{
std::shared_ptr<DS4Device> device = get_hid_device(padId);
if (!device || !device->hidDevice || !device->config)
@ -206,6 +206,7 @@ void ds4_pad_handler::SetPadData(const std::string& padId, u32 largeMotor, u32 s
// Set the device's motor speeds to our requested values 0-255
device->large_motor = largeMotor;
device->small_motor = smallMotor;
device->player_id = player_id;
int index = 0;
for (uint i = 0; i < MAX_GAMEPADS; i++)