From e82e196640be42dfb926859c28aafa75c516bdcb Mon Sep 17 00:00:00 2001 From: Ash Logan Date: Thu, 21 Nov 2019 13:01:12 +1100 Subject: [PATCH] joystick/wiiu: Add player index support --- src/joystick/wiiu/SDL_wiiujoystick.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/joystick/wiiu/SDL_wiiujoystick.c b/src/joystick/wiiu/SDL_wiiujoystick.c index cf7bdbe53..d345b24e7 100644 --- a/src/joystick/wiiu/SDL_wiiujoystick.c +++ b/src/joystick/wiiu/SDL_wiiujoystick.c @@ -225,7 +225,16 @@ static const char *WIIU_JoystickGetDeviceName(int device_index) /* Function to get the player index of a joystick */ static int WIIU_JoystickGetDevicePlayerIndex(int device_index) { - return -1; + int wiiu_device = WIIU_GetDeviceForIndex(device_index); + switch (wiiu_device) { + case WIIU_DEVICE_GAMEPAD: { return 0; } + case WIIU_DEVICE_WPAD(1): { return 1; } + case WIIU_DEVICE_WPAD(2): { return 2; } + case WIIU_DEVICE_WPAD(3): { return 3; } + case WIIU_DEVICE_WPAD(4): { return 4; } + default: { return -1; } + } + } /* Function to return the stable GUID for a plugged in device */