diff options
author | t895 <clombardo169@gmail.com> | 2024-02-23 22:00:48 +0100 |
---|---|---|
committer | t895 <clombardo169@gmail.com> | 2024-02-23 22:41:59 +0100 |
commit | 0369c65870c4ffa1223dc3c6c7234ae1f12f6a04 (patch) | |
tree | c1f670eda72a5273074fb7990d85f83045cfe070 /src/input_common/drivers/android.h | |
parent | Merge pull request #13141 from liamwhite/swap (diff) | |
download | yuzu-0369c65870c4ffa1223dc3c6c7234ae1f12f6a04.tar yuzu-0369c65870c4ffa1223dc3c6c7234ae1f12f6a04.tar.gz yuzu-0369c65870c4ffa1223dc3c6c7234ae1f12f6a04.tar.bz2 yuzu-0369c65870c4ffa1223dc3c6c7234ae1f12f6a04.tar.lz yuzu-0369c65870c4ffa1223dc3c6c7234ae1f12f6a04.tar.xz yuzu-0369c65870c4ffa1223dc3c6c7234ae1f12f6a04.tar.zst yuzu-0369c65870c4ffa1223dc3c6c7234ae1f12f6a04.zip |
Diffstat (limited to 'src/input_common/drivers/android.h')
-rw-r--r-- | src/input_common/drivers/android.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/input_common/drivers/android.h b/src/input_common/drivers/android.h index 8a386c1b1..03e2b2c98 100644 --- a/src/input_common/drivers/android.h +++ b/src/input_common/drivers/android.h @@ -4,6 +4,7 @@ #pragma once #include <set> +#include <common/threadsafe_queue.h> #include <jni.h> #include "input_common/input_engine.h" @@ -16,6 +17,8 @@ class Android final : public InputEngine { public: explicit Android(std::string input_engine_); + ~Android() override; + /** * Registers controller number to accept new inputs. * @param j_input_device YuzuInputDevice object from the Android frontend to register. @@ -89,6 +92,9 @@ private: /// Returns the correct identifier corresponding to the player index PadIdentifier GetIdentifier(const std::string& guid, size_t port) const; + /// Takes all vibrations from the queue and sends the command to the controller + void SendVibrations(JNIEnv* env, std::stop_token token); + static constexpr s32 AXIS_X = 0; static constexpr s32 AXIS_Y = 1; static constexpr s32 AXIS_Z = 11; @@ -133,6 +139,10 @@ private: redmagic_vid, backbone_labs_vid, xbox_vid}; const std::vector<std::string> flipped_xy_vids{sony_vid, razer_vid, redmagic_vid, backbone_labs_vid, xbox_vid}; + + /// Queue of vibration request to controllers + Common::SPSCQueue<VibrationRequest> vibration_queue; + std::jthread vibration_thread; }; } // namespace InputCommon |