diff --git a/assets/images/dumb/Isabelle_AF.png b/assets/images/dumb/Isabelle_AF.png new file mode 100644 index 00000000..afe0cc89 Binary files /dev/null and b/assets/images/dumb/Isabelle_AF.png differ diff --git a/cne.BAT b/cne.BAT new file mode 100644 index 00000000..67f6f988 --- /dev/null +++ b/cne.BAT @@ -0,0 +1 @@ +@haxe -cp commandline -D analyzer-optimize --run Main %* \ No newline at end of file diff --git a/commandline/Main.hx b/commandline/Main.hx new file mode 100644 index 00000000..4efd742d --- /dev/null +++ b/commandline/Main.hx @@ -0,0 +1,113 @@ +package; + +import commands.*; + +class Main { + public static var commands:Array = []; + + public static function initCommands() { + commands = [ + { + names: ["setup"], + doc: "Setups (or updates) all libraries required for the engine.", + func: Update.main, + dDoc: "This command runs through all libraries in libs.xml, and install them.\nIf they're already installed, they will be updated." + }, + { + names: ["help", null], + doc: "Shows help. Pass a command name to get additional help.", + func: help, + dDoc: "Usage: help \n\nFor example, use \"cne help test\" to get additional help on the test command." + }, + { + names: ["test"], + doc: "Creates a non final test build, then runs it.", + func: Compiler.test, + dDoc: "Usage: test \n" + + "\nThis will create a quick debug build binded to the source then run it, which means:" + + "\n- The assets WON'T be copied over - Assets will be read from the game's source." + + "\n- This build WON'T be ready for release - Running anywhere else than in the bin folder will result in a crash from missing assets" + + "\n- This build will also use the mods folder from the source directory." + + "\n\nIf you want a full build which contains all assets, run \"cne release\" or \"cne test-release\"" + + "\nAdditional arguments will be sent to the lime compiler." + }, + { + names: ["build"], + doc: "Creates a non final test build, without running it.", + func: Compiler.build, + dDoc: "Usage: build \n" + + "\nThis will create a quick debug build binded to the source then run it, which means:" + + "\n- The assets WON'T be copied over - Assets will be read from the game's source." + + "\n- This build WON'T be ready for release - Running anywhere else than in the bin folder will result in a crash from missing assets" + + "\n- This build will also use the mods folder from the source directory." + + "\n\nIf you want a full build which contains all assets, run \"cne release\" or \"cne test-release\"" + + "\nAdditional arguments will be sent to the lime compiler." + }, + { + names: ["release"], + doc: "Creates a final non debug build, containing all assets.", + func: Compiler.release, + dDoc: "Usage: release \n" + + "\nThis will create a final ready-for-release build, which means this build will be able to be release on websites such as GameBanana without worrying about source-dependant stuff." + }, + { + names: ["test-release"], + doc: "Creates a final non debug build, containing all assets.", + func: Compiler.testRelease, + dDoc: "Usage: release \n" + + "\nThis will create and run a final ready-for-release build, which means this build will be able to be release on websites such as GameBanana without worrying about source-dependant stuff." + } + ]; + } + + public static function main() { + initCommands(); + var args = Sys.args(); + var commandName = args.shift(); + if (commandName != null) + commandName = commandName.toLowerCase(); + for(c in commands) { + if (c.names.contains(commandName)) { + c.func(args); + return; + } + } + } + + public static function help(args:Array) { + var cmdName = args.shift(); + if (cmdName != null) { + cmdName = cmdName.toLowerCase(); + + var matchingCommand = null; + for(c in commands) if (c.names.contains(cmdName)) { + matchingCommand = c; + break; + } + + if (matchingCommand == null) { + Sys.println('help - Command named ${cmdName} not found.'); + return; + } + + Sys.println('${matchingCommand.names.join(", ")}'); + Sys.println("---"); + Sys.println(matchingCommand.dDoc); + + return; + } + // shows help + Sys.println("Codename Engine Command Line utility"); + Sys.println('Available commands (${commands.length}):\n'); + for(line in commands) { + Sys.println('${line.names.join(", ")} - ${line.doc}'); + } + } +} + +typedef Command = { + var names:Array; + var func:Array->Void; + var ?doc:String; + var ?dDoc:String; +} \ No newline at end of file diff --git a/commandline/commands/Compiler.hx b/commandline/commands/Compiler.hx new file mode 100644 index 00000000..24ace428 --- /dev/null +++ b/commandline/commands/Compiler.hx @@ -0,0 +1,35 @@ +package commands; + +class Compiler { + public static function test(args:Array) { + __build(args, ["test", getBuildTarget(), "-D", "TEST_BUILD"]); + } + public static function build(args:Array) { + __build(args, ["build", "windows", "-D", "TEST_BUILD"]); + } + public static function release(args:Array) { + __build(args, ["build", "windows"]); + } + public static function testRelease(args:Array) { + __build(args, ["test", "windows"]); + } + + private static function __build(args:Array, arg:Array) { + for(a in args) + arg.push(a); + Sys.command("lime", arg); + } + + private static function getBuildTarget() { + return switch(Sys.systemName()) { + case "Windows": + "windows"; + case "Mac": + "macos"; + case "Linux": + "linux"; + case def: + def.toLowerCase(); + } + } +} \ No newline at end of file diff --git a/update/Update.hx b/commandline/commands/Update.hx similarity index 97% rename from update/Update.hx rename to commandline/commands/Update.hx index 9a9bb15b..42c29a61 100644 --- a/update/Update.hx +++ b/commandline/commands/Update.hx @@ -1,10 +1,12 @@ +package commands; + import haxe.Json; import sys.io.File; import sys.io.Process; import sys.FileSystem; class Update { - public static function main() { + public static function main(args:Array) { // to prevent messing with currently installed libs if (!FileSystem.exists('.haxelib')) FileSystem.createDirectory('.haxelib'); diff --git a/project.xml b/project.xml index e10c0636..6fbbd258 100644 --- a/project.xml +++ b/project.xml @@ -57,11 +57,14 @@ + - - +
+ + +
@@ -132,9 +135,6 @@ - - - diff --git a/source/funkin/backend/system/Main.hx b/source/funkin/backend/system/Main.hx index 50cfbf3f..f932180e 100644 --- a/source/funkin/backend/system/Main.hx +++ b/source/funkin/backend/system/Main.hx @@ -83,7 +83,7 @@ class Main extends Sprite #else "" #end; - public static var startedFromSource:Bool = false; + public static var startedFromSource:Bool = #if TEST_BUILD true #else false #end; private static var __threadCycle:Int = 0; @@ -123,26 +123,14 @@ class Main extends Sprite funkin.backend.scripting.GlobalScript.init(); #end - #if sys - if (startedFromSource = Sys.args().contains("-livereload")) { - #if USE_SOURCE_ASSETS - #if windows - trace("Used lime test windows. Switching into source assets."); - #elseif mac - trace("Used lime test mac. Switching into source assets."); - #elseif linux - trace("Used lime test linux. Switching into source assets."); - #end + #if (sys && TEST_BUILD) + trace("Used cne test / cne build. Switching into source assets."); #if MOD_SUPPORT - ModsFolder.modsPath = './${pathBack}mods/'; + ModsFolder.modsPath = './${pathBack}mods/'; #end Paths.assetsTree.__defaultLibraries.push(ModsFolder.loadLibraryFromFolder('assets', './${pathBack}assets/', true)); - #end - } else { - #if USE_ADAPTED_ASSETS + #elseif USE_ADAPTED_ASSETS Paths.assetsTree.__defaultLibraries.push(ModsFolder.loadLibraryFromFolder('assets', './assets/', true)); - #end - } #end diff --git a/update.bat b/update.bat index 243553c5..57ac178e 100644 --- a/update.bat +++ b/update.bat @@ -1 +1 @@ -@haxe -cp update -D analyzer-optimize -main Update --interp \ No newline at end of file +@haxe -cp commandline -D analyzer-optimize --run Main setup \ No newline at end of file