Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: How do 'bounds' work in MAME .lay files?  (Read 6313 times)

0 Members and 1 Guest are viewing this topic.

Nocturnaloner

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 212
  • Last login:May 05, 2016, 12:39:53 pm
  • AARRRRcade!
How do 'bounds' work in MAME .lay files?
« 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

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?

headkaze

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2943
  • Last login:August 14, 2023, 02:00:48 am
  • 0x2b|~0x2b?
Re: How do 'bounds' work in MAME .lay files?
« Reply #1 on: February 21, 2016, 06:18:10 pm »

nexusmtz

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 489
  • Last login:June 01, 2022, 03:14:22 am
Re: How do 'bounds' work in MAME .lay files?
« Reply #2 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.

Nocturnaloner

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 212
  • Last login:May 05, 2016, 12:39:53 pm
  • AARRRRcade!
Re: How do 'bounds' work in MAME .lay files?
« Reply #3 on: February 21, 2016, 08:51:34 pm »

Nocturnaloner

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 212
  • Last login:May 05, 2016, 12:39:53 pm
  • AARRRRcade!
Re: How do 'bounds' work in MAME .lay files?
« Reply #4 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.

nexusmtz

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 489
  • Last login:June 01, 2022, 03:14:22 am
Re: How do 'bounds' work in MAME .lay files?
« Reply #5 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.

Nocturnaloner

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 212
  • Last login:May 05, 2016, 12:39:53 pm
  • AARRRRcade!
Re: How do 'bounds' work in MAME .lay files?
« Reply #6 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.

nexusmtz

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 489
  • Last login:June 01, 2022, 03:14:22 am
Re: How do 'bounds' work in MAME .lay files?
« Reply #7 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). 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 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.

Nocturnaloner

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 212
  • Last login:May 05, 2016, 12:39:53 pm
  • AARRRRcade!
Re: How do 'bounds' work in MAME .lay files?
« Reply #8 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). 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 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.

Nocturnaloner

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 212
  • Last login:May 05, 2016, 12:39:53 pm
  • AARRRRcade!
Re: How do 'bounds' work in MAME .lay files?
« Reply #9 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!