Sometimes you want to be able to launch a game by double-clicking an icon rather than going through MAME’s interface or using the Terminal. This method has the added benefit of letting you easily launch MAME with various options.
We are going to write a small shell script, save it as a command file, and make it executable.
If you have followed the directions in my previous post “MAME on Mac OSX Yosemite” you can follow these instructions exactly, if you have made changes or modified any steps, keep that in mind while working through these steps.
First off we write the shell script.
- 1. Open the Documents directory and create a new folder named “MAME Games”.
- 2. Open Applications > TextEdit and click Format > Make Plain Text
- 3. On the first line of the document enter “
#!/usr/bin/env bash”. This is known as a shebang and tells the computer that we want to use the Bash shell to run our script.
- 4. Then for readablility’s sake skip a line and enter “cd ~/Documents/mame” on the next line. This changes the directory to your mame folder inside of your Documents folder.
- 5. On the last line enter “
./mame64 robotbwl” which launches the MAME application and loads the Robot Bowl ROM.
- 6. Now save the file naming it “Robot Bowl.command”. The filename extension of “command” tells Mac OSX that this is a Terminal shell script.
We have created our script now we have to give it permission to be executable.
- 1. Open the Terminal app and end enter “
chmod +x ~/Documents/MAME\ Games/Robot\ Bowl.command”, this modifies the permissions of the “Robot Bowl.command” file by adding the Executebale for everyone permissions to it.
- 2. NOTE: The back slash “\” in the code escapes the spaces in the directory path and file names, without those back slashes the code will not work.
That is all there is to it, you should now be able to double click on the Robot Bowl file to launch MAME and the Robot Bowl game.
Now we are going to create a file that will launch the Robot Bowl game with the screen much brighter than normal. This can be really handy if you have a screen or a game that is dark.
- 1. Copy the Robot Bowl file we created above and name it “Robot Bowl Bright”. By copying the Robot Bowl file the copied file will have the original’s executable permissions.
- 2. Open the Robot Bowl Bright file in TextEdit and add the brightness option to it by changing the last line to be “
./mame64 robotbwl -brightness 1.5” and save it.
Now launch the new Robot Bowl Bright file and you can see how much brighter it is, the background has become gray. Hit the Escape (esc) key to quit and launch the original Robot Bowl file and you should see that the background is black when launching the game from that file.
In the docs directory there is a config.txt file that contains many other options you can use to configure your launchers. The ones you will probably use most often are the joystick options.
To make launching games even easier you can drag the MAME Games folder onto the right-hand side of the Dock by the trashcan. I don’t like the default view of folders in the Dock so I right-click the folder and choose “Display as Folder” and “View content as List”. Now I can click the folder in the dock and choose a game from the list.
You could get creative with this and have a different folder for different types of games or with different options enabled for the games.