Back out change supporting multiple names for binding elements
testcontroller expects to be able to call SDL_GetGamepadStringForButton() and find that name in the binding string We can revisit this later if it becomes important to use new names in bindings. @smcvmain
parent
efe15588d5
commit
dabd45997e
|
@ -1105,31 +1105,29 @@ const char *SDL_GetGamepadStringForAxis(SDL_GamepadAxis axis)
|
|||
}
|
||||
|
||||
static const char *map_StringForGamepadButton[] = {
|
||||
"a", NULL,
|
||||
"b", NULL,
|
||||
"x", NULL,
|
||||
"y", NULL,
|
||||
"back", NULL,
|
||||
"guide", NULL,
|
||||
"start", NULL,
|
||||
"leftstick", NULL,
|
||||
"rightstick", NULL,
|
||||
"leftshoulder", NULL,
|
||||
"rightshoulder", NULL,
|
||||
"dpup", NULL,
|
||||
"dpdown", NULL,
|
||||
"dpleft", NULL,
|
||||
"dpright", NULL,
|
||||
"misc1", NULL,
|
||||
/* Keep using paddle1-4 when we generate mapping strings so that they
|
||||
* can be reused with SDL2, but accept rightpaddle1 etc. as input */
|
||||
"paddle1", "rightpaddle1",
|
||||
"paddle2", "leftpaddle1",
|
||||
"paddle3", "rightpaddle2",
|
||||
"paddle4", "leftpaddle2",
|
||||
"touchpad", NULL
|
||||
"a",
|
||||
"b",
|
||||
"x",
|
||||
"y",
|
||||
"back",
|
||||
"guide",
|
||||
"start",
|
||||
"leftstick",
|
||||
"rightstick",
|
||||
"leftshoulder",
|
||||
"rightshoulder",
|
||||
"dpup",
|
||||
"dpdown",
|
||||
"dpleft",
|
||||
"dpright",
|
||||
"misc1",
|
||||
"paddle1",
|
||||
"paddle2",
|
||||
"paddle3",
|
||||
"paddle4",
|
||||
"touchpad"
|
||||
};
|
||||
SDL_COMPILE_TIME_ASSERT(map_StringForGamepadButton, SDL_arraysize(map_StringForGamepadButton) == 2 * SDL_GAMEPAD_BUTTON_MAX);
|
||||
SDL_COMPILE_TIME_ASSERT(map_StringForGamepadButton, SDL_arraysize(map_StringForGamepadButton) == SDL_GAMEPAD_BUTTON_MAX);
|
||||
|
||||
/*
|
||||
* convert a string to its enum equivalent
|
||||
|
@ -1143,8 +1141,8 @@ SDL_GamepadButton SDL_GetGamepadButtonFromString(const char *str)
|
|||
}
|
||||
|
||||
for (i = 0; i < SDL_arraysize(map_StringForGamepadButton); ++i) {
|
||||
if (map_StringForGamepadButton[i] && SDL_strcasecmp(str, map_StringForGamepadButton[i]) == 0) {
|
||||
return (SDL_GamepadButton) (i / 2);
|
||||
if (SDL_strcasecmp(str, map_StringForGamepadButton[i]) == 0) {
|
||||
return (SDL_GamepadButton)i;
|
||||
}
|
||||
}
|
||||
return SDL_GAMEPAD_BUTTON_INVALID;
|
||||
|
@ -1156,7 +1154,7 @@ SDL_GamepadButton SDL_GetGamepadButtonFromString(const char *str)
|
|||
const char *SDL_GetGamepadStringForButton(SDL_GamepadButton button)
|
||||
{
|
||||
if (button > SDL_GAMEPAD_BUTTON_INVALID && button < SDL_GAMEPAD_BUTTON_MAX) {
|
||||
return map_StringForGamepadButton[button * 2];
|
||||
return map_StringForGamepadButton[button];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue