Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
08384 Plugins Minor Always Jul 26, 2022, 14:08 Aug 1, 2022, 17:17
Tester hap View Status Public Platform MAME (Official Binary)
Assigned To Resolution Open OS Windows 10/11 (64-bit)
Status [?] Acknowledged Driver
Version 0.245 Fixed in Version Build 64-bit
Fixed in Git Commit Github Pull Request #
Summary 08384: mdndclab: Internal artwork luascript does not work
Description mdndclab internal artwork luascript does not work, no error message, it simply does nothing.
I assume the regression is due to the luascript refactors.
Steps To Reproduce mame.exe mdndclab -plugin layout
click between the board buttons, it should toggle (appear/disappear) rectangles there.
Additional Information
Github Commit
Flags
Regression Version 0.227
Affected Sets / Systems mdndclab
Attached Files
 
Relationships
There are no relationship linked to this issue.
Notes
5
User avatar
No.20410
hap
Developer
Jul 26, 2022, 21:17
plugins/layout/init.lua
local function prepare_layout(file, script) is called twice

Meaning, 2 same scripts get loaded (and will run) in parallel. There's a bug somewhere in MAME causing the script to be loaded twice.
Since the script for mdndclab is for toggling outputs by clicking, it will instead strobe them.
User avatar
No.20411
hap
Developer
Jul 26, 2022, 22:10
As workaround, at line 17 in plugins/layout/init.lua (under local function prepare_layout(file, script)) add:
scripts = {}

But the real bug is, it shouldn't call this function twice.
User avatar
No.20412
hap
Developer
Jul 27, 2022, 12:35
How to show that it really is running 2 scripts in parallel:
open chessmstdm.lay
add a local count var, increment it each frame, and do:
emu.print_error(tostring(count))

result:
1
1
2
2
3
3
4
4
User avatar
No.20413
hap
Developer
Jul 27, 2022, 12:45
Ah, now I see why. It's because the snapshot 'target' loads the script too.
So, do for example: mame mdndclab -numscreens 2
Now it loads 3 scripts, each wall click will do toggle->toggle->toggle, and since it's an uneven amount it will work in this case.

In other words: layout scripts should be wary about globals? Such as a shared output tag.
User avatar
No.20414
Bletch
Developer
Jul 27, 2022, 22:41
In my opinion the problem is the contortions that the layout script goes through to set up mouse clicks.

Even if there are multiple layouts (and corresponding script instances) loaded for each screen, and even a "bogus" one for snapshots, the problem is that they all on their own try to monitor the mouse and figure out when (and where) clicks occur - exhibit A; the `get_mouse` function in mdndclab.lay

Layout scripts should have a clean, consistent mechanism to receive click events without looking at uimouse or having to do anything for aspect ratios. That way, if one has multiple screens open, and the user clicks on one of the windows, the script instances for the other windows (and the snapshot target) don't independently respond to the event.

I might just try to whip up a POC