From f83a8773310d308b630cf5ea617ee58e297f4624 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Mon, 19 Jul 2021 23:27:07 +0200 Subject: [PATCH] Qt: Add VSH to BatchCreatePPUCaches --- rpcs3/rpcs3qt/game_list_frame.cpp | 24 +++++++++++++++++++----- rpcs3/rpcs3qt/game_list_frame.h | 1 + 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/rpcs3/rpcs3qt/game_list_frame.cpp b/rpcs3/rpcs3qt/game_list_frame.cpp index 3c516db33e..bb6fb12b1a 100644 --- a/rpcs3/rpcs3qt/game_list_frame.cpp +++ b/rpcs3/rpcs3qt/game_list_frame.cpp @@ -16,6 +16,7 @@ #include "Emu/Memory/vm.h" #include "Emu/System.h" +#include "Emu/system_config.h" #include "Emu/system_utils.hpp" #include "Loader/PSF.h" #include "util/types.hpp" @@ -1386,21 +1387,26 @@ void game_list_frame::ShowContextMenu(const QPoint &pos) menu.exec(global_pos); } -bool game_list_frame::CreatePPUCache(const game_info& game) +bool game_list_frame::CreatePPUCache(const std::string& path, const std::string& serial) { Emu.SetForceBoot(true); Emu.Stop(); Emu.SetForceBoot(true); - if (const auto error = Emu.BootGame(game->info.path, game->info.serial, true); error != game_boot_result::no_errors) + if (const auto error = Emu.BootGame(path, serial, true); error != game_boot_result::no_errors) { - game_list_log.error("Could not create PPU Cache for %s, error: %s", game->info.path, error); + game_list_log.error("Could not create PPU Cache for %s, error: %s", path, error); return false; } - game_list_log.warning("Creating PPU Cache for %s", game->info.path); + game_list_log.warning("Creating PPU Cache for %s", path); return true; } +bool game_list_frame::CreatePPUCache(const game_info& game) +{ + return game && CreatePPUCache(game->info.path, game->info.serial); +} + bool game_list_frame::RemoveCustomConfiguration(const std::string& title_id, const game_info& game, bool is_interactive) { const std::string config_path_new = rpcs3::utils::get_custom_config_path(title_id); @@ -1607,7 +1613,9 @@ bool game_list_frame::RemoveSPUCache(const std::string& base_dir, bool is_intera void game_list_frame::BatchCreatePPUCaches() { - const u32 total = m_game_data.size(); + const std::string vsh_path = g_cfg.vfs.get_dev_flash() + "/vsh/module/vsh.self"; + const bool vsh_exists = fs::is_file(vsh_path); + const u32 total = m_game_data.size() + (vsh_exists ? 1 : 0); if (total == 0) { @@ -1626,6 +1634,12 @@ void game_list_frame::BatchCreatePPUCaches() pdlg->show(); u32 created = 0; + + if (vsh_exists && CreatePPUCache(vsh_path)) + { + pdlg->SetValue(++created); + } + for (const auto& game : m_game_data) { if (pdlg->wasCanceled()) diff --git a/rpcs3/rpcs3qt/game_list_frame.h b/rpcs3/rpcs3qt/game_list_frame.h index e39a5e2734..2b81f69036 100644 --- a/rpcs3/rpcs3qt/game_list_frame.h +++ b/rpcs3/rpcs3qt/game_list_frame.h @@ -109,6 +109,7 @@ private: bool RemoveShadersCache(const std::string& base_dir, bool is_interactive = false); bool RemovePPUCache(const std::string& base_dir, bool is_interactive = false); bool RemoveSPUCache(const std::string& base_dir, bool is_interactive = false); + static bool CreatePPUCache(const std::string& path, const std::string& serial = {}); static bool CreatePPUCache(const game_info& game); QString GetLastPlayedBySerial(const QString& serial) const;