summaryrefslogtreecommitdiffstats
path: root/src/input_common/drivers
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/input_common/drivers/gc_adapter.cpp6
-rw-r--r--src/input_common/drivers/gc_adapter.h8
-rw-r--r--src/input_common/drivers/keyboard.cpp2
-rw-r--r--src/input_common/drivers/keyboard.h4
-rw-r--r--src/input_common/drivers/mouse.cpp2
-rw-r--r--src/input_common/drivers/mouse.h4
-rw-r--r--src/input_common/drivers/sdl_driver.cpp19
-rw-r--r--src/input_common/drivers/sdl_driver.h14
-rw-r--r--src/input_common/drivers/tas_input.cpp95
-rw-r--r--src/input_common/drivers/tas_input.h65
-rw-r--r--src/input_common/drivers/touch_screen.cpp2
-rw-r--r--src/input_common/drivers/touch_screen.h4
-rw-r--r--src/input_common/drivers/udp_client.cpp2
-rw-r--r--src/input_common/drivers/udp_client.h6
14 files changed, 124 insertions, 109 deletions
diff --git a/src/input_common/drivers/gc_adapter.cpp b/src/input_common/drivers/gc_adapter.cpp
index 8b6574223..7ab4540a8 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(std::string input_engine_) : InputEngine(std::move(input_engine_)) {
if (usb_adapter_handle) {
return;
}
@@ -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 8dc51d2e5..7ce1912a3 100644
--- a/src/input_common/drivers/gc_adapter.h
+++ b/src/input_common/drivers/gc_adapter.h
@@ -22,13 +22,13 @@ namespace InputCommon {
class LibUSBContext;
class LibUSBDeviceHandle;
-class GCAdapter : public InputCommon::InputEngine {
+class GCAdapter : public InputEngine {
public:
- explicit GCAdapter(const std::string& input_engine_);
- ~GCAdapter();
+ explicit GCAdapter(std::string input_engine_);
+ ~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/keyboard.cpp b/src/input_common/drivers/keyboard.cpp
index 23b0c0ccf..4c1e5bbec 100644
--- a/src/input_common/drivers/keyboard.cpp
+++ b/src/input_common/drivers/keyboard.cpp
@@ -24,7 +24,7 @@ constexpr PadIdentifier keyboard_modifier_identifier = {
.pad = 1,
};
-Keyboard::Keyboard(const std::string& input_engine_) : InputEngine(input_engine_) {
+Keyboard::Keyboard(std::string input_engine_) : InputEngine(std::move(input_engine_)) {
// Keyboard is broken into 3 diferent sets:
// key: Unfiltered intended for controllers.
// keyboard_key: Allows only Settings::NativeKeyboard::Keys intended for keyboard emulation.
diff --git a/src/input_common/drivers/keyboard.h b/src/input_common/drivers/keyboard.h
index ad123b136..3856c882c 100644
--- a/src/input_common/drivers/keyboard.h
+++ b/src/input_common/drivers/keyboard.h
@@ -12,9 +12,9 @@ namespace InputCommon {
* A button device factory representing a keyboard. It receives keyboard events and forward them
* to all button devices it created.
*/
-class Keyboard final : public InputCommon::InputEngine {
+class Keyboard final : public InputEngine {
public:
- explicit Keyboard(const std::string& input_engine_);
+ explicit Keyboard(std::string input_engine_);
/**
* Sets the status of all buttons bound with the key to pressed
diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp
index 752118e97..aa69216c8 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(std::string input_engine_) : InputEngine(std::move(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 4a1fd2fd9..040446178 100644
--- a/src/input_common/drivers/mouse.h
+++ b/src/input_common/drivers/mouse.h
@@ -27,9 +27,9 @@ enum class MouseButton {
* A button device factory representing a keyboard. It receives keyboard events and forward them
* to all button devices it created.
*/
-class Mouse final : public InputCommon::InputEngine {
+class Mouse final : public InputEngine {
public:
- explicit Mouse(const std::string& input_engine_);
+ explicit Mouse(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 1052ed394..0cda9df62 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;
}
@@ -387,7 +387,7 @@ void SDLDriver::CloseJoysticks() {
joystick_map.clear();
}
-SDLDriver::SDLDriver(const std::string& input_engine_) : InputEngine(input_engine_) {
+SDLDriver::SDLDriver(std::string input_engine_) : InputEngine(std::move(input_engine_)) {
if (!Settings::values.enable_raw_input) {
// Disable raw input. When enabled this setting causes SDL to die when a web applet opens
SDL_SetHint(SDL_HINT_JOYSTICK_RAWINPUT, "0");
@@ -403,10 +403,11 @@ SDLDriver::SDLDriver(const std::string& input_engine_) : InputEngine(input_engin
// Use hidapi driver for joycons. This will allow joycons to be detected as a GameController and
// not a generic one
- SDL_SetHint("SDL_JOYSTICK_HIDAPI_JOY_CONS", "1");
+ SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS, "1");
- // Turn off Pro controller home led
- SDL_SetHint("SDL_JOYSTICK_HIDAPI_SWITCH_HOME_LED", "0");
+ // Disable hidapi driver for xbox. Already default on Windows, this causes conflict with native
+ // driver on Linux.
+ SDL_SetHint(SDL_HINT_JOYSTICK_HIDAPI_XBOX, "0");
// If the frontend is going to manage the event loop, then we don't start one here
start_thread = SDL_WasInit(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER) == 0;
@@ -491,8 +492,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 +528,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 d03ff4b84..e9a5d2e26 100644
--- a/src/input_common/drivers/sdl_driver.h
+++ b/src/input_common/drivers/sdl_driver.h
@@ -19,19 +19,19 @@ using SDL_GameController = struct _SDL_GameController;
using SDL_Joystick = struct _SDL_Joystick;
using SDL_JoystickID = s32;
+namespace InputCommon {
+
+class SDLJoystick;
+
using ButtonBindings =
std::array<std::pair<Settings::NativeButton::Values, SDL_GameControllerButton>, 17>;
using ZButtonBindings =
std::array<std::pair<Settings::NativeButton::Values, SDL_GameControllerAxis>, 2>;
-namespace InputCommon {
-
-class SDLJoystick;
-
-class SDLDriver : public InputCommon::InputEngine {
+class SDLDriver : public InputEngine {
public:
/// Initializes and registers SDL device factories
- SDLDriver(const std::string& input_engine_);
+ explicit SDLDriver(std::string input_engine_);
/// Unregisters SDL device factories and shut them down.
~SDLDriver() override;
@@ -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/drivers/tas_input.cpp b/src/input_common/drivers/tas_input.cpp
index 0e01fb0d9..5bdd5dac3 100644
--- a/src/input_common/drivers/tas_input.cpp
+++ b/src/input_common/drivers/tas_input.cpp
@@ -3,7 +3,6 @@
// Refer to the license.txt file included.
#include <cstring>
-#include <regex>
#include <fmt/format.h>
#include "common/fs/file.h"
@@ -15,7 +14,7 @@
namespace InputCommon::TasInput {
-enum TasAxes : u8 {
+enum class Tas::TasAxis : u8 {
StickX,
StickY,
SubstickX,
@@ -47,7 +46,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(std::string input_engine_) : InputEngine(std::move(input_engine_)) {
for (size_t player_index = 0; player_index < PLAYER_NUMBER; player_index++) {
PadIdentifier identifier{
.guid = Common::UUID{},
@@ -66,7 +65,7 @@ Tas::Tas(const std::string& input_engine_) : InputCommon::InputEngine(input_engi
Tas::~Tas() {
Stop();
-};
+}
void Tas::LoadTasFiles() {
script_length = 0;
@@ -79,43 +78,43 @@ void Tas::LoadTasFiles() {
}
void Tas::LoadTasFile(size_t player_index, size_t file_index) {
- if (!commands[player_index].empty()) {
- commands[player_index].clear();
- }
+ commands[player_index].clear();
+
std::string file = Common::FS::ReadStringFromFile(
Common::FS::GetYuzuPath(Common::FS::YuzuPath::TASDir) /
fmt::format("script{}-{}.txt", file_index, player_index + 1),
Common::FS::FileType::BinaryFile);
- std::stringstream command_line(file);
+ std::istringstream command_line(file);
std::string line;
int frame_no = 0;
while (std::getline(command_line, line, '\n')) {
if (line.empty()) {
continue;
}
- std::smatch m;
- std::stringstream linestream(line);
- std::string segment;
- std::vector<std::string> seglist;
-
- while (std::getline(linestream, segment, ' ')) {
- seglist.push_back(segment);
+ std::vector<std::string> seg_list;
+ {
+ std::istringstream line_stream(line);
+ std::string segment;
+ while (std::getline(line_stream, segment, ' ')) {
+ seg_list.push_back(std::move(segment));
+ }
}
- if (seglist.size() < 4) {
+ if (seg_list.size() < 4) {
continue;
}
- while (frame_no < std::stoi(seglist.at(0))) {
- commands[player_index].push_back({});
+ const auto num_frames = std::stoi(seg_list[0]);
+ while (frame_no < num_frames) {
+ commands[player_index].emplace_back();
frame_no++;
}
TASCommand command = {
- .buttons = ReadCommandButtons(seglist.at(1)),
- .l_axis = ReadCommandAxis(seglist.at(2)),
- .r_axis = ReadCommandAxis(seglist.at(3)),
+ .buttons = ReadCommandButtons(seg_list[1]),
+ .l_axis = ReadCommandAxis(seg_list[2]),
+ .r_axis = ReadCommandAxis(seg_list[3]),
};
commands[player_index].push_back(command);
frame_no++;
@@ -123,16 +122,17 @@ void Tas::LoadTasFile(size_t player_index, size_t file_index) {
LOG_INFO(Input, "TAS file loaded! {} frames", frame_no);
}
-void Tas::WriteTasFile(std::u8string file_name) {
+void Tas::WriteTasFile(std::u8string_view file_name) {
std::string output_text;
for (size_t frame = 0; frame < record_commands.size(); frame++) {
const TASCommand& line = record_commands[frame];
output_text += fmt::format("{} {} {} {}\n", frame, WriteCommandButtons(line.buttons),
WriteCommandAxis(line.l_axis), WriteCommandAxis(line.r_axis));
}
- const auto bytes_written = Common::FS::WriteStringToFile(
- Common::FS::GetYuzuPath(Common::FS::YuzuPath::TASDir) / file_name,
- Common::FS::FileType::TextFile, output_text);
+
+ const auto tas_file_name = Common::FS::GetYuzuPath(Common::FS::YuzuPath::TASDir) / file_name;
+ const auto bytes_written =
+ Common::FS::WriteStringToFile(tas_file_name, Common::FS::FileType::TextFile, output_text);
if (bytes_written == output_text.size()) {
LOG_INFO(Input, "TAS file written to file!");
} else {
@@ -205,10 +205,10 @@ void Tas::UpdateThread() {
const int button = static_cast<int>(i);
SetButton(identifier, button, button_status);
}
- SetAxis(identifier, TasAxes::StickX, command.l_axis.x);
- SetAxis(identifier, TasAxes::StickY, command.l_axis.y);
- SetAxis(identifier, TasAxes::SubstickX, command.r_axis.x);
- SetAxis(identifier, TasAxes::SubstickY, command.r_axis.y);
+ SetTasAxis(identifier, TasAxis::StickX, command.l_axis.x);
+ SetTasAxis(identifier, TasAxis::StickY, command.l_axis.y);
+ SetTasAxis(identifier, TasAxis::SubstickX, command.r_axis.x);
+ SetTasAxis(identifier, TasAxis::SubstickY, command.r_axis.y);
}
} else {
is_running = Settings::values.tas_loop.GetValue();
@@ -224,27 +224,28 @@ void Tas::ClearInput() {
}
TasAnalog Tas::ReadCommandAxis(const std::string& line) const {
- std::stringstream linestream(line);
- std::string segment;
- std::vector<std::string> seglist;
-
- while (std::getline(linestream, segment, ';')) {
- seglist.push_back(segment);
+ std::vector<std::string> seg_list;
+ {
+ std::istringstream line_stream(line);
+ std::string segment;
+ while (std::getline(line_stream, segment, ';')) {
+ seg_list.push_back(std::move(segment));
+ }
}
- const float x = std::stof(seglist.at(0)) / 32767.0f;
- const float y = std::stof(seglist.at(1)) / 32767.0f;
+ const float x = std::stof(seg_list.at(0)) / 32767.0f;
+ const float y = std::stof(seg_list.at(1)) / 32767.0f;
return {x, y};
}
-u64 Tas::ReadCommandButtons(const std::string& data) const {
- std::stringstream button_text(data);
- std::string line;
+u64 Tas::ReadCommandButtons(const std::string& line) const {
+ std::istringstream button_text(line);
+ std::string button_line;
u64 buttons = 0;
- while (std::getline(button_text, line, ';')) {
- for (auto [text, tas_button] : text_to_tas_button) {
- if (text == line) {
+ while (std::getline(button_text, button_line, ';')) {
+ for (const auto& [text, tas_button] : text_to_tas_button) {
+ if (text == button_line) {
buttons |= static_cast<u64>(tas_button);
break;
}
@@ -254,8 +255,8 @@ u64 Tas::ReadCommandButtons(const std::string& data) const {
}
std::string Tas::WriteCommandButtons(u64 buttons) const {
- std::string returns = "";
- for (auto [text_button, tas_button] : text_to_tas_button) {
+ std::string returns;
+ for (const auto& [text_button, tas_button] : text_to_tas_button) {
if ((buttons & static_cast<u64>(tas_button)) != 0) {
returns += fmt::format("{};", text_button);
}
@@ -267,6 +268,10 @@ std::string Tas::WriteCommandAxis(TasAnalog analog) const {
return fmt::format("{};{}", analog.x * 32767, analog.y * 32767);
}
+void Tas::SetTasAxis(const PadIdentifier& identifier, TasAxis axis, f32 value) {
+ SetAxis(identifier, static_cast<int>(axis), value);
+}
+
void Tas::StartStop() {
if (!Settings::values.tas_enable) {
return;
diff --git a/src/input_common/drivers/tas_input.h b/src/input_common/drivers/tas_input.h
index c95a130fc..4b4e6c417 100644
--- a/src/input_common/drivers/tas_input.h
+++ b/src/input_common/drivers/tas_input.h
@@ -5,11 +5,11 @@
#pragma once
#include <array>
+#include <string>
+#include <vector>
#include "common/common_types.h"
-#include "common/settings_input.h"
#include "input_common/input_engine.h"
-#include "input_common/main.h"
/*
To play back TAS scripts on Yuzu, select the folder with scripts in the configuration menu below
@@ -81,46 +81,46 @@ enum class TasState {
Stopped,
};
-class Tas final : public InputCommon::InputEngine {
+class Tas final : public InputEngine {
public:
- explicit Tas(const std::string& input_engine_);
- ~Tas();
+ explicit Tas(std::string input_engine_);
+ ~Tas() override;
/**
* Changes the input status that will be stored in each frame
- * @param buttons: bitfield with the status of the buttons
- * @param left_axis: value of the left axis
- * @param right_axis: value of the right axis
+ * @param buttons Bitfield with the status of the buttons
+ * @param left_axis Value of the left axis
+ * @param right_axis Value of the right axis
*/
void RecordInput(u64 buttons, TasAnalog left_axis, TasAnalog right_axis);
// Main loop that records or executes input
void UpdateThread();
- // Sets the flag to start or stop the TAS command excecution and swaps controllers profiles
+ // Sets the flag to start or stop the TAS command execution and swaps controllers profiles
void StartStop();
- // Stop the TAS and reverts any controller profile
+ // Stop the TAS and reverts any controller profile
void Stop();
- // Sets the flag to reload the file and start from the begining in the next update
+ // Sets the flag to reload the file and start from the beginning in the next update
void Reset();
/**
* Sets the flag to enable or disable recording of inputs
- * @return Returns true if the current recording status is enabled
+ * @returns true if the current recording status is enabled
*/
bool Record();
/**
* Saves contents of record_commands on a file
- * @param overwrite_file: Indicates if player 1 should be overwritten
+ * @param overwrite_file Indicates if player 1 should be overwritten
*/
void SaveRecording(bool overwrite_file);
/**
* Returns the current status values of TAS playback/recording
- * @return Tuple of
+ * @returns A Tuple of
* TasState indicating the current state out of Running ;
* Current playback progress ;
* Total length of script file currently loaded or being recorded
@@ -128,6 +128,8 @@ public:
std::tuple<TasState, size_t, size_t> GetStatus() const;
private:
+ enum class TasAxis : u8;
+
struct TASCommand {
u64 buttons{};
TasAnalog l_axis{};
@@ -137,29 +139,31 @@ private:
/// Loads TAS files from all players
void LoadTasFiles();
- /** Loads TAS file from the specified player
- * @param player_index: player number to save the script
- * @param file_index: script number of the file
+ /**
+ * Loads TAS file from the specified player
+ * @param player_index Player number to save the script
+ * @param file_index Script number of the file
*/
void LoadTasFile(size_t player_index, size_t file_index);
- /** Writes a TAS file from the recorded commands
- * @param file_name: name of the file to be written
+ /**
+ * Writes a TAS file from the recorded commands
+ * @param file_name Name of the file to be written
*/
- void WriteTasFile(std::u8string file_name);
+ void WriteTasFile(std::u8string_view file_name);
/**
* Parses a string containing the axis values. X and Y have a range from -32767 to 32767
- * @param line: string containing axis values with the following format "x;y"
- * @return Returns a TAS analog object with axis values with range from -1.0 to 1.0
+ * @param line String containing axis values with the following format "x;y"
+ * @returns A TAS analog object with axis values with range from -1.0 to 1.0
*/
TasAnalog ReadCommandAxis(const std::string& line) const;
/**
* Parses a string containing the button values. Each button is represented by it's text format
* specified in text_to_tas_button array
- * @param line: string containing button name with the following format "a;b;c;d..."
- * @return Returns a u64 with each bit representing the status of a button
+ * @param line string containing button name with the following format "a;b;c;d..."
+ * @returns A u64 with each bit representing the status of a button
*/
u64 ReadCommandButtons(const std::string& line) const;
@@ -170,17 +174,20 @@ private:
/**
* Converts an u64 containing the button status into the text equivalent
- * @param buttons: bitfield with the status of the buttons
- * @return Returns a string with the name of the buttons to be written to the file
+ * @param buttons Bitfield with the status of the buttons
+ * @returns A string with the name of the buttons to be written to the file
*/
std::string WriteCommandButtons(u64 buttons) const;
/**
* Converts an TAS analog object containing the axis status into the text equivalent
- * @param data: value of the axis
- * @return A string with the value of the axis to be written to the file
+ * @param analog Value of the axis
+ * @returns A string with the value of the axis to be written to the file
*/
- std::string WriteCommandAxis(TasAnalog data) const;
+ std::string WriteCommandAxis(TasAnalog analog) const;
+
+ /// Sets an axis for a particular pad to the given value.
+ void SetTasAxis(const PadIdentifier& identifier, TasAxis axis, f32 value);
size_t script_length{0};
bool is_recording{false};
diff --git a/src/input_common/drivers/touch_screen.cpp b/src/input_common/drivers/touch_screen.cpp
index 45b3086f6..880781825 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(std::string input_engine_) : InputEngine(std::move(input_engine_)) {
PreSetController(identifier);
}
diff --git a/src/input_common/drivers/touch_screen.h b/src/input_common/drivers/touch_screen.h
index 25c11e8bf..bf395c40b 100644
--- a/src/input_common/drivers/touch_screen.h
+++ b/src/input_common/drivers/touch_screen.h
@@ -12,9 +12,9 @@ namespace InputCommon {
* A button device factory representing a keyboard. It receives keyboard events and forward them
* to all button devices it created.
*/
-class TouchScreen final : public InputCommon::InputEngine {
+class TouchScreen final : public InputEngine {
public:
- explicit TouchScreen(const std::string& input_engine_);
+ explicit TouchScreen(std::string input_engine_);
/**
* Signals that mouse has moved.
diff --git a/src/input_common/drivers/udp_client.cpp b/src/input_common/drivers/udp_client.cpp
index fdee0f2d5..4ab991a7d 100644
--- a/src/input_common/drivers/udp_client.cpp
+++ b/src/input_common/drivers/udp_client.cpp
@@ -136,7 +136,7 @@ static void SocketLoop(Socket* socket) {
socket->Loop();
}
-UDPClient::UDPClient(const std::string& input_engine_) : InputEngine(input_engine_) {
+UDPClient::UDPClient(std::string input_engine_) : InputEngine(std::move(input_engine_)) {
LOG_INFO(Input, "Udp Initialization started");
ReloadSockets();
}
diff --git a/src/input_common/drivers/udp_client.h b/src/input_common/drivers/udp_client.h
index 5d483f26b..1adc947c4 100644
--- a/src/input_common/drivers/udp_client.h
+++ b/src/input_common/drivers/udp_client.h
@@ -49,10 +49,10 @@ struct DeviceStatus {
* A button device factory representing a keyboard. It receives keyboard events and forward them
* to all button devices it created.
*/
-class UDPClient final : public InputCommon::InputEngine {
+class UDPClient final : public InputEngine {
public:
- explicit UDPClient(const std::string& input_engine_);
- ~UDPClient();
+ explicit UDPClient(std::string input_engine_);
+ ~UDPClient() override;
void ReloadSockets();