diff options
author | t895 <clombardo169@gmail.com> | 2024-02-17 03:19:17 +0100 |
---|---|---|
committer | t895 <clombardo169@gmail.com> | 2024-02-17 18:32:33 +0100 |
commit | 50ecad547ea7e88301583f17c9f1eea2cc75b0af (patch) | |
tree | 21e6a6669ea19d05b389b097c0d411654aba4fbf /src/input_common/main.cpp | |
parent | hid_core: Prevent crash if we try to iterate through empty color devices list (diff) | |
download | yuzu-50ecad547ea7e88301583f17c9f1eea2cc75b0af.tar yuzu-50ecad547ea7e88301583f17c9f1eea2cc75b0af.tar.gz yuzu-50ecad547ea7e88301583f17c9f1eea2cc75b0af.tar.bz2 yuzu-50ecad547ea7e88301583f17c9f1eea2cc75b0af.tar.lz yuzu-50ecad547ea7e88301583f17c9f1eea2cc75b0af.tar.xz yuzu-50ecad547ea7e88301583f17c9f1eea2cc75b0af.tar.zst yuzu-50ecad547ea7e88301583f17c9f1eea2cc75b0af.zip |
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 @@ #include <memory> #include "common/input.h" #include "common/param_package.h" -#include "input_common/drivers/android.h" #include "input_common/drivers/camera.h" #include "input_common/drivers/keyboard.h" #include "input_common/drivers/mouse.h" @@ -28,6 +27,10 @@ #include "input_common/drivers/sdl_driver.h" #endif +#ifdef ANDROID +#include "input_common/drivers/android.h" +#endif + namespace InputCommon { /// Dummy engine to get periodic updates @@ -79,7 +82,9 @@ struct InputSubsystem::Impl { RegisterEngine("cemuhookudp", udp_client); RegisterEngine("tas", tas_input); RegisterEngine("camera", camera); +#ifdef ANDROID RegisterEngine("android", android); +#endif RegisterEngine("virtual_amiibo", virtual_amiibo); RegisterEngine("virtual_gamepad", virtual_gamepad); #ifdef HAVE_SDL2 @@ -111,7 +116,9 @@ struct InputSubsystem::Impl { UnregisterEngine(udp_client); UnregisterEngine(tas_input); UnregisterEngine(camera); +#ifdef ANDROID UnregisterEngine(android); +#endif UnregisterEngine(virtual_amiibo); UnregisterEngine(virtual_gamepad); #ifdef HAVE_SDL2 @@ -128,12 +135,16 @@ struct InputSubsystem::Impl { Common::ParamPackage{{"display", "Any"}, {"engine", "any"}}, }; +#ifndef ANDROID auto keyboard_devices = keyboard->GetInputDevices(); devices.insert(devices.end(), keyboard_devices.begin(), keyboard_devices.end()); auto mouse_devices = mouse->GetInputDevices(); devices.insert(devices.end(), mouse_devices.begin(), mouse_devices.end()); +#endif +#ifdef ANDROID auto android_devices = android->GetInputDevices(); devices.insert(devices.end(), android_devices.begin(), android_devices.end()); +#endif #ifdef HAVE_LIBUSB auto gcadapter_devices = gcadapter->GetInputDevices(); devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end()); @@ -162,9 +173,11 @@ struct InputSubsystem::Impl { if (engine == mouse->GetEngineName()) { return mouse; } +#ifdef ANDROID if (engine == android->GetEngineName()) { return android; } +#endif #ifdef HAVE_LIBUSB if (engine == gcadapter->GetEngineName()) { return gcadapter; @@ -245,9 +258,11 @@ struct InputSubsystem::Impl { if (engine == mouse->GetEngineName()) { return true; } +#ifdef ANDROID if (engine == android->GetEngineName()) { return true; } +#endif #ifdef HAVE_LIBUSB if (engine == gcadapter->GetEngineName()) { return true; @@ -276,7 +291,9 @@ struct InputSubsystem::Impl { void BeginConfiguration() { keyboard->BeginConfiguration(); mouse->BeginConfiguration(); +#ifdef ANDROID android->BeginConfiguration(); +#endif #ifdef HAVE_LIBUSB gcadapter->BeginConfiguration(); #endif @@ -290,7 +307,9 @@ struct InputSubsystem::Impl { void EndConfiguration() { keyboard->EndConfiguration(); mouse->EndConfiguration(); +#ifdef ANDROID android->EndConfiguration(); +#endif #ifdef HAVE_LIBUSB gcadapter->EndConfiguration(); #endif @@ -321,7 +340,6 @@ struct InputSubsystem::Impl { std::shared_ptr<TasInput::Tas> tas_input; std::shared_ptr<CemuhookUDP::UDPClient> udp_client; std::shared_ptr<Camera> camera; - std::shared_ptr<Android> android; std::shared_ptr<VirtualAmiibo> virtual_amiibo; std::shared_ptr<VirtualGamepad> virtual_gamepad; @@ -333,6 +351,10 @@ struct InputSubsystem::Impl { std::shared_ptr<SDLDriver> sdl; std::shared_ptr<Joycons> joycon; #endif + +#ifdef ANDROID + std::shared_ptr<Android> android; +#endif }; InputSubsystem::InputSubsystem() : impl{std::make_unique<Impl>()} {} @@ -387,6 +409,7 @@ const Camera* InputSubsystem::GetCamera() const { return impl->camera.get(); } +#ifdef ANDROID Android* InputSubsystem::GetAndroid() { return impl->android.get(); } @@ -394,6 +417,7 @@ Android* InputSubsystem::GetAndroid() { const Android* InputSubsystem::GetAndroid() const { return impl->android.get(); } +#endif VirtualAmiibo* InputSubsystem::GetVirtualAmiibo() { return impl->virtual_amiibo.get(); |