Build Your Own Arcade Controls Forum

Main => Software Forum => Topic started by: Nocturnaloner on February 20, 2016, 08:19:16 pm

Title: How do 'bounds' work in MAME .lay files?
Post by: Nocturnaloner on February 20, 2016, 08:19:16 pm
I've read the wiki, but it's not clicking for me yet: http://wiki.mamedev.org/index.php/LAY_File_Basics_-_Part_I (http://wiki.mamedev.org/index.php/LAY_File_Basics_-_Part_I)

Let's take Berzerk for example:

screen:
bounds x=604 y=740 width=2800 height=2100

bezel:
bounds x=0 y=0 width=4000 height=3475

Let's say I wanted to see more of the bezel on the screen, but not the whole thing.  If I changed the bezel to 3000 wide, 2606 high, what should the bounds be to keep it centered on the screen?
Title: Re: How do 'bounds' work in MAME .lay files?
Post by: headkaze on February 21, 2016, 06:18:10 pm
Check out the Simple Bezel Layout Generator v2.3 (http://mrdo.mameworld.info/mame_lay.php)
Title: Re: How do 'bounds' work in MAME .lay files?
Post by: nexusmtz on February 21, 2016, 08:48:57 pm
Let's say I wanted to see more of the bezel on the screen, but not the whole thing.

With the default .lay file, you should be seeing the entire bezel, unless you have cropping turned on. If you have cropping on, you'll be zoomed in so that the screen will be as large as it can be without it being cut off, and whatever you see of the bezel will be based on the game screen's size.

Think of berzerk.lay's Upright_Artwork view (with cropping off) as being zoomed 'out' all the way, and cropping as being zoomed 'in' all the way. If you want something in between, without messing up the relation between the screen and the bezel, then you want to set the view's bounds, not the bezel's.

So, if you were to open up berzerk_bezel.png in a paint program, and draw a rectangle over the part of the bezel that you do want to see, that rectangle's offset and size would be the bounds that you'd set for the view.

If I'm understanding what you're looking for, you want to see the middle 3000x2606 of the bezel, so your bounds line would be x=(4000-3000)/2, y=(3475-2606)/2, width=3000, height=2606

Code: [Select]
<view name="Upright_Artwork_partialzoom">
<bounds x="500" y="435" width="3000" height="2606" />
<screen index="0">
<bounds x="604" y="740" width="2800" height="2100" />
</screen>
<bezel element="bezel">
<bounds x="0" y="0" width="4000" height="3475" />
</bezel>
</view>

Note that on a widescreen, you'll still see more of the width than your bounds would suggest, because there's nothing defined on the sides of the view that would clip it.
Title: Re: How do 'bounds' work in MAME .lay files?
Post by: Nocturnaloner on February 21, 2016, 08:51:34 pm
Check out the Simple Bezel Layout Generator v2.3 (http://mrdo.mameworld.info/mame_lay.php)
Thanks, I'll give it a look!
Title: Re: How do 'bounds' work in MAME .lay files?
Post by: Nocturnaloner on February 21, 2016, 08:53:32 pm
Let's say I wanted to see more of the bezel on the screen, but not the whole thing.

With the default .lay file, you should be seeing the entire bezel, unless you have cropping turned on. If you have cropping on, you'll be zoomed in so that the screen will be as large as it can be without it being cut off, and whatever you see of the bezel will be based on the game screen's size.

Think of berzerk.lay's Upright_Artwork view (with cropping off) as being zoomed 'out' all the way, and cropping as being zoomed 'in' all the way. If you want something in between, without messing up the relation between the screen and the bezel, then you want to set the view's bounds, not the bezel's.

So, if you were to open up berzerk_bezel.png in a paint program, and draw a rectangle over the part of the bezel that you do want to see, that rectangle's offset and size would be the bounds that you'd set for the view.

If I'm understanding what you're looking for, you want to see the middle 3000x2606 of the bezel, so your bounds line would be x=(4000-3000)/2, y=(3475-2606)/2, width=3000, height=2606

Code: [Select]
<view name="Upright_Artwork_partialzoom">
<bounds x="500" y="435" width="3000" height="2606" />
<screen index="0">
<bounds x="604" y="740" width="2800" height="2100" />
</screen>
<bezel element="bezel">
<bounds x="0" y="0" width="4000" height="3475" />
</bezel>
</view>

Note that on a widescreen, you'll still see more of the width than your bounds would suggest, because there's nothing defined on the sides of the view that would clip it.

Ahhh!  Fantastic, that's exactly what I was looking for.  When I get back at it, I will see if I can apply the logic to another layout.  Oh, btw, my monitor is a 21.3" LCD, so it is a 4:3 monitor.
Title: Re: How do 'bounds' work in MAME .lay files?
Post by: nexusmtz on February 21, 2016, 11:14:29 pm
...open up berzerk_bezel.png in a paint program, and draw a rectangle

I should clarify that you'd need to scale the bezel's image to the element's stated bounds in order to get the right numbers in a paint program. In Berzerk's case, the png image is actually the same dimensions as its element's bounds (4000x3475) but that isn't always the case.

...so it is a 4:3 monitor.

Keep in mind that the closer your view's bounds are to the aspect of your monitor, the closer your display will match what you've asked for. In other words, you're telling MAME that it needs to show the middle 3000x2606 area of that bezel, which is narrower than 4:3. Since it's narrower, MAME will show some more of the bezel on each side to fill up the rest of the 4:3 image. That allows the same view to use as much of the display as possible, whether the monitor is 4:3, 5:4, 16:9, or 16:10.
Title: Re: How do 'bounds' work in MAME .lay files?
Post by: Nocturnaloner on February 24, 2016, 11:05:37 am

Code: [Select]
<view name="Upright_Artwork_partialzoom">
<bounds x="500" y="435" width="3000" height="2606" />
<screen index="0">
<bounds x="604" y="740" width="2800" height="2100" />
</screen>
<bezel element="bezel">
<bounds x="0" y="0" width="4000" height="3475" />
</bezel>
</view>

Note that on a widescreen, you'll still see more of the width than your bounds would suggest, because there's nothing defined on the sides of the view that would clip it.

I tried this, and right now it seems that the view bounds are not quite working as you intended.  The result is a game screen that is full screen, with a smaller bezel floating over it in the middle.  I'll add a screenshot when I can.
Title: Re: How do 'bounds' work in MAME .lay files?
Post by: nexusmtz on February 24, 2016, 04:09:59 pm
I tested that on Windows 7 64bit using the latest official mame64 binary (from mame0171b_64bit.exe (http://www.mame.net/downloader.php?file=mame0171/mame0171b_64bit.exe)). If you're using some other version, try it under the official one.

To test:Then, from a command prompt:If that works, look for differences between that and your setup. Also, please copy/paste or attach your layout file, and I'll try it on my system.
Title: Re: How do 'bounds' work in MAME .lay files?
Post by: Nocturnaloner on March 17, 2016, 01:31:25 pm
I tested that on Windows 7 64bit using the latest official mame64 binary (from mame0171b_64bit.exe (http://www.mame.net/downloader.php?file=mame0171/mame0171b_64bit.exe)). If you're using some other version, try it under the official one.

To test:
  • Extract the exe package above to a fresh directory c:\mame0171
  • Unzip berzerk.zip (http://mrdo.mameworld.info/artwork/berzerk.zip) into c:\mame0171\artwork\berzerk
  • Copy berzerk.zip rom to c:\mame0171\roms
Then, from a command prompt:
  • pushd c:\mame0171
  • mame64 -cc
  • notepad artwork default.lay
    • Paste the lines for the new view above line 15 (</mamelayout>)
    • Save
  • mame64 berzerk -view0 Upright_Artwork_partialzoom
If that works, look for differences between that and your setup. Also, please copy/paste or attach your layout file, and I'll try it on my system.

Thank you very much for taking the time to look at that, I really appreciate it!  I got fed up and worked on other issues before I realized my problem was that I stupidly made a /berzerk folder in my artwork folder that was taking precedence over the new zip files I was making.  Duh.  I'll get back to it and report my results.
Title: Re: How do 'bounds' work in MAME .lay files?
Post by: Nocturnaloner on April 29, 2016, 11:30:39 pm
I was able to make partial zoom views for other games using this example.  Basically, you make a backup of default.lay, then alter the view by inserting the width and height of what you want to be on the screen.  The bounds are 1/2 the difference between the full view and the partial view, as you said.  Not super intuitive,  but it works!