From e02dee2601f728ab3a40a1125400465bb8b0fa94 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 12 Sep 2023 22:34:49 -0400 Subject: [PATCH 1/6] fixed N -> O typo? --- source/funkin/ui/debug/charting/ChartEditorState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index e51a94177..45a9c98a7 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -2906,7 +2906,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); } From 35239909d0fec6173a5a010d584ea02f33e24c35 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 18 Sep 2023 15:48:40 -0400 Subject: [PATCH 2/6] woops fix conditional --- source/funkin/ui/debug/charting/ChartEditorDialogHandler.hx | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorDialogHandler.hx b/source/funkin/ui/debug/charting/ChartEditorDialogHandler.hx index 0a4e68ad1..a32aed862 100644 --- a/source/funkin/ui/debug/charting/ChartEditorDialogHandler.hx +++ b/source/funkin/ui/debug/charting/ChartEditorDialogHandler.hx @@ -653,8 +653,6 @@ class ChartEditorDialogHandler expiryMs: ChartEditorState.NOTIFICATION_DISMISS_TIME }); - #if FILE_DROP_SUPPORTED - vocalsEntryLabel.text = 'Vocals for $charName (drag and drop, or click to browse)\nSelected file: ${path.file}.${path.ext}'; #else vocalsEntryLabel.text = 'Vocals for $charName (click to browse)\n${path.file}.${path.ext}'; From 0d84559606fb12211c3ec2dc5602a9a4825aad5d Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 18 Sep 2023 17:19:31 -0400 Subject: [PATCH 3/6] HTML5 should build now --- hmm.json | 4 ++-- source/funkin/ui/debug/charting/ChartEditorDialogHandler.hx | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hmm.json b/hmm.json index 50cc68851..f06b295e4 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/ui/debug/charting/ChartEditorDialogHandler.hx b/source/funkin/ui/debug/charting/ChartEditorDialogHandler.hx index eb75e31c5..59bee0d74 100644 --- a/source/funkin/ui/debug/charting/ChartEditorDialogHandler.hx +++ b/source/funkin/ui/debug/charting/ChartEditorDialogHandler.hx @@ -631,7 +631,8 @@ class ChartEditorDialogHandler for (charKey in state.currentSongMetadata.playData.playableChars.keys()) { - var charData:SongPlayableChar = state.currentSongMetadata.playData.playableChars.get(charKey); + var charData:Null = state.currentSongMetadata.playData.playableChars.get(charKey); + if (charData == null) continue; charIdsForVocals.push(charKey); if (charData.opponent != null) charIdsForVocals.push(charData.opponent); } From b56768d9b5415b4987c6105eb3ec5cc53cfd4b76 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 18 Sep 2023 17:59:55 -0400 Subject: [PATCH 4/6] Fix an issue where the game would try and fail to load metadata for a newly created song in the Chart Editor. --- source/funkin/data/song/SongRegistry.hx | 23 ++++++++++++++++------- source/funkin/util/VersionUtil.hx | 3 ++- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/source/funkin/data/song/SongRegistry.hx b/source/funkin/data/song/SongRegistry.hx index e21c74a1f..5f2961c19 100644 --- a/source/funkin/data/song/SongRegistry.hx +++ b/source/funkin/data/song/SongRegistry.hx @@ -203,30 +203,39 @@ 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; } 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; From 06269e95fd803e45b28e3d707e066397d256a205 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 18 Sep 2023 20:02:17 -0400 Subject: [PATCH 5/6] Fix to crash in freeplay (swapped two args oops!) --- source/funkin/data/song/SongRegistry.hx | 2 +- source/funkin/play/song/Song.hx | 2 +- source/funkin/ui/debug/charting/ChartEditorState.hx | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/funkin/data/song/SongRegistry.hx b/source/funkin/data/song/SongRegistry.hx index 5f2961c19..9bc1278c8 100644 --- a/source/funkin/data/song/SongRegistry.hx +++ b/source/funkin/data/song/SongRegistry.hx @@ -242,7 +242,7 @@ class SongRegistry extends BaseRegistry 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 cb98ba68e..13450bece 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -2848,6 +2848,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); } function buildSelectionSquare():FlxSprite From 29c22a422faef75d20b1ea313ddd08cf647fa7d9 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 18 Sep 2023 20:14:43 -0400 Subject: [PATCH 6/6] Fixed a JSON parser issue causing event data to be parsed wrong! --- source/funkin/data/DataParse.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; }