void-packages/srcpkgs/mame/files/mame.sh

46 lines
1.4 KiB
Bash

#!/bin/sh
exec_mame() {
/usr/share/mame/mame \
-artpath "$HOME/.mame/artwork;artwork" \
-ctrlrpath "$HOME/.mame/ctrlr;ctrlr" \
-inipath $HOME/.mame/ini \
-rompath $HOME/.mame/roms \
-samplepath $HOME/.mame/samples \
-cfg_directory $HOME/.mame/cfg \
-comment_directory $HOME/.mame/comments \
-diff_directory $HOME/.mame/diff \
-input_directory $HOME/.mame/inp \
-nvram_directory $HOME/.mame/nvram \
-snapshot_directory $HOME/.mame/snap \
-state_directory $HOME/.mame/sta \
-video opengl \
-createconfig
}
if [ "$1" = "--newini" ]; then
echo "Rebuilding the ini file at $HOME/.mame/mame.ini"
echo "Modify this file for permanent changes to your SDLMAME"
echo "options and paths before running SDLMAME again."
cd $HOME/.mame
if [ -e mame.ini ]; then
echo "Your old ini file has been renamed to mame.ini.bak"
mv mame.ini mame.ini.bak
fi
exec_mame
elif [ ! -e $HOME/.mame ]; then
echo "Running SDLMAME for the first time..."
echo "Creating an ini file for SDLMAME at $HOME/.mame/mame.ini"
echo "Modify this file for permanent changes to your SDLMAME"
echo "options and paths before running SDLMAME again."
mkdir $HOME/.mame
for f in artwork cfg comments ctrlr diff ini ip nvram \
samples snap sta roms; do
mkdir $HOME/.mame/${f}
done
cd $HOME/.mame && exec_mame
else
cd /usr/share/mame
./mame "$@"
fi