From 92c3c43af4dcc0bcf6ffa73c3db60a7312c1bade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=8D=9A=7ENex?= <87421482+NexIsDumb@users.noreply.github.com> Date: Mon, 8 Apr 2024 00:16:14 +0200 Subject: [PATCH] made this actually work Co-Authored-By: Ne_Eo --- .../funkin/backend/assets/TranslatedAssetLibrary.hx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source/funkin/backend/assets/TranslatedAssetLibrary.hx b/source/funkin/backend/assets/TranslatedAssetLibrary.hx index d0797c87..6e15054a 100644 --- a/source/funkin/backend/assets/TranslatedAssetLibrary.hx +++ b/source/funkin/backend/assets/TranslatedAssetLibrary.hx @@ -114,13 +114,22 @@ class TranslatedAssetLibrary extends AssetLibrary implements IModsAssetLibrary { private inline function getAssetPath():String return basePath; - // TODO: Make this actually work private function __isCacheValid(cache:Map, asset:String, isLocal:Bool = false):Bool { for(lib in ModsFolder.getLoadedModsLibs()) { + if(!(lib is AssetLibrary)) continue; + + // are you fucking serious (no the fucking switch doesnt work here) - Nex + var _lib = cast(lib, AssetLibrary); + var libCache = (cache == cachedAudioBuffers) ? _lib.cachedAudioBuffers : + (cache == cachedBytes) ? _lib.cachedBytes : + (cache == cachedFonts) ? _lib.cachedFonts : + (cache == cachedImages) ? _lib.cachedImages : + (cache == cachedText) ? _lib.cachedText : cache; + var mainPath = lib.prefix; if(!mainPath.endsWith('/')) mainPath += '/'; - @:privateAccess if(lib.__isCacheValid(cache, mainPath + getAssetPath() + asset, isLocal)) return true; + @:privateAccess if(lib.__isCacheValid(libCache, mainPath + getAssetPath() + asset, isLocal)) return true; } return false; }