From bbaa93c84647370fb7aad588f9eefea53f255455 Mon Sep 17 00:00:00 2001 From: Eladash Date: Sat, 19 Jun 2021 16:57:07 +0300 Subject: [PATCH] RSX Cache: Prevent crash on failure to obtain cache directory (#10474) --- rpcs3/Emu/RSX/rsx_cache.h | 9 ++++++--- rpcs3/Emu/cache_utils.cpp | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/RSX/rsx_cache.h b/rpcs3/Emu/RSX/rsx_cache.h index ecc2301287..ba629ca7dc 100644 --- a/rpcs3/Emu/RSX/rsx_cache.h +++ b/rpcs3/Emu/RSX/rsx_cache.h @@ -199,14 +199,17 @@ namespace rsx { 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 void load(shader_loading_dialog* dlg, Args&& ...args) { - if (g_cfg.video.disable_on_disk_shader_cache) + if (root_path.empty()) { return; } @@ -270,7 +273,7 @@ namespace rsx 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; } diff --git a/rpcs3/Emu/cache_utils.cpp b/rpcs3/Emu/cache_utils.cpp index 19977da841..55671ebdf9 100644 --- a/rpcs3/Emu/cache_utils.cpp +++ b/rpcs3/Emu/cache_utils.cpp @@ -16,7 +16,7 @@ namespace rpcs3::cache if (!g_fxo->is_init() || _main.cache.empty()) { - ppu_log.warning("PPU Cache location not initialized."); + ppu_log.error("PPU Cache location not initialized."); return {}; }