archrelease: copy trunk to community-any
[ArchLinux/community.git] / mame / trunk / mame.sh
blob80b7c4f4edcf8c46bde660445f53d0706e9f8d71
1 #!/bin/sh
2 mame=/usr/lib/mame/mame
4 mame_first_run() {
5 echo "Creating an ini file for MAME at $HOME/.mame/mame.ini"
6 echo "Modify this file for permanent changes to your MAME"
7 echo "options and paths before running MAME again."
9 cd -- ~/.mame || exit
11 if [ -e mame.ini ]; then
12 mv mame.ini mameini.bak || exit
13 echo "Your old ini file has been renamed to mameini.bak"
16 # Note: the single quotes here are not a mistake; MAME will save these
17 # strings verbatim into its configuration file, and expand the variables when
18 # it is run in future.
19 "$mame" \
20 -artpath '$HOME/.mame/artwork;/usr/lib/mame/artwork' \
21 -bgfx_path '$HOME/.mame/bgfx;/usr/lib/mame/bgfx' \
22 -ctrlrpath '$HOME/.mame/ctrlr;/usr/lib/mame/ctrlr' \
23 -hashpath '$HOME/.mame/hash;/usr/lib/mame/hash' \
24 -languagepath '$HOME/.mame/language;/usr/lib/mame/language' \
25 -pluginspath '/usr/lib/mame/plugins' \
26 -inipath '$HOME/.mame/ini' \
27 -rompath '$HOME/.mame/roms' \
28 -samplepath '$HOME/.mame/samples' \
29 -cfg_directory '$HOME/.mame/cfg' \
30 -comment_directory '$HOME/.mame/comments' \
31 -diff_directory '$HOME/.mame/diff' \
32 -input_directory '$HOME/.mame/inp' \
33 -nvram_directory '$HOME/.mame/nvram' \
34 -snapshot_directory '$HOME/.mame/snap' \
35 -state_directory '$HOME/.mame/sta' \
36 -video opengl \
37 -createconfig
40 if [ "$1" = "--newini" ]; then
41 mame_first_run
42 exit
43 elif ! [ -e ~/.mame ]; then
44 echo "Running MAME for the first time..."
46 mkdir -- ~/.mame
48 cd -- ~/.mame || exit
49 mkdir artwork bgfx cfg comments ctrlr diff hash ini inp language nvram samples snap sta roms
51 mame_first_run
52 ) || exit
55 exec "$mame" "$@"