From a5d74c5e96468fd10c4c95436d815727b115b21a Mon Sep 17 00:00:00 2001 From: Eladash Date: Wed, 27 Jan 2021 18:22:06 +0200 Subject: [PATCH] GUI: Improve missing firmware handling * Install PS3UPDAT.PUP at the spot when booting games whenever firmware is missing. The option to boot games without firmware is still supported when all firmware SPRX are HLEd in firmware settings. * Pop-up a confirmation dialog in firmware installation if firmware is already installed. --- rpcs3/Emu/Cell/lv2/sys_prx.cpp | 1 + rpcs3/Emu/System.cpp | 17 +++++++++++++++- rpcs3/rpcs3qt/gui_application.cpp | 2 +- rpcs3/rpcs3qt/gui_settings.cpp | 8 -------- rpcs3/rpcs3qt/gui_settings.h | 1 - rpcs3/rpcs3qt/main_window.cpp | 34 +++++++++++++++++++++++++++++++ rpcs3/rpcs3qt/main_window.h | 1 + rpcs3/rpcs3qt/tooltips.h | 4 ++-- 8 files changed, 55 insertions(+), 13 deletions(-) diff --git a/rpcs3/Emu/Cell/lv2/sys_prx.cpp b/rpcs3/Emu/Cell/lv2/sys_prx.cpp index 09047628e2..20550c5bf0 100644 --- a/rpcs3/Emu/Cell/lv2/sys_prx.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_prx.cpp @@ -22,6 +22,7 @@ extern void ppu_finalize(const ppu_module&); LOG_CHANNEL(sys_prx); +// extern const std::map g_prx_list { { "libaacenc.sprx", 0 }, diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp index 2222416a81..f090962b13 100644 --- a/rpcs3/Emu/System.cpp +++ b/rpcs3/Emu/System.cpp @@ -1647,9 +1647,24 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool { if (!fs::is_file(g_cfg.vfs.get_dev_flash() + "sys/external/liblv2.sprx")) { - if (!GetCallbacks().on_missing_fw()) + const auto libs = g_cfg.core.libraries_control.get_set(); + + extern const std::map g_prx_list; + + // Check if there are any firmware SPRX which may be LLEd during emulation + // Don't prompt GUI confirmation if there aren't any + if (std::any_of(g_prx_list.begin(), g_prx_list.end(), [&libs](auto& lib) + { + return libs.count(std::string(lib.first) + ":lle") || (!lib.second && !libs.count(std::string(lib.first) + ":hle")); + })) { Stop(); + + CallAfter([this]() + { + GetCallbacks().on_missing_fw(); + }); + return game_boot_result::firmware_missing; } } diff --git a/rpcs3/rpcs3qt/gui_application.cpp b/rpcs3/rpcs3qt/gui_application.cpp index ce85dfb65c..29095ec86c 100644 --- a/rpcs3/rpcs3qt/gui_application.cpp +++ b/rpcs3/rpcs3qt/gui_application.cpp @@ -357,7 +357,7 @@ void gui_application::InitializeCallbacks() callbacks.on_missing_fw = [this]() { if (!m_main_window) return false; - return m_gui_settings->GetBootConfirmation(m_main_window, gui::ib_confirm_fw); + return m_main_window->OnMissingFw(); }; callbacks.handle_taskbar_progress = [this](s32 type, s32 value) diff --git a/rpcs3/rpcs3qt/gui_settings.cpp b/rpcs3/rpcs3qt/gui_settings.cpp index c4997487d3..6eacf35f0f 100644 --- a/rpcs3/rpcs3qt/gui_settings.cpp +++ b/rpcs3/rpcs3qt/gui_settings.cpp @@ -222,14 +222,6 @@ bool gui_settings::GetBootConfirmation(QWidget* parent, const gui_save& gui_save title = tr("Exit RPCS3?"); message = tr("A game is currently running. Do you really want to close RPCS3?\n\nAny unsaved progress will be lost!\n"); } - else if (gui_save_entry == gui::ib_confirm_fw) - { - title = tr("Missing Firmware Detected!"); - message = tr("Install the PS3 Firmware (Menu: File -> Install Firmware)." - "\n
For more information read the quickstart guide." - "\nCommercial games do not work without firmware! Do you wish to continue!?"); - icon = QMessageBox::Critical; - } int result = QMessageBox::Yes; diff --git a/rpcs3/rpcs3qt/gui_settings.h b/rpcs3/rpcs3qt/gui_settings.h index 87ad01cefc..91b6b56201 100644 --- a/rpcs3/rpcs3qt/gui_settings.h +++ b/rpcs3/rpcs3qt/gui_settings.h @@ -121,7 +121,6 @@ namespace gui const gui_save ib_show_welcome = gui_save(main_window, "infoBoxEnabledWelcome", true); const gui_save ib_confirm_exit = gui_save(main_window, "confirmationBoxExitGame", true); const gui_save ib_confirm_boot = gui_save(main_window, "confirmationBoxBootGame", true); - const gui_save ib_confirm_fw = gui_save(main_window, "confirmationMissingFW", true); const gui_save fd_install_pkg = gui_save(main_window, "lastExplorePathPKG", ""); const gui_save fd_install_pup = gui_save(main_window, "lastExplorePathPUP", ""); diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp index e7effc555c..60fd7a2ae2 100644 --- a/rpcs3/rpcs3qt/main_window.cpp +++ b/rpcs3/rpcs3qt/main_window.cpp @@ -51,6 +51,7 @@ #include "Loader/TAR.h" #include "Utilities/Thread.h" +#include "util/sysinfo.hpp" #include "ui_main_window.h" @@ -249,6 +250,27 @@ QIcon main_window::GetAppIcon() return m_app_icon; } +bool main_window::OnMissingFw() +{ + const QString title = tr("Missing Firmware Detected!"); + const QString message = tr("Commercial games require the firmware (PS3UPDAT.PUP file) to be installed." + "\n
For information about how to obtain the required firmware read the quickstart guide."); + + QMessageBox* mb = new QMessageBox(QMessageBox::Question, title, message, QMessageBox::Ok | QMessageBox::Cancel, this, Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint | Qt::WindowStaysOnTopHint); + mb->deleteLater(); + mb->setTextFormat(Qt::RichText); + + mb->button(QMessageBox::Ok)->setText(tr("Locate PS3UPDAT.PUP")); + + if (mb->exec() == QMessageBox::Ok) + { + InstallPup(); + return true; + } + + return false; +} + void main_window::ResizeIcons(int index) { if (ui->sizeSlider->value() != index) @@ -865,6 +887,18 @@ void main_window::HandlePupInstallation(QString file_path) return; } + if (std::string installed = utils::get_firmware_version(); !installed.empty()) + { + 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 verion %2?").arg(qstr(installed), qstr(version_string)), + QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::No) + { + gui_log.warning("Reinstallation of firmware aborted."); + return; + } + } + // Remove possibly PS3 fonts from database QFontDatabase::removeAllApplicationFonts(); diff --git a/rpcs3/rpcs3qt/main_window.h b/rpcs3/rpcs3qt/main_window.h index 1ca8c58c0c..bd24bf8865 100644 --- a/rpcs3/rpcs3qt/main_window.h +++ b/rpcs3/rpcs3qt/main_window.h @@ -84,6 +84,7 @@ public: bool Init(); ~main_window(); QIcon GetAppIcon(); + bool OnMissingFw(); Q_SIGNALS: void RequestLanguageChange(const QString& language); diff --git a/rpcs3/rpcs3qt/tooltips.h b/rpcs3/rpcs3qt/tooltips.h index ff476d3902..c82fc2601d 100644 --- a/rpcs3/rpcs3qt/tooltips.h +++ b/rpcs3/rpcs3qt/tooltips.h @@ -19,8 +19,8 @@ public: { // advanced - const QString lle_list = tr("These libraries are LLE'd by default (lower list), selection will switch to HLE.\nLLE - \"Low Level Emulated\", function code inside the selected SPRX file will be used for exported firmware functions.\nHLE - \"High Level Emulated\", alternative emulator code will be used instead for exported firmware functions.\nIf choosen wrongly, games will not work! If unsure, leave both lists' selection empty."); - const QString hle_list = tr("These libraries are HLE'd by default (upper list), selection will switch to LLE.\nLLE - \"Low Level Emulated\", function code inside the selected SPRX file will be used for exported firmware functions.\nHLE - \"High Level Emulated\", alternative emulator code will be used instead for exported firmware functions.\nIf choosen wrongly, games will not work! If unsure, leave both lists' selection empty."); + const QString lle_list = tr("These libraries are LLE'd by default (lower list), selection will switch to HLE.\nLLE - \"Low Level Emulated\", function code inside the selected SPRX file will be used for exported firmware functions.\nHLE - \"High Level Emulated\", alternative emulator code will be used instead for exported firmware functions.\nIf choosen wrongly, games will not work! If unsure, leave both lists empty. HLEing all SPRX allows to boot without firmware installed. (experimental)"); + const QString hle_list = tr("These libraries are HLE'd by default (upper list), selection will switch to LLE.\nLLE - \"Low Level Emulated\", function code inside the selected SPRX file will be used for exported firmware functions.\nHLE - \"High Level Emulated\", alternative emulator code will be used instead for exported firmware functions.\nIf choosen wrongly, games will not work! If unsure, leave both lists empty. HLEing all SPRX allows to boot without firmware installed. (experimental)"); const QString lib_default_hle = tr("Select to LLE. (HLE by default)"); const QString lib_default_lle = tr("Select to HLE. (LLE by default)");