diff options
| author | 2020-09-04 21:35:42 -0500 | |
|---|---|---|
| committer | 2020-09-04 21:48:13 -0500 | |
| commit | 6ee8eab670acfed494ade355d77a32c57f7c9585 (patch) | |
| tree | ca91a7ca7ac7861ae48c5456870eee425fc8c209 /src/input_common/udp/udp.h | |
| parent | Remove RealMotionDevice (diff) | |
| download | yuzu-6ee8eab670acfed494ade355d77a32c57f7c9585.tar.gz yuzu-6ee8eab670acfed494ade355d77a32c57f7c9585.tar.xz yuzu-6ee8eab670acfed494ade355d77a32c57f7c9585.zip | |
Add cemu hook changes related to PR #4609
Diffstat (limited to 'src/input_common/udp/udp.h')
| -rw-r--r-- | src/input_common/udp/udp.h | 61 |
1 files changed, 43 insertions, 18 deletions
diff --git a/src/input_common/udp/udp.h b/src/input_common/udp/udp.h index 672a5c812..ea3fd4175 100644 --- a/src/input_common/udp/udp.h +++ b/src/input_common/udp/udp.h | |||
| @@ -1,32 +1,57 @@ | |||
| 1 | // Copyright 2018 Citra Emulator Project | 1 | // Copyright 2020 yuzu Emulator Project |
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <vector> | 8 | #include "core/frontend/input.h" |
| 9 | #include "common/param_package.h" | 9 | #include "input_common/udp/client.h" |
| 10 | 10 | ||
| 11 | namespace InputCommon::CemuhookUDP { | 11 | namespace InputCommon { |
| 12 | 12 | ||
| 13 | class Client; | 13 | /// A motion device factory that creates motion devices from udp clients |
| 14 | class UDPMotionFactory; | 14 | class UDPMotionFactory final : public Input::Factory<Input::MotionDevice> { |
| 15 | class UDPTouchFactory; | ||
| 16 | |||
| 17 | class State { | ||
| 18 | public: | 15 | public: |
| 19 | State(); | 16 | explicit UDPMotionFactory(std::shared_ptr<CemuhookUDP::Client> client_); |
| 20 | ~State(); | 17 | |
| 21 | void ReloadUDPClient(); | 18 | std::unique_ptr<Input::MotionDevice> Create(const Common::ParamPackage& params) override; |
| 22 | std::vector<Common::ParamPackage> GetInputDevices() const; | 19 | |
| 20 | Common::ParamPackage GetNextInput(); | ||
| 21 | |||
| 22 | /// For device input configuration/polling | ||
| 23 | void BeginConfiguration(); | ||
| 24 | void EndConfiguration(); | ||
| 25 | |||
| 26 | bool IsPolling() const { | ||
| 27 | return polling; | ||
| 28 | } | ||
| 23 | 29 | ||
| 24 | private: | 30 | private: |
| 25 | std::unique_ptr<Client> client; | 31 | std::shared_ptr<CemuhookUDP::Client> client; |
| 26 | std::shared_ptr<UDPMotionFactory> motion_factory; | 32 | bool polling = false; |
| 27 | std::shared_ptr<UDPTouchFactory> touch_factory; | ||
| 28 | }; | 33 | }; |
| 29 | 34 | ||
| 30 | std::unique_ptr<State> Init(); | 35 | /// A touch device factory that creates touch devices from udp clients |
| 36 | class UDPTouchFactory final : public Input::Factory<Input::TouchDevice> { | ||
| 37 | public: | ||
| 38 | explicit UDPTouchFactory(std::shared_ptr<CemuhookUDP::Client> client_); | ||
| 39 | |||
| 40 | std::unique_ptr<Input::TouchDevice> Create(const Common::ParamPackage& params) override; | ||
| 41 | |||
| 42 | Common::ParamPackage GetNextInput(); | ||
| 43 | |||
| 44 | /// For device input configuration/polling | ||
| 45 | void BeginConfiguration(); | ||
| 46 | void EndConfiguration(); | ||
| 47 | |||
| 48 | bool IsPolling() const { | ||
| 49 | return polling; | ||
| 50 | } | ||
| 51 | |||
| 52 | private: | ||
| 53 | std::shared_ptr<CemuhookUDP::Client> client; | ||
| 54 | bool polling = false; | ||
| 55 | }; | ||
| 31 | 56 | ||
| 32 | } // namespace InputCommon::CemuhookUDP | 57 | } // namespace InputCommon |