summaryrefslogtreecommitdiff
path: root/Source/Core/InputCommon/ControllerInterface
diff options
context:
space:
mode:
authorJoshua Vandaƫle <joshua@vandaele.software>2026-08-28 07:37:18 +0200
committerJoshua Vandaƫle <joshua@vandaele.software>2026-08-28 07:37:18 +0200
commitb572e4ca5a74481fad0bd14e4c5f9719945d61d8 (patch)
tree8ff6a79ea03b11b94e2b3eeaac06cbcc358f58d8 /Source/Core/InputCommon/ControllerInterface
parent4f8af23db516d8b6e9cd00e7b261a65b026514a8 (diff)
SDLGamepad: Add Misc 2 through 6
SDL 3 has more misc buttons for "additional controller buttons" (e.g. left/right trigger clicks on a GameCube controller, or for the second touchpad click on the Steam Controller) which use these additional named Misc buttons. Taken from [SDL_GamepadButton](https://wiki.libsdl.org/SDL3/SDL_GamepadButton)
Diffstat (limited to 'Source/Core/InputCommon/ControllerInterface')
-rw-r--r--Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.cpp3
-rw-r--r--Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.h7
2 files changed, 9 insertions, 1 deletions
diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.cpp b/Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.cpp
index 09457598c6..6fcba14e8e 100644
--- a/Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.cpp
@@ -327,6 +327,9 @@ bool Gamepad::Button::IsMatchingName(std::string_view name) const
return true;
// Match the old "Button 0"-like names.
+ if (m_binding.output_type == SDL_GAMEPAD_BINDTYPE_BUTTON)
+ return name == GetLegacyButtonName(m_binding.output.button);
+
switch (m_binding.input_type)
{
case SDL_GAMEPAD_BINDTYPE_BUTTON:
diff --git a/Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.h b/Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.h
index a997437f61..e63357bf78 100644
--- a/Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.h
+++ b/Source/Core/InputCommon/ControllerInterface/SDL/SDLGamepad.h
@@ -380,7 +380,7 @@ struct SDLMotionAxis
};
using SDLMotionAxisList = std::array<SDLMotionAxis, 6>;
-static constexpr std::array<const char*, 21> s_sdl_button_names = {
+static constexpr std::array<const char*, 26> s_sdl_button_names = {
"Button S", // SDL_GAMEPAD_BUTTON_SOUTH
"Button E", // SDL_GAMEPAD_BUTTON_EAST
"Button W", // SDL_GAMEPAD_BUTTON_WEST
@@ -402,6 +402,11 @@ static constexpr std::array<const char*, 21> s_sdl_button_names = {
"Paddle 3", // SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2
"Paddle 4", // SDL_GAMEPAD_BUTTON_LEFT_PADDLE2
"Touchpad", // SDL_GAMEPAD_BUTTON_TOUCHPAD
+ "Misc 2", // SDL_GAMEPAD_BUTTON_MISC2
+ "Misc 3", // SDL_GAMEPAD_BUTTON_MISC3
+ "Misc 4", // SDL_GAMEPAD_BUTTON_MISC4
+ "Misc 5", // SDL_GAMEPAD_BUTTON_MISC5
+ "Misc 6" // SDL_GAMEPAD_BUTTON_MISC6
};
static constexpr std::array<const char*, 6> s_sdl_axis_names = {
"Left X", // SDL_GAMEPAD_AXIS_LEFTX