Adust vsh cache dir criteria

This commit is contained in:
Megamouse 2024-05-04 00:09:38 +02:00
parent bdeeae47a2
commit c11c286206
3 changed files with 21 additions and 17 deletions

View File

@ -3756,11 +3756,13 @@ extern void ppu_finalize(const ppu_module& info, bool force_mem_release)
// Get cache path for this executable
std::string cache_path = fs::get_cache_dir() + "cache/";
if (Emu.IsVsh())
const bool in_dev_flash = info.path.starts_with(dev_flash);
if (in_dev_flash && !info.path.starts_with(dev_flash + "sys/external/"))
{
cache_path += "vsh/";
}
else if (!info.path.starts_with(dev_flash) && !Emu.GetTitleID().empty() && Emu.GetCat() != "1P")
else if (!in_dev_flash && !Emu.GetTitleID().empty() && Emu.GetCat() != "1P")
{
cache_path += Emu.GetTitleID();
cache_path += '/';
@ -4264,7 +4266,7 @@ extern void ppu_precompile(std::vector<std::string>& dir_queue, std::vector<ppu_
obj.clear(), src.close(); // Clear decrypted file and elf object memory
_main.name = ' '; // Make ppu_finalize work
Emu.ConfigurePPUCache(!Emu.IsPathInsideDir(_main.path, g_cfg_vfs.get_dev_flash()));
Emu.ConfigurePPUCache();
ppu_initialize(_main, false, file_size);
spu_cache::initialize(false);
ppu_finalize(_main, true);
@ -4528,12 +4530,14 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_size)
const std::string dev_flash = vfs::get("/dev_flash/");
if (Emu.IsVsh())
const bool in_dev_flash = info.path.starts_with(dev_flash);
if (in_dev_flash && !info.path.starts_with(dev_flash + "sys/external/"))
{
// Add prefix for vsh
cache_path += "vsh/";
}
else if (!info.path.starts_with(dev_flash) && !Emu.GetTitleID().empty() && Emu.GetCat() != "1P")
else if (!in_dev_flash && !Emu.GetTitleID().empty() && Emu.GetCat() != "1P")
{
// Add prefix for anything except dev_flash files, standalone elfs or PS1 classics
cache_path += Emu.GetTitleID();

View File

@ -3695,23 +3695,23 @@ s32 error_code::error_report(s32 result, const logs::message* channel, const cha
return result;
}
void Emulator::ConfigurePPUCache(bool with_title_id) const
void Emulator::ConfigurePPUCache() const
{
auto& _main = g_fxo->get<main_ppu_module>();
_main.cache = rpcs3::utils::get_cache_dir();
if (with_title_id)
const std::string dev_flash = vfs::get("/dev_flash/");
const bool in_dev_flash = _main.path.starts_with(dev_flash);
if (in_dev_flash && !_main.path.starts_with(dev_flash + "sys/external/"))
{
if (IsVsh())
{
_main.cache += "vsh/";
}
else if (!m_title_id.empty() && m_cat != "1P")
{
_main.cache += GetTitleID();
_main.cache += '/';
}
_main.cache += "vsh/";
}
else if (!in_dev_flash && !m_title_id.empty() && m_cat != "1P")
{
_main.cache += GetTitleID();
_main.cache += '/';
}
fmt::append(_main.cache, "ppu-%s-%s/", fmt::base57(_main.sha1), _main.path.substr(_main.path.find_last_of('/') + 1));

View File

@ -377,7 +377,7 @@ public:
std::string GetFormattedTitle(double fps) const;
void ConfigurePPUCache(bool with_title_id = true) const;
void ConfigurePPUCache() const;
std::set<std::string> GetGameDirs() const;
u32 AddGamesFromDir(const std::string& path);