diff --git a/README.md b/README.md index 8a7983f..65bf40e 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ This is the working structure of the 9p filesystem: * `/slot`: After loading the cartridge, its ROM is read from here; Read-only. -* `/data/`: Any supporting data that comes with the cartridge will be found here; They are in three parts: `sprite`, `audio`, and `text`. Because `uxn` is limited to 64-128kb input files, the filesizes of these data blobs should be 64kb max, and the `chunk` command should be used to page different files into the service when needed. The files on the server should be like `TYPEN` where `TYPE` is one of `sprite`, `audio`, and `text`, and `N` is any sequence of characters (canonically a nonnegative integer). When first loading the cartridge, `N == 0`. Issuing the command `chunk TYPE XXX` will attempt to load data from file `carts/CART_NAME/data/TYPEXXX` into the correct data file. If `TYPE` is not one of `sprite`, `audio`, or `text`, or the ifle `TYPEXXX` doesn't exist in the data directory, the `chunk` command does nothing. +* `/data/`: Any supporting data that comes with the cartridge will be found here; They are in three parts: `sprite`, `audio`, and `text`. While `uxn` has the ability to seek through a file up to 4GB in size, it can be beneficial to separate game assets into discrete files. The `chunk` command should be used to page different files into the service when needed. The files on the server should be like `TYPEN` where `TYPE` is one of `sprite`, `audio`, and `text`, and `N` is any sequence of characters (canonically a nonnegative integer). When first loading the cartridge, `N == 0`. Issuing the command `chunk TYPE XXX` will attempt to load data from file `carts/CART_NAME/data/TYPEXXX` into the correct data file. If `TYPE` is not one of `sprite`, `audio`, or `text`, or the file `TYPEXXX` doesn't exist in the data directory, the `chunk` command does nothing. * `/realms`: Open/saved realms, read-only. Realms and their associated universe are backed by real files on the server so that they can be preserved across service instantiations, in a directory structure like: `carts/CART_NAME/realms/REALM_NAME/{realm, universe}`. Realms can either be solo, open, or protected; Open or protected realms can have limited member numbers. Depending on the cartridge, these settings can be user-managed or managed by the cartridge itself. Realms are listed per line upon reading the file like: `REALM_NAME 1 4 1`. First would obviously be the name of the realm. The first number is number of members, second is member limit, third is 1 if protected, 0 if not. `0 1 1` represents a protected solo realm that is empty (saved game with password). `0 1 0` represents an unprotected solo realm that is empty (saved game with no password). @@ -78,7 +78,7 @@ or expose a service on the network (uses `9pserve` to support multiple users and ./xrxs-srv.sh start ``` -Add the `-d` option to the above command to enable 9p debugging output. +Add the `-d` option to the above command to enable 9p debugging output. The default port is `5460` but can be changed by setting the `XRXS_PORT` environment variable. Similarly, you can stop the service with: @@ -103,6 +103,6 @@ You can run `./build.sh` with no options to build the normal `xrxs` client, or w * `-l`: build the standalone bootloader * `-lr`: build the standalone bootloader and run it -When the client ROM has been built, run `./uxn-xrxs.sh` to mount the `9p` service and run the client. +When the client ROM has been built, run `./uxn-xrxs.sh` to mount the `9p` service and run the client. As with the server, the default port is `5460` but can be overridden with the `XRXS_PORT` environment variable. The default server address is `127.0.0.1` but can be similarly changed by setting the `XRXS_ADDR` environment variable. The scripts assume you have `uxnasm` and `uxnemu` in your `PATH`. `9pfuse` is used to mount the service, but other implementations could possibly be used. diff --git a/server/xrxs-srv.sh b/server/xrxs-srv.sh index 152e73d..96d84bd 100755 --- a/server/xrxs-srv.sh +++ b/server/xrxs-srv.sh @@ -1,6 +1,8 @@ #!/bin/sh -PORT=5460 +if [ -z "${XRXS_PORT}" ]; then + XRXS_PORT=5460 +else if [ -z "${DISPLAY}" ]; then export DISPLAY=:0 @@ -16,7 +18,7 @@ case $1 in debug="-d" fi ./xrxs -s xrxs ${debug} & sleep 1 - 9pserve -c unix!/tmp/ns.$(whoami).${seat}/xrxs tcp!0.0.0.0!${PORT} & + 9pserve -c unix!/tmp/ns.$(whoami).${seat}/xrxs tcp!0.0.0.0!${XRXS_PORT} & ;; stop) killall xrxs diff --git a/server/xrxs.c b/server/xrxs.c index 1bb42bc..1572a94 100644 --- a/server/xrxs.c +++ b/server/xrxs.c @@ -17,7 +17,7 @@ #include "realm.h" #include "user.h" -char version[] = "0.2"; +char version[] = "0.3"; int chatty9p = 0; diff --git a/uxn-client/uxn-xrxs.sh b/uxn-client/uxn-xrxs.sh index 64eb76c..0f04d47 100755 --- a/uxn-client/uxn-xrxs.sh +++ b/uxn-client/uxn-xrxs.sh @@ -1,14 +1,18 @@ #!/bin/sh -ADDR=209.141.55.64 -PORT=5460 +if [ -z "${XRXS_ADDR}" ]; then + XRXS_ADDR=127.0.0.1 +fi +if [ -z "${XRXS_PORT}" ]; then + XRXS_PORT=5460 +fi if [ ! -d ./n ]; then mkdir ./n fi # start the 9p client and wait for it to initialize -9pfuse "tcp!${ADDR}!${PORT}" ./n & sleep 1 +9pfuse "tcp!${XRXS_ADDR}!${XRXS_PORT}" ./n & sleep 1 #run the xrxs client uxnemu ./xrxs.rom