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: Odd Bug with Modelines causing them to Break!  (Read 3361 times)

0 Members and 1 Guest are viewing this topic.

Dracrius

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:September 13, 2019, 06:32:53 am
  • Proud Builder of a MAME Cabinet!
Odd Bug with Modelines causing them to Break!
« on: September 02, 2019, 01:58:12 am »
I thought I had this figured out as I had 2 modelines acting weird but I could "trick" them back into working but the "trick" doesn't work any more and I have no clue why!

I setup my Monitor preset as follows
Code: [Select]
monitor "arcade_31", "Arcade 31.5 kHz - high resolution", "4:3"
        crt_range0 31400-93750, 49.50-75.00, 0.940, 3.770, 1.890, 0.349, 0.064, 1.017, 0, 0, 448, 1200, 0, 0

and it created a 960 and 1200 super res that where acting strange in that at 100% horizontal size, in the monitors OSD, a game would only filling 2/3 of the screen.

I don't understand the modeline settings so I just started playing around in Arcade OSD and I notice if I cranked any horizontal setting enough that the horizontal total became red and tested it, everything was suddenly better. Assuming red was bad I canceled saving and reopened the resolution to see if I could do it without going out of range but I didn't have to. After going out of range like that once without saving, the modeline started acting normal and I could adjust the monitor to make it fit.

I did this with both these modelines for 960 and 1200
Code: [Select]
"1600x960_60 63.00KHz 60.00Hz" 172.37 1600 1760 2408 2736 960 982 986 1050 -hsync -vsync
"1600x1200_60 78.78KHz 60.00Hz" 262.81 1600 1848 2840 3336 1200 1228 1233 1313 -hsync -vsync
and it worked perfectly but then I came across a game that was using 1280x960 and I noticed this resolution was acting the same. Unfortunately when I went to do the same procedure my screen went black and wouldn't come back after going out of range and hitting test. I had to restart the machine and even after a restart said modeline would black out the screen if opened so I used VMMaker to reset the modelines.
Code: [Select]
"1280x960_60 63.00KHz 60.00Hz" 138.10 1280 1408 1928 2192 960 982 986 1050 -hsync -vsync
Since then my "trick" now causes all three to black out and I cant figure out how to fix them. Playing with the Horizontal total of 1280x960 I could get it to fill the screen by cranking it to 6403 or something close which is strange because until that number changing the total squishes the image. But if I save that modeline Arcade OSD wont show that resolution at all the next time it opens so cranking that setting isn't the right solution either.

Weirdest part is based on all this I swear the modelines are set pretty well for my monitor but for some reason dont display correctly when first installed and I can nolonger trick CRT EmeDriver in to treat them as expected.

Calamity

  • Moderator
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 7463
  • Last login:July 01, 2025, 01:29:14 pm
  • Quote me with care
Re: Odd Bug with Modelines causing them to Break!
« Reply #1 on: September 02, 2019, 03:45:08 am »
Hi Dracrius,

Modeline math is not black magic, it's actually pretty simple arithmetic. You can't expect those tricks to work.

Instead of using the modeline editor in Arcade OSD, use its horizontal geometry adjustments. If you hit a problem there, let me know.
Important note: posts reporting GM issues without a log will be IGNORED.
Steps to create a log:
 - From command line, run: groovymame.exe -v romname >romname.txt
 - Attach resulting romname.txt file to your post, instead of pasting it.

CRT Emudriver, VMMaker & Arcade OSD downloads, documentation and discussion:  Eiusdemmodi

Dracrius

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:September 13, 2019, 06:32:53 am
  • Proud Builder of a MAME Cabinet!
Re: Odd Bug with Modelines causing them to Break!
« Reply #2 on: September 02, 2019, 01:03:46 pm »
Hi Dracrius,

Modeline math is not black magic, it's actually pretty simple arithmetic. You can't expect those tricks to work.

Instead of using the modeline editor in Arcade OSD, use its horizontal geometry adjustments. If you hit a problem there, let me know.

Thank you Calamity that helps a lot but I'm guessing some lack of knowledge is still holding me back I started editing the horizontal geometry but I seem to only shift it left or right I cant figure out how to make it wider.

I tried looking up crt Front porch and back porch and that results in a lot of home reno pictures haha. VGA sync got me a little further but at best I find explanations of how they relate to the signal and diagrams (unfortunately I have no documentation for this monitor). I can't find anything that explains their relation to screen geometry so I have no idea if I should be adjusting one setting, two in opposite directions, all 3 or what combination. Experimentation has only resulted in the same sized image sliding left or right.

I took a picture of what I'm working with if it helps with suggestions.

Calamity

  • Moderator
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 7463
  • Last login:July 01, 2025, 01:29:14 pm
  • Quote me with care
Re: Odd Bug with Modelines causing them to Break!
« Reply #3 on: September 02, 2019, 01:31:44 pm »
If you take a look, H-active is 9.27 μs (microseconds), while H-blanking is 6.60 μs. This means that 41.58% of your screen is dedicated to blanking (borders), which more or less matches your picture.

6.60 / (6.60 + 9.27) = 0.4158

So you have to reduce H-front porch and H-back porch, in the same proportion, and probably H-sync pulse too.

The reason VMMaker is producing borders that are too big in the first place is that your preset uses the same border size for all resolutions from 448 up to 1200. PC monitors expect VESA modes, an standard that use borders that are proportional to the resolution, which means higher resolution require smaller borders. The VESA presets do that automatically, so they should provide a better initial approach. If you want to use manual presets it's perfectly fine but you'll need to divide the range into several subranges per height and use horizontal timings that are smaller for the higher resolutions.

Important note: posts reporting GM issues without a log will be IGNORED.
Steps to create a log:
 - From command line, run: groovymame.exe -v romname >romname.txt
 - Attach resulting romname.txt file to your post, instead of pasting it.

CRT Emudriver, VMMaker & Arcade OSD downloads, documentation and discussion:  Eiusdemmodi

Dracrius

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:September 13, 2019, 06:32:53 am
  • Proud Builder of a MAME Cabinet!
Re: Odd Bug with Modelines causing them to Break!
« Reply #4 on: September 02, 2019, 02:04:58 pm »
If you take a look, H-active is 9.27 μs (microseconds), while H-blanking is 6.60 μs. This means that 41.58% of your screen is dedicated to blanking (borders), which more or less matches your picture.

6.60 / (6.60 + 9.27) = 0.4158

So you have to reduce H-front porch and H-back porch, in the same proportion, and probably H-sync pulse too.

The reason VMMaker is producing borders that are too big in the first place is that your preset uses the same border size for all resolutions from 448 up to 1200. PC monitors expect VESA modes, an standard that use borders that are proportional to the resolution, which means higher resolution require smaller borders. The VESA presets do that automatically, so they should provide a better initial approach. If you want to use manual presets it's perfectly fine but you'll need to divide the range into several subranges per height and use horizontal timings that are smaller for the higher resolutions.

Now that I can follow and I just figured out how to fix all 3 in both presets. Question is there one preset that is going to be better then another if I have to edit them both? I just tried the VESA preset because you do keep suggesting it but until now I didnt know how to fix the resolutions above or including 768. By default when changed like this
Code: [Select]
monitor "vesa_1024", "VESA GTF 1024", "4:3"
        gtf_range0 448, 480
        gtf_range1 480, 600
        gtf_range1 768, 1200
I got a  768+ resolutions that where to short when set at max vertical from my monitor OSD and from what I had read "vertical amplitude is usually not adjustable by tweaking these settings, only centering is possible in most cases." but just now I opened up 1600x1200 and it displayed correctly so I copied its Vertical Geometry Settings and set 960 to the same and it fit as well.
Code: [Select]
V front porch 1 ln
V sync pulse 3 ln
V back porch 38 ln

I'm not sure why it deaults crazy high for 1600x960 and 1280x960
Code: [Select]
V front porch 117 ln
V sync pulse 3 ln
V back porch 154 ln

I also know from your explanation how I can fix the same resolutions on my Arcade 31 preset but other then the fact that I have a bunch of resolutions already adjusted to match Arcade 31 I don't see a loss or benifit either way but I'm guessing there is still something wrong with using the Arcade  preset with my VGA CRT isn't their? Also is their a reason VESA makes really high front and back porch settings for 768+ resolutions and or am I doing anything wrong by setting them so low?
« Last Edit: September 02, 2019, 02:29:22 pm by Dracrius »

Calamity

  • Moderator
  • Trade Count: (0)
  • Full Member
  • *****
  • Offline Offline
  • Posts: 7463
  • Last login:July 01, 2025, 01:29:14 pm
  • Quote me with care
Re: Odd Bug with Modelines causing them to Break!
« Reply #5 on: September 02, 2019, 02:36:25 pm »
The thing is, VESA preset is a good initial approach but you don't have full control on borders, they just follow the standard. The change you made to the gtf_ranges is not correct, if you want to extend it to 1200 you should add more subdivisions. The issue with 960 is that it falls in the middle of one of the subdivisions so the adjustment will be poor. I'm seeing the default definition in VMMaker is wrong too, we have gtf_range1 repeated.

The advantage of a custom preset is that you have full control on borders, but you can't calculate 448 all the way up to 1200 with just one crt_range line, you need to split it in several ranges to get good results, it'll involve some work.
Important note: posts reporting GM issues without a log will be IGNORED.
Steps to create a log:
 - From command line, run: groovymame.exe -v romname >romname.txt
 - Attach resulting romname.txt file to your post, instead of pasting it.

CRT Emudriver, VMMaker & Arcade OSD downloads, documentation and discussion:  Eiusdemmodi

Dracrius

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:September 13, 2019, 06:32:53 am
  • Proud Builder of a MAME Cabinet!
Re: Odd Bug with Modelines causing them to Break!
« Reply #6 on: September 02, 2019, 02:55:09 pm »
The thing is, VESA preset is a good initial approach but you don't have full control on borders, they just follow the standard. The change you made to the gtf_ranges is not correct, if you want to extend it to 1200 you should add more subdivisions. The issue with 960 is that it falls in the middle of one of the subdivisions so the adjustment will be poor. I'm seeing the default definition in VMMaker is wrong too, we have gtf_range1 repeated.

The advantage of a custom preset is that you have full control on borders, but you can't calculate 448 all the way up to 1200 with just one crt_range line, you need to split it in several ranges to get good results, it'll involve some work.

Oh you're right the default VESA's do all have gtf_range1 twice. After fixing the range numbers the VESA Preset finally doesnt sem broken haha I wish I would have noticed that earlier I wouldn't have kept going back to arcade 31 as arcade 31 also twitches for the first few seconds after changing modes haha probably not a good sign.

Just to be clear thought this is what you mean and would suggest?
Code: [Select]
monitor "vesa_1024", "VESA GTF 1024", "4:3"
        gtf_range0 448, 480
        gtf_range1 480, 600
        gtf_range2 768, 1024
gtf_range3 1024, 1200

It appears to work far better and I apologize that I thought 1200 was still in the same range as 768 I have no clue how to tell what a range should be. Thank you again this has been extremely enlightening!

Dracrius

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:September 13, 2019, 06:32:53 am
  • Proud Builder of a MAME Cabinet!
Re: Odd Bug with Modelines causing them to Break!
« Reply #7 on: September 02, 2019, 03:13:44 pm »
I still had to edit The vertical geometry of 768 and 800 so I made them the same as 960
Code: [Select]
V front porch 29 ln
V sync pulse 3 ln
V back porch 60 ln
Should every resolution have different values?

Dracrius

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:September 13, 2019, 06:32:53 am
  • Proud Builder of a MAME Cabinet!
Re: Odd Bug with Modelines causing them to Break!
« Reply #8 on: September 02, 2019, 11:14:22 pm »
I thought I finally had it! I spent all day messing with VESA just for it to act strange in another way. I have to give up again tonight but now many of my games that use the same resolutions are treating said resolutions differently. I spent the day tweak 5 or 6 resolutions geometry in Arcade OSD and I thought that was it until I started testing games. If I don't figure out a cause I'll switch back to Arcade 31 again and just tweak the three larger resolutions that break.  :banghead:
« Last Edit: September 03, 2019, 12:55:30 am by Dracrius »

Dracrius

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:September 13, 2019, 06:32:53 am
  • Proud Builder of a MAME Cabinet!
Re: Odd Bug with Modelines causing them to Break!
« Reply #9 on: September 08, 2019, 10:00:17 pm »
I dont understand!!!! You keep suggesting I use Vesa but when I do it just breaks things. I get one step forward just to feel like I'm two steps behind. After editing Vesa to be perfect most games are making up their own modelines that don't match and it seems to be because every Vesa Modeline is written with a very small horizontal refresh range and a vertical refresh of 50.00-60.00. So any time a game uses something other then 60 Hz it creates a new modeline that isn't adjusted for. The Arcade 31 Preset does it as well but not to the same extreme. So I have no clue how in the world I'm supposed to set my monitor for every game as Arcade 31's modeline seems like it should cover a wider range "31400-31500, 49.50-65.00" but it still results in a different modeline for Bad Dudes at 57.4 Hz then for Karnov at 60 Hz  . My Monitor only seems to remember like 8 geometry settings, while refresh rates very like crazy how in the world do I make multiple refresh rates use the same modeline values?
« Last Edit: September 08, 2019, 10:08:47 pm by Dracrius »

Dracrius

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 64
  • Last login:September 13, 2019, 06:32:53 am
  • Proud Builder of a MAME Cabinet!
Re: Odd Bug with Modelines causing them to Break!
« Reply #10 on: September 09, 2019, 10:57:02 am »
Finally managed to make a preset that consistently generates modelines that match my screen adjustments so I can in theory add and remove resolutions without reseting everything and having to use Arcade OSD. Now GroovyMAME acts marginally better in that now the majority seem to launch using the correct modeline settings but I still have no sweet clue how to draft these stragling issue games into the modeline pool per say. I now have two examples with Bad Dudes and R-Type which both still seems to create their own freaking modelines. Bad Dudes should display the same as Karnov which works as expected and R-Type should be using the same resolution and modeline as 1942 (which displays correctly) but it generates it's own as well. I checked my mame.ini and it has all 10 modelines and is set to custom and I even copied it into into the ini folder to overwrite the copy there.
 
Super Res File
Code: [Select]
## Desktop ##

 1280 x 960 @ 60.000000 desktop
 1600 x 1200 @ 60.000000 desktop

## Super resolutions ##

1600 x 448 @ 60.000000 super
1600 x 512 @ 59.000000 super
1600 x 520 @ 59.000000 super
1600 x 544 @ 55.000000 super
1600 x 552 @ 60.000000 super
1600 x 560 @ 60.000000 super
1600 x 576 @ 60.000000 super
1600 x 640 @ 59.000000 super
1600 x 768 @ 60.000000 super
1600 x 960 @ 60.000000 super

Preset
Code: [Select]
monitor "vesa_1024", "VESA GTF 1024", "4:3"
crt_range0 31400-93750, 49.50-75.00, 0.684, 2.737, 3.285, 0.443, 0.102, 0.852, 0, 0, 448, 448, 0, 0
crt_range1 31400-93750, 49.50-75.00, 0.927, 2.317, 3.244, 0.445, 0.089, 0.949, 0, 0, 512, 512, 0, 0
crt_range2 31400-93750, 49.50-75.00, 0.914, 2.284, 3.198, 0.439, 0.088, 0.936, 0, 0, 520, 520, 0, 0
crt_range3 31400-93750, 49.50-75.00, 0.974, 2.165, 3.032, 0.473, 0.083, 0.974, 0, 0, 544, 544, 0, 0
crt_range4 31400-93750, 49.50-75.00, 0.976, 2.169, 3.036, 0.362, 0.084, 0.836, 0, 0, 552, 552, 0, 0
crt_range5 31400-93750, 49.50-75.00, 0.869, 2.174, 3.043, 0.278, 0.083, 0.723, 0, 0, 560, 560, 0, 0
crt_range6 31400-93750, 49.50-75.00, 0.848, 2.121, 2.969, 0.244, 0.081, 0.706, 0, 0, 576, 576, 0, 0
crt_range7 31400-93750, 49.50-75.00, 0.940, 1.519, 2.459, 0.562, 0.058, 1.163, 0, 0, 768, 768, 0, 0
crt_range8 31400-93750, 49.50-75.00, 0.768, 1.241, 2.010, 0.475, 0.048, 0.935, 0, 0, 960, 960, 0, 0
crt_range9 31400-93750, 49.50-75.00, 0.646, 1.093, 1.740, 0.013, 0.040, 0.510, 0, 0, 1200, 1200, 0, 0

Modelines Generated
Code: [Select]
""1280x960_60 63.12KHz 60.00Hz" 108.06 1280 1360 1496 1712 960 990 993 1052 -hsync -vsync
"1600x448_60 31.44KHz 60.00Hz" 63.63 1600 1640 1816 2024 448 478 481 524 -hsync -vsync
"1600x512_60 33.72KHz 60.00Hz" 69.06 1600 1664 1824 2048 512 527 530 562 -hsync -vsync
"1600x520_60 34.20KHz 60.00Hz" 70.04 1600 1664 1824 2048 520 535 538 570 -hsync -vsync
"1600x544_60 35.94KHz 60.00Hz" 73.89 1600 1672 1832 2056 544 561 564 599 -hsync -vsync
"1600x552_60 35.88KHz 60.00Hz" 73.77 1600 1672 1832 2056 552 565 568 598 -hsync -vsync
"1600x560_60 35.94KHz 60.00Hz" 73.61 1600 1664 1824 2048 560 570 573 599 -hsync -vsync
"1600x576_60 36.84KHz 60.00Hz" 75.45 1600 1664 1824 2048 576 585 588 614 -hsync -vsync
"1600x768_60 51.60KHz 60.00Hz" 110.63 1600 1704 1872 2144 768 797 800 860 -hsync -vsync
"1600x960_60 63.12KHz 60.00Hz" 135.33 1600 1704 1872 2144 960 990 993 1052 -hsync -vsync
"1600x1200_60 74.52KHz 60.00Hz" 160.96 1600 1704 1880 2160 1200 1201 1204 1242 -hsync -vsync
« Last Edit: September 09, 2019, 12:13:58 pm by Dracrius »