diff options
Diffstat (limited to 'src/input_common/udp')
| -rw-r--r-- | src/input_common/udp/client.cpp | 6 | ||||
| -rw-r--r-- | src/input_common/udp/udp.cpp | 14 | ||||
| -rw-r--r-- | src/input_common/udp/udp.h | 7 |
3 files changed, 19 insertions, 8 deletions
diff --git a/src/input_common/udp/client.cpp b/src/input_common/udp/client.cpp index 6c95a8b42..3f4eaf448 100644 --- a/src/input_common/udp/client.cpp +++ b/src/input_common/udp/client.cpp | |||
| @@ -224,8 +224,7 @@ void TestCommunication(const std::string& host, u16 port, u8 pad_index, u32 clie | |||
| 224 | } else { | 224 | } else { |
| 225 | failure_callback(); | 225 | failure_callback(); |
| 226 | } | 226 | } |
| 227 | }) | 227 | }).detach(); |
| 228 | .detach(); | ||
| 229 | } | 228 | } |
| 230 | 229 | ||
| 231 | CalibrationConfigurationJob::CalibrationConfigurationJob( | 230 | CalibrationConfigurationJob::CalibrationConfigurationJob( |
| @@ -279,8 +278,7 @@ CalibrationConfigurationJob::CalibrationConfigurationJob( | |||
| 279 | complete_event.Wait(); | 278 | complete_event.Wait(); |
| 280 | socket.Stop(); | 279 | socket.Stop(); |
| 281 | worker_thread.join(); | 280 | worker_thread.join(); |
| 282 | }) | 281 | }).detach(); |
| 283 | .detach(); | ||
| 284 | } | 282 | } |
| 285 | 283 | ||
| 286 | CalibrationConfigurationJob::~CalibrationConfigurationJob() { | 284 | CalibrationConfigurationJob::~CalibrationConfigurationJob() { |
diff --git a/src/input_common/udp/udp.cpp b/src/input_common/udp/udp.cpp index 8c6ef1394..4b347e47e 100644 --- a/src/input_common/udp/udp.cpp +++ b/src/input_common/udp/udp.cpp | |||
| @@ -77,10 +77,11 @@ State::State() { | |||
| 77 | std::make_unique<Client>(status, Settings::values.udp_input_address, | 77 | std::make_unique<Client>(status, Settings::values.udp_input_address, |
| 78 | Settings::values.udp_input_port, Settings::values.udp_pad_index); | 78 | Settings::values.udp_input_port, Settings::values.udp_pad_index); |
| 79 | 79 | ||
| 80 | Input::RegisterFactory<Input::TouchDevice>("cemuhookudp", | 80 | motion_factory = std::make_shared<UDPMotionFactory>(status); |
| 81 | std::make_shared<UDPTouchFactory>(status)); | 81 | touch_factory = std::make_shared<UDPTouchFactory>(status); |
| 82 | Input::RegisterFactory<Input::MotionDevice>("cemuhookudp", | 82 | |
| 83 | std::make_shared<UDPMotionFactory>(status)); | 83 | Input::RegisterFactory<Input::MotionDevice>("cemuhookudp", motion_factory); |
| 84 | Input::RegisterFactory<Input::TouchDevice>("cemuhookudp", touch_factory); | ||
| 84 | } | 85 | } |
| 85 | 86 | ||
| 86 | State::~State() { | 87 | State::~State() { |
| @@ -88,6 +89,11 @@ State::~State() { | |||
| 88 | Input::UnregisterFactory<Input::MotionDevice>("cemuhookudp"); | 89 | Input::UnregisterFactory<Input::MotionDevice>("cemuhookudp"); |
| 89 | } | 90 | } |
| 90 | 91 | ||
| 92 | std::vector<Common::ParamPackage> State::GetInputDevices() const { | ||
| 93 | // TODO support binding udp devices | ||
| 94 | return {}; | ||
| 95 | } | ||
| 96 | |||
| 91 | void State::ReloadUDPClient() { | 97 | void State::ReloadUDPClient() { |
| 92 | client->ReloadSocket(Settings::values.udp_input_address, Settings::values.udp_input_port, | 98 | client->ReloadSocket(Settings::values.udp_input_address, Settings::values.udp_input_port, |
| 93 | Settings::values.udp_pad_index); | 99 | Settings::values.udp_pad_index); |
diff --git a/src/input_common/udp/udp.h b/src/input_common/udp/udp.h index 4f83f0441..672a5c812 100644 --- a/src/input_common/udp/udp.h +++ b/src/input_common/udp/udp.h | |||
| @@ -5,19 +5,26 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <memory> | 7 | #include <memory> |
| 8 | #include <vector> | ||
| 9 | #include "common/param_package.h" | ||
| 8 | 10 | ||
| 9 | namespace InputCommon::CemuhookUDP { | 11 | namespace InputCommon::CemuhookUDP { |
| 10 | 12 | ||
| 11 | class Client; | 13 | class Client; |
| 14 | class UDPMotionFactory; | ||
| 15 | class UDPTouchFactory; | ||
| 12 | 16 | ||
| 13 | class State { | 17 | class State { |
| 14 | public: | 18 | public: |
| 15 | State(); | 19 | State(); |
| 16 | ~State(); | 20 | ~State(); |
| 17 | void ReloadUDPClient(); | 21 | void ReloadUDPClient(); |
| 22 | std::vector<Common::ParamPackage> GetInputDevices() const; | ||
| 18 | 23 | ||
| 19 | private: | 24 | private: |
| 20 | std::unique_ptr<Client> client; | 25 | std::unique_ptr<Client> client; |
| 26 | std::shared_ptr<UDPMotionFactory> motion_factory; | ||
| 27 | std::shared_ptr<UDPTouchFactory> touch_factory; | ||
| 21 | }; | 28 | }; |
| 22 | 29 | ||
| 23 | std::unique_ptr<State> Init(); | 30 | std::unique_ptr<State> Init(); |