09 November 2017

Setup MAME 0.191 from scratch on Macs (Update of Previous Posts)

Another update on how to configure MAME from scratch via its internal interface MEWUI (default MAME UI since 0.171) and a text editor.  
If you are willing to work with your Terminal and a Text Editor, it is just the best way to set up and maintain MAME, irrespective of which frontend you wanna use later on.
So let's go step by step from scratch. 
MEWUI - click to enlarge
Step 1 - Basic Homework 

Download and install SDL 2 and QMC2 as explained here (only Steps 1 and 2). Download a good text editor - I prefer TextWrangler from the Mac App Store. Change Finder Settings in order to Display Hidden Folders and Files, e.g. with Deeper (you need access to your User Library folder, which is by default a hidden folder).

Recommendation: I currently keep my running MAME version in the folder 'mame' and keep only older versions in a version-related directory. This definitely helps you further on to stay consistent and carry on your work.

Step 2 - Start MEWUI (the right way)

Open Terminal and switch to your MAME working directory (easiest way: type 'cd' and then drag the mame directory from the Finder into the Terminal -> press Return in the Terminal window)

Warning: starting mame64 with double-click works, but you are not in the MAME working directory, so a lot just does not work -> start via Terminal as explained here. So you must be in the MAME working directory!
Step 3 - Initial Config of MAME in MEWUI 

With Step 2 you came into MEWUI (see screeenshot above). In here your mouse works. I suggest that you apply some minimal changes in Configure Options. Head for Plugins and activate Hiscore Support. Save the Configuration and Exit MEWUI. As a result of this, you now should have generated the necessary ini Files in Your User/Library/Application Support/mame/

After first MEWUI start/exit, these .ini files should be in place. They are most important for your further work.
mame.ini - your overall configuration file for MAME
plugin.ini - your configuration file for activating and deactivating MAME Plugins
ui.ini - your configuration file for the MEWUI interface

Let's be clear: The only reason of this step is to generate the three .ui files. Everything else we do in the Text Editor.

Advantage of this path: version independent, you won't loose anything during a MAME upgrade. These files are your best friends!

Alternative: In your mame directory, execute the following command:
./mame64 -cc
This generates the three default config files in your mame directory. But as explained above, the path (User)/Library/Application Support/mame/ is version-independent, so after that you should move it there. But in general, they also work here.

Step 4 - Configuration of Shaders in Text Editor 

Below I make reference to the line number in my 0.191 mame.ini file - the comments in brackets are just explanations, do not include them in the mame.ini file!!!

Option 1 - Settings in mame.ini for BGFX/CRT-GEOM-DELUXE (explained here):
line
4   readconfig     1 (leave it as is -> tells MAME to read out this ini and other ini files)
91  artwork_crop   0  (no crop of modern bezels; 1 if you want to crop old artwork for 16:9)
191 plugins        1 (if enabled, the settings in plugin.ini should work)
243 video          bgfx (switch shaders to bgfx)
245 window         0 (start MAME in fullscreen; 1 = windowed mode)
348 bgfx_backend   opengl (or metal if it works in your build)
350 bgfx_screen_chains crt-geom-deluxe (or hlsl if your Mac has the power - below)
Note that in BGFX, Bilinear Filtering seems to be irrelevant.
That is basically it! With this settings in your mame.ini, you are ready for a BGFX, enabled MAME environment.

Option 2 - Settings in mame.ini for BGFX/HLSL (explained here):
line
350 bgfx_screen_chains hlsl (bgfx-hlsl, if your Mac has the power)

In all cases of BGFX shaders, consider tweaking HLSL for performance improvements, as explained here.

Option 3 - OpenGL settings in mame.ini for GLSL/CRT-GEOM-DELUXE 

GLSL is still the performance king, and the CRT-GEOM-DELUXE shaders discussed here rock. You need to download the shaders as explained here. Im my case, they are located in an own directory of mame called CRT-GEOM-DELUXE.

These changes of mame.ini are required. You can prepare these changes as well and leave MAME with BGFX by changing everything except for the first line 243.
line
243 video       opengl (switch shaders to OpenGL)
291 gl_vbo      1
292 gl_pbo      1
293 gl_glsl     1
294 gl_glsl_filter 1
295 glsl_shader_mame0   /Users/stefan/Games/mame/CRT-GEOM-DELUXE/Gaussx
296  glsl_shader_mame1 /Users/stefan/Games/mame/CRT-GEOM-DELUXE/Gaussy
297  glsl_shader_mame2  /Users/stefan/Games/mame/CRT-GEOM-DELUXE/CRT-geom-halation

So these shaders are called in a sequence of three. Obviously, you need to include your own correct file path instead of mine.

For vertical games (see Step 4a below as regards specific game inis):
297  glsl_shader_mame2   /Users/stefan/Games/mame/CRT-GEOM-DELUXE/CRT-geom-halation_Vertical

Important: Never include the file ending .vsh or .fsh - it would not work.

Also consider to tweak the settings of both crt-geom-halation.vsh and crt-geom-halation_Vertical.vsh as described here.

Step 4a - Different Configs for Single Games

Some games work better with different shaders, or they need the waitvsync option as described here.  Also here the manual setup of MAME shines - and you do that for any frontend you may make use of afterwards. 

Name convention: (game name).ini
Directory: (Username)/Library/Application Support/mame/ (same as mame.ini)

The best way is to copy/paste your mame.ini - as soon as your mame.ini is ready. This is also a very nice way to test new mame.ini settings just with one game.

Example - I created a 1942.ini from my ready mame.ini in order to change the following settings:
line
62   speed    1.0 (waitvsync always works together with speed, but in the case of 1942, no speed adjustment is required - see the above link)
243  video    opengl (because 1942 runs much better in OpenGL than BGFX)
247  waitvsync 1 (activate waitvsync to stop bleeding in 1942)
297  glsl_shader_mame2   /Users/stefan/Games/mame/CRT-GEOM-DELUXE/CRT-geom-halation_Vertical (for usage of the vertical shader)
Note: You may leave the BGFX settings as is because MAME will not work with them.

Step 5 - Setup Joystick inside of MAME: 

This is probably the best time to set up your joypad for MAME - as described here. If everything works out nicely, you will from now on move the configuration file named /cfg/default.cfg into the subsequent versions.

Step 6 - Setup Artwork inside of MAME: 

Besides a decent shader, artwork is the second most important tweak for me to get a real arcade feeling on your Mac. In this Blog, you will find a lot about tweaking Artwork for your Mac:
My Post about realistic Bezel Artwork for MAME
The most 'official' MAME Artwork directory is here:
http://www.progettosnaps.net/artworks/
When downloading, be sure that you always head for the 16:9 artwork, where available.
Place the .zip files into the Artwork directory, and you should be done.

Step 7 - Look for a Frontend

Right now, Mac users can only decide between QMC2 and Attract Mode. While both are great and work very stable, they always lag a bit behind the Windows and sometimes Linux world. Still both are good choices, and you will find tons of information about how to set up these frontends on your Mac.

Important note for QMC2: Since you configured your standard settings in mame.ini, you need to configure readconfig in QMC2's Global Configuration Settings to "1" and reset QMC2's settings to default settings.



Be careful: QMC2 settings can override mame.ini, so in case of a conflict, set QMC2 settings identical to mame.ini.
Advantage: You have identical settings in different frontends, e.g. QMC2 and Attract Mode.

Of course you can move ahead with MEWUI, which is built into mame64. Then you might want to do the following:

./mame64 Automation: Create a script containing these two lines:
cd /xxxxxxx/xxxxxxx/xxxxx/mame
(of course the xxxxx are placeholders for your directory - and assuming that your directory is mame)
./mame64
Save it under the filename MAME64.command and make it executable via chmod +x. From now on you can start MEWUI from the Finder it by double-clicking this script.

Conclusion: If you get familiar with this setup, you will never be faster in any frontend. It is by far the most preferable way of setting up MAME because you exactly know what you are doing. There are also some advantages over configuring from within QMC2: 
  • You configure the new MAME plugins in the UI, so you can e.g. turn on the new highscore LUA-support -> that one really rocks.
  • joystick works out of the box, it works in the UI without configuration, I just had to configure P1 coin, P1 start and UI exit as described here and everything is in place for moving things without the keyboard - niiiiiice
  • You set a very solid groundwork for a frontend such as Attract Mode, as explained here and here.

7 comments:

  1. One thing to note. When using NEWUI and you configure it how you want, when/if you choose save configuration, the changes are saved to ~/Library/Application Support/mame/mame.ini, not the mame.ini in the current directory. This isn't an issue normally, since by default all mame.ini files are set to read the one in Application Support folder first.

    ReplyDelete
    Replies
    1. Correct, this path is the default path for SDL MAME on OSX, thanks, I clarified

      Delete
  2. I am a rookie to this process. Is there an easier way to set this up?

    ReplyDelete
    Replies
    1. Sure! Look down for the first two posts (Welcome and Setup with QMC2) and you should be fine. You are right that this setup here is a more advanced approach, but the work spent here gives you much more stability later on. Sorry for the later response- your anonymous posting landed in Spam ;-)

      Delete
  3. I would like name to be available to all users on the machine, so I put it in /Applications/mame instead of under my user home directory like you have. is this OK or will there be problems later?

    ReplyDelete
    Replies
    1. You are right, there is no real drawback, just the size of the directory - depending upon the amount of your roms and other data. I am unsure about the impact of a too large Apps directory. Alternatively you could place the directory under Users/shared - Ann all users would have access.

      Delete
  4. Is there any way of removing the Cabinets, Control Panel, PCBs, Ends, Bosses from the right column of MEWUI?
    Thanks!

    ReplyDelete

Any comments are welcome!