Skip to content

Commit 9e3a076

Browse files
committed
Update documentation and README and improve library management; remove the crash analyzer, etc.
1 parent 36d56c3 commit 9e3a076

9 files changed

Lines changed: 75 additions & 250 deletions

File tree

README.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,16 @@ This is inspired by an attempt by the [RetroNX Team](https://github.com/retronx-
1313

1414
---------
1515

16-
**Officially** there are supported libraries to be used in conjunction with HaxeNXCompiler:
16+
**Officially** there are supported libraries or utilities to be used in conjunction with HaxeNXCompiler:
1717

1818
- [hx_libnx](https://github.com/Slushi-Github/hx_libnx): Haxe/hxcpp ``@:native`` bindings for libnx, the Nintendo Switch's homebrew library.
1919

20-
- SDL2 (And SDL2_Image, SDL2_Mixer): Haxe/hxcpp ``@:native`` bindings for SDL 2.28 libraries (PRIVATE LIBRARY).
20+
- [Vupx Engine](https://slushi-github.github.io/Vupx-Engine/): A framework engine 2D and 3D built with Haxe, SDL2 and OpenGL 4.3 that can be used to make games for the Nintendo Switch.
2121

22-
- OpenGL 4.3 ES: Haxe/hxcpp ``@:native`` bindings for the OpenGL 4.3 ES, a 3D graphics library (PRIVATE LIBRARY).
22+
- [Lime-NX](https://github.com/Slushi-Github/lime-nx): Use Lime projects such as OpenFL and even HaxeFlixel on the Nintendo Switch!!! (HaxeNXCompiler comes integrated with Lime-NX, so you don't really need this program to use Lime-NX.) (This is the limit of HaxeNXCompiler).
23+
* [Switch Funkin'](https://gamebanana.com/tools/21807): Psych Engine 1.0.4 on the Nintendo Switch, enjoy the real experience of Friday Night Funkin' on your console!
2324

24-
- libVorbis: Haxe/hxcpp ``@:native`` bindings for libvorbis, a decoder for the OGG Vorbis audio format (PRIVATE LIBRARY).
25-
26-
- OpenAL Soft: Haxe/hxcpp ``@:native`` bindings for OpenAL Soft, a 3D audio library (PRIVATE LIBRARY AND NOT FINISHED).
27-
28-
- FontStash: Haxe/hxcpp ``@:native`` bindings for FontStash, a font rendering library compatible with OpenGL and OpenGL ES (PRIVATE LIBRARY AND NOT FINISHED).
29-
30-
The term *"**officially**"* does not mean that only these libraries will work with this tool; they are simply the libraries that I have created specifically for this project and for the Nintendo Switch. However, you can try any libraries you want that are in [Haxelib](https://lib.haxe.org)! (with certain limitations; remember that this is a separate target from the normal ones and is experimental; libraries that depend on C++ libraries will generally not work without changes. And no, don't try to use HaxeFlixel on this target... for now?).
25+
The term *"**officially**"* does not mean that only these libraries will work with this tool; they are simply the libraries that I have created specifically for this project and for the Nintendo Switch. However, you can try any libraries you want that are in [Haxelib](https://lib.haxe.org)! (with certain limitations; remember that this is a separate target from the normal ones and is experimental; libraries that depend on C++ libraries will generally not work without changes).
3126

3227
## How is this possible?
3328

assets/CommandsInfo

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,14 @@ Commands:
1111
Compiles the project from Haxe/C++ to Nintendo Switch.
1212
Add "--debug" to the command to enable Haxe debug mode.
1313
Add "--clean" to the command to clean the project before compiling.
14-
Add "--send" to the command to send the .nro file to the Nintendo Switch after compilation only if compilation is successful (this starts a nxlink server directly on the port \033[3m28771\033[0m), alternative to set the "sendaftercompile" parameter to true in the project XML file.
14+
Add "--send" to the command to send the .nro file to the Nintendo Switch after compilation only if compilation is successful (this starts a nxlink server directly on the port 28771), alternative to set the "sendaftercompile" parameter to true in the project XML file.
1515

1616
--searchProblem, -sp [LineAddress]
1717
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.
1818

1919
--send, -s
2020
Sends the .nro file to the Nintendo Switch using DevKitPro's nxlink program.
21-
Add "--server" or "-s" to the command to start the nxlink server (on the port \033[3m28771\033[0m), you should define "ENABLE_NXLINK" as C define (with cflag in the project XML file for example).
22-
23-
--crashAnalyzer, -ca
24-
Analyzes the crash log from a .nro file (VERY EXPERIMENTAL).
21+
Add "--server" or "-s" to the command to start the nxlink server (on the port 28771), you should define "ENABLE_NXLINK" as C define (with cflag in the project XML file for example).
2522

2623
--version, -v
2724
Shows the version of the compiler.

assets/WrapperCPP

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <switch.h>
55

66
#include <cstdio>
7+
#include <unistd.h>
78

89
#include <stdio.h>
910
#include <stdlib.h>
@@ -21,6 +22,14 @@ extern char **_hxcpp_argv;
2122

2223
int main(int argc, char **argv)
2324
{
25+
// We need to initialize the socket even if we're not going to use it with nxlink
26+
// Haxe needs to be able to handle their own sockets, if we don't do this it will crash
27+
Result result = socketInitializeDefault();
28+
if (R_FAILED(result))
29+
{
30+
printf("[wrapper.cpp -> socketInitializeDefault()] ERROR: Failed to initialize default socket: %08X\n", result);
31+
}
32+
2433
_hxcpp_argc = argc;
2534
_hxcpp_argv = argv;
2635

@@ -66,9 +75,12 @@ int main(int argc, char **argv)
6675
consoleUpdate(NULL);
6776
}
6877
consoleExit(NULL);
78+
socketExit();
6979
return -1;
7080
}
7181

82+
socketExit();
83+
7284
printf("HaxeNXCompiler v%s -- Project: %s\nProgram Finished!\n\n",
7385
HAXENXCOMPILER_VERSION,
7486
HAXENXCOMPILER_SWITCH_PROJECTNAME);

docs/guides/GetStarted.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,5 @@ More help information:
143143

144144
- [About assets](./AssetsGuide.md)
145145
- [About libraries](./LibrariesGuide.md)
146+
- [Other things](./Other.md)
146147
- [Program Commands](/assets/CommandsInfo) (This is directly from the file used by the already compiled tool.)

docs/guides/LibrariesGuide.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ If HaxeNXCompiler cannot find the file, it will only import the library as a nor
3838

3939
---------
4040

41-
- [About assets](./AssetsGuide.md)
41+
- [About assets](./AssetsGuide.md)
42+
- [Other things](./Other.md)

docs/guides/Other.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## NXLink
2+
3+
For use the nxlink server, first you need to compile your project with the define ``ENABLE_NXLINK`` as C define:
4+
5+
```xml
6+
<cdef name="ENABLE_NXLINK"/>
7+
```
8+
9+
then you can use the ``--send --server`` (or ``-s -s``) command to send the ``.nro`` file to the Nintendo Switch with the server started.
10+
11+
Now you need to start the nxlink client on your program:
12+
13+
```haxe
14+
// import the nxlink class from hx_libnx
15+
import switchLib.runtime.Nxlink;
16+
17+
// Initialize nxlink
18+
if (Nxlink.nxlinkStdio() < 0) {
19+
Sys.println("Failed to redirect logs to NXLink! Maybe it's not running or not required?");
20+
}
21+
```
22+
23+
And that's it! your logs now will be sent to the nxlink server and you can see them on the terminal.

source/Main.hx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Main {
1212
/**
1313
* The version of the program
1414
*/
15-
public static final VERSION:String = "3.0.0";
15+
public static final VERSION:String = "3.1.0";
1616

1717
/**
1818
* The name of the program colored with ANSI escape codes
@@ -63,8 +63,8 @@ class Main {
6363
MainCompiler.startCompiler(secondArg, thirdArg);
6464
case "--send" | "-s":
6565
DevKitProUtils.send(secondArg);
66-
case "--crashAnalyzer" | "-ca":
67-
CrashAnalyzer.initWithFile();
66+
case "searchProblem" | "-sp":
67+
DevKitProUtils.searchProblem(secondArg);
6868
case "--help" | "-h":
6969
Logger.log(commandsInfo, NONE);
7070
case "--version" | "-v":

source/managers/LibsManager.hx

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,39 @@ package source.managers;
88
* The HxNXLibJSONStruct is used to store the JSON data of a HxNX library.
99
*/
1010
typedef HxNXLibJSONStruct = {
11+
/**
12+
* Version of the library
13+
*/
1114
libVersion:String,
12-
// Haxe things
15+
16+
/**
17+
* Haxe libraries
18+
*/
1319
haxeLibs:Array<String>,
14-
// Nintendo Switch things
20+
21+
/**
22+
* Switch libraries
23+
*/
1524
switchLibs:Array<String>,
16-
// Other things
25+
26+
/**
27+
* Main defines for Haxe and C/C++
28+
*/
1729
mainDefines:Array<String>,
18-
// Haxe things
30+
31+
/**
32+
* Haxe defines
33+
*/
1934
hxDefines:Array<String>,
20-
// MakeFile things
35+
36+
/**
37+
* C defines for the MakeFile
38+
*/
2139
cDefines:Array<String>,
40+
41+
/**
42+
* C++ defines for the MakeFile
43+
*/
2244
cppDefines:Array<String>
2345
}
2446

0 commit comments

Comments
 (0)