I got this plugin to launch MAME roms on the mac, here's how:
First, open resources/lib/launcher_plugin.py and in the function _run_launcher, change
Code:
else:
pass;
# unsupported platform
to
Code:
else:
os.system("\"%s\" %s" % (launcher["application"], launcher["args"]))
and in _run_rom, change
Code:
else:
pass
# unsupported platform
to
Code:
else:
os.system("\"%s\" %s \"%s\"" % (launcher["application"], launcher["args"], rom["filename"]))
(i.e. mac launching code is the same as on linux, but the application and filename need to be quoted, as spaces-in-paths are common on the mac)
Now you can launch programs, you have to point Launcher at the binary inside the app bundle (e.g. /Applications/Something.app/Contents/MacOS/something instead of just /Applications/Something.app).
To launch a game in MAME OS X from the command line, you want to run "/Applications/MAME OS X.app/Contents/MacOS/MAME OS X" -Game pacman. Unfortunately Launcher wants to pass the full filename (/Users/foo/Library/Application Support/MAME OS X/ROMs/pacman.zip rather than just pacman). So we write a little shell script that takes the ROM filename and launches MAME with the correct parameters.
Create a file /Applications/MAME OS X.app/Contents/MacOS/cmdlauncher with the following content:
Code:
#!/bin/sh
"$(dirname "$0")/MAME OS X" -Game $(basename -s .zip "$1")
Mark this file executable (chmod 755 cmdlauncher). Now configure Launcher so that the emulator is cmdlauncher (with no arguments), and your ROMs folder is ~/Library/Application Support/MAME OS X/ROMs and it should all work.
Finally, I like to have the full names for the roms (not just filenames) and to have thumbnails showing. The following script will generate the XML with this information, just run it as: generate_romlist.sh "/path/to/MAME OS X.app", and stick the output between <roms> and </roms> in ~/Library/Application Support/XBMC/userdata/plugin_data/programs/Launcher/launchers.xml, replacing what's already there.
Code:
#!/bin/sh
mame="$1"
mamedir="$2"
if [[ ! -d "$mame" ]]
then
echo "First parameter should be MAME app"
exit 1
fi
if [[ ! -d "$mamedir" ]]
then
mamedir="/Users/$USER/Library/Application Support/MAME OS X"
fi
for i in $(ls "$mamedir/ROMs")
do
b=$(basename -s .zip $i)
n="$("$mame/Contents/MacOS/mameosx-util" -l $b | tail -n 1 | cut -c 12- | sed s/.$//)"
t="$mamedir/Screenshots/$b/0000.png"
echo "<rom>"
echo "\t<name>$n</name>"
echo "\t<filename>$mamedir/ROMs/$b.zip</filename>"
if [[ -e "$t" ]]
then
echo "\t<thumb>$t</thumb>"
else
echo "\t<thumb></thumb>"
fi
echo "</rom>"
done