From b9ab38e0b9fb4d9738518d6c978397bf9f9e9206 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 13 Mar 2024 18:47:15 -0700 Subject: [PATCH] timertools -> timerutil fix --- source/funkin/InitState.hx | 6 +-- .../audio/waveform/WaveformDataParser.hx | 6 +-- source/funkin/play/components/PopUpStuff.hx | 10 ++--- .../handlers/ChartEditorAudioHandler.hx | 44 +++++++++---------- .../toolboxes/ChartEditorFreeplayToolbox.hx | 6 +-- source/funkin/util/TimerUtil.hx | 4 +- source/funkin/util/plugins/MemoryGCPlugin.hx | 6 +-- 7 files changed, 41 insertions(+), 41 deletions(-) diff --git a/source/funkin/InitState.hx b/source/funkin/InitState.hx index 9ecf66ec7..8c6af4e51 100644 --- a/source/funkin/InitState.hx +++ b/source/funkin/InitState.hx @@ -30,7 +30,7 @@ import funkin.modding.module.ModuleHandler; import funkin.ui.title.TitleState; import funkin.util.CLIUtil; import funkin.util.CLIUtil.CLIParams; -import funkin.util.tools.TimerTools; +import funkin.util.TimerUtil; import funkin.ui.transition.LoadingState; import funkin.util.TrackerUtil; #if discord_rpc @@ -221,7 +221,7 @@ class InitState extends FlxState // NOTE: Registries must be imported and not referenced with fully qualified names, // to ensure build macros work properly. trace('Parsing game data...'); - var perfStart:Float = TimerTools.start(); + var perfStart:Float = TimerUtil.start(); SongEventRegistry.loadEventCache(); // SongEventRegistry is structured differently so it's not a BaseRegistry. SongRegistry.instance.loadEntries(); LevelRegistry.instance.loadEntries(); @@ -238,7 +238,7 @@ class InitState extends FlxState ModuleHandler.loadModuleCache(); ModuleHandler.callOnCreate(); - trace('Parsing game data took: ${TimerTools.ms(perfStart)}'); + trace('Parsing game data took: ${TimerUtil.ms(perfStart)}'); } /** diff --git a/source/funkin/audio/waveform/WaveformDataParser.hx b/source/funkin/audio/waveform/WaveformDataParser.hx index c667f2002..5aa54d744 100644 --- a/source/funkin/audio/waveform/WaveformDataParser.hx +++ b/source/funkin/audio/waveform/WaveformDataParser.hx @@ -1,6 +1,6 @@ package funkin.audio.waveform; -import funkin.util.tools.TimerTools; +import funkin.util.TimerUtil; class WaveformDataParser { @@ -73,7 +73,7 @@ class WaveformDataParser var outputData:Array = []; - var perfStart:Float = TimerTools.start(); + var perfStart:Float = TimerUtil.start(); for (pointIndex in 0...outputPointCount) { @@ -110,7 +110,7 @@ class WaveformDataParser var outputDataLength:Int = Std.int(outputData.length / channels / 2); var result = new WaveformData(null, channels, sampleRate, samplesPerPoint, bitsPerSample, outputPointCount, outputData); - trace('[WAVEFORM] Interpreted audio buffer in ${TimerTools.seconds(perfStart)}.'); + trace('[WAVEFORM] Interpreted audio buffer in ${TimerUtil.seconds(perfStart)}.'); return result; } diff --git a/source/funkin/play/components/PopUpStuff.hx b/source/funkin/play/components/PopUpStuff.hx index 0fe50f513..69ce40140 100644 --- a/source/funkin/play/components/PopUpStuff.hx +++ b/source/funkin/play/components/PopUpStuff.hx @@ -6,7 +6,7 @@ import flixel.tweens.FlxTween; import flixel.util.FlxDirection; import funkin.graphics.FunkinSprite; import funkin.play.PlayState; -import funkin.util.tools.TimerTools; +import funkin.util.TimerUtil; class PopUpStuff extends FlxTypedGroup { @@ -17,7 +17,7 @@ class PopUpStuff extends FlxTypedGroup public function displayRating(daRating:String) { - var perfStart:Float = TimerTools.start(); + var perfStart:Float = TimerUtil.start(); if (daRating == null) daRating = "good"; @@ -59,12 +59,12 @@ class PopUpStuff extends FlxTypedGroup startDelay: Conductor.instance.beatLengthMs * 0.001 }); - trace('displayRating took: ${TimerTools.seconds(perfStart)}'); + trace('displayRating took: ${TimerUtil.seconds(perfStart)}'); } public function displayCombo(?combo:Int = 0):Int { - var perfStart:Float = TimerTools.start(); + var perfStart:Float = TimerUtil.start(); if (combo == null) combo = 0; @@ -157,7 +157,7 @@ class PopUpStuff extends FlxTypedGroup daLoop++; } - trace('displayCombo took: ${TimerTools.seconds(perfStart)}'); + trace('displayCombo took: ${TimerUtil.seconds(perfStart)}'); return combo; } diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx index 889f5764f..1e1d165f3 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx @@ -7,7 +7,7 @@ import funkin.audio.FunkinSound; import funkin.play.character.BaseCharacter.CharacterType; import funkin.util.FileUtil; import funkin.util.assets.SoundUtil; -import funkin.util.tools.TimerTools; +import funkin.util.TimerUtil; import funkin.audio.waveform.WaveformData; import funkin.audio.waveform.WaveformDataParser; import funkin.audio.waveform.WaveformSprite; @@ -129,41 +129,41 @@ class ChartEditorAudioHandler public static function switchToInstrumental(state:ChartEditorState, instId:String = '', playerId:String, opponentId:String):Bool { - var perfA:Float = TimerTools.start(); + var perfA:Float = TimerUtil.start(); var result:Bool = playInstrumental(state, instId); if (!result) return false; - var perfB:Float = TimerTools.start(); + var perfB:Float = TimerUtil.start(); stopExistingVocals(state); - var perfC:Float = TimerTools.start(); + var perfC:Float = TimerUtil.start(); result = playVocals(state, BF, playerId, instId); - var perfD:Float = TimerTools.start(); + var perfD:Float = TimerUtil.start(); // if (!result) return false; result = playVocals(state, DAD, opponentId, instId); // if (!result) return false; - var perfE:Float = TimerTools.start(); + var perfE:Float = TimerUtil.start(); state.hardRefreshOffsetsToolbox(); - var perfF:Float = TimerTools.start(); + var perfF:Float = TimerUtil.start(); state.hardRefreshFreeplayToolbox(); - var perfG:Float = TimerTools.start(); + var perfG:Float = TimerUtil.start(); - trace('Switched to instrumental in ${TimerTools.seconds(perfA, perfB)}.'); - trace('Stopped existing vocals in ${TimerTools.seconds(perfB, perfC)}.'); - trace('Played BF vocals in ${TimerTools.seconds(perfC, perfD)}.'); - trace('Played DAD vocals in ${TimerTools.seconds(perfD, perfE)}.'); - trace('Hard refreshed offsets toolbox in ${TimerTools.seconds(perfE, perfF)}.'); - trace('Hard refreshed freeplay toolbox in ${TimerTools.seconds(perfF, perfG)}.'); + trace('Switched to instrumental in ${TimerUtil.seconds(perfA, perfB)}.'); + trace('Stopped existing vocals in ${TimerUtil.seconds(perfB, perfC)}.'); + trace('Played BF vocals in ${TimerUtil.seconds(perfC, perfD)}.'); + trace('Played DAD vocals in ${TimerUtil.seconds(perfD, perfE)}.'); + trace('Hard refreshed offsets toolbox in ${TimerUtil.seconds(perfE, perfF)}.'); + trace('Hard refreshed freeplay toolbox in ${TimerUtil.seconds(perfF, perfG)}.'); return true; } @@ -175,9 +175,9 @@ class ChartEditorAudioHandler { if (instId == '') instId = 'default'; var instTrackData:Null = state.audioInstTrackData.get(instId); - var perfStart:Float = TimerTools.start(); + var perfStart:Float = TimerUtil.start(); var instTrack:Null = SoundUtil.buildSoundFromBytes(instTrackData); - trace('Built instrumental track in ${TimerTools.seconds(perfStart)} seconds.'); + trace('Built instrumental track in ${TimerUtil.seconds(perfStart)} seconds.'); if (instTrack == null) return false; stopExistingInstrumental(state); @@ -205,9 +205,9 @@ class ChartEditorAudioHandler { var trackId:String = '${charId}${instId == '' ? '' : '-${instId}'}'; var vocalTrackData:Null = state.audioVocalTrackData.get(trackId); - var perfStart:Float = TimerTools.start(); + var perfStart:Float = TimerUtil.start(); var vocalTrack:Null = SoundUtil.buildSoundFromBytes(vocalTrackData); - trace('Built vocal track in ${TimerTools.seconds(perfStart)}.'); + trace('Built vocal track in ${TimerUtil.seconds(perfStart)}.'); if (state.audioVocalTrackGroup == null) state.audioVocalTrackGroup = new VoicesGroup(); @@ -218,9 +218,9 @@ class ChartEditorAudioHandler case BF: state.audioVocalTrackGroup.addPlayerVoice(vocalTrack); - var perfStart:Float = TimerTools.start(); + var perfStart:Float = TimerUtil.start(); var waveformData:Null = vocalTrack.waveformData; - trace('Interpreted waveform data in ${TimerTools.seconds(perfStart)}.'); + trace('Interpreted waveform data in ${TimerUtil.seconds(perfStart)}.'); if (waveformData != null) { @@ -244,9 +244,9 @@ class ChartEditorAudioHandler case DAD: state.audioVocalTrackGroup.addOpponentVoice(vocalTrack); - var perfStart:Float = TimerTools.start(); + var perfStart:Float = TimerUtil.start(); var waveformData:Null = vocalTrack.waveformData; - trace('Interpreted waveform data in ${TimerTools.seconds(perfStart)}.'); + trace('Interpreted waveform data in ${TimerUtil.seconds(perfStart)}.'); if (waveformData != null) { diff --git a/source/funkin/ui/debug/charting/toolboxes/ChartEditorFreeplayToolbox.hx b/source/funkin/ui/debug/charting/toolboxes/ChartEditorFreeplayToolbox.hx index 28d435c54..c65781259 100644 --- a/source/funkin/ui/debug/charting/toolboxes/ChartEditorFreeplayToolbox.hx +++ b/source/funkin/ui/debug/charting/toolboxes/ChartEditorFreeplayToolbox.hx @@ -7,7 +7,7 @@ import funkin.audio.waveform.WaveformDataParser; import funkin.ui.debug.charting.commands.SetFreeplayPreviewCommand; import funkin.ui.haxeui.components.WaveformPlayer; import funkin.ui.freeplay.FreeplayState; -import funkin.util.tools.TimerTools; +import funkin.util.TimerUtil; import haxe.ui.backend.flixel.components.SpriteWrapper; import haxe.ui.components.Button; import haxe.ui.components.HorizontalSlider; @@ -289,12 +289,12 @@ class ChartEditorFreeplayToolbox extends ChartEditorBaseToolbox // Build player waveform. // waveformMusic.waveform.forceUpdate = true; - var perfStart:Float = TimerTools.start(); + var perfStart:Float = TimerUtil.start(); var waveformData1 = playerVoice?.waveformData; var waveformData2 = opponentVoice?.waveformData ?? playerVoice?.waveformData; // this null check is for songs that only have 1 vocals file! var waveformData3 = chartEditorState.audioInstTrack.waveformData; var waveformData = waveformData3.merge(waveformData1).merge(waveformData2); - trace('Waveform data merging took: ${TimerTools.seconds(perfStart)}'); + trace('Waveform data merging took: ${TimerUtil.seconds(perfStart)}'); waveformMusic.waveform.waveformData = waveformData; // Set the width and duration to render the full waveform, with the clipRect applied we only render a segment of it. diff --git a/source/funkin/util/TimerUtil.hx b/source/funkin/util/TimerUtil.hx index 5322ada92..caf49341b 100644 --- a/source/funkin/util/TimerUtil.hx +++ b/source/funkin/util/TimerUtil.hx @@ -1,9 +1,9 @@ -package funkin.util.tools; +package funkin.util; import funkin.util.tools.FloatTools; import haxe.Timer; -class TimerTools +class TimerUtil { public static function start():Float { diff --git a/source/funkin/util/plugins/MemoryGCPlugin.hx b/source/funkin/util/plugins/MemoryGCPlugin.hx index 67a4fe18e..4b89fa637 100644 --- a/source/funkin/util/plugins/MemoryGCPlugin.hx +++ b/source/funkin/util/plugins/MemoryGCPlugin.hx @@ -1,7 +1,7 @@ package funkin.util.plugins; import flixel.FlxBasic; -import funkin.util.tools.TimerTools; +import funkin.util.TimerUtil; /** * A plugin which adds functionality to press `Ins` to immediately perform memory garbage collection. @@ -24,9 +24,9 @@ class MemoryGCPlugin extends FlxBasic if (FlxG.keys.justPressed.INSERT) { - var perfStart:Float = TimerTools.start(); + var perfStart:Float = TimerUtil.start(); funkin.util.MemoryUtil.collect(true); - trace('Memory GC took: ${TimerTools.seconds(perfStart)}'); + trace('Memory GC took: ${TimerUtil.seconds(perfStart)}'); } }