Force custom native resolution in RetroArch

Hi, I’m running Fuse and Retroarch for ZX Spectrum. My Windows 10 machine is connected to Sony PVM 15KHz TV with AMD GPU. Windows 10 resolution offers: 256x192 resolution - that should be native for this machine.

But RetroArch always runs at 240p (eg super resolution of 2560x240 or native 320x240)

So the image has borders and does not reflect the native resolution.

I’m software developer, can I touch the source code somewhere or is there some parameter to force RetroArch to switch to resolution below 200p?

Settings -> Video -> Fullscreen always changes resolution on primary display (monitor #0), while Retroarch is always running on monitor #1 and is configured like that (this might be Retroarch bug - it should set fullscreen resolution of monitor it is configured for in its settings)

Other stuff seems to work. I tried to experiment with disabling Fuse video border, but that only stretch display horizontally. I tried both PAL and NTSC bioses. I tried core ratio provided and 4:3 ratio.

The borders in Fuse are native to the machine, except actually less, considering it’s mostly a PAL machine, and games are coded for the aspect ratio in mind (the 256x192 games use isn’t actually supposed to be 4:3).

To enlarge the 256x192 screen, you would have to have a custom resolution (modeline) at higher refresh rate. Probably unlikely that you can do much with 50 Hz natural refresh, maybe with extensive monitor controls that allow stretching.

As for actually forcing these, I usually just open up RA with the resolution I need (there are tools that help with desktop switching), or change afterwards from the primary monitor, while RA is running. I use CRU with Windows.

You can use Spectrum 48K (NTSC) BIOS to have 60 Hz.

CRT EmuDriver have this modeline by default. Yes, I have that as a custom resolution at 60 Hz and have NTSC BIOS. I look into source code and when using NTSC BIOS it will do 60 Hz.

The actual question that comes to my mind: Sony PVM is probably natively 240p or 640i. So it cannot natively display 256x192 resolution right? What TV would natively display ZX Spectrum resolution through RGB (RGBHV) or YBGRB cable?

I enabled debug and if you have Fuse borders set to full it will ask for: 320x240

if you have border none it will ask for: 256x192

I don’t need to use CRU. I have CRT EmuDriver, it have this utility VMMaker.

The result look like this:

Other RetroArch emulators: Amiga (PAL & NTSC), NES, SNES, DosBox look ok and do switch correctly to original native resolution.

Overscan on earlier TV’s (like 80’s) was bigger. It’s unlikely to find one that’s by default set up to only display 192 lines though. Borders were supposed to be part of the image, sometimes developers could also do effects in that area which is why any emulator worth it’s salt will include them.

The picture your PVM displays is what I would expect. Cropping borders can be convient for emulation, it’s more something for LCDs though. You have some flexibility in the horizontal direction with the way modelines can be set up so borders can be made less visible, but that won’t work that good in the vertical direction.

You see that both of your modelines end with 261 total lines. You would have to try and lower that, to see if the image get’s bigger. This will of course move you away from NTSC spec, and more in a custom direction. Tvs also can have service menus where V-Size can be increased, I would expect a PVM to have something similar, maybe an actual knob.

Well, it can use both NTSC or PAL, but NTSC always looks better on Sony PVM as it can cover the whole area.

Yes, this is a professional CRT TV from broadcasting studio, it has a lot of settings, but no knobs. Everything is accessible through service menu using a combination of buttons and there is like 200 individual settings. But that settings will affect also other RetroArch emulators and resolutions.

When I boot to standard RetroArch or use different core, the RetroArch menu will span across whole TV display correctly.

I guess I will try to tweak it, or just ignore the big frame and play it on 320x240 or try JVC TV with S-Video and video switcher to choose between Sony (RGB) and JVC (S-Video)

I think I start to understand.

Testing Commodore C64 now: [INFO] [CRT]: Requested Resolution: [email protected]

This resolution is outside of 320x240, so it will choose the closest 640x480 and it is very very ugly.

If in core menu you choose core crop: automatic, then it will request this: [INFO] [Environ]: SET_GEOMETRY: 320x200, Aspect: 1.200. [INFO] [CRT]: Requested Resolution: [email protected]

And it will switch to 320x240 with 20px border at the top and 20px border at the bottom (there is still some border on left and right, so the crop is not the best it could be).

Now a couple of questions:

  1. Where is documentation about this? Documentation about core setup for native CRT resolution? This should be on your RetroArch Wiki.

  2. In General Settings of RetroArch I already have crop enabled and aspect ratio: core provided. Yet it does not work, mostly. All these cores I need to setup and fix manually and even so, the result is still mediocre.

  3. Because all the cropped core resolutions will in the end use 320x200 or 320x240 and will not directly output native resolution, when tweaking “knobs” on CRT monitor, it will remember them for these resolutions. The only thing I could think of is adding custom resolution for all these modelines. Then tweaking it on CRT further, so it will get associated with that modeline inside CRT monitor firmware. And on top of that you need to take care of per core crop settings.

Is this the way to go or where can I get this knowledge from someone, who actually uses RetroArch for more than one emulator?

I think you are getting hung up on the term “native resolution” and because you want to do stuff that actually doesn’t occur on the real hardware. A real C64 does not fill a CRT screen, certainly not with the PAL resolution (384x272") that’s requested by default. It has borders on the left and right and top and bottom. Working with cropping makes sense on a hi-res LCD where you use (integer) scaling, on a CRT it’s usually not supposed to be that way. However it is possible to do various things with custom modelines and the scaling options of RA.

For example you can have two different super resolution modelines, one for NTSC (240p), and one for PAL (288p). Then, what you need to do is use the custom aspect ratio. I think core provided is something you would use with switchres. Anyway, switching back to the integer settings displays the resolution of a core and the numbers by which it’s multiplied. Vertically,it should display 272 by default for PAL C64 (you should probably also turn pixel aspect to 1:1 in the core options, I forgot if this is necessary). Now, you can of course inaccurately crop, or scale (like e.g. you have no more borders), or use the 240p NTSC modeline. In the latter case the 272px lines are still there, you just won’t see all of them, of course.

There are few caveats in your answer:

  1. When using CRT SwitchRes feature of RetroArch, changing aspect ratio or using integer scaling does not do anything. It is precalculated and pre-set by the core based on core native resolution and current modeline. Therefore it is not possible to tweak these!

  2. Many people got headaches with this, there is no documentation and here people filled even some bugs for RetroArch regarding this: https://forum.batocera.org/d/5865-scaling-all-games-properly-with-retroarch-on-a-crt-tv-screen/2

I am still investigating it. Currently, what works the best for me is using desktop resolution of 704x576 or 640x480 and disabling CRT SwitchRes for that particular core using core overrides. Then it will scale and display more correctly.

The PAL 576 looks better, but there is some issue with interlaced resolution. Each second frame in RetroArch has Y+1 position, therefore whole image is shaking. I think this could be fixed from code or maybe tweaking some modeline stuff (I’m currently trying that).

I don’t need to use super resolutions. The behavior is the same.

I think I need switchres.ini and custom config: https://docs.libretro.com/guides/crtswitchres/ <-- this is outdated and the options for porch settings are still not implemented? I think someone should update SwitchRes to the latest. Update documentation, etc. This invalid state of RA SwitchRes is here like for 2 years already. I was looking into this several times before.

Confirmed: The issues are due to tech debt in RetroArch.

For example, it always uses arcade_15 monitor type, even I set and generate modelines for arcade_15ex in AMD CRT EmuDriver.

You need to manually create switchres.ini and tweak some stuff: # # Switchres config #

# Monitor preset. Sets typical monitor operational ranges:
#
# generic_15, ntsc, pal                    Generic CRT standards
# arcade_15, arcade_15ex                   Arcade fixed frequency
# arcade_25, arcade_31                     Arcade fixed frequency
# arcade_15_25, arcade_15_25_31            Arcade multisync
# vesa_480, vesa_600, vesa_768, vesa_1024  VESA GTF
# pc_31_120, pc_70_120                     PC monitor 120 Hz
# h9110, polo, pstar                       Hantarex
# k7000, k7131, d9200, d9800, d9400        Wells Gardner
# m2929                                    Makvision
# m3129                                    Wei-Ya
# ms2930, ms929                            Nanao
# r666b                                    Rodotron
#
# Special presets:
# custom   Defines a custom preset. Use in combination with crt_range0-9 options below.
# lcd      Will keep desktop's resolution but attempt variable refresh, use in combination with lcd_range
#
	monitor                   arcade_15ex                   

It also allows you to disable interlaced modes. Now I need someone with CRT skills, who is not here, and explain how to adjust a specific modeline values, so that interlaced vertical refresh rate is not shaking on Sony PVM as all these monitor types are generated with a specific frequencies and Sony PVM manual states a little bit different values.

Sony PVM is the gold standard in retrogaming and RetroArch. It should be FINALLY supported out of the box.

I found the bug and solution. Switchres is by default using monitor setting: ‘arcade_15’

Which results in this: [INFO] Switchres: Modeline “704x576_50i 15.677190KHz 50.006985Hz” 14.344628 704 733 800 915 576 583 589 627 interlace -hsync -vsync

If you create switchres.ini (from the doc link) and set monitor to ‘pal’ It will use this modeline and it will work: [INFO] Switchres: Modeline “704x576_50i 15.625000KHz 50.000000Hz” 13.531250 704 724 788 866 576 582 587 625 interlace -hsync -vsync

The best thing would be to switch between monitor type ntsc and pal in switchres.ini and don’t use arcade_15 unless you really have the original arcade unit display.

and it is even better to use: interlace 0

…created Github issue here: https://github.com/libretro/RetroArch/issues/14441

I have recorded a video describing the bug as well as providing a solution: https://www.youtube.com/watch?v=Xv5u-JPKDS0

It is in both SwitchRes and RetroArch SwitchRes dependency (they use the code and not dll, so they are even behind).

This applies to all TVs and all 15kHz monitors that handle both NTSC+PAL such as Sony PVM.

Keywords from Google searches (hundreds of forum threads):

  • flaky interlaced resolution 480i or 576i
  • shaking 480i on Sony PVM
  • shaky interlaced modeline
  • CRT EmuDriver setup on Sony PVM
  • RetroArch with Sony PVM
  • RetroArch with CRT native resolution