From 8fc068e7180261607710ef4764dff29895aaacf3 Mon Sep 17 00:00:00 2001 From: Ralty <78720179+Raltyro@users.noreply.github.com> Date: Sun, 29 Mar 2026 09:06:15 +0700 Subject: [PATCH] Libraries update --- building/libs.xml | 2 +- project.xml | 19 +++++++----- source/funkin/backend/system/Flags.hx | 4 +-- source/funkin/backend/system/FunkinGame.hx | 9 +++--- source/funkin/backend/system/Main.hx | 6 ---- .../backend/system/OptimizedBitmapData.hx | 30 ++----------------- .../backend/system/framerate/AssetTreeInfo.hx | 2 +- .../backend/system/framerate/ConductorInfo.hx | 2 +- .../backend/system/framerate/FlixelInfo.hx | 2 +- .../backend/system/framerate/Framerate.hx | 2 +- .../system/framerate/FramerateCategory.hx | 2 +- .../system/framerate/FramerateCounter.hx | 2 +- .../backend/system/framerate/MemoryCounter.hx | 2 +- .../backend/system/framerate/StatsInfo.hx | 2 +- .../backend/system/framerate/SystemInfo.hx | 2 +- source/funkin/editors/SaveSubstate.hx | 11 +++++++ source/funkin/editors/ui/UIFileExplorer.hx | 11 ++++++- 17 files changed, 51 insertions(+), 59 deletions(-) diff --git a/building/libs.xml b/building/libs.xml index 0d8bc1c5..bccaca27 100644 --- a/building/libs.xml +++ b/building/libs.xml @@ -20,7 +20,7 @@ - + diff --git a/project.xml b/project.xml index 6ad26e84..abd8dd35 100644 --- a/project.xml +++ b/project.xml @@ -186,8 +186,13 @@ - - + + + + + + + @@ -207,19 +212,17 @@ + + - - - - - - + + diff --git a/source/funkin/backend/system/Flags.hx b/source/funkin/backend/system/Flags.hx index cac69e81..e1c6661a 100644 --- a/source/funkin/backend/system/Flags.hx +++ b/source/funkin/backend/system/Flags.hx @@ -314,11 +314,11 @@ class Flags { if (SUSTAINS_AS_ONE_NOTE == null) SUSTAINS_AS_ONE_NOTE = MOD_API_VERSION >= 2; if (DEFAULT_GLSL_VERSION == null) { if (MOD_API_VERSION < 2) { - DEFAULT_GLSL_VERSION = "120"; + DEFAULT_GLSL_VERSION = #if (android || mac || web) "100" #else "120" #end; Logs.warn("Blend Mode Extensions won't work in MOD_API_VERSION below than 2"); } else { - DEFAULT_GLSL_VERSION = openfl.display.Shader.getDefaultGLVersion(); + DEFAULT_GLSL_VERSION = openfl.utils.GLSLSourceAssembler.getDefaultVersion(); } } } diff --git a/source/funkin/backend/system/FunkinGame.hx b/source/funkin/backend/system/FunkinGame.hx index 275e9e49..2a87272b 100644 --- a/source/funkin/backend/system/FunkinGame.hx +++ b/source/funkin/backend/system/FunkinGame.hx @@ -8,13 +8,12 @@ class FunkinGame extends FlxGame { super.switchState(); // draw once to put all images in gpu then put the last update time to now to prevent lag spikes or whatever draw(); - _total = ticks = getTicks(); + ticks = getTicks(); skipNextTickUpdate = true; } - public override function onEnterFrame(t) { - if (skipNextTickUpdate != (skipNextTickUpdate = false)) - _total = ticks = getTicks(); - super.onEnterFrame(t); + override function __enterFrame(deltaTime:Float) { + if (skipNextTickUpdate != (skipNextTickUpdate = false)) ticks = getTicks(); + super.__enterFrame(deltaTime); } } \ No newline at end of file diff --git a/source/funkin/backend/system/Main.hx b/source/funkin/backend/system/Main.hx index 517ce1f3..044c5ae7 100644 --- a/source/funkin/backend/system/Main.hx +++ b/source/funkin/backend/system/Main.hx @@ -97,16 +97,10 @@ class Main extends Sprite // DEPRECATED @:dox(hide) public static function execAsync(func:Void->Void) ThreadUtil.execAsync(func); - private static function getTimer():Int { - return time = Lib.getTimer(); - } - public static function loadGameSettings() { WindowUtils.init(); SaveWarning.init(); MemoryUtil.init(); - @:privateAccess - FlxG.game.getTimer = getTimer; FunkinCache.init(); Paths.assetsTree = new AssetsLibraryList(); diff --git a/source/funkin/backend/system/OptimizedBitmapData.hx b/source/funkin/backend/system/OptimizedBitmapData.hx index ecdcd3eb..510ebf14 100644 --- a/source/funkin/backend/system/OptimizedBitmapData.hx +++ b/source/funkin/backend/system/OptimizedBitmapData.hx @@ -1,38 +1,14 @@ package funkin.backend.system; import lime.graphics.Image; -import lime.graphics.cairo.CairoImageSurface; import openfl.display.BitmapData; -import openfl.geom.Rectangle; -import openfl.utils.BitmapDataUtil; -@:deprecated("Use openfl.utils.BitmapDataUtil.toHardware instead.") +@:deprecated("Use openfl.display.BitmapData.toHardware instead.") class OptimizedBitmapData extends BitmapData { @SuppressWarnings("checkstyle:Dynamic") @:noCompletion private override function __fromImage(image:#if lime Image #else Dynamic #end):Void { - #if lime - if (image != null && image.buffer != null) - { - this.image = image; - - width = image.width; - height = image.height; - rect = new Rectangle(0, 0, image.width, image.height); - - __textureWidth = width; - __textureHeight = height; - - #if sys - image.format = BGRA32; - image.premultiplied = true; - #end - - __isValid = true; - readable = true; - - BitmapDataUtil.toHardware(this); - } - #end + super.__fromImage(image); + toHardware(); } } \ No newline at end of file diff --git a/source/funkin/backend/system/framerate/AssetTreeInfo.hx b/source/funkin/backend/system/framerate/AssetTreeInfo.hx index 1414904f..837851ab 100644 --- a/source/funkin/backend/system/framerate/AssetTreeInfo.hx +++ b/source/funkin/backend/system/framerate/AssetTreeInfo.hx @@ -14,7 +14,7 @@ class AssetTreeInfo extends FramerateCategory { super("Asset Libraries Tree Info"); } - public override function __enterFrame(t:Int) { + public override function __enterFrame(t:Float) { if (alpha <= 0.05) return; if ((lastUpdateTime += FlxG.rawElapsed) < 1) diff --git a/source/funkin/backend/system/framerate/ConductorInfo.hx b/source/funkin/backend/system/framerate/ConductorInfo.hx index e615bbba..9a9bf8f1 100644 --- a/source/funkin/backend/system/framerate/ConductorInfo.hx +++ b/source/funkin/backend/system/framerate/ConductorInfo.hx @@ -5,7 +5,7 @@ class ConductorInfo extends FramerateCategory { super("Conductor Info"); } - public override function __enterFrame(t:Int) { + public override function __enterFrame(t:Float) { if (alpha <= 0.05) return; _text = 'Current Song Position: ${Math.floor(Conductor.songPosition * 1000) / 1000}'; _text += '\n - ${Conductor.curBeat} beats'; diff --git a/source/funkin/backend/system/framerate/FlixelInfo.hx b/source/funkin/backend/system/framerate/FlixelInfo.hx index c485468c..be81de7c 100644 --- a/source/funkin/backend/system/framerate/FlixelInfo.hx +++ b/source/funkin/backend/system/framerate/FlixelInfo.hx @@ -7,7 +7,7 @@ class FlixelInfo extends FramerateCategory { super("Flixel Info"); } - public override function __enterFrame(t:Int) { + public override function __enterFrame(t:Float) { if (alpha <= 0.05) return; diff --git a/source/funkin/backend/system/framerate/Framerate.hx b/source/funkin/backend/system/framerate/Framerate.hx index c33b416c..b1ac78af 100644 --- a/source/funkin/backend/system/framerate/Framerate.hx +++ b/source/funkin/backend/system/framerate/Framerate.hx @@ -100,7 +100,7 @@ class Framerate extends Sprite { var debugAlpha:Float = 0; - public override function __enterFrame(t:Int) { + public override function __enterFrame(t:Float) { alpha = CoolUtil.fpsLerp(alpha, debugMode > 0 ? 1 : 0, 0.5); debugAlpha = CoolUtil.fpsLerp(debugAlpha, debugMode > 1 ? 1 : 0, 0.5); diff --git a/source/funkin/backend/system/framerate/FramerateCategory.hx b/source/funkin/backend/system/framerate/FramerateCategory.hx index db89137f..434de06e 100644 --- a/source/funkin/backend/system/framerate/FramerateCategory.hx +++ b/source/funkin/backend/system/framerate/FramerateCategory.hx @@ -42,7 +42,7 @@ class FramerateCategory extends Sprite { public function reload() {} - public override function __enterFrame(t:Int) { + public override function __enterFrame(t:Float) { if (alpha <= 0.05) return; super.__enterFrame(t); diff --git a/source/funkin/backend/system/framerate/FramerateCounter.hx b/source/funkin/backend/system/framerate/FramerateCounter.hx index 9f140695..ead2fbd5 100644 --- a/source/funkin/backend/system/framerate/FramerateCounter.hx +++ b/source/funkin/backend/system/framerate/FramerateCounter.hx @@ -38,7 +38,7 @@ class FramerateCounter extends Sprite { lastUpdateTime = 0; } - public override function __enterFrame(t:Int) { + public override function __enterFrame(t:Float) { if (alpha <= 0.05) return; super.__enterFrame(t); diff --git a/source/funkin/backend/system/framerate/MemoryCounter.hx b/source/funkin/backend/system/framerate/MemoryCounter.hx index 068399b5..5c68ac69 100644 --- a/source/funkin/backend/system/framerate/MemoryCounter.hx +++ b/source/funkin/backend/system/framerate/MemoryCounter.hx @@ -32,7 +32,7 @@ class MemoryCounter extends Sprite { public function reload() {} - public override function __enterFrame(t:Int) { + public override function __enterFrame(t:Float) { if (alpha <= 0.05) return; super.__enterFrame(t); diff --git a/source/funkin/backend/system/framerate/StatsInfo.hx b/source/funkin/backend/system/framerate/StatsInfo.hx index 937bdb10..8cde3e34 100644 --- a/source/funkin/backend/system/framerate/StatsInfo.hx +++ b/source/funkin/backend/system/framerate/StatsInfo.hx @@ -9,7 +9,7 @@ class StatsInfo extends FramerateCategory { super("Asset Libraries Tree Info"); } - public override function __enterFrame(t:Int) { + public override function __enterFrame(t:Float) { if (alpha <= 0.05) return; _text = "totalDC: " + Context3DStats.totalDrawCalls(); _text += "\nstageDC: " + Context3DStats.contextDrawCalls(DrawCallContext.STAGE); diff --git a/source/funkin/backend/system/framerate/SystemInfo.hx b/source/funkin/backend/system/framerate/SystemInfo.hx index 4de57190..05927b9c 100644 --- a/source/funkin/backend/system/framerate/SystemInfo.hx +++ b/source/funkin/backend/system/framerate/SystemInfo.hx @@ -169,7 +169,7 @@ class SystemInfo extends FramerateCategory { super("System Info"); } - public override function __enterFrame(t:Int) { + public override function __enterFrame(t:Float) { if (alpha <= 0.05) return; _text = __formattedSysText; diff --git a/source/funkin/editors/SaveSubstate.hx b/source/funkin/editors/SaveSubstate.hx index 7202cf37..be964248 100644 --- a/source/funkin/editors/SaveSubstate.hx +++ b/source/funkin/editors/SaveSubstate.hx @@ -2,6 +2,9 @@ package funkin.editors; import haxe.io.Path; import lime.ui.FileDialog; +#if lime_funkin +import lime.ui.FileDialogFilter; +#end class SaveSubstate extends MusicBeatSubstate { public var saveOptions:Map; @@ -26,6 +29,13 @@ class SaveSubstate extends MusicBeatSubstate { public override function create() { super.create(); + #if lime_funkin + FileDialog.saveFile(FlxG.stage.window, "Save File", (fileName:String, activeFilter:FileDialogFilter) -> { + CoolUtil.safeSaveFile(fileName, data); + close(); + }, [new FileDialogFilter("Specified File Extension", options.saveExt.getDefault(Path.extension(options.defaultSaveFile)))], + options.defaultSaveFile); + #else var fileDialog = new FileDialog(); fileDialog.onCancel.add(function() close()); fileDialog.onSelect.add(function(str) { @@ -33,6 +43,7 @@ class SaveSubstate extends MusicBeatSubstate { close(); }); fileDialog.browse(SAVE, options.saveExt.getDefault(Path.extension(options.defaultSaveFile)), options.defaultSaveFile); + #end } public override function update(elapsed:Float) { diff --git a/source/funkin/editors/ui/UIFileExplorer.hx b/source/funkin/editors/ui/UIFileExplorer.hx index 4f75fd6e..46ab81c4 100644 --- a/source/funkin/editors/ui/UIFileExplorer.hx +++ b/source/funkin/editors/ui/UIFileExplorer.hx @@ -2,6 +2,9 @@ package funkin.editors.ui; import haxe.io.Bytes; import lime.ui.FileDialog; +#if lime_funkin +import lime.ui.FileDialogFilter; +#end class UIFileExplorer extends UISliceSprite { public var uploadButton:UIButton; @@ -24,10 +27,16 @@ class UIFileExplorer extends UISliceSprite { if (onFile != null) this.onFile = onFile; - uploadButton = new UIButton(x + 8, y+ 8, null, function () { + uploadButton = new UIButton(x + 8, y + 8, null, function () { + #if lime_funkin + FileDialog.openFile(FlxG.stage.window, "Open File", (fileNames:Array, activeFilter:FileDialogFilter) -> { + loadFile(fileNames[0]); + }, this.fileType != null ? [new FileDialogFilter("Specified File Extension", this.fileType)] : null); + #else var fileDialog = new FileDialog(); fileDialog.onSelect.add(loadFile); fileDialog.browse(OPEN, this.fileType); + #end }, bWidth - 16, bHeight - 16); members.push(uploadButton);