summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2021-12-13 15:26:44 +0100
committerLioncash <mathew1800@gmail.com>2021-12-13 15:57:39 +0100
commit755822ceecf2a261a09f486706955bebc23d3917 (patch)
tree2c108925761d939e52b3a5a2c56486b52246c8a9
parentinput_engine: std::move InputIdentifier in SetCallback() (diff)
downloadyuzu-755822ceecf2a261a09f486706955bebc23d3917.tar
yuzu-755822ceecf2a261a09f486706955bebc23d3917.tar.gz
yuzu-755822ceecf2a261a09f486706955bebc23d3917.tar.bz2
yuzu-755822ceecf2a261a09f486706955bebc23d3917.tar.lz
yuzu-755822ceecf2a261a09f486706955bebc23d3917.tar.xz
yuzu-755822ceecf2a261a09f486706955bebc23d3917.tar.zst
yuzu-755822ceecf2a261a09f486706955bebc23d3917.zip
Diffstat (limited to '')
-rw-r--r--src/input_common/drivers/sdl_driver.cpp4
-rw-r--r--src/input_common/input_engine.cpp4
-rw-r--r--src/input_common/input_engine.h5
3 files changed, 7 insertions, 6 deletions
diff --git a/src/input_common/drivers/sdl_driver.cpp b/src/input_common/drivers/sdl_driver.cpp
index a9219dbf2..e33a5ff31 100644
--- a/src/input_common/drivers/sdl_driver.cpp
+++ b/src/input_common/drivers/sdl_driver.cpp
@@ -88,7 +88,7 @@ public:
return true;
}
- BasicMotion GetMotion() {
+ const BasicMotion& GetMotion() const {
return motion;
}
@@ -367,7 +367,7 @@ void SDLDriver::HandleGameControllerEvent(const SDL_Event& event) {
if (joystick->UpdateMotion(event.csensor)) {
const PadIdentifier identifier = joystick->GetPadIdentifier();
SetMotion(identifier, 0, joystick->GetMotion());
- };
+ }
}
break;
}
diff --git a/src/input_common/input_engine.cpp b/src/input_common/input_engine.cpp
index 6b057e2f1..5481607bf 100644
--- a/src/input_common/input_engine.cpp
+++ b/src/input_common/input_engine.cpp
@@ -91,7 +91,7 @@ void InputEngine::SetBattery(const PadIdentifier& identifier, BatteryLevel value
TriggerOnBatteryChange(identifier, value);
}
-void InputEngine::SetMotion(const PadIdentifier& identifier, int motion, BasicMotion value) {
+void InputEngine::SetMotion(const PadIdentifier& identifier, int motion, const BasicMotion& value) {
{
std::lock_guard lock{mutex};
ControllerData& controller = controller_list.at(identifier);
@@ -286,7 +286,7 @@ void InputEngine::TriggerOnBatteryChange(const PadIdentifier& identifier,
}
void InputEngine::TriggerOnMotionChange(const PadIdentifier& identifier, int motion,
- BasicMotion value) {
+ const BasicMotion& value) {
std::lock_guard lock{mutex_callback};
for (const std::pair<int, InputIdentifier> poller_pair : callback_list) {
const InputIdentifier& poller = poller_pair.second;
diff --git a/src/input_common/input_engine.h b/src/input_common/input_engine.h
index 78e7046c7..f9fa5fec3 100644
--- a/src/input_common/input_engine.h
+++ b/src/input_common/input_engine.h
@@ -190,7 +190,7 @@ protected:
void SetHatButton(const PadIdentifier& identifier, int button, u8 value);
void SetAxis(const PadIdentifier& identifier, int axis, f32 value);
void SetBattery(const PadIdentifier& identifier, BatteryLevel value);
- void SetMotion(const PadIdentifier& identifier, int motion, BasicMotion value);
+ void SetMotion(const PadIdentifier& identifier, int motion, const BasicMotion& value);
virtual std::string GetHatButtonName([[maybe_unused]] u8 direction_value) const {
return "Unknown";
@@ -209,7 +209,8 @@ private:
void TriggerOnHatButtonChange(const PadIdentifier& identifier, int button, u8 value);
void TriggerOnAxisChange(const PadIdentifier& identifier, int button, f32 value);
void TriggerOnBatteryChange(const PadIdentifier& identifier, BatteryLevel value);
- void TriggerOnMotionChange(const PadIdentifier& identifier, int motion, BasicMotion value);
+ void TriggerOnMotionChange(const PadIdentifier& identifier, int motion,
+ const BasicMotion& value);
bool IsInputIdentifierEqual(const InputIdentifier& input_identifier,
const PadIdentifier& identifier, EngineInputType type,