mirror of
https://github.com/RPCS3/rpcs3
synced 2024-09-19 08:11:22 +00:00
Move cache dir code to utils
This commit is contained in:
parent
c11c286206
commit
04d6ff274b
|
@ -3754,19 +3754,7 @@ extern void ppu_finalize(const ppu_module& info, bool force_mem_release)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get cache path for this executable
|
// Get cache path for this executable
|
||||||
std::string cache_path = fs::get_cache_dir() + "cache/";
|
std::string cache_path = rpcs3::utils::get_cache_dir(info.path);
|
||||||
|
|
||||||
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 (!in_dev_flash && !Emu.GetTitleID().empty() && Emu.GetCat() != "1P")
|
|
||||||
{
|
|
||||||
cache_path += Emu.GetTitleID();
|
|
||||||
cache_path += '/';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add PPU hash and filename
|
// Add PPU hash and filename
|
||||||
fmt::append(cache_path, "ppu-%s-%s/", fmt::base57(info.sha1), info.path.substr(info.path.find_last_of('/') + 1));
|
fmt::append(cache_path, "ppu-%s-%s/", fmt::base57(info.sha1), info.path.substr(info.path.find_last_of('/') + 1));
|
||||||
|
@ -4526,23 +4514,7 @@ bool ppu_initialize(const ppu_module& info, bool check_only, u64 file_size)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// New PPU cache location
|
// New PPU cache location
|
||||||
cache_path = fs::get_cache_dir() + "cache/";
|
cache_path = rpcs3::utils::get_cache_dir(info.path);
|
||||||
|
|
||||||
const std::string dev_flash = vfs::get("/dev_flash/");
|
|
||||||
|
|
||||||
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 (!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();
|
|
||||||
cache_path += '/';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add PPU hash and filename
|
// Add PPU hash and filename
|
||||||
fmt::append(cache_path, "ppu-%s-%s/", fmt::base57(info.sha1), info.path.substr(info.path.find_last_of('/') + 1));
|
fmt::append(cache_path, "ppu-%s-%s/", fmt::base57(info.sha1), info.path.substr(info.path.find_last_of('/') + 1));
|
||||||
|
|
|
@ -3699,20 +3699,7 @@ void Emulator::ConfigurePPUCache() const
|
||||||
{
|
{
|
||||||
auto& _main = g_fxo->get<main_ppu_module>();
|
auto& _main = g_fxo->get<main_ppu_module>();
|
||||||
|
|
||||||
_main.cache = rpcs3::utils::get_cache_dir();
|
_main.cache = rpcs3::utils::get_cache_dir(_main.path);
|
||||||
|
|
||||||
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/"))
|
|
||||||
{
|
|
||||||
_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));
|
fmt::append(_main.cache, "ppu-%s-%s/", fmt::base57(_main.sha1), _main.path.substr(_main.path.find_last_of('/') + 1));
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "system_config.h"
|
#include "system_config.h"
|
||||||
#include "vfs_config.h"
|
#include "vfs_config.h"
|
||||||
#include "Emu/Io/pad_config.h"
|
#include "Emu/Io/pad_config.h"
|
||||||
|
#include "Emu/System.h"
|
||||||
#include "util/sysinfo.hpp"
|
#include "util/sysinfo.hpp"
|
||||||
#include "Utilities/File.h"
|
#include "Utilities/File.h"
|
||||||
#include "Utilities/StrUtil.h"
|
#include "Utilities/StrUtil.h"
|
||||||
|
@ -121,6 +122,28 @@ namespace rpcs3::utils
|
||||||
return fs::get_cache_dir() + "cache/";
|
return fs::get_cache_dir() + "cache/";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string get_cache_dir(std::string_view module_path)
|
||||||
|
{
|
||||||
|
std::string cache_dir = get_cache_dir();
|
||||||
|
|
||||||
|
const std::string dev_flash = g_cfg_vfs.get_dev_flash();
|
||||||
|
const bool in_dev_flash = Emu.IsPathInsideDir(module_path, dev_flash);
|
||||||
|
|
||||||
|
if (in_dev_flash && !Emu.IsPathInsideDir(module_path, dev_flash + "sys/external/"))
|
||||||
|
{
|
||||||
|
// Add prefix for vsh
|
||||||
|
cache_dir += "vsh/";
|
||||||
|
}
|
||||||
|
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_dir += Emu.GetTitleID();
|
||||||
|
cache_dir += '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
return cache_dir;
|
||||||
|
}
|
||||||
|
|
||||||
std::string get_rap_file_path(const std::string_view& rap)
|
std::string get_rap_file_path(const std::string_view& rap)
|
||||||
{
|
{
|
||||||
const std::string home_dir = get_hdd0_dir() + "home";
|
const std::string home_dir = get_hdd0_dir() + "home";
|
||||||
|
|
|
@ -17,6 +17,7 @@ namespace rpcs3::utils
|
||||||
std::string get_hdd0_dir();
|
std::string get_hdd0_dir();
|
||||||
std::string get_hdd1_dir();
|
std::string get_hdd1_dir();
|
||||||
std::string get_cache_dir();
|
std::string get_cache_dir();
|
||||||
|
std::string get_cache_dir(std::string_view module_path);
|
||||||
|
|
||||||
std::string get_rap_file_path(const std::string_view& rap);
|
std::string get_rap_file_path(const std::string_view& rap);
|
||||||
bool verify_c00_unlock_edat(const std::string_view& content_id, bool fast = false);
|
bool verify_c00_unlock_edat(const std::string_view& content_id, bool fast = false);
|
||||||
|
|
Loading…
Reference in a new issue