mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 04:20:27 +00:00
Merge pull request #7898 from krzys-h/uwp-gamepads
(UWP) Fix multiple gamepads on xinput
This commit is contained in:
commit
aadc299cc2
@ -42,9 +42,6 @@
|
|||||||
|
|
||||||
#ifdef HAVE_DINPUT
|
#ifdef HAVE_DINPUT
|
||||||
#include "dinput_joypad.h"
|
#include "dinput_joypad.h"
|
||||||
#else
|
|
||||||
int g_xinput_pad_indexes[MAX_USERS];
|
|
||||||
bool g_xinput_block_pads;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__WINRT__)
|
#if defined(__WINRT__)
|
||||||
@ -104,6 +101,7 @@ typedef struct
|
|||||||
#define ERROR_DEVICE_NOT_CONNECTED 1167
|
#define ERROR_DEVICE_NOT_CONNECTED 1167
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_DINPUT
|
||||||
/* Due to 360 pads showing up under both XInput and DirectInput,
|
/* Due to 360 pads showing up under both XInput and DirectInput,
|
||||||
* and since we are going to have to pass through unhandled
|
* and since we are going to have to pass through unhandled
|
||||||
* joypad numbers to DirectInput, a slightly ugly
|
* joypad numbers to DirectInput, a slightly ugly
|
||||||
@ -114,6 +112,7 @@ typedef struct
|
|||||||
*/
|
*/
|
||||||
extern int g_xinput_pad_indexes[MAX_USERS];
|
extern int g_xinput_pad_indexes[MAX_USERS];
|
||||||
extern bool g_xinput_block_pads;
|
extern bool g_xinput_block_pads;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_DYNAMIC
|
#ifdef HAVE_DYNAMIC
|
||||||
/* For xinput1_n.dll */
|
/* For xinput1_n.dll */
|
||||||
@ -142,7 +141,11 @@ static xinput_joypad_state g_xinput_states[4];
|
|||||||
|
|
||||||
static INLINE int pad_index_to_xuser_index(unsigned pad)
|
static INLINE int pad_index_to_xuser_index(unsigned pad)
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_DINPUT
|
||||||
return g_xinput_pad_indexes[pad];
|
return g_xinput_pad_indexes[pad];
|
||||||
|
#else
|
||||||
|
return pad < MAX_PADS && g_xinput_states[pad].connected ? pad : -1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generic "XInput" instead of "Xbox 360", because there are
|
/* Generic "XInput" instead of "Xbox 360", because there are
|
||||||
@ -296,9 +299,10 @@ static bool xinput_joypad_init(void *data)
|
|||||||
|
|
||||||
RARCH_LOG("[XInput]: Pads connected: %d\n", g_xinput_states[0].connected +
|
RARCH_LOG("[XInput]: Pads connected: %d\n", g_xinput_states[0].connected +
|
||||||
g_xinput_states[1].connected + g_xinput_states[2].connected + g_xinput_states[3].connected);
|
g_xinput_states[1].connected + g_xinput_states[2].connected + g_xinput_states[3].connected);
|
||||||
g_xinput_block_pads = true;
|
|
||||||
|
|
||||||
#ifdef HAVE_DINPUT
|
#ifdef HAVE_DINPUT
|
||||||
|
g_xinput_block_pads = true;
|
||||||
|
|
||||||
/* We're going to have to be buddies with dinput if we want to be able
|
/* We're going to have to be buddies with dinput if we want to be able
|
||||||
* to use XInput and non-XInput controllers together. */
|
* to use XInput and non-XInput controllers together. */
|
||||||
if (!dinput_joypad.init(data))
|
if (!dinput_joypad.init(data))
|
||||||
@ -372,9 +376,9 @@ static void xinput_joypad_destroy(void)
|
|||||||
|
|
||||||
#ifdef HAVE_DINPUT
|
#ifdef HAVE_DINPUT
|
||||||
dinput_joypad.destroy();
|
dinput_joypad.destroy();
|
||||||
#endif
|
|
||||||
|
|
||||||
g_xinput_block_pads = false;
|
g_xinput_block_pads = false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Buttons are provided by XInput as bits of a uint16.
|
/* Buttons are provided by XInput as bits of a uint16.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user