diff --git a/hmm.json b/hmm.json index 80a63ee03..47460facf 100644 --- a/hmm.json +++ b/hmm.json @@ -49,8 +49,8 @@ "name": "haxeui-core", "type": "git", "dir": null, - "ref": "f5daafe93bdfa957538f199294a54e0476c805b7", - "url": "https://github.com/haxeui/haxeui-core/" + "ref": "e92d5cfac847943fac84696b103670d55c2c774f", + "url": "https://github.com/haxeui/haxeui-core" }, { "name": "haxeui-flixel", diff --git a/source/funkin/data/DataParse.hx b/source/funkin/data/DataParse.hx index 8a78e7c97..f6b5dd659 100644 --- a/source/funkin/data/DataParse.hx +++ b/source/funkin/data/DataParse.hx @@ -64,7 +64,7 @@ class DataParse return switch (json.value) { case JString(s): s; - case JNumber(n): n; + case JNumber(n): Std.parseInt(n); case JBool(b): b; case JNull: null; case JObject(fields): jsonFieldsToDynamicObject(fields); @@ -82,7 +82,7 @@ class DataParse var result:Dynamic = {}; for (field in fields) { - Reflect.setField(result, field.name, field.value); + Reflect.setField(result, field.name, jsonToDynamic(field.value)); } return result; } diff --git a/source/funkin/data/song/SongRegistry.hx b/source/funkin/data/song/SongRegistry.hx index e21c74a1f..9bc1278c8 100644 --- a/source/funkin/data/song/SongRegistry.hx +++ b/source/funkin/data/song/SongRegistry.hx @@ -203,37 +203,46 @@ class SongRegistry extends BaseRegistry return ScriptedSong.listScriptClasses(); } - function loadEntryMetadataFile(id:String, variation:String = ''):BaseRegistry.JsonFile + function loadEntryMetadataFile(id:String, variation:String = ''):Null { var entryFilePath:String = Paths.json('$dataFilePath/$id/$id${variation == '' ? '' : '-$variation'}-metadata'); - var rawJson:String = openfl.Assets.getText(entryFilePath).trim(); + if (!openfl.Assets.exists(entryFilePath)) return null; + var rawJson:Null = openfl.Assets.getText(entryFilePath); + if (rawJson == null) return null; + rawJson = rawJson.trim(); return {fileName: entryFilePath, contents: rawJson}; } - function loadMusicDataFile(id:String, variation:String = ''):BaseRegistry.JsonFile + function loadMusicDataFile(id:String, variation:String = ''):Null { var entryFilePath:String = Paths.file('music/$id/$id${variation == '' ? '' : '-$variation'}-metadata.json'); - var rawJson:String = openfl.Assets.getText(entryFilePath).trim(); + if (!openfl.Assets.exists(entryFilePath)) return null; + var rawJson:String = openfl.Assets.getText(entryFilePath); + if (rawJson == null) return null; + rawJson = rawJson.trim(); return {fileName: entryFilePath, contents: rawJson}; } - function loadEntryChartFile(id:String, variation:String = ''):BaseRegistry.JsonFile + function loadEntryChartFile(id:String, variation:String = ''):Null { var entryFilePath:String = Paths.json('$dataFilePath/$id/$id${variation == '' ? '' : '-$variation'}-chart'); - var rawJson:String = openfl.Assets.getText(entryFilePath).trim(); + if (!openfl.Assets.exists(entryFilePath)) return null; + var rawJson:String = openfl.Assets.getText(entryFilePath); + if (rawJson == null) return null; + rawJson = rawJson.trim(); return {fileName: entryFilePath, contents: rawJson}; } public function fetchEntryMetadataVersion(id:String, variation:String = ''):Null { - var entryStr:String = loadEntryMetadataFile(id, variation).contents; + var entryStr:Null = loadEntryMetadataFile(id, variation)?.contents; var entryVersion:thx.semver.Version = VersionUtil.getVersionFromJSON(entryStr); return entryVersion; } public function fetchEntryChartVersion(id:String, variation:String = ''):Null { - var entryStr:String = loadEntryChartFile(id, variation).contents; + var entryStr:Null = loadEntryChartFile(id, variation)?.contents; var entryVersion:thx.semver.Version = VersionUtil.getVersionFromJSON(entryStr); return entryVersion; } diff --git a/source/funkin/play/song/Song.hx b/source/funkin/play/song/Song.hx index b008f6a8e..e32eb8186 100644 --- a/source/funkin/play/song/Song.hx +++ b/source/funkin/play/song/Song.hx @@ -207,7 +207,7 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry = SongRegistry.instance.fetchEntryChartVersion(id, variation); if (version == null) continue; - var chart:Null = SongRegistry.instance.parseEntryChartDataWithMigration(id, version, variation); + var chart:Null = SongRegistry.instance.parseEntryChartDataWithMigration(id, variation, version); if (chart == null) continue; applyChartData(chart, variation); } diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index 404e9928e..add65c5bf 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -2931,6 +2931,7 @@ class ChartEditorState extends HaxeUIState // If this gets too big, something needs to be optimized somewhere! -Eric FlxG.watch.addQuick("tapNotesRendered", renderedNotes.members.length); FlxG.watch.addQuick("holdNotesRendered", renderedHoldNotes.members.length); + FlxG.watch.addQuick("eventsRendered", renderedEvents.members.length); } /** @@ -3010,7 +3011,7 @@ class ChartEditorState extends HaxeUIState } // CTRL + O = Open Chart - if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.N) + if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.O) { ChartEditorDialogHandler.openBrowseWizard(this, true); } diff --git a/source/funkin/util/VersionUtil.hx b/source/funkin/util/VersionUtil.hx index 368bb12de..1dc00473a 100644 --- a/source/funkin/util/VersionUtil.hx +++ b/source/funkin/util/VersionUtil.hx @@ -51,8 +51,9 @@ class VersionUtil * @param input The JSON string to parse. * @return The semantic version, or null if it could not be parsed. */ - public static function getVersionFromJSON(input:String):Null + public static function getVersionFromJSON(input:Null):Null { + if (input == null) return null; var parsed = SerializerUtil.fromJSON(input); if (parsed == null) return null; if (parsed.version == null) return null;