31 lines
794 B
Bash
Executable file
31 lines
794 B
Bash
Executable file
#!/bin/bash -eu
|
|
|
|
cd "$(dirname "$0")" || exit 1
|
|
#CWD=$(pwd)
|
|
|
|
STATE_HOME=${XDG_STATE_HOME:-$HOME/.local/state}
|
|
|
|
STATEDIR=$STATE_HOME/saturn/48gx
|
|
mkdir -p "$STATEDIR"
|
|
|
|
if [ ! -e "$STATEDIR"/rom ]; then
|
|
if [ ! -d ../share/saturn/ROMs/ ]; then
|
|
echo "Error: No ROMs/ dir found"
|
|
exit 1
|
|
fi
|
|
if [ ! -d "$STATEDIR"/../ROMs ]; then
|
|
cp -R ../share/saturn/ROMs/ "$STATEDIR"/../ROMs
|
|
fi
|
|
make -C "$STATEDIR"/../ROMs gxrom-r
|
|
cp "$STATEDIR"/../ROMs/gxrom-r "$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=4096
|
|
|
|
RESET=''
|
|
if [ ! -e "$STATEDIR"/ram ]; then
|
|
RESET=--reset
|
|
fi
|
|
|
|
./saturn --48gx --state-dir "$STATEDIR" "$RESET" "$@"
|