In the /usr/bin/switchres.ini config file you can set values as crt_range
. This values are used to define the TV screen technical specifications profile and this should help the Switchres tool to calculate a proper and centered video scale in all resolutions and at all frequencies.
RetroArch employ Switchres to calculate resolutions, so with all goods crt_range values in the .ini file, everything should be dynamic and properly scaled.
For now, I can’t find the good crt_range
values for my TV screen. Defaults like generic_15, arcade_15 or arcade_15ex are not valuable for me. Some people said you have to look in the technical manual of your TV screen to get the good crt_range
values.
I found in another arcade forum talking about the VMMaker tool for Windows, a crt_range for a Wega Trinitron TV screen :
monitor "Sony WEGA", "Sony WEGA 15.7 kHz - standard resolution", "4:3"
crt_range0 15625-16200, 56.00-65.00, 2.000, 4.700, 8.000, 0.064, 0.192, 1.024, 0, 0, 192, 288, 448, 576
So I tried to get it works with Switchres and added this values in my /usr/bin/switchres.ini file for testing. I used this command line as recommanded in the wiki : switchres 384 256 55 -i switchres.ini -c
But I get the same modeline as generic_15, arcade_15 or arcade_15ex default screen definition.
# switchres 384 256 55 -i switchres.ini -c
Switchres: Modeline "384x256_55 15.675000KHz 55.000000Hz" 7.837500 384 400 437 500 256 262 265 285 -hsync -vsync
# switchres 384 256 55 -m arcade_15ex -c
Switchres: Modeline "384x256_55 15.675000KHz 55.000000Hz" 7.837500 384 400 437 500 256 262 265 285 -hsync -vsync
# switchres 384 256 55 -m arcade_15 -c
Switchres: Modeline "384x256_55 15.675000KHz 55.000000Hz" 7.837500 384 400 437 500 256 262 265 285 -hsync -vsync
# switchres 384 256 55 -m generic_15 -c
Switchres: Modeline "384x256_55 15.675000KHz 55.000000Hz" 7.837500 384 400 437 500 256 262 265 285 -hsync -vsync
# switchres 384 256 55 -m pal -c
Switchres: Modeline "384x256_50 15.600000KHz 50.000000Hz" 7.378800 384 395 430 473 256 275 277 312 -hsync -vsync
# switchres 384 256 55 -m ntsc -c
Switchres: Modeline "640x480_59i 15.734250KHz 59.940000Hz" 12.146841 640 658 715 772 480 487 493 525 interlace -hsync -vsync
It seems Switchres doesn’t take care about my switchres.ini file.
Here is its content :
#
# 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 custom
# Define a custom preset, use monitor custom to activate
# crt_range0-9 HfreqMin-HfreqMax, VfreqMin-VfreqMax, HFrontPorch, HSyncPulse, HBackPorch, VfrontPorch, VSyncPulse, VBackPorch, HSyncPol, VSyncPol, ProgressiveLinesMin, ProgressiveLinesMax, InterlacedLinesMin, InterlacedLinesMax
# e.g.: crt_range0 15625-15750, 49.50-65.00, 2.000, 4.700, 8.000, 0.064, 0.192, 1.024, 0, 0, 192, 288, 448, 576
crt_range0 15625-16200, 56.00-65.00, 2.000, 4.700, 8.000, 0.064, 0.192, 1.024, 0, 0, 192, 288, 448, 576
crt_range1 auto
crt_range2 auto
crt_range3 auto
crt_range4 auto
crt_range5 auto
crt_range6 auto
crt_range7 auto
crt_range8 auto
crt_range9 auto
# Set the operational refresh range for LCD monitor, e.g. lcd_range 50-61
lcd_range auto
# Force a custom modeline, in XFree86 format. This option overrides the active monitor preset configuration.
modeline auto
# Forces an user mode, in the format: width x height @ refresh. Here, 0 can used as a wildcard. At least one of the three values
# must be defined. E.g. user_mode 0x240 -> SR can freely choose any width based on the game's requested video mode, but will
# force height as 240.
user_mode auto
#
# Display config
#
# Select target display
# auto Pick the default display
# 0, 1, 2, ... Pick a display by index
# \\.\DISPLAY1, ... Windows display name
# VGA-0, ... X11 display name
display auto
# Choose a custom video backend when more than one is available.
# auto Let Switchres decide
# adl Windows - AMD ADL (AMD Radeon HD 5000+)
# ati Windows - ATI legacy (ATI Radeon pre-HD 5000)
# powerstrip Windows - PowerStrip (ATI, Nvidia, Matrox, etc., models up to 2012)
# xrandr Linux - X11/Xorg
# drmkms Linux - KMS/DRM (WIP)
api auto
# [Windows] Lock video modes reported as unsupported by your monitor's EDID
lock_unsupported_modes 1
# Lock system (non-custom) video modes, only use modes that have full detailed timings available
lock_system_modes 0
# Ignore video mode's refresh reported by the OS when checking ranges
refresh_dont_care 0
# Keep changes on exit (warning: this skips video mode cleanup)
keep_changes 0
#
# Modeline generation config
#
# Enable on-the-fly generation of video modes
modeline_generation 1
# Allow interlaced modes (existing or generated)
interlace 1
# Allow doublescan modes (warning: doublescan support is broken in most drivers)
doublescan 0
# Force a minimum dotclock value, in MHz, e.g. dotclock_min 25.0
dotclock_min 0
# Maximum refresh difference, in Hz, allowed in order to synchronize. Below this value, the mismatch does not involve penalization
sync_refresh_tolerance 2.0
# Super resolution width: above this width, fractional scaling on the horizontal axis is applied without penalization
super_width 2560
# Physical aspect ratio of the target monitor. Used to compensate aspect ratio when the target monitor is not 4:3
aspect 4:3
# [Experimental] Attempts to compensate consumer TVs vertical centering issues
v_shift_correct 0
# Calculate horizontal borders with 1-pixel precision, instead of the default 8-pixels blocks that were required by old drivers.
# Greatly improves horizontal centering of video modes.
pixel_precision 1
# Calculate all vertical values of interlaced modes as even numbers. Required by AMD APU hardware on Linux
interlace_force_even 0
#
# Custom video backend config
#
# [X11] adjusts the crtc position after a new video mode is set, maintaining the relative position of screens in a multi-monitor setup.
screen_compositing 0
# [X11] stacks the screens vertically on startup to allow each screen to freely resize up to the maximum width. Useful to avoid video
# glitches when using super-resolutions. screen_reordering overrides screen_compositing.
screen_reordering 0
# [Windows] dynamically adds new modes or updates existing ones, even on stock AMD drivers*. This feature is experimental and is
# disabled by default. It has the following limitations and problems:
# - Synchronization is not perfect yet and the new modes may not always be ready on time for mode switching, causing a wrong display
# output.
# - A plug-n-play audio notification will be present on startup and exit, if the explorer shell is used.
# - Refreshing the hardware is an expensive task that takes time, specially if the app has already entered fullscreen mode. This
# makes it unpractical for games that switch video modes more than once.
# * When used with stock AMD drivers instead of CRT Emudriver, usual limitations apply: no support for low resolutions (below 640x480)
# nor low dotclocks.
# Not a problem however if you're using a 31 kHz monitor.
allow_hardware_refresh 0
# Pass a custom video timing string in the native backend's format. E.g. pstring timing for Powerstrip
custom_timing auto
#
# Logging
#
# Enables verbose mode (0|1)
verbose 1
# Set verbosity level (from 0 to 3)
# 0: no messages from SR
# 1: only errors
# 2: general information
# 3: debug messages
verbosity 3
I probably miss something stupid^^
—– Edit ——
The switchres.ini file must be created in the /etc folder and not in the /usr/bin folder as explained in the wiki. Now the command line switchres 384 256 55 -i switchres.ini -c
returns :
Invalid option interlace_force_even
Invalid option verbosity
parsing /etc/switchres.ini
Invalid option interlace_force_even
Invalid option verbosity
Switchres(v2.002) display[0]: monitor[custom] generation[on]
Switchres: progressive_lines_max 288 out of range
Switchres: Error in monitor range (ignoring): 15625-16200, 55.00-65.00, 2.000, 4.700, 8.000, 0.064, 0.192, 1.024, 0, 0, 192, 288, 448, 576
Switchres: Calculating best video mode for 384x256@55.000000 orientation: normal
Switchres: ( 0)x( 0)_(0=0.000000Hz)
Switchres: could not find a video mode that meets your specs
Yes it’s an error message, but it finally find the swichres.ini config file.
I found the tip here : https://github.com/antonioginer/switchres
It could be nice to update the wiki information here : https://wiki.batocera.org/batocera-and-crt#adding_modelines_read_resolutions_for_emulators
—– Edit 2 ——
I found interesting information about what the crt_range can do here : https://geedorah.com/eiusdemmodi/forum/viewtopic.php?pid=329#p329
It’s not only a monitor specification to set hardware limits or capabilities, we also can define different frequencies range to influence modelines generation. And make the resoltion scale more accurate on the TV screen in some specific conditions.
I have no idea how and where to find crt_range values for my TV screen and how to manipulate them to dynamycaly optimize the result with some specific resolutions and frequencies. This means, matching with the best result in any cases, is just unlikely.
So my first intuition to make manual and optimized modelines for predefined width/height/frequency models, like each real arcade systems do, isn’t so bad.