fix xinput (again)- repair multiple pads support
This commit is contained in:
parent
45cfc584f9
commit
c16d0e54e1
|
@ -423,6 +423,8 @@ static bool name_is_360_pad(const char* name)
|
||||||
// Forward declaration
|
// Forward declaration
|
||||||
static const char *dinput_joypad_name(unsigned pad);
|
static const char *dinput_joypad_name(unsigned pad);
|
||||||
|
|
||||||
|
static int g_last_xbox_pad_index;
|
||||||
|
|
||||||
static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
|
static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
|
||||||
{
|
{
|
||||||
(void)p;
|
(void)p;
|
||||||
|
@ -441,14 +443,13 @@ static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
|
||||||
g_pads[g_joypad_cnt].joy_name = strdup(inst->tszProductName);
|
g_pads[g_joypad_cnt].joy_name = strdup(inst->tszProductName);
|
||||||
|
|
||||||
#ifdef HAVE_WINXINPUT
|
#ifdef HAVE_WINXINPUT
|
||||||
int last_xbox_pad_index = 0;
|
|
||||||
bool is_360_pad = name_is_360_pad(inst->tszProductName);
|
bool is_360_pad = name_is_360_pad(inst->tszProductName);
|
||||||
|
|
||||||
if (is_360_pad)
|
if (is_360_pad)
|
||||||
{
|
{
|
||||||
if (last_xbox_pad_index < 4)
|
if (g_last_xbox_pad_index < 4)
|
||||||
g_xbox_pad_indexes[g_joypad_cnt] = last_xbox_pad_index;
|
g_xbox_pad_indexes[g_joypad_cnt] = g_last_xbox_pad_index;
|
||||||
++last_xbox_pad_index;
|
++g_last_xbox_pad_index;
|
||||||
|
|
||||||
goto enum_iteration_done;
|
goto enum_iteration_done;
|
||||||
}
|
}
|
||||||
|
@ -478,7 +479,9 @@ static bool dinput_joypad_init(void)
|
||||||
{
|
{
|
||||||
if (!dinput_init_context())
|
if (!dinput_init_context())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
g_last_xbox_pad_index = 0;
|
||||||
|
|
||||||
for (unsigned i = 0; i < MAX_PLAYERS; ++i)
|
for (unsigned i = 0; i < MAX_PLAYERS; ++i)
|
||||||
{
|
{
|
||||||
g_xbox_pad_indexes[i] = -1;
|
g_xbox_pad_indexes[i] = -1;
|
||||||
|
|
Loading…
Reference in New Issue