cosmo0
Posts: 2
Joined: Tue Mar 02, 2021 5:13 pm

Understanding LAY files

Hello

I'm trying to automate the porting of OrionsAngel's amazing MAME overlays (see here: https://forums.libretro.com/t/my-realis ... els/10604/ ) to Libretro overlay configs (which are much more basic), and for that, I need to understand the LAY files.

From what I can see, the Mame overlays configuration consist of two main files.

---

The first is a "[gamename].cfg" file for which I can't find any documentation. It usually looks like this:

Code: Select all

    <mameconfig version="10">
        <system name="altbeast2">
            <video>
                <screen index="0"
                        hstretch="0.606000"
                        voffset="0.008000" vstretch="0.656000" />
            </video>
        </system>
    </mameconfig>
I have no idea what these values represent. I assume they are multipliers, but for what? Screen resolution? Layout rendering? What are they used for?

---

The other important file is in a zip file (matching the rom name), and is called "default.lay". This one is a little bit documented ( http://wiki.mamedev.org/index.php/LAY_F ... s_-_Part_I ) but not much. The content seems pretty obvious: it defines elements to draw and then specifies where to draw them.

Below is the configuration taken from the Altered Beast overlay (source here: https://github.com/cosmo0/retropie-over ... tbeast.zip )

Code: Select all

    <mamelayout version="2">
    	<element name="nmva_widescreen">
    		<image file="altbeast.png" alphafile="mask.png" />
    	</element>
    	<view name="NMVA_Widescreen">
    		<bezel element="nmva_widescreen">
    			<bounds x="0" y="0" width="1280" height="720" />
    		</bezel>
    		<screen index="0">
    			<bounds x="232" y="54" width="816" height="612" />
    		</screen> 
    	</view>
    </mamelayout>
The problem is that I don't understand how the coordinates specified in the file match the image.

The "bezel" element seems to indicate that the screen should be in 720p. But applying the screen coordinates to the bezel resized in 720p makes the screen much larger that the area it's supposed to be in: https://ibb.co/jSjT9R

Multiplying the positions and/or sizes by the "stretch" and "offset" values from the first file does not come close to where the screen is supposed to be, so I'm assuming that's the wrong approach.

---

So my question is: what do all these numbers correspond to? How do I get the final screen's X/Y and width/height from these?

There has been a conversion effort here: https://github.com/libretro/RetroArch/pull/8529/files but it's much too complex for me to understand.

I'm assuming OrionsAngel overlay are correctly configured and work for everyone out of the box, but maybe that's where I'm wrong, and MAME overlay always require moving things around when you change your screen resolution?

Thanks for you help :)

Not sure if it's the right forum or I should post in https://forums.bannister.org/ubbthreads ... st&Board=1 ?
cosmo0
Posts: 2
Joined: Tue Mar 02, 2021 5:13 pm

Re: Understanding LAY files

I finally understood and made my own converter (not complete but it does what I needed)

https://github.com/cosmo0/mame-retroarc ... -converter

Return to “MAME Discussion”