RSX Cache: Prevent crash on failure to obtain cache directory (#10474)

This commit is contained in:
Eladash 2021-06-19 16:57:07 +03:00 committed by GitHub
parent 72680c7707
commit bbaa93c846
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -199,14 +199,17 @@ namespace rsx
{ {
if (!g_cfg.video.disable_on_disk_shader_cache) if (!g_cfg.video.disable_on_disk_shader_cache)
{ {
root_path = rpcs3::cache::get_ppu_cache() + "shaders_cache"; if (std::string cache_path = rpcs3::cache::get_ppu_cache(); !cache_path.empty())
{
root_path = std::move(cache_path) + "shaders_cache/";
}
} }
} }
template <typename... Args> template <typename... Args>
void load(shader_loading_dialog* dlg, Args&& ...args) void load(shader_loading_dialog* dlg, Args&& ...args)
{ {
if (g_cfg.video.disable_on_disk_shader_cache) if (root_path.empty())
{ {
return; return;
} }
@ -270,7 +273,7 @@ namespace rsx
void store(const pipeline_storage_type &pipeline, const RSXVertexProgram &vp, const RSXFragmentProgram &fp) void store(const pipeline_storage_type &pipeline, const RSXVertexProgram &vp, const RSXFragmentProgram &fp)
{ {
if (g_cfg.video.disable_on_disk_shader_cache) if (root_path.empty())
{ {
return; return;
} }

View File

@ -16,7 +16,7 @@ namespace rpcs3::cache
if (!g_fxo->is_init<ppu_module>() || _main.cache.empty()) if (!g_fxo->is_init<ppu_module>() || _main.cache.empty())
{ {
ppu_log.warning("PPU Cache location not initialized."); ppu_log.error("PPU Cache location not initialized.");
return {}; return {};
} }