saturnng/dist/saturn48sx

48 lines
1.3 KiB
Text
Raw Normal View History

2024-09-25 14:41:48 +02:00
#!/bin/bash -eu
cd "$(dirname "$0")" || exit 1
BINNAME=$(basename "$0")
2024-09-25 14:41:48 +02:00
CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
2024-09-25 14:41:48 +02:00
CONFIGDIR=${CONFIGDIR:-$CONFIG_HOME/$BINNAME}
mkdir -p "$CONFIGDIR"
if [ ! -e "$CONFIGDIR"/rom ]; then
if [ -d ../share/saturn/ROMs/ ]; then
cp -R ../share/saturn/ROMs/ "$CONFIGDIR"/
elif [ -d ./ROMs/ ]; then
cp -R ./ROMs/ "$CONFIGDIR"/
fi
if [ ! -d "$CONFIGDIR"/ROMs ]; then
2024-09-25 14:41:48 +02:00
echo "Error: No ROMs/ dir found"
exit 1
fi
echo "The next step will download a ROM from https://hpcalc.org where \"HP graciously began allowing this to be downloaded in mid-2000.\""
echo "You can hit Ctrl-C now if you do not wish to download them."
read -r
make -C "$CONFIGDIR"/ROMs sxrom-j
cp "$CONFIGDIR"/ROMs/sxrom-j "$CONFIGDIR"/rom
2024-09-25 14:41:48 +02:00
fi
[ ! -e "$CONFIGDIR"/port1 ] && dd if=/dev/zero of="$CONFIGDIR"/port1 bs=1k count=128
[ ! -e "$CONFIGDIR"/port2 ] && dd if=/dev/zero of="$CONFIGDIR"/port2 bs=1k count=128
2024-09-25 14:41:48 +02:00
RESET=''
if [ ! -e "$CONFIGDIR"/ram ]; then
2024-09-25 14:41:48 +02:00
RESET=--reset
fi
if [ ! -e "$CONFIGDIR"/config.lua ]; then
./saturn --48sx --state-dir "$CONFIGDIR" --print-config > "$CONFIGDIR"/config.lua
fi
2024-10-06 10:52:58 +02:00
if echo "$@" | grep -q "\--verbose"; then
./saturn --48sx --state-dir "$CONFIGDIR" "$RESET" "$@"
else
./saturn --48sx --state-dir "$CONFIGDIR" "$RESET" "$@" 2> /dev/null
fi