From 6b93da37d437235ffa119560382525285d068002 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Thu, 16 Feb 2023 18:05:36 -0500 Subject: [PATCH] fix: use cache on LoadFileRaw (#2489) * fix: use cache on LoadFileRaw this makes it so explosions don't use the dpad texture --------- Co-authored-by: briaguya --- soh/soh/OTRGlobals.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 2b53078f9..272102e97 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -888,6 +888,12 @@ extern "C" char* ResourceMgr_LoadFileRaw(const char* resName) { // TODO: This should not exist. Anywhere we are loading textures with this function should be Resources instead. // We are not currently packing our otr archive with certain textures as resources with otr headers. static std::unordered_map> cachedRawFiles; + + auto cacheFind = cachedRawFiles.find(resName); + if (cacheFind != cachedRawFiles.end()) { + return cacheFind->second->Buffer.data(); + } + auto file = OTRGlobals::Instance->context->GetResourceManager()->LoadFile(resName); cachedRawFiles[resName] = file;