summaryrefslogtreecommitdiff
path: root/src/input_common/drivers/sdl_driver.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/input_common/drivers/sdl_driver.h')
-rw-r--r--src/input_common/drivers/sdl_driver.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/input_common/drivers/sdl_driver.h b/src/input_common/drivers/sdl_driver.h
index dcd0d1e64..c82632506 100644
--- a/src/input_common/drivers/sdl_driver.h
+++ b/src/input_common/drivers/sdl_driver.h
@@ -12,6 +12,7 @@
12#include <SDL.h> 12#include <SDL.h>
13 13
14#include "common/common_types.h" 14#include "common/common_types.h"
15#include "common/threadsafe_queue.h"
15#include "input_common/input_engine.h" 16#include "input_common/input_engine.h"
16 17
17union SDL_Event; 18union SDL_Event;
@@ -64,12 +65,20 @@ public:
64 const PadIdentifier& identifier, const Common::Input::VibrationStatus& vibration) override; 65 const PadIdentifier& identifier, const Common::Input::VibrationStatus& vibration) override;
65 66
66private: 67private:
68 struct VibrationRequest {
69 PadIdentifier identifier;
70 Common::Input::VibrationStatus vibration;
71 };
72
67 void InitJoystick(int joystick_index); 73 void InitJoystick(int joystick_index);
68 void CloseJoystick(SDL_Joystick* sdl_joystick); 74 void CloseJoystick(SDL_Joystick* sdl_joystick);
69 75
70 /// Needs to be called before SDL_QuitSubSystem. 76 /// Needs to be called before SDL_QuitSubSystem.
71 void CloseJoysticks(); 77 void CloseJoysticks();
72 78
79 /// Takes all vibrations from the queue and sends the command to the controller
80 void SendVibrations();
81
73 Common::ParamPackage BuildAnalogParamPackageForButton(int port, std::string guid, s32 axis, 82 Common::ParamPackage BuildAnalogParamPackageForButton(int port, std::string guid, s32 axis,
74 float value = 0.1f) const; 83 float value = 0.1f) const;
75 Common::ParamPackage BuildButtonParamPackageForButton(int port, std::string guid, 84 Common::ParamPackage BuildButtonParamPackageForButton(int port, std::string guid,
@@ -107,6 +116,9 @@ private:
107 /// Returns true if the button is on the left joycon 116 /// Returns true if the button is on the left joycon
108 bool IsButtonOnLeftSide(Settings::NativeButton::Values button) const; 117 bool IsButtonOnLeftSide(Settings::NativeButton::Values button) const;
109 118
119 /// Queue of vibration request to controllers
120 Common::SPSCQueue<VibrationRequest> vibration_queue;
121
110 /// Map of GUID of a list of corresponding virtual Joysticks 122 /// Map of GUID of a list of corresponding virtual Joysticks
111 std::unordered_map<std::string, std::vector<std::shared_ptr<SDLJoystick>>> joystick_map; 123 std::unordered_map<std::string, std::vector<std::shared_ptr<SDLJoystick>>> joystick_map;
112 std::mutex joystick_map_mutex; 124 std::mutex joystick_map_mutex;