1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-01-09 13:47:25 +00:00

Fix some issues causing the Input Offsets view to crash on web.

This commit is contained in:
EliteMasterEric 2024-09-22 12:14:15 -04:00
parent a41d3033d5
commit 0bf1bead03
4 changed files with 25 additions and 3 deletions

View file

@ -103,7 +103,11 @@ class NoteStyle implements IRegistryEntry<NoteStyleData>
function buildNoteFrames(force:Bool = false):Null<FlxAtlasFrames>
{
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)))
{

View file

@ -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);

View file

@ -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

View file

@ -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