Skip to content

06. How To's & Configuration

I would prefer not to edited this page Mar 30, 2021 · 2 revisions

How To's & Configuration

I. Sound & Audio configuration

Don't change audio backends in your emulators because this is done automatically to match the audio backend configuration in RR-Config if you still change the audio backend in an emulator it will most likely crash or you will have no sound output at all.

Before you try to run any emulators make sure your Kodi audio configuration works! So have a look at https://kodi.wiki/view/settings/system/audio or Audio quickstart guide - Official Kodi Wiki first, play some media and double check that your Kodi settings are correct.

After your Kodi audio output works check out the RR Configuration addon (add-ons/my add-ons/Services) and select a proper audio output device. If you want to use video previews in Emulationstation or Pegasus you have to select PulseAudio as backend. If autoconfigure fails disable it & PulseAudio uses the same device you've selected before in RR settings. If you need additional FluidSynth MIDI support in Retroarch then activate "Use FluidSynth service".

If you've never ran Retroarch before and chose Pulseaudio as backend you'll experience no audio output at the first run. Don't panic, that's expected since Retroarch will create a file called retroarch.cfg from scratch & this file will be adjusted on next Retroarch start to match audio settings to your system config.

  • If you use PulseAudio and experience glitches, skips or crackling then disable timer-based audio scheduling (tsched) in the audio menu.
  • If your sound output is missing on recent Intel systems & builds that use Linux Kernel 5.0+ then enter this in a terminal & reboot:
  • echo "blacklist snd_soc_skl" >>/etc/modprobe.d/blacklist.conf

II. Kernel mode setting (KMS):

In KMS mode games have less input lag which might improve your overall experience. By default libretro-cores (Retroarch) won't run in KMS mode on generic systems. You can enable it in the RR-Config Addon this should work for Intel & AMD based GPUs at the moment.

As Emulationstation is only a frontend that starts the libretro-cores another option is to set KMS for every libretro emulator individually by editing the Emulationstation system config file:

  • SMB: \\your_system\Configfiles\emulationstation\es_systems.cfg
  • You'll find a <command> /usr/bin/... </command> line for every emulator. By editing these you can chose between those two modes. -This will start PPSSPP in NOKMS mode:
  • <command>/usr/bin/retroarch-nokms.start -L /tmp/cores/ppsspp_libretro.so %ROM%</command>
  • This will start PPSSPP in KMS mode if available:
  • <command>/usr/bin/retroarch.start -L /tmp/cores/ppsspp_libretro.so %ROM%</command>

III. Kodi Themes & Custom Skins

If you prefer a custom skin and want to start the apps & emulator frontends you'll have to find a way to execute the following scripts. Confluence users can uses this to include the emulation frontends.

Brave

  • /usr/bin/app-brave-browser.py

Moonlight-Qt

  • /usr/bin/moonlight-qt.py

Spotify

  • /usr/bin/app-spotify.py

Emulationstation

  • /usr/bin/frontend-emulationstation.py

Emulationstation

  • /usr/bin/frontend-pegasus-fe.py

Retroarch

  • /usr/bin/frontend-retroarch.py

For example frontend-emulationstation.py runs these commands:

#!/usr/bin/python
import subprocess
subprocess.call("systemd-run /usr/bin/emulationstation.start", shell=True)

You should also check out Waspoeders Github repo for his script addons GitHub - Waspoedertje/Kodiaddon: KodiAddons to start python apps which allows you to start the apps & frontends by using Kodi addons.


IV. Enabling the RAM disk

Compressed rom files will be extracted to /tmp/emulation by the start scripts of Amiberry, FS-UAE, Hatari, m64p and als Retroarch so for example if you run N64 games of the max cartridge size of 512 Mibit then 64MiB will be written on your drive everytime you run this game.

If you play a lot of compressed games you might want to save some wear and tear of your SD card or SSD. Check out the template file in \\yourdevice\configfiles\system.d\tmp-emulation.mount search for Options=size=256m and adjust the size according to your system.

For example ~70MB should be enough for N64 games and is probably suitable for RPi but the default size of 256MB shouldn't hurt your RAM on Generic systems as well. Enable it by running this command in a terminal:

cd ~/.config/system.d && systemctl enable tmp-emulation.mount

Then reboot your system once.


V. Qt5 environment vars

The includes Pegasus frontend, Dolphin, RPCS3, Moonlight-Qt, Citra & Mupen64plus which use Qt5 as framework so you might have to change some variables to achieve an optimal experience.

For generic systems Qt is set to automatic screen scale which means it should set the fontsize according to your monitor/tv size. If your menus are still too big or small disable Use automatic scaling, based on the TV pixel density & adjust Manually define a global menu scale factor until your menus have a proper size.

All ARM based builds come with a preset for a 26 inch television and adjust the dpi according to this. So if you have a screen which is smaller or bigger adjust your Physical TV screen width in millimeters and Physical TV screen height in millimeters in RR-Config to the physical dimensions of your screen.


VI. Mesa 3D & Vulkan tools

On generic systems you can run the following commands in a terminal to test your 3D capabilities and gather information. If you ran into issues like not working Vulkan API or else first run these commands and test if basic programs that utilize those 3D APIs run fine.

Mesa 3D (OpenGL)

  • glxinfo
  • glxgears

Vulkan

  • vulkaninfo
  • vkcube

VII. AMD GPU Driver

If you own a card based on CGN 1.0 or later you can try to use the amdgpu driver instead of radeonsi. Log into your system using a terminal and run these commands. See the Arch Wiki for further details.

# mount -o remount,rw /flash
# nano /flash/syslinux.cfg

Search for the line APPEND boot=... depending on your card and add the following to the kernel command line:

  • Code: CGN 1.0 cards:

  • radeon.si_support=0 amdgpu.si_support=1

  • Code: CGN 1.1 cards:

  • radeon.cik_support=0 amdgpu.cik_support=1


VIII. Configuring a Custom xorg.conf

When you can't select a desired resolution or some emulator menus of Dolphin, Citra or Mupen64plus that use Qt5 as framework are wrong sized you may need to create a custom xorg.conf for you system. This is something you've to individually adjust to your system and can't be set at default for all systems because the variety of hardware configurations.

Before you proceed make sure you know what your doing, using an incorrectly formatted xorg.conf can cripple your system and should be avoided.

  • To use a custom xorg.conf you simply have to access the configfiles samba share and save a text file named xorg.conf
  • If your machine doesn't boot after you have done this. Simply delete the file and reboot.

Please select one of the following xorg.conf based on which GPU your machine has.

Nvidia Graphics

You can try to run one of these commands in a terminal to autogenerate a xorg.conf file. If you use a Geforce series 600 or newer you probably use driver version 460.56. So if you use a Geforce series 500 or older use the command for the legacy driver version 340.108.

  • Code: xf86-video-nvidia-460.56
nvidia-main-xconfig --xconfig=/etc/X11/xorg-nvidia.conf --output-xconfig=/storage/.config/xorg.conf
  • Code: xf86-video-nvidia-legacy-340.108
nvidia-legacy-xconfig --xconfig=/etc/X11/xorg-nvidia-legacy.conf --output-xconfig=/storage/.config/xorg.conf

If you want to create the xorg.conf by yourself use this template:

Section "Device"
    Identifier     "Nvidia Card"
    Driver         "nvidia"
    Option         "DynamicTwinView" "False"
    Option         "NoFlip" "false"
    Option         "NoLogo" "true"
    Option         "ConnectToAcpid" "0"
    Option         "ModeValidation" "NoVesaModes, NoXServerModes"
    Option         "HWCursor" "false"
    # To put Xorg in debug mode change "false" to "true" in the line below:
    Option         "ModeDebug" "false"
    # To use a local edid.bin file uncomment the 4 lines below (change DFP-0 to match your card)
#    Option         "ConnectedMonitor" "DFP-0"
#    Option         "CustomEDID" "DFP-0:/storage/.config/edid.bin"
#    Option         "IgnoreEDID" "false"
#    Option         "UseEDID" "true"
EndSection

Section "Monitor"
    # 1920x1080p @ 60Hz (EIA/CEA-861B)
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    HorizSync      26-81
    VertRefresh    24-75
    ModeLine       "1920x1080_24" 74.250 1920 2558 2602 2750 1080 1084 1089 1125 +hsync +vsync
    ModeLine       "1920x1080_23.976" 74.175 1920 2558 2602 2750 1080 1084 1089 1125 +hsync +vsync
#    Option         "DPMS"
    Option         "DPI" "96 x 96"
EndSection

Section "Screen"
    Identifier     "screen"
    Device         "nvidia"
    DefaultDepth    24
    Option         "ColorRange" "Full"
#    Option         "ColorRange" "Limited"
#    Option         "ColorSpace" "RGB"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Section "Extensions"
   Option         "Composite" "Disable"
EndSectionNvidia Graphics

Color Space

To configure the colorspace for an Nvidia GPU you have to uncomment and comment out certain lines in the xorg.conf

#   Option "ColorRange""Full"
    Option "ColorRange""Limited"

AMD Graphics

Section "ServerLayout"
    Identifier     "aticonfig Layout"
    Screen      0  "screen" 0 0
EndSection

Section "Device"
        Identifier "AMD Graphics"
        Driver     "Radeon"
        # uncomment the following options to use DRI3 and glamor, otherwise DRI2 and exa
        # Option      "DRI3"        "1"
        # Option      "AccelMethod" "glamor"
EndSection

Section "DRI"
  Mode 0666
EndSection

Section "Screen"
  Identifier     "screen"
  Device         "aticonfig Layout"
  DefaultDepth   24
  SubSection     "Display"
    Option       "ColorRange""Full"
#   Option       "ColorRange""Limited"
    Option       "ColorSpace""RGB"
    Modes        "1920x1080_60" "1920x1080@60"
  Depth          24
  EndSubSection
EndSection

Section "Extensions"
  Option      "Composite"             "false"
EndSection

Color Space

To configure the colorspace for an AMD GPU you have to uncomment and comment out certain lines in the xorg.conf

#   Option "ColorRange""Full"
    Option "ColorRange""Limited"

Intel Graphics

Section "Device"
  Identifier  "Device0"
  Driver      "intel"
  VendorName  "INTEL Corporation"
  Option "TripleBuffer" "false"
  Option "TearFree" "false"
EndSection

Section "Screen"
  Identifier  "Screen0"
  Device      "Device0"
  Monitor     "HDMI2"
  DefaultDepth  24
  SubSection "Display"
    Depth       24
    Modes     "[email protected]" "1920x1080@24p" "1920x1080@60p"
  EndSubSection
EndSection

Section "Monitor"
  Identifier  "HDMI2"
  HorizSync   14.0 - 70.0
  VertRefresh 24.0 - 62.0
#  Option      "DPMS" "true"
  Modeline    "1920x1080@24p"     74.230 1920 2560 2604 2752 1080 1084 1089 1125 +hsync +vsync
  Modeline    "1920x1080@50p"    148.500 1920 2448 2492 2640 1080 1084 1089 1125 +hsync +vsync
  Modeline    "[email protected]" 148.352 1920 1960 2016 2200 1080 1082 1088 1125 +hsync +vsync
  Modeline    "1920x1080@60p"    148.500 1920 2008 2056 2200 1080 1084 1089 1125 +hsync +vsync
EndSection

Section "Extensions"
  # fixes tearing
  Option      "Composite"           "Disable"
EndSection

IX. Fix tearing on Generic systems

If you encounter tearing in emulation frontends or Brave you should have a look at section IX how to set up and configure a xorg.conf file and create one or change it to match the following options to fix tearing. All configs have been tested on several platform and were approved.

Nvidia Graphics

Section "Device"
Identifier "Nvidia Card"
Driver     "nvidia"
VendorName "NVIDIA Corporation"
BoardName  "GeForce 8600M"
EndSection
Section "Screen"
Identifier     "Screen0"
Device         "Device0"
Monitor        "Monitor0"
Option         "metamodes" "nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}"
Option         "AllowIndirectGLXProtocol" "off"
Option         "TripleBuffer" "on"
EndSection

AMD Graphics

Section "Device"   
 Identifier "Radeon"   
 Driver "radeon"   
 Option "TearFree" "on"   
 Option "DRI" "3"   
 Option "AccelMethod" "glamor"
EndSection

Intel Graphics

Section "Device"
Identifier  "Device0"
Driver      "intel"
VendorName  "INTEL Corporation"
Option "TripleBuffer" "true"
Option "TearFree" "true"
EndSection

X. set custom RPi4 KMS resolution

ElBoluTony wrote & tested a nice little guide how to set a custom resolution like 1080p on 4k displays.

  1. In command line; first remount the /flash boot partition as read-write:
mount -o remount,rw /flash
  1. Then use nano to edit the distroconfig.txt:
nano /flash/distroconfig.txt
  1. Comment the line disable_fw_kms_setup=1, (This prevents to pick a mode from the EDID info coming from the HDMI) , should be the last line, number 8:
#disable_fw_kms_setup=1

(Ctrl + o to save the file - Ctrl + x to exit nano)

  1. Then use nano again to edit the config.txt:
nano /flash/config.txt
  1. At the end/bottom of the file add the hdmi mode desired; hdmi_group=n (1 for CEA - standard for TVs, 2 for DMT - standard for Monitors) and then hdmi_mode=n (you can find the modes listed in Video options in config.txt - Raspberry Pi Documentation )
hdmi_group=1
hdmi_mode=95

(Ctrl + o to save the file - Ctrl + x to exit nano)

  1. Then reboot to check the changes:
reboot

The /flash partition will be marked as read-only after reboot.

Uncommenting the line of step 3 will prevent to the HDMI mode to take effect.