diff options
| author | 2022-12-28 17:26:46 -0500 | |
|---|---|---|
| committer | 2022-12-28 17:26:46 -0500 | |
| commit | be43b62d79cc03f9908ce5036f96a94e9053ba65 (patch) | |
| tree | 0c55f4709eb56914520aa711f5735a96877fda1f /src/input_common/main.cpp | |
| parent | cmake: ignore missing package finders for packages with submodule fallbacks (diff) | |
| download | yuzu-be43b62d79cc03f9908ce5036f96a94e9053ba65.tar.gz yuzu-be43b62d79cc03f9908ce5036f96a94e9053ba65.tar.xz yuzu-be43b62d79cc03f9908ce5036f96a94e9053ba65.zip | |
cmake: make libusb optional
Diffstat (limited to 'src/input_common/main.cpp')
| -rw-r--r-- | src/input_common/main.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index 86deb4c7c..4dc92f482 100644 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp | |||
| @@ -5,7 +5,6 @@ | |||
| 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/camera.h" | 7 | #include "input_common/drivers/camera.h" |
| 8 | #include "input_common/drivers/gc_adapter.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" |
| 11 | #include "input_common/drivers/tas_input.h" | 10 | #include "input_common/drivers/tas_input.h" |
| @@ -19,6 +18,10 @@ | |||
| 19 | #include "input_common/input_mapping.h" | 18 | #include "input_common/input_mapping.h" |
| 20 | #include "input_common/input_poller.h" | 19 | #include "input_common/input_poller.h" |
| 21 | #include "input_common/main.h" | 20 | #include "input_common/main.h" |
| 21 | |||
| 22 | #ifdef HAVE_LIBUSB | ||
| 23 | #include "input_common/drivers/gc_adapter.h" | ||
| 24 | #endif | ||
| 22 | #ifdef HAVE_SDL2 | 25 | #ifdef HAVE_SDL2 |
| 23 | #include "input_common/drivers/sdl_driver.h" | 26 | #include "input_common/drivers/sdl_driver.h" |
| 24 | #endif | 27 | #endif |
| @@ -45,7 +48,9 @@ struct InputSubsystem::Impl { | |||
| 45 | RegisterEngine("keyboard", keyboard); | 48 | RegisterEngine("keyboard", keyboard); |
| 46 | RegisterEngine("mouse", mouse); | 49 | RegisterEngine("mouse", mouse); |
| 47 | RegisterEngine("touch", touch_screen); | 50 | RegisterEngine("touch", touch_screen); |
| 51 | #ifdef HAVE_LIBUSB | ||
| 48 | RegisterEngine("gcpad", gcadapter); | 52 | RegisterEngine("gcpad", gcadapter); |
| 53 | #endif | ||
| 49 | RegisterEngine("cemuhookudp", udp_client); | 54 | RegisterEngine("cemuhookudp", udp_client); |
| 50 | RegisterEngine("tas", tas_input); | 55 | RegisterEngine("tas", tas_input); |
| 51 | RegisterEngine("camera", camera); | 56 | RegisterEngine("camera", camera); |
| @@ -72,7 +77,9 @@ struct InputSubsystem::Impl { | |||
| 72 | UnregisterEngine(keyboard); | 77 | UnregisterEngine(keyboard); |
| 73 | UnregisterEngine(mouse); | 78 | UnregisterEngine(mouse); |
| 74 | UnregisterEngine(touch_screen); | 79 | UnregisterEngine(touch_screen); |
| 80 | #ifdef HAVE_LIBUSB | ||
| 75 | UnregisterEngine(gcadapter); | 81 | UnregisterEngine(gcadapter); |
| 82 | #endif | ||
| 76 | UnregisterEngine(udp_client); | 83 | UnregisterEngine(udp_client); |
| 77 | UnregisterEngine(tas_input); | 84 | UnregisterEngine(tas_input); |
| 78 | UnregisterEngine(camera); | 85 | UnregisterEngine(camera); |
| @@ -95,8 +102,10 @@ struct InputSubsystem::Impl { | |||
| 95 | devices.insert(devices.end(), keyboard_devices.begin(), keyboard_devices.end()); | 102 | devices.insert(devices.end(), keyboard_devices.begin(), keyboard_devices.end()); |
| 96 | auto mouse_devices = mouse->GetInputDevices(); | 103 | auto mouse_devices = mouse->GetInputDevices(); |
| 97 | devices.insert(devices.end(), mouse_devices.begin(), mouse_devices.end()); | 104 | devices.insert(devices.end(), mouse_devices.begin(), mouse_devices.end()); |
| 105 | #ifdef HAVE_LIBUSB | ||
| 98 | auto gcadapter_devices = gcadapter->GetInputDevices(); | 106 | auto gcadapter_devices = gcadapter->GetInputDevices(); |
| 99 | devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end()); | 107 | devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end()); |
| 108 | #endif | ||
| 100 | auto udp_devices = udp_client->GetInputDevices(); | 109 | auto udp_devices = udp_client->GetInputDevices(); |
| 101 | devices.insert(devices.end(), udp_devices.begin(), udp_devices.end()); | 110 | devices.insert(devices.end(), udp_devices.begin(), udp_devices.end()); |
| 102 | #ifdef HAVE_SDL2 | 111 | #ifdef HAVE_SDL2 |
| @@ -119,9 +128,11 @@ struct InputSubsystem::Impl { | |||
| 119 | if (engine == mouse->GetEngineName()) { | 128 | if (engine == mouse->GetEngineName()) { |
| 120 | return mouse; | 129 | return mouse; |
| 121 | } | 130 | } |
| 131 | #ifdef HAVE_LIBUSB | ||
| 122 | if (engine == gcadapter->GetEngineName()) { | 132 | if (engine == gcadapter->GetEngineName()) { |
| 123 | return gcadapter; | 133 | return gcadapter; |
| 124 | } | 134 | } |
| 135 | #endif | ||
| 125 | if (engine == udp_client->GetEngineName()) { | 136 | if (engine == udp_client->GetEngineName()) { |
| 126 | return udp_client; | 137 | return udp_client; |
| 127 | } | 138 | } |
| @@ -194,9 +205,11 @@ struct InputSubsystem::Impl { | |||
| 194 | if (engine == mouse->GetEngineName()) { | 205 | if (engine == mouse->GetEngineName()) { |
| 195 | return true; | 206 | return true; |
| 196 | } | 207 | } |
| 208 | #ifdef HAVE_LIBUSB | ||
| 197 | if (engine == gcadapter->GetEngineName()) { | 209 | if (engine == gcadapter->GetEngineName()) { |
| 198 | return true; | 210 | return true; |
| 199 | } | 211 | } |
| 212 | #endif | ||
| 200 | if (engine == udp_client->GetEngineName()) { | 213 | if (engine == udp_client->GetEngineName()) { |
| 201 | return true; | 214 | return true; |
| 202 | } | 215 | } |
| @@ -217,7 +230,9 @@ struct InputSubsystem::Impl { | |||
| 217 | void BeginConfiguration() { | 230 | void BeginConfiguration() { |
| 218 | keyboard->BeginConfiguration(); | 231 | keyboard->BeginConfiguration(); |
| 219 | mouse->BeginConfiguration(); | 232 | mouse->BeginConfiguration(); |
| 233 | #ifdef HAVE_LIBUSB | ||
| 220 | gcadapter->BeginConfiguration(); | 234 | gcadapter->BeginConfiguration(); |
| 235 | #endif | ||
| 221 | udp_client->BeginConfiguration(); | 236 | udp_client->BeginConfiguration(); |
| 222 | #ifdef HAVE_SDL2 | 237 | #ifdef HAVE_SDL2 |
| 223 | sdl->BeginConfiguration(); | 238 | sdl->BeginConfiguration(); |
| @@ -227,7 +242,9 @@ struct InputSubsystem::Impl { | |||
| 227 | void EndConfiguration() { | 242 | void EndConfiguration() { |
| 228 | keyboard->EndConfiguration(); | 243 | keyboard->EndConfiguration(); |
| 229 | mouse->EndConfiguration(); | 244 | mouse->EndConfiguration(); |
| 245 | #ifdef HAVE_LIBUSB | ||
| 230 | gcadapter->EndConfiguration(); | 246 | gcadapter->EndConfiguration(); |
| 247 | #endif | ||
| 231 | udp_client->EndConfiguration(); | 248 | udp_client->EndConfiguration(); |
| 232 | #ifdef HAVE_SDL2 | 249 | #ifdef HAVE_SDL2 |
| 233 | sdl->EndConfiguration(); | 250 | sdl->EndConfiguration(); |
| @@ -248,7 +265,6 @@ struct InputSubsystem::Impl { | |||
| 248 | 265 | ||
| 249 | std::shared_ptr<Keyboard> keyboard; | 266 | std::shared_ptr<Keyboard> keyboard; |
| 250 | std::shared_ptr<Mouse> mouse; | 267 | std::shared_ptr<Mouse> mouse; |
| 251 | std::shared_ptr<GCAdapter> gcadapter; | ||
| 252 | std::shared_ptr<TouchScreen> touch_screen; | 268 | std::shared_ptr<TouchScreen> touch_screen; |
| 253 | std::shared_ptr<TasInput::Tas> tas_input; | 269 | std::shared_ptr<TasInput::Tas> tas_input; |
| 254 | std::shared_ptr<CemuhookUDP::UDPClient> udp_client; | 270 | std::shared_ptr<CemuhookUDP::UDPClient> udp_client; |
| @@ -256,6 +272,10 @@ struct InputSubsystem::Impl { | |||
| 256 | std::shared_ptr<VirtualAmiibo> virtual_amiibo; | 272 | std::shared_ptr<VirtualAmiibo> virtual_amiibo; |
| 257 | std::shared_ptr<VirtualGamepad> virtual_gamepad; | 273 | std::shared_ptr<VirtualGamepad> virtual_gamepad; |
| 258 | 274 | ||
| 275 | #ifdef HAVE_LIBUSB | ||
| 276 | std::shared_ptr<GCAdapter> gcadapter; | ||
| 277 | #endif | ||
| 278 | |||
| 259 | #ifdef HAVE_SDL2 | 279 | #ifdef HAVE_SDL2 |
| 260 | std::shared_ptr<SDLDriver> sdl; | 280 | std::shared_ptr<SDLDriver> sdl; |
| 261 | #endif | 281 | #endif |