From 95dec132030e72b74da6bc46966e4fe5e4e239c0 Mon Sep 17 00:00:00 2001 From: Martino Fontana Date: Mon, 6 Apr 2026 11:37:26 +0200 Subject: [PATCH] Improve usage of std::move and const references parameters Accomplished using `run-clang-tidy` with `performance-move-const-arg,performance-unnecessary-value-param,modernize-pass-by-value`. Changed arguments to const references, removed them where inappropriate (e.g. sink parameters). Same with std::move. Manually reviewed each change to make sure that it makes sense, and do something more appropriate if possible. --- Source/Core/AudioCommon/CubebUtils.cpp | 2 +- Source/Core/Common/Assembler/GekkoIRGen.cpp | 4 +-- Source/Core/Common/Crypto/ec.cpp | 2 +- Source/Core/Common/FatFsUtil.cpp | 2 +- Source/Core/Common/FileSearch.cpp | 4 +-- Source/Core/Common/FileUtil.cpp | 2 +- Source/Core/Common/FileUtil.h | 2 +- Source/Core/Common/Profiler.cpp | 6 ++-- Source/Core/Common/Profiler.h | 2 +- Source/Core/Common/TraversalClient.cpp | 5 +-- Source/Core/Common/TraversalClient.h | 3 +- Source/Core/Core/AchievementManager.cpp | 2 +- Source/Core/Core/AchievementManager.h | 4 +-- Source/Core/Core/Boot/Boot.cpp | 4 +-- Source/Core/Core/Boot/Boot.h | 2 +- .../Core/ConfigLoaders/GameConfigLoader.cpp | 6 ++-- .../ConfigLoaders/NetPlayConfigLoader.cpp | 5 +-- Source/Core/Core/CoreTiming.cpp | 2 +- Source/Core/Core/Debugger/RSO.cpp | 10 +++--- Source/Core/Core/DolphinAnalytics.cpp | 4 +-- Source/Core/Core/DolphinAnalytics.h | 2 +- Source/Core/Core/FifoPlayer/FifoRecorder.cpp | 3 +- Source/Core/Core/GeckoCodeConfig.cpp | 4 +-- Source/Core/Core/GeckoCodeConfig.h | 2 +- .../Core/HW/EXI/BBA/TAPServerConnection.cpp | 6 ++-- .../Core/HW/EXI/BBA/TAPServerConnection.h | 3 +- Source/Core/Core/HW/EXI/EXI_DeviceDummy.cpp | 5 +-- Source/Core/Core/HW/EXI/EXI_DeviceDummy.h | 2 +- .../Core/Core/HW/EXI/EXI_DeviceMemoryCard.cpp | 2 +- .../Core/Core/HW/EXI/EXI_DeviceMemoryCard.h | 2 +- .../Core/HW/GCMemcard/GCMemcardDirectory.cpp | 7 ++-- .../Core/HW/GCMemcard/GCMemcardDirectory.h | 2 +- .../Core/Core/HW/GCMemcard/GCMemcardRaw.cpp | 6 ++-- Source/Core/Core/HW/GCMemcard/GCMemcardRaw.h | 2 +- Source/Core/Core/HW/MMIO.cpp | 9 +++--- Source/Core/Core/HW/WiiSave.cpp | 4 +-- Source/Core/Core/HW/WiiSave.h | 2 +- Source/Core/Core/IOS/Device.cpp | 5 +-- Source/Core/Core/IOS/Device.h | 2 +- Source/Core/Core/IOS/FS/HostBackend/FS.cpp | 10 +++--- Source/Core/Core/IOS/FS/HostBackend/FS.h | 6 ++-- Source/Core/Core/IOS/Network/IP/Top.cpp | 2 +- .../Core/Core/IOS/Network/KD/NetKDRequest.cpp | 2 +- Source/Core/Core/IOS/Network/Socket.cpp | 4 +-- Source/Core/Core/IOS/Network/Socket.h | 4 +-- .../Core/Core/IOS/USB/Emulated/Microphone.cpp | 8 ++--- .../Core/Core/IOS/USB/Emulated/Microphone.h | 2 +- Source/Core/Core/IOS/USB/Host.cpp | 7 ++-- Source/Core/Core/IOS/USB/Host.h | 4 +-- Source/Core/Core/IOS/USB/LibusbDevice.cpp | 4 +-- Source/Core/Core/IOS/USB/LibusbDevice.h | 3 +- Source/Core/Core/IOS/USB/USBV5.cpp | 2 +- Source/Core/Core/IOS/USB/USBV5.h | 2 +- Source/Core/Core/LibusbUtils.cpp | 6 ++-- Source/Core/Core/LibusbUtils.h | 2 +- Source/Core/Core/NetPlayClient.cpp | 8 +++-- Source/Core/Core/NetPlayClient.h | 4 +-- Source/Core/Core/PatchEngine.cpp | 2 +- .../PowerPC/Jit64/RegCache/JitRegCache.cpp | 2 +- .../Core/Core/PowerPC/JitCommon/JitCache.cpp | 2 +- Source/Core/Core/PowerPC/JitCommon/JitCache.h | 3 +- Source/Core/Core/PowerPC/JitInterface.cpp | 4 +-- Source/Core/Core/PowerPC/JitInterface.h | 3 +- Source/Core/Core/PowerPC/PPCSymbolDB.cpp | 18 +++++------ Source/Core/Core/WiiUtils.cpp | 6 ++-- Source/Core/DiscIO/CompressedBlob.cpp | 4 +-- Source/Core/DiscIO/CompressedBlob.h | 2 +- Source/Core/DiscIO/DirectoryBlob.cpp | 4 +-- Source/Core/DiscIO/DirectoryBlob.h | 2 +- .../Achievements/AchievementsWindow.cpp | 4 +-- .../Achievements/AchievementsWindow.h | 2 +- .../DolphinQt/Config/CheatWarningWidget.cpp | 7 ++-- .../DolphinQt/Config/CheatWarningWidget.h | 2 +- .../Config/ConfigControls/ConfigChoice.cpp | 2 +- .../Config/ConfigControls/ConfigChoice.h | 2 +- Source/Core/DolphinQt/Config/VerifyWidget.cpp | 5 +-- Source/Core/DolphinQt/Config/VerifyWidget.h | 4 +-- .../DolphinQt/Debugger/AssemblyEditor.cpp | 5 +-- .../Core/DolphinQt/Debugger/AssemblyEditor.h | 2 +- .../Debugger/GekkoSyntaxHighlight.cpp | 4 ++- .../DolphinQt/Debugger/RegisterWidget.cpp | 5 +-- .../Core/DolphinQt/Debugger/RegisterWidget.h | 2 +- .../Core/DolphinQt/Debugger/WatchWidget.cpp | 2 +- Source/Core/DolphinQt/Debugger/WatchWidget.h | 2 +- Source/Core/DolphinQt/GCMemcardManager.cpp | 2 +- Source/Core/DolphinQt/GCMemcardManager.h | 2 +- Source/Core/DolphinQt/GameList/GameList.h | 2 +- .../Core/DolphinQt/GameList/GameTracker.cpp | 4 +-- Source/Core/DolphinQt/Host.cpp | 2 +- .../InfinityBase/InfinityBaseWindow.cpp | 3 +- .../InfinityBase/InfinityBaseWindow.h | 3 +- Source/Core/DolphinQt/MainWindow.cpp | 5 +-- Source/Core/DolphinQt/MenuBar.cpp | 2 +- Source/Core/DolphinQt/MenuBar.h | 4 +-- .../Core/DolphinQt/NetPlay/NetPlayDialog.cpp | 3 +- .../DolphinQt/QtUtils/ModalMessageBox.cpp | 2 +- Source/Core/DolphinQt/Settings.cpp | 4 +-- Source/Core/DolphinQt/Settings.h | 4 +-- .../Core/DolphinQt/Settings/AdvancedPane.cpp | 11 ++++--- Source/Core/DolphinQt/TAS/TASInputWindow.cpp | 6 ++-- Source/Core/DolphinQt/TAS/TASInputWindow.h | 8 ++--- .../ControlReference/ExpressionParser.cpp | 2 +- .../ControllerEmu/ControlGroup/Buttons.cpp | 5 +-- .../ControllerEmu/ControlGroup/Buttons.h | 2 +- .../ControlGroup/ModifySettingsButton.cpp | 3 +- .../ControlGroup/ModifySettingsButton.h | 2 +- .../ControllerInterface.cpp | 2 +- .../ControllerInterface/ControllerInterface.h | 2 +- .../ControllerInterface/CoreDevice.cpp | 4 ++- .../DualShockUDPClient/DualShockUDPClient.cpp | 2 +- .../ControllerInterface/Pipes/Pipes.cpp | 3 +- .../ControllerInterface/Pipes/Pipes.h | 2 +- .../Wiimote/WiimoteController.cpp | 2 +- Source/Core/InputCommon/GCAdapter.cpp | 4 ++- Source/Core/InputCommon/InputConfig.cpp | 10 +++--- Source/Core/InputCommon/InputConfig.h | 4 +-- Source/Core/UICommon/CommandLineParse.cpp | 5 ++- Source/Core/VideoBackends/OGL/OGLPipeline.cpp | 12 ++++--- Source/Core/VideoBackends/OGL/OGLPipeline.h | 5 ++- .../Core/VideoCommon/Assets/CustomAsset.cpp | 4 +-- Source/Core/VideoCommon/Assets/CustomAsset.h | 4 +-- .../Core/VideoCommon/Assets/ShaderAsset.cpp | 4 +-- .../Runtime/CustomPipeline.cpp | 3 +- .../Runtime/CustomPipeline.h | 2 +- .../Runtime/CustomShaderCache.cpp | 32 +++++++++++-------- .../Runtime/GraphicsModManager.cpp | 25 +++++++-------- Source/Core/VideoCommon/NetPlayGolfUI.cpp | 6 ++-- Source/Core/VideoCommon/NetPlayGolfUI.h | 2 +- Source/Core/VideoCommon/OnScreenDisplay.cpp | 4 +-- .../Core/VideoCommon/PerformanceTracker.cpp | 5 +-- Source/Core/VideoCommon/PerformanceTracker.h | 2 +- .../Resources/MaterialResource.cpp | 6 ++-- .../VideoCommon/Resources/MaterialResource.h | 2 +- .../VideoCommon/Resources/ShaderResource.cpp | 7 ++-- .../VideoCommon/Resources/ShaderResource.h | 3 +- Source/Core/VideoCommon/ShaderCache.cpp | 10 +++--- .../Core/VideoCommon/ShaderCompileUtils.cpp | 5 +-- Source/Core/VideoCommon/ShaderCompileUtils.h | 2 +- Source/Core/VideoCommon/TextureCacheBase.cpp | 2 +- Source/UnitTests/Common/x64EmitterTest.cpp | 2 +- 140 files changed, 318 insertions(+), 277 deletions(-) diff --git a/Source/Core/AudioCommon/CubebUtils.cpp b/Source/Core/AudioCommon/CubebUtils.cpp index 73bfafb7fd..fda93ac4c6 100644 --- a/Source/Core/AudioCommon/CubebUtils.cpp +++ b/Source/Core/AudioCommon/CubebUtils.cpp @@ -211,7 +211,7 @@ bool CoInitSyncWorker::Execute(FunctionType f) if (!m_coinit_success) return false; - m_work_queue.PushBlocking(f); + m_work_queue.PushBlocking(std::move(f)); #else f(); #endif diff --git a/Source/Core/Common/Assembler/GekkoIRGen.cpp b/Source/Core/Common/Assembler/GekkoIRGen.cpp index b32c0fd582..f7f62d3d7f 100644 --- a/Source/Core/Common/Assembler/GekkoIRGen.cpp +++ b/Source/Core/Common/Assembler/GekkoIRGen.cpp @@ -538,7 +538,7 @@ void GekkoIRPlugin::AddSymbolResolve(std::string_view sym, bool absolute) }; m_fixup_stack.emplace( - [this, sym, absolute, source_address, err_on_fail = std::move(err_on_fail)] { + [this, sym, absolute, source_address, err_on_fail = std::move(err_on_fail)] mutable { auto label_it = m_labels.find(sym); if (label_it != m_labels.end()) { @@ -575,7 +575,7 @@ void GekkoIRPlugin::AddNumLabelSymResolve(std::string_view sym, u32 num) // Searching forward only size_t search_start_idx = static_cast(m_numlabs.size()); m_fixup_stack.emplace( - [this, num, source_address, search_start_idx, err_on_fail = std::move(err_on_fail)] { + [this, num, source_address, search_start_idx, err_on_fail = std::move(err_on_fail)] mutable { for (size_t i = search_start_idx; i < m_numlabs.size(); i++) { if (num == m_numlabs[i].first) diff --git a/Source/Core/Common/Crypto/ec.cpp b/Source/Core/Common/Crypto/ec.cpp index c8b85eb387..e3f87d9b9b 100644 --- a/Source/Core/Common/Crypto/ec.cpp +++ b/Source/Core/Common/Crypto/ec.cpp @@ -133,7 +133,7 @@ static Elt operator/(const Elt& dividend, const Elt& divisor) struct Point { Point() = default; - constexpr explicit Point(Elt x, Elt y) : m_data{{std::move(x), std::move(y)}} {} + constexpr explicit Point(Elt x, Elt y) : m_data{{x, y}} {} explicit Point(const u8* data) { std::copy_n(data, sizeof(m_data), Data()); } bool IsZero() const { return X().IsZero() && Y().IsZero(); } diff --git a/Source/Core/Common/FatFsUtil.cpp b/Source/Core/Common/FatFsUtil.cpp index 004d84b688..150b73493c 100644 --- a/Source/Core/Common/FatFsUtil.cpp +++ b/Source/Core/Common/FatFsUtil.cpp @@ -598,7 +598,7 @@ bool SyncSDFolderToSDImage(const std::function& cancelled, bool determin return true; } -static bool Unpack(const std::function& cancelled, const std::string path, +static bool Unpack(const std::function& cancelled, const std::string& path, bool is_directory, const char* name, std::vector& tmp_buffer) { if (cancelled()) diff --git a/Source/Core/Common/FileSearch.cpp b/Source/Core/Common/FileSearch.cpp index ebaa9f37b0..a90b385ad9 100644 --- a/Source/Core/Common/FileSearch.cpp +++ b/Source/Core/Common/FileSearch.cpp @@ -71,13 +71,13 @@ std::vector DoFileSearch(std::span director std::error_code error; if (recursive) { - for (auto it = fs::recursive_directory_iterator(std::move(directory_path), error); + for (auto it = fs::recursive_directory_iterator(directory_path, error); it != fs::recursive_directory_iterator(); it.increment(error)) add_filtered(*it); } else { - for (auto it = fs::directory_iterator(std::move(directory_path), error); + for (auto it = fs::directory_iterator(directory_path, error); it != fs::directory_iterator(); it.increment(error)) add_filtered(*it); } diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index 1dbbb4ac41..9f17a58675 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -425,7 +425,7 @@ static FSTEntry ScanDirectoryTreeAndroidContent(std::string directory, bool recu #endif // Recursive or non-recursive list of files and directories under directory. -FSTEntry ScanDirectoryTree(std::string directory, bool recursive) +FSTEntry ScanDirectoryTree(const std::string& directory, bool recursive) { DEBUG_LOG_FMT(COMMON, "{}: directory {}", __func__, directory); diff --git a/Source/Core/Common/FileUtil.h b/Source/Core/Common/FileUtil.h index cfe6eddffb..d5c8285305 100644 --- a/Source/Core/Common/FileUtil.h +++ b/Source/Core/Common/FileUtil.h @@ -193,7 +193,7 @@ bool CopyRegularFile(std::string_view source_path, std::string_view destination_ bool CreateEmptyFile(const std::string& filename); // Recursive or non-recursive list of files and directories under directory. -FSTEntry ScanDirectoryTree(std::string directory, bool recursive); +FSTEntry ScanDirectoryTree(const std::string& directory, bool recursive); // deletes the given directory and anything under it. Returns true on success. bool DeleteDirRecursively(const std::string& directory); diff --git a/Source/Core/Common/Profiler.cpp b/Source/Core/Common/Profiler.cpp index 3a8eeb2746..cf3c0b4a3c 100644 --- a/Source/Core/Common/Profiler.cpp +++ b/Source/Core/Common/Profiler.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include "Common/Timer.h" @@ -26,8 +27,9 @@ u64 Profiler::s_usecs_frame; std::string Profiler::s_lazy_result; int Profiler::s_lazy_delay = 0; -Profiler::Profiler(const std::string& name) - : m_name(name), m_usecs(0), m_usecs_min(UINT64_MAX), m_usecs_max(0), m_usecs_quad(0), m_calls(0) +Profiler::Profiler(std::string name) + : m_name(std::move(name)), m_usecs(0), m_usecs_min(UINT64_MAX), m_usecs_max(0), m_usecs_quad(0), + m_calls(0) { s_max_length = std::max(s_max_length, u32(m_name.length())); diff --git a/Source/Core/Common/Profiler.h b/Source/Core/Common/Profiler.h index 5110e41571..91d9827564 100644 --- a/Source/Core/Common/Profiler.h +++ b/Source/Core/Common/Profiler.h @@ -14,7 +14,7 @@ namespace Common class Profiler { public: - Profiler(const std::string& name); + Profiler(std::string name); ~Profiler(); static std::string ToString(); diff --git a/Source/Core/Common/TraversalClient.cpp b/Source/Core/Common/TraversalClient.cpp index 44b8390f90..2e0fb8e2ad 100644 --- a/Source/Core/Common/TraversalClient.cpp +++ b/Source/Core/Common/TraversalClient.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" @@ -14,9 +15,9 @@ namespace Common { -TraversalClient::TraversalClient(ENetHost* netHost, const std::string& server, const u16 port, +TraversalClient::TraversalClient(ENetHost* netHost, std::string server, const u16 port, const u16 port_alt) - : m_NetHost(netHost), m_Server(server), m_port(port), m_portAlt(port_alt) + : m_NetHost(netHost), m_Server(std::move(server)), m_port(port), m_portAlt(port_alt) { netHost->intercept = TraversalClient::InterceptCallback; diff --git a/Source/Core/Common/TraversalClient.h b/Source/Core/Common/TraversalClient.h index 759edd653a..d3cd8149c0 100644 --- a/Source/Core/Common/TraversalClient.h +++ b/Source/Core/Common/TraversalClient.h @@ -43,8 +43,7 @@ public: SocketSendError, ResendTimeout, }; - TraversalClient(ENetHost* netHost, const std::string& server, const u16 port, - const u16 port_alt = 0); + TraversalClient(ENetHost* netHost, std::string server, const u16 port, const u16 port_alt = 0); ~TraversalClient(); TraversalHostId GetHostID() const; diff --git a/Source/Core/Core/AchievementManager.cpp b/Source/Core/Core/AchievementManager.cpp index b56eccdde4..88af95f42c 100644 --- a/Source/Core/Core/AchievementManager.cpp +++ b/Source/Core/Core/AchievementManager.cpp @@ -1360,7 +1360,7 @@ u32 AchievementManager::MemoryPeeker(u32 address, u8* buffer, u32 num_bytes, rc_ } void AchievementManager::FetchBadge(AchievementManager::Badge* badge, u32 badge_type, - const AchievementManager::BadgeNameFunction function, + AchievementManager::BadgeNameFunction function, UpdatedItems callback_data) { if (!m_client || !HasAPIToken()) diff --git a/Source/Core/Core/AchievementManager.h b/Source/Core/Core/AchievementManager.h index 6a4ac84cc2..74f26b9ec7 100644 --- a/Source/Core/Core/AchievementManager.h +++ b/Source/Core/Core/AchievementManager.h @@ -243,8 +243,8 @@ private: static void Request(const rc_api_request_t* request, rc_client_server_callback_t callback, void* callback_data, rc_client_t* client); static u32 MemoryPeeker(u32 address, u8* buffer, u32 num_bytes, rc_client_t* client); - void FetchBadge(Badge* badge, u32 badge_type, const BadgeNameFunction function, - const UpdatedItems callback_data); + void FetchBadge(Badge* badge, u32 badge_type, BadgeNameFunction function, + UpdatedItems callback_data); static void EventHandler(const rc_client_event_t* event, rc_client_t* client); #ifdef RC_CLIENT_SUPPORTS_RAINTEGRATION diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp index 888173ed9a..2ddadfec72 100644 --- a/Source/Core/Core/Boot/Boot.cpp +++ b/Source/Core/Core/Boot/Boot.cpp @@ -270,7 +270,7 @@ std::unique_ptr BootParameters::GenerateFromFile(std::vector wad = DiscIO::CreateWAD(std::move(path)); + std::unique_ptr wad = DiscIO::CreateWAD(path); if (wad) return std::make_unique(std::move(*wad), std::move(boot_session_data_)); } @@ -707,7 +707,7 @@ void StateFlags::UpdateChecksum() checksum = std::accumulate(flag_data.cbegin(), flag_data.cend(), 0U); } -void UpdateStateFlags(std::function update_function) +void UpdateStateFlags(const std::function& update_function) { CreateSystemMenuTitleDirs(); const std::string file_path = Common::GetTitleDataPath(Titles::SYSTEM_MENU) + "/" WII_STATE; diff --git a/Source/Core/Core/Boot/Boot.h b/Source/Core/Core/Boot/Boot.h index 087245ee0f..9cee293d58 100644 --- a/Source/Core/Core/Boot/Boot.h +++ b/Source/Core/Core/Boot/Boot.h @@ -222,7 +222,7 @@ struct StateFlags // Reads the state file from the NAND, then calls the passed update function to update the struct, // and finally writes the updated state file to the NAND. -void UpdateStateFlags(std::function update_function); +void UpdateStateFlags(const std::function& update_function); /// Create title directories for the system menu (if needed). /// diff --git a/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp b/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp index d086d4d9db..be3da4db9d 100644 --- a/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp +++ b/Source/Core/Core/ConfigLoaders/GameConfigLoader.cpp @@ -176,9 +176,9 @@ static SectionKey GetINILocationFromConfig(const Location& location) class INIGameConfigLayerLoader final : public Config::ConfigLayerLoader { public: - INIGameConfigLayerLoader(const std::string& id, u16 revision, bool global) + INIGameConfigLayerLoader(std::string id, u16 revision, bool global) : ConfigLayerLoader(global ? Config::LayerType::GlobalGame : Config::LayerType::LocalGame), - m_id(id), m_revision(revision) + m_id(std::move(id)), m_revision(revision) { } @@ -229,7 +229,7 @@ private: std::string path = "Profiles/" + std::get<1>(use_data) + "/"; const auto control_section = [&](std::string key) { - return Config::Location{std::get<2>(use_data), "Controls", key}; + return Config::Location{std::get<2>(use_data), "Controls", std::move(key)}; }; for (const char num : nums) diff --git a/Source/Core/Core/ConfigLoaders/NetPlayConfigLoader.cpp b/Source/Core/Core/ConfigLoaders/NetPlayConfigLoader.cpp index 8ead83f8cc..7fb9eaa226 100644 --- a/Source/Core/Core/ConfigLoaders/NetPlayConfigLoader.cpp +++ b/Source/Core/Core/ConfigLoaders/NetPlayConfigLoader.cpp @@ -4,6 +4,7 @@ #include "Core/ConfigLoaders/NetPlayConfigLoader.h" #include +#include #include @@ -23,8 +24,8 @@ namespace ConfigLoaders class NetPlayConfigLayerLoader final : public Config::ConfigLayerLoader { public: - explicit NetPlayConfigLayerLoader(const NetPlay::NetSettings& settings) - : ConfigLayerLoader(Config::LayerType::Netplay), m_settings(settings) + explicit NetPlayConfigLayerLoader(NetPlay::NetSettings settings) + : ConfigLayerLoader(Config::LayerType::Netplay), m_settings(std::move(settings)) { } diff --git a/Source/Core/Core/CoreTiming.cpp b/Source/Core/Core/CoreTiming.cpp index 18e86f11e0..1fa39d7448 100644 --- a/Source/Core/Core/CoreTiming.cpp +++ b/Source/Core/Core/CoreTiming.cpp @@ -363,7 +363,7 @@ void CoreTimingManager::Advance() while (!m_event_queue.empty() && m_event_queue.front().time <= m_globals.global_timer) { - Event evt = std::move(m_event_queue.front()); + Event evt = m_event_queue.front(); std::ranges::pop_heap(m_event_queue, std::ranges::greater{}); m_event_queue.pop_back(); evt.type->callback(m_system, evt.userdata, m_globals.global_timer - evt.time); diff --git a/Source/Core/Core/Debugger/RSO.cpp b/Source/Core/Core/Debugger/RSO.cpp index 6dfb8baa0b..1017410781 100644 --- a/Source/Core/Core/Debugger/RSO.cpp +++ b/Source/Core/Core/Debugger/RSO.cpp @@ -183,7 +183,7 @@ void RSOSectionsView::Load(const Core::CPUThreadGuard& guard, u32 address, std:: RSOSection section; section.offset = PowerPC::MMU::HostRead(guard, address); section.size = PowerPC::MMU::HostRead(guard, address + 4); - m_sections.emplace_back(std::move(section)); + m_sections.emplace_back(section); address += sizeof(RSOSection); } } @@ -212,7 +212,7 @@ void RSOImportsView::Load(const Core::CPUThreadGuard& guard, u32 address, std::s rso_import.name_offset = PowerPC::MMU::HostRead(guard, address); rso_import.code_offset = PowerPC::MMU::HostRead(guard, address + 4); rso_import.entry_offset = PowerPC::MMU::HostRead(guard, address + 8); - m_imports.emplace_back(std::move(rso_import)); + m_imports.emplace_back(rso_import); address += sizeof(RSOImport); } } @@ -242,7 +242,7 @@ void RSOExportsView::Load(const Core::CPUThreadGuard& guard, u32 address, std::s rso_export.code_offset = PowerPC::MMU::HostRead(guard, address + 4); rso_export.section_index = PowerPC::MMU::HostRead(guard, address + 8); rso_export.hash = PowerPC::MMU::HostRead(guard, address + 12); - m_exports.emplace_back(std::move(rso_export)); + m_exports.emplace_back(rso_export); address += sizeof(RSOExport); } } @@ -271,7 +271,7 @@ void RSOInternalsView::Load(const Core::CPUThreadGuard& guard, u32 address, std: entry.r_offset = PowerPC::MMU::HostRead(guard, address); entry.r_info = PowerPC::MMU::HostRead(guard, address + 4); entry.r_addend = PowerPC::MMU::HostRead(guard, address + 8); - m_entries.emplace_back(std::move(entry)); + m_entries.emplace_back(entry); address += sizeof(RSOInternalsEntry); } } @@ -300,7 +300,7 @@ void RSOExternalsView::Load(const Core::CPUThreadGuard& guard, u32 address, std: entry.r_offset = PowerPC::MMU::HostRead(guard, address); entry.r_info = PowerPC::MMU::HostRead(guard, address + 4); entry.r_addend = PowerPC::MMU::HostRead(guard, address + 8); - m_entries.emplace_back(std::move(entry)); + m_entries.emplace_back(entry); address += sizeof(RSOExternalsEntry); } } diff --git a/Source/Core/Core/DolphinAnalytics.cpp b/Source/Core/Core/DolphinAnalytics.cpp index f4f7c01c41..936cd7191b 100644 --- a/Source/Core/Core/DolphinAnalytics.cpp +++ b/Source/Core/Core/DolphinAnalytics.cpp @@ -207,7 +207,7 @@ void DolphinAnalytics::ReportGameQuirk(GameQuirk quirk) Send(builder); } -void DolphinAnalytics::ReportPerformanceInfo(PerformanceSample&& sample) +void DolphinAnalytics::ReportPerformanceInfo(PerformanceSample sample) { if (ShouldStartPerformanceSampling()) { @@ -216,7 +216,7 @@ void DolphinAnalytics::ReportPerformanceInfo(PerformanceSample&& sample) if (m_sampling_performance_info) { - m_performance_samples.emplace_back(std::move(sample)); + m_performance_samples.emplace_back(sample); } if (m_performance_samples.size() >= NUM_PERFORMANCE_SAMPLES_PER_REPORT) diff --git a/Source/Core/Core/DolphinAnalytics.h b/Source/Core/Core/DolphinAnalytics.h index 595736e821..252207e2d1 100644 --- a/Source/Core/Core/DolphinAnalytics.h +++ b/Source/Core/Core/DolphinAnalytics.h @@ -148,7 +148,7 @@ public: // calling it does not guarantee when a report will actually be sent. // // This method is NOT thread-safe. - void ReportPerformanceInfo(PerformanceSample&& sample); + void ReportPerformanceInfo(PerformanceSample sample); // Forward Send method calls to the reporter. template diff --git a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp index 571766eb11..c589b97975 100644 --- a/Source/Core/Core/FifoPlayer/FifoRecorder.cpp +++ b/Source/Core/Core/FifoPlayer/FifoRecorder.cpp @@ -5,6 +5,7 @@ #include #include +#include #include "Common/Logging/Log.h" #include "Common/MsgHandler.h" @@ -246,7 +247,7 @@ void FifoRecorder::StartRecording(s32 numFrames, CallbackFunc finishedCb) } m_RequestedRecordingEnd = false; - m_FinishedCb = finishedCb; + m_FinishedCb = std::move(finishedCb); m_end_of_frame_event = m_system.GetVideoEvents().after_frame_event.Register([this](const Core::System& system) { diff --git a/Source/Core/Core/GeckoCodeConfig.cpp b/Source/Core/Core/GeckoCodeConfig.cpp index edc94ff10d..83243c80b2 100644 --- a/Source/Core/Core/GeckoCodeConfig.cpp +++ b/Source/Core/Core/GeckoCodeConfig.cpp @@ -15,10 +15,10 @@ namespace Gecko { -std::expected, int> DownloadCodes(std::string gametdb_id) +std::expected, int> DownloadCodes(std::string_view gametdb_id) { // codes.rc24.xyz is a mirror of the now defunct geckocodes.org. - std::string endpoint{"https://codes.rc24.xyz/txt.php?txt=" + gametdb_id}; + std::string endpoint{"https://codes.rc24.xyz/txt.php?txt=" + std::string(gametdb_id)}; Common::HttpRequest http; // The server always redirects once to the same location. diff --git a/Source/Core/Core/GeckoCodeConfig.h b/Source/Core/Core/GeckoCodeConfig.h index 860eb4dbee..c312700c97 100644 --- a/Source/Core/Core/GeckoCodeConfig.h +++ b/Source/Core/Core/GeckoCodeConfig.h @@ -19,7 +19,7 @@ class IniFile; namespace Gecko { std::vector LoadCodes(const Common::IniFile& globalIni, const Common::IniFile& localIni); -std::expected, int> DownloadCodes(std::string gametdb_id); +std::expected, int> DownloadCodes(std::string_view gametdb_id); void SaveCodes(Common::IniFile& inifile, std::span gcodes); std::optional DeserializeLine(const std::string& line); diff --git a/Source/Core/Core/HW/EXI/BBA/TAPServerConnection.cpp b/Source/Core/Core/HW/EXI/BBA/TAPServerConnection.cpp index 570221c72b..d70e3eadb2 100644 --- a/Source/Core/Core/HW/EXI/BBA/TAPServerConnection.cpp +++ b/Source/Core/Core/HW/EXI/BBA/TAPServerConnection.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #ifdef _WIN32 #include @@ -33,10 +34,11 @@ using ws_ssize_t = ssize_t; using Common::SEND_FLAGS; -TAPServerConnection::TAPServerConnection(const std::string& destination, +TAPServerConnection::TAPServerConnection(std::string destination, std::function recv_cb, std::size_t max_frame_size) - : m_destination(destination), m_recv_cb(recv_cb), m_max_frame_size(max_frame_size) + : m_destination(std::move(destination)), m_recv_cb(std::move(recv_cb)), + m_max_frame_size(max_frame_size) { } diff --git a/Source/Core/Core/HW/EXI/BBA/TAPServerConnection.h b/Source/Core/Core/HW/EXI/BBA/TAPServerConnection.h index 20b32dd985..f7010142cb 100644 --- a/Source/Core/Core/HW/EXI/BBA/TAPServerConnection.h +++ b/Source/Core/Core/HW/EXI/BBA/TAPServerConnection.h @@ -19,8 +19,7 @@ class TAPServerConnection public: using RecvCallback = std::function; - TAPServerConnection(const std::string& destination, RecvCallback recv_cb, - std::size_t max_frame_size); + TAPServerConnection(std::string destination, RecvCallback recv_cb, std::size_t max_frame_size); bool Activate(); void Deactivate(); diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceDummy.cpp b/Source/Core/Core/HW/EXI/EXI_DeviceDummy.cpp index 936b35d0e2..01916de245 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceDummy.cpp +++ b/Source/Core/Core/HW/EXI/EXI_DeviceDummy.cpp @@ -4,14 +4,15 @@ #include "Core/HW/EXI/EXI_DeviceDummy.h" #include +#include #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" namespace ExpansionInterface { -CEXIDummy::CEXIDummy(Core::System& system, const std::string& name) - : IEXIDevice(system), m_name{name} +CEXIDummy::CEXIDummy(Core::System& system, std::string name) + : IEXIDevice(system), m_name{std::move(name)} { } diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceDummy.h b/Source/Core/Core/HW/EXI/EXI_DeviceDummy.h index e46ca13234..702d69d5e6 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceDummy.h +++ b/Source/Core/Core/HW/EXI/EXI_DeviceDummy.h @@ -16,7 +16,7 @@ namespace ExpansionInterface class CEXIDummy final : public IEXIDevice { public: - CEXIDummy(Core::System& system, const std::string& name); + CEXIDummy(Core::System& system, std::string name); void ImmWrite(u32 data, u32 size) override; u32 ImmRead(u32 size) override; diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceMemoryCard.cpp b/Source/Core/Core/HW/EXI/EXI_DeviceMemoryCard.cpp index 4870e503ba..73ff1d616c 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceMemoryCard.cpp +++ b/Source/Core/Core/HW/EXI/EXI_DeviceMemoryCard.cpp @@ -55,7 +55,7 @@ static Common::EnumMap s_card_short_names{'A', 'B'}; // Takes care of the nasty recovery of the 'this' pointer from card_slot, // stored in the userdata parameter of the CoreTiming event. void CEXIMemoryCard::EventCompleteFindInstance(Core::System& system, u64 userdata, - std::function callback) + const std::function& callback) { Slot card_slot = static_cast(userdata); IEXIDevice* self = system.GetExpansionInterface().GetDevice(card_slot); diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceMemoryCard.h b/Source/Core/Core/HW/EXI/EXI_DeviceMemoryCard.h index 2264abb076..db9c013671 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceMemoryCard.h +++ b/Source/Core/Core/HW/EXI/EXI_DeviceMemoryCard.h @@ -68,7 +68,7 @@ private: void SetupGciFolder(const Memcard::HeaderData& header_data); void SetupRawMemcard(u16 size_mb); static void EventCompleteFindInstance(Core::System& system, u64 userdata, - std::function callback); + const std::function& callback); // Scheduled when a command that required delayed end signaling is done. static void CmdDoneCallback(Core::System& system, u64 userdata, s64 cyclesLate); diff --git a/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.cpp b/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.cpp index 9d3639ed04..791b471be4 100644 --- a/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.cpp +++ b/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -176,11 +177,11 @@ std::vector GCMemcardDirectory::GetFileNamesForGameID(const std::st return filenames; } -GCMemcardDirectory::GCMemcardDirectory(const std::string& directory, ExpansionInterface::Slot slot, +GCMemcardDirectory::GCMemcardDirectory(std::string directory, ExpansionInterface::Slot slot, const Memcard::HeaderData& header_data, u32 game_id) : MemoryCardBase(slot, header_data.m_size_mb), m_game_id(game_id), m_last_block(-1), - m_hdr(header_data), m_bat1(header_data.m_size_mb), m_saves(0), m_save_directory(directory), - m_exiting(false) + m_hdr(header_data), m_bat1(header_data.m_size_mb), m_saves(0), + m_save_directory(std::move(directory)), m_exiting(false) { // Use existing header data if available { diff --git a/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.h b/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.h index 7e53259a27..27e45b317d 100644 --- a/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.h +++ b/Source/Core/Core/HW/GCMemcard/GCMemcardDirectory.h @@ -22,7 +22,7 @@ void MigrateFromMemcardFile(const std::string& directory_name, ExpansionInterfac class GCMemcardDirectory : public MemoryCardBase { public: - GCMemcardDirectory(const std::string& directory, ExpansionInterface::Slot slot, + GCMemcardDirectory(std::string directory, ExpansionInterface::Slot slot, const Memcard::HeaderData& header_data, u32 game_id); ~GCMemcardDirectory() override; diff --git a/Source/Core/Core/HW/GCMemcard/GCMemcardRaw.cpp b/Source/Core/Core/HW/GCMemcard/GCMemcardRaw.cpp index 549cda4dc0..70b271772b 100644 --- a/Source/Core/Core/HW/GCMemcard/GCMemcardRaw.cpp +++ b/Source/Core/Core/HW/GCMemcard/GCMemcardRaw.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include @@ -34,9 +35,8 @@ #define SIZE_TO_Mb (1024 * 8 * 16) #define MC_HDR_SIZE 0xA000 -MemoryCard::MemoryCard(const std::string& filename, ExpansionInterface::Slot card_slot, - u16 size_mbits) - : MemoryCardBase(card_slot, size_mbits), m_filename(filename) +MemoryCard::MemoryCard(std::string filename, ExpansionInterface::Slot card_slot, u16 size_mbits) + : MemoryCardBase(card_slot, size_mbits), m_filename(std::move(filename)) { File::IOFile file(m_filename, "rb"); if (file) diff --git a/Source/Core/Core/HW/GCMemcard/GCMemcardRaw.h b/Source/Core/Core/HW/GCMemcard/GCMemcardRaw.h index 0c7ae75ee2..96e7a29b90 100644 --- a/Source/Core/Core/HW/GCMemcard/GCMemcardRaw.h +++ b/Source/Core/Core/HW/GCMemcard/GCMemcardRaw.h @@ -17,7 +17,7 @@ class PointerWrap; class MemoryCard : public MemoryCardBase { public: - MemoryCard(const std::string& filename, ExpansionInterface::Slot card_slot, + MemoryCard(std::string filename, ExpansionInterface::Slot card_slot, u16 size_mbits = Memcard::MBIT_SIZE_MEMORY_CARD_2043); ~MemoryCard() override; void FlushThread(); diff --git a/Source/Core/Core/HW/MMIO.cpp b/Source/Core/Core/HW/MMIO.cpp index e177e1ca8b..ce6d57175d 100644 --- a/Source/Core/Core/HW/MMIO.cpp +++ b/Source/Core/Core/HW/MMIO.cpp @@ -4,6 +4,7 @@ #include "Core/HW/MMIO.h" #include +#include #include "Common/Assert.h" #include "Common/CommonTypes.h" @@ -113,12 +114,12 @@ class ComplexHandlingMethod : public ReadHandlingMethod, public WriteHandling { public: explicit ComplexHandlingMethod(std::function read_lambda) - : read_lambda_(read_lambda), write_lambda_(InvalidWriteLambda()) + : read_lambda_(std::move(read_lambda)), write_lambda_(InvalidWriteLambda()) { } explicit ComplexHandlingMethod(std::function write_lambda) - : read_lambda_(InvalidReadLambda()), write_lambda_(write_lambda) + : read_lambda_(InvalidReadLambda()), write_lambda_(std::move(write_lambda)) { } @@ -159,12 +160,12 @@ private: template ReadHandlingMethod* ComplexRead(std::function lambda) { - return new ComplexHandlingMethod(lambda); + return new ComplexHandlingMethod(std::move(lambda)); } template WriteHandlingMethod* ComplexWrite(std::function lambda) { - return new ComplexHandlingMethod(lambda); + return new ComplexHandlingMethod(std::move(lambda)); } // Invalid: specialization of the complex handling type with lambdas that diff --git a/Source/Core/Core/HW/WiiSave.cpp b/Source/Core/Core/HW/WiiSave.cpp index 1c3e676897..372418f4f2 100644 --- a/Source/Core/Core/HW/WiiSave.cpp +++ b/Source/Core/Core/HW/WiiSave.cpp @@ -126,7 +126,7 @@ public: Md5 md5_calc; mbedtls_md5_ret(reinterpret_cast(&header), sizeof(Header), md5_calc.data()); - header.md5 = std::move(md5_calc); + header.md5 = md5_calc; return header; } @@ -541,7 +541,7 @@ CopyResult Copy(Storage* source, Storage* dest) return CopyResult::Success; } -CopyResult Import(const std::string& data_bin_path, std::function can_overwrite) +CopyResult Import(const std::string& data_bin_path, const std::function& can_overwrite) { IOS::HLE::Kernel ios; const auto data_bin = MakeDataBinStorage(&ios.GetIOSC(), data_bin_path, "rb"); diff --git a/Source/Core/Core/HW/WiiSave.h b/Source/Core/Core/HW/WiiSave.h index b834043363..58e755fac0 100644 --- a/Source/Core/Core/HW/WiiSave.h +++ b/Source/Core/Core/HW/WiiSave.h @@ -44,7 +44,7 @@ enum class CopyResult CopyResult Copy(Storage* source, Storage* destination); /// Import a save into the NAND from a .bin file. -CopyResult Import(const std::string& data_bin_path, std::function can_overwrite); +CopyResult Import(const std::string& data_bin_path, const std::function& can_overwrite); /// Export a save to a .bin file. CopyResult Export(u64 tid, std::string_view export_path); /// Export all saves that are in the NAND. Returns the number of exported saves. diff --git a/Source/Core/Core/IOS/Device.cpp b/Source/Core/Core/IOS/Device.cpp index 933d7a2081..53cb1039b4 100644 --- a/Source/Core/Core/IOS/Device.cpp +++ b/Source/Core/Core/IOS/Device.cpp @@ -5,6 +5,7 @@ #include #include +#include #include "Common/Logging/Log.h" #include "Common/StringUtil.h" @@ -152,8 +153,8 @@ void IOCtlVRequest::DumpUnknown(Core::System& system, const std::string& descrip Dump(system, "Unknown IOCtlV - " + description, type, level); } -Device::Device(Kernel& ios, const std::string& device_name, const DeviceType type) - : m_ios(ios), m_name(device_name), m_device_type(type) +Device::Device(Kernel& ios, std::string device_name, const DeviceType type) + : m_ios(ios), m_name(std::move(device_name)), m_device_type(type) { } diff --git a/Source/Core/Core/IOS/Device.h b/Source/Core/Core/IOS/Device.h index 35d2f79e91..a21e9d0d9b 100644 --- a/Source/Core/Core/IOS/Device.h +++ b/Source/Core/Core/IOS/Device.h @@ -186,7 +186,7 @@ public: OH0, // OH0 child devices which are created dynamically. }; - Device(Kernel& ios, const std::string& device_name, DeviceType type = DeviceType::Static); + Device(Kernel& ios, std::string device_name, DeviceType type = DeviceType::Static); virtual ~Device() = default; virtual void DoState(PointerWrap& p); diff --git a/Source/Core/Core/IOS/FS/HostBackend/FS.cpp b/Source/Core/Core/IOS/FS/HostBackend/FS.cpp index df4eafbd6d..f50b3fa3b4 100644 --- a/Source/Core/Core/IOS/FS/HostBackend/FS.cpp +++ b/Source/Core/Core/IOS/FS/HostBackend/FS.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include @@ -141,9 +142,8 @@ bool HostFileSystem::FstEntry::CheckPermission(Uid caller_uid, Gid caller_gid, return (u8(requested_mode) & u8(file_mode)) == u8(requested_mode); } -HostFileSystem::HostFileSystem(const std::string& root_path, - std::vector nand_redirects) - : m_root_path{root_path}, m_nand_redirects(std::move(nand_redirects)) +HostFileSystem::HostFileSystem(std::string root_path, std::vector nand_redirects) + : m_root_path{std::move(root_path)}, m_nand_redirects(std::move(nand_redirects)) { while (m_root_path.ends_with('/')) m_root_path.pop_back(); @@ -279,7 +279,7 @@ HostFileSystem::FstEntry* HostFileSystem::GetFstEntryForPath(const std::string& return entry; } -void HostFileSystem::DoStateRead(PointerWrap& p, std::string start_directory_path) +void HostFileSystem::DoStateRead(PointerWrap& p, const std::string& start_directory_path) { std::string path = BuildFilename(start_directory_path).host_path; File::DeleteDirRecursively(path); @@ -324,7 +324,7 @@ void HostFileSystem::DoStateRead(PointerWrap& p, std::string start_directory_pat } } -void HostFileSystem::DoStateWriteOrMeasure(PointerWrap& p, std::string start_directory_path) +void HostFileSystem::DoStateWriteOrMeasure(PointerWrap& p, const std::string& start_directory_path) { std::string path = BuildFilename(start_directory_path).host_path; File::FSTEntry parent_entry = File::ScanDirectoryTree(path, true); diff --git a/Source/Core/Core/IOS/FS/HostBackend/FS.h b/Source/Core/Core/IOS/FS/HostBackend/FS.h index 6f6e74ffa3..d178117770 100644 --- a/Source/Core/Core/IOS/FS/HostBackend/FS.h +++ b/Source/Core/Core/IOS/FS/HostBackend/FS.h @@ -22,7 +22,7 @@ namespace IOS::HLE::FS class HostFileSystem final : public FileSystem { public: - HostFileSystem(const std::string& root_path, std::vector nand_redirects = {}); + HostFileSystem(std::string root_path, std::vector nand_redirects = {}); ~HostFileSystem() override; void DoState(PointerWrap& p) override; @@ -60,8 +60,8 @@ public: void SetNandRedirects(std::vector nand_redirects) override; private: - void DoStateWriteOrMeasure(PointerWrap& p, std::string start_directory_path); - void DoStateRead(PointerWrap& p, std::string start_directory_path); + void DoStateWriteOrMeasure(PointerWrap& p, const std::string& start_directory_path); + void DoStateRead(PointerWrap& p, const std::string& start_directory_path); struct FstEntry { diff --git a/Source/Core/Core/IOS/Network/IP/Top.cpp b/Source/Core/Core/IOS/Network/IP/Top.cpp index e9677d5ef9..5040bfb7f8 100644 --- a/Source/Core/Core/IOS/Network/IP/Top.cpp +++ b/Source/Core/Core/IOS/Network/IP/Top.cpp @@ -69,7 +69,7 @@ enum SOResultCode : s32 NetIPTopDevice::NetIPTopDevice(EmulationKernel& ios, const std::string& device_name) : EmulationDevice(ios, device_name) { - m_work_queue.Reset("Network Worker", [this](AsyncTask task) { + m_work_queue.Reset("Network Worker", [this](const AsyncTask& task) { const IPCReply reply = task.handler(); { std::lock_guard lg(m_async_reply_lock); diff --git a/Source/Core/Core/IOS/Network/KD/NetKDRequest.cpp b/Source/Core/Core/IOS/Network/KD/NetKDRequest.cpp index 97edbbcef9..ed320f566e 100644 --- a/Source/Core/Core/IOS/Network/KD/NetKDRequest.cpp +++ b/Source/Core/Core/IOS/Network/KD/NetKDRequest.cpp @@ -159,7 +159,7 @@ NetKDRequestDevice::NetKDRequestDevice(EmulationKernel& ios, const std::string& // Enable all NWC24 permissions m_scheduler_buffer[1] = Common::swap32(-1); - m_work_queue.Reset("WiiConnect24 Worker", [this](AsyncTask task) { + m_work_queue.Reset("WiiConnect24 Worker", [this](const AsyncTask& task) { const IPCReply reply = task.handler(); { std::lock_guard lg(m_async_reply_lock); diff --git a/Source/Core/Core/IOS/Network/Socket.cpp b/Source/Core/Core/IOS/Network/Socket.cpp index 6baf371204..bac0713a0b 100644 --- a/Source/Core/Core/IOS/Network/Socket.cpp +++ b/Source/Core/Core/IOS/Network/Socket.cpp @@ -850,14 +850,14 @@ void WiiSocket::ResetTimeout() timeout.reset(); } -void WiiSocket::DoSock(Request request, NET_IOCTL type) +void WiiSocket::DoSock(const Request& request, NET_IOCTL type) { sockop so = {request, false}; so.net_type = type; pending_sockops.push_back(so); } -void WiiSocket::DoSock(Request request, SSL_IOCTL type) +void WiiSocket::DoSock(const Request& request, SSL_IOCTL type) { sockop so = {request, true}; so.ssl_type = type; diff --git a/Source/Core/Core/IOS/Network/Socket.h b/Source/Core/Core/IOS/Network/Socket.h index a529f28e14..4f07612799 100644 --- a/Source/Core/Core/IOS/Network/Socket.h +++ b/Source/Core/Core/IOS/Network/Socket.h @@ -213,8 +213,8 @@ private: const Timeout& GetTimeout(); void ResetTimeout(); - void DoSock(Request request, NET_IOCTL type); - void DoSock(Request request, SSL_IOCTL type); + void DoSock(const Request& request, NET_IOCTL type); + void DoSock(const Request& request, SSL_IOCTL type); void Update(bool read, bool write, bool except); void UpdateConnectingState(s32 connect_rv); ConnectingState GetConnectingState() const; diff --git a/Source/Core/Core/IOS/USB/Emulated/Microphone.cpp b/Source/Core/Core/IOS/USB/Emulated/Microphone.cpp index a80c0e0cfe..806fddb14c 100644 --- a/Source/Core/Core/IOS/USB/Emulated/Microphone.cpp +++ b/Source/Core/Core/IOS/USB/Emulated/Microphone.cpp @@ -31,13 +31,13 @@ namespace IOS::HLE::USB { #ifdef HAVE_CUBEB -Microphone::Microphone(const MicrophoneState& sampler, const std::string& worker_name) - : m_sampler(sampler), m_worker(worker_name) +Microphone::Microphone(const MicrophoneState& sampler, std::string worker_name) + : m_sampler(sampler), m_worker(std::move(worker_name)) { } #else -Microphone::Microphone(const MicrophoneState& sampler, const std::string& worker_name) - : m_sampler(sampler) +Microphone::Microphone(MicrophoneState sampler, std::string worker_name) + : m_sampler(std::move(sampler)) { } #endif diff --git a/Source/Core/Core/IOS/USB/Emulated/Microphone.h b/Source/Core/Core/IOS/USB/Emulated/Microphone.h index c2ef1ea031..59f23b0627 100644 --- a/Source/Core/Core/IOS/USB/Emulated/Microphone.h +++ b/Source/Core/Core/IOS/USB/Emulated/Microphone.h @@ -38,7 +38,7 @@ public: using SampleType = s16; using UnsignedSampleType = std::make_unsigned_t; - Microphone(const MicrophoneState& sampler, const std::string& worker_name); + Microphone(const MicrophoneState& sampler, std::string worker_name); virtual ~Microphone(); void Initialize(); diff --git a/Source/Core/Core/IOS/USB/Host.cpp b/Source/Core/Core/IOS/USB/Host.cpp index 11adfb9f38..a3372fdcfb 100644 --- a/Source/Core/Core/IOS/USB/Host.cpp +++ b/Source/Core/Core/IOS/USB/Host.cpp @@ -111,7 +111,7 @@ void USBHost::OnDevicesChangedInternal(const USBScanner::DeviceMap& new_devices) device->GetPid()); changes = true; - auto device_copy = std::move(device); + auto device_copy = device; it = m_devices.erase(it); OnDeviceChange(ChangeEvent::Removed, std::move(device_copy)); } @@ -138,8 +138,9 @@ void USBHost::OnDevicesChangedInternal(const USBScanner::DeviceMap& new_devices) OnDeviceChangeEnd(); } -std::optional USBHost::HandleTransfer(std::shared_ptr device, u32 request, - std::function submit) const +std::optional USBHost::HandleTransfer(const std::shared_ptr& device, + u32 request, + const std::function& submit) const { if (!device) return IPCReply(IPC_ENOENT); diff --git a/Source/Core/Core/IOS/USB/Host.h b/Source/Core/Core/IOS/USB/Host.h index ba858dc503..81efb09320 100644 --- a/Source/Core/Core/IOS/USB/Host.h +++ b/Source/Core/Core/IOS/USB/Host.h @@ -46,8 +46,8 @@ protected: virtual void OnDeviceChangeEnd(); virtual bool ShouldAddDevice(const USB::Device& device) const; - std::optional HandleTransfer(std::shared_ptr device, u32 request, - std::function submit) const; + std::optional HandleTransfer(const std::shared_ptr& device, u32 request, + const std::function& submit) const; std::map> m_devices; mutable std::recursive_mutex m_devices_mutex; diff --git a/Source/Core/Core/IOS/USB/LibusbDevice.cpp b/Source/Core/Core/IOS/USB/LibusbDevice.cpp index 9df0c90cd7..6f31f6dfcd 100644 --- a/Source/Core/Core/IOS/USB/LibusbDevice.cpp +++ b/Source/Core/Core/IOS/USB/LibusbDevice.cpp @@ -476,8 +476,8 @@ void LibusbDevice::TransferEndpoint::AddTransfer(std::unique_ptr fn) +void LibusbDevice::TransferEndpoint::HandleTransfer( + libusb_transfer* transfer, const std::function& fn) { std::lock_guard lk{m_transfers_mutex}; const auto iterator = m_transfers.find(transfer); diff --git a/Source/Core/Core/IOS/USB/LibusbDevice.h b/Source/Core/Core/IOS/USB/LibusbDevice.h index e36175493c..f3b4f0ff44 100644 --- a/Source/Core/Core/IOS/USB/LibusbDevice.h +++ b/Source/Core/Core/IOS/USB/LibusbDevice.h @@ -60,7 +60,8 @@ private: { public: void AddTransfer(std::unique_ptr command, libusb_transfer* transfer); - void HandleTransfer(libusb_transfer* tr, std::function function); + void HandleTransfer(libusb_transfer* tr, + const std::function& function); void CancelTransfers(); private: diff --git a/Source/Core/Core/IOS/USB/USBV5.cpp b/Source/Core/Core/IOS/USB/USBV5.cpp index afc29a252a..b96d4e9c2a 100644 --- a/Source/Core/Core/IOS/USB/USBV5.cpp +++ b/Source/Core/Core/IOS/USB/USBV5.cpp @@ -192,7 +192,7 @@ IPCReply USBV5ResourceManager::SuspendResume(USBV5Device& device, const IOCtlReq } std::optional USBV5ResourceManager::HandleDeviceIOCtl(const IOCtlRequest& request, - Handler handler) + const Handler& handler) { if (request.buffer_in == 0 || request.buffer_in_size != 0x20) return IPCReply(IPC_EINVAL); diff --git a/Source/Core/Core/IOS/USB/USBV5.h b/Source/Core/Core/IOS/USB/USBV5.h index 059092c1a9..051d0dd943 100644 --- a/Source/Core/Core/IOS/USB/USBV5.h +++ b/Source/Core/Core/IOS/USB/USBV5.h @@ -82,7 +82,7 @@ protected: IPCReply SuspendResume(USBV5Device& device, const IOCtlRequest& request); using Handler = std::function(USBV5Device&)>; - std::optional HandleDeviceIOCtl(const IOCtlRequest& request, Handler handler); + std::optional HandleDeviceIOCtl(const IOCtlRequest& request, const Handler& handler); IPCReply GetUSBVersion(const IOCtlRequest& request) const; void OnDeviceChange(ChangeEvent event, std::shared_ptr device) override; diff --git a/Source/Core/Core/LibusbUtils.cpp b/Source/Core/Core/LibusbUtils.cpp index 3cd9949566..fdb2ecd209 100644 --- a/Source/Core/Core/LibusbUtils.cpp +++ b/Source/Core/Core/LibusbUtils.cpp @@ -52,7 +52,7 @@ public: libusb_context* GetContext() const { return m_context; } - int GetDeviceList(GetDeviceListCallback callback) const + int GetDeviceList(const GetDeviceListCallback& callback) const { std::lock_guard lock{m_device_list_mutex}; @@ -113,9 +113,9 @@ bool Context::IsValid() const return m_impl->GetContext() != nullptr; } -int Context::GetDeviceList(GetDeviceListCallback callback) const +int Context::GetDeviceList(const GetDeviceListCallback& callback) const { - return m_impl->GetDeviceList(std::move(callback)); + return m_impl->GetDeviceList(callback); } std::pair MakeConfigDescriptor(libusb_device* device, u8 config_num) diff --git a/Source/Core/Core/LibusbUtils.h b/Source/Core/Core/LibusbUtils.h index 6b73070409..3a1544fc43 100644 --- a/Source/Core/Core/LibusbUtils.h +++ b/Source/Core/Core/LibusbUtils.h @@ -35,7 +35,7 @@ public: bool IsValid() const; // Only valid if the context is valid. - int GetDeviceList(GetDeviceListCallback callback) const; + int GetDeviceList(const GetDeviceListCallback& callback) const; private: class Impl; diff --git a/Source/Core/Core/NetPlayClient.cpp b/Source/Core/Core/NetPlayClient.cpp index 80bee1639b..3764de30d9 100644 --- a/Source/Core/Core/NetPlayClient.cpp +++ b/Source/Core/Core/NetPlayClient.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -123,8 +124,8 @@ NetPlayClient::~NetPlayClient() // called from ---GUI--- thread NetPlayClient::NetPlayClient(const std::string& address, const u16 port, NetPlayUI* dialog, - const std::string& name, const NetTraversalConfig& traversal_config) - : m_dialog(dialog), m_player_name(name) + std::string name, const NetTraversalConfig& traversal_config) + : m_dialog(dialog), m_player_name(std::move(name)) { ClearBuffers(); @@ -2536,7 +2537,8 @@ bool NetPlayClient::DoAllPlayersHaveGame() }); } -static std::string SHA1Sum(const std::string& file_path, std::function report_progress) +static std::string SHA1Sum(const std::string& file_path, + const std::function& report_progress) { std::vector data(8 * 1024 * 1024); u64 read_offset = 0; diff --git a/Source/Core/Core/NetPlayClient.h b/Source/Core/Core/NetPlayClient.h index 0a0dd6267e..10fd3bc943 100644 --- a/Source/Core/Core/NetPlayClient.h +++ b/Source/Core/Core/NetPlayClient.h @@ -113,8 +113,8 @@ public: void ThreadFunc(); void SendAsync(sf::Packet&& packet, u8 channel_id = DEFAULT_CHANNEL); - NetPlayClient(const std::string& address, const u16 port, NetPlayUI* dialog, - const std::string& name, const NetTraversalConfig& traversal_config); + NetPlayClient(const std::string& address, const u16 port, NetPlayUI* dialog, std::string name, + const NetTraversalConfig& traversal_config); ~NetPlayClient() override; std::vector GetPlayers(); diff --git a/Source/Core/Core/PatchEngine.cpp b/Source/Core/Core/PatchEngine.cpp index ca51b52a3a..e162b6e0b3 100644 --- a/Source/Core/Core/PatchEngine.cpp +++ b/Source/Core/Core/PatchEngine.cpp @@ -203,7 +203,7 @@ void LoadPatches() } const size_t enabled_patch_count = - std::ranges::count_if(s_on_frame, [](Patch patch) { return patch.enabled; }); + std::ranges::count_if(s_on_frame, [](const Patch& patch) { return patch.enabled; }); if (enabled_patch_count > 0) { OSD::AddMessage(fmt::format("{} game patch(es) enabled", enabled_patch_count), diff --git a/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp b/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp index 4de0cea621..55c3a3acea 100644 --- a/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp +++ b/Source/Core/Core/PowerPC/Jit64/RegCache/JitRegCache.cpp @@ -215,7 +215,7 @@ RCForkGuard::RCForkGuard(RegCache& rc_) : rc(&rc_), m_regs(rc_.m_regs), m_xregs( } RCForkGuard::RCForkGuard(RCForkGuard&& other) noexcept - : rc(other.rc), m_regs(std::move(other.m_regs)), m_xregs(std::move(other.m_xregs)) + : rc(other.rc), m_regs(other.m_regs), m_xregs(other.m_xregs) { other.rc = nullptr; } diff --git a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp index a7226b2ae9..4eecedc321 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp +++ b/Source/Core/Core/PowerPC/JitCommon/JitCache.cpp @@ -113,7 +113,7 @@ JitBlock** JitBaseBlockCache::GetFastBlockMapFallback() } void JitBaseBlockCache::RunOnBlocks(const Core::CPUThreadGuard&, - std::function f) const + const std::function& f) const { for (const auto& e : block_map) f(e.second); diff --git a/Source/Core/Core/PowerPC/JitCommon/JitCache.h b/Source/Core/Core/PowerPC/JitCommon/JitCache.h index 703fb4069e..4b5ac6fd80 100644 --- a/Source/Core/Core/PowerPC/JitCommon/JitCache.h +++ b/Source/Core/Core/PowerPC/JitCommon/JitCache.h @@ -162,7 +162,8 @@ public: // Code Cache u8** GetEntryPoints(); JitBlock** GetFastBlockMapFallback(); - void RunOnBlocks(const Core::CPUThreadGuard& guard, std::function f) const; + void RunOnBlocks(const Core::CPUThreadGuard& guard, + const std::function& f) const; void WipeBlockProfilingData(const Core::CPUThreadGuard& guard); std::size_t GetBlockCount() const { return block_map.size(); } diff --git a/Source/Core/Core/PowerPC/JitInterface.cpp b/Source/Core/Core/PowerPC/JitInterface.cpp index 62b65b6c2d..f229be35f2 100644 --- a/Source/Core/Core/PowerPC/JitInterface.cpp +++ b/Source/Core/Core/PowerPC/JitInterface.cpp @@ -195,10 +195,10 @@ void JitInterface::WipeBlockProfilingData(const Core::CPUThreadGuard& guard) } void JitInterface::RunOnBlocks(const Core::CPUThreadGuard& guard, - std::function f) const + const std::function& f) const { if (m_jit) - m_jit->GetBlockCache()->RunOnBlocks(guard, std::move(f)); + m_jit->GetBlockCache()->RunOnBlocks(guard, f); } std::size_t JitInterface::GetBlockCount() const diff --git a/Source/Core/Core/PowerPC/JitInterface.h b/Source/Core/Core/PowerPC/JitInterface.h index 65b6060ba2..0da7fd96e7 100644 --- a/Source/Core/Core/PowerPC/JitInterface.h +++ b/Source/Core/Core/PowerPC/JitInterface.h @@ -54,7 +54,8 @@ public: void UpdateMembase(); void JitBlockLogDump(const Core::CPUThreadGuard& guard, std::FILE* file) const; void WipeBlockProfilingData(const Core::CPUThreadGuard& guard); - void RunOnBlocks(const Core::CPUThreadGuard& guard, std::function f) const; + void RunOnBlocks(const Core::CPUThreadGuard& guard, + const std::function& f) const; std::size_t GetBlockCount() const; // Memory Utilities diff --git a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp index 9abc4ad03a..a663c6e0e2 100644 --- a/Source/Core/Core/PowerPC/PPCSymbolDB.cpp +++ b/Source/Core/Core/PowerPC/PPCSymbolDB.cpp @@ -647,10 +647,10 @@ bool PPCSymbolDB::SaveSymbolMap(const std::string& filename) const std::lock_guard lock(m_mutex); // Write .text section - auto function_symbols = - m_functions | - std::views::filter([](auto f) { return f.second.type == Common::Symbol::Type::Function; }) | - std::views::transform([](auto f) { return f.second; }); + auto function_symbols = m_functions | std::views::filter([](const auto& f) { + return f.second.type == Common::Symbol::Type::Function; + }) | + std::views::transform([](const auto& f) { return f.second; }); file.WriteString(".text section layout\n"); for (const auto& symbol : function_symbols) { @@ -665,10 +665,10 @@ bool PPCSymbolDB::SaveSymbolMap(const std::string& filename) const } // Write .data section - auto data_symbols = - m_functions | - std::views::filter([](auto f) { return f.second.type == Common::Symbol::Type::Data; }) | - std::views::transform([](auto f) { return f.second; }); + auto data_symbols = m_functions | std::views::filter([](const auto& f) { + return f.second.type == Common::Symbol::Type::Data; + }) | + std::views::transform([](const auto& f) { return f.second; }); file.WriteString("\n.data section layout\n"); for (const auto& symbol : data_symbols) { @@ -683,7 +683,7 @@ bool PPCSymbolDB::SaveSymbolMap(const std::string& filename) const } // Write .note section - auto note_symbols = m_notes | std::views::transform([](auto f) { return f.second; }); + auto note_symbols = m_notes | std::views::transform([](const auto& f) { return f.second; }); file.WriteString("\n.note section layout\n"); for (const auto& symbol : note_symbols) { diff --git a/Source/Core/Core/WiiUtils.cpp b/Source/Core/Core/WiiUtils.cpp index 8431b5de84..c22e9c8048 100644 --- a/Source/Core/Core/WiiUtils.cpp +++ b/Source/Core/Core/WiiUtils.cpp @@ -335,7 +335,7 @@ std::string SystemUpdater::GetDeviceId() class OnlineSystemUpdater final : public SystemUpdater { public: - OnlineSystemUpdater(UpdateCallback update_callback, const std::string& region); + OnlineSystemUpdater(UpdateCallback update_callback, std::string region); UpdateResult DoOnlineUpdate(); private: @@ -365,8 +365,8 @@ private: Common::HttpRequest m_http{std::chrono::minutes{3}}; }; -OnlineSystemUpdater::OnlineSystemUpdater(UpdateCallback update_callback, const std::string& region) - : m_update_callback(std::move(update_callback)), m_requested_region(region) +OnlineSystemUpdater::OnlineSystemUpdater(UpdateCallback update_callback, std::string region) + : m_update_callback(std::move(update_callback)), m_requested_region(std::move(region)) { } diff --git a/Source/Core/DiscIO/CompressedBlob.cpp b/Source/Core/DiscIO/CompressedBlob.cpp index ed0d313963..5c2ab84cdd 100644 --- a/Source/Core/DiscIO/CompressedBlob.cpp +++ b/Source/Core/DiscIO/CompressedBlob.cpp @@ -33,8 +33,8 @@ namespace DiscIO { bool IsGCZBlob(File::DirectIOFile& file); -CompressedBlobReader::CompressedBlobReader(File::DirectIOFile file, const std::string& filename) - : m_file(std::move(file)), m_file_name(filename) +CompressedBlobReader::CompressedBlobReader(File::DirectIOFile file, std::string filename) + : m_file(std::move(file)), m_file_name(std::move(filename)) { m_file_size = m_file.GetSize(); m_file.Seek(0, File::SeekOrigin::Begin); diff --git a/Source/Core/DiscIO/CompressedBlob.h b/Source/Core/DiscIO/CompressedBlob.h index 5122403f47..943353b169 100644 --- a/Source/Core/DiscIO/CompressedBlob.h +++ b/Source/Core/DiscIO/CompressedBlob.h @@ -65,7 +65,7 @@ public: bool GetBlock(u64 block_num, u8* out_ptr) override; private: - CompressedBlobReader(File::DirectIOFile file, const std::string& filename); + CompressedBlobReader(File::DirectIOFile file, std::string filename); CompressedBlobHeader m_header; std::vector m_block_pointers; diff --git a/Source/Core/DiscIO/DirectoryBlob.cpp b/Source/Core/DiscIO/DirectoryBlob.cpp index fe6c3880df..b2fadeb814 100644 --- a/Source/Core/DiscIO/DirectoryBlob.cpp +++ b/Source/Core/DiscIO/DirectoryBlob.cpp @@ -837,9 +837,9 @@ static void GenerateBuilderNodesFromFileSystem(const VolumeDisc& volume, const P } } -DirectoryBlobPartition::DirectoryBlobPartition(const std::string& root_directory, +DirectoryBlobPartition::DirectoryBlobPartition(std::string root_directory, std::optional is_wii) - : m_root_directory(root_directory) + : m_root_directory(std::move(root_directory)) { std::vector disc_header(DISCHEADER_SIZE); if (ReadFileToVector(m_root_directory + "sys/boot.bin", &disc_header) < 0x20) diff --git a/Source/Core/DiscIO/DirectoryBlob.h b/Source/Core/DiscIO/DirectoryBlob.h index 9ee3e36fc6..a8add132d6 100644 --- a/Source/Core/DiscIO/DirectoryBlob.h +++ b/Source/Core/DiscIO/DirectoryBlob.h @@ -176,7 +176,7 @@ class DirectoryBlobPartition { public: DirectoryBlobPartition() = default; - DirectoryBlobPartition(const std::string& root_directory, std::optional is_wii); + DirectoryBlobPartition(std::string root_directory, std::optional is_wii); DirectoryBlobPartition( VolumeDisc* volume, const Partition& partition, std::optional is_wii, const std::function* fst_nodes)>& sys_callback, diff --git a/Source/Core/DolphinQt/Achievements/AchievementsWindow.cpp b/Source/Core/DolphinQt/Achievements/AchievementsWindow.cpp index 63a15f67e7..11bc917a8a 100644 --- a/Source/Core/DolphinQt/Achievements/AchievementsWindow.cpp +++ b/Source/Core/DolphinQt/Achievements/AchievementsWindow.cpp @@ -34,7 +34,7 @@ AchievementsWindow::AchievementsWindow(QWidget* parent) : QDialog(parent) m_event_hook = AchievementManager::GetInstance().update_event.Register( [this](AchievementManager::UpdatedItems updated_items) { QueueOnObject(this, [this, updated_items = std::move(updated_items)] { - AchievementsWindow::UpdateData(std::move(updated_items)); + AchievementsWindow::UpdateData(updated_items); }); }); UpdateData(AchievementManager::UpdatedItems{.all = true}); @@ -80,7 +80,7 @@ void AchievementsWindow::ConnectWidgets() connect(m_button_box, &QDialogButtonBox::rejected, this, &QDialog::reject); } -void AchievementsWindow::UpdateData(AchievementManager::UpdatedItems updated_items) +void AchievementsWindow::UpdateData(const AchievementManager::UpdatedItems& updated_items) { m_settings_widget->UpdateData(updated_items.failed_login_code); if (updated_items.all) diff --git a/Source/Core/DolphinQt/Achievements/AchievementsWindow.h b/Source/Core/DolphinQt/Achievements/AchievementsWindow.h index a676547ed1..6287821218 100644 --- a/Source/Core/DolphinQt/Achievements/AchievementsWindow.h +++ b/Source/Core/DolphinQt/Achievements/AchievementsWindow.h @@ -22,7 +22,7 @@ class AchievementsWindow : public QDialog Q_OBJECT public: explicit AchievementsWindow(QWidget* parent); - void UpdateData(AchievementManager::UpdatedItems updated_items); + void UpdateData(const AchievementManager::UpdatedItems& updated_items); void ForceSettingsTab(); private: diff --git a/Source/Core/DolphinQt/Config/CheatWarningWidget.cpp b/Source/Core/DolphinQt/Config/CheatWarningWidget.cpp index bd0a09abea..011fd17de5 100644 --- a/Source/Core/DolphinQt/Config/CheatWarningWidget.cpp +++ b/Source/Core/DolphinQt/Config/CheatWarningWidget.cpp @@ -3,6 +3,8 @@ #include "DolphinQt/Config/CheatWarningWidget.h" +#include + #include #include #include @@ -16,9 +18,8 @@ #include "DolphinQt/QtUtils/QtUtils.h" #include "DolphinQt/Settings.h" -CheatWarningWidget::CheatWarningWidget(const std::string& game_id, bool restart_required, - QWidget* parent) - : QWidget(parent), m_game_id(game_id), m_restart_required(restart_required) +CheatWarningWidget::CheatWarningWidget(std::string game_id, bool restart_required, QWidget* parent) + : QWidget(parent), m_game_id(std::move(game_id)), m_restart_required(restart_required) { CreateWidgets(); ConnectWidgets(); diff --git a/Source/Core/DolphinQt/Config/CheatWarningWidget.h b/Source/Core/DolphinQt/Config/CheatWarningWidget.h index 0db25ea023..241cd44cba 100644 --- a/Source/Core/DolphinQt/Config/CheatWarningWidget.h +++ b/Source/Core/DolphinQt/Config/CheatWarningWidget.h @@ -14,7 +14,7 @@ class CheatWarningWidget : public QWidget { Q_OBJECT public: - explicit CheatWarningWidget(const std::string& game_id, bool restart_required, QWidget* parent); + explicit CheatWarningWidget(std::string game_id, bool restart_required, QWidget* parent); signals: void OpenCheatEnableSettings(); diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp b/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp index 60633b010f..d1027312d9 100644 --- a/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp +++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.cpp @@ -91,7 +91,7 @@ void ConfigStringChoice::OnConfigChanged() Load(); } -ConfigComplexChoice::ConfigComplexChoice(const InfoVariant setting1, const InfoVariant setting2, +ConfigComplexChoice::ConfigComplexChoice(const InfoVariant& setting1, const InfoVariant& setting2, Config::Layer* layer) : m_layer(layer), m_setting1(setting1), m_setting2(setting2) { diff --git a/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.h b/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.h index 46902e513a..f49166b6d1 100644 --- a/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.h +++ b/Source/Core/DolphinQt/Config/ConfigControls/ConfigChoice.h @@ -109,7 +109,7 @@ class ConfigComplexChoice final : public ToolTipComboBox using OptionVariant = std::variant; public: - ConfigComplexChoice(const InfoVariant setting1, const InfoVariant setting2, + ConfigComplexChoice(const InfoVariant& setting1, const InfoVariant& setting2, Config::Layer* layer = nullptr); void Add(const QString& name, const OptionVariant option1, const OptionVariant option2); diff --git a/Source/Core/DolphinQt/Config/VerifyWidget.cpp b/Source/Core/DolphinQt/Config/VerifyWidget.cpp index b95a4ac269..b5814bb192 100644 --- a/Source/Core/DolphinQt/Config/VerifyWidget.cpp +++ b/Source/Core/DolphinQt/Config/VerifyWidget.cpp @@ -101,7 +101,8 @@ void VerifyWidget::CreateWidgets() m_verify_button = new QPushButton(tr("Verify Integrity"), this); } -std::pair VerifyWidget::AddHashLine(QFormLayout* layout, QString text) +std::pair VerifyWidget::AddHashLine(QFormLayout* layout, + const QString& text) { QLineEdit* line_edit = new QLineEdit(this); line_edit->setReadOnly(true); @@ -225,7 +226,7 @@ void VerifyWidget::Verify() m_redump_line_edit->setText(QString::fromStdString(result->redump.message)); } -void VerifyWidget::SetProblemCellText(int row, int column, QString text) +void VerifyWidget::SetProblemCellText(int row, int column, const QString& text) { QLabel* label = new QLabel(text); label->setTextInteractionFlags(Qt::TextSelectableByMouse); diff --git a/Source/Core/DolphinQt/Config/VerifyWidget.h b/Source/Core/DolphinQt/Config/VerifyWidget.h index 5a00efb013..55fa2a7794 100644 --- a/Source/Core/DolphinQt/Config/VerifyWidget.h +++ b/Source/Core/DolphinQt/Config/VerifyWidget.h @@ -32,13 +32,13 @@ public: private: void OnEmulationStateChanged(Core::State state); void CreateWidgets(); - std::pair AddHashLine(QFormLayout* layout, QString text); + std::pair AddHashLine(QFormLayout* layout, const QString& text); void ConnectWidgets(); bool CanVerifyRedump() const; void UpdateRedumpEnabled(); void Verify(); - void SetProblemCellText(int row, int column, QString text); + void SetProblemCellText(int row, int column, const QString& text); std::shared_ptr m_volume; QTableWidget* m_problems; diff --git a/Source/Core/DolphinQt/Debugger/AssemblyEditor.cpp b/Source/Core/DolphinQt/Debugger/AssemblyEditor.cpp index 4e74465bca..4d45513bc2 100644 --- a/Source/Core/DolphinQt/Debugger/AssemblyEditor.cpp +++ b/Source/Core/DolphinQt/Debugger/AssemblyEditor.cpp @@ -9,6 +9,7 @@ #include #include +#include #include "Common/StringUtil.h" #include "DolphinQt/Debugger/GekkoSyntaxHighlight.h" @@ -23,8 +24,8 @@ void AsmEditor::LineNumberArea::paintEvent(QPaintEvent* event) asm_editor->LineNumberAreaPaintEvent(event); } -AsmEditor::AsmEditor(const QString& path, int editor_num, bool dark_scheme, QWidget* parent) - : QPlainTextEdit(parent), m_path(path), m_base_address(QStringLiteral("0")), +AsmEditor::AsmEditor(QString path, int editor_num, bool dark_scheme, QWidget* parent) + : QPlainTextEdit(parent), m_path(std::move(path)), m_base_address(QStringLiteral("0")), m_editor_num(editor_num), m_dirty(false), m_dark_scheme(dark_scheme) { if (!m_path.isEmpty()) diff --git a/Source/Core/DolphinQt/Debugger/AssemblyEditor.h b/Source/Core/DolphinQt/Debugger/AssemblyEditor.h index c850817b82..309cf0dc82 100644 --- a/Source/Core/DolphinQt/Debugger/AssemblyEditor.h +++ b/Source/Core/DolphinQt/Debugger/AssemblyEditor.h @@ -18,7 +18,7 @@ class AsmEditor : public QPlainTextEdit Q_OBJECT; public: - AsmEditor(const QString& file_path, int editor_num, bool dark_scheme, QWidget* parent = nullptr); + AsmEditor(QString file_path, int editor_num, bool dark_scheme, QWidget* parent = nullptr); void LineNumberAreaPaintEvent(QPaintEvent* event); int LineNumberAreaWidth(); const QString& Path() const { return m_path; } diff --git a/Source/Core/DolphinQt/Debugger/GekkoSyntaxHighlight.cpp b/Source/Core/DolphinQt/Debugger/GekkoSyntaxHighlight.cpp index 683099cf98..0fbc622d84 100644 --- a/Source/Core/DolphinQt/Debugger/GekkoSyntaxHighlight.cpp +++ b/Source/Core/DolphinQt/Debugger/GekkoSyntaxHighlight.cpp @@ -5,6 +5,8 @@ #include "Common/Assembler/GekkoParser.h" +#include + #include #include @@ -189,7 +191,7 @@ void GekkoSyntaxHighlight::highlightBlock(const QString& text) GekkoSyntaxHighlight::GekkoSyntaxHighlight(QTextDocument* document, QTextCharFormat base_format, bool dark_scheme) - : QSyntaxHighlighter(document), m_base_format(base_format) + : QSyntaxHighlighter(document), m_base_format(std::move(base_format)) { QPalette base_scheme; m_theme_idx = dark_scheme ? 1 : 0; diff --git a/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp b/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp index 84b7e7b74f..6eb66435b0 100644 --- a/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/RegisterWidget.cpp @@ -517,8 +517,9 @@ void RegisterWidget::PopulateTable() m_table->resizeColumnsToContents(); } -void RegisterWidget::AddRegister(int row, int column, RegisterType type, std::string register_name, - std::function get_reg, std::function set_reg) +void RegisterWidget::AddRegister(int row, int column, RegisterType type, + const std::string& register_name, std::function get_reg, + std::function set_reg) { auto* value = new RegisterColumn(type, std::move(get_reg), std::move(set_reg)); diff --git a/Source/Core/DolphinQt/Debugger/RegisterWidget.h b/Source/Core/DolphinQt/Debugger/RegisterWidget.h index 81baae1bd5..68358911dc 100644 --- a/Source/Core/DolphinQt/Debugger/RegisterWidget.h +++ b/Source/Core/DolphinQt/Debugger/RegisterWidget.h @@ -48,7 +48,7 @@ private: void OnItemChanged(QTableWidgetItem* item); void OnDebugFontChanged(const QFont& font); - void AddRegister(int row, int column, RegisterType type, std::string register_name, + void AddRegister(int row, int column, RegisterType type, const std::string& register_name, std::function get_reg, std::function set_reg); void AutoStep(const std::string& reg) const; diff --git a/Source/Core/DolphinQt/Debugger/WatchWidget.cpp b/Source/Core/DolphinQt/Debugger/WatchWidget.cpp index 06fe4aa48b..35107c0ccc 100644 --- a/Source/Core/DolphinQt/Debugger/WatchWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/WatchWidget.cpp @@ -518,7 +518,7 @@ void WatchWidget::ShowInMemory(int row) emit ShowMemory(m_system.GetPowerPC().GetDebugInterface().GetWatch(row).address); } -void WatchWidget::AddWatch(QString name, u32 addr) +void WatchWidget::AddWatch(const QString& name, u32 addr) { m_system.GetPowerPC().GetDebugInterface().SetWatch(addr, name.toStdString()); Update(); diff --git a/Source/Core/DolphinQt/Debugger/WatchWidget.h b/Source/Core/DolphinQt/Debugger/WatchWidget.h index b1e1383803..95ec2cc564 100644 --- a/Source/Core/DolphinQt/Debugger/WatchWidget.h +++ b/Source/Core/DolphinQt/Debugger/WatchWidget.h @@ -27,7 +27,7 @@ public: explicit WatchWidget(QWidget* parent = nullptr); ~WatchWidget() override; - void AddWatch(QString name, u32 addr); + void AddWatch(const QString& name, u32 addr); signals: void RequestMemoryBreakpoint(u32 addr); void ShowMemory(u32 addr); diff --git a/Source/Core/DolphinQt/GCMemcardManager.cpp b/Source/Core/DolphinQt/GCMemcardManager.cpp index 63f3538c0c..1d39d10888 100644 --- a/Source/Core/DolphinQt/GCMemcardManager.cpp +++ b/Source/Core/DolphinQt/GCMemcardManager.cpp @@ -327,7 +327,7 @@ void GCMemcardManager::UpdateActions() m_fix_checksums_button->setEnabled(have_memcard); } -void GCMemcardManager::SetSlotFile(Slot slot, QString path) +void GCMemcardManager::SetSlotFile(Slot slot, const QString& path) { auto [error_code, memcard] = Memcard::GCMemcard::Open(path.toStdString()); diff --git a/Source/Core/DolphinQt/GCMemcardManager.h b/Source/Core/DolphinQt/GCMemcardManager.h index 2f5f974efc..9ad3201c25 100644 --- a/Source/Core/DolphinQt/GCMemcardManager.h +++ b/Source/Core/DolphinQt/GCMemcardManager.h @@ -55,7 +55,7 @@ private: void UpdateActions(); void UpdateSlotTable(ExpansionInterface::Slot slot); - void SetSlotFile(ExpansionInterface::Slot slot, QString path); + void SetSlotFile(ExpansionInterface::Slot slot, const QString& path); void SetSlotFileInteractive(ExpansionInterface::Slot slot); void SetActiveSlot(ExpansionInterface::Slot slot); diff --git a/Source/Core/DolphinQt/GameList/GameList.h b/Source/Core/DolphinQt/GameList/GameList.h index 94de2eec35..0c00811743 100644 --- a/Source/Core/DolphinQt/GameList/GameList.h +++ b/Source/Core/DolphinQt/GameList/GameList.h @@ -56,7 +56,7 @@ signals: void GameCountUpdated(int total_games, int visible_games) const; void OnStartWithRiivolution(const UICommon::GameFile& game); void NetPlayHost(const UICommon::GameFile& game); - void SelectionChanged(std::shared_ptr game_file); + void SelectionChanged(const std::shared_ptr& game_file); void OpenGeneralSettings(); void OpenGraphicsSettings(); #ifdef USE_RETRO_ACHIEVEMENTS diff --git a/Source/Core/DolphinQt/GameList/GameTracker.cpp b/Source/Core/DolphinQt/GameList/GameTracker.cpp index 5b15bfc53c..72a2cdbeaa 100644 --- a/Source/Core/DolphinQt/GameList/GameTracker.cpp +++ b/Source/Core/DolphinQt/GameList/GameTracker.cpp @@ -54,7 +54,7 @@ GameTracker::GameTracker(QObject* parent) : QFileSystemWatcher(parent) connect(&Settings::Instance(), &Settings::MetadataRefreshRequested, this, [this] { m_load_thread.EmplaceItem(Command{CommandType::UpdateMetadata, {}}); }); - m_load_thread.Reset("GameList Tracker", [this](Command command) { + m_load_thread.Reset("GameList Tracker", [this](const Command& command) { switch (command.type) { case CommandType::LoadCache: @@ -356,7 +356,7 @@ void GameTracker::LoadGame(const QString& path) bool cache_changed = false; auto game = m_cache.AddOrGet(converted_path, &cache_changed); if (game) - emit GameLoaded(std::move(game)); + emit GameLoaded(game); if (cache_changed && !m_refresh_in_progress) m_cache.Save(); } diff --git a/Source/Core/DolphinQt/Host.cpp b/Source/Core/DolphinQt/Host.cpp index ea7b1920c6..e2f1b21884 100644 --- a/Source/Core/DolphinQt/Host.cpp +++ b/Source/Core/DolphinQt/Host.cpp @@ -76,7 +76,7 @@ void Host::SetMainWindowHandle(void* handle) m_main_window_handle = handle; } -static void RunWithGPUThreadInactive(std::function f) +static void RunWithGPUThreadInactive(const std::function& f) { // Potentially any thread which shows panic alerts can be blocked on this returning. // This means that, in order to avoid deadlocks, we need to be careful with how we diff --git a/Source/Core/DolphinQt/InfinityBase/InfinityBaseWindow.cpp b/Source/Core/DolphinQt/InfinityBase/InfinityBaseWindow.cpp index 7867704223..38a14d984e 100644 --- a/Source/Core/DolphinQt/InfinityBase/InfinityBaseWindow.cpp +++ b/Source/Core/DolphinQt/InfinityBase/InfinityBaseWindow.cpp @@ -106,7 +106,8 @@ void InfinityBaseWindow::CreateMainWindow() setLayout(main_layout); } -void InfinityBaseWindow::AddFigureSlot(QVBoxLayout* vbox_group, QString name, FigureUIPosition slot) +void InfinityBaseWindow::AddFigureSlot(QVBoxLayout* vbox_group, const QString& name, + FigureUIPosition slot) { auto* hbox_infinity = new QHBoxLayout(); diff --git a/Source/Core/DolphinQt/InfinityBase/InfinityBaseWindow.h b/Source/Core/DolphinQt/InfinityBase/InfinityBaseWindow.h index 3350ff0b94..a7d0c69d37 100644 --- a/Source/Core/DolphinQt/InfinityBase/InfinityBaseWindow.h +++ b/Source/Core/DolphinQt/InfinityBase/InfinityBaseWindow.h @@ -37,7 +37,8 @@ protected: private: void CreateMainWindow(); - void AddFigureSlot(QVBoxLayout* vbox_group, QString name, IOS::HLE::USB::FigureUIPosition slot); + void AddFigureSlot(QVBoxLayout* vbox_group, const QString& name, + IOS::HLE::USB::FigureUIPosition slot); void OnEmulationStateChanged(Core::State state); void EmulateBase(bool emulate); void ClearFigure(IOS::HLE::USB::FigureUIPosition slot); diff --git a/Source/Core/DolphinQt/MainWindow.cpp b/Source/Core/DolphinQt/MainWindow.cpp index 2713157a74..688ae6ffcd 100644 --- a/Source/Core/DolphinQt/MainWindow.cpp +++ b/Source/Core/DolphinQt/MainWindow.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #if defined(__unix__) || defined(__unix) || defined(__APPLE__) @@ -201,7 +202,7 @@ static WindowSystemInfo GetWindowSystemInfo(QWindow* window) return wsi; } -static std::vector StringListToStdVector(QStringList list) +static std::vector StringListToStdVector(const QStringList& list) { std::vector result; result.reserve(list.size()); @@ -474,7 +475,7 @@ void MainWindow::CreateComponents() m_code_widget = new CodeWidget(this); m_assembler_widget = new AssemblerWidget(this); - const auto request_watch = [this](QString name, u32 addr) { + const auto request_watch = [this](const QString& name, u32 addr) { m_watch_widget->AddWatch(name, addr); }; const auto request_breakpoint = [this](u32 addr) { m_breakpoint_widget->AddBP(addr); }; diff --git a/Source/Core/DolphinQt/MenuBar.cpp b/Source/Core/DolphinQt/MenuBar.cpp index 5015eb5fee..9fe037e7ef 100644 --- a/Source/Core/DolphinQt/MenuBar.cpp +++ b/Source/Core/DolphinQt/MenuBar.cpp @@ -1419,7 +1419,7 @@ void MenuBar::NANDExtractCertificates() } } -void MenuBar::OnSelectionChanged(std::shared_ptr game_file) +void MenuBar::OnSelectionChanged(const std::shared_ptr& game_file) { m_game_selected = !!game_file; diff --git a/Source/Core/DolphinQt/MenuBar.h b/Source/Core/DolphinQt/MenuBar.h index 2cd56f4e54..9533459eed 100644 --- a/Source/Core/DolphinQt/MenuBar.h +++ b/Source/Core/DolphinQt/MenuBar.h @@ -131,7 +131,7 @@ signals: void ExportRecording(); void ShowTASInput(); - void SelectionChanged(std::shared_ptr game_file); + void SelectionChanged(const std::shared_ptr& game_file); void RecordingStatusChanged(bool recording); void ReadOnlyModeChanged(bool read_only); @@ -195,7 +195,7 @@ private: void LogInstructions(); void SearchInstruction(); - void OnSelectionChanged(std::shared_ptr game_file); + void OnSelectionChanged(const std::shared_ptr& game_file); void OnRecordingStatusChanged(bool recording); void OnReadOnlyModeChanged(bool read_only); void OnDebugModeToggled(bool enabled); diff --git a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp index b71af44161..6cadce9203 100644 --- a/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp +++ b/Source/Core/DolphinQt/NetPlay/NetPlayDialog.cpp @@ -23,6 +23,7 @@ #include #include +#include #ifdef HAS_LIBMGBA #include @@ -500,7 +501,7 @@ void NetPlayDialog::reject() void NetPlayDialog::show(std::string nickname, bool use_traversal) { - m_nickname = nickname; + m_nickname = std::move(nickname); m_use_traversal = use_traversal; m_buffer_size = 0; m_old_player_count = 0; diff --git a/Source/Core/DolphinQt/QtUtils/ModalMessageBox.cpp b/Source/Core/DolphinQt/QtUtils/ModalMessageBox.cpp index 2afe64015d..9a3d3612b8 100644 --- a/Source/Core/DolphinQt/QtUtils/ModalMessageBox.cpp +++ b/Source/Core/DolphinQt/QtUtils/ModalMessageBox.cpp @@ -19,7 +19,7 @@ ModalMessageBox::ModalMessageBox(QWidget* parent, Qt::WindowModality modality) static inline int ExecMessageBox(ModalMessageBox::Icon icon, QWidget* parent, const QString& title, const QString& text, ModalMessageBox::StandardButtons buttons, ModalMessageBox::StandardButton default_button, - Qt::WindowModality modality, QString detailed_text) + Qt::WindowModality modality, const QString& detailed_text) { ModalMessageBox msg(parent, modality); msg.setIcon(icon); diff --git a/Source/Core/DolphinQt/Settings.cpp b/Source/Core/DolphinQt/Settings.cpp index 396cd14ae5..0c4ca89ae2 100644 --- a/Source/Core/DolphinQt/Settings.cpp +++ b/Source/Core/DolphinQt/Settings.cpp @@ -534,7 +534,7 @@ QString Settings::GetDefaultGame() const return QString::fromStdString(Config::Get(Config::MAIN_DEFAULT_ISO)); } -void Settings::SetDefaultGame(QString path) +void Settings::SetDefaultGame(const QString& path) { if (GetDefaultGame() != path) { @@ -833,7 +833,7 @@ void Settings::RefreshWidgetVisibility() emit GameCountVisibilityChanged(IsGameCountVisible()); } -void Settings::SetDebugFont(QFont font) +void Settings::SetDebugFont(const QFont& font) { if (GetDebugFont() != font) { diff --git a/Source/Core/DolphinQt/Settings.h b/Source/Core/DolphinQt/Settings.h index 2c721a8489..2fe0d272e6 100644 --- a/Source/Core/DolphinQt/Settings.h +++ b/Source/Core/DolphinQt/Settings.h @@ -102,7 +102,7 @@ public: bool GetPreferredView() const; void SetPreferredView(bool list); QString GetDefaultGame() const; - void SetDefaultGame(QString path); + void SetDefaultGame(const QString& path); void RefreshGameList(); void NotifyRefreshGameListStarted(); void NotifyRefreshGameListComplete(); @@ -175,7 +175,7 @@ public: void SetAssemblerVisible(bool enabled); bool IsAssemblerVisible() const; QFont GetDebugFont() const; - void SetDebugFont(QFont font); + void SetDebugFont(const QFont& font); // Auto-Update QString GetAutoUpdateTrack() const; diff --git a/Source/Core/DolphinQt/Settings/AdvancedPane.cpp b/Source/Core/DolphinQt/Settings/AdvancedPane.cpp index ddb47bc767..a526e8c7cb 100644 --- a/Source/Core/DolphinQt/Settings/AdvancedPane.cpp +++ b/Source/Core/DolphinQt/Settings/AdvancedPane.cpp @@ -336,11 +336,12 @@ void AdvancedPane::ConnectLayout() Update(); }); - connect(m_custom_rtc_datetime, &QDateTimeEdit::dateTimeChanged, [this](QDateTime date_time) { - Config::SetBaseOrCurrent(Config::MAIN_CUSTOM_RTC_VALUE, - static_cast(date_time.toSecsSinceEpoch())); - Update(); - }); + connect(m_custom_rtc_datetime, &QDateTimeEdit::dateTimeChanged, + [this](const QDateTime& date_time) { + Config::SetBaseOrCurrent(Config::MAIN_CUSTOM_RTC_VALUE, + static_cast(date_time.toSecsSinceEpoch())); + Update(); + }); } void AdvancedPane::Update() diff --git a/Source/Core/DolphinQt/TAS/TASInputWindow.cpp b/Source/Core/DolphinQt/TAS/TASInputWindow.cpp index 7b2cff94a0..227b04759f 100644 --- a/Source/Core/DolphinQt/TAS/TASInputWindow.cpp +++ b/Source/Core/DolphinQt/TAS/TASInputWindow.cpp @@ -166,8 +166,8 @@ QGridLayout* TASInputWindow::CreateSliderValuePairLayout( TASSpinBox* TASInputWindow::CreateSliderValuePair( std::string_view group_name, std::string_view control_name, InputOverrider* overrider, QGridLayout* layout, int zero, int default_, int min, int max, - QKeySequence shortcut_key_sequence, Qt::Orientation orientation, QWidget* shortcut_widget, - std::optional scale) + const QKeySequence& shortcut_key_sequence, Qt::Orientation orientation, + QWidget* shortcut_widget, std::optional scale) { TASSpinBox* value = CreateSliderValuePair(layout, default_, max, shortcut_key_sequence, orientation, shortcut_widget); @@ -194,7 +194,7 @@ TASSpinBox* TASInputWindow::CreateSliderValuePair( // The shortcut_widget argument needs to specify the container widget that will be hidden/shown. // This is done to avoid ambiguous shortcuts TASSpinBox* TASInputWindow::CreateSliderValuePair(QGridLayout* layout, int default_, int max, - QKeySequence shortcut_key_sequence, + const QKeySequence& shortcut_key_sequence, Qt::Orientation orientation, QWidget* shortcut_widget) { diff --git a/Source/Core/DolphinQt/TAS/TASInputWindow.h b/Source/Core/DolphinQt/TAS/TASInputWindow.h index 0ae14a22fc..c61a60d1f7 100644 --- a/Source/Core/DolphinQt/TAS/TASInputWindow.h +++ b/Source/Core/DolphinQt/TAS/TASInputWindow.h @@ -64,12 +64,12 @@ protected: TASSpinBox* CreateSliderValuePair(std::string_view group_name, std::string_view control_name, InputOverrider* overrider, QGridLayout* layout, int zero, int default_, int min, int max, - QKeySequence shortcut_key_sequence, Qt::Orientation orientation, - QWidget* shortcut_widget, + const QKeySequence& shortcut_key_sequence, + Qt::Orientation orientation, QWidget* shortcut_widget, std::optional scale = {}); TASSpinBox* CreateSliderValuePair(QGridLayout* layout, int default_, int max, - QKeySequence shortcut_key_sequence, Qt::Orientation orientation, - QWidget* shortcut_widget); + const QKeySequence& shortcut_key_sequence, + Qt::Orientation orientation, QWidget* shortcut_widget); void SetupScrollArea(QLayout* layout); diff --git a/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp b/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp index daa654e48c..ee2e78db49 100644 --- a/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp +++ b/Source/Core/InputCommon/ControlReference/ExpressionParser.cpp @@ -956,7 +956,7 @@ private: static bool IsRTLBinaryOp(TokenType type) { return type == TOK_ASSIGN; } - static bool IsBinaryOpWithPrecedence(Token tok, int precedence) + static bool IsBinaryOpWithPrecedence(const Token& tok, int precedence) { if (!tok.IsBinaryOperator()) return false; diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.cpp index 612310a470..65926a2524 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.cpp @@ -4,6 +4,7 @@ #include "InputCommon/ControllerEmu/ControlGroup/Buttons.h" #include +#include namespace ControllerEmu { @@ -11,8 +12,8 @@ Buttons::Buttons(const std::string& name_) : Buttons(name_, name_) { } -Buttons::Buttons(const std::string& ini_name, const std::string& group_name) - : ControlGroup(ini_name, group_name, GroupType::Buttons) +Buttons::Buttons(std::string ini_name, std::string group_name) + : ControlGroup(std::move(ini_name), std::move(group_name), GroupType::Buttons) { } diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.h index db61f1b8b2..68784310bb 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.h +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/Buttons.h @@ -15,7 +15,7 @@ class Buttons : public ControlGroup { public: explicit Buttons(const std::string& name_); - Buttons(const std::string& ini_name, const std::string& group_name); + Buttons(std::string ini_name, std::string group_name); template void GetState(C* const buttons, const C* bitmasks) const diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp index 7a34d1c597..239289e748 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.cpp @@ -13,8 +13,7 @@ namespace ControllerEmu { -ModifySettingsButton::ModifySettingsButton(std::string button_name) - : Buttons(std::move(button_name)) +ModifySettingsButton::ModifySettingsButton(const std::string& button_name) : Buttons(button_name) { } diff --git a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.h b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.h index af4a80e94f..6b117eda4d 100644 --- a/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.h +++ b/Source/Core/InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.h @@ -13,7 +13,7 @@ namespace ControllerEmu class ModifySettingsButton : public Buttons { public: - explicit ModifySettingsButton(std::string button_name); + explicit ModifySettingsButton(const std::string& button_name); void AddInput(std::string button_name, bool toggle = false); diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp index 7393de9950..9dd8cdb6a9 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp @@ -166,7 +166,7 @@ void ControllerInterface::RefreshDevices(RefreshReason reason) InvokeDevicesChangedCallbacks(); } -void ControllerInterface::PlatformPopulateDevices(std::function callback) +void ControllerInterface::PlatformPopulateDevices(const std::function& callback) { if (!m_is_init) return; diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h index 05a3a99a05..8f7f4baf40 100644 --- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h +++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.h @@ -97,7 +97,7 @@ public: // This is mandatory to use on device populations functions that can be called concurrently by // more than one thread, or that are called by a single other thread. // Without this, our devices list might end up in a mixed state. - void PlatformPopulateDevices(std::function callback); + void PlatformPopulateDevices(const std::function& callback); bool IsInit() const { return m_is_init; } void UpdateInput(); diff --git a/Source/Core/InputCommon/ControllerInterface/CoreDevice.cpp b/Source/Core/InputCommon/ControllerInterface/CoreDevice.cpp index 7197aa1fed..a10edd13c9 100644 --- a/Source/Core/InputCommon/ControllerInterface/CoreDevice.cpp +++ b/Source/Core/InputCommon/ControllerInterface/CoreDevice.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include @@ -25,7 +26,8 @@ class CombinedInput final : public Device::Input public: using Inputs = std::pair; - CombinedInput(std::string name, const Inputs& inputs) : m_name(std::move(name)), m_inputs(inputs) + CombinedInput(std::string name, Inputs inputs) + : m_name(std::move(name)), m_inputs(std::move(inputs)) { } ControlState GetState() const override diff --git a/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp b/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp index dad0844beb..b22ace19f2 100644 --- a/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp +++ b/Source/Core/InputCommon/ControllerInterface/DualShockUDPClient/DualShockUDPClient.cpp @@ -179,7 +179,7 @@ struct Server m_description = std::move(other.m_description); m_address = std::move(other.m_address); m_port = other.m_port; - m_port_info = std::move(other.m_port_info); + m_port_info = other.m_port_info; } Server& operator=(const Server&) = delete; diff --git a/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.cpp b/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.cpp index 20baa74be9..ce0ddb3314 100644 --- a/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include "Common/FileUtil.h" @@ -73,7 +74,7 @@ void InputBackend::PopulateDevices() } } -PipeDevice::PipeDevice(int fd, const std::string& name) : m_fd(fd), m_name(name) +PipeDevice::PipeDevice(int fd, std::string name) : m_fd(fd), m_name(std::move(name)) { for (const auto& tok : s_button_tokens) { diff --git a/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.h b/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.h index 857d5e8128..d9e2d7b4b7 100644 --- a/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.h +++ b/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.h @@ -26,7 +26,7 @@ std::unique_ptr CreateInputBackend(ControllerInterface* co class PipeDevice : public Core::Device { public: - PipeDevice(int fd, const std::string& name); + PipeDevice(int fd, std::string name); ~PipeDevice(); Core::DeviceRemoval UpdateInput() override; diff --git a/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp b/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp index b062684100..e7724c1840 100644 --- a/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Wiimote/WiimoteController.cpp @@ -505,7 +505,7 @@ void Device::RunTasks() { static constexpr u16 MPLUS_POLL_ADDR = WiimoteEmu::MotionPlus::PASSTHROUGH_MODE_OFFSET; ReadData(AddressSpace::I2CBus, WiimoteEmu::MotionPlus::INACTIVE_DEVICE_ADDR, MPLUS_POLL_ADDR, 1, - [this](ReadResponse response) { + [this](const ReadResponse& response) { if (!response) { DEBUG_LOG_FMT(WIIMOTE, "WiiRemote: M+ poll failed."); diff --git a/Source/Core/InputCommon/GCAdapter.cpp b/Source/Core/InputCommon/GCAdapter.cpp index 986480227d..c8b686a8b3 100644 --- a/Source/Core/InputCommon/GCAdapter.cpp +++ b/Source/Core/InputCommon/GCAdapter.cpp @@ -15,6 +15,8 @@ #include #include #include +#include + using namespace std::chrono_literals; #if GCADAPTER_USE_LIBUSB_IMPLEMENTATION @@ -477,7 +479,7 @@ static void ScanThreadFunc() void SetAdapterCallback(std::function func) { #if GCADAPTER_USE_LIBUSB_IMPLEMENTATION - s_detect_callback = func; + s_detect_callback = std::move(func); #endif } diff --git a/Source/Core/InputCommon/InputConfig.cpp b/Source/Core/InputCommon/InputConfig.cpp index 5e8e4ac880..34de19b883 100644 --- a/Source/Core/InputCommon/InputConfig.cpp +++ b/Source/Core/InputCommon/InputConfig.cpp @@ -3,6 +3,7 @@ #include "InputCommon/InputConfig.h" +#include #include #include "Common/FileUtil.h" @@ -16,10 +17,11 @@ #include "InputCommon/ControllerInterface/ControllerInterface.h" #include "InputCommon/InputProfile.h" -InputConfig::InputConfig(const std::string& ini_name, const std::string& gui_name, - const std::string& profile_directory_name, const std::string& profile_key) - : m_ini_name(ini_name), m_gui_name(gui_name), m_profile_directory_name(profile_directory_name), - m_profile_key(profile_key) +InputConfig::InputConfig(std::string ini_name, std::string gui_name, + std::string profile_directory_name, std::string profile_key) + : m_ini_name(std::move(ini_name)), m_gui_name(std::move(gui_name)), + m_profile_directory_name(std::move(profile_directory_name)), + m_profile_key(std::move(profile_key)) { } diff --git a/Source/Core/InputCommon/InputConfig.h b/Source/Core/InputCommon/InputConfig.h index 205f5d3623..33e98b7cbf 100644 --- a/Source/Core/InputCommon/InputConfig.h +++ b/Source/Core/InputCommon/InputConfig.h @@ -24,8 +24,8 @@ class EmulatedController; class InputConfig { public: - InputConfig(const std::string& ini_name, const std::string& gui_name, - const std::string& profile_directory_name, const std::string& profile_key); + InputConfig(std::string ini_name, std::string gui_name, std::string profile_directory_name, + std::string profile_key); ~InputConfig(); diff --git a/Source/Core/UICommon/CommandLineParse.cpp b/Source/Core/UICommon/CommandLineParse.cpp index a37f0f2561..6b855457d8 100644 --- a/Source/Core/UICommon/CommandLineParse.cpp +++ b/Source/Core/UICommon/CommandLineParse.cpp @@ -54,9 +54,8 @@ public: std::optional system = Config::GetSystemFromName(system_str); if (system) { - m_values.emplace_back( - Config::Location{std::move(*system), std::move(section), std::move(key)}, - std::move(value)); + m_values.emplace_back(Config::Location{*system, std::move(section), std::move(key)}, + std::move(value)); } } } diff --git a/Source/Core/VideoBackends/OGL/OGLPipeline.cpp b/Source/Core/VideoBackends/OGL/OGLPipeline.cpp index e2c61264c4..caf981338c 100644 --- a/Source/Core/VideoBackends/OGL/OGLPipeline.cpp +++ b/Source/Core/VideoBackends/OGL/OGLPipeline.cpp @@ -3,6 +3,8 @@ #include "VideoBackends/OGL/OGLPipeline.h" +#include + #include "VideoBackends/OGL/OGLShader.h" #include "VideoBackends/OGL/OGLVertexManager.h" #include "VideoBackends/OGL/ProgramShaderCache.h" @@ -27,12 +29,12 @@ static GLenum MapToGLPrimitive(PrimitiveType primitive_type) } } OGLPipeline::OGLPipeline(const AbstractPipelineConfig& config, const GLVertexFormat* vertex_format, - const RasterizationState& rasterization_state, - const DepthState& depth_state, const BlendingState& blending_state, - PipelineProgram* program, GLuint gl_primitive) + RasterizationState rasterization_state, DepthState depth_state, + BlendingState blending_state, PipelineProgram* program, + GLuint gl_primitive) : AbstractPipeline(config), m_vertex_format(vertex_format), - m_rasterization_state(rasterization_state), m_depth_state(depth_state), - m_blending_state(blending_state), m_program(program), m_gl_primitive(gl_primitive) + m_rasterization_state(std::move(rasterization_state)), m_depth_state(std::move(depth_state)), + m_blending_state(std::move(blending_state)), m_program(program), m_gl_primitive(gl_primitive) { } diff --git a/Source/Core/VideoBackends/OGL/OGLPipeline.h b/Source/Core/VideoBackends/OGL/OGLPipeline.h index f4dddc681c..0f061d790f 100644 --- a/Source/Core/VideoBackends/OGL/OGLPipeline.h +++ b/Source/Core/VideoBackends/OGL/OGLPipeline.h @@ -15,9 +15,8 @@ class OGLPipeline final : public AbstractPipeline { public: explicit OGLPipeline(const AbstractPipelineConfig& config, const GLVertexFormat* vertex_format, - const RasterizationState& rasterization_state, const DepthState& depth_state, - const BlendingState& blending_state, PipelineProgram* program, - GLenum gl_primitive); + RasterizationState rasterization_state, DepthState depth_state, + BlendingState blending_state, PipelineProgram* program, GLenum gl_primitive); ~OGLPipeline() override; const GLVertexFormat* GetVertexFormat() const { return m_vertex_format; } diff --git a/Source/Core/VideoCommon/Assets/CustomAsset.cpp b/Source/Core/VideoCommon/Assets/CustomAsset.cpp index 7e2e817d15..c01fb3b689 100644 --- a/Source/Core/VideoCommon/Assets/CustomAsset.cpp +++ b/Source/Core/VideoCommon/Assets/CustomAsset.cpp @@ -8,8 +8,8 @@ namespace VideoCommon { CustomAsset::CustomAsset(std::shared_ptr library, - const CustomAssetLibrary::AssetID& asset_id, u64 asset_handle) - : m_owning_library(std::move(library)), m_asset_id(asset_id), m_handle(asset_handle) + CustomAssetLibrary::AssetID asset_id, u64 asset_handle) + : m_owning_library(std::move(library)), m_asset_id(std::move(asset_id)), m_handle(asset_handle) { } diff --git a/Source/Core/VideoCommon/Assets/CustomAsset.h b/Source/Core/VideoCommon/Assets/CustomAsset.h index cdf5f14e70..6fe25a7fcf 100644 --- a/Source/Core/VideoCommon/Assets/CustomAsset.h +++ b/Source/Core/VideoCommon/Assets/CustomAsset.h @@ -20,8 +20,8 @@ public: using ClockType = std::chrono::steady_clock; using TimeType = ClockType::time_point; - CustomAsset(std::shared_ptr library, - const CustomAssetLibrary::AssetID& asset_id, u64 session_id); + CustomAsset(std::shared_ptr library, CustomAssetLibrary::AssetID asset_id, + u64 session_id); virtual ~CustomAsset() = default; CustomAsset(const CustomAsset&) = delete; CustomAsset(CustomAsset&&) = delete; diff --git a/Source/Core/VideoCommon/Assets/ShaderAsset.cpp b/Source/Core/VideoCommon/Assets/ShaderAsset.cpp index 04a9139212..d6ec53db6d 100644 --- a/Source/Core/VideoCommon/Assets/ShaderAsset.cpp +++ b/Source/Core/VideoCommon/Assets/ShaderAsset.cpp @@ -116,7 +116,7 @@ static bool ParseShaderValue(const CustomAssetLibrary::AssetID& asset_id, ShaderProperty::RGB rgb; if (!ParseNumeric(asset_id, json_value, code_name, &rgb.value)) return false; - *value = std::move(rgb); + *value = rgb; return true; } else if (type == "rgba") @@ -124,7 +124,7 @@ static bool ParseShaderValue(const CustomAssetLibrary::AssetID& asset_id, ShaderProperty::RGBA rgba; if (!ParseNumeric(asset_id, json_value, code_name, &rgba.value)) return false; - *value = std::move(rgba); + *value = rgba; return true; } else if (type == "bool") diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomPipeline.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomPipeline.cpp index bb09a84328..df8e07469f 100644 --- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomPipeline.cpp +++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomPipeline.cpp @@ -9,8 +9,7 @@ #include "Common/CommonTypes.h" #include "VideoCommon/Assets/CustomAssetLibrary.h" -void CustomPipeline::UpdatePixelData(std::shared_ptr, - std::span, +void CustomPipeline::UpdatePixelData(const VideoCommon::CustomAssetLibrary*, std::span, const VideoCommon::CustomAssetLibrary::AssetID&) { } diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomPipeline.h b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomPipeline.h index 3aa7b6641c..a05a28ea16 100644 --- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomPipeline.h +++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomPipeline.h @@ -11,7 +11,7 @@ struct CustomPipeline { - void UpdatePixelData(std::shared_ptr library, + void UpdatePixelData(const VideoCommon::CustomAssetLibrary* library, std::span texture_units, const VideoCommon::CustomAssetLibrary::AssetID& material_to_load); }; diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomShaderCache.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomShaderCache.cpp index 54b0d786f2..91d4082348 100644 --- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomShaderCache.cpp +++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/CustomShaderCache.cpp @@ -3,6 +3,8 @@ #include "VideoCommon/GraphicsModSystem/Runtime/CustomShaderCache.h" +#include + #include "VideoCommon/AbstractGfx.h" #include "VideoCommon/VideoConfig.h" #include "VideoCommon/VideoEvents.h" @@ -100,11 +102,11 @@ void CustomShaderCache::AsyncCreatePipeline(const VideoCommon::GXPipelineUid& ui class PipelineWorkItem final : public VideoCommon::AsyncShaderCompiler::WorkItem { public: - PipelineWorkItem(CustomShaderCache* shader_cache, const VideoCommon::GXPipelineUid& uid, - const CustomShaderInstance& custom_shaders, PipelineIterator iterator, - const AbstractPipelineConfig& pipeline_config) - : m_shader_cache(shader_cache), m_uid(uid), m_iterator(iterator), m_config(pipeline_config), - m_custom_shaders(custom_shaders) + PipelineWorkItem(CustomShaderCache* shader_cache, VideoCommon::GXPipelineUid uid, + CustomShaderInstance custom_shaders, PipelineIterator iterator, + AbstractPipelineConfig pipeline_config) + : m_shader_cache(shader_cache), m_uid(std::move(uid)), m_iterator(iterator), + m_config(std::move(pipeline_config)), m_custom_shaders(std::move(custom_shaders)) { SetStagesReady(); } @@ -184,11 +186,11 @@ void CustomShaderCache::AsyncCreatePipeline(const VideoCommon::GXUberPipelineUid class PipelineWorkItem final : public VideoCommon::AsyncShaderCompiler::WorkItem { public: - PipelineWorkItem(CustomShaderCache* shader_cache, const VideoCommon::GXUberPipelineUid& uid, - const CustomShaderInstance& custom_shaders, UberPipelineIterator iterator, - const AbstractPipelineConfig& pipeline_config) - : m_shader_cache(shader_cache), m_uid(uid), m_iterator(iterator), m_config(pipeline_config), - m_custom_shaders(custom_shaders) + PipelineWorkItem(CustomShaderCache* shader_cache, VideoCommon::GXUberPipelineUid uid, + CustomShaderInstance custom_shaders, UberPipelineIterator iterator, + AbstractPipelineConfig pipeline_config) + : m_shader_cache(shader_cache), m_uid(std::move(uid)), m_iterator(iterator), + m_config(std::move(pipeline_config)), m_custom_shaders(std::move(custom_shaders)) { SetStagesReady(); } @@ -281,8 +283,9 @@ void CustomShaderCache::QueuePixelShaderCompile(const PixelShaderUid& uid, { public: PixelShaderWorkItem(CustomShaderCache* shader_cache, const PixelShaderUid& uid, - const CustomShaderInstance& custom_shaders, PixelShaderIterator iter) - : m_shader_cache(shader_cache), m_uid(uid), m_custom_shaders(custom_shaders), m_iter(iter) + CustomShaderInstance custom_shaders, PixelShaderIterator iter) + : m_shader_cache(shader_cache), m_uid(uid), m_custom_shaders(std::move(custom_shaders)), + m_iter(iter) { } @@ -319,8 +322,9 @@ void CustomShaderCache::QueuePixelShaderCompile(const UberShader::PixelShaderUid { public: PixelShaderWorkItem(CustomShaderCache* shader_cache, const UberShader::PixelShaderUid& uid, - const CustomShaderInstance& custom_shaders, UberPixelShaderIterator iter) - : m_shader_cache(shader_cache), m_uid(uid), m_custom_shaders(custom_shaders), m_iter(iter) + CustomShaderInstance custom_shaders, UberPixelShaderIterator iter) + : m_shader_cache(shader_cache), m_uid(uid), m_custom_shaders(std::move(custom_shaders)), + m_iter(iter) { } diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp index 5f9cf48d52..c49b655804 100644 --- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp +++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp @@ -247,23 +247,22 @@ void GraphicsModManager::Load(const GraphicsModGroupConfig& config) } } + const auto create_action = + [filesystem_library = std::move(filesystem_library)]( + const std::string_view& action_name, const picojson::value& json_data, + GraphicsModConfig mod_config) -> std::unique_ptr { + auto action = GraphicsModActionFactory::Create(action_name, json_data, filesystem_library); + if (action == nullptr) + { + return nullptr; + } + return std::make_unique(std::move(action), std::move(mod_config)); + }; + for (const auto& mod : mods) { for (const GraphicsModFeatureConfig& feature : mod.m_features) { - const auto create_action = - [filesystem_library](const std::string_view& action_name, - const picojson::value& json_data, - GraphicsModConfig mod_config) -> std::unique_ptr { - auto action = - GraphicsModActionFactory::Create(action_name, json_data, std::move(filesystem_library)); - if (action == nullptr) - { - return nullptr; - } - return std::make_unique(std::move(action), std::move(mod_config)); - }; - const auto internal_group = fmt::format("{}.{}", mod.m_title, feature.m_group); const auto add_target = [&](const GraphicsTargetConfig& target) { diff --git a/Source/Core/VideoCommon/NetPlayGolfUI.cpp b/Source/Core/VideoCommon/NetPlayGolfUI.cpp index d8ada720ad..87b866b348 100644 --- a/Source/Core/VideoCommon/NetPlayGolfUI.cpp +++ b/Source/Core/VideoCommon/NetPlayGolfUI.cpp @@ -3,6 +3,8 @@ #include "VideoCommon/NetPlayGolfUI.h" +#include + #include #include @@ -13,8 +15,8 @@ constexpr float DEFAULT_WINDOW_HEIGHT = 45.0f; std::unique_ptr g_netplay_golf_ui; -NetPlayGolfUI::NetPlayGolfUI(std::shared_ptr netplay_client) - : m_netplay_client{netplay_client} +NetPlayGolfUI::NetPlayGolfUI(std::weak_ptr netplay_client) + : m_netplay_client{std::move(netplay_client)} { } diff --git a/Source/Core/VideoCommon/NetPlayGolfUI.h b/Source/Core/VideoCommon/NetPlayGolfUI.h index d8d69ffe66..fc815a75e9 100644 --- a/Source/Core/VideoCommon/NetPlayGolfUI.h +++ b/Source/Core/VideoCommon/NetPlayGolfUI.h @@ -13,7 +13,7 @@ class NetPlayClient; class NetPlayGolfUI { public: - explicit NetPlayGolfUI(std::shared_ptr netplay_client); + explicit NetPlayGolfUI(std::weak_ptr netplay_client); ~NetPlayGolfUI(); void Display(); diff --git a/Source/Core/VideoCommon/OnScreenDisplay.cpp b/Source/Core/VideoCommon/OnScreenDisplay.cpp index 6f42879c34..8ab5463d3d 100644 --- a/Source/Core/VideoCommon/OnScreenDisplay.cpp +++ b/Source/Core/VideoCommon/OnScreenDisplay.cpp @@ -142,14 +142,14 @@ void AddTypedMessage(MessageType type, std::string message, u32 ms, u32 argb, for (auto it = range.first; it != range.second; ++it) it->second.should_discard = true; - s_messages.emplace(type, Message(std::move(message), ms, argb, std::move(icon))); + s_messages.emplace(type, Message(std::move(message), ms, argb, icon)); } void AddMessage(std::string message, u32 ms, u32 argb, const VideoCommon::CustomTextureData::ArraySlice::Level* icon) { std::lock_guard lock{s_messages_mutex}; - s_messages.emplace(MessageType::Typeless, Message(std::move(message), ms, argb, std::move(icon))); + s_messages.emplace(MessageType::Typeless, Message(std::move(message), ms, argb, icon)); } void DrawMessages() diff --git a/Source/Core/VideoCommon/PerformanceTracker.cpp b/Source/Core/VideoCommon/PerformanceTracker.cpp index 725d6b26e3..3d519865be 100644 --- a/Source/Core/VideoCommon/PerformanceTracker.cpp +++ b/Source/Core/VideoCommon/PerformanceTracker.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include @@ -18,9 +19,9 @@ static constexpr double SAMPLE_RC_RATIO = 0.25; static constexpr u64 MAX_DT_QUEUE_SIZE = 1UL << 12; static constexpr u64 MAX_QUALITY_GRAPH_SIZE = 1UL << 8; -PerformanceTracker::PerformanceTracker(const std::optional log_name, +PerformanceTracker::PerformanceTracker(std::optional log_name, const std::optional
sample_window_duration) - : m_log_name{log_name}, m_sample_window_duration{sample_window_duration} + : m_log_name{std::move(log_name)}, m_sample_window_duration{sample_window_duration} { Reset(); } diff --git a/Source/Core/VideoCommon/PerformanceTracker.h b/Source/Core/VideoCommon/PerformanceTracker.h index 358de676b4..e210a8497c 100644 --- a/Source/Core/VideoCommon/PerformanceTracker.h +++ b/Source/Core/VideoCommon/PerformanceTracker.h @@ -14,7 +14,7 @@ class PerformanceTracker { public: - PerformanceTracker(const std::optional log_name = std::nullopt, + PerformanceTracker(std::optional log_name = std::nullopt, const std::optional
sample_window_duration = std::nullopt); ~PerformanceTracker() = default; diff --git a/Source/Core/VideoCommon/Resources/MaterialResource.cpp b/Source/Core/VideoCommon/Resources/MaterialResource.cpp index d41937d992..ea96cdf5f6 100644 --- a/Source/Core/VideoCommon/Resources/MaterialResource.cpp +++ b/Source/Core/VideoCommon/Resources/MaterialResource.cpp @@ -62,8 +62,8 @@ MaterialResource::MaterialResource(Resource::ResourceContext resource_context) } MaterialResource::MaterialResource(Resource::ResourceContext resource_context, - const GXPipelineUid& pipeline_uid) - : Resource(std::move(resource_context)), m_uid(pipeline_uid) + GXPipelineUid pipeline_uid) + : Resource(std::move(resource_context)), m_uid(std::move(pipeline_uid)) { m_material_asset = m_resource_context.asset_cache->CreateAsset( m_resource_context.primary_asset_id, m_resource_context.asset_library, this); @@ -221,7 +221,7 @@ Resource::TaskComplete MaterialResource::ProcessData() VideoCommon::GXPipelineUid* uid, FramebufferState frame_buffer_state) : m_material_resource_data(std::move(material_resource_data)), m_shader_resource_data(std::move(shader_resource_data)), m_uid(uid), - m_frame_buffer_state(frame_buffer_state) + m_frame_buffer_state(std::move(frame_buffer_state)) { } diff --git a/Source/Core/VideoCommon/Resources/MaterialResource.h b/Source/Core/VideoCommon/Resources/MaterialResource.h index 6f4835927f..9729039d43 100644 --- a/Source/Core/VideoCommon/Resources/MaterialResource.h +++ b/Source/Core/VideoCommon/Resources/MaterialResource.h @@ -29,7 +29,7 @@ class MaterialResource final : public Resource { public: explicit MaterialResource(Resource::ResourceContext resource_context); - MaterialResource(Resource::ResourceContext resource_context, const GXPipelineUid& pipeline_uid); + MaterialResource(Resource::ResourceContext resource_context, GXPipelineUid pipeline_uid); struct TextureLikeReference { diff --git a/Source/Core/VideoCommon/Resources/ShaderResource.cpp b/Source/Core/VideoCommon/Resources/ShaderResource.cpp index 08aa994055..7b77886e2e 100644 --- a/Source/Core/VideoCommon/Resources/ShaderResource.cpp +++ b/Source/Core/VideoCommon/Resources/ShaderResource.cpp @@ -4,6 +4,7 @@ #include "VideoCommon/Resources/ShaderResource.h" #include +#include #include @@ -382,11 +383,11 @@ CompileVertexShader(VertexShaderUid* uid, std::string_view preprocessor_settings } } // namespace ShaderResource::ShaderResource(Resource::ResourceContext resource_context, - const std::optional& pipeline_uid, - const std::string& preprocessor_setting, + std::optional pipeline_uid, + std::string preprocessor_setting, const ShaderHostConfig& shader_host_config) : Resource(std::move(resource_context)), m_shader_host_config{.bits = shader_host_config.bits}, - m_uid(pipeline_uid), m_preprocessor_settings(preprocessor_setting) + m_uid(std::move(pipeline_uid)), m_preprocessor_settings(std::move(preprocessor_setting)) { m_shader_asset = m_resource_context.asset_cache->CreateAsset( m_resource_context.primary_asset_id, m_resource_context.asset_library, this); diff --git a/Source/Core/VideoCommon/Resources/ShaderResource.h b/Source/Core/VideoCommon/Resources/ShaderResource.h index 2f35087aab..1e59a1b11d 100644 --- a/Source/Core/VideoCommon/Resources/ShaderResource.h +++ b/Source/Core/VideoCommon/Resources/ShaderResource.h @@ -18,8 +18,7 @@ class ShaderResource final : public Resource { public: ShaderResource(Resource::ResourceContext resource_context, - const std::optional& pipeline_uid, - const std::string& preprocessor_settings, + std::optional pipeline_uid, std::string preprocessor_setting, const ShaderHostConfig& shader_host_config); class Data diff --git a/Source/Core/VideoCommon/ShaderCache.cpp b/Source/Core/VideoCommon/ShaderCache.cpp index 22a5437046..2627656d0d 100644 --- a/Source/Core/VideoCommon/ShaderCache.cpp +++ b/Source/Core/VideoCommon/ShaderCache.cpp @@ -3,6 +3,8 @@ #include "VideoCommon/ShaderCache.h" +#include + #include #include "Common/Assert.h" @@ -1018,8 +1020,8 @@ void ShaderCache::QueuePipelineCompile(const GXPipelineUid& uid, u32 priority) class PipelineWorkItem final : public AsyncShaderCompiler::WorkItem { public: - PipelineWorkItem(ShaderCache* shader_cache_, const GXPipelineUid& uid_, u32 priority_) - : shader_cache(shader_cache_), uid(uid_), priority(priority_) + PipelineWorkItem(ShaderCache* shader_cache_, GXPipelineUid uid_, u32 priority_) + : shader_cache(shader_cache_), uid(std::move(uid_)), priority(priority_) { // Check if all the stages required for this pipeline have been compiled. // If not, this work item becomes a no-op, and re-queues the pipeline for the next frame. @@ -1090,8 +1092,8 @@ void ShaderCache::QueueUberPipelineCompile(const GXUberPipelineUid& uid, u32 pri class UberPipelineWorkItem final : public AsyncShaderCompiler::WorkItem { public: - UberPipelineWorkItem(ShaderCache* shader_cache_, const GXUberPipelineUid& uid_, u32 priority_) - : shader_cache(shader_cache_), uid(uid_), priority(priority_) + UberPipelineWorkItem(ShaderCache* shader_cache_, GXUberPipelineUid uid_, u32 priority_) + : shader_cache(shader_cache_), uid(std::move(uid_)), priority(priority_) { // Check if all the stages required for this UberPipeline have been compiled. // If not, this work item becomes a no-op, and re-queues the UberPipeline for the next frame. diff --git a/Source/Core/VideoCommon/ShaderCompileUtils.cpp b/Source/Core/VideoCommon/ShaderCompileUtils.cpp index 297d86ea92..ee4adbf46e 100644 --- a/Source/Core/VideoCommon/ShaderCompileUtils.cpp +++ b/Source/Core/VideoCommon/ShaderCompileUtils.cpp @@ -4,14 +4,15 @@ #include "VideoCommon/ShaderCompileUtils.h" #include +#include #include "Common/FileUtil.h" #include "Common/StringUtil.h" namespace VideoCommon { -ShaderIncluder::ShaderIncluder(const std::string& user_path, const std::string& system_path) - : m_root_user_path(user_path), m_root_system_path(system_path) +ShaderIncluder::ShaderIncluder(std::string user_path, std::string system_path) + : m_root_user_path(std::move(user_path)), m_root_system_path(std::move(system_path)) { } diff --git a/Source/Core/VideoCommon/ShaderCompileUtils.h b/Source/Core/VideoCommon/ShaderCompileUtils.h index 0e7c5eed5f..8bccca836c 100644 --- a/Source/Core/VideoCommon/ShaderCompileUtils.h +++ b/Source/Core/VideoCommon/ShaderCompileUtils.h @@ -15,7 +15,7 @@ namespace VideoCommon class ShaderIncluder final : public glslang::TShader::Includer { public: - ShaderIncluder(const std::string& user_path, const std::string& system_path); + ShaderIncluder(std::string user_path, std::string system_path); ~ShaderIncluder() override = default; std::vector GetIncludes() const; diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 6fc13c5fba..8da63bf891 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -657,7 +657,7 @@ void TextureCacheBase::DoSaveState(PointerWrap& p) } } - auto doList = [&p](auto list) { + auto doList = [&p](const auto& list) { u32 list_size = static_cast(list.size()); p.Do(list_size); for (const auto& it : list) diff --git a/Source/UnitTests/Common/x64EmitterTest.cpp b/Source/UnitTests/Common/x64EmitterTest.cpp index ef060e0a93..ede3a731b3 100644 --- a/Source/UnitTests/Common/x64EmitterTest.cpp +++ b/Source/UnitTests/Common/x64EmitterTest.cpp @@ -191,7 +191,7 @@ protected: ResetCodeBuffer(); } - void ExpectBytes(const std::vector expected_bytes) + void ExpectBytes(const std::vector& expected_bytes) { const std::vector code_bytes(code_buffer, emitter->GetWritableCodePtr());