diff options
Diffstat (limited to 'src/input_common')
| -rw-r--r-- | src/input_common/drivers/tas_input.h | 1 | ||||
| -rw-r--r-- | src/input_common/helpers/touch_from_buttons.cpp | 4 | ||||
| -rw-r--r-- | src/input_common/input_engine.cpp | 2 | ||||
| -rw-r--r-- | src/input_common/input_engine.h | 5 | ||||
| -rw-r--r-- | src/input_common/input_poller.cpp | 89 |
5 files changed, 52 insertions, 49 deletions
diff --git a/src/input_common/drivers/tas_input.h b/src/input_common/drivers/tas_input.h index 5f5c3267c..82dc9d616 100644 --- a/src/input_common/drivers/tas_input.h +++ b/src/input_common/drivers/tas_input.h | |||
| @@ -188,7 +188,6 @@ private: | |||
| 188 | std::string WriteCommandAxis(TasAnalog data) const; | 188 | std::string WriteCommandAxis(TasAnalog data) const; |
| 189 | 189 | ||
| 190 | size_t script_length{0}; | 190 | size_t script_length{0}; |
| 191 | bool is_old_input_saved{false}; | ||
| 192 | bool is_recording{false}; | 191 | bool is_recording{false}; |
| 193 | bool is_running{false}; | 192 | bool is_running{false}; |
| 194 | bool needs_reset{false}; | 193 | bool needs_reset{false}; |
diff --git a/src/input_common/helpers/touch_from_buttons.cpp b/src/input_common/helpers/touch_from_buttons.cpp index fee41cae3..024343715 100644 --- a/src/input_common/helpers/touch_from_buttons.cpp +++ b/src/input_common/helpers/touch_from_buttons.cpp | |||
| @@ -12,7 +12,7 @@ namespace InputCommon { | |||
| 12 | class TouchFromButtonDevice final : public Common::Input::InputDevice { | 12 | class TouchFromButtonDevice final : public Common::Input::InputDevice { |
| 13 | public: | 13 | public: |
| 14 | using Button = std::unique_ptr<Common::Input::InputDevice>; | 14 | using Button = std::unique_ptr<Common::Input::InputDevice>; |
| 15 | TouchFromButtonDevice(Button button_, u32 touch_id_, float x_, float y_) | 15 | TouchFromButtonDevice(Button button_, int touch_id_, float x_, float y_) |
| 16 | : button(std::move(button_)), touch_id(touch_id_), x(x_), y(y_) { | 16 | : button(std::move(button_)), touch_id(touch_id_), x(x_), y(y_) { |
| 17 | Common::Input::InputCallback button_up_callback{ | 17 | Common::Input::InputCallback button_up_callback{ |
| 18 | [this](Common::Input::CallbackStatus callback_) { UpdateButtonStatus(callback_); }}; | 18 | [this](Common::Input::CallbackStatus callback_) { UpdateButtonStatus(callback_); }}; |
| @@ -52,7 +52,7 @@ public: | |||
| 52 | 52 | ||
| 53 | private: | 53 | private: |
| 54 | Button button; | 54 | Button button; |
| 55 | const u32 touch_id; | 55 | const int touch_id; |
| 56 | const float x; | 56 | const float x; |
| 57 | const float y; | 57 | const float y; |
| 58 | const Common::Input::AnalogProperties properties{0.0f, 1.0f, 0.5f, 0.0f, false}; | 58 | const Common::Input::AnalogProperties properties{0.0f, 1.0f, 0.5f, 0.0f, false}; |
diff --git a/src/input_common/input_engine.cpp b/src/input_common/input_engine.cpp index 9cfe0f232..965a2bdf1 100644 --- a/src/input_common/input_engine.cpp +++ b/src/input_common/input_engine.cpp | |||
| @@ -315,7 +315,7 @@ void InputEngine::TriggerOnMotionChange(const PadIdentifier& identifier, int mot | |||
| 315 | 315 | ||
| 316 | bool InputEngine::IsInputIdentifierEqual(const InputIdentifier& input_identifier, | 316 | bool InputEngine::IsInputIdentifierEqual(const InputIdentifier& input_identifier, |
| 317 | const PadIdentifier& identifier, EngineInputType type, | 317 | const PadIdentifier& identifier, EngineInputType type, |
| 318 | std::size_t index) const { | 318 | int index) const { |
| 319 | if (input_identifier.type != type) { | 319 | if (input_identifier.type != type) { |
| 320 | return false; | 320 | return false; |
| 321 | } | 321 | } |
diff --git a/src/input_common/input_engine.h b/src/input_common/input_engine.h index ed79d3d93..5430c0cf8 100644 --- a/src/input_common/input_engine.h +++ b/src/input_common/input_engine.h | |||
| @@ -96,7 +96,7 @@ struct MappingCallback { | |||
| 96 | struct InputIdentifier { | 96 | struct InputIdentifier { |
| 97 | PadIdentifier identifier; | 97 | PadIdentifier identifier; |
| 98 | EngineInputType type; | 98 | EngineInputType type; |
| 99 | std::size_t index; | 99 | int index; |
| 100 | UpdateCallback callback; | 100 | UpdateCallback callback; |
| 101 | }; | 101 | }; |
| 102 | 102 | ||
| @@ -216,12 +216,11 @@ private: | |||
| 216 | 216 | ||
| 217 | bool IsInputIdentifierEqual(const InputIdentifier& input_identifier, | 217 | bool IsInputIdentifierEqual(const InputIdentifier& input_identifier, |
| 218 | const PadIdentifier& identifier, EngineInputType type, | 218 | const PadIdentifier& identifier, EngineInputType type, |
| 219 | std::size_t index) const; | 219 | int index) const; |
| 220 | 220 | ||
| 221 | mutable std::mutex mutex; | 221 | mutable std::mutex mutex; |
| 222 | mutable std::mutex mutex_callback; | 222 | mutable std::mutex mutex_callback; |
| 223 | bool configuring{false}; | 223 | bool configuring{false}; |
| 224 | bool is_callback_enabled{true}; | ||
| 225 | const std::string input_engine; | 224 | const std::string input_engine; |
| 226 | int last_callback_key = 0; | 225 | int last_callback_key = 0; |
| 227 | std::unordered_map<PadIdentifier, ControllerData> controller_list; | 226 | std::unordered_map<PadIdentifier, ControllerData> controller_list; |
diff --git a/src/input_common/input_poller.cpp b/src/input_common/input_poller.cpp index 2b3b77938..01c435802 100644 --- a/src/input_common/input_poller.cpp +++ b/src/input_common/input_poller.cpp | |||
| @@ -18,7 +18,7 @@ public: | |||
| 18 | 18 | ||
| 19 | class InputFromButton final : public Common::Input::InputDevice { | 19 | class InputFromButton final : public Common::Input::InputDevice { |
| 20 | public: | 20 | public: |
| 21 | explicit InputFromButton(PadIdentifier identifier_, u32 button_, bool toggle_, bool inverted_, | 21 | explicit InputFromButton(PadIdentifier identifier_, int button_, bool toggle_, bool inverted_, |
| 22 | InputEngine* input_engine_) | 22 | InputEngine* input_engine_) |
| 23 | : identifier(identifier_), button(button_), toggle(toggle_), inverted(inverted_), | 23 | : identifier(identifier_), button(button_), toggle(toggle_), inverted(inverted_), |
| 24 | input_engine(input_engine_) { | 24 | input_engine(input_engine_) { |
| @@ -69,7 +69,7 @@ public: | |||
| 69 | 69 | ||
| 70 | private: | 70 | private: |
| 71 | const PadIdentifier identifier; | 71 | const PadIdentifier identifier; |
| 72 | const u32 button; | 72 | const int button; |
| 73 | const bool toggle; | 73 | const bool toggle; |
| 74 | const bool inverted; | 74 | const bool inverted; |
| 75 | int callback_key; | 75 | int callback_key; |
| @@ -79,7 +79,7 @@ private: | |||
| 79 | 79 | ||
| 80 | class InputFromHatButton final : public Common::Input::InputDevice { | 80 | class InputFromHatButton final : public Common::Input::InputDevice { |
| 81 | public: | 81 | public: |
| 82 | explicit InputFromHatButton(PadIdentifier identifier_, u32 button_, u8 direction_, bool toggle_, | 82 | explicit InputFromHatButton(PadIdentifier identifier_, int button_, u8 direction_, bool toggle_, |
| 83 | bool inverted_, InputEngine* input_engine_) | 83 | bool inverted_, InputEngine* input_engine_) |
| 84 | : identifier(identifier_), button(button_), direction(direction_), toggle(toggle_), | 84 | : identifier(identifier_), button(button_), direction(direction_), toggle(toggle_), |
| 85 | inverted(inverted_), input_engine(input_engine_) { | 85 | inverted(inverted_), input_engine(input_engine_) { |
| @@ -130,7 +130,7 @@ public: | |||
| 130 | 130 | ||
| 131 | private: | 131 | private: |
| 132 | const PadIdentifier identifier; | 132 | const PadIdentifier identifier; |
| 133 | const u32 button; | 133 | const int button; |
| 134 | const u8 direction; | 134 | const u8 direction; |
| 135 | const bool toggle; | 135 | const bool toggle; |
| 136 | const bool inverted; | 136 | const bool inverted; |
| @@ -141,7 +141,7 @@ private: | |||
| 141 | 141 | ||
| 142 | class InputFromStick final : public Common::Input::InputDevice { | 142 | class InputFromStick final : public Common::Input::InputDevice { |
| 143 | public: | 143 | public: |
| 144 | explicit InputFromStick(PadIdentifier identifier_, u32 axis_x_, u32 axis_y_, | 144 | explicit InputFromStick(PadIdentifier identifier_, int axis_x_, int axis_y_, |
| 145 | Common::Input::AnalogProperties properties_x_, | 145 | Common::Input::AnalogProperties properties_x_, |
| 146 | Common::Input::AnalogProperties properties_y_, | 146 | Common::Input::AnalogProperties properties_y_, |
| 147 | InputEngine* input_engine_) | 147 | InputEngine* input_engine_) |
| @@ -211,8 +211,8 @@ public: | |||
| 211 | 211 | ||
| 212 | private: | 212 | private: |
| 213 | const PadIdentifier identifier; | 213 | const PadIdentifier identifier; |
| 214 | const u32 axis_x; | 214 | const int axis_x; |
| 215 | const u32 axis_y; | 215 | const int axis_y; |
| 216 | const Common::Input::AnalogProperties properties_x; | 216 | const Common::Input::AnalogProperties properties_x; |
| 217 | const Common::Input::AnalogProperties properties_y; | 217 | const Common::Input::AnalogProperties properties_y; |
| 218 | int callback_key_x; | 218 | int callback_key_x; |
| @@ -224,8 +224,8 @@ private: | |||
| 224 | 224 | ||
| 225 | class InputFromTouch final : public Common::Input::InputDevice { | 225 | class InputFromTouch final : public Common::Input::InputDevice { |
| 226 | public: | 226 | public: |
| 227 | explicit InputFromTouch(PadIdentifier identifier_, u32 touch_id_, u32 button_, bool toggle_, | 227 | explicit InputFromTouch(PadIdentifier identifier_, int touch_id_, int button_, bool toggle_, |
| 228 | bool inverted_, u32 axis_x_, u32 axis_y_, | 228 | bool inverted_, int axis_x_, int axis_y_, |
| 229 | Common::Input::AnalogProperties properties_x_, | 229 | Common::Input::AnalogProperties properties_x_, |
| 230 | Common::Input::AnalogProperties properties_y_, | 230 | Common::Input::AnalogProperties properties_y_, |
| 231 | InputEngine* input_engine_) | 231 | InputEngine* input_engine_) |
| @@ -302,12 +302,12 @@ public: | |||
| 302 | 302 | ||
| 303 | private: | 303 | private: |
| 304 | const PadIdentifier identifier; | 304 | const PadIdentifier identifier; |
| 305 | const u32 touch_id; | 305 | const int touch_id; |
| 306 | const u32 button; | 306 | const int button; |
| 307 | const bool toggle; | 307 | const bool toggle; |
| 308 | const bool inverted; | 308 | const bool inverted; |
| 309 | const u32 axis_x; | 309 | const int axis_x; |
| 310 | const u32 axis_y; | 310 | const int axis_y; |
| 311 | const Common::Input::AnalogProperties properties_x; | 311 | const Common::Input::AnalogProperties properties_x; |
| 312 | const Common::Input::AnalogProperties properties_y; | 312 | const Common::Input::AnalogProperties properties_y; |
| 313 | int callback_key_button; | 313 | int callback_key_button; |
| @@ -321,8 +321,8 @@ private: | |||
| 321 | 321 | ||
| 322 | class InputFromTrigger final : public Common::Input::InputDevice { | 322 | class InputFromTrigger final : public Common::Input::InputDevice { |
| 323 | public: | 323 | public: |
| 324 | explicit InputFromTrigger(PadIdentifier identifier_, u32 button_, bool toggle_, bool inverted_, | 324 | explicit InputFromTrigger(PadIdentifier identifier_, int button_, bool toggle_, bool inverted_, |
| 325 | u32 axis_, Common::Input::AnalogProperties properties_, | 325 | int axis_, Common::Input::AnalogProperties properties_, |
| 326 | InputEngine* input_engine_) | 326 | InputEngine* input_engine_) |
| 327 | : identifier(identifier_), button(button_), toggle(toggle_), inverted(inverted_), | 327 | : identifier(identifier_), button(button_), toggle(toggle_), inverted(inverted_), |
| 328 | axis(axis_), properties(properties_), input_engine(input_engine_) { | 328 | axis(axis_), properties(properties_), input_engine(input_engine_) { |
| @@ -355,9 +355,14 @@ public: | |||
| 355 | .raw_value = input_engine->GetAxis(identifier, axis), | 355 | .raw_value = input_engine->GetAxis(identifier, axis), |
| 356 | .properties = properties, | 356 | .properties = properties, |
| 357 | }; | 357 | }; |
| 358 | const Common::Input::ButtonStatus button_status{ | ||
| 359 | .value = input_engine->GetButton(identifier, button), | ||
| 360 | .inverted = inverted, | ||
| 361 | .toggle = toggle, | ||
| 362 | }; | ||
| 358 | return { | 363 | return { |
| 359 | .analog = analog_status, | 364 | .analog = analog_status, |
| 360 | .pressed = input_engine->GetButton(identifier, button), | 365 | .pressed = button_status, |
| 361 | }; | 366 | }; |
| 362 | } | 367 | } |
| 363 | 368 | ||
| @@ -368,19 +373,19 @@ public: | |||
| 368 | }; | 373 | }; |
| 369 | 374 | ||
| 370 | if (status.trigger_status.analog.raw_value != last_axis_value || | 375 | if (status.trigger_status.analog.raw_value != last_axis_value || |
| 371 | status.trigger_status.pressed != last_button_value) { | 376 | status.trigger_status.pressed.value != last_button_value) { |
| 372 | last_axis_value = status.trigger_status.analog.raw_value; | 377 | last_axis_value = status.trigger_status.analog.raw_value; |
| 373 | last_button_value = status.trigger_status.pressed; | 378 | last_button_value = status.trigger_status.pressed.value; |
| 374 | TriggerOnChange(status); | 379 | TriggerOnChange(status); |
| 375 | } | 380 | } |
| 376 | } | 381 | } |
| 377 | 382 | ||
| 378 | private: | 383 | private: |
| 379 | const PadIdentifier identifier; | 384 | const PadIdentifier identifier; |
| 380 | const u32 button; | 385 | const int button; |
| 381 | const bool toggle; | 386 | const bool toggle; |
| 382 | const bool inverted; | 387 | const bool inverted; |
| 383 | const u32 axis; | 388 | const int axis; |
| 384 | const Common::Input::AnalogProperties properties; | 389 | const Common::Input::AnalogProperties properties; |
| 385 | int callback_key_button; | 390 | int callback_key_button; |
| 386 | int axis_callback_key; | 391 | int axis_callback_key; |
| @@ -391,7 +396,7 @@ private: | |||
| 391 | 396 | ||
| 392 | class InputFromAnalog final : public Common::Input::InputDevice { | 397 | class InputFromAnalog final : public Common::Input::InputDevice { |
| 393 | public: | 398 | public: |
| 394 | explicit InputFromAnalog(PadIdentifier identifier_, u32 axis_, | 399 | explicit InputFromAnalog(PadIdentifier identifier_, int axis_, |
| 395 | Common::Input::AnalogProperties properties_, | 400 | Common::Input::AnalogProperties properties_, |
| 396 | InputEngine* input_engine_) | 401 | InputEngine* input_engine_) |
| 397 | : identifier(identifier_), axis(axis_), properties(properties_), | 402 | : identifier(identifier_), axis(axis_), properties(properties_), |
| @@ -432,7 +437,7 @@ public: | |||
| 432 | 437 | ||
| 433 | private: | 438 | private: |
| 434 | const PadIdentifier identifier; | 439 | const PadIdentifier identifier; |
| 435 | const u32 axis; | 440 | const int axis; |
| 436 | const Common::Input::AnalogProperties properties; | 441 | const Common::Input::AnalogProperties properties; |
| 437 | int callback_key; | 442 | int callback_key; |
| 438 | float last_axis_value; | 443 | float last_axis_value; |
| @@ -493,7 +498,7 @@ private: | |||
| 493 | 498 | ||
| 494 | class InputFromMotion final : public Common::Input::InputDevice { | 499 | class InputFromMotion final : public Common::Input::InputDevice { |
| 495 | public: | 500 | public: |
| 496 | explicit InputFromMotion(PadIdentifier identifier_, u32 motion_sensor_, | 501 | explicit InputFromMotion(PadIdentifier identifier_, int motion_sensor_, |
| 497 | InputEngine* input_engine_) | 502 | InputEngine* input_engine_) |
| 498 | : identifier(identifier_), motion_sensor(motion_sensor_), input_engine(input_engine_) { | 503 | : identifier(identifier_), motion_sensor(motion_sensor_), input_engine(input_engine_) { |
| 499 | UpdateCallback engine_callback{[this]() { OnChange(); }}; | 504 | UpdateCallback engine_callback{[this]() { OnChange(); }}; |
| @@ -539,14 +544,14 @@ public: | |||
| 539 | 544 | ||
| 540 | private: | 545 | private: |
| 541 | const PadIdentifier identifier; | 546 | const PadIdentifier identifier; |
| 542 | const u32 motion_sensor; | 547 | const int motion_sensor; |
| 543 | int callback_key; | 548 | int callback_key; |
| 544 | InputEngine* input_engine; | 549 | InputEngine* input_engine; |
| 545 | }; | 550 | }; |
| 546 | 551 | ||
| 547 | class InputFromAxisMotion final : public Common::Input::InputDevice { | 552 | class InputFromAxisMotion final : public Common::Input::InputDevice { |
| 548 | public: | 553 | public: |
| 549 | explicit InputFromAxisMotion(PadIdentifier identifier_, u32 axis_x_, u32 axis_y_, u32 axis_z_, | 554 | explicit InputFromAxisMotion(PadIdentifier identifier_, int axis_x_, int axis_y_, int axis_z_, |
| 550 | Common::Input::AnalogProperties properties_x_, | 555 | Common::Input::AnalogProperties properties_x_, |
| 551 | Common::Input::AnalogProperties properties_y_, | 556 | Common::Input::AnalogProperties properties_y_, |
| 552 | Common::Input::AnalogProperties properties_z_, | 557 | Common::Input::AnalogProperties properties_z_, |
| @@ -634,9 +639,9 @@ public: | |||
| 634 | 639 | ||
| 635 | private: | 640 | private: |
| 636 | const PadIdentifier identifier; | 641 | const PadIdentifier identifier; |
| 637 | const u32 axis_x; | 642 | const int axis_x; |
| 638 | const u32 axis_y; | 643 | const int axis_y; |
| 639 | const u32 axis_z; | 644 | const int axis_z; |
| 640 | const Common::Input::AnalogProperties properties_x; | 645 | const Common::Input::AnalogProperties properties_x; |
| 641 | const Common::Input::AnalogProperties properties_y; | 646 | const Common::Input::AnalogProperties properties_y; |
| 642 | const Common::Input::AnalogProperties properties_z; | 647 | const Common::Input::AnalogProperties properties_z; |
| @@ -680,8 +685,8 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateButtonDevice( | |||
| 680 | .pad = static_cast<std::size_t>(params.Get("pad", 0)), | 685 | .pad = static_cast<std::size_t>(params.Get("pad", 0)), |
| 681 | }; | 686 | }; |
| 682 | 687 | ||
| 683 | const auto button_id = static_cast<u32>(params.Get("button", 0)); | 688 | const auto button_id = params.Get("button", 0); |
| 684 | const auto keyboard_key = static_cast<u32>(params.Get("code", 0)); | 689 | const auto keyboard_key = params.Get("code", 0); |
| 685 | const auto toggle = params.Get("toggle", false); | 690 | const auto toggle = params.Get("toggle", false); |
| 686 | const auto inverted = params.Get("inverted", false); | 691 | const auto inverted = params.Get("inverted", false); |
| 687 | input_engine->PreSetController(identifier); | 692 | input_engine->PreSetController(identifier); |
| @@ -703,7 +708,7 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateHatButtonDevice( | |||
| 703 | .pad = static_cast<std::size_t>(params.Get("pad", 0)), | 708 | .pad = static_cast<std::size_t>(params.Get("pad", 0)), |
| 704 | }; | 709 | }; |
| 705 | 710 | ||
| 706 | const auto button_id = static_cast<u32>(params.Get("hat", 0)); | 711 | const auto button_id = params.Get("hat", 0); |
| 707 | const auto direction = input_engine->GetHatButtonId(params.Get("direction", "")); | 712 | const auto direction = input_engine->GetHatButtonId(params.Get("direction", "")); |
| 708 | const auto toggle = params.Get("toggle", false); | 713 | const auto toggle = params.Get("toggle", false); |
| 709 | const auto inverted = params.Get("inverted", false); | 714 | const auto inverted = params.Get("inverted", false); |
| @@ -725,7 +730,7 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateStickDevice( | |||
| 725 | .pad = static_cast<std::size_t>(params.Get("pad", 0)), | 730 | .pad = static_cast<std::size_t>(params.Get("pad", 0)), |
| 726 | }; | 731 | }; |
| 727 | 732 | ||
| 728 | const auto axis_x = static_cast<u32>(params.Get("axis_x", 0)); | 733 | const auto axis_x = params.Get("axis_x", 0); |
| 729 | const Common::Input::AnalogProperties properties_x = { | 734 | const Common::Input::AnalogProperties properties_x = { |
| 730 | .deadzone = deadzone, | 735 | .deadzone = deadzone, |
| 731 | .range = range, | 736 | .range = range, |
| @@ -734,7 +739,7 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateStickDevice( | |||
| 734 | .inverted = params.Get("invert_x", "+") == "-", | 739 | .inverted = params.Get("invert_x", "+") == "-", |
| 735 | }; | 740 | }; |
| 736 | 741 | ||
| 737 | const auto axis_y = static_cast<u32>(params.Get("axis_y", 1)); | 742 | const auto axis_y = params.Get("axis_y", 1); |
| 738 | const Common::Input::AnalogProperties properties_y = { | 743 | const Common::Input::AnalogProperties properties_y = { |
| 739 | .deadzone = deadzone, | 744 | .deadzone = deadzone, |
| 740 | .range = range, | 745 | .range = range, |
| @@ -757,7 +762,7 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateAnalogDevice( | |||
| 757 | .pad = static_cast<std::size_t>(params.Get("pad", 0)), | 762 | .pad = static_cast<std::size_t>(params.Get("pad", 0)), |
| 758 | }; | 763 | }; |
| 759 | 764 | ||
| 760 | const auto axis = static_cast<u32>(params.Get("axis", 0)); | 765 | const auto axis = params.Get("axis", 0); |
| 761 | const Common::Input::AnalogProperties properties = { | 766 | const Common::Input::AnalogProperties properties = { |
| 762 | .deadzone = std::clamp(params.Get("deadzone", 0.0f), 0.0f, 1.0f), | 767 | .deadzone = std::clamp(params.Get("deadzone", 0.0f), 0.0f, 1.0f), |
| 763 | .range = std::clamp(params.Get("range", 1.0f), 0.25f, 1.50f), | 768 | .range = std::clamp(params.Get("range", 1.0f), 0.25f, 1.50f), |
| @@ -778,11 +783,11 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateTriggerDevice( | |||
| 778 | .pad = static_cast<std::size_t>(params.Get("pad", 0)), | 783 | .pad = static_cast<std::size_t>(params.Get("pad", 0)), |
| 779 | }; | 784 | }; |
| 780 | 785 | ||
| 781 | const auto button = static_cast<u32>(params.Get("button", 0)); | 786 | const auto button = params.Get("button", 0); |
| 782 | const auto toggle = params.Get("toggle", false); | 787 | const auto toggle = params.Get("toggle", false); |
| 783 | const auto inverted = params.Get("inverted", false); | 788 | const auto inverted = params.Get("inverted", false); |
| 784 | 789 | ||
| 785 | const auto axis = static_cast<u32>(params.Get("axis", 0)); | 790 | const auto axis = params.Get("axis", 0); |
| 786 | const Common::Input::AnalogProperties properties = { | 791 | const Common::Input::AnalogProperties properties = { |
| 787 | .deadzone = std::clamp(params.Get("deadzone", 0.0f), 0.0f, 1.0f), | 792 | .deadzone = std::clamp(params.Get("deadzone", 0.0f), 0.0f, 1.0f), |
| 788 | .range = std::clamp(params.Get("range", 1.0f), 0.25f, 2.50f), | 793 | .range = std::clamp(params.Get("range", 1.0f), 0.25f, 2.50f), |
| @@ -809,11 +814,11 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateTouchDevice( | |||
| 809 | .pad = static_cast<std::size_t>(params.Get("pad", 0)), | 814 | .pad = static_cast<std::size_t>(params.Get("pad", 0)), |
| 810 | }; | 815 | }; |
| 811 | 816 | ||
| 812 | const auto button = static_cast<u32>(params.Get("button", 0)); | 817 | const auto button = params.Get("button", 0); |
| 813 | const auto toggle = params.Get("toggle", false); | 818 | const auto toggle = params.Get("toggle", false); |
| 814 | const auto inverted = params.Get("inverted", false); | 819 | const auto inverted = params.Get("inverted", false); |
| 815 | 820 | ||
| 816 | const auto axis_x = static_cast<u32>(params.Get("axis_x", 0)); | 821 | const auto axis_x = params.Get("axis_x", 0); |
| 817 | const Common::Input::AnalogProperties properties_x = { | 822 | const Common::Input::AnalogProperties properties_x = { |
| 818 | .deadzone = deadzone, | 823 | .deadzone = deadzone, |
| 819 | .range = range, | 824 | .range = range, |
| @@ -822,7 +827,7 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateTouchDevice( | |||
| 822 | .inverted = params.Get("invert_x", "+") == "-", | 827 | .inverted = params.Get("invert_x", "+") == "-", |
| 823 | }; | 828 | }; |
| 824 | 829 | ||
| 825 | const auto axis_y = static_cast<u32>(params.Get("axis_y", 1)); | 830 | const auto axis_y = params.Get("axis_y", 1); |
| 826 | const Common::Input::AnalogProperties properties_y = { | 831 | const Common::Input::AnalogProperties properties_y = { |
| 827 | .deadzone = deadzone, | 832 | .deadzone = deadzone, |
| 828 | .range = range, | 833 | .range = range, |
| @@ -869,7 +874,7 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateMotionDevice( | |||
| 869 | const auto range = std::clamp(params.Get("range", 1.0f), 0.25f, 1.50f); | 874 | const auto range = std::clamp(params.Get("range", 1.0f), 0.25f, 1.50f); |
| 870 | const auto threshold = std::clamp(params.Get("threshold", 0.5f), 0.0f, 1.0f); | 875 | const auto threshold = std::clamp(params.Get("threshold", 0.5f), 0.0f, 1.0f); |
| 871 | 876 | ||
| 872 | const auto axis_x = static_cast<u32>(params.Get("axis_x", 0)); | 877 | const auto axis_x = params.Get("axis_x", 0); |
| 873 | const Common::Input::AnalogProperties properties_x = { | 878 | const Common::Input::AnalogProperties properties_x = { |
| 874 | .deadzone = deadzone, | 879 | .deadzone = deadzone, |
| 875 | .range = range, | 880 | .range = range, |
| @@ -878,7 +883,7 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateMotionDevice( | |||
| 878 | .inverted = params.Get("invert_x", "+") == "-", | 883 | .inverted = params.Get("invert_x", "+") == "-", |
| 879 | }; | 884 | }; |
| 880 | 885 | ||
| 881 | const auto axis_y = static_cast<u32>(params.Get("axis_y", 1)); | 886 | const auto axis_y = params.Get("axis_y", 1); |
| 882 | const Common::Input::AnalogProperties properties_y = { | 887 | const Common::Input::AnalogProperties properties_y = { |
| 883 | .deadzone = deadzone, | 888 | .deadzone = deadzone, |
| 884 | .range = range, | 889 | .range = range, |
| @@ -887,7 +892,7 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateMotionDevice( | |||
| 887 | .inverted = params.Get("invert_y", "+") != "+", | 892 | .inverted = params.Get("invert_y", "+") != "+", |
| 888 | }; | 893 | }; |
| 889 | 894 | ||
| 890 | const auto axis_z = static_cast<u32>(params.Get("axis_z", 1)); | 895 | const auto axis_z = params.Get("axis_z", 1); |
| 891 | const Common::Input::AnalogProperties properties_z = { | 896 | const Common::Input::AnalogProperties properties_z = { |
| 892 | .deadzone = deadzone, | 897 | .deadzone = deadzone, |
| 893 | .range = range, | 898 | .range = range, |