Compare commits

...

2 Commits

Author SHA1 Message Date
germanaizek
a49f1f5765 Added std::string_view and const ref, push/insert -> emplace, lower scope code 2022-04-26 18:21:27 +03:00
germanaizek
0ca29f1e54 Using std::move, remove unused vars, better use '= default;' 2022-04-26 18:19:03 +03:00
41 changed files with 78 additions and 78 deletions

View File

@@ -135,7 +135,7 @@ void Fiber::YieldTo(std::weak_ptr<Fiber> weak_from, Fiber& to) {
}
std::shared_ptr<Fiber> Fiber::ThreadToFiber() {
std::shared_ptr<Fiber> fiber = std::shared_ptr<Fiber>{new Fiber()};
auto fiber = std::make_shared<Fiber>();
fiber->impl->guard.lock();
fiber->impl->is_thread_fiber = true;
return fiber;

View File

@@ -120,7 +120,7 @@ private:
// and a pointer to the next ElementPtr
class ElementPtr {
public:
ElementPtr() {}
ElementPtr() = default;
~ElementPtr() {
ElementPtr* next_ptr = next.load();

View File

@@ -717,7 +717,6 @@ InstallResult RegisteredCache::RawInstallNCA(const NCA& nca, const VfsCopyFuncti
bool overwrite_if_exists,
std::optional<NcaID> override_id) {
const auto in = nca.GetBaseFile();
Core::Crypto::SHA256Hash hash{};
// Calculate NcaID
// NOTE: Because computing the SHA256 of an entire NCA is quite expensive (especially if the
@@ -727,6 +726,7 @@ InstallResult RegisteredCache::RawInstallNCA(const NCA& nca, const VfsCopyFuncti
if (override_id) {
id = *override_id;
} else {
Core::Crypto::SHA256Hash hash{};
const auto& data = in->ReadBytes(0x100000);
mbedtls_sha256_ret(data.data(), data.size(), hash.data(), 0);
memcpy(id.data(), hash.data(), 16);

View File

@@ -21,8 +21,8 @@ void DefaultErrorApplet::ShowErrorWithTimestamp(ResultCode error, std::chrono::s
error.module.Value(), error.description.Value(), error.raw, time.count());
}
void DefaultErrorApplet::ShowCustomErrorText(ResultCode error, std::string main_text,
std::string detail_text,
void DefaultErrorApplet::ShowCustomErrorText(ResultCode error, std::string_view main_text,
std::string_view detail_text,
std::function<void()> finished) const {
LOG_CRITICAL(Service_Fatal,
"Application requested custom error with error_code={:04X}-{:04X} (raw={:08X})",

View File

@@ -19,8 +19,8 @@ public:
virtual void ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time,
std::function<void()> finished) const = 0;
virtual void ShowCustomErrorText(ResultCode error, std::string dialog_text,
std::string fullscreen_text,
virtual void ShowCustomErrorText(ResultCode error, std::string_view dialog_text,
std::string_view fullscreen_text,
std::function<void()> finished) const = 0;
};
@@ -29,7 +29,8 @@ public:
void ShowError(ResultCode error, std::function<void()> finished) const override;
void ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time,
std::function<void()> finished) const override;
void ShowCustomErrorText(ResultCode error, std::string main_text, std::string detail_text,
void ShowCustomErrorText(ResultCode error, std::string_view main_text,
std::string_view detail_text,
std::function<void()> finished) const override;
};

View File

@@ -91,7 +91,6 @@ void MotionInput::UpdateOrientation(u64 elapsed_time) {
return;
}
const auto normal_accel = accel.Normalized();
auto rad_gyro = gyro * Common::PI * 2;
const f32 swap = rad_gyro.x;
rad_gyro.x = rad_gyro.y;
@@ -107,6 +106,7 @@ void MotionInput::UpdateOrientation(u64 elapsed_time) {
// Ignore drift correction if acceleration is not reliable
if (accel.Length() >= 0.75f && accel.Length() <= 1.25f) {
const auto normal_accel = accel.Normalized();
const f32 ax = -normal_accel.x;
const f32 ay = normal_accel.y;
const f32 az = -normal_accel.z;

View File

@@ -85,11 +85,11 @@ void KMemoryBlockManager::Update(VAddr addr, std::size_t num_pages, KMemoryState
iterator new_node{node};
if (addr > cur_addr) {
memory_block_tree.insert(node, block->Split(addr));
memory_block_tree.emplace(node, block->Split(addr));
}
if (update_end_addr < cur_end_addr) {
new_node = memory_block_tree.insert(node, block->Split(update_end_addr));
new_node = memory_block_tree.emplace(node, block->Split(update_end_addr));
}
new_node->Update(state, perm, attribute);
@@ -120,11 +120,11 @@ void KMemoryBlockManager::Update(VAddr addr, std::size_t num_pages, KMemoryState
iterator new_node{node};
if (addr > cur_addr) {
memory_block_tree.insert(node, block->Split(addr));
memory_block_tree.emplace(node, block->Split(addr));
}
if (update_end_addr < cur_end_addr) {
new_node = memory_block_tree.insert(node, block->Split(update_end_addr));
new_node = memory_block_tree.emplace(node, block->Split(update_end_addr));
}
new_node->Update(state, perm, attribute);
@@ -155,11 +155,11 @@ void KMemoryBlockManager::UpdateLock(VAddr addr, std::size_t num_pages, LockFunc
iterator new_node{node};
if (addr > cur_addr) {
memory_block_tree.insert(node, block->Split(addr));
memory_block_tree.emplace(node, block->Split(addr));
}
if (update_end_addr < cur_end_addr) {
new_node = memory_block_tree.insert(node, block->Split(update_end_addr));
new_node = memory_block_tree.emplace(node, block->Split(update_end_addr));
}
lock_func(new_node, perm);

View File

@@ -35,7 +35,7 @@ void KServerSession::Initialize(KSession* parent_session_, std::string&& name_,
name = std::move(name_);
if (manager_) {
manager = manager_;
manager = std::move(manager_);
} else {
manager = std::make_shared<SessionRequestManager>(kernel);
}

View File

@@ -67,7 +67,7 @@ private:
public:
KAutoObjectWithSlabHeapAndContainer(KernelCore& kernel_) : Base(kernel_), kernel(kernel_) {}
virtual ~KAutoObjectWithSlabHeapAndContainer() {}
virtual ~KAutoObjectWithSlabHeapAndContainer() = default;
virtual void Destroy() override {
const bool is_initialized = this->IsInitialized();

View File

@@ -187,9 +187,9 @@ ResultCode VfsDirectoryServiceWrapper::RenameDirectory(const std::string& src_pa
const std::string& dest_path_) const {
std::string src_path(Common::FS::SanitizePath(src_path_));
std::string dest_path(Common::FS::SanitizePath(dest_path_));
auto src = GetDirectoryRelativeWrapped(backing, src_path);
if (Common::FS::GetParentPath(src_path) == Common::FS::GetParentPath(dest_path)) {
// Use more-optimized vfs implementation rename.
auto src = GetDirectoryRelativeWrapped(backing, src_path);
if (src == nullptr)
return FileSys::ERROR_PATH_NOT_FOUND;
if (!src->Rename(Common::FS::GetFilename(dest_path))) {
@@ -772,10 +772,10 @@ void FileSystemController::CreateFactories(FileSys::VfsFilesystem& vfs, bool ove
vfs.OpenDirectory(Common::FS::GetYuzuPathString(YuzuPath::LoadDir), FileSys::Mode::Read);
auto sd_load_directory =
vfs.OpenDirectory(Common::FS::PathToUTF8String(sdmc_load_dir_path), FileSys::Mode::Read);
auto dump_directory =
vfs.OpenDirectory(Common::FS::GetYuzuPathString(YuzuPath::DumpDir), rw_mode);
if (bis_factory == nullptr) {
auto dump_directory =
vfs.OpenDirectory(Common::FS::GetYuzuPathString(YuzuPath::DumpDir), rw_mode);
bis_factory = std::make_unique<FileSys::BISFactory>(
nand_directory, std::move(load_directory), std::move(dump_directory));
system.RegisterContentProvider(FileSys::ContentProviderUnionSlot::SysNAND,

View File

@@ -409,7 +409,7 @@ void DynarmicCallbacks64::InterpreterFallback(u64 pc, size_t num_instructions) {
JITContext::JITContext(Core::Memory::Memory& memory)
: impl{std::make_unique<JITContextImpl>(memory)} {}
JITContext::~JITContext() {}
JITContext::~JITContext() = default;
bool JITContext::LoadNRO(std::span<const u8> data) {
return impl->LoadNRO(data);

View File

@@ -122,7 +122,7 @@ struct PL_U::Impl {
// Derive key withing inverse xor
const u32 KEY = GetU32Swapped(input.data() + cur_offset) ^ EXPECTED_MAGIC;
const u32 SIZE = GetU32Swapped(input.data() + cur_offset + 4) ^ KEY;
shared_font_regions.push_back(FontRegion{cur_offset + 8, SIZE});
shared_font_regions.emplace_back(cur_offset + 8, SIZE);
cur_offset += SIZE + 8;
}
}

View File

@@ -11,7 +11,7 @@ namespace Service::NVFlinger {
HosBinderDriverServer::HosBinderDriverServer(Core::System& system_)
: service_context(system_, "HosBinderDriverServer") {}
HosBinderDriverServer::~HosBinderDriverServer() {}
HosBinderDriverServer::~HosBinderDriverServer() = default;
u64 HosBinderDriverServer::RegisterProducer(std::unique_ptr<android::IBinder>&& binder) {
std::scoped_lock lk{lock};

View File

@@ -22,7 +22,7 @@ struct SteadyClockTimePoint {
s64 time_point;
Common::UUID clock_source_id;
ResultCode GetSpanBetween(SteadyClockTimePoint other, s64& span) const {
ResultCode GetSpanBetween(const SteadyClockTimePoint& other, s64& span) const {
span = 0;
if (clock_source_id != other.clock_source_id) {

View File

@@ -36,7 +36,7 @@ public:
return auto_correction_enabled;
}
void SetAutomaticCorrectionUpdatedTime(SteadyClockTimePoint steady_clock_time_point) {
void SetAutomaticCorrectionUpdatedTime(const SteadyClockTimePoint& steady_clock_time_point) {
auto_correction_time = steady_clock_time_point;
}

View File

@@ -797,7 +797,6 @@ AnalogMapping SDLDriver::GetAnalogMappingForDevice(const Common::ParamPackage& p
return {};
}
const auto joystick = GetSDLJoystickByGUID(params.Get("guid", ""), params.Get("port", 0));
const auto joystick2 = GetSDLJoystickByGUID(params.Get("guid2", ""), params.Get("port", 0));
auto* controller = joystick->GetSDLGameController();
if (controller == nullptr) {
return {};
@@ -809,6 +808,7 @@ AnalogMapping SDLDriver::GetAnalogMappingForDevice(const Common::ParamPackage& p
const auto& binding_left_y =
SDL_GameControllerGetBindForAxis(controller, SDL_CONTROLLER_AXIS_LEFTY);
if (params.Has("guid2")) {
const auto joystick2 = GetSDLJoystickByGUID(params.Get("guid2", ""), params.Get("port", 0));
const auto identifier = joystick2->GetPadIdentifier();
PreSetController(identifier);
PreSetAxis(identifier, binding_left_x.value.axis);
@@ -853,7 +853,6 @@ MotionMapping SDLDriver::GetMotionMappingForDevice(const Common::ParamPackage& p
return {};
}
const auto joystick = GetSDLJoystickByGUID(params.Get("guid", ""), params.Get("port", 0));
const auto joystick2 = GetSDLJoystickByGUID(params.Get("guid2", ""), params.Get("port", 0));
auto* controller = joystick->GetSDLGameController();
if (controller == nullptr) {
return {};
@@ -867,6 +866,7 @@ MotionMapping SDLDriver::GetMotionMappingForDevice(const Common::ParamPackage& p
BuildMotionParam(joystick->GetPort(), joystick->GetGUID()));
}
if (params.Has("guid2")) {
const auto joystick2 = GetSDLJoystickByGUID(params.Get("guid2", ""), params.Get("port", 0));
joystick2->EnableMotion();
if (joystick2->HasGyro() || joystick2->HasAccel()) {
mapping.insert_or_assign(Settings::NativeMotion::MotionLeft,

View File

@@ -50,11 +50,11 @@ public:
}
void UpdateButtonStatus(const Common::Input::CallbackStatus& button_callback) {
const Common::Input::CallbackStatus status{
.type = Common::Input::InputType::Touch,
.touch_status = GetStatus(button_callback.button_status.value),
};
if (last_button_value != button_callback.button_status.value) {
const Common::Input::CallbackStatus status{
.type = Common::Input::InputType::Touch,
.touch_status = GetStatus(button_callback.button_status.value),
};
last_button_value = button_callback.button_status.value;
TriggerOnChange(status);
}

View File

@@ -268,7 +268,6 @@ void EmitImageSampleExplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Valu
const auto info{inst.Flags<IR::TextureInstInfo>()};
const auto sparse_inst{PrepareSparse(inst)};
const std::string_view sparse_mod{sparse_inst ? ".SPARSE" : ""};
const std::string_view type{TextureType(info)};
const std::string texture{Texture(ctx, info, index)};
const std::string offset_vec{Offset(ctx, offset)};
const auto [coord_vec, coord_alloc]{Coord(ctx, coord)};
@@ -277,6 +276,7 @@ void EmitImageSampleExplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Valu
ctx.Add("TXL.F{} {},{},{},{},ARRAYCUBE{};", sparse_mod, ret, coord_vec, lod, texture,
offset_vec);
} else {
const std::string_view type{TextureType(info)};
ctx.Add("MOV.F {}.w,{};"
"TXL.F{} {},{},{},{}{};",
coord_vec, lod, sparse_mod, ret, coord_vec, texture, type, offset_vec);

View File

@@ -60,15 +60,14 @@ void GetCbuf(EmitContext& ctx, std::string_view ret, const IR::Value& binding,
const auto offset_var{ctx.var_alloc.Consume(offset)};
const auto index{is_immediate ? fmt::format("{}", offset.U32() / 16)
: fmt::format("{}>>4", offset_var)};
const auto swizzle{is_immediate ? fmt::format(".{}", OffsetSwizzle(offset.U32()))
: fmt::format("[({}>>2)%4]", offset_var)};
const auto cbuf{ChooseCbuf(ctx, binding, index)};
const auto cbuf_cast{fmt::format("{}({}{{}})", cast, cbuf)};
const auto extraction{num_bits == 32 ? cbuf_cast
: fmt::format("bitfieldExtract({},int({}),{})", cbuf_cast,
bit_offset, num_bits)};
if (!component_indexing_bug) {
const auto swizzle{is_immediate ? fmt::format(".{}", OffsetSwizzle(offset.U32()))
: fmt::format("[({}>>2)%4]", offset_var)};
const auto result{fmt::format(fmt::runtime(extraction), swizzle)};
ctx.Add("{}={};", ret, result);
return;

View File

@@ -226,7 +226,6 @@ Id Emit(MethodPtrType sparse_ptr, MethodPtrType non_sparse_ptr, EmitContext& ctx
}
Id IsScaled(EmitContext& ctx, const IR::Value& index, Id member_index, u32 base_index) {
const Id push_constant_u32{ctx.TypePointer(spv::StorageClass::PushConstant, ctx.U32[1])};
Id bit{};
if (index.IsImmediate()) {
// Use BitwiseAnd instead of BitfieldExtract for better codegen on Nvidia OpenGL.
@@ -234,6 +233,7 @@ Id IsScaled(EmitContext& ctx, const IR::Value& index, Id member_index, u32 base_
const u32 index_value{index.U32() + base_index};
const Id word_index{ctx.Const(index_value / 32)};
const Id bit_index_mask{ctx.Const(1u << (index_value % 32))};
const Id push_constant_u32{ctx.TypePointer(spv::StorageClass::PushConstant, ctx.U32[1])};
const Id pointer{ctx.OpAccessChain(push_constant_u32, ctx.rescaling_push_constants,
member_index, word_index)};
const Id word{ctx.OpLoad(ctx.U32[1], pointer)};

View File

@@ -80,7 +80,7 @@ IR::Value MakeCoords(TranslatorVisitor& v, IR::Reg reg, Type type) {
}
IR::Value ApplyAtomicOp(IR::IREmitter& ir, const IR::U32& handle, const IR::Value& coords,
const IR::Value& op_b, IR::TextureInstInfo info, AtomicOp op,
const IR::Value& op_b, const IR::TextureInstInfo& info, AtomicOp op,
bool is_signed) {
switch (op) {
case AtomicOp::ADD:
@@ -149,11 +149,10 @@ void ImageAtomOp(TranslatorVisitor& v, IR::Reg dest_reg, IR::Reg operand_reg, IR
info.type.Assign(tex_type);
info.image_format.Assign(format);
// TODO: float/64-bit operand
const IR::Value op_b{v.X(operand_reg)};
const IR::Value color{ApplyAtomicOp(v.ir, handle, coords, op_b, info, op, is_signed)};
if (write_result) {
// TODO: float/64-bit operand
const IR::Value op_b{v.X(operand_reg)};
const IR::Value color{ApplyAtomicOp(v.ir, handle, coords, op_b, info, op, is_signed)};
v.X(dest_reg, IR::U32{color});
}
}

View File

@@ -546,7 +546,7 @@ IR::Value EvalImmediates(const IR::Inst& inst, Func&& func, std::index_sequence<
return IR::Value{func(Arg<typename Traits::template ArgType<I>>(inst.Arg(I))...)};
}
std::optional<IR::Value> FoldCompositeExtractImpl(IR::Value inst_value, IR::Opcode insert,
std::optional<IR::Value> FoldCompositeExtractImpl(const IR::Value& inst_value, IR::Opcode insert,
IR::Opcode construct, u32 first_index) {
IR::Inst* const inst{inst_value.InstRecursive()};
if (inst->GetOpcode() == construct) {
@@ -587,7 +587,7 @@ void FoldCompositeExtract(IR::Inst& inst, IR::Opcode construct, IR::Opcode inser
inst.ReplaceUsesWith(*result);
}
IR::Value GetThroughCast(IR::Value value, IR::Opcode expected_cast) {
IR::Value GetThroughCast(const IR::Value& value, IR::Opcode expected_cast) {
if (value.IsImmediate()) {
return value;
}

View File

@@ -135,7 +135,7 @@ private:
class RescalingPushConstant {
public:
explicit RescalingPushConstant() noexcept {}
explicit RescalingPushConstant() noexcept = default;
void PushTexture(bool is_rescaled) noexcept {
*texture_ptr |= is_rescaled ? texture_bit : 0u;

View File

@@ -105,7 +105,7 @@ struct Client::Impl {
httplib::Request request;
request.method = method;
request.path = path;
request.headers = params;
request.headers = std::move(params);
request.body = data;
httplib::Response response;

View File

@@ -37,7 +37,7 @@ void UpdateController(Core::HID::EmulatedController* controller,
// Returns true if the given controller type is compatible with the given parameters.
bool IsControllerCompatible(Core::HID::NpadStyleIndex controller_type,
Core::Frontend::ControllerParameters parameters) {
const Core::Frontend::ControllerParameters& parameters) {
switch (controller_type) {
case Core::HID::NpadStyleIndex::ProController:
return parameters.allow_pro_controller;

View File

@@ -40,8 +40,8 @@ void QtErrorDisplay::ShowErrorWithTimestamp(ResultCode error, std::chrono::secon
.arg(date_time.toString(QStringLiteral("h:mm:ss A"))));
}
void QtErrorDisplay::ShowCustomErrorText(ResultCode error, std::string dialog_text,
std::string fullscreen_text,
void QtErrorDisplay::ShowCustomErrorText(ResultCode error, std::string_view dialog_text,
std::string_view fullscreen_text,
std::function<void()> finished) const {
callback = std::move(finished);
emit MainWindowDisplayError(

View File

@@ -19,7 +19,8 @@ public:
void ShowError(ResultCode error, std::function<void()> finished) const override;
void ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time,
std::function<void()> finished) const override;
void ShowCustomErrorText(ResultCode error, std::string dialog_text, std::string fullscreen_text,
void ShowCustomErrorText(ResultCode error, std::string_view dialog_text,
std::string_view fullscreen_text,
std::function<void()> finished) const override;
signals:

View File

@@ -385,7 +385,7 @@ void QtSoftwareKeyboardDialog::ShowNormalKeyboard(QPoint pos, QSize size) {
void QtSoftwareKeyboardDialog::ShowTextCheckDialog(
Service::AM::Applets::SwkbdTextCheckResult text_check_result,
std::u16string text_check_message) {
const std::u16string& text_check_message) {
switch (text_check_result) {
case SwkbdTextCheckResult::Success:
case SwkbdTextCheckResult::Silent:
@@ -422,7 +422,7 @@ void QtSoftwareKeyboardDialog::ShowTextCheckDialog(
}
void QtSoftwareKeyboardDialog::ShowInlineKeyboard(
Core::Frontend::InlineAppearParameters appear_parameters, QPoint pos, QSize size) {
const Core::Frontend::InlineAppearParameters& appear_parameters, QPoint pos, QSize size) {
MoveAndResizeWindow(pos, size);
ui->topOSK->setStyleSheet(QStringLiteral("background: rgba(0, 0, 0, 0);"));
@@ -456,7 +456,7 @@ void QtSoftwareKeyboardDialog::HideInlineKeyboard() {
}
void QtSoftwareKeyboardDialog::InlineTextChanged(
Core::Frontend::InlineTextParameters text_parameters) {
const Core::Frontend::InlineTextParameters& text_parameters) {
current_text = text_parameters.input_text;
cursor_position = text_parameters.cursor_position;

View File

@@ -40,14 +40,15 @@ public:
void ShowNormalKeyboard(QPoint pos, QSize size);
void ShowTextCheckDialog(Service::AM::Applets::SwkbdTextCheckResult text_check_result,
std::u16string text_check_message);
const std::u16string& text_check_message);
void ShowInlineKeyboard(Core::Frontend::InlineAppearParameters appear_parameters, QPoint pos,
void ShowInlineKeyboard(const Core::Frontend::InlineAppearParameters& appear_parameters,
QPoint pos,
QSize size);
void HideInlineKeyboard();
void InlineTextChanged(Core::Frontend::InlineTextParameters text_parameters);
void InlineTextChanged(const Core::Frontend::InlineTextParameters& text_parameters);
void ExitKeyboard();

View File

@@ -280,7 +280,7 @@ void ConfigureGraphics::RetranslateUI() {
ui->retranslateUi(this);
}
void ConfigureGraphics::UpdateBackgroundColorButton(QColor color) {
void ConfigureGraphics::UpdateBackgroundColorButton(const QColor& color) {
bg_color = color;
QPixmap pixmap(ui->bg_button->size());

View File

@@ -36,7 +36,7 @@ private:
void changeEvent(QEvent* event) override;
void RetranslateUI();
void UpdateBackgroundColorButton(QColor color);
void UpdateBackgroundColorButton(const QColor& color);
void UpdateAPILayout();
void UpdateDeviceSelection(int device);
void UpdateShaderBackendSelection(int backend);

View File

@@ -128,7 +128,7 @@ void ConfigureHotkeys::Configure(QModelIndex index) {
model->setData(index, key_sequence.toString(QKeySequence::NativeText));
}
}
void ConfigureHotkeys::ConfigureController(QModelIndex index) {
void ConfigureHotkeys::ConfigureController(const QModelIndex& index) {
if (timeout_timer->isActive()) {
return;
}
@@ -342,7 +342,7 @@ void ConfigureHotkeys::PopupContextMenu(const QPoint& menu_location) {
context_menu.exec(ui->hotkey_list->viewport()->mapToGlobal(menu_location));
}
void ConfigureHotkeys::RestoreControllerHotkey(QModelIndex index) {
void ConfigureHotkeys::RestoreControllerHotkey(const QModelIndex& index) {
const QString& default_key_sequence =
Config::default_hotkeys[index.row()].shortcut.controller_keyseq;
const auto [key_sequence_used, used_action] = IsUsedControllerKey(default_key_sequence);
@@ -356,7 +356,7 @@ void ConfigureHotkeys::RestoreControllerHotkey(QModelIndex index) {
}
}
void ConfigureHotkeys::RestoreHotkey(QModelIndex index) {
void ConfigureHotkeys::RestoreHotkey(const QModelIndex& index) {
const QKeySequence& default_key_sequence = QKeySequence::fromString(
Config::default_hotkeys[index.row()].shortcut.keyseq, QKeySequence::NativeText);
const auto [key_sequence_used, used_action] = IsUsedKey(default_key_sequence);

View File

@@ -45,15 +45,15 @@ private:
void RetranslateUI();
void Configure(QModelIndex index);
void ConfigureController(QModelIndex index);
void ConfigureController(const QModelIndex& index);
std::pair<bool, QString> IsUsedKey(QKeySequence key_sequence) const;
std::pair<bool, QString> IsUsedControllerKey(const QString& key_sequence) const;
void RestoreDefaults();
void ClearAll();
void PopupContextMenu(const QPoint& menu_location);
void RestoreControllerHotkey(QModelIndex index);
void RestoreHotkey(QModelIndex index);
void RestoreControllerHotkey(const QModelIndex& index);
void RestoreHotkey(const QModelIndex& index);
std::unique_ptr<Ui::ConfigureHotkeys> ui;

View File

@@ -234,7 +234,6 @@ QString ConfigureInputPlayer::AnalogToText(const Common::ParamPackage& param,
return QObject::tr("[unknown]");
}
const auto engine_str = param.Get("engine", "");
const QString axis_x_str = QString::fromStdString(param.Get("axis_x", ""));
const QString axis_y_str = QString::fromStdString(param.Get("axis_y", ""));
const bool invert_x = param.Get("invert_x", "+") == "-";

View File

@@ -1996,8 +1996,8 @@ void PlayerControlPreview::DrawProTriggers(QPainter& p, const QPointF center,
}
void PlayerControlPreview::DrawGCTriggers(QPainter& p, const QPointF center,
Common::Input::TriggerStatus left_trigger,
Common::Input::TriggerStatus right_trigger) {
const Common::Input::TriggerStatus& left_trigger,
const Common::Input::TriggerStatus& right_trigger) {
std::array<QPointF, left_gc_trigger.size() / 2> qleft_trigger;
std::array<QPointF, left_gc_trigger.size() / 2> qright_trigger;
@@ -2404,7 +2404,8 @@ void PlayerControlPreview::DrawGCJoystick(QPainter& p, const QPointF center,
DrawCircle(p, center, 7.5f);
}
void PlayerControlPreview::DrawRawJoystick(QPainter& p, QPointF center_left, QPointF center_right) {
void PlayerControlPreview::DrawRawJoystick(QPainter& p, const QPointF& center_left,
const QPointF& center_right) {
using namespace Settings::NativeAnalog;
if (center_right != QPointF(0, 0)) {
DrawJoystickProperties(p, center_right, stick_values[RStick].x.properties);
@@ -2672,7 +2673,7 @@ void PlayerControlPreview::DrawTriggerButton(QPainter& p, const QPointF center,
DrawPolygon(p, qtrigger_button);
}
void PlayerControlPreview::DrawBattery(QPainter& p, QPointF center,
void PlayerControlPreview::DrawBattery(QPainter& p, const QPointF& center,
Common::Input::BatteryLevel battery) {
if (battery == Common::Input::BatteryLevel::None) {
return;

View File

@@ -120,8 +120,8 @@ private:
void DrawProTriggers(QPainter& p, QPointF center,
const Common::Input::ButtonStatus& left_pressed,
const Common::Input::ButtonStatus& right_pressed);
void DrawGCTriggers(QPainter& p, QPointF center, Common::Input::TriggerStatus left_trigger,
Common::Input::TriggerStatus right_trigger);
void DrawGCTriggers(QPainter& p, QPointF center, const Common::Input::TriggerStatus& left_trigger,
const Common::Input::TriggerStatus& right_trigger);
void DrawHandheldTriggers(QPainter& p, QPointF center,
const Common::Input::ButtonStatus& left_pressed,
const Common::Input::ButtonStatus& right_pressed);
@@ -156,7 +156,7 @@ private:
const Common::Input::ButtonStatus& pressed);
void DrawJoystickSideview(QPainter& p, QPointF center, float angle, float size,
const Common::Input::ButtonStatus& pressed);
void DrawRawJoystick(QPainter& p, QPointF center_left, QPointF center_right);
void DrawRawJoystick(QPainter& p, const QPointF& center_left, const QPointF& center_right);
void DrawJoystickProperties(QPainter& p, QPointF center,
const Common::Input::AnalogProperties& properties);
void DrawJoystickDot(QPainter& p, QPointF center, const Common::Input::StickStatus& stick,
@@ -185,7 +185,7 @@ private:
const Common::Input::ButtonStatus& pressed);
// Draw battery functions
void DrawBattery(QPainter& p, QPointF center, Common::Input::BatteryLevel battery);
void DrawBattery(QPainter& p, const QPointF& center, Common::Input::BatteryLevel battery);
// Draw icon functions
void DrawSymbol(QPainter& p, QPointF center, Symbol symbol, float icon_size);

View File

@@ -86,7 +86,7 @@ void ConfigurePerGameAddons::ApplyConfiguration() {
"game_list" / fmt::format("{:016X}.pv.txt", title_id));
}
Settings::values.disabled_addons[title_id] = disabled_addons;
Settings::values.disabled_addons[title_id] = std::move(disabled_addons);
}
void ConfigurePerGameAddons::LoadFromFile(FileSys::VirtualFile file) {

View File

@@ -392,7 +392,6 @@ QString ConfigureRingController::AnalogToText(const Common::ParamPackage& param,
return QObject::tr("[unknown]");
}
const auto engine_str = param.Get("engine", "");
const QString axis_x_str = QString::fromStdString(param.Get("axis_x", ""));
const QString axis_y_str = QString::fromStdString(param.Get("axis_y", ""));
const bool invert_x = param.Get("invert_x", "+") == "-";

View File

@@ -131,6 +131,7 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeMutexInfo::GetChildren() cons
const bool has_waiters = (mutex_value & Kernel::Svc::HandleWaitMask) != 0;
std::vector<std::unique_ptr<WaitTreeItem>> list;
list.reserve(3);
list.push_back(std::make_unique<WaitTreeText>(tr("has waiters: %1").arg(has_waiters)));
list.push_back(std::make_unique<WaitTreeText>(
tr("owner handle: 0x%1").arg(owner_handle, 8, 16, QLatin1Char{'0'})));

View File

@@ -150,9 +150,8 @@ bool IsExtractedNCAMain(const std::string& file_name) {
QString FormatGameName(const std::string& physical_name) {
const QString physical_name_as_qstring = QString::fromStdString(physical_name);
const QFileInfo file_info(physical_name_as_qstring);
if (IsExtractedNCAMain(physical_name)) {
const QFileInfo file_info(physical_name_as_qstring);
return file_info.dir().path();
}

View File

@@ -159,7 +159,7 @@ void Config::ReadValues() {
"ControlsGeneral", std::string("debug_pad_") + Settings::NativeButton::mapping[i],
default_param);
if (Settings::values.debug_pad_buttons[i].empty())
Settings::values.debug_pad_buttons[i] = default_param;
Settings::values.debug_pad_buttons[i] = std::move(default_param);
}
for (int i = 0; i < Settings::NativeAnalog::NumAnalogs; ++i) {
@@ -170,7 +170,7 @@ void Config::ReadValues() {
"ControlsGeneral", std::string("debug_pad_") + Settings::NativeAnalog::mapping[i],
default_param);
if (Settings::values.debug_pad_analogs[i].empty())
Settings::values.debug_pad_analogs[i] = default_param;
Settings::values.debug_pad_analogs[i] = std::move(default_param);
}
ReadSetting("ControlsGeneral", Settings::values.vibration_enabled);