From ad5142ac2c56aded4090ad031a9351cd188caacf Mon Sep 17 00:00:00 2001 From: german77 Date: Mon, 20 Sep 2021 14:56:55 -0500 Subject: common: Rewrite and move core/frontend/input.h to common --- src/common/input.h | 242 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 242 insertions(+) create mode 100644 src/common/input.h (limited to 'src/common/input.h') diff --git a/src/common/input.h b/src/common/input.h new file mode 100644 index 000000000..6eefc55f9 --- /dev/null +++ b/src/common/input.h @@ -0,0 +1,242 @@ +// Copyright 2017 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include +#include +#include +#include +#include +#include "common/logging/log.h" +#include "common/param_package.h" + +namespace Input { + +enum class InputType { + None, + Battery, + Button, + Stick, + Analog, + Trigger, + Motion, + Touch, + Color, + Vibration, + Nfc, + Ir, +}; + +enum class BatteryLevel { + Empty, + Critical, + Low, + Medium, + Full, + Charging, +}; + +struct AnalogProperties { + float deadzone{}; + float range{1.0f}; + float threshold{0.5f}; + float offset{}; + bool inverted{}; +}; + +struct AnalogStatus { + float value{}; + float raw_value{}; + AnalogProperties properties{}; +}; + +struct ButtonStatus { + bool value{}; + bool inverted{}; + bool toggle{}; + bool locked{}; +}; + +using BatteryStatus = BatteryLevel; + +struct StickStatus { + AnalogStatus x{}; + AnalogStatus y{}; + bool left{}; + bool right{}; + bool up{}; + bool down{}; +}; + +struct TriggerStatus { + AnalogStatus analog{}; + bool pressed{}; +}; + +struct MotionSensor { + AnalogStatus x{}; + AnalogStatus y{}; + AnalogStatus z{}; +}; + +struct MotionStatus { + MotionSensor gyro{}; + MotionSensor accel{}; + u64 delta_timestamp{}; +}; + +struct TouchStatus { + ButtonStatus pressed{}; + AnalogStatus x{}; + AnalogStatus y{}; + u32 id{}; +}; + +struct BodyColorStatus { + u32 body{}; + u32 buttons{}; +}; + +struct VibrationStatus { + f32 low_amplitude{}; + f32 low_frequency{}; + f32 high_amplitude{}; + f32 high_frequency{}; +}; + +struct LedStatus { + bool led_1{}; + bool led_2{}; + bool led_3{}; + bool led_4{}; +}; + +struct CallbackStatus { + InputType type{InputType::None}; + ButtonStatus button_status{}; + StickStatus stick_status{}; + AnalogStatus analog_status{}; + TriggerStatus trigger_status{}; + MotionStatus motion_status{}; + TouchStatus touch_status{}; + BodyColorStatus color_status{}; + BatteryStatus battery_status{}; + VibrationStatus vibration_status{}; +}; + +struct InputCallback { + std::function on_change; +}; + +/// An abstract class template for an input device (a button, an analog input, etc.). +class InputDevice { +public: + virtual ~InputDevice() = default; + + void SetCallback(InputCallback callback_) { + callback = std::move(callback_); + } + + void TriggerOnChange(CallbackStatus status) { + if (callback.on_change) { + callback.on_change(status); + } + } + +private: + InputCallback callback; +}; + +/// An abstract class template for a factory that can create input devices. +template +class Factory { +public: + virtual ~Factory() = default; + virtual std::unique_ptr Create(const Common::ParamPackage&) = 0; +}; + +namespace Impl { + +template +using FactoryListType = std::unordered_map>>; + +template +struct FactoryList { + static FactoryListType list; +}; + +template +FactoryListType FactoryList::list; + +} // namespace Impl + +/** + * Registers an input device factory. + * @tparam InputDeviceType the type of input devices the factory can create + * @param name the name of the factory. Will be used to match the "engine" parameter when creating + * a device + * @param factory the factory object to register + */ +template +void RegisterFactory(const std::string& name, std::shared_ptr> factory) { + auto pair = std::make_pair(name, std::move(factory)); + if (!Impl::FactoryList::list.insert(std::move(pair)).second) { + LOG_ERROR(Input, "Factory '{}' already registered", name); + } +} + +/** + * Unregisters an input device factory. + * @tparam InputDeviceType the type of input devices the factory can create + * @param name the name of the factory to unregister + */ +template +void UnregisterFactory(const std::string& name) { + if (Impl::FactoryList::list.erase(name) == 0) { + LOG_ERROR(Input, "Factory '{}' not registered", name); + } +} + +/** + * Create an input device from given paramters. + * @tparam InputDeviceType the type of input devices to create + * @param params a serialized ParamPackage string that contains all parameters for creating the + * device + */ +template +std::unique_ptr CreateDeviceFromString(const std::string& params) { + const Common::ParamPackage package(params); + const std::string engine = package.Get("engine", "null"); + const auto& factory_list = Impl::FactoryList::list; + const auto pair = factory_list.find(engine); + if (pair == factory_list.end()) { + if (engine != "null") { + LOG_ERROR(Input, "Unknown engine name: {}", engine); + } + return std::make_unique(); + } + return pair->second->Create(package); +} + +/** + * Create an input device from given paramters. + * @tparam InputDeviceType the type of input devices to create + * @param A ParamPackage that contains all parameters for creating the device + */ +template +std::unique_ptr CreateDevice(const Common::ParamPackage package) { + const std::string engine = package.Get("engine", "null"); + const auto& factory_list = Impl::FactoryList::list; + const auto pair = factory_list.find(engine); + if (pair == factory_list.end()) { + if (engine != "null") { + LOG_ERROR(Input, "Unknown engine name: {}", engine); + } + return std::make_unique(); + } + return pair->second->Create(package); +} + +} // namespace Input -- cgit v1.2.3 From 06a5ef5874144a70e30e577a83ba68d1dad79e78 Mon Sep 17 00:00:00 2001 From: german77 Date: Mon, 11 Oct 2021 00:43:11 -0500 Subject: core/hid: Add output devices --- src/common/input.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/common/input.h') diff --git a/src/common/input.h b/src/common/input.h index 6eefc55f9..3a28b77a7 100644 --- a/src/common/input.h +++ b/src/common/input.h @@ -38,6 +38,27 @@ enum class BatteryLevel { Charging, }; +enum class PollingMode { + Active, + Pasive, + Camera, + NCF, + IR, +}; + +enum class VibrationError { + None, + NotSupported, + Disabled, + Unknown, +}; + +enum class PollingError { + None, + NotSupported, + Unknown, +}; + struct AnalogProperties { float deadzone{}; float range{1.0f}; @@ -149,6 +170,24 @@ private: InputCallback callback; }; +/// An abstract class template for an output device (rumble, LED pattern, polling mode). +class OutputDevice { +public: + virtual ~OutputDevice() = default; + + virtual void SetLED([[maybe_unused]] LedStatus led_status) { + return; + } + + virtual VibrationError SetVibration([[maybe_unused]] VibrationStatus vibration_status) { + return VibrationError::NotSupported; + } + + virtual PollingError SetPollingMode([[maybe_unused]] PollingMode polling_mode) { + return PollingError::NotSupported; + } +}; + /// An abstract class template for a factory that can create input devices. template class Factory { -- cgit v1.2.3 From 601ac43495904f3f7666d79a800a8b4eda5a8461 Mon Sep 17 00:00:00 2001 From: german77 Date: Tue, 19 Oct 2021 00:12:24 -0500 Subject: core/hid: Only signal when needed --- src/common/input.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/common/input.h') diff --git a/src/common/input.h b/src/common/input.h index 3a28b77a7..8871a9d07 100644 --- a/src/common/input.h +++ b/src/common/input.h @@ -30,6 +30,7 @@ enum class InputType { }; enum class BatteryLevel { + None, Empty, Critical, Low, -- cgit v1.2.3 From c3ff0a8ac0d1c3f9c0791b5263dae53c06ad6048 Mon Sep 17 00:00:00 2001 From: german77 Date: Wed, 20 Oct 2021 14:41:56 -0500 Subject: core/hid: Fix rumble too strong at 1% --- src/common/input.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/common/input.h') diff --git a/src/common/input.h b/src/common/input.h index 8871a9d07..cdacd4689 100644 --- a/src/common/input.h +++ b/src/common/input.h @@ -60,6 +60,12 @@ enum class PollingError { Unknown, }; +// Hint for amplification curve to be used +enum class VibrationAmplificationType { + Linear, + Exponential, +}; + struct AnalogProperties { float deadzone{}; float range{1.0f}; @@ -126,6 +132,7 @@ struct VibrationStatus { f32 low_frequency{}; f32 high_amplitude{}; f32 high_frequency{}; + VibrationAmplificationType type; }; struct LedStatus { -- cgit v1.2.3 From c6c32daf40ae1c720f0a2897c538bb1117371ea5 Mon Sep 17 00:00:00 2001 From: german77 Date: Sun, 24 Oct 2021 20:28:54 -0500 Subject: input_common: Add manual update options to input devices --- src/common/input.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/common/input.h') diff --git a/src/common/input.h b/src/common/input.h index cdacd4689..cb84f1005 100644 --- a/src/common/input.h +++ b/src/common/input.h @@ -164,6 +164,16 @@ class InputDevice { public: virtual ~InputDevice() = default; + // Request input device to update if necessary + virtual void SoftUpdate() { + return; + } + + // Force input device to update data regarless of the current state + virtual void ForceUpdate() { + return; + } + void SetCallback(InputCallback callback_) { callback = std::move(callback_); } -- cgit v1.2.3 From 2b1b0c2a30e242b08ec120e09803ec54d5445703 Mon Sep 17 00:00:00 2001 From: german77 Date: Sat, 30 Oct 2021 22:23:10 -0500 Subject: kraken: Address comments from review start lion review --- src/common/input.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/common/input.h') diff --git a/src/common/input.h b/src/common/input.h index cb84f1005..6d3227f5e 100644 --- a/src/common/input.h +++ b/src/common/input.h @@ -12,7 +12,7 @@ #include "common/logging/log.h" #include "common/param_package.h" -namespace Input { +namespace Common::Input { enum class InputType { None, @@ -296,4 +296,4 @@ std::unique_ptr CreateDevice(const Common::ParamPackage package return pair->second->Create(package); } -} // namespace Input +} // namespace Common::Input -- cgit v1.2.3 From 730f07830247cfcdc551c253d30c6717fc16316c Mon Sep 17 00:00:00 2001 From: german77 Date: Sun, 31 Oct 2021 10:41:44 -0500 Subject: settings: Fix Debug controller type options --- src/common/input.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/common/input.h') diff --git a/src/common/input.h b/src/common/input.h index 6d3227f5e..16b1e6f1b 100644 --- a/src/common/input.h +++ b/src/common/input.h @@ -100,7 +100,7 @@ struct StickStatus { struct TriggerStatus { AnalogStatus analog{}; - bool pressed{}; + ButtonStatus pressed{}; }; struct MotionSensor { @@ -119,7 +119,7 @@ struct TouchStatus { ButtonStatus pressed{}; AnalogStatus x{}; AnalogStatus y{}; - u32 id{}; + int id{}; }; struct BodyColorStatus { -- cgit v1.2.3 From 77fa4d4bf60526826ef8b53ee3870f7d2a761976 Mon Sep 17 00:00:00 2001 From: german77 Date: Mon, 1 Nov 2021 14:17:53 -0600 Subject: second commit lion review --- src/common/input.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/common/input.h') diff --git a/src/common/input.h b/src/common/input.h index 16b1e6f1b..12acd8785 100644 --- a/src/common/input.h +++ b/src/common/input.h @@ -29,7 +29,7 @@ enum class InputType { Ir, }; -enum class BatteryLevel { +enum class BatteryLevel : u32 { None, Empty, Critical, -- cgit v1.2.3 From 136eb9c4c2b2425c2dd45a79cf444dee7170714d Mon Sep 17 00:00:00 2001 From: german77 Date: Mon, 1 Nov 2021 19:49:14 -0600 Subject: core/hid: Fully emulate motion from button --- src/common/input.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/common/input.h') diff --git a/src/common/input.h b/src/common/input.h index 12acd8785..8f29026a1 100644 --- a/src/common/input.h +++ b/src/common/input.h @@ -110,9 +110,14 @@ struct MotionSensor { }; struct MotionStatus { + // Gyroscope vector measurement in radians/s. MotionSensor gyro{}; + // Acceleration vector measurement in G force MotionSensor accel{}; + // Time since last measurement in microseconds u64 delta_timestamp{}; + // Request to update after reading the value + bool force_update{}; }; struct TouchStatus { -- cgit v1.2.3 From 157e0b85fdd805e02d234dccf1ce578e3159adee Mon Sep 17 00:00:00 2001 From: german77 Date: Tue, 2 Nov 2021 22:50:30 -0600 Subject: core/hid: Prevent Emulated controller from flapping with multiple inputs devices --- src/common/input.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/common/input.h') diff --git a/src/common/input.h b/src/common/input.h index 8f29026a1..f21872b0a 100644 --- a/src/common/input.h +++ b/src/common/input.h @@ -11,6 +11,7 @@ #include #include "common/logging/log.h" #include "common/param_package.h" +#include "common/uuid.h" namespace Common::Input { @@ -81,6 +82,7 @@ struct AnalogStatus { }; struct ButtonStatus { + Common::UUID uuid{}; bool value{}; bool inverted{}; bool toggle{}; @@ -90,6 +92,7 @@ struct ButtonStatus { using BatteryStatus = BatteryLevel; struct StickStatus { + Common::UUID uuid{}; AnalogStatus x{}; AnalogStatus y{}; bool left{}; @@ -99,6 +102,7 @@ struct StickStatus { }; struct TriggerStatus { + Common::UUID uuid{}; AnalogStatus analog{}; ButtonStatus pressed{}; }; -- cgit v1.2.3 From 84c58666a4dbb6d46e132514e4d91437fb689fa0 Mon Sep 17 00:00:00 2001 From: german77 Date: Wed, 3 Nov 2021 22:35:45 -0600 Subject: config: Cleanup and documentation --- src/common/input.h | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'src/common/input.h') diff --git a/src/common/input.h b/src/common/input.h index f21872b0a..d997853c6 100644 --- a/src/common/input.h +++ b/src/common/input.h @@ -15,6 +15,7 @@ namespace Common::Input { +// Type of data that is expected to recieve or send enum class InputType { None, Battery, @@ -30,6 +31,7 @@ enum class InputType { Ir, }; +// Internal battery charge level enum class BatteryLevel : u32 { None, Empty, @@ -41,13 +43,17 @@ enum class BatteryLevel : u32 { }; enum class PollingMode { + // Constant polling of buttons, analogs and motion data Active, + // Only update on button change, digital analogs Pasive, - Camera, - NCF, + // Enable near field communication polling + NFC, + // Enable infrared camera polling IR, }; +// Vibration reply from the controller enum class VibrationError { None, NotSupported, @@ -55,6 +61,7 @@ enum class VibrationError { Unknown, }; +// Polling mode reply from the controller enum class PollingError { None, NotSupported, @@ -67,20 +74,28 @@ enum class VibrationAmplificationType { Exponential, }; +// Analog properties for calibration struct AnalogProperties { + // Anything below this value will be detected as zero float deadzone{}; + // Anyting above this values will be detected as one float range{1.0f}; + // Minimum value to be detected as active float threshold{0.5f}; + // Drift correction applied to the raw data float offset{}; + // Invert direction of the sensor data bool inverted{}; }; +// Single analog sensor data struct AnalogStatus { float value{}; float raw_value{}; AnalogProperties properties{}; }; +// Button data struct ButtonStatus { Common::UUID uuid{}; bool value{}; @@ -89,8 +104,10 @@ struct ButtonStatus { bool locked{}; }; +// Internal battery data using BatteryStatus = BatteryLevel; +// Analog and digital joystick data struct StickStatus { Common::UUID uuid{}; AnalogStatus x{}; @@ -101,18 +118,21 @@ struct StickStatus { bool down{}; }; +// Analog and digital trigger data struct TriggerStatus { Common::UUID uuid{}; AnalogStatus analog{}; ButtonStatus pressed{}; }; +// 3D vector representing motion input struct MotionSensor { AnalogStatus x{}; AnalogStatus y{}; AnalogStatus z{}; }; +// Motion data used to calculate controller orientation struct MotionStatus { // Gyroscope vector measurement in radians/s. MotionSensor gyro{}; @@ -124,6 +144,7 @@ struct MotionStatus { bool force_update{}; }; +// Data of a single point on a touch screen struct TouchStatus { ButtonStatus pressed{}; AnalogStatus x{}; @@ -131,11 +152,13 @@ struct TouchStatus { int id{}; }; +// Physical controller color in RGB format struct BodyColorStatus { u32 body{}; u32 buttons{}; }; +// HD rumble data struct VibrationStatus { f32 low_amplitude{}; f32 low_frequency{}; @@ -144,6 +167,7 @@ struct VibrationStatus { VibrationAmplificationType type; }; +// Physical controller LED pattern struct LedStatus { bool led_1{}; bool led_2{}; @@ -151,6 +175,7 @@ struct LedStatus { bool led_4{}; }; +// Callback data consisting of an input type and the equivalent data status struct CallbackStatus { InputType type{InputType::None}; ButtonStatus button_status{}; @@ -164,6 +189,7 @@ struct CallbackStatus { VibrationStatus vibration_status{}; }; +// Triggered once every input change struct InputCallback { std::function on_change; }; @@ -178,15 +204,17 @@ public: return; } - // Force input device to update data regarless of the current state + // Force input device to update data regardless of the current state virtual void ForceUpdate() { return; } + // Sets the function to be triggered when input changes void SetCallback(InputCallback callback_) { callback = std::move(callback_); } + // Triggers the function set in the callback void TriggerOnChange(CallbackStatus status) { if (callback.on_change) { callback.on_change(status); -- cgit v1.2.3 From 746c85b56011b87afb57e37b75953435389fc810 Mon Sep 17 00:00:00 2001 From: german77 Date: Sun, 21 Nov 2021 14:12:01 -0600 Subject: input_common: Move button names to the frontend --- src/common/input.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/common/input.h') diff --git a/src/common/input.h b/src/common/input.h index d997853c6..cc0cbd9b8 100644 --- a/src/common/input.h +++ b/src/common/input.h @@ -175,6 +175,28 @@ struct LedStatus { bool led_4{}; }; +// List of buttons to be passed to Qt that can be translated +enum class ButtonNames { + Undefined, + Invalid, + // This will display the engine name instead of the button name + Engine, + // This will display the button by value instead of the button name + Value, + ButtonLeft, + ButtonRight, + ButtonDown, + ButtonUp, + TriggerZ, + TriggerR, + TriggerL, + ButtonA, + ButtonB, + ButtonX, + ButtonY, + ButtonStart, +}; + // Callback data consisting of an input type and the equivalent data status struct CallbackStatus { InputType type{InputType::None}; -- cgit v1.2.3 From 639402850ac65c694967ef6519becb65abe89b39 Mon Sep 17 00:00:00 2001 From: Narr the Reg Date: Fri, 26 Nov 2021 15:45:37 -0600 Subject: input_common: Fully implement UDP controllers --- src/common/input.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/common/input.h') diff --git a/src/common/input.h b/src/common/input.h index cc0cbd9b8..eaee0bdea 100644 --- a/src/common/input.h +++ b/src/common/input.h @@ -195,6 +195,20 @@ enum class ButtonNames { ButtonX, ButtonY, ButtonStart, + + // DS4 button names + L1, + L2, + L3, + R1, + R2, + R3, + Circle, + Cross, + Square, + Triangle, + Share, + Options, }; // Callback data consisting of an input type and the equivalent data status -- cgit v1.2.3 From 38f3442ea56a3ac9447924c015c2a9ade0f5bb83 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 13 Dec 2021 09:09:03 -0500 Subject: input_engine: Pass VibrationStatus by const reference in SetRumble() Avoids creating copies of the struct where not necessary. --- src/common/input.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/common/input.h') diff --git a/src/common/input.h b/src/common/input.h index eaee0bdea..12d5d976f 100644 --- a/src/common/input.h +++ b/src/common/input.h @@ -266,11 +266,9 @@ class OutputDevice { public: virtual ~OutputDevice() = default; - virtual void SetLED([[maybe_unused]] LedStatus led_status) { - return; - } + virtual void SetLED([[maybe_unused]] LedStatus led_status) {} - virtual VibrationError SetVibration([[maybe_unused]] VibrationStatus vibration_status) { + virtual VibrationError SetVibration([[maybe_unused]] const VibrationStatus& vibration_status) { return VibrationError::NotSupported; } -- cgit v1.2.3 From 985599e485cbee94eb99d0bfcfdbec5345968b15 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 13 Dec 2021 09:20:55 -0500 Subject: input_engine: Pass LedStatus by const reference Avoids copies where reasonably applicable --- src/common/input.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/common/input.h') diff --git a/src/common/input.h b/src/common/input.h index 12d5d976f..0b92449bc 100644 --- a/src/common/input.h +++ b/src/common/input.h @@ -266,7 +266,7 @@ class OutputDevice { public: virtual ~OutputDevice() = default; - virtual void SetLED([[maybe_unused]] LedStatus led_status) {} + virtual void SetLED([[maybe_unused]] const LedStatus& led_status) {} virtual VibrationError SetVibration([[maybe_unused]] const VibrationStatus& vibration_status) { return VibrationError::NotSupported; -- cgit v1.2.3 From 54eafbaf172309d92c6b2c5069de23fc534dd2d2 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 13 Dec 2021 20:43:09 -0500 Subject: common/input: Remove unnecessary returns Given these return void, these can be omitted. --- src/common/input.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/common/input.h') diff --git a/src/common/input.h b/src/common/input.h index 0b92449bc..848ad7b81 100644 --- a/src/common/input.h +++ b/src/common/input.h @@ -236,14 +236,10 @@ public: virtual ~InputDevice() = default; // Request input device to update if necessary - virtual void SoftUpdate() { - return; - } + virtual void SoftUpdate() {} // Force input device to update data regardless of the current state - virtual void ForceUpdate() { - return; - } + virtual void ForceUpdate() {} // Sets the function to be triggered when input changes void SetCallback(InputCallback callback_) { -- cgit v1.2.3 From e05d2a70b24e550d67fcdd24aae7094ad41745f8 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 13 Dec 2021 21:09:28 -0500 Subject: common/input: Avoid numerous large copies of CallbackStatus CallbackStatus instances aren't the cheapest things to copy around (relative to everything else), given that they're currently 520 bytes in size and are currently copied numerous times when callbacks are invoked. Instead, we can pass the status by const reference to avoid all the copying. --- src/common/input.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/common/input.h') diff --git a/src/common/input.h b/src/common/input.h index 848ad7b81..f775a4c01 100644 --- a/src/common/input.h +++ b/src/common/input.h @@ -227,7 +227,7 @@ struct CallbackStatus { // Triggered once every input change struct InputCallback { - std::function on_change; + std::function on_change; }; /// An abstract class template for an input device (a button, an analog input, etc.). @@ -247,7 +247,7 @@ public: } // Triggers the function set in the callback - void TriggerOnChange(CallbackStatus status) { + void TriggerOnChange(const CallbackStatus& status) { if (callback.on_change) { callback.on_change(status); } -- cgit v1.2.3