2018-04-25 12:30:02 +00:00
|
|
|
#!/bin/sh
|
2019-04-24 12:39:48 +00:00
|
|
|
mame=/usr/lib/mame/mame
|
2018-04-25 12:30:02 +00:00
|
|
|
|
2018-11-11 14:59:18 +00:00
|
|
|
mame_first_run() {
|
|
|
|
echo "Creating an ini file for MAME at $HOME/.mame/mame.ini"
|
|
|
|
echo "Modify this file for permanent changes to your MAME"
|
|
|
|
echo "options and paths before running MAME again."
|
|
|
|
|
|
|
|
cd -- ~/.mame || exit
|
2018-04-25 12:30:02 +00:00
|
|
|
|
|
|
|
if [ -e mame.ini ]; then
|
2018-11-11 14:59:18 +00:00
|
|
|
mv mame.ini mameini.bak || exit
|
2018-04-25 12:30:02 +00:00
|
|
|
echo "Your old ini file has been renamed to mameini.bak"
|
|
|
|
fi
|
2018-11-11 14:59:18 +00:00
|
|
|
|
|
|
|
# Note: the single quotes here are not a mistake; MAME will save these
|
|
|
|
# strings verbatim into its configuration file, and expand the variables when
|
|
|
|
# it is run in future.
|
|
|
|
"$mame" \
|
2019-04-24 12:39:48 +00:00
|
|
|
-artpath '$HOME/.mame/artwork;/usr/lib/mame/artwork' \
|
|
|
|
-bgfx_path '$HOME/.mame/bgfx;/usr/lib/mame/bgfx' \
|
|
|
|
-ctrlrpath '$HOME/.mame/ctrlr;/usr/lib/mame/ctrlr' \
|
|
|
|
-hashpath '$HOME/.mame/hash;/usr/lib/mame/hash' \
|
|
|
|
-languagepath '$HOME/.mame/language;/usr/lib/mame/language' \
|
|
|
|
-pluginspath '/usr/lib/mame/plugins' \
|
2018-11-11 14:59:18 +00:00
|
|
|
-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' \
|
2018-04-25 12:30:02 +00:00
|
|
|
-video opengl \
|
|
|
|
-createconfig
|
2018-11-11 14:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$1" = "--newini" ]; then
|
|
|
|
mame_first_run
|
|
|
|
exit
|
|
|
|
elif ! [ -e ~/.mame ]; then
|
|
|
|
echo "Running MAME for the first time..."
|
|
|
|
|
|
|
|
mkdir -- ~/.mame
|
|
|
|
(
|
|
|
|
cd -- ~/.mame || exit
|
2019-04-24 12:39:48 +00:00
|
|
|
mkdir artwork bgfx cfg comments ctrlr diff hash ini inp language nvram samples snap sta roms
|
2018-11-11 14:59:18 +00:00
|
|
|
|
|
|
|
mame_first_run
|
|
|
|
) || exit
|
2018-04-25 12:30:02 +00:00
|
|
|
fi
|
2018-11-11 14:59:18 +00:00
|
|
|
|
2019-04-24 12:39:48 +00:00
|
|
|
exec "$mame" "$@"
|