diff options
Diffstat (limited to 'src/input_common')
| -rw-r--r-- | src/input_common/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/input_common/drivers/sdl_driver.cpp | 4 | ||||
| -rw-r--r-- | src/input_common/input_poller.cpp | 18 |
3 files changed, 12 insertions, 11 deletions
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt index 7935ac655..d2730bdc1 100644 --- a/src/input_common/CMakeLists.txt +++ b/src/input_common/CMakeLists.txt | |||
| @@ -45,6 +45,7 @@ if (MSVC) | |||
| 45 | /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data | 45 | /we4244 # 'conversion': conversion from 'type1' to 'type2', possible loss of data |
| 46 | /we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch | 46 | /we4245 # 'conversion': conversion from 'type1' to 'type2', signed/unsigned mismatch |
| 47 | /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data | 47 | /we4254 # 'operator': conversion from 'type1:field_bits' to 'type2:field_bits', possible loss of data |
| 48 | /we4800 # Implicit conversion from 'type' to bool. Possible information loss | ||
| 48 | ) | 49 | ) |
| 49 | else() | 50 | else() |
| 50 | target_compile_options(input_common PRIVATE | 51 | target_compile_options(input_common PRIVATE |
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index b72e4b397..c175a8853 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp | |||
| @@ -40,8 +40,8 @@ public: | |||
| 40 | void EnableMotion() { | 40 | void EnableMotion() { |
| 41 | if (sdl_controller) { | 41 | if (sdl_controller) { |
| 42 | SDL_GameController* controller = sdl_controller.get(); | 42 | SDL_GameController* controller = sdl_controller.get(); |
| 43 | has_accel = SDL_GameControllerHasSensor(controller, SDL_SENSOR_ACCEL); | 43 | has_accel = SDL_GameControllerHasSensor(controller, SDL_SENSOR_ACCEL) == SDL_TRUE; |
| 44 | has_gyro = SDL_GameControllerHasSensor(controller, SDL_SENSOR_GYRO); | 44 | has_gyro = SDL_GameControllerHasSensor(controller, SDL_SENSOR_GYRO) == SDL_TRUE; |
| 45 | if (has_accel) { | 45 | if (has_accel) { |
| 46 | SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_ACCEL, SDL_TRUE); | 46 | SDL_GameControllerSetSensorEnabled(controller, SDL_SENSOR_ACCEL, SDL_TRUE); |
| 47 | } | 47 | } |
diff --git a/src/input_common/input_poller.cpp b/src/input_common/input_poller.cpp index ca33fb4eb..ccc3076ca 100644 --- a/src/input_common/input_poller.cpp +++ b/src/input_common/input_poller.cpp | |||
| @@ -797,8 +797,8 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateButtonDevice( | |||
| 797 | 797 | ||
| 798 | const auto button_id = params.Get("button", 0); | 798 | const auto button_id = params.Get("button", 0); |
| 799 | const auto keyboard_key = params.Get("code", 0); | 799 | const auto keyboard_key = params.Get("code", 0); |
| 800 | const auto toggle = params.Get("toggle", false); | 800 | const auto toggle = params.Get("toggle", false) != 0; |
| 801 | const auto inverted = params.Get("inverted", false); | 801 | const auto inverted = params.Get("inverted", false) != 0; |
| 802 | input_engine->PreSetController(identifier); | 802 | input_engine->PreSetController(identifier); |
| 803 | input_engine->PreSetButton(identifier, button_id); | 803 | input_engine->PreSetButton(identifier, button_id); |
| 804 | input_engine->PreSetButton(identifier, keyboard_key); | 804 | input_engine->PreSetButton(identifier, keyboard_key); |
| @@ -820,8 +820,8 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateHatButtonDevice( | |||
| 820 | 820 | ||
| 821 | const auto button_id = params.Get("hat", 0); | 821 | const auto button_id = params.Get("hat", 0); |
| 822 | const auto direction = input_engine->GetHatButtonId(params.Get("direction", "")); | 822 | const auto direction = input_engine->GetHatButtonId(params.Get("direction", "")); |
| 823 | const auto toggle = params.Get("toggle", false); | 823 | const auto toggle = params.Get("toggle", false) != 0; |
| 824 | const auto inverted = params.Get("inverted", false); | 824 | const auto inverted = params.Get("inverted", false) != 0; |
| 825 | 825 | ||
| 826 | input_engine->PreSetController(identifier); | 826 | input_engine->PreSetController(identifier); |
| 827 | input_engine->PreSetHatButton(identifier, button_id); | 827 | input_engine->PreSetHatButton(identifier, button_id); |
| @@ -879,7 +879,7 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateAnalogDevice( | |||
| 879 | .threshold = std::clamp(params.Get("threshold", 0.5f), 0.0f, 1.0f), | 879 | .threshold = std::clamp(params.Get("threshold", 0.5f), 0.0f, 1.0f), |
| 880 | .offset = std::clamp(params.Get("offset", 0.0f), -1.0f, 1.0f), | 880 | .offset = std::clamp(params.Get("offset", 0.0f), -1.0f, 1.0f), |
| 881 | .inverted = params.Get("invert", "+") == "-", | 881 | .inverted = params.Get("invert", "+") == "-", |
| 882 | .toggle = static_cast<bool>(params.Get("toggle", false)), | 882 | .toggle = params.Get("toggle", false) != 0, |
| 883 | }; | 883 | }; |
| 884 | input_engine->PreSetController(identifier); | 884 | input_engine->PreSetController(identifier); |
| 885 | input_engine->PreSetAxis(identifier, axis); | 885 | input_engine->PreSetAxis(identifier, axis); |
| @@ -895,8 +895,8 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateTriggerDevice( | |||
| 895 | }; | 895 | }; |
| 896 | 896 | ||
| 897 | const auto button = params.Get("button", 0); | 897 | const auto button = params.Get("button", 0); |
| 898 | const auto toggle = params.Get("toggle", false); | 898 | const auto toggle = params.Get("toggle", false) != 0; |
| 899 | const auto inverted = params.Get("inverted", false); | 899 | const auto inverted = params.Get("inverted", false) != 0; |
| 900 | 900 | ||
| 901 | const auto axis = params.Get("axis", 0); | 901 | const auto axis = params.Get("axis", 0); |
| 902 | const Common::Input::AnalogProperties properties = { | 902 | const Common::Input::AnalogProperties properties = { |
| @@ -926,8 +926,8 @@ std::unique_ptr<Common::Input::InputDevice> InputFactory::CreateTouchDevice( | |||
| 926 | }; | 926 | }; |
| 927 | 927 | ||
| 928 | const auto button = params.Get("button", 0); | 928 | const auto button = params.Get("button", 0); |
| 929 | const auto toggle = params.Get("toggle", false); | 929 | const auto toggle = params.Get("toggle", false) != 0; |
| 930 | const auto inverted = params.Get("inverted", false); | 930 | const auto inverted = params.Get("inverted", false) != 0; |
| 931 | 931 | ||
| 932 | const auto axis_x = params.Get("axis_x", 0); | 932 | const auto axis_x = params.Get("axis_x", 0); |
| 933 | const Common::Input::AnalogProperties properties_x = { | 933 | const Common::Input::AnalogProperties properties_x = { |