From 53e30c06e85f5c5bd3270aaee0e1d13a51f59446 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Wed, 24 Jul 2019 05:19:13 +1000 Subject: Config: Add an option to skip saving texture cache to save state --- Source/Core/VideoCommon/TextureCacheBase.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp') diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 974b121c56..2f330bb2bc 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -24,6 +24,7 @@ #include "Common/MemoryUtil.h" #include "Common/StringUtil.h" +#include "Core/Config/GraphicsSettings.h" #include "Core/ConfigManager.h" #include "Core/FifoPlayer/FifoPlayer.h" #include "Core/FifoPlayer/FifoRecorder.h" @@ -469,7 +470,7 @@ std::optional TextureCacheBase::DeserializeTextu std::vector texture_data; p.Do(texture_data); - if (p.GetMode() != PointerWrap::MODE_READ) + if (p.GetMode() != PointerWrap::MODE_READ || texture_data.empty()) return std::nullopt; auto tex = AllocateTexture(config); @@ -546,20 +547,23 @@ void TextureCacheBase::DoSaveState(PointerWrap& p) // of address/hash to entry ID. std::vector> textures_by_address_list; std::vector> textures_by_hash_list; - for (const auto& it : textures_by_address) + if (Config::Get(Config::GFX_SAVE_TEXTURE_CACHE_TO_STATE)) { - if (ShouldSaveEntry(it.second)) + for (const auto& it : textures_by_address) { - u32 id = AddCacheEntryToMap(it.second); - textures_by_address_list.push_back(std::make_pair(it.first, id)); + if (ShouldSaveEntry(it.second)) + { + u32 id = AddCacheEntryToMap(it.second); + textures_by_address_list.push_back(std::make_pair(it.first, id)); + } } - } - for (const auto& it : textures_by_hash) - { - if (ShouldSaveEntry(it.second)) + for (const auto& it : textures_by_hash) { - u32 id = AddCacheEntryToMap(it.second); - textures_by_hash_list.push_back(std::make_pair(it.first, id)); + if (ShouldSaveEntry(it.second)) + { + u32 id = AddCacheEntryToMap(it.second); + textures_by_hash_list.push_back(std::make_pair(it.first, id)); + } } } -- cgit v1.2.3