summaryrefslogtreecommitdiffstats
path: root/src/input_common
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2021-12-13 15:09:03 +0100
committerLioncash <mathew1800@gmail.com>2021-12-13 15:16:10 +0100
commit38f3442ea56a3ac9447924c015c2a9ade0f5bb83 (patch)
tree4fbdcc84b82ff753306647b309c8a0b128af02f0 /src/input_common
parentinput_engine: std::move engine name where applicable (diff)
downloadyuzu-38f3442ea56a3ac9447924c015c2a9ade0f5bb83.tar
yuzu-38f3442ea56a3ac9447924c015c2a9ade0f5bb83.tar.gz
yuzu-38f3442ea56a3ac9447924c015c2a9ade0f5bb83.tar.bz2
yuzu-38f3442ea56a3ac9447924c015c2a9ade0f5bb83.tar.lz
yuzu-38f3442ea56a3ac9447924c015c2a9ade0f5bb83.tar.xz
yuzu-38f3442ea56a3ac9447924c015c2a9ade0f5bb83.tar.zst
yuzu-38f3442ea56a3ac9447924c015c2a9ade0f5bb83.zip
Diffstat (limited to 'src/input_common')
-rw-r--r--src/input_common/drivers/gc_adapter.cpp4
-rw-r--r--src/input_common/drivers/gc_adapter.h2
-rw-r--r--src/input_common/drivers/sdl_driver.cpp6
-rw-r--r--src/input_common/drivers/sdl_driver.h2
-rw-r--r--src/input_common/input_engine.h2
-rw-r--r--src/input_common/input_poller.cpp2
6 files changed, 10 insertions, 8 deletions
diff --git a/src/input_common/drivers/gc_adapter.cpp b/src/input_common/drivers/gc_adapter.cpp
index 451147755..7ab4540a8 100644
--- a/src/input_common/drivers/gc_adapter.cpp
+++ b/src/input_common/drivers/gc_adapter.cpp
@@ -325,8 +325,8 @@ bool GCAdapter::GetGCEndpoint(libusb_device* device) {
return true;
}
-Common::Input::VibrationError GCAdapter::SetRumble(const PadIdentifier& identifier,
- const Common::Input::VibrationStatus vibration) {
+Common::Input::VibrationError GCAdapter::SetRumble(
+ const PadIdentifier& identifier, const Common::Input::VibrationStatus& vibration) {
const auto mean_amplitude = (vibration.low_amplitude + vibration.high_amplitude) * 0.5f;
const auto processed_amplitude =
static_cast<u8>((mean_amplitude + std::pow(mean_amplitude, 0.3f)) * 0.5f * 0x8);
diff --git a/src/input_common/drivers/gc_adapter.h b/src/input_common/drivers/gc_adapter.h
index 3c4f0396c..7ce1912a3 100644
--- a/src/input_common/drivers/gc_adapter.h
+++ b/src/input_common/drivers/gc_adapter.h
@@ -28,7 +28,7 @@ public:
~GCAdapter() override;
Common::Input::VibrationError SetRumble(
- const PadIdentifier& identifier, const Common::Input::VibrationStatus vibration) override;
+ const PadIdentifier& identifier, const Common::Input::VibrationStatus& vibration) override;
/// Used for automapping features
std::vector<Common::ParamPackage> GetInputDevices() const override;
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp
index 1bae6cdc8..a9219dbf2 100644
--- a/src/input_common/drivers/sdl_driver.cpp
+++ b/src/input_common/drivers/sdl_driver.cpp
@@ -491,8 +491,9 @@ std::vector<Common::ParamPackage> SDLDriver::GetInputDevices() const {
}
return devices;
}
-Common::Input::VibrationError SDLDriver::SetRumble(const PadIdentifier& identifier,
- const Common::Input::VibrationStatus vibration) {
+
+Common::Input::VibrationError SDLDriver::SetRumble(
+ const PadIdentifier& identifier, const Common::Input::VibrationStatus& vibration) {
const auto joystick =
GetSDLJoystickByGUID(identifier.guid.Format(), static_cast<int>(identifier.port));
const auto process_amplitude_exp = [](f32 amplitude, f32 factor) {
@@ -526,6 +527,7 @@ Common::Input::VibrationError SDLDriver::SetRumble(const PadIdentifier& identifi
return Common::Input::VibrationError::None;
}
+
Common::ParamPackage SDLDriver::BuildAnalogParamPackageForButton(int port, std::string guid,
s32 axis, float value) const {
Common::ParamPackage params{};
diff --git a/src/input_common/drivers/sdl_driver.h b/src/input_common/drivers/sdl_driver.h
index c6fffe374..e9a5d2e26 100644
--- a/src/input_common/drivers/sdl_driver.h
+++ b/src/input_common/drivers/sdl_driver.h
@@ -59,7 +59,7 @@ public:
u8 GetHatButtonId(const std::string& direction_name) const override;
Common::Input::VibrationError SetRumble(
- const PadIdentifier& identifier, const Common::Input::VibrationStatus vibration) override;
+ const PadIdentifier& identifier, const Common::Input::VibrationStatus& vibration) override;
private:
void InitJoystick(int joystick_index);
diff --git a/src/input_common/input_engine.h b/src/input_common/input_engine.h
index b21adfabf..15cd5fa2e 100644
--- a/src/input_common/input_engine.h
+++ b/src/input_common/input_engine.h
@@ -119,7 +119,7 @@ public:
// Sets rumble to a controller
virtual Common::Input::VibrationError SetRumble(
[[maybe_unused]] const PadIdentifier& identifier,
- [[maybe_unused]] const Common::Input::VibrationStatus vibration) {
+ [[maybe_unused]] const Common::Input::VibrationStatus& vibration) {
return Common::Input::VibrationError::NotSupported;
}
diff --git a/src/input_common/input_poller.cpp b/src/input_common/input_poller.cpp
index 7e4eafded..de63f36b3 100644
--- a/src/input_common/input_poller.cpp
+++ b/src/input_common/input_poller.cpp
@@ -673,7 +673,7 @@ public:
}
virtual Common::Input::VibrationError SetVibration(
- Common::Input::VibrationStatus vibration_status) {
+ const Common::Input::VibrationStatus& vibration_status) {
return input_engine->SetRumble(identifier, vibration_status);
}