So here’s a solution for everyone looking to get switchres working.
- Connect Raspberry Pi to the external monitor without using any kind of scaling adapter. The thing that worked for me was the Gert VGA HAT. Depending on your CRT’s input capabilities you’ll convert this into SCART / Component / S-Video.
- You’ll use custom display mode and for that you’ll need to make one and enforce it
- sudo vim /boot/firmware/config.txt
- Use this code with KMS driver: Careful! Lines over 80 characters are ignored)
dtoverlay=vc4-kms-dpi-generic,rgb666,clock-frequency=4898400
dtparam=hactive=256,hsync-invert,hfp=7,hsync=23,hbp=28
dtparam=vactive=240,vsync-invert,vfp=27,vsync=2,vbp=4
- Alternatively with fkms you can use
dpi_group=2 # Legacy alternative
dpi_mode=87 # Legacy alternative
dpi_timings=256 1 7 23 28 240 1 27 2 4 0 0 0 50 0 4898400 1 # Legacy alternative: https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html
- For the splash logo:
sudo vim /boot/firmware/cmdline.txt
console... ... rootwait quiet splash video=DPI-1:256x240@50e
- Now you’ll notice with or without switchres, your CRT will look pixel perfect. So for NES and SNES, with this setup you’ll not need it. The time when you’ll really need it is when you play multiple consoles which require switching the timings on the run. Switchres can be turned on with mode set to 15Khz or 30KHz etc. or INI. I setup my monitor as “pal” in /etc/switchres.ini
- For the video settings, I use aspect ratio to “full” or core provided.
Background info:
git clone https://github.com/libretro/RetroArch
cd RetroArch/deps/switchres
make
To calculate display timings / modeline:
./switchres 246 240 50 -m pal -c -vvvv # pal CRT: Modeline "246x240_50 15.600000KHz 50.000000Hz" 4.711200 246 253 275 302 240 267 269 312 -hsync -vsync
# leaving NTSC as a homework.
./switchres 246 240 50 -m generic_15 -c -vvvv # generic_15 CRT: Switchres: Modeline "246x240_50 15.650000KHz 50.000000Hz" 4.992350 246 256 279 319 240 268 271 313 -hsync -vsync
Adapt modeline to FKMS dpi_timings or KMS dtparam. Use Chat-GPT with care to adapt.
PS: Happy to share any details upon request.