diff options
Diffstat (limited to '')
| -rw-r--r-- | src/input_common/main.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index f8749ebbf..62a7ae40f 100644 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp | |||
| @@ -4,7 +4,6 @@ | |||
| 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" | ||
| 8 | #include "input_common/drivers/camera.h" | 7 | #include "input_common/drivers/camera.h" |
| 9 | #include "input_common/drivers/keyboard.h" | 8 | #include "input_common/drivers/keyboard.h" |
| 10 | #include "input_common/drivers/mouse.h" | 9 | #include "input_common/drivers/mouse.h" |
| @@ -28,6 +27,10 @@ | |||
| 28 | #include "input_common/drivers/sdl_driver.h" | 27 | #include "input_common/drivers/sdl_driver.h" |
| 29 | #endif | 28 | #endif |
| 30 | 29 | ||
| 30 | #ifdef ANDROID | ||
| 31 | #include "input_common/drivers/android.h" | ||
| 32 | #endif | ||
| 33 | |||
| 31 | namespace InputCommon { | 34 | namespace InputCommon { |
| 32 | 35 | ||
| 33 | /// Dummy engine to get periodic updates | 36 | /// Dummy engine to get periodic updates |
| @@ -79,7 +82,9 @@ struct InputSubsystem::Impl { | |||
| 79 | RegisterEngine("cemuhookudp", udp_client); | 82 | RegisterEngine("cemuhookudp", udp_client); |
| 80 | RegisterEngine("tas", tas_input); | 83 | RegisterEngine("tas", tas_input); |
| 81 | RegisterEngine("camera", camera); | 84 | RegisterEngine("camera", camera); |
| 85 | #ifdef ANDROID | ||
| 82 | RegisterEngine("android", android); | 86 | RegisterEngine("android", android); |
| 87 | #endif | ||
| 83 | RegisterEngine("virtual_amiibo", virtual_amiibo); | 88 | RegisterEngine("virtual_amiibo", virtual_amiibo); |
| 84 | RegisterEngine("virtual_gamepad", virtual_gamepad); | 89 | RegisterEngine("virtual_gamepad", virtual_gamepad); |
| 85 | #ifdef HAVE_SDL2 | 90 | #ifdef HAVE_SDL2 |
| @@ -111,7 +116,9 @@ struct InputSubsystem::Impl { | |||
| 111 | UnregisterEngine(udp_client); | 116 | UnregisterEngine(udp_client); |
| 112 | UnregisterEngine(tas_input); | 117 | UnregisterEngine(tas_input); |
| 113 | UnregisterEngine(camera); | 118 | UnregisterEngine(camera); |
| 119 | #ifdef ANDROID | ||
| 114 | UnregisterEngine(android); | 120 | UnregisterEngine(android); |
| 121 | #endif | ||
| 115 | UnregisterEngine(virtual_amiibo); | 122 | UnregisterEngine(virtual_amiibo); |
| 116 | UnregisterEngine(virtual_gamepad); | 123 | UnregisterEngine(virtual_gamepad); |
| 117 | #ifdef HAVE_SDL2 | 124 | #ifdef HAVE_SDL2 |
| @@ -128,12 +135,16 @@ struct InputSubsystem::Impl { | |||
| 128 | Common::ParamPackage{{"display", "Any"}, {"engine", "any"}}, | 135 | Common::ParamPackage{{"display", "Any"}, {"engine", "any"}}, |
| 129 | }; | 136 | }; |
| 130 | 137 | ||
| 138 | #ifndef ANDROID | ||
| 131 | auto keyboard_devices = keyboard->GetInputDevices(); | 139 | auto keyboard_devices = keyboard->GetInputDevices(); |
| 132 | devices.insert(devices.end(), keyboard_devices.begin(), keyboard_devices.end()); | 140 | devices.insert(devices.end(), keyboard_devices.begin(), keyboard_devices.end()); |
| 133 | auto mouse_devices = mouse->GetInputDevices(); | 141 | auto mouse_devices = mouse->GetInputDevices(); |
| 134 | devices.insert(devices.end(), mouse_devices.begin(), mouse_devices.end()); | 142 | devices.insert(devices.end(), mouse_devices.begin(), mouse_devices.end()); |
| 143 | #endif | ||
| 144 | #ifdef ANDROID | ||
| 135 | auto android_devices = android->GetInputDevices(); | 145 | auto android_devices = android->GetInputDevices(); |
| 136 | devices.insert(devices.end(), android_devices.begin(), android_devices.end()); | 146 | devices.insert(devices.end(), android_devices.begin(), android_devices.end()); |
| 147 | #endif | ||
| 137 | #ifdef HAVE_LIBUSB | 148 | #ifdef HAVE_LIBUSB |
| 138 | auto gcadapter_devices = gcadapter->GetInputDevices(); | 149 | auto gcadapter_devices = gcadapter->GetInputDevices(); |
| 139 | devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end()); | 150 | devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end()); |
| @@ -162,9 +173,11 @@ struct InputSubsystem::Impl { | |||
| 162 | if (engine == mouse->GetEngineName()) { | 173 | if (engine == mouse->GetEngineName()) { |
| 163 | return mouse; | 174 | return mouse; |
| 164 | } | 175 | } |
| 176 | #ifdef ANDROID | ||
| 165 | if (engine == android->GetEngineName()) { | 177 | if (engine == android->GetEngineName()) { |
| 166 | return android; | 178 | return android; |
| 167 | } | 179 | } |
| 180 | #endif | ||
| 168 | #ifdef HAVE_LIBUSB | 181 | #ifdef HAVE_LIBUSB |
| 169 | if (engine == gcadapter->GetEngineName()) { | 182 | if (engine == gcadapter->GetEngineName()) { |
| 170 | return gcadapter; | 183 | return gcadapter; |
| @@ -245,9 +258,11 @@ struct InputSubsystem::Impl { | |||
| 245 | if (engine == mouse->GetEngineName()) { | 258 | if (engine == mouse->GetEngineName()) { |
| 246 | return true; | 259 | return true; |
| 247 | } | 260 | } |
| 261 | #ifdef ANDROID | ||
| 248 | if (engine == android->GetEngineName()) { | 262 | if (engine == android->GetEngineName()) { |
| 249 | return true; | 263 | return true; |
| 250 | } | 264 | } |
| 265 | #endif | ||
| 251 | #ifdef HAVE_LIBUSB | 266 | #ifdef HAVE_LIBUSB |
| 252 | if (engine == gcadapter->GetEngineName()) { | 267 | if (engine == gcadapter->GetEngineName()) { |
| 253 | return true; | 268 | return true; |
| @@ -276,7 +291,9 @@ struct InputSubsystem::Impl { | |||
| 276 | void BeginConfiguration() { | 291 | void BeginConfiguration() { |
| 277 | keyboard->BeginConfiguration(); | 292 | keyboard->BeginConfiguration(); |
| 278 | mouse->BeginConfiguration(); | 293 | mouse->BeginConfiguration(); |
| 294 | #ifdef ANDROID | ||
| 279 | android->BeginConfiguration(); | 295 | android->BeginConfiguration(); |
| 296 | #endif | ||
| 280 | #ifdef HAVE_LIBUSB | 297 | #ifdef HAVE_LIBUSB |
| 281 | gcadapter->BeginConfiguration(); | 298 | gcadapter->BeginConfiguration(); |
| 282 | #endif | 299 | #endif |
| @@ -290,7 +307,9 @@ struct InputSubsystem::Impl { | |||
| 290 | void EndConfiguration() { | 307 | void EndConfiguration() { |
| 291 | keyboard->EndConfiguration(); | 308 | keyboard->EndConfiguration(); |
| 292 | mouse->EndConfiguration(); | 309 | mouse->EndConfiguration(); |
| 310 | #ifdef ANDROID | ||
| 293 | android->EndConfiguration(); | 311 | android->EndConfiguration(); |
| 312 | #endif | ||
| 294 | #ifdef HAVE_LIBUSB | 313 | #ifdef HAVE_LIBUSB |
| 295 | gcadapter->EndConfiguration(); | 314 | gcadapter->EndConfiguration(); |
| 296 | #endif | 315 | #endif |
| @@ -321,7 +340,6 @@ struct InputSubsystem::Impl { | |||
| 321 | std::shared_ptr<TasInput::Tas> tas_input; | 340 | std::shared_ptr<TasInput::Tas> tas_input; |
| 322 | std::shared_ptr<CemuhookUDP::UDPClient> udp_client; | 341 | std::shared_ptr<CemuhookUDP::UDPClient> udp_client; |
| 323 | std::shared_ptr<Camera> camera; | 342 | std::shared_ptr<Camera> camera; |
| 324 | std::shared_ptr<Android> android; | ||
| 325 | std::shared_ptr<VirtualAmiibo> virtual_amiibo; | 343 | std::shared_ptr<VirtualAmiibo> virtual_amiibo; |
| 326 | std::shared_ptr<VirtualGamepad> virtual_gamepad; | 344 | std::shared_ptr<VirtualGamepad> virtual_gamepad; |
| 327 | 345 | ||
| @@ -333,6 +351,10 @@ struct InputSubsystem::Impl { | |||
| 333 | std::shared_ptr<SDLDriver> sdl; | 351 | std::shared_ptr<SDLDriver> sdl; |
| 334 | std::shared_ptr<Joycons> joycon; | 352 | std::shared_ptr<Joycons> joycon; |
| 335 | #endif | 353 | #endif |
| 354 | |||
| 355 | #ifdef ANDROID | ||
| 356 | std::shared_ptr<Android> android; | ||
| 357 | #endif | ||
| 336 | }; | 358 | }; |
| 337 | 359 | ||
| 338 | InputSubsystem::InputSubsystem() : impl{std::make_unique<Impl>()} {} | 360 | InputSubsystem::InputSubsystem() : impl{std::make_unique<Impl>()} {} |
| @@ -387,6 +409,7 @@ const Camera* InputSubsystem::GetCamera() const { | |||
| 387 | return impl->camera.get(); | 409 | return impl->camera.get(); |
| 388 | } | 410 | } |
| 389 | 411 | ||
| 412 | #ifdef ANDROID | ||
| 390 | Android* InputSubsystem::GetAndroid() { | 413 | Android* InputSubsystem::GetAndroid() { |
| 391 | return impl->android.get(); | 414 | return impl->android.get(); |
| 392 | } | 415 | } |
| @@ -394,6 +417,7 @@ Android* InputSubsystem::GetAndroid() { | |||
| 394 | const Android* InputSubsystem::GetAndroid() const { | 417 | const Android* InputSubsystem::GetAndroid() const { |
| 395 | return impl->android.get(); | 418 | return impl->android.get(); |
| 396 | } | 419 | } |
| 420 | #endif | ||
| 397 | 421 | ||
| 398 | VirtualAmiibo* InputSubsystem::GetVirtualAmiibo() { | 422 | VirtualAmiibo* InputSubsystem::GetVirtualAmiibo() { |
| 399 | return impl->virtual_amiibo.get(); | 423 | return impl->virtual_amiibo.get(); |