diff options
| author | 2021-11-14 21:56:54 -0600 | |
|---|---|---|
| committer | 2021-11-24 20:30:28 -0600 | |
| commit | 42949738f2c01a4125a9a385c9100240181153ec (patch) | |
| tree | 5de97be0bc08a1dd4ff5138196c08a6bf2e08e70 /src/input_common | |
| parent | core/hid: Improve accuary of mouse implementation (diff) | |
| download | yuzu-42949738f2c01a4125a9a385c9100240181153ec.tar.gz yuzu-42949738f2c01a4125a9a385c9100240181153ec.tar.xz yuzu-42949738f2c01a4125a9a385c9100240181153ec.zip | |
kraken: Address comments from review
Fix compiler bug
Diffstat (limited to 'src/input_common')
| -rw-r--r-- | src/input_common/drivers/gc_adapter.cpp | 16 | ||||
| -rw-r--r-- | src/input_common/drivers/gc_adapter.h | 2 | ||||
| -rw-r--r-- | src/input_common/drivers/mouse.cpp | 2 | ||||
| -rw-r--r-- | src/input_common/drivers/mouse.h | 2 | ||||
| -rw-r--r-- | src/input_common/drivers/sdl_driver.cpp | 2 | ||||
| -rw-r--r-- | src/input_common/drivers/sdl_driver.h | 2 | ||||
| -rw-r--r-- | src/input_common/drivers/tas_input.cpp | 2 | ||||
| -rw-r--r-- | src/input_common/drivers/tas_input.h | 2 | ||||
| -rw-r--r-- | src/input_common/drivers/touch_screen.cpp | 2 | ||||
| -rw-r--r-- | src/input_common/drivers/touch_screen.h | 2 | ||||
| -rw-r--r-- | src/input_common/input_engine.cpp | 4 | ||||
| -rw-r--r-- | src/input_common/input_engine.h | 2 |
12 files changed, 14 insertions, 26 deletions
diff --git a/src/input_common/drivers/gc_adapter.cpp b/src/input_common/drivers/gc_adapter.cpp index 2550f8cba..a1b9b6d98 100644 --- a/src/input_common/drivers/gc_adapter.cpp +++ b/src/input_common/drivers/gc_adapter.cpp | |||
| @@ -69,7 +69,7 @@ private: | |||
| 69 | libusb_device_handle* handle{}; | 69 | libusb_device_handle* handle{}; |
| 70 | }; | 70 | }; |
| 71 | 71 | ||
| 72 | GCAdapter::GCAdapter(const std::string input_engine_) : InputEngine(input_engine_) { | 72 | GCAdapter::GCAdapter(const std::string& input_engine_) : InputEngine(input_engine_) { |
| 73 | if (usb_adapter_handle) { | 73 | if (usb_adapter_handle) { |
| 74 | return; | 74 | return; |
| 75 | } | 75 | } |
| @@ -486,42 +486,30 @@ std::string GCAdapter::GetUIButtonName(const Common::ParamPackage& params) const | |||
| 486 | switch (button) { | 486 | switch (button) { |
| 487 | case PadButton::ButtonLeft: | 487 | case PadButton::ButtonLeft: |
| 488 | return "left"; | 488 | return "left"; |
| 489 | break; | ||
| 490 | case PadButton::ButtonRight: | 489 | case PadButton::ButtonRight: |
| 491 | return "right"; | 490 | return "right"; |
| 492 | break; | ||
| 493 | case PadButton::ButtonDown: | 491 | case PadButton::ButtonDown: |
| 494 | return "down"; | 492 | return "down"; |
| 495 | break; | ||
| 496 | case PadButton::ButtonUp: | 493 | case PadButton::ButtonUp: |
| 497 | return "up"; | 494 | return "up"; |
| 498 | break; | ||
| 499 | case PadButton::TriggerZ: | 495 | case PadButton::TriggerZ: |
| 500 | return "Z"; | 496 | return "Z"; |
| 501 | break; | ||
| 502 | case PadButton::TriggerR: | 497 | case PadButton::TriggerR: |
| 503 | return "R"; | 498 | return "R"; |
| 504 | break; | ||
| 505 | case PadButton::TriggerL: | 499 | case PadButton::TriggerL: |
| 506 | return "L"; | 500 | return "L"; |
| 507 | break; | ||
| 508 | case PadButton::ButtonA: | 501 | case PadButton::ButtonA: |
| 509 | return "A"; | 502 | return "A"; |
| 510 | break; | ||
| 511 | case PadButton::ButtonB: | 503 | case PadButton::ButtonB: |
| 512 | return "B"; | 504 | return "B"; |
| 513 | break; | ||
| 514 | case PadButton::ButtonX: | 505 | case PadButton::ButtonX: |
| 515 | return "X"; | 506 | return "X"; |
| 516 | break; | ||
| 517 | case PadButton::ButtonY: | 507 | case PadButton::ButtonY: |
| 518 | return "Y"; | 508 | return "Y"; |
| 519 | break; | ||
| 520 | case PadButton::ButtonStart: | 509 | case PadButton::ButtonStart: |
| 521 | return "start"; | 510 | return "start"; |
| 522 | break; | ||
| 523 | default: | 511 | default: |
| 524 | return "Unkown GC"; | 512 | return "Unknown GC"; |
| 525 | } | 513 | } |
| 526 | } | 514 | } |
| 527 | 515 | ||
diff --git a/src/input_common/drivers/gc_adapter.h b/src/input_common/drivers/gc_adapter.h index fba90352e..3e4747040 100644 --- a/src/input_common/drivers/gc_adapter.h +++ b/src/input_common/drivers/gc_adapter.h | |||
| @@ -24,7 +24,7 @@ class LibUSBDeviceHandle; | |||
| 24 | 24 | ||
| 25 | class GCAdapter : public InputCommon::InputEngine { | 25 | class GCAdapter : public InputCommon::InputEngine { |
| 26 | public: | 26 | public: |
| 27 | explicit GCAdapter(const std::string input_engine_); | 27 | explicit GCAdapter(const std::string& input_engine_); |
| 28 | ~GCAdapter(); | 28 | ~GCAdapter(); |
| 29 | 29 | ||
| 30 | Common::Input::VibrationError SetRumble( | 30 | Common::Input::VibrationError SetRumble( |
diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp index 05fd7f9c0..9a9a1987d 100644 --- a/src/input_common/drivers/mouse.cpp +++ b/src/input_common/drivers/mouse.cpp | |||
| @@ -24,7 +24,7 @@ constexpr PadIdentifier identifier = { | |||
| 24 | .pad = 0, | 24 | .pad = 0, |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | Mouse::Mouse(const std::string input_engine_) : InputEngine(input_engine_) { | 27 | Mouse::Mouse(const std::string& input_engine_) : InputEngine(input_engine_) { |
| 28 | PreSetController(identifier); | 28 | PreSetController(identifier); |
| 29 | PreSetAxis(identifier, mouse_axis_x); | 29 | PreSetAxis(identifier, mouse_axis_x); |
| 30 | PreSetAxis(identifier, mouse_axis_y); | 30 | PreSetAxis(identifier, mouse_axis_y); |
diff --git a/src/input_common/drivers/mouse.h b/src/input_common/drivers/mouse.h index f7e6db0b5..11dd76e14 100644 --- a/src/input_common/drivers/mouse.h +++ b/src/input_common/drivers/mouse.h | |||
| @@ -29,7 +29,7 @@ enum class MouseButton { | |||
| 29 | */ | 29 | */ |
| 30 | class Mouse final : public InputCommon::InputEngine { | 30 | class Mouse final : public InputCommon::InputEngine { |
| 31 | public: | 31 | public: |
| 32 | explicit Mouse(const std::string input_engine_); | 32 | explicit Mouse(const std::string& input_engine_); |
| 33 | 33 | ||
| 34 | /** | 34 | /** |
| 35 | * Signals that mouse has moved. | 35 | * Signals that mouse has moved. |
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp index 1e3741e0f..0b24f1858 100644 --- a/src/input_common/drivers/sdl_driver.cpp +++ b/src/input_common/drivers/sdl_driver.cpp | |||
| @@ -929,7 +929,7 @@ std::string SDLDriver::GetHatButtonName(u8 direction_value) const { | |||
| 929 | } | 929 | } |
| 930 | } | 930 | } |
| 931 | 931 | ||
| 932 | u8 SDLDriver::GetHatButtonId(const std::string direction_name) const { | 932 | u8 SDLDriver::GetHatButtonId(const std::string& direction_name) const { |
| 933 | Uint8 direction; | 933 | Uint8 direction; |
| 934 | if (direction_name == "up") { | 934 | if (direction_name == "up") { |
| 935 | direction = SDL_HAT_UP; | 935 | direction = SDL_HAT_UP; |
diff --git a/src/input_common/drivers/sdl_driver.h b/src/input_common/drivers/sdl_driver.h index b879df8ab..3faaca984 100644 --- a/src/input_common/drivers/sdl_driver.h +++ b/src/input_common/drivers/sdl_driver.h | |||
| @@ -56,7 +56,7 @@ public: | |||
| 56 | std::string GetUIName(const Common::ParamPackage& params) const override; | 56 | std::string GetUIName(const Common::ParamPackage& params) const override; |
| 57 | 57 | ||
| 58 | std::string GetHatButtonName(u8 direction_value) const override; | 58 | std::string GetHatButtonName(u8 direction_value) const override; |
| 59 | u8 GetHatButtonId(const std::string direction_name) const override; | 59 | u8 GetHatButtonId(const std::string& direction_name) const override; |
| 60 | 60 | ||
| 61 | Common::Input::VibrationError SetRumble( | 61 | Common::Input::VibrationError SetRumble( |
| 62 | const PadIdentifier& identifier, const Common::Input::VibrationStatus vibration) override; | 62 | const PadIdentifier& identifier, const Common::Input::VibrationStatus vibration) override; |
diff --git a/src/input_common/drivers/tas_input.cpp b/src/input_common/drivers/tas_input.cpp index bb9c236ea..0e01fb0d9 100644 --- a/src/input_common/drivers/tas_input.cpp +++ b/src/input_common/drivers/tas_input.cpp | |||
| @@ -47,7 +47,7 @@ constexpr std::array<std::pair<std::string_view, TasButton>, 20> text_to_tas_but | |||
| 47 | {"KEY_ZR", TasButton::TRIGGER_ZR}, | 47 | {"KEY_ZR", TasButton::TRIGGER_ZR}, |
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | Tas::Tas(const std::string input_engine_) : InputCommon::InputEngine(input_engine_) { | 50 | Tas::Tas(const std::string& input_engine_) : InputCommon::InputEngine(input_engine_) { |
| 51 | for (size_t player_index = 0; player_index < PLAYER_NUMBER; player_index++) { | 51 | for (size_t player_index = 0; player_index < PLAYER_NUMBER; player_index++) { |
| 52 | PadIdentifier identifier{ | 52 | PadIdentifier identifier{ |
| 53 | .guid = Common::UUID{}, | 53 | .guid = Common::UUID{}, |
diff --git a/src/input_common/drivers/tas_input.h b/src/input_common/drivers/tas_input.h index bfb37a638..c95a130fc 100644 --- a/src/input_common/drivers/tas_input.h +++ b/src/input_common/drivers/tas_input.h | |||
| @@ -83,7 +83,7 @@ enum class TasState { | |||
| 83 | 83 | ||
| 84 | class Tas final : public InputCommon::InputEngine { | 84 | class Tas final : public InputCommon::InputEngine { |
| 85 | public: | 85 | public: |
| 86 | explicit Tas(const std::string input_engine_); | 86 | explicit Tas(const std::string& input_engine_); |
| 87 | ~Tas(); | 87 | ~Tas(); |
| 88 | 88 | ||
| 89 | /** | 89 | /** |
diff --git a/src/input_common/drivers/touch_screen.cpp b/src/input_common/drivers/touch_screen.cpp index 377c9ee2b..45b3086f6 100644 --- a/src/input_common/drivers/touch_screen.cpp +++ b/src/input_common/drivers/touch_screen.cpp | |||
| @@ -13,7 +13,7 @@ constexpr PadIdentifier identifier = { | |||
| 13 | .pad = 0, | 13 | .pad = 0, |
| 14 | }; | 14 | }; |
| 15 | 15 | ||
| 16 | TouchScreen::TouchScreen(const std::string input_engine_) : InputEngine(input_engine_) { | 16 | TouchScreen::TouchScreen(const std::string& input_engine_) : InputEngine(input_engine_) { |
| 17 | PreSetController(identifier); | 17 | PreSetController(identifier); |
| 18 | } | 18 | } |
| 19 | 19 | ||
diff --git a/src/input_common/drivers/touch_screen.h b/src/input_common/drivers/touch_screen.h index 0f4cd0e7a..25c11e8bf 100644 --- a/src/input_common/drivers/touch_screen.h +++ b/src/input_common/drivers/touch_screen.h | |||
| @@ -14,7 +14,7 @@ namespace InputCommon { | |||
| 14 | */ | 14 | */ |
| 15 | class TouchScreen final : public InputCommon::InputEngine { | 15 | class TouchScreen final : public InputCommon::InputEngine { |
| 16 | public: | 16 | public: |
| 17 | explicit TouchScreen(const std::string input_engine_); | 17 | explicit TouchScreen(const std::string& input_engine_); |
| 18 | 18 | ||
| 19 | /** | 19 | /** |
| 20 | * Signals that mouse has moved. | 20 | * Signals that mouse has moved. |
diff --git a/src/input_common/input_engine.cpp b/src/input_common/input_engine.cpp index 139d8d2e6..2b2105376 100644 --- a/src/input_common/input_engine.cpp +++ b/src/input_common/input_engine.cpp | |||
| @@ -300,8 +300,8 @@ void InputEngine::TriggerOnMotionChange(const PadIdentifier& identifier, int mot | |||
| 300 | if (!configuring || !mapping_callback.on_data) { | 300 | if (!configuring || !mapping_callback.on_data) { |
| 301 | return; | 301 | return; |
| 302 | } | 302 | } |
| 303 | if (std::abs(value.gyro_x) < 1.0f && std::abs(value.gyro_y) < 1.0f && | 303 | if (std::abs(value.gyro_x) < 0.6f && std::abs(value.gyro_y) < 0.6f && |
| 304 | std::abs(value.gyro_z) < 1.0f) { | 304 | std::abs(value.gyro_z) < 0.6f) { |
| 305 | return; | 305 | return; |
| 306 | } | 306 | } |
| 307 | mapping_callback.on_data(MappingData{ | 307 | mapping_callback.on_data(MappingData{ |
diff --git a/src/input_common/input_engine.h b/src/input_common/input_engine.h index 5430c0cf8..c621686e5 100644 --- a/src/input_common/input_engine.h +++ b/src/input_common/input_engine.h | |||
| @@ -166,7 +166,7 @@ public: | |||
| 166 | }; | 166 | }; |
| 167 | 167 | ||
| 168 | /// Retrieves the index number of the given hat button direction | 168 | /// Retrieves the index number of the given hat button direction |
| 169 | virtual u8 GetHatButtonId([[maybe_unused]] const std::string direction_name) const { | 169 | virtual u8 GetHatButtonId([[maybe_unused]] const std::string& direction_name) const { |
| 170 | return 0; | 170 | return 0; |
| 171 | }; | 171 | }; |
| 172 | 172 | ||