Merge pull request #14565 from SuperSamus/cpp-argument-move-reference

Improve usage of std::move and const references parameters
This commit is contained in:
JosJuice
2026-04-18 21:02:30 +02:00
committed by GitHub
140 changed files with 318 additions and 277 deletions
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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<size_t>(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)
+1 -1
View File
@@ -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(); }
+1 -1
View File
@@ -598,7 +598,7 @@ bool SyncSDFolderToSDImage(const std::function<bool()>& cancelled, bool determin
return true;
}
static bool Unpack(const std::function<bool()>& cancelled, const std::string path,
static bool Unpack(const std::function<bool()>& cancelled, const std::string& path,
bool is_directory, const char* name, std::vector<u8>& tmp_buffer)
{
if (cancelled())
+2 -2
View File
@@ -71,13 +71,13 @@ std::vector<std::string> DoFileSearch(std::span<const std::string_view> 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);
}
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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);
+4 -2
View File
@@ -8,6 +8,7 @@
#include <iomanip>
#include <ios>
#include <sstream>
#include <utility>
#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<u32>(s_max_length, u32(m_name.length()));
+1 -1
View File
@@ -14,7 +14,7 @@ namespace Common
class Profiler
{
public:
Profiler(const std::string& name);
Profiler(std::string name);
~Profiler();
static std::string ToString();
+3 -2
View File
@@ -5,6 +5,7 @@
#include <cstddef>
#include <cstring>
#include <string>
#include <utility>
#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;
+1 -2
View File
@@ -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;
+1 -1
View File
@@ -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())
+2 -2
View File
@@ -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
+2 -2
View File
@@ -270,7 +270,7 @@ std::unique_ptr<BootParameters> BootParameters::GenerateFromFile(std::vector<std
if (extension == ".wad")
{
std::unique_ptr<DiscIO::VolumeWAD> wad = DiscIO::CreateWAD(std::move(path));
std::unique_ptr<DiscIO::VolumeWAD> wad = DiscIO::CreateWAD(path);
if (wad)
return std::make_unique<BootParameters>(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<void(StateFlags*)> update_function)
void UpdateStateFlags(const std::function<void(StateFlags*)>& update_function)
{
CreateSystemMenuTitleDirs();
const std::string file_path = Common::GetTitleDataPath(Titles::SYSTEM_MENU) + "/" WII_STATE;
+1 -1
View File
@@ -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<void(StateFlags*)> update_function);
void UpdateStateFlags(const std::function<void(StateFlags*)>& update_function);
/// Create title directories for the system menu (if needed).
///
@@ -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)
@@ -4,6 +4,7 @@
#include "Core/ConfigLoaders/NetPlayConfigLoader.h"
#include <memory>
#include <utility>
#include <fmt/format.h>
@@ -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))
{
}
+1 -1
View File
@@ -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);
+5 -5
View File
@@ -183,7 +183,7 @@ void RSOSectionsView::Load(const Core::CPUThreadGuard& guard, u32 address, std::
RSOSection section;
section.offset = PowerPC::MMU::HostRead<u32>(guard, address);
section.size = PowerPC::MMU::HostRead<u32>(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<u32>(guard, address);
rso_import.code_offset = PowerPC::MMU::HostRead<u32>(guard, address + 4);
rso_import.entry_offset = PowerPC::MMU::HostRead<u32>(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<u32>(guard, address + 4);
rso_export.section_index = PowerPC::MMU::HostRead<u32>(guard, address + 8);
rso_export.hash = PowerPC::MMU::HostRead<u32>(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<u32>(guard, address);
entry.r_info = PowerPC::MMU::HostRead<u32>(guard, address + 4);
entry.r_addend = PowerPC::MMU::HostRead<u32>(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<u32>(guard, address);
entry.r_info = PowerPC::MMU::HostRead<u32>(guard, address + 4);
entry.r_addend = PowerPC::MMU::HostRead<u32>(guard, address + 8);
m_entries.emplace_back(std::move(entry));
m_entries.emplace_back(entry);
address += sizeof(RSOExternalsEntry);
}
}
+2 -2
View File
@@ -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)
+1 -1
View File
@@ -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 <typename T>
+2 -1
View File
@@ -5,6 +5,7 @@
#include <algorithm>
#include <cstring>
#include <utility>
#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) {
+2 -2
View File
@@ -15,10 +15,10 @@
namespace Gecko
{
std::expected<std::vector<GeckoCode>, int> DownloadCodes(std::string gametdb_id)
std::expected<std::vector<GeckoCode>, 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.
+1 -1
View File
@@ -19,7 +19,7 @@ class IniFile;
namespace Gecko
{
std::vector<GeckoCode> LoadCodes(const Common::IniFile& globalIni, const Common::IniFile& localIni);
std::expected<std::vector<GeckoCode>, int> DownloadCodes(std::string gametdb_id);
std::expected<std::vector<GeckoCode>, int> DownloadCodes(std::string_view gametdb_id);
void SaveCodes(Common::IniFile& inifile, std::span<const GeckoCode> gcodes);
std::optional<GeckoCode::Code> DeserializeLine(const std::string& line);
@@ -4,6 +4,7 @@
#include <cstdlib>
#include <cstring>
#include <optional>
#include <utility>
#ifdef _WIN32
#include <winsock2.h>
@@ -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<void(std::string&&)> 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)
{
}
@@ -19,8 +19,7 @@ class TAPServerConnection
public:
using RecvCallback = std::function<void(std::string&&)>;
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();
+3 -2
View File
@@ -4,14 +4,15 @@
#include "Core/HW/EXI/EXI_DeviceDummy.h"
#include <string>
#include <utility>
#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)}
{
}
+1 -1
View File
@@ -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;
@@ -55,7 +55,7 @@ static Common::EnumMap<char, MAX_MEMCARD_SLOT> 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<void(CEXIMemoryCard*)> callback)
const std::function<void(CEXIMemoryCard*)>& callback)
{
Slot card_slot = static_cast<Slot>(userdata);
IEXIDevice* self = system.GetExpansionInterface().GetDevice(card_slot);
@@ -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<void(CEXIMemoryCard*)> callback);
const std::function<void(CEXIMemoryCard*)>& callback);
// Scheduled when a command that required delayed end signaling is done.
static void CmdDoneCallback(Core::System& system, u64 userdata, s64 cyclesLate);
@@ -9,6 +9,7 @@
#include <mutex>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include <fmt/format.h>
@@ -176,11 +177,11 @@ std::vector<std::string> 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
{
@@ -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;
@@ -9,6 +9,7 @@
#include <mutex>
#include <string>
#include <thread>
#include <utility>
#include <fmt/format.h>
@@ -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)
+1 -1
View File
@@ -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();
+5 -4
View File
@@ -4,6 +4,7 @@
#include "Core/HW/MMIO.h"
#include <functional>
#include <utility>
#include "Common/Assert.h"
#include "Common/CommonTypes.h"
@@ -113,12 +114,12 @@ class ComplexHandlingMethod : public ReadHandlingMethod<T>, public WriteHandling
{
public:
explicit ComplexHandlingMethod(std::function<T(Core::System&, u32)> read_lambda)
: read_lambda_(read_lambda), write_lambda_(InvalidWriteLambda())
: read_lambda_(std::move(read_lambda)), write_lambda_(InvalidWriteLambda())
{
}
explicit ComplexHandlingMethod(std::function<void(Core::System&, u32, T)> write_lambda)
: read_lambda_(InvalidReadLambda()), write_lambda_(write_lambda)
: read_lambda_(InvalidReadLambda()), write_lambda_(std::move(write_lambda))
{
}
@@ -159,12 +160,12 @@ private:
template <typename T>
ReadHandlingMethod<T>* ComplexRead(std::function<T(Core::System&, u32)> lambda)
{
return new ComplexHandlingMethod<T>(lambda);
return new ComplexHandlingMethod<T>(std::move(lambda));
}
template <typename T>
WriteHandlingMethod<T>* ComplexWrite(std::function<void(Core::System&, u32, T)> lambda)
{
return new ComplexHandlingMethod<T>(lambda);
return new ComplexHandlingMethod<T>(std::move(lambda));
}
// Invalid: specialization of the complex handling type with lambdas that
+2 -2
View File
@@ -126,7 +126,7 @@ public:
Md5 md5_calc;
mbedtls_md5_ret(reinterpret_cast<const u8*>(&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<bool()> can_overwrite)
CopyResult Import(const std::string& data_bin_path, const std::function<bool()>& can_overwrite)
{
IOS::HLE::Kernel ios;
const auto data_bin = MakeDataBinStorage(&ios.GetIOSC(), data_bin_path, "rb");
+1 -1
View File
@@ -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<bool()> can_overwrite);
CopyResult Import(const std::string& data_bin_path, const std::function<bool()>& 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.
+3 -2
View File
@@ -5,6 +5,7 @@
#include <algorithm>
#include <map>
#include <utility>
#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)
{
}
+1 -1
View File
@@ -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);
+5 -5
View File
@@ -9,6 +9,7 @@
#include <string_view>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <fmt/format.h>
@@ -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<NandRedirect> nand_redirects)
: m_root_path{root_path}, m_nand_redirects(std::move(nand_redirects))
HostFileSystem::HostFileSystem(std::string root_path, std::vector<NandRedirect> 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);
+3 -3
View File
@@ -22,7 +22,7 @@ namespace IOS::HLE::FS
class HostFileSystem final : public FileSystem
{
public:
HostFileSystem(const std::string& root_path, std::vector<NandRedirect> nand_redirects = {});
HostFileSystem(std::string root_path, std::vector<NandRedirect> nand_redirects = {});
~HostFileSystem() override;
void DoState(PointerWrap& p) override;
@@ -60,8 +60,8 @@ public:
void SetNandRedirects(std::vector<NandRedirect> 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
{
+1 -1
View File
@@ -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);
@@ -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);
+2 -2
View File
@@ -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;
+2 -2
View File
@@ -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;
@@ -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
@@ -38,7 +38,7 @@ public:
using SampleType = s16;
using UnsignedSampleType = std::make_unsigned_t<SampleType>;
Microphone(const MicrophoneState& sampler, const std::string& worker_name);
Microphone(const MicrophoneState& sampler, std::string worker_name);
virtual ~Microphone();
void Initialize();
+4 -3
View File
@@ -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<IPCReply> USBHost::HandleTransfer(std::shared_ptr<USB::Device> device, u32 request,
std::function<s32()> submit) const
std::optional<IPCReply> USBHost::HandleTransfer(const std::shared_ptr<USB::Device>& device,
u32 request,
const std::function<s32()>& submit) const
{
if (!device)
return IPCReply(IPC_ENOENT);
+2 -2
View File
@@ -46,8 +46,8 @@ protected:
virtual void OnDeviceChangeEnd();
virtual bool ShouldAddDevice(const USB::Device& device) const;
std::optional<IPCReply> HandleTransfer(std::shared_ptr<USB::Device> device, u32 request,
std::function<s32()> submit) const;
std::optional<IPCReply> HandleTransfer(const std::shared_ptr<USB::Device>& device, u32 request,
const std::function<s32()>& submit) const;
std::map<u64, std::shared_ptr<USB::Device>> m_devices;
mutable std::recursive_mutex m_devices_mutex;
+2 -2
View File
@@ -476,8 +476,8 @@ void LibusbDevice::TransferEndpoint::AddTransfer(std::unique_ptr<TransferCommand
m_transfers.emplace(transfer, std::move(command));
}
void LibusbDevice::TransferEndpoint::HandleTransfer(libusb_transfer* transfer,
std::function<s32(const TransferCommand&)> fn)
void LibusbDevice::TransferEndpoint::HandleTransfer(
libusb_transfer* transfer, const std::function<s32(const TransferCommand&)>& fn)
{
std::lock_guard lk{m_transfers_mutex};
const auto iterator = m_transfers.find(transfer);
+2 -1
View File
@@ -60,7 +60,8 @@ private:
{
public:
void AddTransfer(std::unique_ptr<TransferCommand> command, libusb_transfer* transfer);
void HandleTransfer(libusb_transfer* tr, std::function<s32(const TransferCommand&)> function);
void HandleTransfer(libusb_transfer* tr,
const std::function<s32(const TransferCommand&)>& function);
void CancelTransfers();
private:
+1 -1
View File
@@ -192,7 +192,7 @@ IPCReply USBV5ResourceManager::SuspendResume(USBV5Device& device, const IOCtlReq
}
std::optional<IPCReply> USBV5ResourceManager::HandleDeviceIOCtl(const IOCtlRequest& request,
Handler handler)
const Handler& handler)
{
if (request.buffer_in == 0 || request.buffer_in_size != 0x20)
return IPCReply(IPC_EINVAL);
+1 -1
View File
@@ -82,7 +82,7 @@ protected:
IPCReply SuspendResume(USBV5Device& device, const IOCtlRequest& request);
using Handler = std::function<std::optional<IPCReply>(USBV5Device&)>;
std::optional<IPCReply> HandleDeviceIOCtl(const IOCtlRequest& request, Handler handler);
std::optional<IPCReply> HandleDeviceIOCtl(const IOCtlRequest& request, const Handler& handler);
IPCReply GetUSBVersion(const IOCtlRequest& request) const;
void OnDeviceChange(ChangeEvent event, std::shared_ptr<USB::Device> device) override;
+3 -3
View File
@@ -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<int, ConfigDescriptor> MakeConfigDescriptor(libusb_device* device, u8 config_num)
+1 -1
View File
@@ -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;
+5 -3
View File
@@ -14,6 +14,7 @@
#include <thread>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>
#include <fmt/format.h>
@@ -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<bool(int)> report_progress)
static std::string SHA1Sum(const std::string& file_path,
const std::function<bool(int)>& report_progress)
{
std::vector<u8> data(8 * 1024 * 1024);
u64 read_offset = 0;
+2 -2
View File
@@ -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<const Player*> GetPlayers();
+1 -1
View File
@@ -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),
@@ -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;
}
@@ -113,7 +113,7 @@ JitBlock** JitBaseBlockCache::GetFastBlockMapFallback()
}
void JitBaseBlockCache::RunOnBlocks(const Core::CPUThreadGuard&,
std::function<void(const JitBlock&)> f) const
const std::function<void(const JitBlock&)>& f) const
{
for (const auto& e : block_map)
f(e.second);
@@ -162,7 +162,8 @@ public:
// Code Cache
u8** GetEntryPoints();
JitBlock** GetFastBlockMapFallback();
void RunOnBlocks(const Core::CPUThreadGuard& guard, std::function<void(const JitBlock&)> f) const;
void RunOnBlocks(const Core::CPUThreadGuard& guard,
const std::function<void(const JitBlock&)>& f) const;
void WipeBlockProfilingData(const Core::CPUThreadGuard& guard);
std::size_t GetBlockCount() const { return block_map.size(); }
+2 -2
View File
@@ -195,10 +195,10 @@ void JitInterface::WipeBlockProfilingData(const Core::CPUThreadGuard& guard)
}
void JitInterface::RunOnBlocks(const Core::CPUThreadGuard& guard,
std::function<void(const JitBlock&)> f) const
const std::function<void(const JitBlock&)>& 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
+2 -1
View File
@@ -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<void(const JitBlock&)> f) const;
void RunOnBlocks(const Core::CPUThreadGuard& guard,
const std::function<void(const JitBlock&)>& f) const;
std::size_t GetBlockCount() const;
// Memory Utilities
+9 -9
View File
@@ -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)
{
+3 -3
View File
@@ -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))
{
}
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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<u64> m_block_pointers;
+2 -2
View File
@@ -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<bool> is_wii)
: m_root_directory(root_directory)
: m_root_directory(std::move(root_directory))
{
std::vector<u8> disc_header(DISCHEADER_SIZE);
if (ReadFileToVector(m_root_directory + "sys/boot.bin", &disc_header) < 0x20)
+1 -1
View File
@@ -176,7 +176,7 @@ class DirectoryBlobPartition
{
public:
DirectoryBlobPartition() = default;
DirectoryBlobPartition(const std::string& root_directory, std::optional<bool> is_wii);
DirectoryBlobPartition(std::string root_directory, std::optional<bool> is_wii);
DirectoryBlobPartition(
VolumeDisc* volume, const Partition& partition, std::optional<bool> is_wii,
const std::function<void(std::vector<FSTBuilderNode>* fst_nodes)>& sys_callback,
@@ -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)
@@ -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:
@@ -3,6 +3,8 @@
#include "DolphinQt/Config/CheatWarningWidget.h"
#include <utility>
#include <QHBoxLayout>
#include <QLabel>
#include <QPixmap>
@@ -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();
@@ -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();
@@ -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)
{
@@ -109,7 +109,7 @@ class ConfigComplexChoice final : public ToolTipComboBox
using OptionVariant = std::variant<Config::DefaultState, u32, int, bool>;
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);
@@ -101,7 +101,8 @@ void VerifyWidget::CreateWidgets()
m_verify_button = new QPushButton(tr("Verify Integrity"), this);
}
std::pair<QCheckBox*, QLineEdit*> VerifyWidget::AddHashLine(QFormLayout* layout, QString text)
std::pair<QCheckBox*, QLineEdit*> 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);
+2 -2
View File
@@ -32,13 +32,13 @@ public:
private:
void OnEmulationStateChanged(Core::State state);
void CreateWidgets();
std::pair<QCheckBox*, QLineEdit*> AddHashLine(QFormLayout* layout, QString text);
std::pair<QCheckBox*, QLineEdit*> 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<DiscIO::Volume> m_volume;
QTableWidget* m_problems;
@@ -9,6 +9,7 @@
#include <QToolTip>
#include <filesystem>
#include <utility>
#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())
@@ -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; }
@@ -5,6 +5,8 @@
#include "Common/Assembler/GekkoParser.h"
#include <utility>
#include <QLabel>
#include <QPalette>
@@ -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;
@@ -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<u64()> get_reg, std::function<void(u64)> set_reg)
void RegisterWidget::AddRegister(int row, int column, RegisterType type,
const std::string& register_name, std::function<u64()> get_reg,
std::function<void(u64)> set_reg)
{
auto* value = new RegisterColumn(type, std::move(get_reg), std::move(set_reg));
@@ -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<u64()> get_reg, std::function<void(u64)> set_reg);
void AutoStep(const std::string& reg) const;
@@ -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();
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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());
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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<const UICommon::GameFile> game_file);
void SelectionChanged(const std::shared_ptr<const UICommon::GameFile>& game_file);
void OpenGeneralSettings();
void OpenGraphicsSettings();
#ifdef USE_RETRO_ACHIEVEMENTS
@@ -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();
}
+1 -1
View File
@@ -76,7 +76,7 @@ void Host::SetMainWindowHandle(void* handle)
m_main_window_handle = handle;
}
static void RunWithGPUThreadInactive(std::function<void()> f)
static void RunWithGPUThreadInactive(const std::function<void()>& 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
@@ -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();
@@ -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);
+3 -2
View File
@@ -22,6 +22,7 @@
#include <future>
#include <optional>
#include <utility>
#include <variant>
#if defined(__unix__) || defined(__unix) || defined(__APPLE__)
@@ -201,7 +202,7 @@ static WindowSystemInfo GetWindowSystemInfo(QWindow* window)
return wsi;
}
static std::vector<std::string> StringListToStdVector(QStringList list)
static std::vector<std::string> StringListToStdVector(const QStringList& list)
{
std::vector<std::string> 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); };
+1 -1
View File
@@ -1419,7 +1419,7 @@ void MenuBar::NANDExtractCertificates()
}
}
void MenuBar::OnSelectionChanged(std::shared_ptr<const UICommon::GameFile> game_file)
void MenuBar::OnSelectionChanged(const std::shared_ptr<const UICommon::GameFile>& game_file)
{
m_game_selected = !!game_file;
+2 -2
View File
@@ -131,7 +131,7 @@ signals:
void ExportRecording();
void ShowTASInput();
void SelectionChanged(std::shared_ptr<const UICommon::GameFile> game_file);
void SelectionChanged(const std::shared_ptr<const UICommon::GameFile>& 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<const UICommon::GameFile> game_file);
void OnSelectionChanged(const std::shared_ptr<const UICommon::GameFile>& game_file);
void OnRecordingStatusChanged(bool recording);
void OnReadOnlyModeChanged(bool read_only);
void OnDebugModeToggled(bool enabled);
@@ -23,6 +23,7 @@
#include <QTextBrowser>
#include <algorithm>
#include <utility>
#ifdef HAS_LIBMGBA
#include <fmt/ranges.h>
@@ -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;
@@ -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);
+2 -2
View File
@@ -552,7 +552,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)
{
@@ -851,7 +851,7 @@ void Settings::RefreshWidgetVisibility()
emit GameCountVisibilityChanged(IsGameCountVisible());
}
void Settings::SetDebugFont(QFont font)
void Settings::SetDebugFont(const QFont& font)
{
if (GetDebugFont() != font)
{
+2 -2
View File
@@ -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;
@@ -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<u32>(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<u32>(date_time.toSecsSinceEpoch()));
Update();
});
}
void AdvancedPane::Update()
+3 -3
View File
@@ -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<ControlState> scale)
const QKeySequence& shortcut_key_sequence, Qt::Orientation orientation,
QWidget* shortcut_widget, std::optional<ControlState> 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)
{

Some files were not shown because too many files have changed in this diff Show More