aboutsummaryrefslogtreecommitdiff
path: root/src/input_common/drivers/sdl_driver.h
diff options
context:
space:
mode:
authorKaydax <kaydax@kaydax.xyz>2026-05-18 19:07:41 +0200
committercrueter <crueter@eden-emu.dev>2026-05-18 19:07:41 +0200
commitad2e1cc554ecd363ae1412b66d537464bba001e7 (patch)
tree74550cbc893f7cbd6c3da3b24b4e91f27bee308e /src/input_common/drivers/sdl_driver.h
parent02521882e788223f357af8e777eb322735afbf1d (diff)
[externals] Update to SDL3 (#3952)
Since the launch of the steam controller I think it's only best to push towards updating to SDL3 allowing for a wider range of controller support I went ahead and started on getting it working. Everything here should be functional, I've personally tested it all on Arch Linux. Still untested on windows, so looking for feedback on that Any feedback and help would be appreciated! Main changes: - Bump everything to SDL3 - Handle SDL3 audio and input - Add steam controller support, including HD Rumble - Improved battery reporting via the status icon by using real % rather than state alone Co-authored-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3952 Reviewed-by: crueter <crueter@eden-emu.dev> Reviewed-by: MaranBr <maranbr@eden-emu.dev> Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Diffstat (limited to 'src/input_common/drivers/sdl_driver.h')
-rw-r--r--src/input_common/drivers/sdl_driver.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/input_common/drivers/sdl_driver.h b/src/input_common/drivers/sdl_driver.h
index 1677ab8289..bf4a45e83d 100644
--- a/src/input_common/drivers/sdl_driver.h
+++ b/src/input_common/drivers/sdl_driver.h
@@ -11,25 +11,22 @@
#include <thread>
#include <ankerl/unordered_dense.h>
-#include <SDL.h>
+#include <SDL3/SDL.h>
#include "common/common_types.h"
#include "common/threadsafe_queue.h"
#include "input_common/input_engine.h"
union SDL_Event;
-using SDL_GameController = struct _SDL_GameController;
-using SDL_Joystick = struct _SDL_Joystick;
-using SDL_JoystickID = s32;
namespace InputCommon {
class SDLJoystick;
using ButtonBindings =
- std::array<std::pair<Settings::NativeButton::Values, SDL_GameControllerButton>, 20>;
+ std::array<std::pair<Settings::NativeButton::Values, SDL_GamepadButton>, 20>;
using ZButtonBindings =
- std::array<std::pair<Settings::NativeButton::Values, SDL_GameControllerAxis>, 2>;
+ std::array<std::pair<Settings::NativeButton::Values, SDL_GamepadAxis>, 2>;
class SDLDriver : public InputEngine {
public:
@@ -46,6 +43,7 @@ public:
/// Get the nth joystick with the corresponding GUID
std::shared_ptr<SDLJoystick> GetSDLJoystickBySDLID(SDL_JoystickID sdl_id);
+ std::shared_ptr<SDLJoystick> GetSDLJoystickByGamepadID(SDL_JoystickID sdl_id);
/**
* Check how many identical joysticks (by guid) were connected before the one with sdl_id and so
@@ -72,7 +70,7 @@ public:
bool IsVibrationEnabled(const PadIdentifier& identifier) override;
private:
- void InitJoystick(int joystick_index);
+ void InitJoystick(SDL_JoystickID joystick_id);
void CloseJoystick(SDL_Joystick* sdl_joystick);
/// Needs to be called before SDL_QuitSubSystem.
@@ -92,7 +90,7 @@ private:
Common::ParamPackage BuildMotionParam(int port, const Common::UUID& guid) const;
Common::ParamPackage BuildParamPackageForBinding(
- int port, const Common::UUID& guid, const SDL_GameControllerButtonBind& binding) const;
+ int port, const Common::UUID& guid, const SDL_GamepadBinding& binding) const;
Common::ParamPackage BuildParamPackageForAnalog(PadIdentifier identifier, int axis_x,
int axis_y, float offset_x,