This guide assumes you are already familliar with setting up RetroArch with libtransistor.
Clone the fs-net
branch from https://github.com/davidbuchanan314/libtransistor:
git clone https://github.com/davidbuchanan314/libtransistor --recursive -b fs-net
Build libtransistor as usual.
A few minor patches need to be added to RetroArch to make things work smoothly. Add the following lines to the start of the rarch_main
function in frontend/frontend.c
:
int r;
if((r = sm_init()) != RESULT_OK) {
printf("failed to init sm: 0x%x\n", r);
return -1;
}
if((r = bsd_init()) != RESULT_OK) {
printf("failed to init bsd: 0x%x, %d\n", r, bsd_errno);
return -1;
}
char server_ip_addr[4] = {192, 168, 0, 36};
if((r = fsnet_init(*(uint32_t*) server_ip_addr, 1337)) != RESULT_OK) {
printf("failed to init fsnet: 0x%x\n", r);
return -1;
}
You also need to add #include<libtransistor/nx.h>
to the top of that file.
The value of server_ip_addr
needs to be replaced with the IP address you will be running the file server from. In this example, my server is at 192.168.0.36
. Note that port 1337
is used for FS communications, so you need to ensure that this is not filtered by your firewall.
In addition, you may need to patch the function retro_dirent_is_dir
in libretro-common/file/retro_dirent.c
to read as follows:
bool retro_dirent_is_dir(struct RDIR *rdir, const char *path)
{
return false;
}
This is needed because I haven't implemented the stat
syscall yet. You also need to remove all references to squashfs from the retroarch Makefile.switch
file. This is what my makefile looks like: https://gist.github.com/DavidBuchanan314/e23d184862e0eba134a0dbfcc9d8652e
For some reason, it seems that a lot of cores don't actually write save changes until you exit to the RetroArch menu. If you apply this change, you can exit to the retroarch menu by pressing start+select: https://github.com/lubosz/RetroArch/commit/7be52de7cfeeef04da8f51925e039a377cfd40fa
The server script is located at tools/fsnet.py
in libtransistor. Run it with python3. By default, it reads files from the /tmp/fs/
directory (Run mkdir /tmp/fs
to create this), so if you need to edit the python script if you want it somewhere else. All file operations are logged to the terminal the script is running from.
Important Note: Only run the server script on a trusted network, since it allows full access to your filesystem.
Launch retroarch as normal, and everything should just work!
If you want to report an issue, please include the relevant logs from the python server script, and from nc -lvp 2991
.
If you are getting build errors, make sure you have deleted any residual files from previous builds. For some reason I had to use find -name "*.o" -exec rm {} \;
to get RetroArch to build again.