mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-15 03:08:36 +12:00
Qt: Add Firmware Cache options to main window menu
This commit is contained in:
parent
8c747bf0a2
commit
ebd92a2f2f
6 changed files with 85 additions and 7 deletions
|
@ -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")
|
||||
{
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -141,7 +141,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1058</width>
|
||||
<height>22</height>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
|
@ -179,6 +179,13 @@
|
|||
<addaction name="separator"/>
|
||||
<addaction name="removeDiskCacheAct"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuFirmware">
|
||||
<property name="title">
|
||||
<string>Firmware</string>
|
||||
</property>
|
||||
<addaction name="createFirmwareCacheAct"/>
|
||||
<addaction name="removeFirmwareCacheAct"/>
|
||||
</widget>
|
||||
<addaction name="bootElfAct"/>
|
||||
<addaction name="bootGameAct"/>
|
||||
<addaction name="bootRecentMenu"/>
|
||||
|
@ -189,6 +196,7 @@
|
|||
<addaction name="bootInstallPupAct"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="menuBatch"/>
|
||||
<addaction name="menuFirmware"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="exitAct"/>
|
||||
</widget>
|
||||
|
@ -1039,6 +1047,16 @@
|
|||
<string>Screenshots</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="removeFirmwareCacheAct">
|
||||
<property name="text">
|
||||
<string>Remove Firmware Cache</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="createFirmwareCacheAct">
|
||||
<property name="text">
|
||||
<string>Create Firmware Cache</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue