diff --git a/source/funkin/play/notes/notestyle/NoteStyle.hx b/source/funkin/play/notes/notestyle/NoteStyle.hx index c2f7ec009..3318e9086 100644 --- a/source/funkin/play/notes/notestyle/NoteStyle.hx +++ b/source/funkin/play/notes/notestyle/NoteStyle.hx @@ -103,7 +103,11 @@ class NoteStyle implements IRegistryEntry function buildNoteFrames(force:Bool = false):Null { var noteAssetPath = getNoteAssetPath(); - if (noteAssetPath == null) return null; + if (noteAssetPath == null) + { + FlxG.log.warn('Note asset path not found: ${id}'); + return null; + } if (!FunkinSprite.isTextureCached(Paths.image(noteAssetPath))) { diff --git a/source/funkin/ui/debug/latency/LatencyState.hx b/source/funkin/ui/debug/latency/LatencyState.hx index 962438154..63595655c 100644 --- a/source/funkin/ui/debug/latency/LatencyState.hx +++ b/source/funkin/ui/debug/latency/LatencyState.hx @@ -16,6 +16,7 @@ import funkin.ui.debug.latency.CoolStatsGraph; import openfl.events.KeyboardEvent; import funkin.input.PreciseInputManager; import funkin.play.notes.Strumline; +import funkin.ui.mainmenu.MainMenuState; import funkin.play.notes.notestyle.NoteStyle; import funkin.data.notestyle.NoteStyleData; import funkin.data.notestyle.NoteStyleRegistry; @@ -188,6 +189,12 @@ class LatencyState extends MusicBeatSubState } override public function close():Void + { + cleanup(); + super.close(); + } + + function cleanup():Void { PreciseInputManager.instance.onInputPressed.remove(preciseInputPressed); PreciseInputManager.instance.onInputReleased.remove(preciseInputReleased); @@ -200,7 +207,6 @@ class LatencyState extends MusicBeatSubState FlxG.state.persistentDraw = prevPersistentDraw; FlxG.state.persistentUpdate = prevPersistentUpdate; - super.close(); } function regenNoteData() @@ -311,7 +317,9 @@ class LatencyState extends MusicBeatSubState if (controls.BACK) { - close(); + // close(); + cleanup(); + FlxG.switchState(() -> new MainMenuState()); } super.update(elapsed); diff --git a/source/funkin/ui/options/OptionsState.hx b/source/funkin/ui/options/OptionsState.hx index a2301e6a3..6bf637eb9 100644 --- a/source/funkin/ui/options/OptionsState.hx +++ b/source/funkin/ui/options/OptionsState.hx @@ -1,5 +1,6 @@ package funkin.ui.options; +import funkin.ui.transition.LoadingState; import funkin.ui.debug.latency.LatencyState; import flixel.FlxSprite; import flixel.FlxSubState; @@ -185,7 +186,11 @@ class OptionsMenu extends Page createItem("PREFERENCES", function() switchPage(Preferences)); createItem("CONTROLS", function() switchPage(Controls)); createItem("INPUT OFFSETS", function() { + #if web + LoadingState.transitionToState(() -> new LatencyState()); + #else FlxG.state.openSubState(new LatencyState()); + #end }); #if newgrounds diff --git a/source/funkin/ui/transition/LoadingState.hx b/source/funkin/ui/transition/LoadingState.hx index f3620c893..a4fee0f8d 100644 --- a/source/funkin/ui/transition/LoadingState.hx +++ b/source/funkin/ui/transition/LoadingState.hx @@ -451,6 +451,11 @@ class LoadingState extends MusicBeatSubState return promise.future; } + + public static function transitionToState(state:NextState, stopMusic:Bool = false):Void + { + FlxG.switchState(() -> new LoadingState(state, stopMusic)); + } } class MultiCallback