diff --git a/source/funkin/backend/system/CommandLineHandler.hx b/source/funkin/backend/system/CommandLineHandler.hx index 9be7928c..4050b049 100644 --- a/source/funkin/backend/system/CommandLineHandler.hx +++ b/source/funkin/backend/system/CommandLineHandler.hx @@ -26,7 +26,7 @@ class CommandLineHandler { var arg = cmd[i]; if (arg == null) { Sys.println("[ERROR] You need to specify the mod name"); - Sys.exit(0); + Sys.exit(1); } else { Main.modToLoad = arg.trim(); } @@ -35,24 +35,24 @@ class CommandLineHandler { var arg = cmd[i]; if (arg == null) { Sys.println("[ERROR] You need to specify the mod folder path"); - Sys.exit(0); + Sys.exit(1); } else if (FileSystem.exists(arg)) { funkin.backend.assets.ModsFolder.modsPath = arg; } else { Sys.println('[ERROR] Mod folder at "${arg}" does not exist.'); - Sys.exit(0); + Sys.exit(1); } case "-addonsfolder": i++; var arg = cmd[i]; if (arg == null) { Sys.println("[ERROR] You need to specify the addon folder path"); - Sys.exit(0); + Sys.exit(1); } else if (FileSystem.exists(arg)) { funkin.backend.assets.ModsFolder.addonsPath = arg; } else { Sys.println('[ERROR] Addons folder at "${arg}" does not exist.'); - Sys.exit(0); + Sys.exit(1); } #end case "-nocolor": diff --git a/source/funkin/backend/system/GraphicCacheSprite.hx b/source/funkin/backend/system/GraphicCacheSprite.hx index 4f0fe98f..fd03bdc4 100644 --- a/source/funkin/backend/system/GraphicCacheSprite.hx +++ b/source/funkin/backend/system/GraphicCacheSprite.hx @@ -25,14 +25,21 @@ class GraphicCacheSprite extends FlxSprite { * @param path Path to the graphic. */ public function cache(path:String) { - var graphic = FlxG.bitmap.add(path); - if (graphic != null) { - // make their useCount one time higher to prevent them from auto being cleared from cache - graphic.useCount++; - graphic.destroyOnNoUse = false; - cachedGraphics.push(graphic); - nonRenderedCachedGraphics.push(graphic); - } + cacheGraphic(FlxG.bitmap.add(path)); + } + + /** + * Caches a graphic. + * @param graphic The FlxGraphic + */ + public function cacheGraphic(graphic:FlxGraphic) { + if (graphic == null) return; + + // make their useCount one time higher to prevent them from auto being cleared from cache + graphic.useCount++; + graphic.destroyOnNoUse = false; + cachedGraphics.push(graphic); + nonRenderedCachedGraphics.push(graphic); } public override function destroy() {