summaryrefslogtreecommitdiffstats
path: root/src/input_common/drivers/sdl_driver.h
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2022-05-23 18:33:34 +0200
committerNarr the Reg <juangerman-13@hotmail.com>2022-05-23 19:25:02 +0200
commitbf948b57903a55b562287347129ec718154b5f82 (patch)
tree452677f5ec79e8dcef0a9c6f12c8fb928b5bfa0c /src/input_common/drivers/sdl_driver.h
parentMerge pull request #8342 from lat9nq/clang-latest-stdc++ (diff)
downloadyuzu-bf948b57903a55b562287347129ec718154b5f82.tar
yuzu-bf948b57903a55b562287347129ec718154b5f82.tar.gz
yuzu-bf948b57903a55b562287347129ec718154b5f82.tar.bz2
yuzu-bf948b57903a55b562287347129ec718154b5f82.tar.lz
yuzu-bf948b57903a55b562287347129ec718154b5f82.tar.xz
yuzu-bf948b57903a55b562287347129ec718154b5f82.tar.zst
yuzu-bf948b57903a55b562287347129ec718154b5f82.zip
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 @@
#include <SDL.h>
#include "common/common_types.h"
+#include "common/threadsafe_queue.h"
#include "input_common/input_engine.h"
union SDL_Event;
@@ -64,12 +65,20 @@ public:
const PadIdentifier& identifier, const Common::Input::VibrationStatus& vibration) override;
private:
+ struct VibrationRequest {
+ PadIdentifier identifier;
+ Common::Input::VibrationStatus vibration;
+ };
+
void InitJoystick(int joystick_index);
void CloseJoystick(SDL_Joystick* sdl_joystick);
/// Needs to be called before SDL_QuitSubSystem.
void CloseJoysticks();
+ /// Takes all vibrations from the queue and sends the command to the controller
+ void SendVibrations();
+
Common::ParamPackage BuildAnalogParamPackageForButton(int port, std::string guid, s32 axis,
float value = 0.1f) const;
Common::ParamPackage BuildButtonParamPackageForButton(int port, std::string guid,
@@ -107,6 +116,9 @@ private:
/// Returns true if the button is on the left joycon
bool IsButtonOnLeftSide(Settings::NativeButton::Values button) const;
+ /// Queue of vibration request to controllers
+ Common::SPSCQueue<VibrationRequest> vibration_queue;
+
/// Map of GUID of a list of corresponding virtual Joysticks
std::unordered_map<std::string, std::vector<std::shared_ptr<SDLJoystick>>> joystick_map;
std::mutex joystick_map_mutex;