diff --git a/buildnumber.txt b/buildnumber.txt index 7f06f5c9..28e1597c 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -1445 \ No newline at end of file +1447 \ No newline at end of file diff --git a/source/funkin/away3d/Flx3DView.hx b/source/funkin/away3d/Flx3DView.hx index f3cc868f..3c35abd4 100644 --- a/source/funkin/away3d/Flx3DView.hx +++ b/source/funkin/away3d/Flx3DView.hx @@ -25,7 +25,7 @@ class Flx3DView extends FlxSprite { public static function init() { __sprite = new Sprite(); - FlxG.stage.addChild(__sprite); + FlxG.game.addChild(__sprite); } #end diff --git a/source/funkin/system/AssetsLibraryList.hx b/source/funkin/system/AssetsLibraryList.hx index b7c95dbe..3596273d 100644 --- a/source/funkin/system/AssetsLibraryList.hx +++ b/source/funkin/system/AssetsLibraryList.hx @@ -68,6 +68,32 @@ class AssetsLibraryList extends AssetLibrary { return null; } + public function clearCache() { + var libs:Array = [for(lib in libraries) lib]; + libs.push(this); + for(l in libs) { + var lib:AssetLibrary = l; + if (lib is openfl.utils.AssetLibrary) { + var openflLib = cast(lib, openfl.utils.AssetLibrary); + @:privateAccess + if (openflLib.__proxy != null) lib = openflLib.__proxy; + } + + @:privateAccess var cachedAudioBuffers = lib.cachedAudioBuffers; + @:privateAccess var cachedBytes = lib.cachedBytes; + @:privateAccess var cachedFonts = lib.cachedFonts; + @:privateAccess var cachedText = lib.cachedText; + + + for(buff in cachedAudioBuffers) buff.dispose(); + cachedAudioBuffers.clear(); + + cachedBytes.clear(); + cachedFonts.clear(); + cachedText.clear(); + } + } + public function new(?base:AssetLibrary) { super(); if (base == null) diff --git a/source/funkin/system/Main.hx b/source/funkin/system/Main.hx index 7232e0fd..7cfa3a3d 100644 --- a/source/funkin/system/Main.hx +++ b/source/funkin/system/Main.hx @@ -228,5 +228,9 @@ class Main extends Sprite cache.removeFont(key); for (key=>sound in cache.sound) cache.removeSound(key); + + Paths.assetsTree.clearCache(); + + } }