More small adjustments to joypad drivers

This commit is contained in:
pinumbernumber 2013-08-27 14:38:20 +01:00
parent 905e767983
commit 6bed0cfa65
2 changed files with 16 additions and 10 deletions

View File

@ -394,8 +394,11 @@ static BOOL CALLBACK enum_axes_cb(const DIDEVICEOBJECTINSTANCE *inst, void *p)
return DIENUM_CONTINUE;
}
// Is there a better way of detecting dual XInput/DInput pads? This is going to get
// outdated, for example when the Xbox One controller becomes available.
// TODO: Use a better way of detecting dual XInput/DInput pads. This current method
// will not work correctly for third-party controllers or future MS pads (Xbox One?).
// An example of this is provided in the DX SDK, which advises "Enum each PNP device
// using WMI and check each device ID to see if it contains "IG_"". Unfortunately the
// example code is a horrible unsightly mess.
static const char* const XINPUT_PAD_NAMES[] =
{
"Controller (Gamepad for Xbox 360)",
@ -452,6 +455,8 @@ static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
if (last_xbox_pad_index < 4)
g_xbox_pad_indexes[g_joypad_cnt] = last_xbox_pad_index;
++last_xbox_pad_index;
goto enum_iteration_done;
}
#endif
@ -472,9 +477,8 @@ static BOOL CALLBACK enum_joypad_cb(const DIDEVICEINSTANCE *inst, void *p)
input_config_autoconfigure_joypad(g_joypad_cnt, dinput_joypad_name(g_joypad_cnt), dinput_joypad.ident);
}
enum_iteration_done:
g_joypad_cnt++;
return DIENUM_CONTINUE;
}

View File

@ -108,12 +108,14 @@ static int pad_index_to_xplayer_index(unsigned pad)
return g_xbox_pad_indexes[pad];
}
// Generic "XInput" instead of "Xbox 360", because there are
// some other non-xbox third party PC controllers.
static const char* const XBOX_CONTROLLER_NAMES[4] =
{
"Xbox 360 Controller (Player 1)",
"Xbox 360 Controller (Player 2)",
"Xbox 360 Controller (Player 3)",
"Xbox 360 Controller (Player 4)"
"XInput Controller (Player 1)",
"XInput Controller (Player 2)",
"XInput Controller (Player 3)",
"XInput Controller (Player 4)"
};
const char* winxinput_joypad_name (unsigned pad)
@ -169,8 +171,8 @@ static bool winxinput_joypad_init(void)
if (!g_XInputGetStateEx)
{
// no ordinal 100. (Old version of x360ce perhaps?) Load the ordinary XInputGetState,
// at the cost of losing guide button support.
// no ordinal 100. (Presumably a wrapper.) Load the ordinary
// XInputGetState, at the cost of losing guide button support.
g_winxinput_guide_button_supported = false;
g_XInputGetStateEx = (XInputGetStateEx_t) GetProcAddress(g_winxinput_dll, "XInputGetState");
if (!g_XInputGetStateEx)