summarylogtreecommitdiffstats
path: root/mame.sh
diff options
context:
space:
mode:
authorsL1pKn072019-03-13 20:55:12 +0100
committersL1pKn072019-03-13 20:55:12 +0100
commit693bdb47d9ee0805c0fbd8dfde420f4e6aa71dbb (patch)
tree9afd88abe64806a4828a12849c2e20de99c9d461 /mame.sh
parent697ca8357b169793ac4d90187ccd10188899050b (diff)
downloadaur-693bdb47d9ee0805c0fbd8dfde420f4e6aa71dbb.tar.gz
deep rework
Diffstat (limited to 'mame.sh')
-rw-r--r--mame.sh57
1 files changed, 57 insertions, 0 deletions
diff --git a/mame.sh b/mame.sh
new file mode 100644
index 000000000000..bd73f0a9f2e8
--- /dev/null
+++ b/mame.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+mamelib=/usr/lib/mame/
+
+mame_first_run() {
+ echo "Creating an ini file for MAME at ~/.mame/mame.ini"
+ echo "Modify this file for permanent changes to your MAME"
+ echo "options and paths before running MAME again."
+
+ cd -- ~/.mame || exit
+
+ if [ -e mame.ini ]; then
+ mv mame.ini mameini.bak || exit
+ echo "Your old ini file has been renamed to mameini.bak"
+ fi
+
+ # 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 \
+ -rompath '$HOME/.mame/roms;roms' \
+ -hashpath '$HOME/.mame/hash;hash' \
+ -samplepath '$HOME/.mame/samples' \
+ -artpath '$HOME/.mame/artwork;artwork' \
+ -ctrlrpath '$HOME/.mame/ctrlr;ctrlr' \
+ -inipath '$HOME/.mame/ini' \
+ -fontpath '$HOME/.mame/fonts;fonts' \
+ -cheatpath '$HOME/.mame/cheat' \
+ -crosshairpath '$HOME/.mame/crosshair' \
+ -pluginspath '$HOME/.mame/plugins;plugins' \
+ -languagepath '$HOME/.mame/language;language' \
+ -swpath '$HOME/.mame/software;software' \
+ -cfg_directory '$HOME/.mame/cfg' \
+ -nvram_directory '$HOME/.mame/nvram' \
+ -input_directory '$HOME/.mame/inp' \
+ -state_directory '$HOME/.mame/sta' \
+ -snapshot_directory '$HOME/.mame/snap' \
+ -diff_directory '$HOME/.mame/diff' \
+ -comment_directory '$HOME/.mame/comments' \
+ -video opengl \
+ -noreadconfig -showconfig > mame.ini
+}
+
+if [ "$1" = "--newini" ]; then
+ echo "Running MAME for the first time..."
+ if ! [ -e ~/.mame ]; then
+ mkdir -- ~/.mame
+ fi
+ (
+ cd -- ~/.mame || exit
+ mkdir -p roms hash samples artwork ctrlr ini fonts cheat crosshair plugins language software
+ mame_first_run
+ ) || exit
+fi
+
+cd "${mamelib}"
+exec ./mame "${@/--newini/}"