summaryrefslogtreecommitdiff
path: root/src/input_common/main.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2020-09-23 15:55:26 -0700
committerGravatar GitHub2020-09-23 15:55:26 -0700
commit10e8acc4513b0f286fd485aa366cd8b7900c63ca (patch)
tree4e7a3cbe17ed34736530bb4ec61e2fe6a181afa2 /src/input_common/main.cpp
parentMerge pull request #4702 from lioncash/doc-warn (diff)
parentAdd automap feature for GC adapter (diff)
downloadyuzu-10e8acc4513b0f286fd485aa366cd8b7900c63ca.tar.gz
yuzu-10e8acc4513b0f286fd485aa366cd8b7900c63ca.tar.xz
yuzu-10e8acc4513b0f286fd485aa366cd8b7900c63ca.zip
Merge pull request #4618 from german77/GcAdapterAutoMap
Add automap feature for GC adapter
Diffstat (limited to 'src/input_common/main.cpp')
-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 {
22 22
23struct InputSubsystem::Impl { 23struct InputSubsystem::Impl {
24 void Initialize() { 24 void Initialize() {
25 auto gcadapter = std::make_shared<GCAdapter::Adapter>(); 25 gcadapter = std::make_shared<GCAdapter::Adapter>();
26 gcbuttons = std::make_shared<GCButtonFactory>(gcadapter); 26 gcbuttons = std::make_shared<GCButtonFactory>(gcadapter);
27 Input::RegisterFactory<Input::ButtonDevice>("gcpad", gcbuttons); 27 Input::RegisterFactory<Input::ButtonDevice>("gcpad", gcbuttons);
28 gcanalog = std::make_shared<GCAnalogFactory>(gcadapter); 28 gcanalog = std::make_shared<GCAnalogFactory>(gcadapter);
@@ -82,6 +82,8 @@ struct InputSubsystem::Impl {
82#endif 82#endif
83 auto udp_devices = udp->GetInputDevices(); 83 auto udp_devices = udp->GetInputDevices();
84 devices.insert(devices.end(), udp_devices.begin(), udp_devices.end()); 84 devices.insert(devices.end(), udp_devices.begin(), udp_devices.end());
85 auto gcpad_devices = gcadapter->GetInputDevices();
86 devices.insert(devices.end(), gcpad_devices.begin(), gcpad_devices.end());
85 return devices; 87 return devices;
86 } 88 }
87 89
@@ -94,6 +96,9 @@ struct InputSubsystem::Impl {
94 // TODO consider returning the SDL key codes for the default keybindings 96 // TODO consider returning the SDL key codes for the default keybindings
95 return {}; 97 return {};
96 } 98 }
99 if (params.Get("class", "") == "gcpad") {
100 return gcadapter->GetAnalogMappingForDevice(params);
101 }
97#ifdef HAVE_SDL2 102#ifdef HAVE_SDL2
98 if (params.Get("class", "") == "sdl") { 103 if (params.Get("class", "") == "sdl") {
99 return sdl->GetAnalogMappingForDevice(params); 104 return sdl->GetAnalogMappingForDevice(params);
@@ -111,6 +116,9 @@ struct InputSubsystem::Impl {
111 // TODO consider returning the SDL key codes for the default keybindings 116 // TODO consider returning the SDL key codes for the default keybindings
112 return {}; 117 return {};
113 } 118 }
119 if (params.Get("class", "") == "gcpad") {
120 return gcadapter->GetButtonMappingForDevice(params);
121 }
114#ifdef HAVE_SDL2 122#ifdef HAVE_SDL2
115 if (params.Get("class", "") == "sdl") { 123 if (params.Get("class", "") == "sdl") {
116 return sdl->GetButtonMappingForDevice(params); 124 return sdl->GetButtonMappingForDevice(params);
@@ -141,6 +149,7 @@ struct InputSubsystem::Impl {
141 std::shared_ptr<UDPMotionFactory> udpmotion; 149 std::shared_ptr<UDPMotionFactory> udpmotion;
142 std::shared_ptr<UDPTouchFactory> udptouch; 150 std::shared_ptr<UDPTouchFactory> udptouch;
143 std::shared_ptr<CemuhookUDP::Client> udp; 151 std::shared_ptr<CemuhookUDP::Client> udp;
152 std::shared_ptr<GCAdapter::Adapter> gcadapter;
144}; 153};
145 154
146InputSubsystem::InputSubsystem() : impl{std::make_unique<Impl>()} {} 155InputSubsystem::InputSubsystem() : impl{std::make_unique<Impl>()} {}