Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions source/funkin/backend/system/modules/FunkinCache.hx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,24 @@ class FunkinCache extends AssetCache {
sound = [];
}

public function clearAll()
{
for (k in bitmapData.keys())
{
LimeAssets.cache.image.remove(k);
var g = FlxG.bitmap.get(k);
if (g != null && g.useCount <= 0)
FlxG.bitmap.remove(g);
}
for (k in font.keys())
LimeAssets.cache.font.remove(k);
for (k in sound.keys())
LimeAssets.cache.audio.remove(k);
bitmapData = [];
font = [];
sound = [];
}

public function clearSecondLayer() {
for(k=>b in bitmapData2) {
FlxG.bitmap.removeByKey(k);
Expand Down
3 changes: 3 additions & 0 deletions source/funkin/backend/utils/TranslationUtil.hx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import haxe.io.Path;
import haxe.xml.Access;
import haxe.Exception;
import funkin.backend.utils.translations.FormatUtil;
import funkin.backend.system.modules.FunkinCache;

/**
* The class used for translations based on the XMLs inside the translations folders.
Expand Down Expand Up @@ -112,6 +113,8 @@ final class TranslationUtil
if(mod is TranslatedAssetLibrary)
cast(mod, TranslatedAssetLibrary).langFolder = name;

if (FunkinCache.instance != null) FunkinCache.instance.clearAll();
Paths.assetsTree.resetAssetPathCache();
config = getConfig(name);
stringMap = loadLanguage(name);
alternativeStringMap = name == Flags.DEFAULT_LANGUAGE || config.get("showMissingIds").getDefault("false") == "true" ? [] : loadLanguage(Flags.DEFAULT_LANGUAGE);
Expand Down