Thanks for this information. My settings is a little different, 1920x240, then on snes I use custom viewport (7x) 1792x224, integer scale on, that fills the screen enterily, nothing outside and no black bars. Dont't know if its correct but it looks good :)
19 September 2021 at 12:53
Resolution Settings Tutorial for Retropie and Pi2SCART for 15Khz SCART CRTs like BVM, PVM
This tutorial was posted from Ben in the pi2jamma Facebook group.
[Image]
----
As
I’ve mentioned in a few other posts, I’ve had great success with 1600 x
240 resolution, which has given me pixel perfect resolution across a
variety of systems with full screen picture and zero scaling artifacts.
Prior
to this, I had been experimenting with various HDMI timings all based
on the native resolutions of the various systems I wanted to emulate.
I’d been primarily using 320 x 240, but this meant that any games with
different horizontal resolutions either scaled horribly or didn’t fit
the screen properly.
[Image]
For example...
SNES
native 256 x 224 results in horrible scaling if I force the aspect
ratio to fill the screen because the emulator is trying to fudge 256
pixels across a ‘canvas’ of 320 pixels. Alternatively, you can force 1:1
pixel mapping, but this leaves big black borders due to the 64 unused
pixels (32 either side of the image.)
The beauty of
1600 x 240 is that it accommodates the vast majority of horizontal
resolutions when combining it with the appropriate integer scaling.
To use the same example above...
SNES
native 256 x 224 becomes 1536 (i.e. 256*6) x 224. This effectively
gives a pixel perfect picture and although we still have 64 unused
pixels, these now represent a much smaller proportion of the horizontal
picture and in my case these are lost in the overscan of my monitor.
[Image]
So...
I thought I would share my setup/settings in the hope of helping others
on here who may benefit from using the same settings.
This
is by no means a ‘final’ or ‘perfect’ solution, it’s a work in
progress, but has nevertheless been a revelation for me personally and
allowed me to play the vast majority of games exactly as I wanted
[Image]
Much
of what I describe below has been covered - at least in part -
elsewhere and special thanks to Michael Chi for the original idea
https://github.com/libretro/libretro-meta/issues/73#issuecomment-290904508
and also to Michael Vencio for bringing to my attention via an earlier
post. Thanks also to Frank Skilton for his invaluable explanation of
porch settings for centring the image.
All the below
is based on Retropie and only works for Retroarch based emulators
(fortunately this covers all of the main/popular systems). I haven’t
tried Recalbox or Lakka, so I’m not sure whether the scripts below can
be applied to either of these...
First step is to set
your starting resolution, which will be the resolution at which the GUI
is displayed after the initial boot. This is defined in the main config
file on the root of your SD card. It can be anything as this won’t be
the resolution we’re using for the games, but I would suggest using a
straight forward 320 x 240 resolution. My timings for this are: -
[Image]
You
then need to create scripts to change the resolution to 1600 x 240
every time an emulator/game is launched and then back to 320 x 240 when
the game is closed. (The reason that we can’t run the GUI at 1600 x 240
is that this is an abnormally wide resolution and on a 4:3 monitor
results in everything being unreadable.)
The scripts
need to be added via your network to the folder
/opt/retropie/configs/all. This can be done either with ethernet or WiFi
(I use WiFi). I created the scripts simply by creating a new notepad
file, adding the text below and then renaming them accordingly (file
names shown in bold).
You will need to reboot your Pi in order for the above to work.
[Image]
Once
you have done this, the next time you launch an emulator it will be in
1600 x 240. Depending on your pre-existing video settings for Retroarch,
you may find that the image fills the screen reasonably well, or is
squashed into the centre. In any event, we now need to manipulate the
video settings in Retroarch to optimise the picture.
Before
I continue, I highly recommend that you centre the image by altering
the porch values in your hdmi timings. These values will vary depending
on your monitor and geometry settings.
(Courtesy of Frank Skilton): -
To
shift the image left, increase the horizontal front porch while
decreasing the horizontal back porch by an equal amount. Do the opposite
to shift right.
To shift the image up, increase the
vertical front porch while decreasing the vertical back porch by an
equal amount. Do the opposite to shift down.
3rd parameter is horizontal front porch
5th parameter is horizontal back porch
8th parameter is vertical front porch
10th parameter is vertical back porch
[Image]
The
benefit of doing this is that it saves you a lot of time repositioning
the picture when you alter the custom viewport (see below).
So,
you now have your emulator outputting 1600 x 240, but you need to
ensure that you have a pixel perfect image. To do this, you go into the
Retroarch main menu (select+X on an xbox controller), then navigate to
Settings>Video.
The values you’re interested in are: -
Aspect Ratio Index (depending on your version of Retropie, this may appear simply as Aspect Ratio)
Custom Viewport Width (aka Custom Aspect Ratio Width)
Custom Viewport Height (aka Custom Aspect Ratio Height)
Integer Scale
The
goal here is to ensure that the emulator is rendering the game in an
exact integer scale of the original native resolution. This means
matching the vertical resolution (e.g. 240), while finding a suitable
multiple of the horizontal resolution that is as close to 1600 as
possible.
The best way to establish the native
resolution of your game is to switch Integer Scale to Off, then back to
On, which will lock it to the correct scale and allow you to choose the
appropriate values.
Let’s start with an easy one..
Games running in 320 x 240 can be rendered at the full 1600 x 240 output as 320*5=1600. So your video settings will be: -
Aspect Ratio Index = Custom
Custom Viewport Width = 1600
Custom Viewport Height = 240
Integer Scale = On
If
you have correctly set your porch settings to centre the image, this
will give you pixel perfect results. If your porch values are off
centre, you will need to set Integer Scale to Off and manually
reposition the image via Custom Viewport X and Custom Viewport Y. As
I’ve stated already, it’s far easier in the long run to get your porch
settings bang-on, as this will guarantee you a centred picture without
having to alter the X and Y values every time you change the viewport.
(Hereafter
I will only specify the Custom Viewport Width and Height as the Aspect
Ratio Index is always Custom and Integer Scale will depend on your porch
settings.)
Let’s get into system specifics (values in brackets are shown just to illustrate why these are the optimum viewport widths): -
Mega Drive native = 320 x 224
Custom Viewport Width = 1600 (320*5)
Custom Viewport Height = 224
Master System native = 256 x 192
Custom Viewport Width = 1536 (256*6)
Custom Viewport Height = 192 (this will give borders top and bottom - as per real hardware)
Arcade
games are more difficult as the native resolution varies from game to
game. My recommendation is to set your default viewport for arcade games
to 1600 x 224 as this caters for a lot of them, then only alter games
that don’t fit this. To set this as the default, open any arcade game
(preferably one that runs at 320 x 224), set 1600 x 224 as the custom
viewport and save the configuration manually. Make sure that Save
Configuration on Exit is set to ‘Off’, otherwise when you launch any
games that you have manually set to a different custom viewport (see
below), it will override your default viewport of 1600 x 224.
The
way to alter custom viewports on a per-game basis is to create a game
specific config file in the same rom folder as the game in question (in
this case RetroPie/roms/arcade). Again, you access this via your
network.
The config files need to be named
game_name.zip.cfg. Much like the script files earlier on, these are
created by creating a new notepad file, entering the required text, then
renaming as appropriate.
An example would be Final Fight: -
Final Fight (CPS1 hardware) native res = 384 x 224
Custom Viewport Width = 1536 (384*4)
Custom Viewport Height = 224
So your config file for this game will be ffight.zip.cfg.
You
only need to create an instruction for the bits of the video settings
that you want to change from your default viewport of 1600 x 224. In
this case, we need to change the viewport width to 1536, so in our
config file we enter just one line of text: -
custom_viewport_width = "1536"
That’s it. The next time you launch ffight.zip, it will display with a custom viewport of 1536 x 224.
Unfortunately,
this is rom specific, so any other versions of Final Fight would need
to be changed if you wanted to play them too. I tend to stick to a
specific version of each game, just to prevent me having to create
config files for every version.
You can apply the same method to any arcade game that doesn’t fit your default 1600 x 224 viewport.
...And
that pretty much covers it for now! As I said originally, this is a
work in progress, but has improved my enjoyment of the Pi immeasurably.
In
closing, it’s worth remembering that your mileage may vary depending on
your monitor and existing geometry settings. All I can say is that
before I embarked on this project I had already optimised my PVM’s
geometry for all my real hardware and I haven’t changed anything since
using the Pi. One of the reasons that I’m enjoying the above setup is
that it gives me a pixel perfect image that fills the screen on nearly
everything. There are some exceptional arcade games that run at odd
resolutions that don’t quite work, but for the time being I am very
satisfied with the results.
"Retropie 15Khz CRT Tutorial for Raspberry Pi use with Pi2Jamma and Pi2SCART"
1 Comment -
Thanks for this information. My settings is a little different, 1920x240, then on snes I use custom viewport (7x) 1792x224, integer scale on, that fills the screen enterily, nothing outside and no black bars. Dont't know if its correct but it looks good :)
19 September 2021 at 12:53