2024-08-25 17:39:50 +02:00
|
|
|
#!/bin/bash -eu
|
|
|
|
|
2024-09-24 15:14:15 +02:00
|
|
|
cd "$(dirname "$0")" || exit 1
|
2024-08-29 09:44:18 +02:00
|
|
|
|
2024-09-26 14:49:57 +02:00
|
|
|
BINNAME=$(basename "$0")
|
2024-08-25 17:39:50 +02:00
|
|
|
|
2024-09-26 14:49:57 +02:00
|
|
|
CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
|
2024-08-25 17:39:50 +02:00
|
|
|
|
2024-09-26 14:49:57 +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-08-25 17:39:50 +02:00
|
|
|
echo "Error: No ROMs/ dir found"
|
|
|
|
exit 1
|
|
|
|
fi
|
2024-09-26 14:49:57 +02:00
|
|
|
|
|
|
|
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 rom.49g
|
|
|
|
cp "$CONFIGDIR"/ROMs/rom.49g "$CONFIGDIR"/rom
|
2024-08-25 17:39:50 +02:00
|
|
|
fi
|
|
|
|
|
2024-09-24 20:23:21 +02:00
|
|
|
RESET=''
|
2024-09-26 14:49:57 +02:00
|
|
|
if [ ! -e "$CONFIGDIR"/ram ]; then
|
2024-10-07 09:19:10 +02:00
|
|
|
RESET=--reset
|
2024-08-25 17:39:50 +02:00
|
|
|
fi
|
|
|
|
|
2024-10-09 15:24:23 +02:00
|
|
|
if [ ! -e "$CONFIGDIR"/config.lua ]; then
|
|
|
|
./saturn --49g --state-dir "$CONFIGDIR" --print-config > "$CONFIGDIR"/config.lua
|
|
|
|
fi
|
|
|
|
|
2024-10-06 10:52:58 +02:00
|
|
|
if echo "$@" | grep -q "\--verbose"; then
|
2024-10-06 10:15:56 +02:00
|
|
|
./saturn --49g --state-dir "$CONFIGDIR" "$RESET" "$@"
|
|
|
|
else
|
|
|
|
./saturn --49g --state-dir "$CONFIGDIR" "$RESET" "$@" 2> /dev/null
|
|
|
|
fi
|