all repos — xrxs @ 6864b143f2a3c787f982bd882902bc37d70b7984

experimental networked application/game server with 9p

use environment to set addr and port in wrappers
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmImXaUACgkQO3+8IhRO
Y5hFshAAgdC/sXPl3t3gl1FUocY1CwWuav8h1SMjc6K6bkFO9RSZYMz3YL/JLfPM
R0KyPgBzG296wrLW0I9DIq5HnMCpK3slBXJa8L61TtQUfNPmXC1RUtb8M/eO+QA+
GuMpifZvKQMLKGJW/6CUBwBlUovIcDzN3ryHPvBzyK1MGzLLJXQEVru/9+vUe3Cz
j6fZTxVII/C1rviYd4vV/yhBDIGLLPfvhKVT/VP5dT9pxQ8eCjY8pBmUknlZX+Do
XIAwJ4AQZzCG0KrqoAt8eGDfEKC9ZTwZr8+WW79bU2Sbts9An5i0wvHv92TefR1A
tzmXgg4/wFxMkwvTVxTjU62dwbEiaMRHSInPRsHr0CPXZszjOZj2Wc5TF9STQRQv
HkccX4Ltdr17vow6+kQhezMthe7JW4Ui5jjLd2YwjYZ2MlNICjSRYBJPgNEr0WPQ
//DsksXHEb9Ol49i6giyzZQW6g67GCx+shSwsUMQhdssvaYA+BZcg/Eru+jmhciG
NURpgCrBDZWBul5ROObEDegxA4ZChVL3cz7pcGaR7qIPfhoYN1/AJsSoOhorQ8FM
mjK/El1t9+kPtdjHMJ+7TTixY+vMBpl2An+190GOc5qI+t7cd0xaiKOM6ofCgrEE
zMzBUgdWuZDCGZ6qyckQs4rmkbwNUHRpkFEqV1yZBceajEt5BSM=
=rNa/
-----END PGP SIGNATURE-----
commit

6864b143f2a3c787f982bd882902bc37d70b7984

parent

614c886436fa404a09881efd5d030f49172b2a93

4 files changed, 15 insertions(+), 9 deletions(-)

jump to
M README.mdREADME.md

@@ -27,7 +27,7 @@ * `/carts`: Available game/app cartridges for this server, read only; Carts are listed per line upon reading the file. It is backed by files on the server in a directory structure like `carts/CART_NAME/{CART_NAME.rom, data/, realms/}`.

* `/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 @@ ```

./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 @@ * `-r`: build the normal client and run it for local testing (don't mount the remote `9p` filesystem)

* `-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.
M server/xrxs-srv.shserver/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 @@ if [ "$2" = "-d" ]; then

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
M server/xrxs.cserver/xrxs.c

@@ -17,7 +17,7 @@ #include "universe.h"

#include "realm.h" #include "user.h" -char version[] = "0.2"; +char version[] = "0.3"; int chatty9p = 0;
M uxn-client/uxn-xrxs.shuxn-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