From 03ec60cfdaa8ab6240d976555c7c776e85afbeb4 Mon Sep 17 00:00:00 2001 From: BearOso Date: Fri, 13 Dec 2024 19:04:56 -0600 Subject: [PATCH] Qt: Fix up SDL3 button binding. --- common/audio/s9x_sound_driver_sdl3.cpp | 3 ++- qt/src/ControllerPanel.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/common/audio/s9x_sound_driver_sdl3.cpp b/common/audio/s9x_sound_driver_sdl3.cpp index 882973c6..4bb6eff2 100644 --- a/common/audio/s9x_sound_driver_sdl3.cpp +++ b/common/audio/s9x_sound_driver_sdl3.cpp @@ -6,6 +6,7 @@ #include "s9x_sound_driver_sdl3.hpp" #include "SDL3/SDL_audio.h" +#include #include bool S9xSDL3SoundDriver::write_samples(int16_t *data, int samples) @@ -116,4 +117,4 @@ std::pair S9xSDL3SoundDriver::buffer_level() { std::pair level = { buffer.space_empty(), buffer.buffer_size }; return level; -} \ No newline at end of file +} diff --git a/qt/src/ControllerPanel.cpp b/qt/src/ControllerPanel.cpp index fc0c23ec..d6cdc0f6 100644 --- a/qt/src/ControllerPanel.cpp +++ b/qt/src/ControllerPanel.cpp @@ -110,10 +110,10 @@ void ControllerPanel::autoPopulateWithJoystick(int joystick_id, int slot) SDL_GAMEPAD_BUTTON_DPAD_LEFT, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, // B, A and X, Y are inverted on XInput vs SNES - SDL_GAMEPAD_BUTTON_SOUTH, SDL_GAMEPAD_BUTTON_EAST, - SDL_GAMEPAD_BUTTON_WEST, + SDL_GAMEPAD_BUTTON_SOUTH, SDL_GAMEPAD_BUTTON_NORTH, + SDL_GAMEPAD_BUTTON_WEST, SDL_GAMEPAD_BUTTON_LEFT_SHOULDER, SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER, SDL_GAMEPAD_BUTTON_START, @@ -125,7 +125,8 @@ void ControllerPanel::autoPopulateWithJoystick(int joystick_id, int slot) auto get_binding_for_button = [&](SDL_GamepadButton button) -> SDL_GamepadBinding { for (int i = 0; i < num_bindings; i++) - if (bindings[i]->output.button == button) + if (bindings[i]->output_type == SDL_GAMEPAD_BINDTYPE_BUTTON && + bindings[i]->output.button == button) return *bindings[i]; return SDL_GamepadBinding{}; };