Added std::string_view and const ref, push/insert -> emplace, lower scope code
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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})",
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)};
|
||||
|
||||
@@ -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});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user