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: Success with MAME and custom refresh rates (no tearing)  (Read 14449 times)

0 Members and 1 Guest are viewing this topic.

teknikfrik

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 7
  • Last login:August 31, 2016, 05:42:43 am
Success with MAME and custom refresh rates (no tearing)
« on: September 19, 2013, 04:26:51 pm »
Hello there (first post, wall of text incoming),

I just wanted to write about my MAME setup that works without screen tearing and hopefully minimal lag for _some_ games.

It's basically a combination of running MAME in sync with the refresh rate, and making sure the games' refresh rates are available in my monitor settings. I haven't really found anyone describing a setup like that when googling. So here goes!

Computer setup:
Windows 8 64-bit
MAME64 0.149u1
DELL U2412M 16:10 LCD monitor (native resolution 1920x1200)
ATI HD4850

I'm using Custom Resolution Utility (cru 1.0.1) http://www.monitortests.com/forum/Thread-Custom-Resolution-Utility-CRU. With this utility I can add custom resolutions AND REFRESHRATES to my monitor settings.
What I did was select a few games that I want to run at 100% exactly, and check for their monitor refresh rates in the MAME game xml. There is a limit of 4 custom resolutions in CRU (probably Windows' fault). The games I currently use are:

(The numbers are from memory, but that's not really important.)
Mortal Kombat 54.5 Hz
ESP RaDe 57.55 Hz
Donkey Kong 60.60 Hz
I would've liked to use the neogeo refresh rate as well, but my monitor did not like it, so i had to use 59.95 Hz instead of 59.16(?).

These refresh-rates are added with CRU using the native resolution of my monitor, 1920x1200, on each entry, but with a different refresh rate for each entry (one for each game/system).

This is combined with the following MAME.ini settings:

throttle 0 (If this is not set to 0, no speeds over 100% will be allowed)
multithreading 0 (With mt on, syncrefresh seems to not work and run games at 400% and above)
syncrefresh 1
resolution 1920x1200  (This is important: I want to run the panel at native resolution always. And: when not specifying refresh rate, MAME selects the best available)
switchres 1 (MAME must actually switch the resolution/refresh-rate combination)

waitvsync 0
triplebuffer 0

Since syncrefresh will make sure the game runs in sync with the monitor, we can disable the other 'screen tearing'-fixes.

With this setup, there is a small delay when launching different games since the monitor must adapt to the new refresh rate.

This runs Mortal Kombat, ESP RaDe and Donkey Kong at 100% without audio glitching (like happens with waitvsync and triplebuffer for donkey kong). Other games that don't match exactly run at e.g. 101% (neo geo games).

I might improve on this by using these settings only for games that are confirmed to run at 100%, and use triplebuffer, throttling, and multithreading for games with refresh rates that my monitor does not accept.

When trying refresh rates on your monitor, some may not work. In that case, just exit MAME and it will revert back to your desktop refresh rate. Then use CRU to try a different refresh rate, reboot, and launch the game again.

For some reason, not all refresh rates between 57-61 Hz work even though those 'endpoints' work. I guess it's trial and error to get the 'perfect 4' refresh rates for the favorite games to run as close as 100% as possible.

Comments are welcome if you know how to improve on this :)
Made the MAME cabinet playable before it was finished... not quite finished, yet ;)

TheManuel

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 805
  • Last login:August 07, 2020, 10:15:48 am
  • On and off hobbyist
Re: Success with MAME and custom refresh rates (no tearing)
« Reply #1 on: September 20, 2013, 04:27:52 pm »
This is nice.  I saved the link to this post for when I buy an LCD monitor for my cab.  Thanks for taking the time to share.

Why did you need a custom resolution for Mortal Kombat?
I've never had any issues with that game, but maybe it is because I use triplebuffer and refreshspeed.
One game that is notorious for this kind of problem is Kung Fu Master.  With triplebuffer and refreshspeed you get rid of the screen tearing but introduce a bit of stuttering in the scrolling.  I probably don't notice this issue in MK because it hardly does any scrolling.
"The Manuel"

BadMouth

  • Trade Count: (+6)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 9226
  • Last login:April 26, 2024, 03:37:41 pm
  • ...
Re: Success with MAME and custom refresh rates (no tearing)
« Reply #2 on: September 20, 2013, 04:52:30 pm »
This is nice.  I saved the link to this post for when I buy an LCD monitor for my cab.  Thanks for taking the time to share.

Why did you need a custom resolution for Mortal Kombat?
I've never had any issues with that game, but maybe it is because I use triplebuffer and refreshspeed.
One game that is notorious for this kind of problem is Kung Fu Master.  With triplebuffer and refreshspeed you get rid of the screen tearing but introduce a bit of stuttering in the scrolling.  I probably don't notice this issue in MK because it hardly does any scrolling.

Triplebuffering adds lag which is not good for shmups (which are most susceptible to tearing because of the scrolling).
Not that I'm good enough for it to make any difference, but I'll give this method a go when my cab is finished and I'm fine tuning the little things.

I had horrible tearing in the NAOMI shmups using both Demul and Makaron.  Forcing triple buffer through my video card software fixed it, but I may have to revisit the issue and see if the refresh rate can be adjusted somehow.

teknikfrik

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 7
  • Last login:August 31, 2016, 05:42:43 am
Re: Success with MAME and custom refresh rates (no tearing)
« Reply #3 on: September 20, 2013, 06:40:58 pm »
Why did you need a custom resolution for Mortal Kombat?
Because I could ;) True, the animation fps in mortal kombat is far below the screen refreshrate, and there's not much scrolling. It was mostly a test of my monitor's refresh 'range' using one of the games with the lowest refresh rate in my game list - and as BadMouth mentioned, it should give less lag.

I might drop the MK-resolution to give me 1 more slot for some other refresh rate. Don't know which game I will try to sync with, though. I'll check the rest of the Cave shmups maybe.

But ESP RaDe was my main goal, and it works great =) With the monitor at 60Hz it would run at a smooth-scrolling 104% speed or with triplebuffer + lag/non-smooth-scrolling - both options felt less than ideal.
Made the MAME cabinet playable before it was finished... not quite finished, yet ;)

teknikfrik

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 7
  • Last login:August 31, 2016, 05:42:43 am
Re: Success with MAME and custom refresh rates (no tearing)
« Reply #4 on: September 23, 2013, 03:49:48 pm »
The biggest problem right now is that the refresh rate list is sometimes reset after reboot... Not always, but sometimes.. Any ideas?
Made the MAME cabinet playable before it was finished... not quite finished, yet ;)

marioxb

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 235
  • Last login:March 08, 2024, 01:54:31 pm
  • I want to build my own arcade controls!
Re: Success with MAME and custom refresh rates (no tearing)
« Reply #5 on: September 24, 2013, 10:07:57 am »
Is there a list somewhere of what resolutions a game uses? Or which games need custom resolutions to work properly? I heard Paperboy may be one of them? Does this only apply for LCD monitors?

gildahl

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 182
  • Last login:April 24, 2024, 09:14:07 am
Re: Success with MAME and custom refresh rates (no tearing)
« Reply #6 on: September 25, 2013, 04:32:46 pm »
I'd like to report that this does seem to work, and to thank the OP for the info.

Normally, I turn on vsync and autoframeskip whenever tearing is evident.  This has always cleaned up tearing and sound issues with no downsides that have ever seemed evident to me.  However, in 0.149 I discovered that certain games like Missile Command have trackball slowdown issues when vSync is turned on (I use vsync in MC due to tearing evident in the explosions--especially "The End").  Since Pokey sound in MC has been tweaked in 149, I wanted to "upgrade" but couldn't come up with a useable fix for the tearing.  The very next day I saw this post and tried it out.

I created a new entry in CRU at Missile Command's refresh rate and my monitor's native resolution (1920x1200) , then set the MAME options as instructed.  I also turned off vsync and autoframeskip.  Magically, this worked!  The tearing is gone and the trackball is back to normal.  It is too bad that only four resolutions can be configured, but since there are very few games with this particular problem, it's probably enough.

teknikfrik

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 7
  • Last login:August 31, 2016, 05:42:43 am
Re: Success with MAME and custom refresh rates (no tearing)
« Reply #7 on: September 27, 2013, 05:10:37 pm »
Cool gildahl :-)

I think I've solved my problem with Windows 8 resetting the refresh rates. Now I'm using a VGA cable with pin 12 removed (the EDID-pin). And after about 3-4 reboots, the resolutions are still there. Keeping my fingers crossed!
Made the MAME cabinet playable before it was finished... not quite finished, yet ;)

teknikfrik

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 7
  • Last login:August 31, 2016, 05:42:43 am
Re: Success with MAME and custom refresh rates (no tearing)
« Reply #8 on: September 27, 2013, 05:20:54 pm »
Is there a list somewhere of what resolutions a game uses? Or which games need custom resolutions to work properly? I heard Paperboy may be one of them? Does this only apply for LCD monitors?

Yes, you can generate an XML file which contains the refresh rates for all games by running:

mame.exe -listxml > list.xml

in the command prompt. (That's how I remeber it.. may be wrong ;) )
Made the MAME cabinet playable before it was finished... not quite finished, yet ;)

teknikfrik

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 7
  • Last login:August 31, 2016, 05:42:43 am
Re: Success with MAME and custom refresh rates (no tearing)
« Reply #9 on: July 13, 2016, 02:12:18 pm »
Wow... I just realized I read and followed the instructions from my own thread when googling last week after upgrading to Windows 10.

..and I didn't even realize it was my own thread  :laugh2:

A small update: In Windows 10 and with an ATI HD6970 I can use HDMI and still use custom resolutions without them resetting on reboot.

And in Mame 0.175 I can use multithreading without getting 400% speed as I mentioned in my original post.
Made the MAME cabinet playable before it was finished... not quite finished, yet ;)

Rataplan626

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:April 17, 2024, 03:44:12 am
  • I want to build my own arcade controls!
Re: Success with MAME and custom refresh rates (no tearing)
« Reply #10 on: January 10, 2017, 05:25:33 pm »
You might want to try my tool at http://forum.arcadecontrols.com/index.php/topic,152919.0.html which can switch resolution per game based on the refresh rate in mame.xml. You can use it to automate resolution / refresh rate switching so you'll have a perfect match for any game.