From 404d08ef6dfb7998ee422dfe77fdc05ee6c600de Mon Sep 17 00:00:00 2001 From: Megamouse Date: Tue, 6 Jun 2023 00:24:00 +0200 Subject: [PATCH] Qt: always use last boot path for game boot actions The actual path caused the GUI to try to run elfs directly after booting a game from a loader. --- rpcs3/Emu/System.cpp | 9 +++++++-- rpcs3/Emu/System.h | 6 ++++++ rpcs3/rpcs3qt/main_window.cpp | 12 ++++++------ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index f9758047f9..4cb54ffe62 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -731,18 +731,23 @@ game_boot_result Emulator::GetElfPathFromDir(std::string& elf_path, const std::s game_boot_result Emulator::BootGame(const std::string& path, const std::string& title_id, bool direct, cfg_mode config_mode, const std::string& config_path) { - auto save_args = std::make_tuple(m_path, argv, envp, data, disc, klic, hdd1, m_config_mode, m_config_path); + auto save_args = std::make_tuple(m_path, m_path_original, argv, envp, data, disc, klic, hdd1, m_config_mode, m_config_path); auto restore_on_no_boot = [&](game_boot_result result) { if (IsStopped() || result != game_boot_result::no_errors) { - std::tie(m_path, argv, envp, data, disc, klic, hdd1, m_config_mode, m_config_path) = std::move(save_args); + std::tie(m_path, m_path_original, argv, envp, data, disc, klic, hdd1, m_config_mode, m_config_path) = std::move(save_args); } return result; }; + if (m_path_original.empty() || config_mode != cfg_mode::continuous) + { + m_path_original = m_path; + } + m_path_old = m_path; m_config_mode = config_mode; diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h index ff7744bcd3..98355b3a0e 100644 --- a/rpcs3/Emu/System.h +++ b/rpcs3/Emu/System.h @@ -122,6 +122,7 @@ class Emulator final std::string m_config_path; std::string m_path; std::string m_path_old; + std::string m_path_original; std::string m_title_id; std::string m_title; std::string m_app_version; @@ -235,6 +236,11 @@ public: return m_path; } + const std::string& GetLastBoot() const + { + return m_path_original; + } + const std::string& GetTitleID() const { return m_title_id; diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index bec5915b82..3621d86863 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -259,7 +259,7 @@ QString main_window::GetCurrentTitle() QString title = qstr(Emu.GetTitleAndTitleID()); if (title.isEmpty()) { - title = qstr(Emu.GetBoot()); + title = qstr(Emu.GetLastBoot()); } return title; } @@ -383,7 +383,7 @@ void main_window::OnPlayOrPause() gui_log.notice("Booting from OnPlayOrPause..."); Boot(m_selected_game->info.path, m_selected_game->info.serial); } - else if (const auto path = Emu.GetBoot(); !path.empty()) + else if (const std::string path = Emu.GetLastBoot(); !path.empty()) { if (const auto error = Emu.Load(); error != game_boot_result::no_errors) { @@ -1971,7 +1971,7 @@ void main_window::BootRecentAction(const QAction* act) if (contains_path) { // clear menu of actions - for (auto action : m_recent_game_acts) + for (QAction* action : m_recent_game_acts) { ui->bootRecentMenu->removeAction(action); } @@ -2062,7 +2062,7 @@ void main_window::AddRecentAction(const q_string_pair& entry) } // clear menu of actions - for (auto action : m_recent_game_acts) + for (QAction* action : m_recent_game_acts) { ui->bootRecentMenu->removeAction(action); } @@ -2915,7 +2915,7 @@ void main_window::CreateDockWindows() ui->toolbar_start->setIcon(m_icon_play); } - else if (const auto& path = Emu.GetBoot(); !path.empty()) // Restartable games + else if (const std::string& path = Emu.GetLastBoot(); !path.empty()) // Restartable games { tooltip = tr("Restart %0").arg(GetCurrentTitle()); @@ -2979,7 +2979,7 @@ void main_window::ConfigureGuiFromSettings() m_rg_entries = m_gui_settings->Var2List(m_gui_settings->GetValue(gui::rg_entries)); // clear recent games menu of actions - for (auto act : m_recent_game_acts) + for (QAction* act : m_recent_game_acts) { ui->bootRecentMenu->removeAction(act); }