diff --git a/rpcs3/rpcs3qt/debugger_frame.cpp b/rpcs3/rpcs3qt/debugger_frame.cpp index 502a01dc09..b85aa2859e 100644 --- a/rpcs3/rpcs3qt/debugger_frame.cpp +++ b/rpcs3/rpcs3qt/debugger_frame.cpp @@ -40,8 +40,6 @@ #include "rpcs3qt/debugger_add_bp_window.h" #include "util/asm.hpp" -constexpr auto qstr = QString::fromStdString; - constexpr auto s_pause_flags = cpu_flag::dbg_pause + cpu_flag::dbg_global_pause; extern atomic_t g_debugger_pause_all_threads_on_bp; @@ -1030,7 +1028,7 @@ void debugger_frame::UpdateUnitList() std::function func_cpu = make_check_cpu(std::addressof(cpu), true); // Space at the end is to pad a gap on the right - cpu_list.emplace_back(qstr((id >> 24 == 0x55 ? "RSX[0x55555555]" : cpu.get_name()) + ' '), std::move(func_cpu)); + cpu_list.emplace_back(QString::fromStdString((id >> 24 == 0x55 ? "RSX[0x55555555]" : cpu.get_name()) + ' '), std::move(func_cpu)); if (old_cpu_ptr == std::addressof(cpu)) { @@ -1373,7 +1371,7 @@ void debugger_frame::WritePanels() int loc = m_misc_state->verticalScrollBar()->value(); int hloc = m_misc_state->horizontalScrollBar()->value(); m_misc_state->clear(); - m_misc_state->setPlainText(qstr(cpu->dump_misc())); + m_misc_state->setPlainText(QString::fromStdString(cpu->dump_misc())); m_misc_state->verticalScrollBar()->setValue(loc); m_misc_state->horizontalScrollBar()->setValue(hloc); @@ -1382,7 +1380,7 @@ void debugger_frame::WritePanels() m_regs->clear(); m_last_reg_state.clear(); cpu->dump_regs(m_last_reg_state, m_dump_reg_func_data); - m_regs->setPlainText(qstr(m_last_reg_state)); + m_regs->setPlainText(QString::fromStdString(m_last_reg_state)); m_regs->verticalScrollBar()->setValue(loc); m_regs->horizontalScrollBar()->setValue(hloc); diff --git a/rpcs3/rpcs3qt/debugger_list.cpp b/rpcs3/rpcs3qt/debugger_list.cpp index e398921aaf..757eb9cd98 100644 --- a/rpcs3/rpcs3qt/debugger_list.cpp +++ b/rpcs3/rpcs3qt/debugger_list.cpp @@ -19,8 +19,6 @@ #include -constexpr auto qstr = QString::fromStdString; - debugger_list::debugger_list(QWidget* parent, std::shared_ptr gui_settings, breakpoint_handler* handler) : QListWidget(parent) , m_gui_settings(std::move(gui_settings)) @@ -208,7 +206,7 @@ void debugger_list::ShowAddress(u32 addr, bool select_addr, bool direct) for (uint i = 0; i < m_item_count; ++i) { QListWidgetItem* list_item = item(i); - list_item->setText(qstr(fmt::format(" [%08x] ?? ?? ?? ??:", 0))); + list_item->setText(QString::fromStdString(fmt::format(" [%08x] ?? ?? ?? ??:", 0))); list_item->setForeground(default_foreground); list_item->setBackground(default_background); } @@ -253,7 +251,7 @@ void debugger_list::ShowAddress(u32 addr, bool select_addr, bool direct) if (cpu && cpu->get_class() == thread_class::ppu && !vm::check_addr(pc, 0)) { - list_item->setText((IsBreakpoint(pc) ? ">> " : " ") + qstr(fmt::format("[%08x] ?? ?? ?? ??:", pc))); + list_item->setText((IsBreakpoint(pc) ? ">> " : " ") + QString::fromStdString(fmt::format("[%08x] ?? ?? ?? ??:", pc))); count = 4; continue; } @@ -261,7 +259,7 @@ void debugger_list::ShowAddress(u32 addr, bool select_addr, bool direct) if (cpu && cpu->get_class() == thread_class::ppu && !vm::check_addr(pc, vm::page_executable)) { const u32 data = *vm::get_super_ptr>(pc); - list_item->setText((IsBreakpoint(pc) ? ">> " : " ") + qstr(fmt::format("[%08x] %02x %02x %02x %02x:", pc, + list_item->setText((IsBreakpoint(pc) ? ">> " : " ") + QString::fromStdString(fmt::format("[%08x] %02x %02x %02x %02x:", pc, static_cast(data >> 24), static_cast(data >> 16), static_cast(data >> 8), @@ -274,12 +272,12 @@ void debugger_list::ShowAddress(u32 addr, bool select_addr, bool direct) if (!count) { - list_item->setText((IsBreakpoint(pc) ? ">> " : " ") + qstr(fmt::format("[%08x] ??? ?? ??", pc))); + list_item->setText((IsBreakpoint(pc) ? ">> " : " ") + QString::fromStdString(fmt::format("[%08x] ??? ?? ??", pc))); count = 4; continue; } - list_item->setText((IsBreakpoint(pc) ? ">> " : " ") + qstr(m_disasm->last_opcode)); + list_item->setText((IsBreakpoint(pc) ? ">> " : " ") + QString::fromStdString(m_disasm->last_opcode)); } } diff --git a/rpcs3/rpcs3qt/emu_settings.h b/rpcs3/rpcs3qt/emu_settings.h index 4cd3da262d..5da946dabe 100644 --- a/rpcs3/rpcs3qt/emu_settings.h +++ b/rpcs3/rpcs3qt/emu_settings.h @@ -23,8 +23,6 @@ namespace cfg class _base; } -constexpr auto qstr = QString::fromStdString; - class emu_settings : public QObject { /** A settings class for Emulator specific settings. This class is a refactored version of the wx version. It is much nicer diff --git a/rpcs3/rpcs3qt/game_compatibility.cpp b/rpcs3/rpcs3qt/game_compatibility.cpp index e672cdb508..2d901b6642 100644 --- a/rpcs3/rpcs3qt/game_compatibility.cpp +++ b/rpcs3/rpcs3qt/game_compatibility.cpp @@ -13,8 +13,6 @@ LOG_CHANNEL(compat_log, "Compat"); -constexpr auto qstr = QString::fromStdString; - game_compatibility::game_compatibility(std::shared_ptr gui_settings, QWidget* parent) : QObject(parent) , m_gui_settings(std::move(gui_settings)) @@ -91,7 +89,7 @@ bool game_compatibility::ReadJSON(const QJsonObject& json_data, bool after_downl break; } compat_log.error("%s: return code %d", error_message, return_code); - Q_EMIT DownloadError(qstr(error_message) + " " + QString::number(return_code)); + Q_EMIT DownloadError(QString::fromStdString(error_message) + " " + QString::number(return_code)); } else { @@ -269,10 +267,10 @@ compat::package_info game_compatibility::GetPkgInfo(const QString& pkg_path, gam const std::string changelog_key = "paramhip"; info.path = pkg_path; - info.title = qstr(std::string(psf::get_string(psf, title_key))); // Let's read this from the psf first - info.title_id = qstr(std::string(psf::get_string(psf, "TITLE_ID"))); - info.category = qstr(std::string(psf::get_string(psf, "CATEGORY"))); - info.version = qstr(std::string(psf::get_string(psf, "APP_VER"))); + info.title = QString::fromStdString(std::string(psf::get_string(psf, title_key))); // Let's read this from the psf first + info.title_id = QString::fromStdString(std::string(psf::get_string(psf, "TITLE_ID"))); + info.category = QString::fromStdString(std::string(psf::get_string(psf, "CATEGORY"))); + info.version = QString::fromStdString(std::string(psf::get_string(psf, "APP_VER"))); if (!info.category.isEmpty()) { @@ -306,7 +304,7 @@ compat::package_info game_compatibility::GetPkgInfo(const QString& pkg_path, gam if (info.version.isEmpty()) { // Fallback to VERSION - info.version = qstr(std::string(psf::get_string(psf, "VERSION"))); + info.version = QString::fromStdString(std::string(psf::get_string(psf, "VERSION"))); } if (compat) @@ -321,12 +319,12 @@ compat::package_info game_compatibility::GetPkgInfo(const QString& pkg_path, gam { if (const std::string localized_title = package.get_title(title_key); !localized_title.empty()) { - info.title = qstr(localized_title); + info.title = QString::fromStdString(localized_title); } if (const std::string localized_changelog = package.get_changelog(changelog_key); !localized_changelog.empty()) { - info.changelog = qstr(localized_changelog); + info.changelog = QString::fromStdString(localized_changelog); } // This should be an update since it was found in a patch set diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index 58430bc3b1..3da34c832a 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -265,15 +265,15 @@ bool game_list_frame::IsEntryVisible(const game_info& game, bool search_fallback { if (m_is_list_layout) { - return m_category_filters.contains(qstr(game->info.category)); + return m_category_filters.contains(QString::fromStdString(game->info.category)); } - return m_grid_category_filters.contains(qstr(game->info.category)); + return m_grid_category_filters.contains(QString::fromStdString(game->info.category)); }; - const QString serial = qstr(game->info.serial); + const QString serial = QString::fromStdString(game->info.serial); const bool is_visible = m_show_hidden || !m_hidden_list.contains(serial); - return is_visible && matches_category() && SearchMatchesApp(qstr(game->info.name), serial, search_fallback); + return is_visible && matches_category() && SearchMatchesApp(QString::fromStdString(game->info.name), serial, search_fallback); } bool game_list_frame::RemoveContentPath(const std::string& path, const std::string& desc) @@ -1068,7 +1068,7 @@ void game_list_frame::CreateShortcuts(const std::vector& games, const if (!fs::create_path(target_icon_dir)) { - game_list_log.error("Failed to create shortcut path %s (%s)", qstr(gameinfo->info.name).simplified(), target_icon_dir, fs::g_tls_error); + game_list_log.error("Failed to create shortcut path %s (%s)", QString::fromStdString(gameinfo->info.name).simplified(), target_icon_dir, fs::g_tls_error); success = false; continue; } @@ -1094,11 +1094,11 @@ void game_list_frame::CreateShortcuts(const std::vector& games, const if (!gameid_token_value.empty() && gui::utils::create_shortcut(gameinfo->info.name, gameinfo->info.serial, target_cli_args, gameinfo->info.name, gameinfo->info.icon_path, target_icon_dir, location)) { - game_list_log.success("Created %s shortcut for %s", destination, qstr(gameinfo->info.name).simplified()); + game_list_log.success("Created %s shortcut for %s", destination, QString::fromStdString(gameinfo->info.name).simplified()); } else { - game_list_log.error("Failed to create %s shortcut for %s", destination, qstr(gameinfo->info.name).simplified()); + game_list_log.error("Failed to create %s shortcut for %s", destination, QString::fromStdString(gameinfo->info.name).simplified()); success = false; } } @@ -1144,8 +1144,8 @@ void game_list_frame::ShowContextMenu(const QPoint &pos) } GameInfo current_game = gameinfo->info; - const QString serial = qstr(current_game.serial); - const QString name = qstr(current_game.name).simplified(); + const QString serial = QString::fromStdString(current_game.serial); + const QString name = QString::fromStdString(current_game.name).simplified(); const std::string cache_base_dir = GetCacheDirBySerial(current_game.serial); const std::string config_data_base_dir = GetDataDirBySerial(current_game.serial); @@ -1520,7 +1520,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos) for (const auto& [type, icon_name, suffix, actions] : icon_map) { - const QString icon_path = qstr(custom_icon_dir_path) + icon_name; + const QString icon_path = QString::fromStdString(custom_icon_dir_path) + icon_name; if (QFile::exists(icon_path)) { @@ -1547,7 +1547,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos) // Open Folder menu QMenu* open_folder_menu = menu.addMenu(tr("&Open Folder")); - const bool is_disc_game = qstr(current_game.category) == cat::cat_disc_game; + const bool is_disc_game = QString::fromStdString(current_game.category) == cat::cat_disc_game; const std::string captures_dir = fs::get_config_dir() + "/captures/"; const std::string recordings_dir = fs::get_config_dir() + "/recordings/" + current_game.serial; const std::string screenshots_dir = fs::get_config_dir() + "/screenshots/" + current_game.serial; @@ -1723,7 +1723,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos) return; } - const bool is_disc_game = qstr(current_game.category) == cat::cat_disc_game; + const bool is_disc_game = QString::fromStdString(current_game.category) == cat::cat_disc_game; const bool is_in_games_dir = is_disc_game && Emu.IsPathInsideDir(current_game.path, rpcs3::utils::get_games_dir()); std::vector data_dir_list; @@ -1737,11 +1737,11 @@ void game_list_frame::ShowContextMenu(const QPoint &pos) } const bool has_data_dir = !data_dir_list.empty(); // "true" if data path is present (it could be absent for a disc game) - QString text = tr("%0 - %1\n").arg(qstr(current_game.serial)).arg(name); + QString text = tr("%0 - %1\n").arg(QString::fromStdString(current_game.serial)).arg(name); if (is_disc_game) { - text += tr("\nDisc Game Info:\nPath: %0\n").arg(qstr(current_game.path)); + text += tr("\nDisc Game Info:\nPath: %0\n").arg(QString::fromStdString(current_game.path)); if (current_game.size_on_disk != umax) // If size was properly detected { @@ -1757,7 +1757,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos) for (const std::string& data_dir : data_dir_list) { - text += tr("Path: %0\n").arg(qstr(data_dir)); + text += tr("Path: %0\n").arg(QString::fromStdString(data_dir)); if (const u64 data_size = fs::get_dir_size(data_dir, 1); data_size != umax) // If size was properly detected { @@ -1835,8 +1835,8 @@ void game_list_frame::ShowContextMenu(const QPoint &pos) if (has_data_dir && RemoveContentPathList(data_dir_list, gameinfo->localized_category.toStdString()) != data_dir_list.size()) { QMessageBox::critical(this, tr("Failure!"), remove_caches - ? tr("Failed to remove %0 from drive!\nPath: %1\nCaches and custom configs have been left intact.").arg(name).arg(qstr(data_dir_list[0])) - : tr("Failed to remove %0 from drive!\nPath: %1").arg(name).arg(qstr(data_dir_list[0]))); + ? tr("Failed to remove %0 from drive!\nPath: %1\nCaches and custom configs have been left intact.").arg(name).arg(QString::fromStdString(data_dir_list[0])) + : tr("Failed to remove %0 from drive!\nPath: %1").arg(name).arg(QString::fromStdString(data_dir_list[0]))); return; } @@ -1981,7 +1981,7 @@ void game_list_frame::ShowContextMenu(const QPoint &pos) }); // Disable options depending on software category - const QString category = qstr(current_game.category); + const QString category = QString::fromStdString(current_game.category); if (category == cat::cat_ps3_os) { @@ -2072,7 +2072,7 @@ bool game_list_frame::RemoveCustomPadConfiguration(const std::string& title_id, g_cfg_input_configs.save(); game_list_log.notice("Removed active input configuration entry for key '%s'", title_id); - if (QDir(qstr(config_dir)).removeRecursively()) + if (QDir(QString::fromStdString(config_dir)).removeRecursively()) { if (game) { @@ -2108,7 +2108,7 @@ bool game_list_frame::RemoveShadersCache(const std::string& base_dir, bool is_in u32 caches_total = 0; const QStringList filter{ QStringLiteral("shaders_cache") }; - const QString q_base_dir = qstr(base_dir); + const QString q_base_dir = QString::fromStdString(base_dir); QDirIterator dir_iter(q_base_dir, filter, QDir::Dirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); @@ -2159,7 +2159,7 @@ bool game_list_frame::RemovePPUCache(const std::string& base_dir, bool is_intera u32 files_total = 0; const QStringList filter{ QStringLiteral("v*.obj"), QStringLiteral("v*.obj.gz") }; - const QString q_base_dir = qstr(base_dir); + const QString q_base_dir = QString::fromStdString(base_dir); QDirIterator dir_iter(q_base_dir, filter, QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); @@ -2210,7 +2210,7 @@ bool game_list_frame::RemoveSPUCache(const std::string& base_dir, bool is_intera u32 files_total = 0; const QStringList filter{ QStringLiteral("spu*.dat"), QStringLiteral("spu*.dat.gz"), QStringLiteral("spu*.obj"), QStringLiteral("spu*.obj.gz") }; - const QString q_base_dir = qstr(base_dir); + const QString q_base_dir = QString::fromStdString(base_dir); QDirIterator dir_iter(q_base_dir, filter, QDir::Files | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); @@ -2260,9 +2260,9 @@ void game_list_frame::RemoveHDD1Cache(const std::string& base_dir, const std::st u32 dirs_removed = 0; u32 dirs_total = 0; - const QString q_base_dir = qstr(base_dir); + const QString q_base_dir = QString::fromStdString(base_dir); - const QStringList filter{ qstr(title_id + "_*") }; + const QStringList filter{ QString::fromStdString(title_id + "_*") }; QDirIterator dir_iter(q_base_dir, filter, QDir::Dirs | QDir::NoDotAndDotDot); diff --git a/rpcs3/rpcs3qt/instruction_editor_dialog.cpp b/rpcs3/rpcs3qt/instruction_editor_dialog.cpp index 460b7503f6..667fbe40db 100644 --- a/rpcs3/rpcs3qt/instruction_editor_dialog.cpp +++ b/rpcs3/rpcs3qt/instruction_editor_dialog.cpp @@ -12,8 +12,6 @@ #include #include -constexpr auto qstr = QString::fromStdString; - extern bool ppu_patch(u32 addr, u32 value); extern std::string format_spu_func_info(u32 addr, cpu_thread* spu); @@ -50,14 +48,14 @@ instruction_editor_dialog::instruction_editor_dialog(QWidget *parent, u32 _pc, C m_disasm->change_mode(cpu_disasm_mode::normal); m_disasm->disasm(m_pc); - m_preview = new QLabel(qstr(m_disasm->last_opcode), this); + m_preview = new QLabel(QString::fromStdString(m_disasm->last_opcode), this); // Layouts vbox_left_panel->addWidget(new QLabel(tr("Address: "))); vbox_left_panel->addWidget(new QLabel(tr("Instruction: "))); vbox_left_panel->addWidget(new QLabel(tr("Preview: "))); - vbox_right_panel->addWidget(new QLabel(qstr(fmt::format("%08x", m_pc)))); + vbox_right_panel->addWidget(new QLabel(QString::fromStdString(fmt::format("%08x", m_pc)))); vbox_right_panel->addWidget(m_instr); vbox_right_panel->addWidget(m_preview); @@ -68,7 +66,7 @@ instruction_editor_dialog::instruction_editor_dialog(QWidget *parent, u32 _pc, C m_func_info = new QLabel("", this); vbox_right_panel->addWidget(m_func_info); - m_func_info->setText(qstr(format_spu_func_info(m_pc, cpu))); + m_func_info->setText(QString::fromStdString(format_spu_func_info(m_pc, cpu))); } if (cpu && cpu->get_class() == thread_class::spu) @@ -158,7 +156,7 @@ void instruction_editor_dialog::updatePreview() const if (ok && m_disasm->disasm(m_pc)) { - m_preview->setText(qstr(m_disasm->last_opcode)); + m_preview->setText(QString::fromStdString(m_disasm->last_opcode)); } else { diff --git a/rpcs3/rpcs3qt/kernel_explorer.cpp b/rpcs3/rpcs3qt/kernel_explorer.cpp index 3b50f9ea97..360c352100 100644 --- a/rpcs3/rpcs3qt/kernel_explorer.cpp +++ b/rpcs3/rpcs3qt/kernel_explorer.cpp @@ -38,8 +38,6 @@ #include "kernel_explorer.h" #include "qt_utils.h" -constexpr auto qstr = QString::fromStdString; - LOG_CHANNEL(sys_log, "SYS"); enum kernel_item_role @@ -173,7 +171,7 @@ static QTreeWidgetItem* add_solid_node(QTreeWidgetItem* parent, const QString& b kernel_explorer::kernel_explorer(QWidget* parent) : QDialog(parent) { - setWindowTitle(tr("Kernel Explorer | %1").arg(qstr(Emu.GetTitleAndTitleID()))); + setWindowTitle(tr("Kernel Explorer | %1").arg(QString::fromStdString(Emu.GetTitleAndTitleID()))); setObjectName("kernel_explorer"); setAttribute(Qt::WA_DeleteOnClose); setMinimumSize(QSize(800, 600)); @@ -313,10 +311,10 @@ void kernel_explorer::update() const u32 total_memory_usage = dct->used; - root->setText(0, qstr(fmt::format("Process 0x%08x: Total Memory Usage: 0x%x/0x%x (%0.2f/%0.2f MB)", process_getpid(), total_memory_usage, dct->size, 1. * total_memory_usage / (1024 * 1024) + root->setText(0, QString::fromStdString(fmt::format("Process 0x%08x: Total Memory Usage: 0x%x/0x%x (%0.2f/%0.2f MB)", process_getpid(), total_memory_usage, dct->size, 1. * total_memory_usage / (1024 * 1024) , 1. * dct->size / (1024 * 1024)))); - add_solid_node(find_node(root, additional_nodes::process_info), qstr(fmt::format("Process Info, Sdk Version: 0x%08x, PPC SEG: %#x, SFO Category: %s (Fake: %s)", g_ps3_process_info.sdk_ver, g_ps3_process_info.ppc_seg, Emu.GetCat(), Emu.GetFakeCat()))); + add_solid_node(find_node(root, additional_nodes::process_info), QString::fromStdString(fmt::format("Process Info, Sdk Version: 0x%08x, PPC SEG: %#x, SFO Category: %s (Fake: %s)", g_ps3_process_info.sdk_ver, g_ps3_process_info.ppc_seg, Emu.GetCat(), Emu.GetFakeCat()))); auto display_program_segments = [this](QTreeWidgetItem* tree, const ppu_module& m) { @@ -325,7 +323,7 @@ void kernel_explorer::update() const u32 addr = m.segs[i].addr; const u32 size = m.segs[i].size; - add_leaf(tree, qstr(fmt::format("Segment %u: (0x%08x...0x%08x), Flags: 0x%x" + add_leaf(tree, QString::fromStdString(fmt::format("Segment %u: (0x%08x...0x%08x), Flags: 0x%x" , i, addr, addr + std::max(size, 1) - 1, m.segs[i].flags))); } }; @@ -342,7 +340,7 @@ void kernel_explorer::update() { for (; cpu; cpu = cpu->get_next_cpu()) { - add_leaf(tree, qstr(fmt::format("Waiter: ID: 0x%x", cpu->get_class() == thread_class::spu ? static_cast(cpu)->lv2_id : cpu->id))); + add_leaf(tree, QString::fromStdString(fmt::format("Waiter: ID: 0x%x", cpu->get_class() == thread_class::spu ? static_cast(cpu)->lv2_id : cpu->id))); } }; @@ -355,32 +353,32 @@ void kernel_explorer::update() if (mem.pshared) { - add_leaf(node, qstr(fmt::format("Shared Mem 0x%08x: Size: 0x%x (%0.2f MB), Chunk: %s, Mappings: %u, Mem Container: %s, Key: %#llx", id, mem.size, size_mb, mem.align == 0x10000u ? "64K" : "1MB", +mem.counter, mem.ct->id, mem.key))); + add_leaf(node, QString::fromStdString(fmt::format("Shared Mem 0x%08x: Size: 0x%x (%0.2f MB), Chunk: %s, Mappings: %u, Mem Container: %s, Key: %#llx", id, mem.size, size_mb, mem.align == 0x10000u ? "64K" : "1MB", +mem.counter, mem.ct->id, mem.key))); break; } - add_leaf(node, qstr(fmt::format("Shared Mem 0x%08x: Size: 0x%x (%0.2f MB), Chunk: %s, Mem Container: %s, Mappings: %u", id, mem.size, size_mb, mem.align == 0x10000u ? "64K" : "1MB", mem.ct->id, +mem.counter))); + add_leaf(node, QString::fromStdString(fmt::format("Shared Mem 0x%08x: Size: 0x%x (%0.2f MB), Chunk: %s, Mem Container: %s, Mappings: %u", id, mem.size, size_mb, mem.align == 0x10000u ? "64K" : "1MB", mem.ct->id, +mem.counter))); break; } case SYS_MUTEX_OBJECT: { auto& mutex = static_cast(obj); const auto control = mutex.control.load(); - show_waiters(add_solid_node(node, qstr(fmt::format(u8"Mutex 0x%08x: “%s”", id, lv2_obj::name64(mutex.name))), qstr(fmt::format(u8"Mutex 0x%08x: “%s”, %s,%s Owner: %#x, Locks: %u, Key: %#llx, Conds: %u", id, lv2_obj::name64(mutex.name), mutex.protocol, + show_waiters(add_solid_node(node, QString::fromStdString(fmt::format(u8"Mutex 0x%08x: “%s”", id, lv2_obj::name64(mutex.name))), QString::fromStdString(fmt::format(u8"Mutex 0x%08x: “%s”, %s,%s Owner: %#x, Locks: %u, Key: %#llx, Conds: %u", id, lv2_obj::name64(mutex.name), mutex.protocol, mutex.recursive == SYS_SYNC_RECURSIVE ? " Recursive," : "", control.owner, +mutex.lock_count, mutex.key, mutex.cond_count))), control.sq); break; } case SYS_COND_OBJECT: { auto& cond = static_cast(obj); - show_waiters(add_solid_node(node, qstr(fmt::format(u8"Cond 0x%08x: “%s”", id, lv2_obj::name64(cond.name))), qstr(fmt::format(u8"Cond 0x%08x: “%s”, %s, Mutex: 0x%08x, Key: %#llx", id, lv2_obj::name64(cond.name), cond.mutex->protocol, cond.mtx_id, cond.key))), cond.sq); + show_waiters(add_solid_node(node, QString::fromStdString(fmt::format(u8"Cond 0x%08x: “%s”", id, lv2_obj::name64(cond.name))), QString::fromStdString(fmt::format(u8"Cond 0x%08x: “%s”, %s, Mutex: 0x%08x, Key: %#llx", id, lv2_obj::name64(cond.name), cond.mutex->protocol, cond.mtx_id, cond.key))), cond.sq); break; } case SYS_RWLOCK_OBJECT: { auto& rw = static_cast(obj); const s64 val = rw.owner; - auto tree = add_solid_node(node, qstr(fmt::format(u8"RW Lock 0x%08x: “%s”", id, lv2_obj::name64(rw.name))), qstr(fmt::format(u8"RW Lock 0x%08x: “%s”, %s, Owner: %#x(%d), Key: %#llx", id, lv2_obj::name64(rw.name), rw.protocol, + auto tree = add_solid_node(node, QString::fromStdString(fmt::format(u8"RW Lock 0x%08x: “%s”", id, lv2_obj::name64(rw.name))), QString::fromStdString(fmt::format(u8"RW Lock 0x%08x: “%s”, %s, Owner: %#x(%d), Key: %#llx", id, lv2_obj::name64(rw.name), rw.protocol, std::max(0, val >> 1), -std::min(0, val >> 1), rw.key))); if (auto rq = +rw.rq) @@ -402,23 +400,23 @@ void kernel_explorer::update() if (lv2_obj::check(handler)) { - add_leaf(node, qstr(fmt::format("Intr Tag 0x%08x, Handler: 0x%08x", id, handler->id))); + add_leaf(node, QString::fromStdString(fmt::format("Intr Tag 0x%08x, Handler: 0x%08x", id, handler->id))); break; } - add_leaf(node, qstr(fmt::format("Intr Tag 0x%08x, Handler: Unbound", id))); + add_leaf(node, QString::fromStdString(fmt::format("Intr Tag 0x%08x, Handler: Unbound", id))); break; } case SYS_INTR_SERVICE_HANDLE_OBJECT: { auto& serv = static_cast(obj); - add_leaf(node, qstr(fmt::format("Intr Svc 0x%08x, PPU: 0x%07x, arg1: 0x%x, arg2: 0x%x", id, serv.thread->id, serv.arg1, serv.arg2))); + add_leaf(node, QString::fromStdString(fmt::format("Intr Svc 0x%08x, PPU: 0x%07x, arg1: 0x%x, arg2: 0x%x", id, serv.thread->id, serv.arg1, serv.arg2))); break; } case SYS_EVENT_QUEUE_OBJECT: { auto& eq = static_cast(obj); - show_waiters(add_solid_node(node, qstr(fmt::format(u8"Event Queue 0x%08x: “%s”", id, lv2_obj::name64(eq.name))), qstr(fmt::format(u8"Event Queue 0x%08x: “%s”, %s, %s, Key: %#llx, Events: %zu/%d", id, lv2_obj::name64(eq.name), eq.protocol, + show_waiters(add_solid_node(node, QString::fromStdString(fmt::format(u8"Event Queue 0x%08x: “%s”", id, lv2_obj::name64(eq.name))), QString::fromStdString(fmt::format(u8"Event Queue 0x%08x: “%s”, %s, %s, Key: %#llx, Events: %zu/%d", id, lv2_obj::name64(eq.name), eq.protocol, eq.type == SYS_SPU_QUEUE ? "SPU" : "PPU", eq.key, eq.events.size(), eq.size))), eq.type == SYS_SPU_QUEUE ? static_cast(+eq.sq) : +eq.pq); break; } @@ -431,30 +429,30 @@ void kernel_explorer::update() { if (queue == idm::check_unlocked(queue->id)) { - add_leaf(node, qstr(fmt::format("Event Port 0x%08x: %s, Name: %#llx, Event Queue (ID): 0x%08x", id, type, ep.name, queue->id))); + add_leaf(node, QString::fromStdString(fmt::format("Event Port 0x%08x: %s, Name: %#llx, Event Queue (ID): 0x%08x", id, type, ep.name, queue->id))); break; } // This code is unused until multi-process is implemented if (queue == lv2_event_queue::find(queue->key).get()) { - add_leaf(node, qstr(fmt::format("Event Port 0x%08x: %s, Name: %#llx, Event Queue (IPC): %s", id, type, ep.name, queue->key))); + add_leaf(node, QString::fromStdString(fmt::format("Event Port 0x%08x: %s, Name: %#llx, Event Queue (IPC): %s", id, type, ep.name, queue->key))); break; } } - add_leaf(node, qstr(fmt::format("Event Port 0x%08x: %s, Name: %#llx, Unbound", id, type, ep.name))); + add_leaf(node, QString::fromStdString(fmt::format("Event Port 0x%08x: %s, Name: %#llx, Unbound", id, type, ep.name))); break; } case SYS_TRACE_OBJECT: { - add_leaf(node, qstr(fmt::format("Trace 0x%08x", id))); + add_leaf(node, QString::fromStdString(fmt::format("Trace 0x%08x", id))); break; } case SYS_SPUIMAGE_OBJECT: { auto& spi = static_cast(obj); - add_leaf(node, qstr(fmt::format("SPU Image 0x%08x, Entry: 0x%x, Segs: *0x%x, Num Segs: %d", id, spi.e_entry, spi.segs, spi.nsegs))); + add_leaf(node, QString::fromStdString(fmt::format("SPU Image 0x%08x, Entry: 0x%x, Segs: *0x%x, Num Segs: %d", id, spi.e_entry, spi.segs, spi.nsegs))); break; } case SYS_PRX_OBJECT: @@ -463,24 +461,24 @@ void kernel_explorer::update() if (prx.segs.empty()) { - add_leaf(node, qstr(fmt::format("PRX 0x%08x: '%s' (HLE)", id, prx.name))); + add_leaf(node, QString::fromStdString(fmt::format("PRX 0x%08x: '%s' (HLE)", id, prx.name))); break; } - const QString text = qstr(fmt::format("PRX 0x%08x: '%s', attr=0x%x, lib=%s", id, prx.name, prx.module_info_attributes, prx.module_info_name)); + const QString text = QString::fromStdString(fmt::format("PRX 0x%08x: '%s', attr=0x%x, lib=%s", id, prx.name, prx.module_info_attributes, prx.module_info_name)); QTreeWidgetItem* prx_tree = add_solid_node(node, text, text); display_program_segments(prx_tree, prx); break; } case SYS_SPUPORT_OBJECT: { - add_leaf(node, qstr(fmt::format("SPU Port 0x%08x", id))); + add_leaf(node, QString::fromStdString(fmt::format("SPU Port 0x%08x", id))); break; } case SYS_OVERLAY_OBJECT: { auto& ovl = static_cast(obj); - const QString text = qstr(fmt::format("OVL 0x%08x: '%s'", id, ovl.name)); + const QString text = QString::fromStdString(fmt::format("OVL 0x%08x: '%s'", id, ovl.name)); QTreeWidgetItem* ovl_tree = add_solid_node(node, text, text); display_program_segments(ovl_tree, ovl); break; @@ -516,11 +514,11 @@ void kernel_explorer::update() } else { - show_waiters(add_solid_node(node, qstr(fmt::format(u8"LWMutex 0x%08x: “%s”", id, lv2_obj::name64(lwm.name))), qstr(fmt::format(u8"LWMutex 0x%08x: “%s”, %s, Signal: %#x (unmapped/invalid control data at *0x%x)", id, lv2_obj::name64(lwm.name), lwm.protocol, +lv2_control.signaled, lwm.control))), lv2_control.sq); + show_waiters(add_solid_node(node, QString::fromStdString(fmt::format(u8"LWMutex 0x%08x: “%s”", id, lv2_obj::name64(lwm.name))), QString::fromStdString(fmt::format(u8"LWMutex 0x%08x: “%s”, %s, Signal: %#x (unmapped/invalid control data at *0x%x)", id, lv2_obj::name64(lwm.name), lwm.protocol, +lv2_control.signaled, lwm.control))), lv2_control.sq); break; } - show_waiters(add_solid_node(node, qstr(fmt::format(u8"LWMutex 0x%08x: “%s”", id, lv2_obj::name64(lwm.name))), qstr(fmt::format(u8"LWMutex 0x%08x: “%s”, %s,%s Owner: %s, Locks: %u, Signal: %#x, Control: *0x%x", id, lv2_obj::name64(lwm.name), lwm.protocol, + show_waiters(add_solid_node(node, QString::fromStdString(fmt::format(u8"LWMutex 0x%08x: “%s”", id, lv2_obj::name64(lwm.name))), QString::fromStdString(fmt::format(u8"LWMutex 0x%08x: “%s”, %s,%s Owner: %s, Locks: %u, Signal: %#x, Control: *0x%x", id, lv2_obj::name64(lwm.name), lwm.protocol, (lwm_data.attribute & SYS_SYNC_RECURSIVE) ? " Recursive," : "", owner_str, lwm_data.recursive_count, +lv2_control.signaled, lwm.control))), lv2_control.sq); break; } @@ -550,7 +548,7 @@ void kernel_explorer::update() period = timer.period; // Period (oneshot if 0) } - add_leaf(node, qstr(fmt::format("Timer 0x%08x: State: %s, Period: 0x%llx, Next Expire: 0x%llx, Queue ID: 0x%08x, Source: 0x%08x, Data1: 0x%08x, Data2: 0x%08x", id, timer_state ? "Running" : "Stopped" + add_leaf(node, QString::fromStdString(fmt::format("Timer 0x%08x: State: %s, Period: 0x%llx, Next Expire: 0x%llx, Queue ID: 0x%08x, Source: 0x%08x, Data1: 0x%08x, Data2: 0x%08x", id, timer_state ? "Running" : "Stopped" , period, expire, port ? port->id : 0, source, data1, data2))); break; } @@ -558,20 +556,20 @@ void kernel_explorer::update() { auto& sema = static_cast(obj); const auto val = +sema.val; - show_waiters(add_solid_node(node, qstr(fmt::format(u8"Sema 0x%08x: “%s”", id, lv2_obj::name64(sema.name))), qstr(fmt::format(u8"Sema 0x%08x: “%s”, %s, Count: %d/%d, Key: %#llx", id, lv2_obj::name64(sema.name), sema.protocol, + show_waiters(add_solid_node(node, QString::fromStdString(fmt::format(u8"Sema 0x%08x: “%s”", id, lv2_obj::name64(sema.name))), QString::fromStdString(fmt::format(u8"Sema 0x%08x: “%s”, %s, Count: %d/%d, Key: %#llx", id, lv2_obj::name64(sema.name), sema.protocol, std::max(val, 0), sema.max, sema.key, -std::min(val, 0)))), sema.sq); break; } case SYS_LWCOND_OBJECT: { auto& lwc = static_cast(obj); - show_waiters(add_solid_node(node, qstr(fmt::format(u8"LWCond 0x%08x: “%s”", id, lv2_obj::name64(lwc.name))), qstr(fmt::format(u8"LWCond 0x%08x: “%s”, %s, OG LWMutex: 0x%08x, Control: *0x%x", id, lv2_obj::name64(lwc.name), lwc.protocol, lwc.lwid, lwc.control))), lwc.sq); + show_waiters(add_solid_node(node, QString::fromStdString(fmt::format(u8"LWCond 0x%08x: “%s”", id, lv2_obj::name64(lwc.name))), QString::fromStdString(fmt::format(u8"LWCond 0x%08x: “%s”, %s, OG LWMutex: 0x%08x, Control: *0x%x", id, lv2_obj::name64(lwc.name), lwc.protocol, lwc.lwid, lwc.control))), lwc.sq); break; } case SYS_EVENT_FLAG_OBJECT: { auto& ef = static_cast(obj); - show_waiters(add_solid_node(node, qstr(fmt::format(u8"Event Flag 0x%08x: “%s”", id, lv2_obj::name64(ef.name))), qstr(fmt::format(u8"Event Flag 0x%08x: “%s”, %s, Type: 0x%x, Key: %#llx, Pattern: 0x%llx", id, lv2_obj::name64(ef.name), ef.protocol, + show_waiters(add_solid_node(node, QString::fromStdString(fmt::format(u8"Event Flag 0x%08x: “%s”", id, lv2_obj::name64(ef.name))), QString::fromStdString(fmt::format(u8"Event Flag 0x%08x: “%s”, %s, Type: 0x%x, Key: %#llx, Pattern: 0x%llx", id, lv2_obj::name64(ef.name), ef.protocol, ef.type, ef.key, ef.pattern.load()))), ef.sq); break; } @@ -584,12 +582,12 @@ void kernel_explorer::update() break; } - QTreeWidgetItem* rao_obj = add_solid_node(node, qstr(fmt::format(u8"RSXAudio 0x%08x: Shmem: 0x%08x", id, u32{rao.shmem}))); + QTreeWidgetItem* rao_obj = add_solid_node(node, QString::fromStdString(fmt::format(u8"RSXAudio 0x%08x: Shmem: 0x%08x", id, u32{rao.shmem}))); for (u64 q_idx = 0; q_idx < rao.event_queue.size(); q_idx++) { if (const auto& eq = rao.event_queue[q_idx]) { - add_leaf(rao_obj, qstr(fmt::format(u8"Event Queue %u: ID: 0x%08x", q_idx, eq->id))); + add_leaf(rao_obj, QString::fromStdString(fmt::format(u8"Event Queue %u: ID: 0x%08x", q_idx, eq->id))); } } @@ -597,7 +595,7 @@ void kernel_explorer::update() } default: { - add_leaf(node, qstr(fmt::format("Unknown object 0x%08x", id))); + add_leaf(node, QString::fromStdString(fmt::format("Unknown object 0x%08x", id))); } } }); @@ -605,19 +603,19 @@ void kernel_explorer::update() idm::select([&](u32 /*id*/, sys_vm_t& vmo) { const u32 psize = vmo.psize; - add_leaf(find_node(root, additional_nodes::virtual_memory), qstr(fmt::format("Virtual Mem 0x%08x: Virtual Size: 0x%x (%0.2f MB), Physical Size: 0x%x (%0.2f MB), Mem Container: %s", vmo.addr + add_leaf(find_node(root, additional_nodes::virtual_memory), QString::fromStdString(fmt::format("Virtual Mem 0x%08x: Virtual Size: 0x%x (%0.2f MB), Physical Size: 0x%x (%0.2f MB), Mem Container: %s", vmo.addr , vmo.size, vmo.size * 1. / (1024 * 1024), psize, psize * 1. / (1024 * 1024), vmo.ct->id))); }); idm::select([&](u32 id, lv2_socket& sock) { - add_leaf(find_node(root, additional_nodes::sockets), qstr(fmt::format("Socket %u: Type: %s, Family: %s, Wq: %zu", id, sock.get_type(), sock.get_family(), sock.get_queue_size()))); + add_leaf(find_node(root, additional_nodes::sockets), QString::fromStdString(fmt::format("Socket %u: Type: %s, Family: %s, Wq: %zu", id, sock.get_type(), sock.get_family(), sock.get_queue_size()))); }); idm::select([&](u32 id, lv2_memory_container& container) { const u32 used = container.used; - add_leaf(find_node(root, additional_nodes::memory_containers), qstr(fmt::format("Memory Container 0x%08x: Used: 0x%x/0x%x (%0.2f/%0.2f MB)", id, used, container.size, used * 1. / (1024 * 1024), container.size * 1. / (1024 * 1024)))); + add_leaf(find_node(root, additional_nodes::memory_containers), QString::fromStdString(fmt::format("Memory Container 0x%08x: Used: 0x%x/0x%x (%0.2f/%0.2f MB)", id, used, container.size, used * 1. / (1024 * 1024), container.size * 1. / (1024 * 1024)))); }); std::optional> lock_idm_lv2(std::in_place, id_manager::g_mutex, lv2_obj::g_mutex); @@ -658,7 +656,7 @@ void kernel_explorer::update() const auto func = ppu.last_function; const ppu_thread_status status = lv2_obj::ppu_state(&ppu, false, false).first; - add_leaf(find_node(root, additional_nodes::ppu_threads), qstr(fmt::format(u8"PPU 0x%07x: “%s”, PRIO: %d, Joiner: %s, Status: %s, State: %s, %s func: “%s”%s", id, *ppu.ppu_tname.load(), ppu.prio.load().prio, ppu.joiner.load(), status, ppu.state.load() + add_leaf(find_node(root, additional_nodes::ppu_threads), QString::fromStdString(fmt::format(u8"PPU 0x%07x: “%s”, PRIO: %d, Joiner: %s, Status: %s, State: %s, %s func: “%s”%s", id, *ppu.ppu_tname.load(), ppu.prio.load().prio, ppu.joiner.load(), status, ppu.state.load() , ppu.ack_suspend ? "After" : (ppu.current_function ? "In" : "Last"), func ? func : "", get_wait_time_str(ppu.start_time)))); }, idm::unlocked); @@ -669,7 +667,7 @@ void kernel_explorer::update() const auto func = spu.current_func; const u64 start_time = spu.start_time; - QTreeWidgetItem* spu_thread_tree = add_solid_node(find_node(root, additional_nodes::spu_threads), qstr(fmt::format(u8"SPU 0x%07x: “%s”", spu.lv2_id, *spu.spu_tname.load())), qstr(fmt::format(u8"SPU 0x%07x: “%s”, State: %s, Type: %s, Func: \"%s\"%s", spu.lv2_id, *spu.spu_tname.load(), spu.state.load(), spu.get_type(), start_time && func ? func : "", start_time ? get_wait_time_str(get_guest_system_time(start_time)) : ""))); + QTreeWidgetItem* spu_thread_tree = add_solid_node(find_node(root, additional_nodes::spu_threads), QString::fromStdString(fmt::format(u8"SPU 0x%07x: “%s”", spu.lv2_id, *spu.spu_tname.load())), QString::fromStdString(fmt::format(u8"SPU 0x%07x: “%s”, State: %s, Type: %s, Func: \"%s\"%s", spu.lv2_id, *spu.spu_tname.load(), spu.state.load(), spu.get_type(), start_time && func ? func : "", start_time ? get_wait_time_str(get_guest_system_time(start_time)) : ""))); if (spu.get_type() == spu_type::threaded) { @@ -693,21 +691,21 @@ void kernel_explorer::update() { if (lv2_obj::check(port)) { - add_leaf(spu_thread_tree, qstr(fmt::format("SPU Port %u: Queue ID: 0x%08x", &port - spu.spup, port->id))); + add_leaf(spu_thread_tree, QString::fromStdString(fmt::format("SPU Port %u: Queue ID: 0x%08x", &port - spu.spup, port->id))); } } } else if (has_connected_ports) { // Avoid duplication of information between threads which is common - add_leaf(spu_thread_tree, qstr(fmt::format("SPU Ports: As SPU 0x%07x", first_spu->lv2_id))); + add_leaf(spu_thread_tree, QString::fromStdString(fmt::format("SPU Ports: As SPU 0x%07x", first_spu->lv2_id))); } for (const auto& [key, queue] : spu.spuq) { if (lv2_obj::check(queue)) { - add_leaf(spu_thread_tree, qstr(fmt::format("SPU Queue: Queue ID: 0x%08x, Key: 0x%x", queue->id, key))); + add_leaf(spu_thread_tree, QString::fromStdString(fmt::format("SPU Queue: Queue ID: 0x%08x, Key: 0x%x", queue->id, key))); } } } @@ -717,7 +715,7 @@ void kernel_explorer::update() { if (lv2_obj::check(ctrl.tag)) { - add_leaf(spu_thread_tree, qstr(fmt::format("Interrupt Tag %u: ID: 0x%x, Mask: 0x%x, Status: 0x%x", &ctrl - spu.int_ctrl.data(), ctrl.tag->id, +ctrl.mask, +ctrl.stat))); + add_leaf(spu_thread_tree, QString::fromStdString(fmt::format("Interrupt Tag %u: ID: 0x%x, Mask: 0x%x, Status: 0x%x", &ctrl - spu.int_ctrl.data(), ctrl.tag->id, +ctrl.mask, +ctrl.stat))); } } } @@ -725,7 +723,7 @@ void kernel_explorer::update() idm::select([&](u32 id, lv2_spu_group& tg) { - QTreeWidgetItem* spu_tree = add_solid_node(find_node(root, additional_nodes::spu_thread_groups), qstr(fmt::format(u8"SPU Group 0x%07x: “%s”, Type = 0x%x", id, tg.name, tg.type)), qstr(fmt::format(u8"SPU Group 0x%07x: “%s”, Status = %s, Priority = %d, Type = 0x%x", id, tg.name, tg.run_state.load(), tg.prio.load().prio, tg.type))); + QTreeWidgetItem* spu_tree = add_solid_node(find_node(root, additional_nodes::spu_thread_groups), QString::fromStdString(fmt::format(u8"SPU Group 0x%07x: “%s”, Type = 0x%x", id, tg.name, tg.type)), QString::fromStdString(fmt::format(u8"SPU Group 0x%07x: “%s”, Status = %s, Priority = %d, Type = 0x%x", id, tg.name, tg.run_state.load(), tg.prio.load().prio, tg.type))); if (tg.name.ends_with("CellSpursKernelGroup"sv)) { @@ -763,7 +761,7 @@ void kernel_explorer::update() { const QString branch_name = tr("SPURS %1").arg(pspurs.addr()); const u32 wklEnabled = spurs.wklEnabled; - QTreeWidgetItem* spurs_tree = add_solid_node(spu_tree, branch_name, qstr(fmt::format("SPURS, Instance: *0x%x, LWMutex: 0x%x, LWCond: 0x%x, wklEnabled: 0x%x" + QTreeWidgetItem* spurs_tree = add_solid_node(spu_tree, branch_name, QString::fromStdString(fmt::format("SPURS, Instance: *0x%x, LWMutex: 0x%x, LWCond: 0x%x, wklEnabled: 0x%x" , pspurs, spurs.mutex.sleep_queue, spurs.cond.lwcond_queue, wklEnabled))); const u32 signal_mask = u32{spurs.wklSignal1} << 16 | spurs.wklSignal2; @@ -788,7 +786,7 @@ void kernel_explorer::update() const u8 status = spurs.wklStatus(wid); const auto has_signal = (signal_mask & (0x80000000u >> wid)) ? "Signalled"sv : "No Signal"sv; - QTreeWidgetItem* wkl_tree = add_solid_node(spurs_tree, branch_name + qstr(fmt::format(" Work.%u", wid)), qstr(fmt::format("Work.%u, class: %s, %s, %s, Status: %#x, Event: %#x, %s, ReadyCnt: %u", wid, +name.nameClass, +name.nameInstance, state, status, evt, has_signal, ready_count))); + QTreeWidgetItem* wkl_tree = add_solid_node(spurs_tree, branch_name + QString::fromStdString(fmt::format(" Work.%u", wid)), QString::fromStdString(fmt::format("Work.%u, class: %s, %s, %s, Status: %#x, Event: %#x, %s, ReadyCnt: %u", wid, +name.nameClass, +name.nameInstance, state, status, evt, has_signal, ready_count))); auto contention = [&](u8 v) { @@ -799,11 +797,11 @@ void kernel_explorer::update() }; const auto& winfo = spurs.wklInfo(wid); - add_leaf(wkl_tree, qstr(fmt::format("Contention: %u/%u (pending: %u), Image: *0x%x (size: 0x%x, arg: 0x%x), Priority (BE64): %016x", contention(spurs.wklCurrentContention[wid % 16]) + add_leaf(wkl_tree, QString::fromStdString(fmt::format("Contention: %u/%u (pending: %u), Image: *0x%x (size: 0x%x, arg: 0x%x), Priority (BE64): %016x", contention(spurs.wklCurrentContention[wid % 16]) , contention(spurs.wklMaxContention[wid % 16]), contention(spurs.wklPendingContention[wid % 16]), +winfo.addr, winfo.size, winfo.arg, std::bit_cast>(winfo.priority)))); } - add_leaf(spurs_tree, qstr(fmt::format("Handler Info: PPU0: 0x%x, PPU1: 0x%x, DirtyState: %u, Waiting: %u, Exiting: %u", spurs.ppu0, spurs.ppu1 + add_leaf(spurs_tree, QString::fromStdString(fmt::format("Handler Info: PPU0: 0x%x, PPU1: 0x%x, DirtyState: %u, Waiting: %u, Exiting: %u", spurs.ppu0, spurs.ppu1 , +spurs.handlerDirty, +spurs.handlerWaiting, +spurs.handlerExiting))); } else @@ -834,7 +832,7 @@ void kernel_explorer::update() const QString branch_name = "RSX Context 0x55555555"; QTreeWidgetItem* rsx_tree = add_solid_node(rsx_context_node, branch_name, - branch_name + qstr(fmt::format(u8", Local Size: %u MB, Base Addr: 0x%x, Device Addr: 0x%x, Handlers: 0x%x", rsx->local_mem_size >> 20, base, rsx->device_addr, +vm::_ref(rsx->driver_info).handlers))); + branch_name + QString::fromStdString(fmt::format(u8", Local Size: %u MB, Base Addr: 0x%x, Device Addr: 0x%x, Handlers: 0x%x", rsx->local_mem_size >> 20, base, rsx->device_addr, +vm::_ref(rsx->driver_info).handlers))); QTreeWidgetItem* io_tree = add_volatile_node(rsx_tree, tr("IO-EA Table")); QTreeWidgetItem* zc_tree = add_volatile_node(rsx_tree, tr("Zcull Bindings")); @@ -859,7 +857,7 @@ void kernel_explorer::update() if (size_block) { // Print block - add_leaf(io_tree, qstr(fmt::format("IO: %08x, EA: %08x, Size: %uMB", first_io, first_ea, size_block))); + add_leaf(io_tree, QString::fromStdString(fmt::format("IO: %08x, EA: %08x, Size: %uMB", first_io, first_ea, size_block))); } if (i >= 512u) @@ -885,7 +883,7 @@ void kernel_explorer::update() else { // Print last block before we continue to a new one - add_leaf(io_tree, qstr(fmt::format("IO: %08x, EA: %08x, Size: %uMB", first_io, first_ea, old_block_size))); + add_leaf(io_tree, QString::fromStdString(fmt::format("IO: %08x, EA: %08x, Size: %uMB", first_io, first_ea, old_block_size))); size_block = 1; first_ea = addr; first_io = (i - 1) << 20; @@ -903,7 +901,7 @@ void kernel_explorer::update() { if (zc.bound) { - add_leaf(zc_tree, qstr(fmt::format("O: %07x, W: %u, H: %u, Zformat: 0x%x, AAformat: 0x%x, Dir: 0x%x, sFunc: 0x%x, sRef: %02x, sMask: %02x" + add_leaf(zc_tree, QString::fromStdString(fmt::format("O: %07x, W: %u, H: %u, Zformat: 0x%x, AAformat: 0x%x, Dir: 0x%x, sFunc: 0x%x, sRef: %02x, sMask: %02x" , zc.offset, zc.height, zc.width, zc.zFormat, zc.aaFormat, zc.zcullDir, zc.sFunc, zc.sRef, zc.sMask))); } } @@ -912,7 +910,7 @@ void kernel_explorer::update() { if (db.valid()) { - add_leaf(db_tree, qstr(fmt::format("Offset: %07x, Width: %u, Height: %u, Pitch: %u" + add_leaf(db_tree, QString::fromStdString(fmt::format("Offset: %07x, Width: %u, Height: %u, Pitch: %u" , db.offset, db.height, db.width, db.pitch))); } } @@ -936,7 +934,7 @@ void kernel_explorer::update() return "Unknown object!"; }()); - add_leaf(find_node(root, additional_nodes::file_descriptors), qstr(str)); + add_leaf(find_node(root, additional_nodes::file_descriptors), QString::fromStdString(str)); }); std::function final_touches; @@ -969,7 +967,7 @@ void kernel_explorer::update() if (count > 0) { // Append count - node->setText(0, node->text(0) + qstr(fmt::format(" (%zu)", count))); + node->setText(0, node->text(0) + QString::fromStdString(fmt::format(" (%zu)", count))); // Expand if necessary node->setExpanded(node->data(0, kernel_item_role::expanded_role).toBool()); @@ -1009,7 +1007,7 @@ void kernel_explorer::log(u32 level, QTreeWidgetItem* item) return; } - m_log_buf = qstr(fmt::format("Kernel Explorer: %s\n", Emu.GetTitleAndTitleID())); + m_log_buf = QString::fromStdString(fmt::format("Kernel Explorer: %s\n", Emu.GetTitleAndTitleID())); log(level + 1, item); sys_log.success("%s", m_log_buf); diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index 1326f112d9..547acd97d6 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -103,8 +103,6 @@ extern atomic_t g_user_asked_for_frame_capture; class CPUDisAsm; std::shared_ptr make_basic_ppu_disasm(); -inline std::string sstr(const QString& _in) { return _in.toStdString(); } - extern void qt_events_aware_op(int repeat_duration_ms, std::function wrapped_op) { ensure(wrapped_op); @@ -313,12 +311,12 @@ void main_window::update_gui_pad_thread() QString main_window::GetCurrentTitle() { - QString title = qstr(Emu.GetTitleAndTitleID()); - if (title.isEmpty()) + std::string title = Emu.GetTitleAndTitleID(); + if (title.empty()) { - title = qstr(Emu.GetLastBoot()); + title = Emu.GetLastBoot(); } - return title; + return QString::fromStdString(title); } // returns appIcon @@ -595,7 +593,7 @@ void main_window::BootElf() // game folder in case of having e.g. a Game Folder with collected links to elf files. // Don't set last path earlier in case of cancelled dialog m_gui_settings->SetValue(gui::fd_boot_elf, file_path); - const std::string path = sstr(QFileInfo(file_path).absoluteFilePath()); + const std::string path = QFileInfo(file_path).absoluteFilePath().toStdString(); gui_log.notice("Booting from BootElf..."); Boot(path, "", true, true); @@ -635,7 +633,7 @@ void main_window::BootTest() return; } - const std::string path = sstr(QFileInfo(file_path).absoluteFilePath()); + const std::string path = QFileInfo(file_path).absoluteFilePath().toStdString(); gui_log.notice("Booting from BootTest..."); Boot(path, "", true); @@ -651,7 +649,7 @@ void main_window::BootSavestate() stopped = true; } - const QString file_path = QFileDialog::getOpenFileName(this, tr("Select Savestate To Boot"), qstr(fs::get_config_dir() + "savestates/"), tr( + const QString file_path = QFileDialog::getOpenFileName(this, tr("Select Savestate To Boot"), QString::fromStdString(fs::get_config_dir() + "savestates/"), tr( "Savestate files (*.SAVESTAT *.SAVESTAT.zst *.SAVESTAT.gz);;" "All files (*.*)"), Q_NULLPTR, QFileDialog::DontResolveSymlinks); @@ -665,7 +663,7 @@ void main_window::BootSavestate() return; } - const std::string path = sstr(QFileInfo(file_path).absoluteFilePath()); + const std::string path = QFileInfo(file_path).absoluteFilePath().toStdString(); gui_log.notice("Booting from BootSavestate..."); Boot(path, "", true); @@ -696,7 +694,7 @@ void main_window::BootGame() m_gui_settings->SetValue(gui::fd_boot_game, QFileInfo(dir_path).path()); gui_log.notice("Booting from BootGame..."); - Boot(sstr(dir_path), "", false, true); + Boot(dir_path.toStdString(), "", false, true); } void main_window::BootVSH() @@ -717,7 +715,7 @@ void main_window::BootRsxCapture(std::string path) is_stopped = true; } - const QString file_path = QFileDialog::getOpenFileName(this, tr("Select RSX Capture"), qstr(fs::get_config_dir() + "captures/"), tr("RRC files (*.rrc *.RRC *.rrc.gz *.RRC.GZ);;All files (*.*)")); + const QString file_path = QFileDialog::getOpenFileName(this, tr("Select RSX Capture"), QString::fromStdString(fs::get_config_dir() + "captures/"), tr("RRC files (*.rrc *.RRC *.rrc.gz *.RRC.GZ);;All files (*.*)")); if (file_path.isEmpty()) { @@ -727,7 +725,7 @@ void main_window::BootRsxCapture(std::string path) } return; } - path = sstr(file_path); + path = file_path.toStdString(); } if (!m_gui_settings->GetBootConfirmation(this)) @@ -757,7 +755,7 @@ bool main_window::InstallFileInExData(const std::string& extension, const QStrin // Copy file atomically with thread/process-safe error checking for file size const std::string to_path = rpcs3::utils::get_hdd0_dir() + "/home/" + Emu.GetUsr() + "/exdata/" + filename.substr(0, filename.find_last_of('.')); fs::pending_file to(to_path + "." + extension); - fs::file from(sstr(path)); + fs::file from(path.toStdString()); if (!to.file || !from) { @@ -908,7 +906,7 @@ bool main_window::InstallPackages(QStringList file_paths, bool from_boot) for (const QString& file : file_paths.filter(QRegularExpression(pattern, QRegularExpression::PatternOption::CaseInsensitiveOption))) { const QFileInfo file_info(file); - const std::string filename = sstr(file_info.fileName()); + const std::string filename = file_info.fileName().toStdString(); if (InstallFileInExData(extension, file, filename)) { @@ -1054,7 +1052,7 @@ bool main_window::HandlePackageInstallation(QStringList file_paths, bool from_bo for (const compat::package_info& info : packages) { - readers.emplace_back(sstr(info.path)); + readers.emplace_back(info.path.toStdString()); } std::deque bootable_paths; @@ -1282,7 +1280,7 @@ void main_window::ExtractMSELF() if (!dir.isEmpty()) { m_gui_settings->SetValue(gui::fd_ext_mself, QFileInfo(file_path).path()); - extract_mself(sstr(file_path), sstr(dir) + '/'); + extract_mself(file_path.toStdString(), dir.toStdString() + '/'); } } @@ -1376,7 +1374,7 @@ void main_window::ExtractTar() const QString& file = *files_it; // Do not abort on failure here, in case the user selected a wrong file in multi-selection while the rest are valid - if (!extract_tar(sstr(file), sstr(dir) + '/')) + if (!extract_tar(file.toStdString(), dir.toStdString() + '/')) { if (error.isEmpty()) { @@ -1427,7 +1425,7 @@ void main_window::HandlePupInstallation(const QString& file_path, const QString& m_gui_settings->SetValue(gui::fd_install_pup, QFileInfo(file_path).path()); - const std::string path = sstr(file_path); + const std::string path = file_path.toStdString(); fs::file pup_f(path); if (!pup_f) @@ -1515,7 +1513,7 @@ void main_window::HandlePupInstallation(const QString& file_path, const QString& { // Extract only mode, extract direct TAR entries to a user directory - if (!vfs::mount("/pup_extract", sstr(dir_path) + '/')) + if (!vfs::mount("/pup_extract", dir_path.toStdString() + '/')) { gui_log.error("Error while extracting firmware: Failed to mount '%s'", dir_path); critical(tr("Firmware extraction failed: VFS mounting failed.")); @@ -1570,7 +1568,7 @@ void main_window::HandlePupInstallation(const QString& file_path, const QString& } if (version_string < cur_version && - QMessageBox::question(this, tr("RPCS3 Firmware Installer"), tr("Old firmware detected.\nThe newest firmware version is %1 and you are trying to install version %2\nContinue installation?").arg(QString::fromUtf8(cur_version.data(), ::size32(cur_version)), qstr(version_string)), + QMessageBox::question(this, tr("RPCS3 Firmware Installer"), tr("Old firmware detected.\nThe newest firmware version is %1 and you are trying to install version %2\nContinue installation?").arg(QString::fromUtf8(cur_version.data(), ::size32(cur_version)), QString::fromStdString(version_string)), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::No) { return; @@ -1580,7 +1578,7 @@ void main_window::HandlePupInstallation(const QString& file_path, const QString& { gui_log.warning("Reinstalling firmware: old=%s, new=%s", installed, version_string); - if (QMessageBox::question(this, tr("RPCS3 Firmware Installer"), tr("Firmware of version %1 has already been installed.\nOverwrite current installation with version %2?").arg(qstr(installed), qstr(version_string)), + if (QMessageBox::question(this, tr("RPCS3 Firmware Installer"), tr("Firmware of version %1 has already been installed.\nOverwrite current installation with version %2?").arg(QString::fromStdString(installed), QString::fromStdString(version_string)), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::No) { gui_log.warning("Reinstallation of firmware aborted."); @@ -1591,7 +1589,7 @@ void main_window::HandlePupInstallation(const QString& file_path, const QString& // Remove possibly PS3 fonts from database QFontDatabase::removeAllApplicationFonts(); - progress_dialog pdlg(tr("RPCS3 Firmware Installer"), tr("Installing firmware version %1\nPlease wait...").arg(qstr(version_string)), tr("Cancel"), 0, static_cast(update_filenames.size()), false, this); + progress_dialog pdlg(tr("RPCS3 Firmware Installer"), tr("Installing firmware version %1\nPlease wait...").arg(QString::fromStdString(version_string)), tr("Cancel"), 0, static_cast(update_filenames.size()), false, this); pdlg.show(); // Used by tar_object::extract() as destination directory @@ -1703,10 +1701,10 @@ void main_window::DecryptSPRXLibraries() { QString path_last_sprx = m_gui_settings->GetValue(gui::fd_decrypt_sprx).toString(); - if (!fs::is_dir(sstr(path_last_sprx))) + if (!fs::is_dir(path_last_sprx.toStdString())) { // Default: redirect to userland firmware SPRX directory - path_last_sprx = qstr(g_cfg_vfs.get_dev_flash() + "sys/external"); + path_last_sprx = QString::fromStdString(g_cfg_vfs.get_dev_flash() + "sys/external"); } const QStringList modules = QFileDialog::getOpenFileNames(this, tr("Select binary files"), path_last_sprx, tr("All Binaries (*.bin *.BIN *.self *.SELF *.sprx *.SPRX *.sdat *.SDAT *.edat *.EDAT);;" @@ -1734,14 +1732,14 @@ void main_window::DecryptSPRXLibraries() const std::string filename = path.substr(path.find_last_of(fs::delim) + 1); const QString hint = tr("Hint: KLIC (KLicense key) is a 16-byte long string. (32 hexadecimal characters, can be prefixed with \"KLIC=0x\" from the log message)" - "\nAnd is logged with some sceNpDrm* functions when the game/application which owns \"%0\" is running.").arg(qstr(filename)); + "\nAnd is logged with some sceNpDrm* functions when the game/application which owns \"%0\" is running.").arg(QString::fromStdString(filename)); if (repeat_count >= 2) { gui_log.error("Failed to decrypt %s with specified KLIC, retrying.\n%s", path, hint); } - input_dialog* dlg = new input_dialog(39, "", tr("Enter KLIC of %0").arg(qstr(filename)), + input_dialog* dlg = new input_dialog(39, "", tr("Enter KLIC of %0").arg(QString::fromStdString(filename)), repeat_count >= 2 ? tr("Decryption failed with provided KLIC.\n%0").arg(hint) : tr("Hexadecimal value."), "KLIC=0x00000000000000000000000000000000", this); QFont mono = QFontDatabase::systemFont(QFontDatabase::FixedFont); @@ -1759,7 +1757,7 @@ void main_window::DecryptSPRXLibraries() connect(dlg, &QDialog::accepted, this, [this, iterate, dlg, mod_index, decrypter, repeat_count]() { - std::string text = sstr(dlg->get_input_text()); + std::string text = dlg->get_input_text().toStdString(); if (usz new_index = decrypter->decrypt(std::move(text)); !decrypter->done()) { @@ -2424,7 +2422,7 @@ void main_window::ShowOptionalGamePreparations(const QString& title, const QStri { for (const game_info& gameinfo : m_game_list_frame->GetGameInfo()) { - if (gameinfo && gameinfo->info.serial == sstr(title_id)) + if (gameinfo && gameinfo->info.serial == title_id.toStdString()) { if (Emu.IsPathInsideDir(boot_path, gameinfo->info.path)) { @@ -2537,7 +2535,7 @@ void main_window::CreateConnects() } // Only select one folder for now - QString dir = QFileDialog::getExistingDirectory(this, tr("Select a folder containing one or more games"), qstr(fs::get_config_dir()), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); + QString dir = QFileDialog::getExistingDirectory(this, tr("Select a folder containing one or more games"), QString::fromStdString(fs::get_config_dir()), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if (dir.isEmpty()) { return; @@ -2645,7 +2643,7 @@ void main_window::CreateConnects() } // Get new filename from title and title ID but simplified - QString log_filename_q = qstr(Emu.GetTitleID().empty() ? "RPCS3" : Emu.GetTitleAndTitleID()); + QString log_filename_q = QString::fromStdString(Emu.GetTitleID().empty() ? "RPCS3" : Emu.GetTitleAndTitleID()); ensure(!log_filename_q.isEmpty()); // Replace unfitting characters @@ -2697,7 +2695,7 @@ void main_window::CreateConnects() if (archived_stat.size) { - const QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select RPCS3's log saving location (saving %0)").arg(qstr(log_filename + ".log.gz")), path_last_log, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); + const QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select RPCS3's log saving location (saving %0)").arg(QString::fromStdString(log_filename + ".log.gz")), path_last_log, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if (dir_path.isEmpty()) { @@ -2720,7 +2718,7 @@ void main_window::CreateConnects() return; } - const QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select RPCS3's log saving location (saving %0)").arg(qstr(log_filename + ".log")), path_last_log, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); + const QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select RPCS3's log saving location (saving %0)").arg(QString::fromStdString(log_filename + ".log")), path_last_log, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); if (dir_path.isEmpty()) { @@ -3245,7 +3243,7 @@ void main_window::CreateConnects() const QStringList categories = get_cats(act, id); for (const game_info& game : m_game_list_frame->GetGameInfo()) { - if (game && categories.contains(qstr(game->info.category))) count++; + if (game && categories.contains(QString::fromStdString(game->info.category))) count++; } act->setText(QString("%0 (%1)").arg(text).arg(count)); }; @@ -3472,14 +3470,14 @@ void main_window::CreateDockWindows() if (title_and_title_id == Emu.GetTitleAndTitleID()) // This should usually not cause trouble, but feel free to improve. { - tooltip = tr("Restart %0").arg(qstr(title_and_title_id)); + tooltip = tr("Restart %0").arg(QString::fromStdString(title_and_title_id)); ui->toolbar_start->setIcon(m_icon_restart); ui->toolbar_start->setText(tr("Restart")); } else { - tooltip = tr("Play %0").arg(qstr(title_and_title_id)); + tooltip = tr("Play %0").arg(QString::fromStdString(title_and_title_id)); ui->toolbar_start->setIcon(m_icon_play); ui->toolbar_start->setText(tr("Play")); @@ -3670,7 +3668,7 @@ void main_window::RemoveAllCaches() for (const game_info& game : m_game_list_frame->GetGameInfo()) // Loop on detected games { - if (game && qstr(game->info.category) != cat::cat_ps3_os && fs::exists(cache_base_dir + game->info.serial)) // If not OS category and cache exists + if (game && QString::fromStdString(game->info.category) != cat::cat_ps3_os && fs::exists(cache_base_dir + game->info.serial)) // If not OS category and cache exists { caches_count++; @@ -3726,7 +3724,7 @@ void main_window::CleanUpGameList() for (const game_info& game : m_game_list_frame->GetGameInfo()) // Loop on detected games { // If Disc Game and its serial is found in game list file - if (game && qstr(game->info.category) == cat::cat_disc_game && game->info.serial == serial) + if (game && QString::fromStdString(game->info.category) == cat::cat_disc_game && game->info.serial == serial) { found = true; break; @@ -3758,7 +3756,7 @@ void main_window::RemoveFirmwareCache() const QStringList filter{ QStringLiteral("ppu-*-lib*.sprx")}; - QDirIterator dir_iter(qstr(cache_dir), filter, QDir::Dirs | QDir::NoDotAndDotDot); + QDirIterator dir_iter(QString::fromStdString(cache_dir), filter, QDir::Dirs | QDir::NoDotAndDotDot); while (dir_iter.hasNext()) { @@ -3881,7 +3879,7 @@ void main_window::AddGamesFromDirs(QStringList&& paths) for (const QString& path : paths) { - games_added += Emu.AddGamesFromDir(sstr(path)); + games_added += Emu.AddGamesFromDir(path.toStdString()); } if (games_added) @@ -3900,7 +3898,7 @@ void main_window::AddGamesFromDirs(QStringList&& paths) { for (const auto& dir_path : paths) { - if (Emu.IsPathInsideDir(game->info.path, sstr(dir_path))) + if (Emu.IsPathInsideDir(game->info.path, dir_path.toStdString())) { // Try to claim operation on directory path @@ -3909,7 +3907,7 @@ void main_window::AddGamesFromDirs(QStringList&& paths) if (!resolved_path.empty() && !claimed_paths.count(resolved_path)) { claimed_paths.emplace(game->info.path); - paths_added.emplace(game->info.path, qstr(game->info.serial)); + paths_added.emplace(game->info.path, QString::fromStdString(game->info.serial)); } break; @@ -4090,13 +4088,13 @@ void main_window::dropEvent(QDropEvent* event) { for (const auto& psf : drop_paths) { - const std::string psf_path = sstr(psf); + const std::string psf_path = psf.toStdString(); std::string info = fmt::format("Dropped PARAM.SFO '%s':\n\n%s", psf_path, psf::load(psf_path).sfo); gui_log.success("%s", info); info.erase(info.begin(), info.begin() + info.find_first_of('\'')); - QMessageBox mb(QMessageBox::Information, tr("PARAM.SFO Information"), qstr(info), QMessageBox::Ok, this); + QMessageBox mb(QMessageBox::Information, tr("PARAM.SFO Information"), QString::fromStdString(info), QMessageBox::Ok, this); mb.setTextInteractionFlags(Qt::TextSelectableByMouse); mb.exec(); } @@ -4147,7 +4145,7 @@ void main_window::dropEvent(QDropEvent* event) } case drop_type::drop_rrc: // replay a rsx capture file { - BootRsxCapture(sstr(drop_paths.first())); + BootRsxCapture(drop_paths.first().toStdString()); break; } } diff --git a/rpcs3/rpcs3qt/memory_viewer_panel.cpp b/rpcs3/rpcs3qt/memory_viewer_panel.cpp index d2d03f01b9..533dccc4d2 100644 --- a/rpcs3/rpcs3qt/memory_viewer_panel.cpp +++ b/rpcs3/rpcs3qt/memory_viewer_panel.cpp @@ -30,8 +30,6 @@ LOG_CHANNEL(gui_log, "GUI"); -constexpr auto qstr = QString::fromStdString; - memory_viewer_panel::memory_viewer_panel(QWidget* parent, std::shared_ptr disasm, u32 addr, std::function func) : QDialog(parent) , m_addr(addr) @@ -67,7 +65,7 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent, std::shared_ptrget_name())) : + cpu && m_type == thread_class::spu ? tr("Memory Viewer Of %0").arg(QString::fromStdString(cpu->get_name())) : cpu && m_type == thread_class::rsx ? tr("Memory Viewer Of RSX[0x55555555]") : tr("Memory Viewer")); @@ -362,11 +360,11 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent, std::shared_ptr 1) { - m_cbox_input_mode->setItemText(std::countr_zero(i), qstr(fmt::format("* %s", search_mode{i}))); + m_cbox_input_mode->setItemText(std::countr_zero(i), QString::fromStdString(fmt::format("* %s", search_mode{i}))); } else { - m_cbox_input_mode->setItemText(std::countr_zero(i), qstr(fmt::format("%s", search_mode{i}))); + m_cbox_input_mode->setItemText(std::countr_zero(i), QString::fromStdString(fmt::format("%s", search_mode{i}))); } } @@ -633,7 +631,7 @@ void memory_viewer_panel::scroll(s32 steps) m_addr &= m_addr_mask; // Mask it m_addr -= m_addr % (m_colcount * 4); // Align by amount of bytes in a row - m_addr_line->setText(qstr(fmt::format("%08x", m_addr))); + m_addr_line->setText(QString::fromStdString(fmt::format("%08x", m_addr))); ShowMemory(); } @@ -818,7 +816,7 @@ void memory_viewer_panel::ShowMemory() for (u32 i = 0; i < 3; i++) { - t_mem_addr_str += qstr(fmt::format("%08x", addr)); + t_mem_addr_str += QString::fromStdString(fmt::format("%08x", addr)); std::string str(i == 1 ? header : ""); @@ -828,7 +826,7 @@ void memory_viewer_panel::ShowMemory() str.resize(expected_str_size); std::replace(str.begin(), str.end(), '\0', i == 1 ? ' ' : '='); - t_mem_hex_str += qstr(str); + t_mem_hex_str += QString::fromStdString(str); spu_passed++; row++; @@ -850,7 +848,7 @@ void memory_viewer_panel::ShowMemory() } } - t_mem_addr_str += qstr(fmt::format("%08x", (m_addr + (row - spu_passed) * m_colcount * 4) & m_addr_mask)); + t_mem_addr_str += QString::fromStdString(fmt::format("%08x", (m_addr + (row - spu_passed) * m_colcount * 4) & m_addr_mask)); } for (u32 col = 0; col < m_colcount; col++) @@ -865,7 +863,7 @@ void memory_viewer_panel::ShowMemory() if (const auto ptr = this->to_ptr(addr)) { const be_t rmem = read_from_ptr>(static_cast(ptr)); - t_mem_hex_str += qstr(fmt::format("%02x %02x %02x %02x", + t_mem_hex_str += QString::fromStdString(fmt::format("%02x %02x %02x %02x", static_cast(rmem >> 24), static_cast(rmem >> 16), static_cast(rmem >> 8), @@ -878,7 +876,7 @@ void memory_viewer_panel::ShowMemory() if (!std::isprint(static_cast(ch))) ch = '.'; } - t_mem_ascii_str += qstr(std::move(str)); + t_mem_ascii_str += QString::fromStdString(std::move(str)); } else { @@ -1190,7 +1188,7 @@ void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, color_format form QLineEdit* addr_line = static_cast(parent())->m_addr_line; const QPointF xy = static_cast(event)->position() / m_canvas_scale; - addr_line->setText(qstr(fmt::format("%08x", get_pointed_addr(xy.x(), xy.y())))); + addr_line->setText(QString::fromStdString(fmt::format("%08x", get_pointed_addr(xy.x(), xy.y())))); Q_EMIT addr_line->returnPressed(); close(); return false; @@ -1208,11 +1206,11 @@ void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, color_format form { if (x < 0 || y < 0) { - m_image_title->setText(qstr(fmt::format("[-, -]: NA"))); + m_image_title->setText(QString::fromStdString(fmt::format("[-, -]: NA"))); return; } - m_image_title->setText(qstr(fmt::format("[x:%d, y:%d]: 0x%x", x, y, get_pointed_addr(x, y)))); + m_image_title->setText(QString::fromStdString(fmt::format("[x:%d, y:%d]: 0x%x", x, y, get_pointed_addr(x, y)))); } void keyPressEvent(QKeyEvent* event) override @@ -1257,7 +1255,7 @@ void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, color_format form image_viewer* f_image_viewer = new image_viewer(parent, canvas, image_title, std::move(image), addr, texel_bytes, width, width, height); canvas->installEventFilter(f_image_viewer); - f_image_viewer->setWindowTitle(qstr(fmt::format("Raw Image @ 0x%x", addr))); + f_image_viewer->setWindowTitle(QString::fromStdString(fmt::format("Raw Image @ 0x%x", addr))); f_image_viewer->setLayout(layout); f_image_viewer->setAttribute(Qt::WA_DeleteOnClose); f_image_viewer->show(); diff --git a/rpcs3/rpcs3qt/pad_settings_dialog.cpp b/rpcs3/rpcs3qt/pad_settings_dialog.cpp index 4710ad4ec4..09032c0926 100644 --- a/rpcs3/rpcs3qt/pad_settings_dialog.cpp +++ b/rpcs3/rpcs3qt/pad_settings_dialog.cpp @@ -26,8 +26,6 @@ LOG_CHANNEL(cfg_log, "CFG"); -inline std::string sstr(const QString& _in) { return _in.toStdString(); } - cfg_input_configurations g_cfg_input_configs; inline bool CreateConfigFile(const QString& dir, const QString& name) @@ -1395,7 +1393,7 @@ void pad_settings_dialog::ChangeHandler() } else { - handler = sstr(ui->chooseHandler->currentData().toString()); + handler = ui->chooseHandler->currentData().toString().toStdString(); device = player_config->device.to_string(); buddy_device = player_config->buddy_device.to_string(); } @@ -1518,7 +1516,7 @@ void pad_settings_dialog::ChangeHandler() { const QString device_name = name_string + QString::number(i); const QString device_name_localized = GetLocalizedPadName(m_handler->m_type, device_name, i); - ui->chooseDevice->addItem(device_name_localized, QVariant::fromValue(pad_device_info{ sstr(device_name), device_name_localized, true })); + ui->chooseDevice->addItem(device_name_localized, QVariant::fromValue(pad_device_info{ device_name.toStdString(), device_name_localized, true })); } force_enable = true; break; @@ -1626,7 +1624,7 @@ void pad_settings_dialog::ChangeConfig(const QString& config_file) if (config_file.isEmpty()) return; - m_config_file = sstr(config_file); + m_config_file = config_file.toStdString(); // Load in order to get the pad handlers if (!g_cfg_input.load(m_title_id, m_config_file, true)) diff --git a/rpcs3/rpcs3qt/qt_utils.cpp b/rpcs3/rpcs3qt/qt_utils.cpp index 0094d83618..c4e8c5a571 100644 --- a/rpcs3/rpcs3qt/qt_utils.cpp +++ b/rpcs3/rpcs3qt/qt_utils.cpp @@ -16,8 +16,6 @@ LOG_CHANNEL(gui_log, "GUI"); -constexpr auto qstr = QString::fromStdString; - namespace gui { namespace utils @@ -397,7 +395,7 @@ namespace gui if (!found_file) { // Get Icon for the gs_frame from path. this handles presumably all possible use cases - const QString qpath = qstr(path); + const QString qpath = QString::fromStdString(path); const std::string path_list[] = { path, qpath.section("/", 0, -2, QString::SectionIncludeTrailingSep).toStdString(), qpath.section("/", 0, -3, QString::SectionIncludeTrailingSep).toStdString() }; @@ -422,7 +420,7 @@ namespace gui if (found_file) { // load the image from path. It will most likely be a rectangle - const QImage source = QImage(qstr(icon_path)); + const QImage source = QImage(QString::fromStdString(icon_path)); const int edge_max = std::max(source.width(), source.height()); // create a new transparent image with square size and same format as source (maybe handle other formats than RGB32 as well?) @@ -448,7 +446,7 @@ namespace gui void open_dir(const std::string& spath) { - QString path = qstr(spath); + QString path = QString::fromStdString(spath); if (fs::is_file(spath)) { @@ -470,7 +468,7 @@ namespace gui QProcess::execute("/usr/bin/osascript", { "-e", "tell application \"Finder\" to activate" }); #else // open parent directory - const QUrl url = QUrl::fromLocalFile(qstr(fs::get_parent_dir(spath))); + const QUrl url = QUrl::fromLocalFile(QString::fromStdString(fs::get_parent_dir(spath))); const std::string url_path = url.toString().toStdString(); gui_log.notice("gui::utils::open_dir: About to open parent dir url '%s' for path '%s'", url_path, spath); diff --git a/rpcs3/rpcs3qt/register_editor_dialog.cpp b/rpcs3/rpcs3qt/register_editor_dialog.cpp index 54f50e6f60..639fb7db35 100644 --- a/rpcs3/rpcs3qt/register_editor_dialog.cpp +++ b/rpcs3/rpcs3qt/register_editor_dialog.cpp @@ -18,10 +18,6 @@ #include "util/v128.hpp" #include "util/asm.hpp" -constexpr auto qstr = QString::fromStdString; -inline std::string sstr(const QString& _in) { return _in.toStdString(); } -inline std::string sstr(const QVariant& _in) { return sstr(_in.toString()); } - enum registers : int { ppu_r0, @@ -108,10 +104,10 @@ register_editor_dialog::register_editor_dialog(QWidget *parent, CPUDisAsm* _disa { if (cpu->get_class() == thread_class::ppu) { - for (int i = ppu_r0; i <= ppu_r31; i++) m_register_combo->addItem(qstr(fmt::format("r%d", i % 32)), i); - for (int i = ppu_f0; i <= ppu_f31; i++) m_register_combo->addItem(qstr(fmt::format("f%d", i % 32)), i); - for (int i = ppu_ff0; i <= ppu_ff31; i++) m_register_combo->addItem(qstr(fmt::format("ff%d", i % 32)), i); - for (int i = ppu_v0; i <= ppu_v31; i++) m_register_combo->addItem(qstr(fmt::format("v%d", i % 32)), i); + for (int i = ppu_r0; i <= ppu_r31; i++) m_register_combo->addItem(QString::fromStdString(fmt::format("r%d", i % 32)), i); + for (int i = ppu_f0; i <= ppu_f31; i++) m_register_combo->addItem(QString::fromStdString(fmt::format("f%d", i % 32)), i); + for (int i = ppu_ff0; i <= ppu_ff31; i++) m_register_combo->addItem(QString::fromStdString(fmt::format("ff%d", i % 32)), i); + for (int i = ppu_v0; i <= ppu_v31; i++) m_register_combo->addItem(QString::fromStdString(fmt::format("v%d", i % 32)), i); m_register_combo->addItem("CR", +PPU_CR); m_register_combo->addItem("LR", +PPU_LR); m_register_combo->addItem("CTR", PPU_CTR); @@ -124,7 +120,7 @@ register_editor_dialog::register_editor_dialog(QWidget *parent, CPUDisAsm* _disa } else if (cpu->get_class() == thread_class::spu) { - for (int i = spu_r0; i <= spu_r127; i++) m_register_combo->addItem(qstr(fmt::format("r%d", i % 128)), i); + for (int i = spu_r0; i <= spu_r127; i++) m_register_combo->addItem(QString::fromStdString(fmt::format("r%d", i % 128)), i); m_register_combo->addItem("MFC Pending Events", +MFC_PEVENTS); m_register_combo->addItem("MFC Events Mask", +MFC_EVENTS_MASK); m_register_combo->addItem("MFC Events Count", +MFC_EVENTS_COUNT); @@ -167,7 +163,7 @@ register_editor_dialog::register_editor_dialog(QWidget *parent, CPUDisAsm* _disa void register_editor_dialog::updateRegister(int reg) const { - std::string str = sstr(tr("Error parsing register value!")); + std::string str = tr("Error parsing register value!").toStdString(); const auto cpu = m_get_cpu(); @@ -196,7 +192,7 @@ void register_editor_dialog::updateRegister(int reg) const else if (reg == PPU_CTR) str = fmt::format("%016llx", ppu.ctr); else if (reg == PPU_VRSAVE) str = fmt::format("%08x", ppu.vrsave); else if (reg == PPU_PRIO) str = fmt::format("%08x", ppu.prio.load().prio); - else if (reg == RESERVATION_LOST) str = sstr(ppu.raddr ? tr("Lose reservation on OK") : tr("Reservation is inactive")); + else if (reg == RESERVATION_LOST) str = ppu.raddr ? tr("Lose reservation on OK").toStdString() : tr("Reservation is inactive").toStdString(); else if (reg == PC) str = fmt::format("%08x", ppu.cia); } else if (cpu->get_class() == thread_class::spu) @@ -218,17 +214,17 @@ void register_editor_dialog::updateRegister(int reg) const else if (reg == SPU_SNR2) str = fmt::format("%s", spu.ch_snr2); else if (reg == SPU_OUT_MBOX) str = fmt::format("%s", spu.ch_out_mbox); else if (reg == SPU_OUT_INTR_MBOX) str = fmt::format("%s", spu.ch_out_intr_mbox); - else if (reg == RESERVATION_LOST) str = sstr(spu.raddr ? tr("Lose reservation on OK") : tr("Reservation is inactive")); + else if (reg == RESERVATION_LOST) str = spu.raddr ? tr("Lose reservation on OK").toStdString() : tr("Reservation is inactive").toStdString(); else if (reg == PC) str = fmt::format("%08x", spu.pc); } - m_value_line->setText(qstr(str)); + m_value_line->setText(QString::fromStdString(str)); } void register_editor_dialog::OnOkay() { const int reg = m_register_combo->currentData().toInt(); - std::string value = sstr(m_value_line->text()); + std::string value = m_value_line->text().toStdString(); auto check_res = [](std::from_chars_result res, const char* end) { diff --git a/rpcs3/rpcs3qt/rsx_debugger.cpp b/rpcs3/rpcs3qt/rsx_debugger.cpp index bdea183d2e..234adbd8e2 100644 --- a/rpcs3/rpcs3qt/rsx_debugger.cpp +++ b/rpcs3/rpcs3qt/rsx_debugger.cpp @@ -28,8 +28,6 @@ enum GCMEnumTypes CELL_GCM_PRIMITIVE_ENUM, }; -constexpr auto qstr = QString::fromStdString; - LOG_CHANNEL(rsx_debugger, "RSX Debugger"); namespace utils @@ -604,9 +602,9 @@ void rsx_debugger::OnClickDrawCalls() // Programs m_transform_disasm->clear(); - m_transform_disasm->setText(qstr(frame_debug.draw_calls[draw_id].programs.first)); + m_transform_disasm->setText(QString::fromStdString(frame_debug.draw_calls[draw_id].programs.first)); m_fragment_disasm->clear(); - m_fragment_disasm->setText(qstr(frame_debug.draw_calls[draw_id].programs.second)); + m_fragment_disasm->setText(QString::fromStdString(frame_debug.draw_calls[draw_id].programs.second)); m_list_index_buffer->clear(); //m_list_index_buffer->insertColumn(0, "Index", 0, 700); @@ -615,7 +613,7 @@ void rsx_debugger::OnClickDrawCalls() auto index_buffer = ref_ptr(frame_debug.draw_calls[draw_id].index); for (u32 i = 0; i < frame_debug.draw_calls[draw_id].vertex_count; ++i) { - m_list_index_buffer->insertItem(i, qstr(std::to_string(index_buffer[i]))); + m_list_index_buffer->insertItem(i, QString::fromStdString(std::to_string(index_buffer[i]))); } } if (frame_debug.draw_calls[draw_id].state.index_type() == rsx::index_array_type::u32) @@ -623,7 +621,7 @@ void rsx_debugger::OnClickDrawCalls() auto index_buffer = ref_ptr(frame_debug.draw_calls[draw_id].index); for (u32 i = 0; i < frame_debug.draw_calls[draw_id].vertex_count; ++i) { - m_list_index_buffer->insertItem(i, qstr(std::to_string(index_buffer[i]))); + m_list_index_buffer->insertItem(i, QString::fromStdString(std::to_string(index_buffer[i]))); } } } @@ -647,7 +645,7 @@ void rsx_debugger::GetMemory() const { str.clear(); rsx::get_pretty_printing_function(command.first)(str, command.first, command.second); - m_list_captured_frame->setItem(cmd_i++, 0, new QTableWidgetItem(qstr(str))); + m_list_captured_frame->setItem(cmd_i++, 0, new QTableWidgetItem(QString::fromStdString(str))); dump += str; dump += '\n'; @@ -659,7 +657,7 @@ void rsx_debugger::GetMemory() const } for (u32 i = 0; i < frame_debug.draw_calls.size(); i++) - m_list_captured_draw_calls->setItem(i, 0, new QTableWidgetItem(qstr(frame_debug.draw_calls[i].name))); + m_list_captured_draw_calls->setItem(i, 0, new QTableWidgetItem(QString::fromStdString(frame_debug.draw_calls[i].name))); } void rsx_debugger::GetBuffers() const diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index abea4b47bf..7ad9023f4e 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -45,10 +45,6 @@ LOG_CHANNEL(cfg_log, "CFG"); -inline std::string sstr(const QString& _in) { return _in.toStdString(); } -inline std::string sstr(const QVariant& _in) { return sstr(_in.toString()); } -inline QString qsv(std::string_view sv) { return QString(sv.data()); } - std::pair get_data(const QComboBox* box, int index) { if (!box) return {}; @@ -137,7 +133,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std if (game) { m_emu_settings->LoadSettings(game->serial, create_cfg_from_global_cfg); - setWindowTitle(tr("Settings: [%0] %1", "Settings dialog").arg(qstr(game->serial)).arg(qstr(game->name))); + setWindowTitle(tr("Settings: [%0] %1", "Settings dialog").arg(QString::fromStdString(game->serial)).arg(QString::fromStdString(game->name))); } else { @@ -171,7 +167,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std if (item->checkState() != Qt::CheckState::Unchecked) { // suffix indicates forced HLE mode - selected.emplace(sstr(item->text()) + ":hle"); + selected.emplace(item->text().toStdString() + ":hle"); } } @@ -181,7 +177,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std if (item->checkState() != Qt::CheckState::Unchecked) { // suffix indicates forced LLE mode - selected.emplace(sstr(item->text()) + ":lle"); + selected.emplace(item->text().toStdString() + ":lle"); } } @@ -206,7 +202,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std if (m_use_discord) { discord::initialize(); - discord::update_presence(sstr(m_discord_state)); + discord::update_presence(m_discord_state.toStdString()); } else { @@ -215,7 +211,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std } else if (m_discord_state != discord_state_old && Emu.IsStopped()) { - discord::update_presence(sstr(m_discord_state), "Idle", false); + discord::update_presence(m_discord_state.toStdString(), "Idle", false); } #endif @@ -802,7 +798,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std { if (renderer->has_adapters) { - renderer->old_adapter = qstr(m_emu_settings->GetSetting(renderer->type)); + renderer->old_adapter = QString::fromStdString(m_emu_settings->GetSetting(renderer->type)); } continue; } @@ -833,7 +829,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std { if (renderer.name != render->name && render->has_adapters && render->supported) { - m_emu_settings->SetSetting(render->type, sstr(render->old_adapter)); + m_emu_settings->SetSetting(render->type, render->old_adapter.toStdString()); } } @@ -866,7 +862,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std } } ui->graphicsAdapterBox->setCurrentIndex(idx); - m_emu_settings->SetSetting(renderer.type, sstr(ui->graphicsAdapterBox->currentText())); + m_emu_settings->SetSetting(renderer.type, ui->graphicsAdapterBox->currentText().toStdString()); }; for (const auto& renderer : r_creator->renderers) @@ -897,7 +893,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std { if (render->name == new_renderer && render->has_adapters && render->adapters.contains(text)) { - m_emu_settings->SetSetting(render->type, sstr(text)); + m_emu_settings->SetSetting(render->type, text.toStdString()); break; } } @@ -1012,15 +1008,15 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std ui->audioDeviceBox->clear(); ui->audioDeviceBox->blockSignals(true); - ui->audioDeviceBox->addItem(tr("Default"), qsv(audio_device_enumerator::DEFAULT_DEV_ID)); + ui->audioDeviceBox->addItem(tr("Default"), QString(audio_device_enumerator::DEFAULT_DEV_ID.data())); const std::string selected_device = m_emu_settings->GetSetting(emu_settings_type::AudioDevice); int device_index = 0; for (const audio_device_enumerator::audio_device& dev : dev_array) { - const QString cur_item = qstr(dev.id); - ui->audioDeviceBox->addItem(qstr(dev.name), cur_item); + const QString cur_item = QString::fromStdString(dev.id); + ui->audioDeviceBox->addItem(QString::fromStdString(dev.name), cur_item); if (selected_device == dev.id) { device_index = ui->audioDeviceBox->findData(cur_item); @@ -1030,7 +1026,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std if (device_index == 0 && keep_old && selected_device != audio_device_enumerator::DEFAULT_DEV_ID) { cfg_log.error("The selected audio device (%s) was not found", selected_device); - ui->audioDeviceBox->addItem(tr("Unknown device"), qsv(selected_device)); + ui->audioDeviceBox->addItem(tr("Unknown device"), QString::fromStdString(selected_device)); device_index = ui->audioDeviceBox->count() - 1; } @@ -1046,7 +1042,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std } const QVariant item_data = ui->audioDeviceBox->itemData(index); - m_emu_settings->SetSetting(emu_settings_type::AudioDevice, sstr(item_data.toString())); + m_emu_settings->SetSetting(emu_settings_type::AudioDevice, item_data.toString().toStdString()); ui->audioDeviceBox->setCurrentIndex(index); }; @@ -1157,7 +1153,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std for (s32 index = static_cast(mic_sel_list.size()) - 1; index >= 0; index--) { - const QString qmic = qstr(mic_sel_list[index]); + const QString qmic = QString::fromStdString(mic_sel_list[index]); if (qmic.isEmpty() || m_mics_combo[index]->findText(qmic) == -1) { @@ -1228,7 +1224,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std const std::string default_camera = m_emu_settings->GetSettingDefault(emu_settings_type::CameraID); const std::string selected_camera = m_emu_settings->GetSetting(emu_settings_type::CameraID); ui->cameraIdBox->addItem(tr("None", "Camera Device"), ""); - ui->cameraIdBox->addItem(tr("Default", "Camera Device"), qstr(default_camera)); + ui->cameraIdBox->addItem(tr("Default", "Camera Device"), QString::fromStdString(default_camera)); for (const QCameraDevice& camera_info : QMediaDevices::videoInputs()) { if (!camera_info.isNull()) @@ -1236,14 +1232,14 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std ui->cameraIdBox->addItem(camera_info.description(), QString(camera_info.id())); } } - if (const int index = ui->cameraIdBox->findData(qstr(selected_camera)); index >= 0) + if (const int index = ui->cameraIdBox->findData(QString::fromStdString(selected_camera)); index >= 0) { ui->cameraIdBox->setCurrentIndex(index); } else { cfg_log.error("The selected camera was not found. Selecting default camera as fallback."); - ui->cameraIdBox->setCurrentIndex(ui->cameraIdBox->findData(qstr(default_camera))); + ui->cameraIdBox->setCurrentIndex(ui->cameraIdBox->findData(QString::fromStdString(default_camera))); } connect(ui->cameraIdBox, QOverload::of(&QComboBox::currentIndexChanged), this, [this](int index) { @@ -1252,7 +1248,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std connect(this, &settings_dialog::signal_restore_dependant_defaults, this, [this, default_camera]() { m_emu_settings->SetSetting(emu_settings_type::CameraID, default_camera); - ui->cameraIdBox->setCurrentIndex(ui->cameraIdBox->findData(qstr(default_camera))); + ui->cameraIdBox->setCurrentIndex(ui->cameraIdBox->findData(QString::fromStdString(default_camera))); }); SubscribeTooltip(ui->gb_camera_id, tooltips.settings.camera_id); } @@ -1701,7 +1697,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std const auto list = (lib.second ? ui->hleList : ui->lleList); - QListWidgetItem* item = new QListWidgetItem(qsv(lib.first), list); + QListWidgetItem* item = new QListWidgetItem(QString(lib.first.data()), list); item->setFlags(item->flags() | Qt::ItemIsUserCheckable); // set checkable flag // If no override selected (res=0), checkbox is unchecked @@ -2063,7 +2059,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std const auto get_game_window_title = [this, game](const QString& format) { rpcs3::title_format_data title_data; - title_data.format = sstr(format); + title_data.format = format.toStdString(); title_data.renderer = m_emu_settings->GetSetting(emu_settings_type::Renderer); title_data.vulkan_adapter = m_emu_settings->GetSetting(emu_settings_type::VulkanAdapter); title_data.fps = 60.; @@ -2075,7 +2071,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std } else { - title_data.title = sstr(tr("My Game", "Game window title")); + title_data.title = tr("My Game", "Game window title").toStdString(); title_data.title_id = "ABCD12345"; } @@ -2086,12 +2082,12 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std return QStringLiteral("RPCS3"); } - return qstr(game_window_title); + return QString::fromStdString(game_window_title); }; const auto set_game_window_title = [get_game_window_title, this](const std::string& format) { - const QString game_window_title_format = qstr(format); + const QString game_window_title_format = QString::fromStdString(format); const QString game_window_title = get_game_window_title(game_window_title_format); const int width = ui->label_game_window_title_format->sizeHint().width(); const QFontMetrics metrics = ui->label_game_window_title_format->fontMetrics(); @@ -2133,7 +2129,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std const std::string game_title_format = m_emu_settings->GetSetting(emu_settings_type::WindowTitleFormat); - QString edited_format = qstr(game_title_format); + QString edited_format = QString::fromStdString(game_title_format); input_dialog dlg(-1, edited_format, tr("Game Window Title Format", "Game window title"), get_game_window_title_label(edited_format), "", this); dlg.resize(width() * .75, dlg.height()); @@ -2146,7 +2142,7 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std if (dlg.exec() == QDialog::Accepted) { - m_emu_settings->SetSetting(emu_settings_type::WindowTitleFormat, sstr(edited_format)); + m_emu_settings->SetSetting(emu_settings_type::WindowTitleFormat, edited_format.toStdString()); set_game_window_title(m_emu_settings->GetSetting(emu_settings_type::WindowTitleFormat)); } }); diff --git a/rpcs3/rpcs3qt/user_manager_dialog.cpp b/rpcs3/rpcs3qt/user_manager_dialog.cpp index b8ccebdf43..48e017ea8f 100644 --- a/rpcs3/rpcs3qt/user_manager_dialog.cpp +++ b/rpcs3/rpcs3qt/user_manager_dialog.cpp @@ -25,8 +25,6 @@ #include "Utilities/File.h" #include "util/logs.hpp" -constexpr auto qstr = QString::fromStdString; - LOG_CHANNEL(gui_log, "GUI"); user_manager_dialog::user_manager_dialog(std::shared_ptr gui_settings, std::shared_ptr persistent_settings, QWidget* parent) @@ -144,7 +142,7 @@ void user_manager_dialog::UpdateTable(bool mark_only) if (mark_only) { - const QString active_user = qstr(m_active_user); + const QString active_user = QString::fromStdString(m_active_user); for (int i = 0; i < m_table->rowCount(); i++) { @@ -176,12 +174,12 @@ void user_manager_dialog::UpdateTable(bool mark_only) int row = 0; for (auto& [id, account] : m_user_list) { - QTableWidgetItem* user_id_item = new QTableWidgetItem(qstr(account.GetUserId())); + QTableWidgetItem* user_id_item = new QTableWidgetItem(QString::fromStdString(account.GetUserId())); user_id_item->setData(Qt::UserRole, id); // For sorting to work properly user_id_item->setFlags(user_id_item->flags() & ~Qt::ItemIsEditable); m_table->setItem(row, 0, user_id_item); - QTableWidgetItem* username_item = new QTableWidgetItem(qstr(account.GetUsername())); + QTableWidgetItem* username_item = new QTableWidgetItem(QString::fromStdString(account.GetUsername())); username_item->setData(Qt::UserRole, id); // For sorting to work properly username_item->setFlags(username_item->flags() & ~Qt::ItemIsEditable); m_table->setItem(row, 1, username_item); @@ -218,12 +216,12 @@ void user_manager_dialog::OnUserRemove() return; } - const QString username = qstr(m_user_list[key].GetUsername()); - const QString user_id = qstr(m_user_list[key].GetUserId()); + const QString username = QString::fromStdString(m_user_list[key].GetUsername()); + const QString user_id = QString::fromStdString(m_user_list[key].GetUserId()); const std::string user_dir = m_user_list[key].GetUserDir(); if (QMessageBox::question(this, tr("Delete Confirmation"), tr("Are you sure you want to delete the following user?\n\nUser ID: %0\nUsername: %1\n\n" - "This will remove all files in:\n%2").arg(user_id).arg(username).arg(qstr(user_dir)), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) + "This will remove all files in:\n%2").arg(user_id).arg(username).arg(QString::fromStdString(user_dir)), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { gui_log.warning("Deleting user: %s", user_dir); fs::remove_all(user_dir); @@ -267,11 +265,11 @@ void user_manager_dialog::OnUserRename() const std::string user_id = m_user_list[key].GetUserId(); const std::string username = m_user_list[key].GetUsername(); - const QString q_username = qstr(username); + const QString q_username = QString::fromStdString(username); QInputDialog* dialog = new QInputDialog(this); dialog->setWindowTitle(tr("Rename User")); - dialog->setLabelText(tr("User Id: %0\nOld Username: %1\n\nNew Username: ").arg(qstr(user_id)).arg(q_username)); + dialog->setLabelText(tr("User Id: %0\nOld Username: %1\n\nNew Username: ").arg(QString::fromStdString(user_id)).arg(q_username)); dialog->setTextValue(q_username); dialog->resize(200, 100); @@ -329,7 +327,7 @@ void user_manager_dialog::OnUserCreate() QInputDialog* dialog = new QInputDialog(this); dialog->setWindowTitle(tr("New User")); - dialog->setLabelText(tr("New User ID: %0\n\nNew Username: ").arg(qstr(next_user_id))); + dialog->setLabelText(tr("New User ID: %0\n\nNew Username: ").arg(QString::fromStdString(next_user_id))); dialog->resize(200, 100); while (dialog->exec() != QDialog::Rejected) @@ -370,7 +368,7 @@ void user_manager_dialog::OnUserLogin() main_application::InitializeEmulator(new_user, Emu.HasGui()); m_active_user = new_user; - m_persistent_settings->SetValue(gui::persistent::active_user, qstr(m_active_user)); + m_persistent_settings->SetValue(gui::persistent::active_user, QString::fromStdString(m_active_user)); UpdateTable(true); Q_EMIT OnUserLoginSuccess(); } @@ -425,7 +423,7 @@ void user_manager_dialog::ShowContextMenu(const QPoint &pos) connect(login_act, &QAction::triggered, this, &user_manager_dialog::OnUserLogin); connect(show_dir_act, &QAction::triggered, this, [this, key]() { - const QString path = qstr(m_user_list[key].GetUserDir()); + const QString path = QString::fromStdString(m_user_list[key].GetUserDir()); gui::utils::open_dir(path); });