You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-1Lines changed: 16 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,14 +7,21 @@ Using this utility (Inspired by [HxCompileU](https://github.com/Slushi-Github/hx
7
7
8
8
This is inspired by an attempt by the [RetroNX Team](https://github.com/retronx-team) to use Haxe on the Nintendo Switch. I used part of the [original project](https://github.com/retronx-team/switch-haxe) for this, so credit goes to them for achieving this in the first place!
9
9
10
-
**This project is being tested with Haxe 4.3.7 and a Nintendo Switch V2 with firmware 20.4.0 (AMS 1.9.4).**
10
+
**This project is being tested with Haxe 4.3.6 and a Nintendo Switch V2 with firmware 20.4.0 and Atmosphère 1.9.5.**
11
11
12
12
Officially there are supported libraries to be used in conjunction with HaxeNXCompiler:
13
13
14
14
-[hx_libnx](https://github.com/Slushi-Github/hx_libnx): Haxe/hxcpp @:native bindings for libnx, the Nintendo Switch's homebrew library.
15
15
16
16
-----
17
17
18
+
## Current problems:
19
+
20
+
- Apparently there is no full support for `sys.net.Socket`.
21
+
- Critical issue related to hxcpp and its garbage collector when the program ends, causing Atmosphère to crash sometimes.
22
+
23
+
-----
24
+
18
25
## How?
19
26
20
27
Well... Unlike the Wii U, where using hxcpp causes many problems, and to achieve that I had to use [Reflaxe/C++ (Amazing library!)](https://github.com/SomeRanDev/reflaxe.CPP) to be able to use Haxe on that console. With the Nintendo Switch, hxcpp compiles perfectly!
@@ -102,6 +109,14 @@ After that, you will get your executable ``HaxeNXCompiler`` in the "export" fold
102
109
103
110
-----
104
111
112
+
#### You can get errors from a log file using the following command:
113
+
114
+
``{haxeNXCompilerProgram} --crashAnalyzer`` or ``{haxeNXCompilerProgram} --ca``
115
+
116
+
**THIS IS TOO EXPERIMENTAL!**
117
+
118
+
-----
119
+
105
120
and that's it! if your compilation was successful on both Haxe and Nintendo Switch side, your ``.nro``, ``.ncap`` and ``.elf`` files will be in ``yourOutputFolder/switchFiles``.
publicstaticvarhaxenxcompilerString="\x1b[38;5;214mHaxe\033[0m\x1b[38;5;81mN\x1b[38;5;1mX\033[0mCompiler (Based on \x1b[38;5;214mHx\033[0mCompile\x1b[38;5;74mU\033[0m)";
27
-
publicstaticfinalversion:String="2.0.0";
27
+
publicstaticfinalhaxenxcompilerString="\x1b[38;5;214mHaxe\033[0m\x1b[38;5;81mN\x1b[38;5;1mX\033[0mCompiler (Based on \x1b[38;5;214mHx\033[0mCompile\x1b[38;5;74mU\033[0m)";
28
+
publicstaticfinalversion:String="2.1.0";
28
29
staticvarstdin=Sys.stdin();
29
30
staticvarstdout=Sys.stdout();
30
31
staticvarargs=Sys.args();
@@ -40,23 +41,26 @@ class Main {
40
41
SlushiUtils.printMsg('$haxenxcompilerString v$version -- Created by \033[96mSlushi\033[0m', NONE);
41
42
}
42
43
43
-
if (JsonFile.checkJson() ==false) {
44
-
return;
44
+
if (args[0] !="--import"&&args[0] !="--i"&&args[0] !="--prepare"&&args[0] !="--p") {
45
+
// if (!JsonFile.checkJson())
46
+
return;
45
47
}
46
48
47
49
switch (args[0]) {
48
50
case"--prepare" | "--p":
49
-
JsonFile.createJson();
51
+
SlushiUtils.prepareProject(false, "");
50
52
case"--import" | "--i":
51
-
JsonFile.importJSON(args[1]);
53
+
SlushiUtils.prepareProject(true, args[1]);
52
54
case"--compile" | "--c":
53
55
MainCompiler.start(args[1], args[2]);
54
56
case"--searchProblem" | "--sp":
55
57
DevKitProUtils.searchProblem(args[1]);
58
+
case"--crashAnalyzer" | "--ca":
59
+
CrashAnalyzer.initWithFile();
56
60
case"--send" | "--s":
57
61
DevKitProUtils.send(args[1]);
58
62
case"--help" | "--h":
59
-
SlushiUtils.printMsg("Usage: HaxeNXCompiler [command]\nCommands:\n\t--prepare, --p: Creates a new haxeNXConfig.json in the current directory.\n\t--import, --i \033[3mHAXE_LIB\033[0m: Imports a JSON file from a Haxe lib to the current directory \n\t--compile, --c: Compiles the project. \n\t\tAdd \"--debug\" to enable Haxe debug mode \n\t--searchProblem, --sp \033[3mLINE_ADDRESS\033[0m: search for a line of code in the [.elf] file from a line address of some log using devkitA64's aarch64-none-elf-addr2line program \n\t--send, --s: Sends the .nro file to the Nintendo Switch using DevKitPro's nxlink program \n\t\tAdd \"--server\" or \"--s\" to start the a cosnole server via nxlink\n\t--version, --v: Shows the version of the compiler\n\t--help, --h: Shows this message",
63
+
SlushiUtils.printMsg("Usage: HaxeNXCompiler [command]\nCommands:\n\t--prepare, --p: Creates a new haxeNXConfig.json in the current directory.\n\t--import, --i \033[3mHAXE_LIB\033[0m: Imports a JSON file from a Haxe lib to the current directory \n\t--compile, --c: Compiles the project. \n\t\tAdd \"--debug\" to enable Haxe debug mode \n\t--searchProblem, --sp \033[3mLINE_ADDRESS\033[0m: search for a line of code in the [.elf] file from a line address of some log using devkitA64's aarch64-none-elf-addr2line program \n\t--send, --s: Sends the .nro file to the Nintendo Switch using DevKitPro's nxlink program \n\t\tAdd \"--server\" or \"--s\" to start the a cosnole server via DevKitPro's nxlink program\n\t--version, --v: Shows the version of the compiler\n\t--help, --h: Shows this message",
60
64
NONE);
61
65
default:
62
66
SlushiUtils.printMsg("Invalid argument: ["+args.join("") +"], use \033[3m--help\033[0m argument for more information", NONE);
SlushiUtils.printMsg("DevkitA64 not found", ERROR);
147
+
fail=true;
148
+
}
149
+
150
+
if (fail) {
151
+
SlushiUtils.printMsg("Failed to prepare project. Can't find DevKitPro or DevKitA64, please install them (Or add them to your PATH) and try again:\n\thttps://devkitpro.org/wiki/devkitPro_pacman", NONE);
SlushiUtils.printMsg("projectName in [haxeNXConfig.json -> switchConfig.projectName] is empty", ERROR);
44
66
exitCodeNum=3;
45
67
return;
46
68
}
47
69
70
+
maxJobs=jsonFile.makeFileMaxJobs??2;
71
+
if (maxJobs<=0) {
72
+
maxJobs=2;
73
+
}
74
+
48
75
SlushiUtils.printMsg("Trying to compile to a \x1b[38;5;1mNintendo Switch\033[0m project -> \x1b[38;5;110m["+jsonFile.switchConfig.projectName+"]\033[0m...", PROCESSING);
0 commit comments