diff --git a/src/core/hid/emulated_console.cpp b/src/core/hid/emulated_console.cpp index b6c8cc58d9..30c2e9d170 100644 --- a/src/core/hid/emulated_console.cpp +++ b/src/core/hid/emulated_console.cpp @@ -37,7 +37,7 @@ void EmulatedConsole::SetTouchParams() { touchscreen_param.Set("axis_x", i * 2); touchscreen_param.Set("axis_y", (i * 2) + 1); touchscreen_param.Set("button", i); - touch_params[index++] = touchscreen_param; + touch_params[index++] = std::move(touchscreen_param); } const auto button_index = @@ -59,7 +59,7 @@ void EmulatedConsole::SetTouchParams() { touch_button_params.Set("button", params.Serialize()); touch_button_params.Set("x", x); touch_button_params.Set("y", y); - touch_params[index] = touch_button_params; + touch_params[index] = std::move(touch_button_params); index++; } } @@ -131,7 +131,7 @@ Common::ParamPackage EmulatedConsole::GetMotionParam() const { } void EmulatedConsole::SetMotionParam(Common::ParamPackage param) { - motion_params = param; + motion_params = std::move(param); ReloadInput(); } @@ -199,7 +199,7 @@ void EmulatedConsole::SetTouch(const Common::Input::CallbackStatus& callback, st if (is_new_input) { touch_value.pressed.value = true; - touch_value.id = static_cast(index); + touch_value.id = static_cast(index); } touch_value.x = touch_input.x; @@ -284,7 +284,7 @@ void EmulatedConsole::TriggerOnChange(ConsoleTriggerType type) { int EmulatedConsole::SetCallback(ConsoleUpdateCallback update_callback) { std::scoped_lock lock{callback_mutex}; - callback_list.insert_or_assign(last_callback_key, update_callback); + callback_list.insert_or_assign(last_callback_key, std::move(update_callback)); return last_callback_key++; } diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index 74c8777285..67969e938a 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp @@ -424,15 +424,14 @@ void EmulatedController::RestoreConfig() { ReloadFromSettings(); } -std::vector EmulatedController::GetMappedDevices( - EmulatedDeviceIndex device_index) const { +std::vector EmulatedController::GetMappedDevices() const { std::vector devices; for (const auto& param : button_params) { if (!param.Has("engine")) { continue; } const auto devices_it = std::find_if( - devices.begin(), devices.end(), [param](const Common::ParamPackage param_) { + devices.begin(), devices.end(), [¶m](const Common::ParamPackage& param_) { return param.Get("engine", "") == param_.Get("engine", "") && param.Get("guid", "") == param_.Get("guid", "") && param.Get("port", 0) == param_.Get("port", 0) && @@ -441,12 +440,12 @@ std::vector EmulatedController::GetMappedDevices( if (devices_it != devices.end()) { continue; } - Common::ParamPackage device{}; + + auto& device = devices.emplace_back(); device.Set("engine", param.Get("engine", "")); device.Set("guid", param.Get("guid", "")); device.Set("port", param.Get("port", 0)); device.Set("pad", param.Get("pad", 0)); - devices.push_back(device); } for (const auto& param : stick_params) { @@ -457,7 +456,7 @@ std::vector EmulatedController::GetMappedDevices( continue; } const auto devices_it = std::find_if( - devices.begin(), devices.end(), [param](const Common::ParamPackage param_) { + devices.begin(), devices.end(), [¶m](const Common::ParamPackage& param_) { return param.Get("engine", "") == param_.Get("engine", "") && param.Get("guid", "") == param_.Get("guid", "") && param.Get("port", 0) == param_.Get("port", 0) && @@ -466,12 +465,12 @@ std::vector EmulatedController::GetMappedDevices( if (devices_it != devices.end()) { continue; } - Common::ParamPackage device{}; + + auto& device = devices.emplace_back(); device.Set("engine", param.Get("engine", "")); device.Set("guid", param.Get("guid", "")); device.Set("port", param.Get("port", 0)); device.Set("pad", param.Get("pad", 0)); - devices.push_back(device); } return devices; } diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h index 3f83108d38..fa7a342787 100644 --- a/src/core/hid/emulated_controller.h +++ b/src/core/hid/emulated_controller.h @@ -244,7 +244,7 @@ public: void RestoreConfig(); /// Returns a vector of mapped devices from the mapped button and stick parameters - std::vector GetMappedDevices(EmulatedDeviceIndex device_index) const; + std::vector GetMappedDevices() const; // Returns the current mapped button device Common::ParamPackage GetButtonParam(std::size_t index) const; diff --git a/src/yuzu/configuration/configure_input_player.cpp b/src/yuzu/configuration/configure_input_player.cpp index ed21f4b92f..b1575b0d3e 100644 --- a/src/yuzu/configuration/configure_input_player.cpp +++ b/src/yuzu/configuration/configure_input_player.cpp @@ -855,8 +855,7 @@ void ConfigureInputPlayer::UpdateInputDeviceCombobox() { return; } - const auto devices = - emulated_controller->GetMappedDevices(Core::HID::EmulatedDeviceIndex::AllDevices); + const auto devices = emulated_controller->GetMappedDevices(); UpdateInputDevices(); if (devices.empty()) {