Skip to content

RFC: rework mess support for mame/lr-mame#15667

Draft
aderumier wants to merge 1 commit into
batocera-linux:masterfrom
aderumier:mess-refactor
Draft

RFC: rework mess support for mame/lr-mame#15667
aderumier wants to merge 1 commit into
batocera-linux:masterfrom
aderumier:mess-refactor

Conversation

@aderumier

Copy link
Copy Markdown
Contributor

This is a rework for old computers support in mame (mess).

The new code is using lua autoboot scripts to load floppy && cass (with fast cass loading when possible).
I have used https://github.com/dsync89/mess-curated-autoboot-scripts as base, but I have reworked a lot of scripts and write new one to handle auto-loading based on cassette headers or floppy disk structure, without relying of specific rom name.

The lua code is shared between mame && lr-mame, so it's remove a lot of spaghetti code in both generator.

It's re-introduce a fake "mess" core, to cleary split code between softlist (mess) && arcade/rom (mame), and avoid the need to rely on system.name.
(And also allow user to add new custom systems, compute or arcade, without need to hack the generatorsà

In mess mode, by default, a sha1 of the rom is done to compare to mame xml files, to detect the correct softlist and configure the machine && media. A new messSoftlistMap.json has been added, with all existing mess softlists and best compatible machine && media. It's possible to define custom options for each softmap in the json too.

(We could also add a new "MESS" system if needed, to allow user to put all obscures system games inside, it should work automatically if autodetected)

If no auto detection is found, it's search the default mapping from the system name. For this, A new messSystems.json is introduce to replace messSystems.csv, with mapping based on rom extension to a mess softlist.

I have tried to test all existing softlist (also for systems not existing in batocera), it should be pretty complete, but maybe I have missed something, so please review carefully.

@aderumier aderumier marked this pull request as draft May 2, 2026 12:28
@dmanlfc

dmanlfc commented May 2, 2026

Copy link
Copy Markdown
Collaborator

@bryanforbes was going to look at this for v44. Bryan, thoughts on the approach?

@bryanforbes

Copy link
Copy Markdown
Contributor

I’ll review it sometime this weekend

@aderumier

Copy link
Copy Markdown
Contributor Author

I’ll review it sometime this weekend

don't hesitate to ping me if you have any question about the implementation

@dmanlfc

dmanlfc commented May 9, 2026

Copy link
Copy Markdown
Collaborator

Why use lua? Why not just python as per configgen? Id prefer that if possible.

@Tovarichtch

Copy link
Copy Markdown
Collaborator

iirc this is what MAME uses. lua is mainly their own scripting system.

https://docs.mamedev.org/luascript/index.html

@aderumier

Copy link
Copy Markdown
Contributor Author

Why use lua? Why not just python as per configgen? Id prefer that if possible.

lua is the internal language of mame for mame autoboot scripts, I have verify they are no python support inside mame.

@dmanlfc

dmanlfc commented May 16, 2026

Copy link
Copy Markdown
Collaborator

i'm aware of that but configgen is python and if the configuration can be done in python, that is the preference ideally...

@aderumier

Copy link
Copy Markdown
Contributor Author

i'm aware of that but configgen is python and if the configuration can be done in python, that is the preference ideally...

no, you can't really do same work outside mame with basic sent autoload command like we currently do in v42. For example fast cassette loading.

for example : send command "LOAD ...", play tape, speed tape motor to max speed until load it's finished, restore motor speed normal, sent command "RUN"

This is really a basic example, they are more complex loader with parsing the cassette header to find the correct command to launch, parse disk content ,etc.. depending of each systems, it need really fine tuning.

@Tovarichtch

Tovarichtch commented May 16, 2026

Copy link
Copy Markdown
Collaborator

Main configgen must remain python, but MAME is using its own lua scripting langage. I've done something similar here to enable offscreen reload helper (newly introduced): https://github.com/batocera-linux/batocera.linux/blob/master/package/batocera/emulators/mame/009-offscreenreload-autoconfig.patch

I didn't check the current PR, I'm just throwing what I know about MAME. On first look, it seems bloated.

@aderumier

Copy link
Copy Markdown
Contributor Author

Main configgen must remain python, but MAME is using its own lua scripting langage. I've done something similar here to enable offscreen reload helper (newly introduced): https://github.com/batocera-linux/batocera.linux/blob/master/package/batocera/emulators/mame/009-offscreenreload-autoconfig.patch

I didn't check the current PR, I'm just throwing what I know about MAME. On first look, it seems bloated.

sure, the main configgen in in the python code, this is only the autoloading script that are in lua.
it's replacing the old "autoboot_command=.... && -autoboot_delay=.." (that what defined in both messsystem.csv + python generator too, depending of systems, with some tricks by system).

Now, all the differents systems options are all defined in the json + the autoloading part in lua. (with big improvements like reading cassette headers or list diskette catalog find correct command to launch)

and they are no duplicate code between mame && libretro mame anymore. (where it was missing sometimes some feature on 1 side or the other)

This is a rework for old computers support in mame (mess).

The new code is using lua autoboot scripts to load floppy && cass
(with fast cass loading when possible).
I have used https://github.com/dsync89/mess-curated-autoboot-scripts
as base, but I have reworked a lot of scripts and write new one to handle auto-loading based
on cassette headers or floppy disk structure, without relying of specific rom
name.

The lua code is shared between mame && lr-mame, so it's remove a
lot of spaghetti code in both generator.

It's re-introduce a fake "mess" core, to cleary split code between
softlist (mess) && arcade/rom (mame), and avoid the need to rely
on system.name.
(And also allow user to add new custom systems, compute or arcade, without need to hack the generatorsà

In mess mode, by default, a sha1 of the rom is done to compare to mame xml files,
to detect the correct softlist and configure the machine && media.
A new messSoftlistMap.json has been added, with all existing mess softlists and best compatible machine && media.
It's possible to define custom options for each softmap in the json too.

(We could also add a new "MESS" system if needed, to allow user to put all obscures system games inside, it should
work automatically if autodetected)

If no auto detection is found, it's search the default mapping from the system name.
For this, A new messSystems.json is introduce to replace messSystems.csv,
with mapping based on rom extension to a mess softlist.
@aderumier

Copy link
Copy Markdown
Contributor Author

Just have done a push . I have refactored the lua scripts to move zip parsing code to a common function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants