summaryrefslogtreecommitdiffstats
path: root/src/input_common/main.cpp
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-01-24 15:29:37 +0100
committerGitHub <noreply@github.com>2023-01-24 15:29:37 +0100
commita68af583ea378b48e2ed5a19f519a815ba89e40f (patch)
tree2983c14a7d4bc2797259c7d97462a439bec629f3 /src/input_common/main.cpp
parentMerge pull request #9555 from abouvier/catch2-update (diff)
parentcore: hid: Make use of SCOPE_EXIT and SCOPE_GUARD where applicable (diff)
downloadyuzu-a68af583ea378b48e2ed5a19f519a815ba89e40f.tar
yuzu-a68af583ea378b48e2ed5a19f519a815ba89e40f.tar.gz
yuzu-a68af583ea378b48e2ed5a19f519a815ba89e40f.tar.bz2
yuzu-a68af583ea378b48e2ed5a19f519a815ba89e40f.tar.lz
yuzu-a68af583ea378b48e2ed5a19f519a815ba89e40f.tar.xz
yuzu-a68af583ea378b48e2ed5a19f519a815ba89e40f.tar.zst
yuzu-a68af583ea378b48e2ed5a19f519a815ba89e40f.zip
Diffstat (limited to 'src/input_common/main.cpp')
-rw-r--r--src/input_common/main.cpp14
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 @@
#include "input_common/drivers/gc_adapter.h"
#endif
#ifdef HAVE_SDL2
+#include "input_common/drivers/joycon.h"
#include "input_common/drivers/sdl_driver.h"
#endif
@@ -81,6 +82,7 @@ struct InputSubsystem::Impl {
RegisterEngine("virtual_gamepad", virtual_gamepad);
#ifdef HAVE_SDL2
RegisterEngine("sdl", sdl);
+ RegisterEngine("joycon", joycon);
#endif
Common::Input::RegisterInputFactory("touch_from_button",
@@ -111,6 +113,7 @@ struct InputSubsystem::Impl {
UnregisterEngine(virtual_gamepad);
#ifdef HAVE_SDL2
UnregisterEngine(sdl);
+ UnregisterEngine(joycon);
#endif
Common::Input::UnregisterInputFactory("touch_from_button");
@@ -133,6 +136,8 @@ struct InputSubsystem::Impl {
auto udp_devices = udp_client->GetInputDevices();
devices.insert(devices.end(), udp_devices.begin(), udp_devices.end());
#ifdef HAVE_SDL2
+ auto joycon_devices = joycon->GetInputDevices();
+ devices.insert(devices.end(), joycon_devices.begin(), joycon_devices.end());
auto sdl_devices = sdl->GetInputDevices();
devices.insert(devices.end(), sdl_devices.begin(), sdl_devices.end());
#endif
@@ -164,6 +169,9 @@ struct InputSubsystem::Impl {
if (engine == sdl->GetEngineName()) {
return sdl;
}
+ if (engine == joycon->GetEngineName()) {
+ return joycon;
+ }
#endif
return nullptr;
}
@@ -247,6 +255,9 @@ struct InputSubsystem::Impl {
if (engine == sdl->GetEngineName()) {
return true;
}
+ if (engine == joycon->GetEngineName()) {
+ return true;
+ }
#endif
return false;
}
@@ -260,6 +271,7 @@ struct InputSubsystem::Impl {
udp_client->BeginConfiguration();
#ifdef HAVE_SDL2
sdl->BeginConfiguration();
+ joycon->BeginConfiguration();
#endif
}
@@ -272,6 +284,7 @@ struct InputSubsystem::Impl {
udp_client->EndConfiguration();
#ifdef HAVE_SDL2
sdl->EndConfiguration();
+ joycon->EndConfiguration();
#endif
}
@@ -304,6 +317,7 @@ struct InputSubsystem::Impl {
#ifdef HAVE_SDL2
std::shared_ptr<SDLDriver> sdl;
+ std::shared_ptr<Joycons> joycon;
#endif
};