[GUIDE] Libretro MAME(current) hiscore, history, gameinit & command

How to: Make hiscores, history and commands work

This guide describes how to setup MAME (0.212 at the moment of writing) in RetroArch to save hiscores and make it possible to view game history and commands through the mame-menu.

With older MAME cores (e.g. mame2003) or FBNeo it is sufficient to place the respective hiscore.dat file in your /system/mame20xx or /system/fbneo folder, but current mame switched to a lua-based plugin system which requires a bit of manual-labour to make it work in RetroArch.

[INFO] In Linux , the path separator is / . In Windows , it is either \ or / .

Working on:

  • Windows 7
  • Linux Mint 19.2 cinnamon

(If this guide works on other systems as well, please let me know. I will eventually update this post)

1. Preparation

1.1. Download the mame plugins

You can either download the precompiled mame binary from https://mamedev.org
or you can download the source from https://github.com/mamedev/ or https://github.com/libretro/mame

[NOTE] The mame version has to match your current mame core in RetroArch.
other versions should work as well, but i havenā€™t tested this yet

1.2. Download history.dat and command.dat

The history.dat is found at https://www.arcade-history.com/index.php?page=download
and the command.dat can be downloaded from http://www.progettosnaps.net/command/

2. Setup

2.1. Creating of folders

In retroarch/system/mame/ create the following folders:

  • ini
  • plugins

2.2. Creating the right *.ini files

In your ini/ folder you should create the following files:

  • mame.ini
  • plugins.ini
  • ui.ini

[NOTE] plugins.ini is the only necessary file, but with mame.ini and ui.ini you can specify the location of your plugin/ folder and where your history/ and hi/ folders are generated.

[INFO] The history/ and hi/ folders are usually generated in the mame root path. On Windows this is your RetroArch main folder, but on Linux Mint it is your $home folder (/home/user/).
The plugins folder on Windows has to be in system/mame/plugins and on Linux also in your $home folder if no other path is specified.

3. Fill in the blanks

3.1. plugins.ini

Your file should look like this:

#
# PLUGINS OPTIONS
#
data                      1
hiscore                   1

3.2. ui.ini

Here you can define where the history.dat and command.dat should be placed. (full path)

#
# UI SEARCH PATH OPTIONS
#
historypath               I:\want\some\history

I usually put them in /system/mame/history

3.2.1. Another Folder

Now you have to create the folder you defined in the ui.ini. I will explain later, why you have to create this by yourself.

3.3. mame.ini

Here you have to specify the save location of your plugin folder (full path)

#
# CORE SEARCH PATH OPTIONS
#
pluginspath               I:\am\using\plugins

Same as above, i am using /system/mame/plugins as my path

4. Move things around

4.1. plugins

Now itā€™s time to move the content of the plugins folder from your previously downloaded mame release to your newly created plugin folder.

For hiscore history and commands you need only the following files/folders:

data/
hiscore/
boot.lua

4.2. history.dat & command.dat

Move your downloaded history.dat and command.dat in your history/ folder

5. Edit the hiscore plugin

To specify the save location of your hiscore files you have to edit the init.lua in the plugin/hiscore/ folder.

[NOTE] You have to redo this every time you update the plugins
There should be a possibility to override this with a hiscore.ini file, but i havenā€™t figured out how to make this work at the moment.

Change this line

25|	local hiscore_path = "hi";

to

25|	local hiscore_path = "I:\\am\\so\\hi";

As you see, you have to use the lua syntax and therefore you have to escape the backslashes on a Windows machine.
On Linux escaping is not needed.

[INFO] The escape character in lua scripts is \

On my setup it is /saves/mame/hi/

6. Configuring RetroArch

If you followed this guide so far, everything should run with default core settings (on Windows)
On Linux you have to enable Read configuration in the Quick Menu (donā€™t ask me why)

Now your high-scores will be saved correctly and you can view the history and commands ingame by opening the mame-menu (TAB on keyboard) and going to External DAT View

[INFO] In the mame-menu under Input (general) you can assign a hotkey on your controller for the mame-menu (Config Menu)

Input (general)
  ā”” User Interface
      ā”” Config Menu

7. Conclusion

Ofttimes people mentioned to enable Read configuration and Write configuration in

QUICK MENU
  ā”” Options

or your retroarch-core-options.cfg

mame_read_config = "enabled"
mame_write_config = "enabled"

or even in the mame.ini

#
# CORE CONFIGURATION OPTIONS
#
readconfig                1
writeconfig               1

but this is NOT needed. Read configuration is only needed on Linux (i donā€™t know why it works on Windows without, but not on Linux), Write configuration is in my opinion not needed at all in RetroArch.

read config will indeed generate the history/ folder, but if you create it by yourself, you donā€™t need to enable this (on Windows). I have no idea if this has other effects than this.

write config will produce for every game played a *gamename*.ini which is a complete mame.ini with every setting possible that overrides every future change you make in your settings.

This is highly unwanted and should therefore not be turned on

8. Closing words

This guide is not meant to be complete or to be 100% correct, but i think it is the right direction.

Also i am not a native English speaker :wink:

8 Likes

Hi , I followed your steps, but it doesnā€™t work in mame2016. Do you try it ever? Thanks a lot

Since i donā€™t use the mame2016 core i canā€™t really test if one of the methods above work.

As stated in the introduction, this guide is for mame 0.212+
For mame2003 it is sufficient to place the respective hiscore.dat file in your /system/mame2003 folder.

Both methods are working with the corresponding cores

After searching for 1min the web i read, that mame 0.173 was the first version introducing the lua plugins.
The libretro mame2016 core is based on mame 0.174, so the guide above should work. If not, than the libretro core is build without lua and therefore it is inpossible to make hiscores work.

Of course you have to download the plugins for the 0.174 version: https://github.com/libretro/mame2016-libretro/tree/master/plugins

[EDIT] mame2016 doesnā€™t work. I got some lua error, but canā€™t figure out how to fix it.

[LUA ERROR] D:\RetroArch\system\mame2016\plugins\boot.lua:7: module 'json' not found:
        no field package.preload['json']
        no file 'D:\RetroArch/plugins/json.lua'
        no file 'D:\RetroArch/plugins/json/init.lua'
        no file 'D:\RetroArch\json.dll'
        no file 'D:\RetroArch\..\lib\lua\5.3\json.dll'
        no file 'D:\RetroArch\loadall.dll'
        no file '.\json.dll'

Has anyone had any luck with .217 on Windows 10? Iā€™m fairly certain Iā€™ve followed all of the directions exactly and havenā€™t had any success.

Going to run through them from the start once more in hopes that maybe I missed something, but everything seems to be correct in my configs.

Is anything supposed to show up in the ā€œPluginsā€ MAME menu in-game? Itā€™s blank for me, so Iā€™m not even sure if my plugins are working.

That said, I can pull data from in-game menu via External DAT view, so something seems to be working, at least.

So far, Iā€™ve tried turning on ā€œRead Configurationā€ as well as ā€œWrite configurationā€, Iā€™ve also tried to move the hiscore.dat to the ā€œhiā€ directory and changing the path in the config lua, no luck there either.

Any suggestions, or should I just give up on it working in Windows 10?

Welcome @darkaegis, unfortunately i donā€™t have the possibility to test it on Windows 10 (still on Windows 7).
Mame 0.217 is now 3 days old and i didnā€™t had the time to update for now.

I will test it probably tomorrow now and post here if i discover if this is a win10 or a mame0.217 problem.

:wink: Yes (not really, donā€™t let you stop from such a little thing)

1 Like

Updated to Libretro MAME 0.217 (Windows 7)

[should work on other systems as well]

Maybe i missed something in the guide above, so here is a short checklist of the steps needed:

0. Default paths

  • Windows: Drive Letter:\Directory(s) of your choice\RetroArch\
  • Linux: ~/.config/retroarch/
  • Mac: I don't know :wink:

1. Directorys

  • system/mame/plugins/
  • system/mame/history/
  • system/mame/ini/

2. Downloads

3. INI files in system/mame/ini/ (note, this are my paths, you have to change them eventually)

  • mame.ini
#
# CORE CONFIGURATION OPTIONS
#
readconfig                1
writeconfig               0
#
# CORE SEARCH PATH OPTIONS
#
pluginspath               D:\RetroArch\system\mame\plugins
  • plugin.ini
#
# PLUGINS OPTIONS
#
data                      1
hiscore                   1
  • ui.ini
#
# UI SEARCH PATH OPTIONS
#
historypath               D:\RetroArch\system\mame\history

4. init.lua in system/mame/plugins/hiscore/

  • line 25 [NOTE the double backslashes]
local hiscore_path = "D:\\RetroArch\\saves\\mame\\hi";

5. MAME settings in-game

  • Run a game and enable Read configuration
Quick Menu
    ā”” Options
        ā”” Read configurations = ON

or in retroarch-core-options.cfg

mame_read_config = "enabled"

Donā€™t enable Write configuration as this creates a seperate *.ini file for every game played


Now everything should work.

In MAME Menu you should have an extra entry:
External DAT View
where you can see game history, control commands or information about gameinit if available.

The
Plugin Options
remains empty as none of the plugins used here have UI settings.

Hiscores will be saved in the location you defined in the init.lua

RetroArch
    ā”” saves
        ā”” mame
            ā”” hi
                ā”” game.hi (e.g. 1941.hi)
1 Like

I think, in the end, I was foiled by the naming of the ā€œplugin.iniā€. Went back and checked, and I had it named ā€œplugins.iniā€ - not sure if that was a change in .217 or what, but it was there. I shouldā€™ve noticed my MAME install wasnā€™t using that name, but I somehow never spotted it.

Followed your directions again, and in the meantime I changed my local hiscore path to my Google Drive so I can sync it between computers, and itā€™s working like a charm. I really appreciate the work you put into this, thank you so much!

1 Like

plugin(s).ini was my fault in the original Guide, but unfortunately i cannot edit it no more
(after a while posts canā€™t be editet anymore :frowning: )

1 Like

Can anyone help me get the ā€˜Autofireā€™ plugin working, as native autofire functionality was stripped out of MAME.

I have downloaded it, put it in my Retroarch\system\mame\plugins folder, added the plugins.iniā€¦tried renaming it to plugin.ini, set the path to plugins in mame.iniā€¦which Iā€™ve put in Retroarch\system\mame\ini

PLEASE HELP!

OK, Iā€™ve got the plugin to show up - I think I needed the ā€˜boot.luaā€™ file in the plugins folder.

Sadly now Iā€™m having trouble using the damn thing - when I click on the HOTKEY option in the menu, nothing happens, so I canā€™t actually make any buttons autofire!

Itā€™s such a pain in the arse that they removed the native functionality.

Luckily Iā€™ve managed to find an older core backup (MAME .215) which is one of the last releases to contain native autofire functionality.

Add this to your /retroarch/system/mame/ini/plugin.ini [without the (s) - it was a typo in the guide]:

#
# PLUGINS OPTIONS
#
autofire                  1

Now in the TAB menu you should have this (sorry the small resoluion):
1941j-200410-110538
1941j-200410-110542
1941j-200410-110548

Thanks for the guide ImnoTapLumber :+1:. In your experience, does FBNeo offer similar features to Mame OOTB? As in, all configurable within RetroArchā€™s Options? Hiscore support is the main thing for me but would prefer something that is straight forward to setup.

:slight_smile:

1 Like

For hiscore support you simply need to copy hiscore.dat to your setup as said in the documentation : https://docs.libretro.com/library/fbneo/#hiscores

2 Likes

Thanks. That seems fairly straight forward. Are FBNeoā€™s options within RetroArchā€™s Options or within itā€™s own GUI? (like Mame). Ideally, I would like to control everything from one place (RetroArch).

:slight_smile:

FBNeo doesnā€™t have an equivalent to MAME OSD, everything is done through RetroArch menus.

2 Likes

Could you please implement vrr (like gsync and freesync) to linux version mame current core? I would like it to work in batocera and currently it working correctly only in windows version.

Very nice. Happy to confirm that this works under MacOS with todayā€™s MAME current Libretro Core - 251! History.dat loads as well :-). Path separator under MacOS is like Linux.

However, hiscores are saved under ā€¦/system/mame/hiscore ā€¦ I think that has changed in MAME in overall.

Has anyone else tried following this guide with more recent builds of MAME? With the latest, .258, there seem to be some changes, fior instance the history.dat is now history.xml. And the lua init file also seems to have been reworked to pull the directories dynamically with a function instead of a hard coded path.

From looking at the lua, it does look like there are HiScore related menu options now, but they arenā€™t showing for me, though I do see the options related to the External DAT view and the Command and History tabs are there, so those portions are loading correctly.

Iā€™ve tried following this guide using the new xml file and took a stab at modifying the lua but the high scores are still not working for me. Iā€™m not really familiar with lua syntax so Iā€™m guessing my problem might lie there.

Hi @ArsInvictus,

this is what i tried today (fresh install retroarch+mame current):

  • Download https://github.com/libretro/mame/archive/refs/heads/master.zip
  • Extract the content of the plugins folder to RetroArch/system/mame/plugins/ (or your system path)
  • Start a Game with the mame-current core and enter Quick Menu (default [F1])
  • In Core Options - System enable Boot to OSD
  • Close mame and start again (restart seems not to work)
  • With [Tab] and the arrow keys [ā†][ā†‘][ā†’][ā†“] on your keyboard navigate to General Settings - Plugins and enable Hiscore support
  • Donā€™t forget to disable Boot to OSD
  • Done. Now the hiscores should be saved in /system/mame/hiscore/*

No more need to manually edit *.ini or *.lua files

1 Like