cjuniorfox / retropie-crt

Some scripting to enable retropie to run as 240p with some HDMI to analog adapter
GNU General Public License v3.0
2 stars 1 forks source link

retropie-crt

This project enables Raspberry Pi with Retropie to work with the native display modes for the emulated content. It manages things like scanline configuration (progressive or interlaced), refresh rate, and pixel aspect ratio.

Disclaimer

The Raspberry Pi it's an amazing device highly customizable.

Bundled with Raspberry Pi OS, the basis of the Retropie distribution, it has a tool called "vcgencmd" which allows customizing the video output settings in a detailed way. It's possible to set technical parameters, like sync pulse interval or pixel aspect ratio, it's allowing to represent the original behavior of the emulated content at the intended CRT faithful as possible.

Those scripts manage the "vcgemcmd" tool making the needed calculations and switching modes on the fly. Meaning that when you're browsing over the Emulationstation, the display settings will be optimized for that content, displaying at a standard resolution of 640x480i at 60Hz, or 640x576 at 50Hz, if the "aka PAL settings" was enabled. While managing to have the display outputting the proper settings for the target emulated platform.

But, how do I connect the Raspberry Pi to a CRT display using the HDMI output?

To manage that, it's needed to have two things.

A CRT display that is capable of managing the standard video modes with the proper inputs, like RGB or YPbPr, and a converter box from HDMI to the desired connection like an HDMI to YPbPr (component) or HDMI to RGB SCART.

Most television sets manufactured for the American market in the early 2000s tend to have the component YPbPr inputs. Important to say that I'm not talking about only North America, but the whole American continent. If we talk about the European market, the set from the same period tends to have the SCART input connection, allowing the same purpose, but changing the connection and the color space.

I tested with a cheap Chinese HDMI to YPbPr converter brought from Aliexpress. I believe that other converters, like HDMI to VGA or HDMI to SCART will also work as well. Be aware that if you want to use an HDMI to VGA adapter for outputting to a CRT VGA Display, the intended display must be capable of handling the 15Khz signal. Shortly, I can manage to add the 31Khz support. But currently, it's not supported.

The set of scripting is composed of two Python scripts. The "chvideo.py" and "consoledisp.py".

chvideo.py

This script drives the "vcgencmd" for outputting the desired video mode accordingly with the desired specs, like horizontal resolution, scanline mode, and refresh rate. It does the calculation needed for the intended video settings.

consoledisp.py

This one has all the intended modes and manages the customizable settings for the target platform emulated. Driving the "chvideo" script.

chvideocore.py

Check for the Retroarch core's geometry specs and configure the chvideo.py to match the intended game (currently enabled only for arcades).

Requiriments

Initial setup

Important: Don't plug the Raspberry into the CRT display before applying the configuration unless you know your set can handle HDTV signals, with the risk of harming the set deflection circuitry if you do so.

Configuring the CRT Television modes.

At the first setup, keep your Raspberry connected to an HDTV-capable display over the HDMI and follow the steps below.

.With the gamepad, navigate to the Retropie Menu and then, choose the "RETROPIE-CRT" options menu. Retropie-CRT menu

Choose the most appropriate option for your needs. You have three options.

CHANGELOG