diff --git a/source/funkin/chart/BaseGameParser.hx b/source/funkin/chart/BaseGameParser.hx index 3a430ff8..8d01a321 100644 --- a/source/funkin/chart/BaseGameParser.hx +++ b/source/funkin/chart/BaseGameParser.hx @@ -13,10 +13,11 @@ class BaseGameParser { result.scrollSpeed = data.speed; result.stage = data.stage; + var p2isGF:Bool = false; result.strumLines.push({ characters: [data.player2], type: 0, - position: data.player2.startsWith("gf") ? "girlfriend" : "dad", + position: (p2isGF = data.player2.startsWith("gf")) ? "girlfriend" : "dad", notes: [] }); result.strumLines.push({ @@ -25,7 +26,7 @@ class BaseGameParser { position: "boyfriend", notes: [] }); - if (data.gf != "none") { + if (!p2isGF && data.gf != "none") { result.strumLines.push({ characters: [data.gf != null ? data.gf : "gf"], type: 2, diff --git a/source/funkin/chart/Chart.hx b/source/funkin/chart/Chart.hx index 08231276..a7f9f7c5 100644 --- a/source/funkin/chart/Chart.hx +++ b/source/funkin/chart/Chart.hx @@ -86,29 +86,33 @@ class Chart { fromMods: Paths.assetsTree.existsSpecific(chartPath, "TEXT", MODS) }; + var valid:Bool = true; if (!Assets.exists(chartPath)) { Logs.trace('Chart for song ${songName} ($difficulty) at "$chartPath" was not found.', ERROR, RED); - return base; + valid = false; } var data:Dynamic = null; try { - data = Json.parse(Assets.getText(chartPath)); + if (valid) + data = Json.parse(Assets.getText(chartPath)); } catch(e) { Logs.trace('Could not parse chart for song ${songName} ($difficulty): ${Std.string(e)}', ERROR, RED); } - /** - * CHART CONVERSION - */ - #if REGION - if (Reflect.hasField(data, "codenameChart") && Reflect.field(data, "codenameChart") == true) { - // codename chart - base = data; - } else { - // base game chart - BaseGameParser.parse(data, base); + if (data != null) { + /** + * CHART CONVERSION + */ + #if REGION + if (Reflect.hasField(data, "codenameChart") && Reflect.field(data, "codenameChart") == true) { + // codename chart + base = data; + } else { + // base game chart + BaseGameParser.parse(data, base); + } + #end } - #end if (base.meta == null) base.meta = loadChartMeta(songName, difficulty, base.fromMods); diff --git a/source/funkin/menus/FreeplayState.hx b/source/funkin/menus/FreeplayState.hx index e80aae17..3b734fce 100644 --- a/source/funkin/menus/FreeplayState.hx +++ b/source/funkin/menus/FreeplayState.hx @@ -238,8 +238,10 @@ class FreeplayState extends MusicBeatState FlxG.switchState(new MainMenuState()); } + #if sys if (FlxG.keys.justPressed.EIGHT && Sys.args().contains("-livereload")) convertChart(); + #end if (controls.ACCEPT && !dontPlaySongThisFrame) select(); diff --git a/source/funkin/mods/ModsFolder.hx b/source/funkin/mods/ModsFolder.hx index c4ff944a..4783a930 100644 --- a/source/funkin/mods/ModsFolder.hx +++ b/source/funkin/mods/ModsFolder.hx @@ -92,19 +92,11 @@ class ModsFolder { Paths.assetsTree.clearCache(); FlxG.bitmap.reset(); Paths.assetsTree.removeLibrary(loadedMods[mod]); - Assets.unloadLibrary('mods/$mod'.toLowerCase()); loadedMods[mod] = null; } public static function prepareLibrary(libName:String, force:Bool = false) { - if (Assets.hasLibrary(libName)) { - if (force) - Assets.unloadLibrary(libName); - else - return null; - } - var assets:AssetManifest = new AssetManifest(); assets.name = libName; assets.version = 2; @@ -119,7 +111,6 @@ class ModsFolder { lib.prefix = 'assets/'; @:privateAccess openLib.__proxy = cast(lib, lime.utils.AssetLibrary); - Assets.registerLibrary(libName, openLib); return openLib; } diff --git a/source/funkin/native/HiddenProcess.hx b/source/funkin/native/HiddenProcess.hx index b765f48e..3596521d 100644 --- a/source/funkin/native/HiddenProcess.hx +++ b/source/funkin/native/HiddenProcess.hx @@ -1,3 +1,3 @@ package funkin.native; -typedef HiddenProcess = sys.io.Process; \ No newline at end of file +typedef HiddenProcess = #if sys sys.io.Process #else Dynamic #end; \ No newline at end of file diff --git a/source/funkin/system/Main.hx b/source/funkin/system/Main.hx index 847641a9..305af97e 100644 --- a/source/funkin/system/Main.hx +++ b/source/funkin/system/Main.hx @@ -23,6 +23,7 @@ import flixel.addons.transition.TransitionData; import flixel.math.FlxPoint; import flixel.math.FlxRect; import lime.app.Application; +import funkin.system.modules.*; #if ALLOW_MULTITHREADING import sys.thread.Thread; @@ -199,7 +200,6 @@ class Main extends Sprite FlxG.fixedTimestep = false; - refreshAssets(); FlxG.scaleMode = scaleMode = new FunkinRatioScaleMode(); @@ -214,7 +214,6 @@ class Main extends Sprite #if MOD_SUPPORT ModsFolder.switchMod(modToLoad.getDefault(Options.lastLoadedMod)); #end - initTransition(); } diff --git a/source/funkin/system/framerate/Framerate.hx b/source/funkin/system/framerate/Framerate.hx index f5205518..60b7be04 100644 --- a/source/funkin/system/framerate/Framerate.hx +++ b/source/funkin/system/framerate/Framerate.hx @@ -1,5 +1,7 @@ package funkin.system.framerate; +import openfl.display.Bitmap; +import openfl.display.BitmapData; import flixel.math.FlxPoint; import openfl.events.KeyboardEvent; import openfl.display.DisplayObject; @@ -23,10 +25,18 @@ class Framerate extends Sprite { public static var debugMode:Bool = false; public static var offset:FlxPoint = new FlxPoint(); - public var bgSprite:Sprite; + public var bgSprite:Bitmap; public var categories:Array = []; + @:isVar public static var __bitmap(get, null):BitmapData = null; + + private static function get___bitmap():BitmapData { + if (__bitmap == null) + __bitmap = new BitmapData(1, 1, 0xFF000000); + return __bitmap; + } + public function new() { super(); if (instance != null) throw "Cannot create another instance"; @@ -43,10 +53,10 @@ class Framerate extends Sprite { } }); - bgSprite = new Sprite(); - bgSprite.graphics.beginFill(0xFF000000); - bgSprite.graphics.drawRect(0, 0, 1, 1); - bgSprite.graphics.endFill(); + if (__bitmap == null) + __bitmap = new BitmapData(1, 1, 0xFF000000); + + bgSprite = new Bitmap(__bitmap); bgSprite.alpha = 0; addChild(bgSprite); diff --git a/source/funkin/system/framerate/FramerateCategory.hx b/source/funkin/system/framerate/FramerateCategory.hx index f11376ee..c8c139b9 100644 --- a/source/funkin/system/framerate/FramerateCategory.hx +++ b/source/funkin/system/framerate/FramerateCategory.hx @@ -1,5 +1,6 @@ package funkin.system.framerate; +import openfl.display.Bitmap; import openfl.text.TextFormat; import openfl.display.Sprite; import openfl.text.TextField; @@ -8,7 +9,7 @@ class FramerateCategory extends Sprite { public var title:TextField; public var text:TextField; - public var bgSprite:Sprite; + public var bgSprite:Bitmap; private var _text:String = ""; @@ -19,10 +20,7 @@ class FramerateCategory extends Sprite { this.title = new TextField(); this.text = new TextField(); - bgSprite = new Sprite(); - bgSprite.graphics.beginFill(0xFF000000); - bgSprite.graphics.drawRect(0, 0, 1, 1); - bgSprite.graphics.endFill(); + bgSprite = new Bitmap(Framerate.__bitmap); bgSprite.alpha = 0.5; addChild(bgSprite); diff --git a/source/funkin/system/AudioSwitchFix.hx b/source/funkin/system/modules/AudioSwitchFix.hx similarity index 97% rename from source/funkin/system/AudioSwitchFix.hx rename to source/funkin/system/modules/AudioSwitchFix.hx index 8c41626f..5494f63e 100644 --- a/source/funkin/system/AudioSwitchFix.hx +++ b/source/funkin/system/modules/AudioSwitchFix.hx @@ -1,4 +1,4 @@ -package funkin.system; +package funkin.system.modules; import lime.media.AudioManager; import flixel.system.FlxSound; diff --git a/source/funkin/system/CrashHandler.hx b/source/funkin/system/modules/CrashHandler.hx similarity index 98% rename from source/funkin/system/CrashHandler.hx rename to source/funkin/system/modules/CrashHandler.hx index be087e1a..7236e80f 100644 --- a/source/funkin/system/CrashHandler.hx +++ b/source/funkin/system/modules/CrashHandler.hx @@ -1,4 +1,4 @@ -package funkin.system; +package funkin.system.modules; import lime.system.System; import funkin.windows.WindowsAPI; diff --git a/source/funkin/system/FunkinCache.hx b/source/funkin/system/modules/FunkinCache.hx similarity index 99% rename from source/funkin/system/FunkinCache.hx rename to source/funkin/system/modules/FunkinCache.hx index d2669914..7f66f9f1 100644 --- a/source/funkin/system/FunkinCache.hx +++ b/source/funkin/system/modules/FunkinCache.hx @@ -1,4 +1,4 @@ -package funkin.system; +package funkin.system.modules; import openfl.utils.AssetCache; import openfl.display.BitmapData;