diff options
| author | 2024-01-17 22:01:33 -0600 | |
|---|---|---|
| committer | 2024-01-17 22:47:56 -0600 | |
| commit | 72f803c366f5406bc0098821f237c6185d1ed034 (patch) | |
| tree | eb24af3dfdcb580a3236cd5f95cfdeb8eaa38252 /src/input_common/main.cpp | |
| parent | Merge pull request #12689 from liamwhite/remove-format (diff) | |
| download | yuzu-72f803c366f5406bc0098821f237c6185d1ed034.tar.gz yuzu-72f803c366f5406bc0098821f237c6185d1ed034.tar.xz yuzu-72f803c366f5406bc0098821f237c6185d1ed034.zip | |
input_common: Add android input engine
Diffstat (limited to 'src/input_common/main.cpp')
| -rw-r--r-- | src/input_common/main.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index c77fc04ee..f8749ebbf 100644 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | #include <memory> | 4 | #include <memory> |
| 5 | #include "common/input.h" | 5 | #include "common/input.h" |
| 6 | #include "common/param_package.h" | 6 | #include "common/param_package.h" |
| 7 | #include "input_common/drivers/android.h" | ||
| 7 | #include "input_common/drivers/camera.h" | 8 | #include "input_common/drivers/camera.h" |
| 8 | #include "input_common/drivers/keyboard.h" | 9 | #include "input_common/drivers/keyboard.h" |
| 9 | #include "input_common/drivers/mouse.h" | 10 | #include "input_common/drivers/mouse.h" |
| @@ -78,6 +79,7 @@ struct InputSubsystem::Impl { | |||
| 78 | RegisterEngine("cemuhookudp", udp_client); | 79 | RegisterEngine("cemuhookudp", udp_client); |
| 79 | RegisterEngine("tas", tas_input); | 80 | RegisterEngine("tas", tas_input); |
| 80 | RegisterEngine("camera", camera); | 81 | RegisterEngine("camera", camera); |
| 82 | RegisterEngine("android", android); | ||
| 81 | RegisterEngine("virtual_amiibo", virtual_amiibo); | 83 | RegisterEngine("virtual_amiibo", virtual_amiibo); |
| 82 | RegisterEngine("virtual_gamepad", virtual_gamepad); | 84 | RegisterEngine("virtual_gamepad", virtual_gamepad); |
| 83 | #ifdef HAVE_SDL2 | 85 | #ifdef HAVE_SDL2 |
| @@ -109,6 +111,7 @@ struct InputSubsystem::Impl { | |||
| 109 | UnregisterEngine(udp_client); | 111 | UnregisterEngine(udp_client); |
| 110 | UnregisterEngine(tas_input); | 112 | UnregisterEngine(tas_input); |
| 111 | UnregisterEngine(camera); | 113 | UnregisterEngine(camera); |
| 114 | UnregisterEngine(android); | ||
| 112 | UnregisterEngine(virtual_amiibo); | 115 | UnregisterEngine(virtual_amiibo); |
| 113 | UnregisterEngine(virtual_gamepad); | 116 | UnregisterEngine(virtual_gamepad); |
| 114 | #ifdef HAVE_SDL2 | 117 | #ifdef HAVE_SDL2 |
| @@ -129,6 +132,8 @@ struct InputSubsystem::Impl { | |||
| 129 | devices.insert(devices.end(), keyboard_devices.begin(), keyboard_devices.end()); | 132 | devices.insert(devices.end(), keyboard_devices.begin(), keyboard_devices.end()); |
| 130 | auto mouse_devices = mouse->GetInputDevices(); | 133 | auto mouse_devices = mouse->GetInputDevices(); |
| 131 | devices.insert(devices.end(), mouse_devices.begin(), mouse_devices.end()); | 134 | devices.insert(devices.end(), mouse_devices.begin(), mouse_devices.end()); |
| 135 | auto android_devices = android->GetInputDevices(); | ||
| 136 | devices.insert(devices.end(), android_devices.begin(), android_devices.end()); | ||
| 132 | #ifdef HAVE_LIBUSB | 137 | #ifdef HAVE_LIBUSB |
| 133 | auto gcadapter_devices = gcadapter->GetInputDevices(); | 138 | auto gcadapter_devices = gcadapter->GetInputDevices(); |
| 134 | devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end()); | 139 | devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end()); |
| @@ -157,6 +162,9 @@ struct InputSubsystem::Impl { | |||
| 157 | if (engine == mouse->GetEngineName()) { | 162 | if (engine == mouse->GetEngineName()) { |
| 158 | return mouse; | 163 | return mouse; |
| 159 | } | 164 | } |
| 165 | if (engine == android->GetEngineName()) { | ||
| 166 | return android; | ||
| 167 | } | ||
| 160 | #ifdef HAVE_LIBUSB | 168 | #ifdef HAVE_LIBUSB |
| 161 | if (engine == gcadapter->GetEngineName()) { | 169 | if (engine == gcadapter->GetEngineName()) { |
| 162 | return gcadapter; | 170 | return gcadapter; |
| @@ -237,6 +245,9 @@ struct InputSubsystem::Impl { | |||
| 237 | if (engine == mouse->GetEngineName()) { | 245 | if (engine == mouse->GetEngineName()) { |
| 238 | return true; | 246 | return true; |
| 239 | } | 247 | } |
| 248 | if (engine == android->GetEngineName()) { | ||
| 249 | return true; | ||
| 250 | } | ||
| 240 | #ifdef HAVE_LIBUSB | 251 | #ifdef HAVE_LIBUSB |
| 241 | if (engine == gcadapter->GetEngineName()) { | 252 | if (engine == gcadapter->GetEngineName()) { |
| 242 | return true; | 253 | return true; |
| @@ -265,6 +276,7 @@ struct InputSubsystem::Impl { | |||
| 265 | void BeginConfiguration() { | 276 | void BeginConfiguration() { |
| 266 | keyboard->BeginConfiguration(); | 277 | keyboard->BeginConfiguration(); |
| 267 | mouse->BeginConfiguration(); | 278 | mouse->BeginConfiguration(); |
| 279 | android->BeginConfiguration(); | ||
| 268 | #ifdef HAVE_LIBUSB | 280 | #ifdef HAVE_LIBUSB |
| 269 | gcadapter->BeginConfiguration(); | 281 | gcadapter->BeginConfiguration(); |
| 270 | #endif | 282 | #endif |
| @@ -278,6 +290,7 @@ struct InputSubsystem::Impl { | |||
| 278 | void EndConfiguration() { | 290 | void EndConfiguration() { |
| 279 | keyboard->EndConfiguration(); | 291 | keyboard->EndConfiguration(); |
| 280 | mouse->EndConfiguration(); | 292 | mouse->EndConfiguration(); |
| 293 | android->EndConfiguration(); | ||
| 281 | #ifdef HAVE_LIBUSB | 294 | #ifdef HAVE_LIBUSB |
| 282 | gcadapter->EndConfiguration(); | 295 | gcadapter->EndConfiguration(); |
| 283 | #endif | 296 | #endif |
| @@ -308,6 +321,7 @@ struct InputSubsystem::Impl { | |||
| 308 | std::shared_ptr<TasInput::Tas> tas_input; | 321 | std::shared_ptr<TasInput::Tas> tas_input; |
| 309 | std::shared_ptr<CemuhookUDP::UDPClient> udp_client; | 322 | std::shared_ptr<CemuhookUDP::UDPClient> udp_client; |
| 310 | std::shared_ptr<Camera> camera; | 323 | std::shared_ptr<Camera> camera; |
| 324 | std::shared_ptr<Android> android; | ||
| 311 | std::shared_ptr<VirtualAmiibo> virtual_amiibo; | 325 | std::shared_ptr<VirtualAmiibo> virtual_amiibo; |
| 312 | std::shared_ptr<VirtualGamepad> virtual_gamepad; | 326 | std::shared_ptr<VirtualGamepad> virtual_gamepad; |
| 313 | 327 | ||
| @@ -373,6 +387,14 @@ const Camera* InputSubsystem::GetCamera() const { | |||
| 373 | return impl->camera.get(); | 387 | return impl->camera.get(); |
| 374 | } | 388 | } |
| 375 | 389 | ||
| 390 | Android* InputSubsystem::GetAndroid() { | ||
| 391 | return impl->android.get(); | ||
| 392 | } | ||
| 393 | |||
| 394 | const Android* InputSubsystem::GetAndroid() const { | ||
| 395 | return impl->android.get(); | ||
| 396 | } | ||
| 397 | |||
| 376 | VirtualAmiibo* InputSubsystem::GetVirtualAmiibo() { | 398 | VirtualAmiibo* InputSubsystem::GetVirtualAmiibo() { |
| 377 | return impl->virtual_amiibo.get(); | 399 | return impl->virtual_amiibo.get(); |
| 378 | } | 400 | } |