saturnng/dist/saturn48sx

32 lines
804 B
Text
Raw Normal View History

2024-09-25 14:41:48 +02:00
#!/bin/bash -eu
cd "$(dirname "$0")" || exit 1
#CWD=$(pwd)
STATE_HOME=${XDG_STATE_HOME:-$HOME/.local/state}
STATEDIR=${STATEDIR:-$STATE_HOME/sb4xng/48sx}
2024-09-25 14:41:48 +02:00
mkdir -p "$STATEDIR"
if [ ! -e "$STATEDIR"/rom ]; then
if [ ! -d ../share/sb4xng/ROMs/ ]; then
2024-09-25 14:41:48 +02:00
echo "Error: No ROMs/ dir found"
exit 1
fi
if [ ! -d "$STATEDIR"/../ROMs ]; then
cp -R ../share/sb4xng/ROMs/ "$STATEDIR"/../ROMs
2024-09-25 14:41:48 +02:00
fi
make -C "$STATEDIR"/../ROMs sxrom-j
cp "$STATEDIR"/../ROMs/sxrom-j "$STATEDIR"/rom
fi
[ ! -e "$STATEDIR"/port1 ] && dd if=/dev/zero of="$STATEDIR"/port1 bs=1k count=128
[ ! -e "$STATEDIR"/port2 ] && dd if=/dev/zero of="$STATEDIR"/port2 bs=1k count=128
RESET=''
if [ ! -e "$STATEDIR"/ram ]; then
RESET=--reset
fi
sb4xng --48sx --state-dir "$STATEDIR" "$RESET" "$@"