mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-07 02:40:30 -05:00
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 <briaguya@alice>
This commit is contained in:
parent
6cd7066706
commit
6b93da37d4
@ -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<std::string, std::shared_ptr<Ship::OtrFile>> 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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user