From 549d46117254b3c53d4f0798c6a4d7c0e501aafd Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sun, 14 Jan 2024 06:46:58 -0500 Subject: [PATCH 1/2] Fix an issue where Song offsets would be null rather than zero. --- source/funkin/data/song/SongData.hx | 5 +++-- source/funkin/data/song/SongRegistry.hx | 9 +++++---- source/funkin/play/song/Song.hx | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/source/funkin/data/song/SongData.hx b/source/funkin/data/song/SongData.hx index 07ea38741..703ab406c 100644 --- a/source/funkin/data/song/SongData.hx +++ b/source/funkin/data/song/SongData.hx @@ -38,10 +38,11 @@ class SongMetadata implements ICloneable public var looped:Bool; /** - * Instrumental and vocal offsets. Optional, defaults to 0. + * Instrumental and vocal offsets. + * Defaults to an empty SongOffsets object. */ @:optional - public var offsets:SongOffsets; + public var offsets:Null; /** * Data relating to the song's gameplay. diff --git a/source/funkin/data/song/SongRegistry.hx b/source/funkin/data/song/SongRegistry.hx index 5a0835f57..98b46c782 100644 --- a/source/funkin/data/song/SongRegistry.hx +++ b/source/funkin/data/song/SongRegistry.hx @@ -12,6 +12,7 @@ import funkin.util.VersionUtil; using funkin.data.song.migrator.SongDataMigrator; +@:nullSafety class SongRegistry extends BaseRegistry { /** @@ -31,7 +32,7 @@ class SongRegistry extends BaseRegistry public static final SONG_MUSIC_DATA_VERSION_RULE:thx.semver.VersionRule = "2.0.x"; - public static var DEFAULT_GENERATEDBY(get, null):String; + public static var DEFAULT_GENERATEDBY(get, never):String; static function get_DEFAULT_GENERATEDBY():String { @@ -88,7 +89,7 @@ class SongRegistry extends BaseRegistry { try { - var entry:Song = createEntry(entryId); + var entry:Null = createEntry(entryId); if (entry != null) { trace(' Loaded entry data: ${entry}'); @@ -455,7 +456,7 @@ class SongRegistry extends BaseRegistry { variation = variation == null ? Constants.DEFAULT_VARIATION : variation; var entryStr:Null = loadEntryMetadataFile(id, variation)?.contents; - var entryVersion:thx.semver.Version = VersionUtil.getVersionFromJSON(entryStr); + var entryVersion:Null = VersionUtil.getVersionFromJSON(entryStr); return entryVersion; } @@ -463,7 +464,7 @@ class SongRegistry extends BaseRegistry { variation = variation == null ? Constants.DEFAULT_VARIATION : variation; var entryStr:Null = loadEntryChartFile(id, variation)?.contents; - var entryVersion:thx.semver.Version = VersionUtil.getVersionFromJSON(entryStr); + var entryVersion:Null = VersionUtil.getVersionFromJSON(entryStr); return entryVersion; } diff --git a/source/funkin/play/song/Song.hx b/source/funkin/play/song/Song.hx index cde068f42..089eb6c92 100644 --- a/source/funkin/play/song/Song.hx +++ b/source/funkin/play/song/Song.hx @@ -174,7 +174,7 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry Date: Sun, 14 Jan 2024 06:47:17 -0500 Subject: [PATCH 2/2] Fix an issue with parsing enums in HScript. --- hmm.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hmm.json b/hmm.json index 67ba4d18d..b5db4b717 100644 --- a/hmm.json +++ b/hmm.json @@ -149,7 +149,7 @@ "name": "polymod", "type": "git", "dir": null, - "ref": "80d1d309803c1b111866524f9769325e3b8b0b1b", + "ref": "cb11a95d0159271eb3587428cf4b9602e46dc469", "url": "https://github.com/larsiusprime/polymod" }, {