diff --git a/rpcs3/Emu/System.cpp b/rpcs3/Emu/System.cpp
index 6869a6f5bf..caa93380db 100644
--- a/rpcs3/Emu/System.cpp
+++ b/rpcs3/Emu/System.cpp
@@ -656,6 +656,11 @@ std::string Emulator::GetHdd1Dir()
return fmt::replace_all(g_cfg.vfs.dev_hdd1, "$(EmulatorDir)", GetEmuDir());
}
+std::string Emulator::GetCacheDir()
+{
+ return fs::get_cache_dir() + "cache/";
+}
+
#ifdef _WIN32
std::string Emulator::GetExeDir()
{
@@ -1430,7 +1435,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
ppu_load_exec(ppu_exec);
- _main->cache = fs::get_cache_dir() + "cache/";
+ _main->cache = GetCacheDir();
if (!m_title_id.empty() && m_cat != "1P")
{
diff --git a/rpcs3/Emu/System.h b/rpcs3/Emu/System.h
index c31352b0e3..42ce43e255 100644
--- a/rpcs3/Emu/System.h
+++ b/rpcs3/Emu/System.h
@@ -182,6 +182,7 @@ public:
static std::string GetEmuDir();
static std::string GetHddDir();
static std::string GetHdd1Dir();
+ static std::string GetCacheDir();
static std::string GetSfoDirFromGamePath(const std::string& game_path, const std::string& user, const std::string& title_id = "");
static std::string GetCustomConfigDir();
diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp
index 7c33c23c78..ebe3156fb0 100644
--- a/rpcs3/rpcs3qt/game_list_frame.cpp
+++ b/rpcs3/rpcs3qt/game_list_frame.cpp
@@ -388,7 +388,7 @@ QString game_list_frame::GetLastPlayedBySerial(const QString& serial)
std::string game_list_frame::GetCacheDirBySerial(const std::string& serial)
{
- return fs::get_cache_dir() + "cache/" + serial;
+ return Emu.GetCacheDir() + serial;
}
std::string game_list_frame::GetDataDirBySerial(const std::string& serial)
diff --git a/rpcs3/rpcs3qt/main_window.cpp b/rpcs3/rpcs3qt/main_window.cpp
index 7737d1d474..1bb317afca 100644
--- a/rpcs3/rpcs3qt/main_window.cpp
+++ b/rpcs3/rpcs3qt/main_window.cpp
@@ -741,8 +741,7 @@ void main_window::HandlePupInstallation(QString file_path)
gui_log.success("Successfully installed PS3 firmware version %s.", version_string);
m_gui_settings->ShowInfoBox(tr("Success!"), tr("Successfully installed PS3 firmware and LLE Modules!"), gui::ib_pup_success, this);
- Emu.SetForceBoot(true);
- Emu.BootGame(g_cfg.vfs.get_dev_flash() + "sys/external/", "", true);
+ CreateFirmwareCache();
}
}
@@ -1412,6 +1411,9 @@ void main_window::CreateConnects()
connect(ui->removeDiskCacheAct, &QAction::triggered, this, &main_window::RemoveDiskCache);
+ connect(ui->removeFirmwareCacheAct, &QAction::triggered, this, &main_window::RemoveFirmwareCache);
+ connect(ui->createFirmwareCacheAct, &QAction::triggered, this, &main_window::CreateFirmwareCache);
+
connect(ui->sysPauseAct, &QAction::triggered, this, &main_window::OnPlayOrPause);
connect(ui->sysStopAct, &QAction::triggered, [this]() { Emu.Stop(); });
connect(ui->sysRebootAct, &QAction::triggered, [this]() { Emu.Restart(); });
@@ -1989,6 +1991,56 @@ void main_window::RemoveDiskCache()
}
}
+void main_window::RemoveFirmwareCache()
+{
+ const std::string cache_dir = Emu.GetCacheDir();
+
+ if (!fs::is_dir(cache_dir))
+ return;
+
+ if (QMessageBox::question(this, tr("Confirm Removal"), tr("Remove firmware cache?")) != QMessageBox::Yes)
+ return;
+
+ u32 caches_removed = 0;
+ u32 caches_total = 0;
+
+ const QStringList filter{ QStringLiteral("ppu-*-lib*.sprx")};
+
+ QDirIterator dir_iter(qstr(cache_dir), filter, QDir::Dirs | QDir::NoDotAndDotDot);
+
+ while (dir_iter.hasNext())
+ {
+ const QString path = dir_iter.next();
+
+ if (QDir(path).removeRecursively())
+ {
+ ++caches_removed;
+ gui_log.notice("Removed firmware cache: %s", sstr(path));
+ }
+ else
+ {
+ gui_log.warning("Could not remove firmware cache: %s", sstr(path));
+ }
+
+ ++caches_total;
+ }
+
+ const bool success = caches_total == caches_removed;
+
+ if (success)
+ gui_log.success("Removed firmware cache in %s", cache_dir);
+ else
+ gui_log.fatal("Only %d/%d firmware caches could be removed in %s", caches_removed, caches_total, cache_dir);
+
+ return;
+}
+
+void main_window::CreateFirmwareCache()
+{
+ Emu.SetForceBoot(true);
+ Emu.BootGame(g_cfg.vfs.get_dev_flash() + "sys/external/", "", true);
+}
+
void main_window::keyPressEvent(QKeyEvent *keyEvent)
{
if (((keyEvent->modifiers() & Qt::AltModifier) && keyEvent->key() == Qt::Key_Return) || (isFullScreen() && keyEvent->key() == Qt::Key_Escape))
diff --git a/rpcs3/rpcs3qt/main_window.h b/rpcs3/rpcs3qt/main_window.h
index a35f8592cd..8e1d3d1548 100644
--- a/rpcs3/rpcs3qt/main_window.h
+++ b/rpcs3/rpcs3qt/main_window.h
@@ -109,6 +109,10 @@ private Q_SLOTS:
void SetIconSizeActions(int idx);
void ResizeIcons(int index);
+ void RemoveDiskCache();
+ void RemoveFirmwareCache();
+ void CreateFirmwareCache();
+
protected:
void closeEvent(QCloseEvent *event) override;
void keyPressEvent(QKeyEvent *keyEvent) override;
@@ -142,8 +146,6 @@ private:
void UpdateLanguageActions(const QStringList& language_codes, const QString& language);
- void RemoveDiskCache();
-
QString GetCurrentTitle();
q_pair_list m_rg_entries;
diff --git a/rpcs3/rpcs3qt/main_window.ui b/rpcs3/rpcs3qt/main_window.ui
index bc431d4303..80861d1d83 100644
--- a/rpcs3/rpcs3qt/main_window.ui
+++ b/rpcs3/rpcs3qt/main_window.ui
@@ -141,7 +141,7 @@
0
0
1058
- 22
+ 26
@@ -179,6 +179,13 @@
+
@@ -189,6 +196,7 @@
+
@@ -1039,6 +1047,16 @@
Screenshots
+
+
+ Remove Firmware Cache
+
+
+
+
+ Create Firmware Cache
+
+