summaryrefslogtreecommitdiffstats
path: root/src/input_common
diff options
context:
space:
mode:
authorgerman77 <juangerman-13@hotmail.com>2021-11-15 04:56:54 +0100
committerNarr the Reg <juangerman-13@hotmail.com>2021-11-25 03:30:28 +0100
commit42949738f2c01a4125a9a385c9100240181153ec (patch)
tree5de97be0bc08a1dd4ff5138196c08a6bf2e08e70 /src/input_common
parentcore/hid: Improve accuary of mouse implementation (diff)
downloadyuzu-42949738f2c01a4125a9a385c9100240181153ec.tar
yuzu-42949738f2c01a4125a9a385c9100240181153ec.tar.gz
yuzu-42949738f2c01a4125a9a385c9100240181153ec.tar.bz2
yuzu-42949738f2c01a4125a9a385c9100240181153ec.tar.lz
yuzu-42949738f2c01a4125a9a385c9100240181153ec.tar.xz
yuzu-42949738f2c01a4125a9a385c9100240181153ec.tar.zst
yuzu-42949738f2c01a4125a9a385c9100240181153ec.zip
Diffstat (limited to 'src/input_common')
-rw-r--r--src/input_common/drivers/gc_adapter.cpp16
-rw-r--r--src/input_common/drivers/gc_adapter.h2
-rw-r--r--src/input_common/drivers/mouse.cpp2
-rw-r--r--src/input_common/drivers/mouse.h2
-rw-r--r--src/input_common/drivers/sdl_driver.cpp2
-rw-r--r--src/input_common/drivers/sdl_driver.h2
-rw-r--r--src/input_common/drivers/tas_input.cpp2
-rw-r--r--src/input_common/drivers/tas_input.h2
-rw-r--r--src/input_common/drivers/touch_screen.cpp2
-rw-r--r--src/input_common/drivers/touch_screen.h2
-rw-r--r--src/input_common/input_engine.cpp4
-rw-r--r--src/input_common/input_engine.h2
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:
libusb_device_handle* handle{};
};
-GCAdapter::GCAdapter(const std::string input_engine_) : InputEngine(input_engine_) {
+GCAdapter::GCAdapter(const std::string& input_engine_) : InputEngine(input_engine_) {
if (usb_adapter_handle) {
return;
}
@@ -486,42 +486,30 @@ std::string GCAdapter::GetUIButtonName(const Common::ParamPackage& params) const
switch (button) {
case PadButton::ButtonLeft:
return "left";
- break;
case PadButton::ButtonRight:
return "right";
- break;
case PadButton::ButtonDown:
return "down";
- break;
case PadButton::ButtonUp:
return "up";
- break;
case PadButton::TriggerZ:
return "Z";
- break;
case PadButton::TriggerR:
return "R";
- break;
case PadButton::TriggerL:
return "L";
- break;
case PadButton::ButtonA:
return "A";
- break;
case PadButton::ButtonB:
return "B";
- break;
case PadButton::ButtonX:
return "X";
- break;
case PadButton::ButtonY:
return "Y";
- break;
case PadButton::ButtonStart:
return "start";
- break;
default:
- return "Unkown GC";
+ return "Unknown GC";
}
}
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;
class GCAdapter : public InputCommon::InputEngine {
public:
- explicit GCAdapter(const std::string input_engine_);
+ explicit GCAdapter(const std::string& input_engine_);
~GCAdapter();
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 = {
.pad = 0,
};
-Mouse::Mouse(const std::string input_engine_) : InputEngine(input_engine_) {
+Mouse::Mouse(const std::string& input_engine_) : InputEngine(input_engine_) {
PreSetController(identifier);
PreSetAxis(identifier, mouse_axis_x);
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 {
*/
class Mouse final : public InputCommon::InputEngine {
public:
- explicit Mouse(const std::string input_engine_);
+ explicit Mouse(const std::string& input_engine_);
/**
* 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 {
}
}
-u8 SDLDriver::GetHatButtonId(const std::string direction_name) const {
+u8 SDLDriver::GetHatButtonId(const std::string& direction_name) const {
Uint8 direction;
if (direction_name == "up") {
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:
std::string GetUIName(const Common::ParamPackage& params) const override;
std::string GetHatButtonName(u8 direction_value) const override;
- u8 GetHatButtonId(const std::string direction_name) const override;
+ u8 GetHatButtonId(const std::string& direction_name) const override;
Common::Input::VibrationError SetRumble(
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
{"KEY_ZR", TasButton::TRIGGER_ZR},
};
-Tas::Tas(const std::string input_engine_) : InputCommon::InputEngine(input_engine_) {
+Tas::Tas(const std::string& input_engine_) : InputCommon::InputEngine(input_engine_) {
for (size_t player_index = 0; player_index < PLAYER_NUMBER; player_index++) {
PadIdentifier identifier{
.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 {
class Tas final : public InputCommon::InputEngine {
public:
- explicit Tas(const std::string input_engine_);
+ explicit Tas(const std::string& input_engine_);
~Tas();
/**
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 = {
.pad = 0,
};
-TouchScreen::TouchScreen(const std::string input_engine_) : InputEngine(input_engine_) {
+TouchScreen::TouchScreen(const std::string& input_engine_) : InputEngine(input_engine_) {
PreSetController(identifier);
}
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 {
*/
class TouchScreen final : public InputCommon::InputEngine {
public:
- explicit TouchScreen(const std::string input_engine_);
+ explicit TouchScreen(const std::string& input_engine_);
/**
* 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
if (!configuring || !mapping_callback.on_data) {
return;
}
- if (std::abs(value.gyro_x) < 1.0f && std::abs(value.gyro_y) < 1.0f &&
- std::abs(value.gyro_z) < 1.0f) {
+ if (std::abs(value.gyro_x) < 0.6f && std::abs(value.gyro_y) < 0.6f &&
+ std::abs(value.gyro_z) < 0.6f) {
return;
}
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:
};
/// Retrieves the index number of the given hat button direction
- virtual u8 GetHatButtonId([[maybe_unused]] const std::string direction_name) const {
+ virtual u8 GetHatButtonId([[maybe_unused]] const std::string& direction_name) const {
return 0;
};