From 30012ca900e3cf908cda9c66c3ee6995f45d4545 Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Sun, 18 Dec 2022 03:26:50 +0100 Subject: [PATCH] its me optimization are you scared --- buildnumber.txt | 2 +- source/funkin/system/AssetsLibraryList.hx | 33 ++++++++++++++++------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/buildnumber.txt b/buildnumber.txt index 68bcf6a3..466fe402 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -1546 \ No newline at end of file +1548 \ No newline at end of file diff --git a/source/funkin/system/AssetsLibraryList.hx b/source/funkin/system/AssetsLibraryList.hx index d9438e47..03b8c960 100644 --- a/source/funkin/system/AssetsLibraryList.hx +++ b/source/funkin/system/AssetsLibraryList.hx @@ -57,15 +57,30 @@ class AssetsLibraryList extends AssetLibrary { } public override function getAsset(id:String, type:String) { - if (!id.startsWith("assets/")) { - var ass = getAsset('assets/$id', type); - if (ass != null) - return ass; - } - for(e in libraries) { - var asset = e.getAsset(id, type); - if (asset != null) - return asset; + try { + #if cpp + cpp.vm.Gc.enable(false); + #end + + if (!id.startsWith("assets/")) { + var ass = getAsset('assets/$id', type); + if (ass != null) + return ass; + } + for(e in libraries) { + var asset = e.getAsset(id, type); + if (asset != null) + return asset; + } + + #if cpp + cpp.vm.Gc.enable(true); + #end + } catch(e) { + #if cpp + cpp.vm.Gc.enable(true); + #end + throw e; } return null; }