From d4a7d7eac4dec7361aa778d97b6a2771c7b92295 Mon Sep 17 00:00:00 2001 From: Hyper_ <40342021+NotHyper-474@users.noreply.github.com> Date: Thu, 18 Jul 2024 17:48:58 -0300 Subject: [PATCH 01/25] [Unix Build Actions] Do not preserve directory tree when packing tar (#334) * Update linux.yml Now it won't preserve the directory tree (i.e it won't include the "export/release/linux/bin" folders) * do the same for macos --- .github/workflows/linux.yml | 2 +- .github/workflows/macos.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 8ac80b6a..4e742b35 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -36,7 +36,7 @@ jobs: run: | haxelib run lime build linux - name: Tar files - run: tar -zcvf CodenameEngine.tar.gz export/release/linux/bin + run: tar -zcvf CodenameEngine.tar.gz -C export/release/linux/bin . - name: Uploading artifact (entire build) uses: actions/upload-artifact@v2 with: diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 819a3af0..3dd28814 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -33,7 +33,7 @@ jobs: run: | haxelib run lime build mac - name: Tar files - run: tar -zcvf CodenameEngine.tar.gz export/release/macos/bin + run: tar -zcvf CodenameEngine.tar.gz -C export/release/macos/bin . - name: Uploading artifact (entire build) uses: actions/upload-artifact@v2 with: From 64923a3e07317fc36db9e539b546c72d64275653 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Fri, 26 Jul 2024 04:42:06 +0200 Subject: [PATCH 02/25] Istfg why didnt we fix this months ago --- source/funkin/editors/charter/Charter.hx | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 1071763a..9e03c5a6 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -607,20 +607,29 @@ class Charter extends UIState { updateWaveforms(); } + inline function isSoundLoaded(sound:FlxSound) { + @:privateAccess + return sound != null && sound._sound != null && sound._sound.length > 0; + } + public function updateWaveforms() { - var wavesToGenerate:Array<{name:String, sound:FlxSound}> = [ - {name: "Inst.ogg", sound: FlxG.sound.music}, - ]; - if (PlayState.SONG.meta.needsVoices != false) + var wavesToGenerate:Array<{name:String, sound:FlxSound}> = []; + + if(isSoundLoaded(FlxG.sound.music)) + wavesToGenerate.push({name: "Inst.ogg", sound: FlxG.sound.music}); + + if (PlayState.SONG.meta.needsVoices != false && isSoundLoaded(vocals)) wavesToGenerate.push({name: "Voices.ogg", sound: vocals}); for (strumLine in strumLines) - if (strumLine.vocals != null && strumLine.strumLine.vocalsSuffix != null && strumLine.strumLine.vocalsSuffix != "") + if (strumLine.vocals != null && strumLine.strumLine.vocalsSuffix != null && strumLine.strumLine.vocalsSuffix != "" && isSoundLoaded(strumLine.vocals)) wavesToGenerate.push({ - name: 'Voices${strumLine.strumLine.vocalsSuffix}.ogg', + name: 'Voices${strumLine.strumLine.vocalsSuffix}.ogg', sound: strumLine.vocals }); + trace(wavesToGenerate, @:privateAccess vocals._sound, @:privateAccess vocals._sound?.length); + var oldWaveformList:Array = waveformHandler.waveformList; var newWaveformList:Array = [for (data in wavesToGenerate) data.name]; From d8104ee4dbb8ca354f3ecf48fe3848f16f549fe0 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Fri, 26 Jul 2024 04:42:40 +0200 Subject: [PATCH 03/25] Ooop --- source/funkin/backend/utils/DiscordUtil.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/backend/utils/DiscordUtil.hx b/source/funkin/backend/utils/DiscordUtil.hx index 871ca42e..db3c20c4 100644 --- a/source/funkin/backend/utils/DiscordUtil.hx +++ b/source/funkin/backend/utils/DiscordUtil.hx @@ -309,7 +309,7 @@ class DiscordUtil Logs.logText(")") ], INFO); - call("onReady", [errorCode, cast(finalMsg, String)]); + call("onDisconnected", [errorCode, cast(finalMsg, String)]); } private static function onError(errorCode:Int, message:cpp.ConstCharStar):Void From 42cbb45360821283ba18d68d386712ca50c9bc4c Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Fri, 26 Jul 2024 04:44:18 +0200 Subject: [PATCH 04/25] Ooops --- source/funkin/editors/charter/Charter.hx | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 9e03c5a6..2ff39aa0 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -628,8 +628,6 @@ class Charter extends UIState { sound: strumLine.vocals }); - trace(wavesToGenerate, @:privateAccess vocals._sound, @:privateAccess vocals._sound?.length); - var oldWaveformList:Array = waveformHandler.waveformList; var newWaveformList:Array = [for (data in wavesToGenerate) data.name]; From e1146587a69155f4e137c05c26223d6774904c44 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Wed, 31 Jul 2024 16:09:15 +0200 Subject: [PATCH 05/25] Evil cats --- commandline/commands/Update.hx | 13 +++++++++---- libs.xml | 6 +----- setup-dev-branch.xml | 6 +----- setup-dev.xml | 6 +----- 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/commandline/commands/Update.hx b/commandline/commands/Update.hx index 36a790ad..4e3fb3b1 100644 --- a/commandline/commands/Update.hx +++ b/commandline/commands/Update.hx @@ -58,11 +58,11 @@ class Update { data: lib }); case "cmd": - events.push({ type: CMD, data: { inLib: libNode.has.inLib ? libNode.att.inLib : null, + dir: libNode.has.dir ? libNode.att.dir : null, lines: { if(Lambda.count(libNode.nodes.line) > 0) [ @@ -141,6 +141,10 @@ class Update { case CMD: var cmd:CmdData = event.data; var lib = cmd.inLib; + var dir = ""; + if(cmd.dir != null) { + dir = "/" + cmd.dir; + } var oldCwd = Sys.getCwd(); if(lib != null) { var libPrefix = '.haxelib/$lib'; @@ -152,7 +156,7 @@ class Update { Sys.setCwd(oldCwd); continue; } - Sys.setCwd(devPath); + Sys.setCwd(devPath + dir); } else if(FileSystem.exists(libPrefix + '/.current')) { var version = StringTools.replace(File.getContent(libPrefix + '/.current'), ".", ","); if(!FileSystem.exists(libPrefix + '/$version')) { @@ -160,7 +164,7 @@ class Update { Sys.setCwd(oldCwd); continue; } - Sys.setCwd(libPrefix + '/$version'); + Sys.setCwd(libPrefix + '/$version' + dir); } else { Sys.println('Cannot find .dev or .current file in $libPrefix'); Sys.setCwd(oldCwd); @@ -271,7 +275,8 @@ typedef Event = { } typedef CmdData = { - var ?inLib:String; + var inLib:String; + var dir:String; var lines:Array; } diff --git a/libs.xml b/libs.xml index 9f3f5ede..6f78c1cc 100644 --- a/libs.xml +++ b/libs.xml @@ -34,10 +34,6 @@ - - cd tools - haxe tools.hxml - cd ..s - + diff --git a/setup-dev-branch.xml b/setup-dev-branch.xml index ed3eb905..34859035 100644 --- a/setup-dev-branch.xml +++ b/setup-dev-branch.xml @@ -22,9 +22,5 @@ Rebuilding Lime... - - cd tools - haxe tools.hxml - cd ..s - + diff --git a/setup-dev.xml b/setup-dev.xml index dc2762ff..f4ef6574 100644 --- a/setup-dev.xml +++ b/setup-dev.xml @@ -25,11 +25,7 @@ - - cd tools - haxe tools.hxml - cd ..s - + From 818eba4f74db2aa34f1a9eff59dcb348f2163734 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Wed, 31 Jul 2024 16:11:06 +0200 Subject: [PATCH 06/25] forgor --- libs.xml | 2 +- setup-dev-branch.xml | 2 +- setup-dev.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs.xml b/libs.xml index 6f78c1cc..f19a5739 100644 --- a/libs.xml +++ b/libs.xml @@ -33,7 +33,7 @@ Rebuilding Lime... - + diff --git a/setup-dev-branch.xml b/setup-dev-branch.xml index 34859035..82c27129 100644 --- a/setup-dev-branch.xml +++ b/setup-dev-branch.xml @@ -21,6 +21,6 @@ Rebuilding Lime... - + diff --git a/setup-dev.xml b/setup-dev.xml index f4ef6574..be2eedb2 100644 --- a/setup-dev.xml +++ b/setup-dev.xml @@ -24,7 +24,7 @@ - + From 38af44112af5044a2496bb83a6db29316e2d9d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=8D=9A=7ENex?= <87421482+NexIsDumb@users.noreply.github.com> Date: Wed, 31 Jul 2024 18:38:57 +0200 Subject: [PATCH 07/25] fixing a thingie when rebuilding lime --- libs.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libs.xml b/libs.xml index f19a5739..eeecc9e0 100644 --- a/libs.xml +++ b/libs.xml @@ -20,12 +20,11 @@ - - - + + From ad52d5ac00918fea416c2add1ccffad389e22e85 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Fri, 2 Aug 2024 13:31:18 +0200 Subject: [PATCH 08/25] Added hxcpp fork --- libs.xml | 13 +++++++++++++ setup-dev.xml | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/libs.xml b/libs.xml index eeecc9e0..a7ad3aef 100644 --- a/libs.xml +++ b/libs.xml @@ -25,6 +25,19 @@ + + + + + + + + + + Rebuilding Hxcpp... + + + diff --git a/setup-dev.xml b/setup-dev.xml index be2eedb2..c3de04d2 100644 --- a/setup-dev.xml +++ b/setup-dev.xml @@ -82,5 +82,17 @@ + + + cd dev-libs + git clone https://github.com/NeeEoo/hxcpp hxcpp + cd .. + haxelib dev hxcpp dev-libs/hxcpp + + + + + + Setup for dev libs complete! From 763e47813bdfa1442d40f0f80046332fb8023271 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Fri, 2 Aug 2024 13:59:11 +0200 Subject: [PATCH 09/25] Aaaaaa --- commandline/commands/Update.hx | 14 +++++++++----- libs.xml | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/commandline/commands/Update.hx b/commandline/commands/Update.hx index 4e3fb3b1..60c60574 100644 --- a/commandline/commands/Update.hx +++ b/commandline/commands/Update.hx @@ -46,6 +46,7 @@ class Update { type: libNode.name }; if (libNode.has.global) lib.global = libNode.att.global; + if (libNode.has.skipDeps) lib.skipDeps = libNode.att.skipDeps; switch (lib.type) { case "lib": if (libNode.has.version) lib.version = libNode.att.version; @@ -120,21 +121,22 @@ class Update { } var commandSuffix = " --always"; - if (SILENT) commandSuffix += " --silent"; + if (SILENT) commandSuffix += " --quiet"; for(event in events) { switch(event.type) { case INSTALL: var lib:Library = event.data; - var globalism:Null = lib.global == "true" ? "--global" : null; - var globalSuffix = globalism != null ? ' $globalism' : ''; + var globalSuffix:Null = lib.global == "true" ? " --global" : ""; + var skipDeps = lib.skipDeps == "true" ? " --skip-dependencies" : ""; + var commandPrefix = commandSuffix + globalSuffix + skipDeps;// + " --no-timeout"; switch(lib.type) { case "lib": prettyPrint((lib.global == "true" ? "Globally installing" : "Locally installing") + ' "${lib.name}"...'); - Sys.command('haxelib install ${lib.name} ${lib.version != null ? " " + lib.version : " "}$globalSuffix$commandSuffix'); + Sys.command('haxelib$commandPrefix install ${lib.name} ${lib.version != null ? " " + lib.version : " "}'); case "git": prettyPrint((lib.global == "true" ? "Globally installing" : "Locally installing") + ' "${lib.name}" from git url "${lib.url}"'); - Sys.command('haxelib git ${lib.name} ${lib.url}${lib.ref != null ? ' ${lib.ref}' : ''}$globalSuffix$commandSuffix'); + Sys.command('haxelib$commandPrefix git ${lib.name} ${lib.url}${lib.ref != null ? ' ${lib.ref}' : ''}'); default: prettyPrint('Cannot resolve library of type "${lib.type}"'); } @@ -264,6 +266,8 @@ typedef Library = { var name:String; var type:String; var ?global:String; + var ?skipDeps:String; + var ?recursive:String; var ?version:String; var ?ref:String; var ?url:String; diff --git a/libs.xml b/libs.xml index a7ad3aef..0f9139d8 100644 --- a/libs.xml +++ b/libs.xml @@ -14,8 +14,8 @@ - - + + From da20261490c88320b24bc4f3dde07ad4a82e1869 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Fri, 2 Aug 2024 14:11:59 +0200 Subject: [PATCH 10/25] Fix issues --- commandline/commands/Update.hx | 19 +++++++++++++++---- setup-dev.xml | 24 ++++++++++++------------ 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/commandline/commands/Update.hx b/commandline/commands/Update.hx index 60c60574..0d39d27c 100644 --- a/commandline/commands/Update.hx +++ b/commandline/commands/Update.hx @@ -7,8 +7,19 @@ import sys.io.Process; import sys.FileSystem; class Update { + private static function recursiveDelete(path:String) { + for(file in FileSystem.readDirectory(path)) { + var p = '$path/$file'; + if(FileSystem.isDirectory(p)) + recursiveDelete(p); + else + FileSystem.deleteFile(p); + } + FileSystem.deleteDirectory(path); + } + public static function main(args:Array) { - var args = ArgParser.parse(args, ["S" => "silent-progress", "silent" => "silent-progress"]); + var args = ArgParser.parse(args, ["s" => "silent-progress", "S" => "silent-progress", "silent" => "silent-progress"]); var CHECK_VSTUDIO = !args.existsOption("no-vscheck"); var REINSTALL_ALL = args.existsOption("reinstall"); var SILENT = args.existsOption("silent-progress"); @@ -18,7 +29,7 @@ class Update { FileSystem.createDirectory('.haxelib'); if (REINSTALL_ALL) { - FileSystem.deleteDirectory('.haxelib'); + recursiveDelete('.haxelib'); FileSystem.createDirectory('.haxelib'); } @@ -102,9 +113,9 @@ class Update { if(args.args.length == 0) defines.push("all"); function parse(libNode:Access) { - if(libNode.name == "if") { + if(libNode.name == "if" || libNode.name == "unless") { var cond = libNode.att.cond; - if(!Utils.evaluateArgsCondition(cond, defines)) { + if(Utils.evaluateArgsCondition(cond, defines) != (libNode.name == "if")) { return; } diff --git a/setup-dev.xml b/setup-dev.xml index c3de04d2..ba79d790 100644 --- a/setup-dev.xml +++ b/setup-dev.xml @@ -6,6 +6,18 @@ mkdir dev-libs + + + cd dev-libs + git clone https://github.com/NeeEoo/hxcpp hxcpp + cd .. + haxelib dev hxcpp dev-libs/hxcpp + + + + + + cd dev-libs @@ -82,17 +94,5 @@ - - - cd dev-libs - git clone https://github.com/NeeEoo/hxcpp hxcpp - cd .. - haxelib dev hxcpp dev-libs/hxcpp - - - - - - Setup for dev libs complete! From 8cb833a38d6e255820960ea186c99d1877280aaf Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Fri, 2 Aug 2024 14:24:50 +0200 Subject: [PATCH 11/25] Fix compiling issues --- source/funkin/backend/chart/Chart.hx | 1 + source/funkin/backend/chart/ChartData.hx | 1 + source/funkin/backend/chart/FNFLegacyParser.hx | 1 + source/funkin/editors/charter/Charter.hx | 2 +- source/funkin/game/PlayState.hx | 2 +- 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/funkin/backend/chart/Chart.hx b/source/funkin/backend/chart/Chart.hx index 9eabd626..87302b71 100644 --- a/source/funkin/backend/chart/Chart.hx +++ b/source/funkin/backend/chart/Chart.hx @@ -56,6 +56,7 @@ class Chart { data.setFieldDefault("name", songName); data.setFieldDefault("beatsPerMeasure", 4); data.setFieldDefault("stepsPerBeat", 4); + data.setFieldDefault("needsVoices", true); data.setFieldDefault("icon", "face"); data.setFieldDefault("difficulties", []); data.setFieldDefault("coopAllowed", false); diff --git a/source/funkin/backend/chart/ChartData.hx b/source/funkin/backend/chart/ChartData.hx index 7e6ad795..3f8f3302 100644 --- a/source/funkin/backend/chart/ChartData.hx +++ b/source/funkin/backend/chart/ChartData.hx @@ -26,6 +26,7 @@ typedef ChartMetaData = { public var ?coopAllowed:Bool; public var ?opponentModeAllowed:Bool; public var ?customValues:Dynamic; + public var ?needsVoices:Bool; // NOT TO BE EXPORTED public var ?parsedColor:FlxColor; diff --git a/source/funkin/backend/chart/FNFLegacyParser.hx b/source/funkin/backend/chart/FNFLegacyParser.hx index 3bd0dfad..6eb26188 100644 --- a/source/funkin/backend/chart/FNFLegacyParser.hx +++ b/source/funkin/backend/chart/FNFLegacyParser.hx @@ -41,6 +41,7 @@ class FNFLegacyParser { } result.meta.bpm = data.bpm; + result.meta.needsVoices = data.needsVoices.getDefault(true); var camFocusedBF:Bool = false; var altAnims:Bool = false; diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 7135b90e..dc862cc4 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -526,7 +526,7 @@ class Charter extends UIState { noteTypes = PlayState.SONG.noteTypes; FlxG.sound.setMusic(FlxG.sound.load(Paths.inst(__song, __diff))); - if (Assets.exists(Paths.voices(__song, __diff))) // null or true + if (PlayState.SONG.meta.needsVoices != false && Assets.exists(Paths.voices(__song, __diff))) // null or true vocals = FlxG.sound.load(Paths.voices(__song, __diff)); else vocals = new FlxSound(); diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 31fa37c7..20e3ce7b 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1000,7 +1000,7 @@ class PlayState extends MusicBeatState curSong = songData.meta.name.toLowerCase(); inst = FlxG.sound.load(Paths.inst(SONG.meta.name, difficulty)); - if (Assets.exists(Paths.voices(SONG.meta.name, difficulty))) // null or true + if (SONG.meta.needsVoices != false && Assets.exists(Paths.voices(SONG.meta.name, difficulty))) // null or true vocals = FlxG.sound.load(Paths.voices(SONG.meta.name, difficulty)); else vocals = new FlxSound(); From 1a4c2cac21b42523b1b4e04e2edabf5cfb8ebf92 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Fri, 2 Aug 2024 14:48:19 +0200 Subject: [PATCH 12/25] Oops --- source/funkin/backend/chart/FNFLegacyParser.hx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/funkin/backend/chart/FNFLegacyParser.hx b/source/funkin/backend/chart/FNFLegacyParser.hx index 6eb26188..0e5f55df 100644 --- a/source/funkin/backend/chart/FNFLegacyParser.hx +++ b/source/funkin/backend/chart/FNFLegacyParser.hx @@ -146,6 +146,7 @@ class FNFLegacyParser { notes: null, bpm: chart.meta.bpm, speed: chart.scrollSpeed, + needsVoices: chart.meta.needsVoices, player1: null, player2: null, @@ -209,6 +210,7 @@ typedef SwagSong = var ?stage:String; var ?noteTypes:Array; var ?events:Array; + var ?needsVoices:Bool; var player1:String; var player2:String; From 2e1fd5897adc9944591a1ccc802cd78d5d912e4b Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Fri, 2 Aug 2024 15:04:53 +0200 Subject: [PATCH 13/25] Remove SQLITE and MYSQL --- source/funkin/backend/system/macros/Macros.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/backend/system/macros/Macros.hx b/source/funkin/backend/system/macros/Macros.hx index 9183e4a4..0711c612 100644 --- a/source/funkin/backend/system/macros/Macros.hx +++ b/source/funkin/backend/system/macros/Macros.hx @@ -31,10 +31,10 @@ class Macros { if(Context.defined("sys")) { for(inc in ["sys", "openfl.net", "funkin.backend.system.net"]) { if(!isHl) - Compiler.include(inc); + Compiler.include(inc, ["sys.db.Sqlite", "sys.db.Mysql"]); else { // TODO: Hashlink - //Compiler.include(inc, ["sys.net.UdpSocket", "openfl.net.DatagramSocket"]); // fixes FATAL ERROR : Failed to load function std@socket_set_broadcast + //Compiler.include(inc, ["sys.net.UdpSocket", "openfl.net.DatagramSocket", "sys.db.Sqlite", "sys.db.Mysql"]); // fixes FATAL ERROR : Failed to load function std@socket_set_broadcast } } } From 04ab53ee385dc3c66fc326d6c403642f1b4e73db Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Fri, 2 Aug 2024 15:24:21 +0200 Subject: [PATCH 14/25] Some more stuffs --- source/funkin/backend/system/macros/Macros.hx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source/funkin/backend/system/macros/Macros.hx b/source/funkin/backend/system/macros/Macros.hx index 0711c612..d40855b3 100644 --- a/source/funkin/backend/system/macros/Macros.hx +++ b/source/funkin/backend/system/macros/Macros.hx @@ -28,13 +28,21 @@ class Macros { var isHl = Context.defined("hl"); + var compathx4 = [ + "sys.db.Sqlite", + "sys.db.Mysql", + "sys.db.Connection", + "sys.db.ResultSet", + "haxe.remoting.Proxy", + ]; + if(Context.defined("sys")) { for(inc in ["sys", "openfl.net", "funkin.backend.system.net"]) { if(!isHl) - Compiler.include(inc, ["sys.db.Sqlite", "sys.db.Mysql"]); + Compiler.include(inc, compathx4); else { // TODO: Hashlink - //Compiler.include(inc, ["sys.net.UdpSocket", "openfl.net.DatagramSocket", "sys.db.Sqlite", "sys.db.Mysql"]); // fixes FATAL ERROR : Failed to load function std@socket_set_broadcast + //Compiler.include(inc, compathx4.concat(["sys.net.UdpSocket", "openfl.net.DatagramSocket"]); // fixes FATAL ERROR : Failed to load function std@socket_set_broadcast } } } From 21bf0c0a3799f7cefdf4d849d786e997d349394a Mon Sep 17 00:00:00 2001 From: Frakits Date: Sat, 3 Aug 2024 14:28:21 +0300 Subject: [PATCH 15/25] easier to softcode healthicons --- source/funkin/game/HealthIcon.hx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source/funkin/game/HealthIcon.hx b/source/funkin/game/HealthIcon.hx index d55bf14b..92c38b8a 100644 --- a/source/funkin/game/HealthIcon.hx +++ b/source/funkin/game/HealthIcon.hx @@ -24,6 +24,11 @@ class HealthIcon extends FlxSprite */ public var healthSteps:Map = null; + /** + * current animation state + */ + public var curAnimState:Int = -1; + /** * Helper for HScript who can't make maps * @param steps Something like this: `[[0, 1], [20, 0]]` @@ -91,7 +96,14 @@ class HealthIcon extends FlxSprite i = icon; } } - if (i >= 0) animation.curAnim.curFrame = i; + if (i >= 0 && curAnimState != i) { + var event = EventManager.get(funkin.backend.scripting.events.AmountEvent).recycle(i); + funkin.backend.scripting.GlobalScript.event("onHealthIconAnimChange", event); + if (!event.cancelled) + animation.curAnim.curFrame = event.amount; + + curAnimState = event.amount; + } } } } From 67e965fbf9a5b3060bddb775951b9985885d2508 Mon Sep 17 00:00:00 2001 From: Frakits Date: Sat, 3 Aug 2024 15:04:16 +0300 Subject: [PATCH 16/25] oops --- .../scripting/events/HealthIconChangeEvent.hx | 13 +++++++++++++ source/funkin/game/HealthIcon.hx | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 source/funkin/backend/scripting/events/HealthIconChangeEvent.hx diff --git a/source/funkin/backend/scripting/events/HealthIconChangeEvent.hx b/source/funkin/backend/scripting/events/HealthIconChangeEvent.hx new file mode 100644 index 00000000..93a2a7dd --- /dev/null +++ b/source/funkin/backend/scripting/events/HealthIconChangeEvent.hx @@ -0,0 +1,13 @@ +package source.funkin.backend.scripting.events; + +final class AmountEvent extends CancellableEvent { + /** + * Amount + */ + public var amount:Int; + + /** + * The health icon + */ + public var healthIcon:HealthIcon; +} \ No newline at end of file diff --git a/source/funkin/game/HealthIcon.hx b/source/funkin/game/HealthIcon.hx index 92c38b8a..1c7bb59d 100644 --- a/source/funkin/game/HealthIcon.hx +++ b/source/funkin/game/HealthIcon.hx @@ -97,7 +97,7 @@ class HealthIcon extends FlxSprite } } if (i >= 0 && curAnimState != i) { - var event = EventManager.get(funkin.backend.scripting.events.AmountEvent).recycle(i); + var event = EventManager.get(funkin.backend.scripting.events.HealthIconChangeEvent).recycle(i, this); funkin.backend.scripting.GlobalScript.event("onHealthIconAnimChange", event); if (!event.cancelled) animation.curAnim.curFrame = event.amount; From 8b0d3c77204eeabab0886039c58af17a8e5c2a62 Mon Sep 17 00:00:00 2001 From: Frakits Date: Sat, 3 Aug 2024 15:21:45 +0300 Subject: [PATCH 17/25] oops --- .../backend/scripting/events/HealthIconChangeEvent.hx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/funkin/backend/scripting/events/HealthIconChangeEvent.hx b/source/funkin/backend/scripting/events/HealthIconChangeEvent.hx index 93a2a7dd..a98493ef 100644 --- a/source/funkin/backend/scripting/events/HealthIconChangeEvent.hx +++ b/source/funkin/backend/scripting/events/HealthIconChangeEvent.hx @@ -1,6 +1,6 @@ -package source.funkin.backend.scripting.events; +package funkin.backend.scripting.events; -final class AmountEvent extends CancellableEvent { +final class HealthIconChangeEvent extends CancellableEvent { /** * Amount */ @@ -9,5 +9,5 @@ final class AmountEvent extends CancellableEvent { /** * The health icon */ - public var healthIcon:HealthIcon; + public var healthIcon:funkin.game.HealthIcon; } \ No newline at end of file From 087959018bdb6ad39e675ef8b8a5e59ac54176d8 Mon Sep 17 00:00:00 2001 From: Frakits Date: Sat, 3 Aug 2024 15:42:43 +0300 Subject: [PATCH 18/25] oops --- source/funkin/game/HealthIcon.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/game/HealthIcon.hx b/source/funkin/game/HealthIcon.hx index 1c7bb59d..a7706a86 100644 --- a/source/funkin/game/HealthIcon.hx +++ b/source/funkin/game/HealthIcon.hx @@ -50,12 +50,12 @@ class HealthIcon extends FlxSprite public function new(char:String = 'bf', isPlayer:Bool = false) { - super(); health = 0.5; this.isPlayer = isPlayer; setIcon(char); scrollFactor.set(); + super(); } public function setIcon(char:String, width:Int = 150, height:Int = 150) { From 8a7917fce25a3c9eb57d9761cd67707c87574f12 Mon Sep 17 00:00:00 2001 From: Frakits Date: Sat, 3 Aug 2024 16:50:30 +0300 Subject: [PATCH 19/25] make my life easier --- source/funkin/game/HealthIcon.hx | 2 +- source/funkin/game/SplashHandler.hx | 5 ++++- source/funkin/game/Strum.hx | 2 ++ source/funkin/game/StrumLine.hx | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/source/funkin/game/HealthIcon.hx b/source/funkin/game/HealthIcon.hx index a7706a86..1c7bb59d 100644 --- a/source/funkin/game/HealthIcon.hx +++ b/source/funkin/game/HealthIcon.hx @@ -50,12 +50,12 @@ class HealthIcon extends FlxSprite public function new(char:String = 'bf', isPlayer:Bool = false) { + super(); health = 0.5; this.isPlayer = isPlayer; setIcon(char); scrollFactor.set(); - super(); } public function setIcon(char:String, width:Int = 150, height:Int = 150) { diff --git a/source/funkin/game/SplashHandler.hx b/source/funkin/game/SplashHandler.hx index dc6f7533..78ed86ce 100644 --- a/source/funkin/game/SplashHandler.hx +++ b/source/funkin/game/SplashHandler.hx @@ -40,7 +40,10 @@ class SplashHandler extends FlxTypedGroup { var __grp:SplashGroup; public function showSplash(name:String, strum:Strum) { __grp = getSplashGroup(name); - add(__grp.showOnStrum(strum)); + var event = funkin.backend.scripting.EventManager.get(funkin.backend.scripting.events.DynamicEvent).recycle(__grp.showOnStrum(strum), strum); + event = PlayState.instance.scripts.event("onSplashShown", event); + if (!event.cancelled) + add(__grp.showOnStrum(strum)); // max 8 rendered splashes while(members.length > 8) diff --git a/source/funkin/game/Strum.hx b/source/funkin/game/Strum.hx index 0e179f71..5a0299d8 100644 --- a/source/funkin/game/Strum.hx +++ b/source/funkin/game/Strum.hx @@ -14,6 +14,8 @@ class Strum extends FlxSprite { public var cpu = false; // Unused public var lastHit:Float = -5000; + public var strumLine = null; + public var scrollSpeed:Null = null; // custom scroll speed per strum public var noteAngle:Null = null; diff --git a/source/funkin/game/StrumLine.hx b/source/funkin/game/StrumLine.hx index d743dd79..e00e58f8 100644 --- a/source/funkin/game/StrumLine.hx +++ b/source/funkin/game/StrumLine.hx @@ -303,6 +303,7 @@ class StrumLine extends FlxTypedGroup { animPrefix = strumAnimPrefix[i % strumAnimPrefix.length]; var babyArrow:Strum = new Strum(startingPos.x + ((Note.swagWidth * strumScale) * i), startingPos.y); babyArrow.ID = i; + babyArrow.strumLine = this; if(data.scrollSpeed != null) babyArrow.scrollSpeed = data.scrollSpeed; From 82d50e50c8416e377abcd3d5276f2e69023e90f3 Mon Sep 17 00:00:00 2001 From: Frakits Date: Sat, 3 Aug 2024 16:53:38 +0300 Subject: [PATCH 20/25] PLLELASEEEEEEE --- source/funkin/game/SplashHandler.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/game/SplashHandler.hx b/source/funkin/game/SplashHandler.hx index 78ed86ce..1776bdb8 100644 --- a/source/funkin/game/SplashHandler.hx +++ b/source/funkin/game/SplashHandler.hx @@ -43,7 +43,7 @@ class SplashHandler extends FlxTypedGroup { var event = funkin.backend.scripting.EventManager.get(funkin.backend.scripting.events.DynamicEvent).recycle(__grp.showOnStrum(strum), strum); event = PlayState.instance.scripts.event("onSplashShown", event); if (!event.cancelled) - add(__grp.showOnStrum(strum)); + add(event.value1); // max 8 rendered splashes while(members.length > 8) From 6aaa9e1421230ef10eced39890fce4720ce09eac Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Mon, 5 Aug 2024 18:52:12 +0200 Subject: [PATCH 21/25] Fix bug with autoplay --- source/funkin/menus/FreeplayState.hx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/source/funkin/menus/FreeplayState.hx b/source/funkin/menus/FreeplayState.hx index 7eeef342..3d3a4d15 100644 --- a/source/funkin/menus/FreeplayState.hx +++ b/source/funkin/menus/FreeplayState.hx @@ -196,6 +196,10 @@ class FreeplayState extends MusicBeatState * Path to the currently playing song instrumental. */ public var curPlayingInst:String = null; + /** + * If it should play the song automatically. + */ + public var autoplayShouldPlay:Bool = true; #end override function update(elapsed:Float) @@ -236,7 +240,17 @@ class FreeplayState extends MusicBeatState autoplayElapsed += elapsed; if (!disableAutoPlay && !songInstPlaying && (autoplayElapsed > timeUntilAutoplay || FlxG.keys.justPressed.SPACE)) { if (curPlayingInst != (curPlayingInst = Paths.inst(songs[curSelected].name, songs[curSelected].difficulties[curDifficulty]))) { - var huh:Void->Void = function() FlxG.sound.playMusic(curPlayingInst, 0); + var huh:Void->Void = function() { + var soundPath = curPlayingInst; + var sound = null; + if (Assets.exists(soundPath, SOUND) || Assets.exists(soundPath, MUSIC)) + sound = Assets.getSound(soundPath); + else + FlxG.log.error('Could not find a Sound asset with an ID of \'$soundPath\'.'); + + if (sound != null && autoplayShouldPlay) + FlxG.sound.playMusic(sound, 0); + } if(!disableAsyncLoading) Main.execAsync(huh); else huh(); } @@ -289,6 +303,10 @@ class FreeplayState extends MusicBeatState if (event.cancelled) return; + #if PRELOAD_ALL + autoplayShouldPlay = false; + #end + Options.freeplayLastSong = songs[curSelected].name; Options.freeplayLastDifficulty = songs[curSelected].difficulties[curDifficulty]; From 363f82860d302032f39d6b352ce95937b86719ab Mon Sep 17 00:00:00 2001 From: haven <85509162+cookiesock@users.noreply.github.com> Date: Tue, 6 Aug 2024 12:01:43 -0500 Subject: [PATCH 22/25] character and stage type for events --- source/funkin/backend/chart/EventsData.hx | 4 ++++ .../funkin/editors/charter/CharterEventScreen.hx | 16 ++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/source/funkin/backend/chart/EventsData.hx b/source/funkin/backend/chart/EventsData.hx index 05f35bde..eff3fd8e 100644 --- a/source/funkin/backend/chart/EventsData.hx +++ b/source/funkin/backend/chart/EventsData.hx @@ -70,6 +70,8 @@ class EventsData { hscriptInterp.variables.set("StrumLine", TStrumLine); hscriptInterp.variables.set("ColorWheel", TColorWheel); hscriptInterp.variables.set("DropDown", Reflect.makeVarArgs((args) -> {return args.length > 0 ? TDropDown([for (arg in args) Std.string(arg)]) : TDropDown(["null"]);})); + hscriptInterp.variables.set("Character", TCharacter); + hscriptInterp.variables.set("Stage", TStage); var hscriptParser:Parser = new Parser(); hscriptParser.allowJSON = hscriptParser.allowMetadata = false; @@ -127,4 +129,6 @@ enum EventParamType { TStrumLine; TColorWheel; TDropDown(?options:Array); + TCharacter; + TStage; } diff --git a/source/funkin/editors/charter/CharterEventScreen.hx b/source/funkin/editors/charter/CharterEventScreen.hx index ec9ce660..20d84715 100644 --- a/source/funkin/editors/charter/CharterEventScreen.hx +++ b/source/funkin/editors/charter/CharterEventScreen.hx @@ -5,6 +5,8 @@ import flixel.util.FlxColor; import funkin.backend.chart.ChartData.ChartEvent; import funkin.backend.chart.EventsData; import funkin.backend.system.Conductor; +import funkin.game.Character; +import funkin.game.Stage; using StringTools; @@ -163,6 +165,20 @@ class CharterEventScreen extends UISubstateWindow { var dropdown = new UIDropDown(eventName.x, y, 320, 32, options, Std.int(Math.abs(options.indexOf(cast value)))); paramsPanel.add(dropdown); paramsFields.push(dropdown); dropdown; + case TCharacter: + addLabel(); + var charFileList = Character.getList(false); + var textBox:UIAutoCompleteTextBox = new UIAutoCompleteTextBox(eventName.x, y, cast value); + textBox.suggestItems = charFileList; + paramsPanel.add(textBox); paramsFields.push(textBox); + textBox; + case TStage: + addLabel(); + var stageFileList = Stage.getList(false); + var textBox:UIAutoCompleteTextBox = new UIAutoCompleteTextBox(eventName.x, y, cast value); + textBox.suggestItems = stageFileList; + paramsPanel.add(textBox); paramsFields.push(textBox); + textBox; default: paramsFields.push(null); null; From 3ee946fe031f8986fde2d354b0fc48102d11d7de Mon Sep 17 00:00:00 2001 From: haven <85509162+cookiesock@users.noreply.github.com> Date: Thu, 8 Aug 2024 17:28:53 -0500 Subject: [PATCH 23/25] death counter now increments lj saved codename engine from demise by reporting death counter bug --- source/funkin/game/PlayState.hx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 20e3ce7b..9bcc2ca6 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -1423,6 +1423,8 @@ class PlayState extends MusicBeatState FlxG.sound.music.stop(); for (strumLine in strumLines.members) strumLine.vocals.stop(); + deathCounter++; + openSubState(new GameOverSubstate(event.x, event.y, event.deathCharID, event.isPlayer, event.gameOverSong, event.lossSFX, event.retrySFX)); scripts.event("onPostGameOver", event); From 7885e1a4c374ebe4d6ea1a5ca7db527a499c8c00 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Sat, 10 Aug 2024 14:42:38 +0200 Subject: [PATCH 24/25] Added activityType to Discord --- .../funkin/backend/system/macros/BuildInfo.hx | 1 + source/funkin/backend/utils/DiscordUtil.hx | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/source/funkin/backend/system/macros/BuildInfo.hx b/source/funkin/backend/system/macros/BuildInfo.hx index f86d67e2..5c2afe95 100644 --- a/source/funkin/backend/system/macros/BuildInfo.hx +++ b/source/funkin/backend/system/macros/BuildInfo.hx @@ -5,6 +5,7 @@ using StringTools; #if macro class BuildInfo { public static function printBuildInfo() { + if(haxe.macro.Context.defined("display")) return; var haxeVersion = haxe.macro.Context.definedValue("haxe"); Sys.println('[ BUILD INFO ]'); Sys.println('Haxe Version: ${haxeVersion}'); diff --git a/source/funkin/backend/utils/DiscordUtil.hx b/source/funkin/backend/utils/DiscordUtil.hx index db3c20c4..1b96071b 100644 --- a/source/funkin/backend/utils/DiscordUtil.hx +++ b/source/funkin/backend/utils/DiscordUtil.hx @@ -107,14 +107,28 @@ class DiscordUtil public static function loadScript() { + #if DISCORD_RPC if (script != null) { call("destroy"); script = FlxDestroyUtil.destroy(script); } script = Script.create(Paths.script('data/discord')); + script.set("ActivityType", { + Playing: ActivityType.Playing, + PLAYING: ActivityType.Playing, + Streaming: ActivityType.Streaming, + STREAMING: ActivityType.Streaming, + Watching: ActivityType.Watching, + WATCHING: ActivityType.Watching, + Listening: ActivityType.Listening, + LISTENING: ActivityType.Listening, + Competing: ActivityType.Competing, + COMPETING: ActivityType.Competing + }); // script.setParent(DiscordUtil); script.load(); + #end } public static function changePresence(details:String, state:String, ?smallImageKey:String) @@ -218,6 +232,8 @@ class DiscordUtil Utils.safeSetWrapper(dp.joinSecret, data.joinSecret, fixString); Utils.safeSetWrapper(dp.spectateSecret, data.spectateSecret, fixString); Utils.safeSet(dp.instance, data.instance); + Utils.safeSet(dp.activityType, data.activityType); + Utils.safeSetWrapper(dp.streamUrl, data.streamUrl, fixString); if (data.matchSecret == null && data.joinSecret == null && data.spectateSecret == null) { Utils.safeSetWrapper(dp.button1Label, data.button1Label, fixString); @@ -476,6 +492,8 @@ typedef DPresence = var ?button1Url:String; /* max 512 bytes */ var ?button2Label:String; /* max 32 bytes */ var ?button2Url:String; /* max 512 bytes */ + var ?activityType:ActivityType; + var ?streamUrl:String; /* max 512 bytes */ } typedef DEvents = From 9504af3ae6e0d5bf5f1f7e46ecd272a46d39e8de Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Sat, 10 Aug 2024 16:01:32 +0200 Subject: [PATCH 25/25] Allow more custom stuffs --- .../funkin/backend/scripting/GlobalScript.hx | 4 +++ source/funkin/backend/utils/DiscordUtil.hx | 33 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/source/funkin/backend/scripting/GlobalScript.hx b/source/funkin/backend/scripting/GlobalScript.hx index d2d9323f..1ca88772 100644 --- a/source/funkin/backend/scripting/GlobalScript.hx +++ b/source/funkin/backend/scripting/GlobalScript.hx @@ -11,7 +11,11 @@ import funkin.backend.system.Conductor; class GlobalScript { public static var scripts:ScriptPack; + private static var initalized:Bool = false; + public static function init() { + if(initalized) return; + initalized = true; #if MOD_SUPPORT ModsFolder.onModSwitch.add(onModSwitch); #end diff --git a/source/funkin/backend/utils/DiscordUtil.hx b/source/funkin/backend/utils/DiscordUtil.hx index 1b96071b..0ea8e5b3 100644 --- a/source/funkin/backend/utils/DiscordUtil.hx +++ b/source/funkin/backend/utils/DiscordUtil.hx @@ -1,5 +1,6 @@ package funkin.backend.utils; +import flixel.util.FlxSignal.FlxTypedSignal; import flixel.sound.FlxSound; import flixel.util.typeLimit.OneOfTwo; import funkin.backend.scripting.*; // lazy @@ -268,6 +269,7 @@ class DiscordUtil handlers.joinGame = cpp.Function.fromStaticFunction(onJoin); handlers.joinRequest = cpp.Function.fromStaticFunction(onJoinReq); handlers.spectateGame = cpp.Function.fromStaticFunction(onSpectate); + handlers.anyResponse = cpp.Function.fromStaticFunction(onAnyResponse); Discord.Initialize(id, cpp.RawPointer.addressOf(handlers), 1, null); stopThread = false; @@ -367,7 +369,38 @@ class DiscordUtil var req:DUser = DUser.initRaw(request); call("onJoinRequest", [req]); } + + public static var anyResponse:FlxTypedSignalVoid> = new FlxTypedSignalVoid>(); + + private static function onAnyResponse(data:cpp.ConstCharStar):Void + { + call("onAnyResponse", [data]); + anyResponse.dispatch(data); + } #end + + private static function getUUID():String { + var uuid = new StringBuf(); + for (i in 0...16) { + uuid.add(StringTools.hex(Math.floor(Math.random() * 16), 1)); + } + return uuid.toString(); + } + + public static function sendCustomCommand(data:Dynamic) { + #if DISCORD_RPC + if(data == null) return; + if(data.nonce == null) data.nonce = getUUID(); + var json = Json.stringify(data); + Discord.SendCustomCommand(json); + #end + } + + public static function setDebugMode(mode:Bool) { + #if DISCORD_RPC + Discord.SetDebugMode(mode); + #end + } } typedef DiscordJson =