diff options
| author | 2022-12-20 11:34:33 -0600 | |
|---|---|---|
| committer | 2023-01-19 18:05:20 -0600 | |
| commit | d80e6c399bf8196646cca5ac1265d122638bb96b (patch) | |
| tree | 328254642e4edcd5e0aadfe9190f3f133d34708e /src/input_common/main.cpp | |
| parent | Merge pull request #9556 from vonchenplus/draw_texture (diff) | |
| download | yuzu-d80e6c399bf8196646cca5ac1265d122638bb96b.tar.gz yuzu-d80e6c399bf8196646cca5ac1265d122638bb96b.tar.xz yuzu-d80e6c399bf8196646cca5ac1265d122638bb96b.zip | |
input_common: Initial skeleton for custom joycon driver
Diffstat (limited to 'src/input_common/main.cpp')
| -rw-r--r-- | src/input_common/main.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index e0b2131ed..c77fc04ee 100644 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include "input_common/drivers/gc_adapter.h" | 23 | #include "input_common/drivers/gc_adapter.h" |
| 24 | #endif | 24 | #endif |
| 25 | #ifdef HAVE_SDL2 | 25 | #ifdef HAVE_SDL2 |
| 26 | #include "input_common/drivers/joycon.h" | ||
| 26 | #include "input_common/drivers/sdl_driver.h" | 27 | #include "input_common/drivers/sdl_driver.h" |
| 27 | #endif | 28 | #endif |
| 28 | 29 | ||
| @@ -81,6 +82,7 @@ struct InputSubsystem::Impl { | |||
| 81 | RegisterEngine("virtual_gamepad", virtual_gamepad); | 82 | RegisterEngine("virtual_gamepad", virtual_gamepad); |
| 82 | #ifdef HAVE_SDL2 | 83 | #ifdef HAVE_SDL2 |
| 83 | RegisterEngine("sdl", sdl); | 84 | RegisterEngine("sdl", sdl); |
| 85 | RegisterEngine("joycon", joycon); | ||
| 84 | #endif | 86 | #endif |
| 85 | 87 | ||
| 86 | Common::Input::RegisterInputFactory("touch_from_button", | 88 | Common::Input::RegisterInputFactory("touch_from_button", |
| @@ -111,6 +113,7 @@ struct InputSubsystem::Impl { | |||
| 111 | UnregisterEngine(virtual_gamepad); | 113 | UnregisterEngine(virtual_gamepad); |
| 112 | #ifdef HAVE_SDL2 | 114 | #ifdef HAVE_SDL2 |
| 113 | UnregisterEngine(sdl); | 115 | UnregisterEngine(sdl); |
| 116 | UnregisterEngine(joycon); | ||
| 114 | #endif | 117 | #endif |
| 115 | 118 | ||
| 116 | Common::Input::UnregisterInputFactory("touch_from_button"); | 119 | Common::Input::UnregisterInputFactory("touch_from_button"); |
| @@ -133,6 +136,8 @@ struct InputSubsystem::Impl { | |||
| 133 | auto udp_devices = udp_client->GetInputDevices(); | 136 | auto udp_devices = udp_client->GetInputDevices(); |
| 134 | devices.insert(devices.end(), udp_devices.begin(), udp_devices.end()); | 137 | devices.insert(devices.end(), udp_devices.begin(), udp_devices.end()); |
| 135 | #ifdef HAVE_SDL2 | 138 | #ifdef HAVE_SDL2 |
| 139 | auto joycon_devices = joycon->GetInputDevices(); | ||
| 140 | devices.insert(devices.end(), joycon_devices.begin(), joycon_devices.end()); | ||
| 136 | auto sdl_devices = sdl->GetInputDevices(); | 141 | auto sdl_devices = sdl->GetInputDevices(); |
| 137 | devices.insert(devices.end(), sdl_devices.begin(), sdl_devices.end()); | 142 | devices.insert(devices.end(), sdl_devices.begin(), sdl_devices.end()); |
| 138 | #endif | 143 | #endif |
| @@ -164,6 +169,9 @@ struct InputSubsystem::Impl { | |||
| 164 | if (engine == sdl->GetEngineName()) { | 169 | if (engine == sdl->GetEngineName()) { |
| 165 | return sdl; | 170 | return sdl; |
| 166 | } | 171 | } |
| 172 | if (engine == joycon->GetEngineName()) { | ||
| 173 | return joycon; | ||
| 174 | } | ||
| 167 | #endif | 175 | #endif |
| 168 | return nullptr; | 176 | return nullptr; |
| 169 | } | 177 | } |
| @@ -247,6 +255,9 @@ struct InputSubsystem::Impl { | |||
| 247 | if (engine == sdl->GetEngineName()) { | 255 | if (engine == sdl->GetEngineName()) { |
| 248 | return true; | 256 | return true; |
| 249 | } | 257 | } |
| 258 | if (engine == joycon->GetEngineName()) { | ||
| 259 | return true; | ||
| 260 | } | ||
| 250 | #endif | 261 | #endif |
| 251 | return false; | 262 | return false; |
| 252 | } | 263 | } |
| @@ -260,6 +271,7 @@ struct InputSubsystem::Impl { | |||
| 260 | udp_client->BeginConfiguration(); | 271 | udp_client->BeginConfiguration(); |
| 261 | #ifdef HAVE_SDL2 | 272 | #ifdef HAVE_SDL2 |
| 262 | sdl->BeginConfiguration(); | 273 | sdl->BeginConfiguration(); |
| 274 | joycon->BeginConfiguration(); | ||
| 263 | #endif | 275 | #endif |
| 264 | } | 276 | } |
| 265 | 277 | ||
| @@ -272,6 +284,7 @@ struct InputSubsystem::Impl { | |||
| 272 | udp_client->EndConfiguration(); | 284 | udp_client->EndConfiguration(); |
| 273 | #ifdef HAVE_SDL2 | 285 | #ifdef HAVE_SDL2 |
| 274 | sdl->EndConfiguration(); | 286 | sdl->EndConfiguration(); |
| 287 | joycon->EndConfiguration(); | ||
| 275 | #endif | 288 | #endif |
| 276 | } | 289 | } |
| 277 | 290 | ||
| @@ -304,6 +317,7 @@ struct InputSubsystem::Impl { | |||
| 304 | 317 | ||
| 305 | #ifdef HAVE_SDL2 | 318 | #ifdef HAVE_SDL2 |
| 306 | std::shared_ptr<SDLDriver> sdl; | 319 | std::shared_ptr<SDLDriver> sdl; |
| 320 | std::shared_ptr<Joycons> joycon; | ||
| 307 | #endif | 321 | #endif |
| 308 | }; | 322 | }; |
| 309 | 323 | ||