Qt: Add VSH to BatchCreatePPUCaches

This commit is contained in:
Megamouse 2021-07-19 23:27:07 +02:00
parent 2a8d740d63
commit f83a877331
2 changed files with 20 additions and 5 deletions

View File

@ -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())

View File

@ -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;