New CRTSwitchRes v2.0 for RetroArch

VGA-2-RGB adapter (that generates the combined sync signal on it´s own)

Tell me more.

Maybe my description is kind of misleading. The Raspberry Pi (as well as the MiSTer hardware) are able to output a combined sync signal when configured correctly, so that further discrete hardware is not needed (tested with tons of modelines with the RPi before when I had played around with retropie and a special startup script - that unfortunately just allows one modeline per emulator).

While MiSTer uses a (free) VGA pin, the Raspberry Pi can output the csync signal on GPIO1/pin28. To enable this, you have to add dpi_output_format=0x105 to your config.txt as described in the link above - see https://www.raspberrypi.org/documentation/hardware/raspberrypi/dpi/README.md (“output_enable_mode -> 1: DPI_OUTPUT_ENABLE_MODE_COMBINED_SYNCS”) for detailed information on this parameter.

However, just to emphasize this again:

  • This cable does not work with hardware other than RPis (also does not work on PCs!). You normally have to use a cable/hardware with an additional circuit to combine the H- and V-Sync signals and maybe also add +3V/5V to certain scart pins. See e.g http://www.geocities.ws/podernixie/htpc/cables-en.html for details (because the solution with the resistors did not work, I am going to give the circuit with the 4070-IC a try within the next weeks to be able to test PC-VGA - or buy the ready-made VGA-2-Scart solution from arcadeforge).
  • There are apparrently limitations (unfortunately not further analyzed/documented) regarding the pixel clock generation on RPi 0-3 that seem to be solved on RPi 4 - see the post by LewisGamer from 07/03/2019 from the firmware issue link posted above.
1 Like

@Alphanu @hunterk (and also Nikoh77 and Scanlitzer),

I had a closer look on the reason why the image is shifted to the right (in my case) with CRTSwitchRes v2.0, showing a clearly visible border on the left on my consumer JVC CRT TV, especially because I haven´t had this problem with tons of modelines/hdmi_timings I have tested before. Furthermore, the system menu of my TV does not allow to move the image thus far to the left - and I also don´t know if it makes sense to change the default global values in general because it also modifies the image shift of all other input sources…

I currently use these retroarch settings:

  • crt_switch_center_adjust = “0”
  • crt_switch_resolution = “1”
  • crt_switch_resolution_super = “1920”
  • crt_switch_resolution_use_custom_refresh_rate = “true”
  • crt_video_refresh_rate = “60.000000”

I played around with different emulators and roms from different regions, and they all had this shift to the right. This is clear to me, because the horizontal front porch value always stays at 80 (see calculations in lines 324-328 in video_crt_switch.c), e.g.:

  • vcgencmd hdmi_timings 1920 1 80 224 465 256 1 20 3 34 0 0 0 50 0 42082848 1 (PSX - EU)
  • vcgencmd hdmi_timings 1920 1 80 224 465 224 1 10 3 24 0 0 0 60 0 42179800 1 (NES - World)
  • vcgencmd hdmi_timings 1920 1 80 224 465 224 1 10 3 24 0 0 0 59 0 42055520 1 (Genesis - US)

Using the values calculated for the RGUI, I played around with the crt_switch_center_adjust value:

  • 0: vcgencmd hdmi_timings 1920 1 80 224 465 240 1 28 3 42 0 0 0 50 0 42082848 1
  • -4: vcgencmd hdmi_timings 1920 1 80 240 465 240 1 28 3 42 0 0 0 50 0 42333248 1
  • +4: vcgencmd hdmi_timings 1920 1 80 208 465 240 1 28 3 42 0 0 0 50 0 41832448 1
  • 40: vcgencmd hdmi_timings 1920 1 80 64 465 240 1 28 3 42 0 0 0 50 0 39578848 1

As you can see, only the horizontal sync signal length is modified by the crt_switch_center_adjust value, but as also Nikoh77 wrote, this does not seem to alter anything regarding the horizontal positioning.

In fact, this approach in fact seems to be wrong, because in my opinion, the front porch and back porch would have to be changed instead. Therefore, to get a centered picture, I would have to change the front porch and back porch as follows for my TV:

  • from: 1920 1 80 224 465 240 1 28 3 42 0 0 0 50 0 42082848 1
  • to: 1920 1 195 224 350 240 1 28 3 42 0 0 0 50 0 42082848 1

As you can see, while the sync signal length stays the same, the front porch is increased by 115 while the backporch is lowered by the same value.

This also works for the vertical positioning btw.

For further tests and maybe as a proof that this is the right way to handle this, I found a link to a video timings generator script by Frank Skilton from 2017 at https://drive.google.com/file/d/0B10JEKHkXafmajlWbVcyTEVzdGM (apparently, there is no repository available; linked e.g. from the Pi2Scart website). With this, you can show a test image (in this case, scale the included align.png e.g. to 1920x240px or alike) and move the output image by using the cursor keys. If you are satisfied with the positioning, you can save the adjusted modeline settings - this is how I found out the correct front-porch/back-porch settings for my TV.

@Alphanu @hunterk Since I don´t understand how the values in video_crt_switch.c are calculated currently (and even haven´t compiles RetroArch myself yet on the Raspi), I would ask for some bugfix/adjustment regarding this. Should I open a ticket?

2 Likes

Sure. I think alphanu is the resident expert on this sort of thing, but having a ticket for it means it has less risk of getting lost.

Hi I’m trying to use crtswitchres in a crt pc monitor (so 31khz it is) with linux. As I can see in xrandr, when activating 31khz option retroarch creates a new modeline 2560x240@120.

Instead of using super resolutions and change the refresh rate… would it be possible to just double the resolutions? Something like this:

Ghost & goblins 
Original: [email protected]> Doubled: [email protected]
Capcom CPS3
Original:[email protected]> Doubled: [email protected]
Mortal Combat
Original: [email protected]> Doubled: [email protected]
Sega Saturn (depending on the game)
Original: 352x240@60-> Doubled: 704x480@60
Original: 320x240@60-> Doubled: 640x480@60

I can play arcade games with groovymame like this and it would be great to do same thing with retroarch for consoles.

hi, does anyone have the config.txt file for lakka on pi4 ? I would like to use the hdmi2vga adapter and the rgb scart cable for a 15 khz tv. Thanks