summaryrefslogtreecommitdiffstats
path: root/src/input_common/main.cpp
diff options
context:
space:
mode:
authorgerman <german@thesoftwareartisans.com>2020-09-02 01:17:59 +0200
committergerman <german@thesoftwareartisans.com>2020-09-18 23:51:16 +0200
commitc5e257017f6ffb888534af1ebbc34fffd7a35a2e (patch)
tree59063b1fce2ab10ca9cbf9c3e07869921068a74e /src/input_common/main.cpp
parentMerge pull request #4684 from lioncash/desig4 (diff)
downloadyuzu-c5e257017f6ffb888534af1ebbc34fffd7a35a2e.tar
yuzu-c5e257017f6ffb888534af1ebbc34fffd7a35a2e.tar.gz
yuzu-c5e257017f6ffb888534af1ebbc34fffd7a35a2e.tar.bz2
yuzu-c5e257017f6ffb888534af1ebbc34fffd7a35a2e.tar.lz
yuzu-c5e257017f6ffb888534af1ebbc34fffd7a35a2e.tar.xz
yuzu-c5e257017f6ffb888534af1ebbc34fffd7a35a2e.tar.zst
yuzu-c5e257017f6ffb888534af1ebbc34fffd7a35a2e.zip
Diffstat (limited to '')
-rw-r--r--src/input_common/main.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp
index 062ec66b5..8da829132 100644
--- a/src/input_common/main.cpp
+++ b/src/input_common/main.cpp
@@ -22,7 +22,7 @@ namespace InputCommon {
struct InputSubsystem::Impl {
void Initialize() {
- auto gcadapter = std::make_shared<GCAdapter::Adapter>();
+ gcadapter = std::make_shared<GCAdapter::Adapter>();
gcbuttons = std::make_shared<GCButtonFactory>(gcadapter);
Input::RegisterFactory<Input::ButtonDevice>("gcpad", gcbuttons);
gcanalog = std::make_shared<GCAnalogFactory>(gcadapter);
@@ -82,6 +82,8 @@ struct InputSubsystem::Impl {
#endif
auto udp_devices = udp->GetInputDevices();
devices.insert(devices.end(), udp_devices.begin(), udp_devices.end());
+ auto gcpad_devices = gcadapter->GetInputDevices();
+ devices.insert(devices.end(), gcpad_devices.begin(), gcpad_devices.end());
return devices;
}
@@ -94,6 +96,9 @@ struct InputSubsystem::Impl {
// TODO consider returning the SDL key codes for the default keybindings
return {};
}
+ if (params.Get("class", "") == "gcpad") {
+ return gcadapter->GetAnalogMappingForDevice(params);
+ }
#ifdef HAVE_SDL2
if (params.Get("class", "") == "sdl") {
return sdl->GetAnalogMappingForDevice(params);
@@ -111,6 +116,9 @@ struct InputSubsystem::Impl {
// TODO consider returning the SDL key codes for the default keybindings
return {};
}
+ if (params.Get("class", "") == "gcpad") {
+ return gcadapter->GetButtonMappingForDevice(params);
+ }
#ifdef HAVE_SDL2
if (params.Get("class", "") == "sdl") {
return sdl->GetButtonMappingForDevice(params);
@@ -141,6 +149,7 @@ struct InputSubsystem::Impl {
std::shared_ptr<UDPMotionFactory> udpmotion;
std::shared_ptr<UDPTouchFactory> udptouch;
std::shared_ptr<CemuhookUDP::Client> udp;
+ std::shared_ptr<GCAdapter::Adapter> gcadapter;
};
InputSubsystem::InputSubsystem() : impl{std::make_unique<Impl>()} {}