28 lines
634 B
Bash
Executable file
28 lines
634 B
Bash
Executable file
#!/bin/bash -eu
|
|
|
|
cd "$(dirname "$0")" || exit 1
|
|
#CWD=$(pwd)
|
|
|
|
STATE_HOME=${XDG_STATE_HOME:-$HOME/.local/state}
|
|
|
|
STATEDIR=${STATEDIR:-$STATE_HOME/sb4xng/40g}
|
|
mkdir -p "$STATEDIR"
|
|
|
|
if [ ! -e "$STATEDIR"/rom ]; then
|
|
if [ ! -d ../share/sb4xng/ROMs/ ]; then
|
|
echo "Error: No ROMs/ dir found"
|
|
exit 1
|
|
fi
|
|
if [ ! -d "$STATEDIR"/../ROMs ]; then
|
|
cp -R ../share/sb4xng/ROMs/ "$STATEDIR"/../ROMs
|
|
fi
|
|
make -C "$STATEDIR"/../ROMs rom.39g
|
|
cp "$STATEDIR"/../ROMs/rom.39g "$STATEDIR"/rom
|
|
fi
|
|
|
|
RESET=''
|
|
if [ ! -e "$STATEDIR"/ram ]; then
|
|
RESET=-reset
|
|
fi
|
|
|
|
sb4xng --40g --state-dir "$STATEDIR" "$RESET" "$@"
|