Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Notes on SDLMAME, GLSL, rom sorting and EmuLaunch on the Mac  (Read 7197 times)

0 Members and 1 Guest are viewing this topic.

alfonzotan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 553
  • Last login:May 21, 2025, 01:49:38 pm
    • The Cab With No Name
Notes on SDLMAME, GLSL, rom sorting and EmuLaunch on the Mac
« on: April 02, 2014, 11:41:46 am »
Bit of a public service announcement here, as there's very little info out there for OS X arcade emulation.  I just finished doing some updates to my OS X-driven cab and figured I might as well pass along my experiences.

Since I first built the cab three years ago, the MAME devs have come a long way in adding some very cool effects via HLSL shaders (based on DirectX, so unfortunately Windows only) and somewhat more limited but still cool GLSL shaders (based on OpenGL, so they work on OS X and Linux) that have been adopted in SDLMAME.  Naturally, the MAME version I'd been running for years (0.142) didn't support GLSL effects, so if I wanted to used them--and I did, after being blown away by the difference HLSL makes in the Windows version--I had to update.  Not only do the new filters make classic raster games look much more "real" on a flat screen, they make vector games playable--you can see bullets in Asteroids and such, which was previously difficult, especially if using tinted glass in front of a screen/bezel. (The Windows HLSL version is, I confess, even more impressive; they've done an amazing job of simulating CRTs for both raster and vector games.)

Fair warning:  all testing below was done on a Snow Leopard (10.6.8 ) Hackintosh build.  I have no reason to think it wouldn't work on Lion, Mountain Lion or Mavericks, but I haven't tried those OS's yet.  I may get motivated and load up Mavericks on a spare drive just to see what happens, if so I'll report back on the results.  My hardware setup was an Asrock Conroe motherboard (really for Hackintosh you should get a Gigabyte board, but this one was only $20), a 2.16GHz Core2Duo CPU, 2GB of RAM and an XTX Radeon HD 6450 graphics card.  I haven't tested the GLSL shaders on GMA950 graphics yet, but plan to in the future (I suspect they won't work, GMA950 doesn't support OpenGL 2.0 [UPDATE: I was right, trying to load shaders on a 950 results in a black screen]).

The first step of course was to grab the latest SDLMAME binary set (0.152 in this case) from here:

http://sdlmame.lngn.net/

I had very little luck with the 64-bit builds; YMMV.  But in my case I'm strictly a classic-era gamer, and performance under 32-bit is just fine.   If you haven't used SDLMAME before, you'll need to load the SDL libraries first, you can find the download links at the above site.

ROM sorting on the Mac is basically nonexistent.  There aren't any tools like clrmame that make it easy (well, maybe easy is the wrong word for clrmame) to sort through the thousands of roms in a full set to get down to something useful (to say nothing of getting rid of Mahjong and other stuff that you probably don't have any interest in).  But if you know which games you want to have in a given list for your front end, there is a relatively-easy way to cull them out of a massive roms set.  I ran across a bash script which can be run inside Automator.  You'll first need to grab a text editor and prepare a list of all the roms you want to wind up with, one rom per row, like this:

1942.7z
amidar.7z
aliens.7z

... and so forth.  Save that file to your Desktop in plain text as "files.txt".  Here's the script:

Code: [Select]
IFS=$'\n'
mkdir -p ~/Desktop/target/
for l in $(cat ~/Desktop/files.txt); do
    found=$(find ~/Documents/source -type f -name "*$l*")
    [[ -n $found ]] && cp $found ~/Desktop/target/ || echo "$l"
done

Here's the source page for the script.  I do NOT recommend using the longer Applescript suggestion above it, did bad things to my home directory. http://stackoverflow.com/questions/15739636/applescript-to-read-text-file-containing-file-names-search-for-each-file-name

Replace "~/Documents/source" with the path to the folder containing the rom set you want to sort from, paste the script text into the "run a shell script" window in Automator, and click on the Run button.  The output roms will be in a new folder on your desktop called "target."  This will just do a copy, the original folder will remain untouched.  It's not perfect; the script will mindlessly copy files that contain the same names as a given item on the list, so for example you'll get cassette versions of some games (i.e. Burger Time), and if you have panic.7z on your list, you'll get every single rom that contains the word "panic."  But it's still a lot easier than manually sifting through 8,000 roms and editing out any extras is relatively painless.

Once you settle on a rom set, drop the files into the roms folder in your SDLMAME directory.  Now fire up the Terminal, navigate to the SDLMAME directory, and make a mame.ini file by typing ./mame -cc

After that you can load up artwork and samples into the appropriate directories (if you want to store them somewhere else than your SDLMAME folder, open mame.ini with TextEdit and type in the appropriate directory paths to point MAME at them).  Now we're ready to load up GLSL filters.

This tutorial, while meant for Linux users, works fine for OS X.  From here you can download a shader pack (written by cgwg), an osd folder which you just drop into your SDLMAME directory, and get the extra lines you'll need to add to your mame.ini file to make them work:

http://www.mameau.com/mame-glsl-shaders-setup/

Like the author of that tutorial, I was not crazy about the overscan and asymmetric tilt of the simulated CRT screen (especially for verticals), and so I made the changes suggested by eldaiu in this post:

http://forum.arcadecontrols.com/index.php/topic,120205.msg1274906.html#msg1274906

Code: [Select]
You can customize the effects changing some variables in CRT-geom.vsh, I felt some effects were a bit too strong:

The overscan was cutting to much graphic:
overscan = vec2(1.00,1.00);

The curvature was a bit too much:
R = 3.0;

I didn't like the tilting:
const vec2 angle = vec2(0.0,0.0);

You can test all this along the way by navigating in Terminal to your SDLMAME folder and starting any game with ./mame romname.zip (note, you can launch with either .zip or .7z, which will be important in a second).  You can always turn off the GLSL filters by deleting or commenting out the lines you added to the mame.ini file.

Once you've got everything linking up (artwork is populating, samples are sounding properly--if not, check the paths in your mame.ini), it's time to set up a front end.  For a cabinet controlled by joysticks and buttons, the only real choice for OS X is the venerable (and abandonware) but still working EmuLaunch:

http://www.emulaunch.com/

You should run the EmuLaunch setup sequence to get it pointed towards your roms and SDLMAME app.  After the first start, you can go to the Preferences xml file (at ~/Library/Preferences/EMUlaunch-mame.xml) to edit the game names, add or subtract games, or what have you by editing the .xml file in TextEdit (you always have to Save As and add the .xml or it'll be saved as a .txt file). 

Also, make a copy of your mame.ini file, then go to ~/Library/Application Support/, create a folder named mame, and drop the copy of the mame.ini in there.  That's where Emulaunch looks for it for some reason, and it'll need to be there to get the artwork, samples, GLSL filters and anything else correct when launching emulated games. 

EmuLaunch will look for screenshot graphics in your main SDLMAME directory under the screenshots and screenshots2 folders.  Note that EmuLaunch will NOT display screenshots if your roms are tagged as .7z files in the .xml file, so be sure they are all listed there as .zip files (MAME doesn't care and will open the game either way).

I have not really played around with OpenEmu yet, not least because it doesn't run under Snow Leopard.  My impression from a brief check is that it isn't suited (yet) for cabinet frontend work, you pretty much need a mouse and keyboard to select games.  Another limitation is that it uses its own "core" for MAME emulation, and I'm not sure how you can customize arcade games for filters, artwork, etc.  Anybody who's more familiar with that app, please let the rest of us know.

That's it for this round, hope it's helpful...
« Last Edit: June 25, 2015, 07:11:13 am by alfonzotan »

EMDB

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 865
  • Last login:September 05, 2023, 09:18:51 am
  • Project RetroCade
Re: Notes on SDLMAME, GLSL, rom sorting and EmuLaunch on the Mac
« Reply #1 on: April 02, 2014, 02:57:22 pm »
I can understand why you would use a MAC as desktop computer  but why choose it as platform for an arcade system as most stuff is designed for Windows (and partially Linux)  :dunno

alfonzotan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 553
  • Last login:May 21, 2025, 01:49:38 pm
    • The Cab With No Name
Re: Notes on SDLMAME, GLSL, rom sorting and EmuLaunch on the Mac
« Reply #2 on: April 02, 2014, 03:01:47 pm »
I can understand why you would use a MAC as desktop computer  but why choose it as platform for an arcade system as most stuff is designed for Windows (and partially Linux)  :dunno

Because it's there!

Slightly more seriously, because I wanted to.  There aren't many Mac cabs, and it was a fun challenge to put one together (although frankly, EmuLaunch on OS X is a hell of a lot easier to set up than MALA on Windows, but admittedly it's also much less configurable).  Besides, I spend entirely too much time fighting with Windows at work...
« Last Edit: April 02, 2014, 03:08:48 pm by alfonzotan »

keilmillerjr

  • Trade Count: (+5)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1847
  • Last login:October 06, 2023, 10:20:39 pm
  • Web Developer.
Re: Notes on SDLMAME, GLSL, rom sorting and EmuLaunch on the Mac
« Reply #3 on: April 02, 2014, 03:23:21 pm »
Have you seem OpenEmu for Mac? It's pretty close to being "front end ready". http://openemu.org

alfonzotan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 553
  • Last login:May 21, 2025, 01:49:38 pm
    • The Cab With No Name
Re: Notes on SDLMAME, GLSL, rom sorting and EmuLaunch on the Mac
« Reply #4 on: April 02, 2014, 03:34:55 pm »
Have you seem OpenEmu for Mac? It's pretty close to being "front end ready". http://openemu.org

I have, mentioned it towards the end of the post (and I don't blame anybody for not reading that far).

trarman

  • Trade Count: (0)
  • Newbie
  • *
  • Offline Offline
  • Posts: 1
  • Last login:October 09, 2014, 12:12:38 pm
  • I want to build my own arcade controls!
Re: Notes on SDLMAME, GLSL, rom sorting and EmuLaunch on the Mac
« Reply #5 on: October 09, 2014, 12:09:44 pm »
Registered just to say thank you to OP for this post.  It was very helpful for setting up an old PPC mac mini running OS X Leopard (10.5) in a cocktail cabinet.

Why use a ppc mac mini?  Cuz I've got one and it's not doing anything else.  :)  Plays the old classic games just fine.  It's quiet and takes up very little space in the cabinet.

« Last Edit: October 09, 2014, 12:13:03 pm by trarman »