diff options
Diffstat (limited to 'src/input_common/main.cpp')
| -rw-r--r-- | src/input_common/main.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index a4d7ed645..21834fb6b 100644 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <memory> | 5 | #include <memory> |
| 6 | #include <thread> | ||
| 7 | #include "common/input.h" | 6 | #include "common/input.h" |
| 8 | #include "common/param_package.h" | 7 | #include "common/param_package.h" |
| 9 | #include "input_common/drivers/gc_adapter.h" | 8 | #include "input_common/drivers/gc_adapter.h" |
| @@ -242,6 +241,28 @@ struct InputSubsystem::Impl { | |||
| 242 | return Common::Input::ButtonNames::Invalid; | 241 | return Common::Input::ButtonNames::Invalid; |
| 243 | } | 242 | } |
| 244 | 243 | ||
| 244 | bool IsStickInverted(const Common::ParamPackage& params) { | ||
| 245 | const std::string engine = params.Get("engine", ""); | ||
| 246 | if (engine == mouse->GetEngineName()) { | ||
| 247 | return mouse->IsStickInverted(params); | ||
| 248 | } | ||
| 249 | if (engine == gcadapter->GetEngineName()) { | ||
| 250 | return gcadapter->IsStickInverted(params); | ||
| 251 | } | ||
| 252 | if (engine == udp_client->GetEngineName()) { | ||
| 253 | return udp_client->IsStickInverted(params); | ||
| 254 | } | ||
| 255 | if (engine == tas_input->GetEngineName()) { | ||
| 256 | return tas_input->IsStickInverted(params); | ||
| 257 | } | ||
| 258 | #ifdef HAVE_SDL2 | ||
| 259 | if (engine == sdl->GetEngineName()) { | ||
| 260 | return sdl->IsStickInverted(params); | ||
| 261 | } | ||
| 262 | #endif | ||
| 263 | return false; | ||
| 264 | } | ||
| 265 | |||
| 245 | bool IsController(const Common::ParamPackage& params) { | 266 | bool IsController(const Common::ParamPackage& params) { |
| 246 | const std::string engine = params.Get("engine", ""); | 267 | const std::string engine = params.Get("engine", ""); |
| 247 | if (engine == mouse->GetEngineName()) { | 268 | if (engine == mouse->GetEngineName()) { |
| @@ -385,6 +406,13 @@ bool InputSubsystem::IsController(const Common::ParamPackage& params) const { | |||
| 385 | return impl->IsController(params); | 406 | return impl->IsController(params); |
| 386 | } | 407 | } |
| 387 | 408 | ||
| 409 | bool InputSubsystem::IsStickInverted(const Common::ParamPackage& params) const { | ||
| 410 | if (params.Has("axis_x") && params.Has("axis_y")) { | ||
| 411 | return impl->IsStickInverted(params); | ||
| 412 | } | ||
| 413 | return false; | ||
| 414 | } | ||
| 415 | |||
| 388 | void InputSubsystem::ReloadInputDevices() { | 416 | void InputSubsystem::ReloadInputDevices() { |
| 389 | impl->udp_client.get()->ReloadSockets(); | 417 | impl->udp_client.get()->ReloadSockets(); |
| 390 | } | 418 | } |