mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-25 09:17:12 +01:00
Re-enable axis correlation for raw input controllers, for twin stick shooters that don't need face buttons
This commit is contained in:
parent
ce77966da8
commit
a7dede7e36
@ -63,6 +63,7 @@ typedef struct WindowsGamingInputGamepadState WindowsGamingInputGamepadState;
|
|||||||
|
|
||||||
#if defined(SDL_JOYSTICK_RAWINPUT_XINPUT) || defined(SDL_JOYSTICK_RAWINPUT_WGI)
|
#if defined(SDL_JOYSTICK_RAWINPUT_XINPUT) || defined(SDL_JOYSTICK_RAWINPUT_WGI)
|
||||||
#define SDL_JOYSTICK_RAWINPUT_MATCHING
|
#define SDL_JOYSTICK_RAWINPUT_MATCHING
|
||||||
|
#define SDL_JOYSTICK_RAWINPUT_MATCH_AXES
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*#define DEBUG_RAWINPUT*/
|
/*#define DEBUG_RAWINPUT*/
|
||||||
@ -364,6 +365,10 @@ RAWINPUT_GuessXInputSlot(const WindowsMatchState *state, Uint8 *correlation_id,
|
|||||||
|
|
||||||
*slot_idx = 0;
|
*slot_idx = 0;
|
||||||
|
|
||||||
|
if (!state->any_data) {
|
||||||
|
return SDL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
match_count = 0;
|
match_count = 0;
|
||||||
for (user_index = 0; user_index < XUSER_MAX_COUNT; ++user_index) {
|
for (user_index = 0; user_index < XUSER_MAX_COUNT; ++user_index) {
|
||||||
if (!xinput_state[user_index].used && RAWINPUT_XInputSlotMatches(state, user_index)) {
|
if (!xinput_state[user_index].used && RAWINPUT_XInputSlotMatches(state, user_index)) {
|
||||||
@ -376,10 +381,7 @@ RAWINPUT_GuessXInputSlot(const WindowsMatchState *state, Uint8 *correlation_id,
|
|||||||
/* Only return a match if we match exactly one, and we have some non-zero data (buttons or axes) that matched.
|
/* Only return a match if we match exactly one, and we have some non-zero data (buttons or axes) that matched.
|
||||||
Note that we're still invalidating *other* potential correlations if we have more than one match or we have no
|
Note that we're still invalidating *other* potential correlations if we have more than one match or we have no
|
||||||
data. */
|
data. */
|
||||||
if (match_count == 1 && state->any_data) {
|
return (match_count == 1) ? SDL_TRUE : SDL_FALSE;
|
||||||
return SDL_TRUE;
|
|
||||||
}
|
|
||||||
return SDL_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* SDL_JOYSTICK_RAWINPUT_XINPUT */
|
#endif /* SDL_JOYSTICK_RAWINPUT_XINPUT */
|
||||||
@ -579,6 +581,10 @@ RAWINPUT_GuessWindowsGamingInputSlot(const WindowsMatchState *state, Uint8 *corr
|
|||||||
{
|
{
|
||||||
int match_count;
|
int match_count;
|
||||||
|
|
||||||
|
if (!state->any_data) {
|
||||||
|
return SDL_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
match_count = 0;
|
match_count = 0;
|
||||||
for (int user_index = 0; user_index < wgi_state.per_gamepad_count; ++user_index) {
|
for (int user_index = 0; user_index < wgi_state.per_gamepad_count; ++user_index) {
|
||||||
WindowsGamingInputGamepadState *gamepad_state = wgi_state.per_gamepad[user_index];
|
WindowsGamingInputGamepadState *gamepad_state = wgi_state.per_gamepad[user_index];
|
||||||
@ -592,10 +598,7 @@ RAWINPUT_GuessWindowsGamingInputSlot(const WindowsMatchState *state, Uint8 *corr
|
|||||||
/* Only return a match if we match exactly one, and we have some non-zero data (buttons or axes) that matched.
|
/* Only return a match if we match exactly one, and we have some non-zero data (buttons or axes) that matched.
|
||||||
Note that we're still invalidating *other* potential correlations if we have more than one match or we have no
|
Note that we're still invalidating *other* potential correlations if we have more than one match or we have no
|
||||||
data. */
|
data. */
|
||||||
if (match_count == 1 && state->any_data) {
|
return (match_count == 1) ? SDL_TRUE : SDL_FALSE;
|
||||||
return SDL_TRUE;
|
|
||||||
}
|
|
||||||
return SDL_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user