Jump to content

RetroArch

From postmarketOS Wiki

RetroArch is a frontend for video game system emulators and other things. It can be used as a normal app, or as your user interface with the postmarketos-ui-retroarch package (not yet merged).

Installation

You can install RetroArch from the Alpine repo:

$ sudo apk add retroarch

To use RetroArch as your user interface, either select it during pmbootstrap init or install it with apk.

$ sudo apk add postmarketos-ui-retroarch

Menu

The default "menu driver" RetroArch uses is suitable for desktop usage, but there are other options. On a mobile device you can use a touchscreen friendly menu driver called glui, or on devices very low resolution displays and no touch, you can use rgui. You can set the menu driver in ~/.config/retroarch/retroarch.cfg with:

menu_driver = "glui"

Squeakboard currently does not work properly to navigate the menu, the bindings are seemingly random, here are the current key bindings:

ok
down
up × (Multiplication sign)
left π
right τ
toggle fullsceen F7
exit 0

Touchscreen

To enable touchscreen on RetroArch menu the following settings must be set in retroarch.cfg:

menu_mouse_enable = "false"
menu_pointer_enable = "true"

In case you're on a scaled display, you have to specify the scale factor in retroarch.cfg:

input_touch_scale = "2"

As of writing, input_touch_scale is only available in postmarketOS edge.

Cores

Warning WARNING: Launching roms from RetroArch frontend doesn't always works as expected, for this reason it is recommended to launch games from command-line

These are the tested cores so far, if you manage to successfully test a core please add it to the list so everyone can have an idea of what can be potentially executed.

A list of installable cores can be found here: https://pkgs.alpinelinux.org/packages?name=libretro*&branch=edge

Overlay assets and configurations can be found here: https://github.com/libretro/common-overlays Shader assets can be found here: https://github.com/libretro/common-shaders

You can git clone them directly to your ~/.config/retroarch/overlay and ~/.config/retroarch/shaders folders directly.

Sega Master System

Genesis Plus GX
Installation sudo apk add libretro-genesis-plus-gx caption
Retroarch overlay ~/.config/retroarch/overlay/gamepads/genesis/genesis.cfg
Shader ~/.config/retroarch/shaders/shaders_glsl/crt/crt-easymode.glslp
Command-line
retroarch --set-shader "shaders_glsl/crt/crt-easymode.glslp" -L /usr/lib/libretro/genesis_plus_gx_libretro.so -c ~/.config/retroarch/retroarch.cfg --appendconfig custom.cfg YOUR_ROM
custom.cfg
 input_overlay = "~/.config/retroarch/overlay/gamepads/genesis/genesis.cfg"
 
 # Custom aspect ratio and game viewport size/position params
 aspect_ratio_index = "23"
 custom_viewport_width = "720"
 custom_viewport_height = "578"
 custom_viewport_x = "0"
 custom_viewport_y = "0"

Gameboy

Gambatte
Installation sudo apk add libretro-gambatte caption
Retroarch overlay ~/.config/retroarch/overlay/gamepads/genesis/genesis.cfg
Custom overlay ZilogZ92 custom overlays
Shader ~/.config/retroarch/shaders/shaders_glsl/handheld/gameboy.glslp
Command-line
retroarch --set-shader "shaders_glsl/handheld/gameboy.glslp" -L /usr/lib/libretro/gambatte_libretro.so -c ~/.config/retroarch/retroarch.cfg --appendconfig custom.cfg YOUR_ROM
custom.cfg
 # ZilogZ92 Gameboy overlay
 input_overlay = "./overlay/gb_big.cfg"
 
 # Custom aspect ratio and game viewport size/position params
 aspect_ratio_index = "23"
 custom_viewport_width = "720"
 custom_viewport_height = "578"
 custom_viewport_x = "0"
 custom_viewport_y = "0"

PlayStation

PSCX Rearmed
Installation sudo apk add libretro-pcsx-rearmed caption
Retroarch overlay ~/.config/retroarch/overlay/gamepads/psx/psx.cfg
Command-line
retroarch -L /usr/lib/libretro/pcsx_rearmed_libretro.so -c ~/.config/retroarch/retroarch.cfg --appendconfig custom.cfg YOUR_ROM
custom.cfg
 input_overlay = "~/.config/retroarch/overlay/gamepads/psx/psx.cfg
Comments Please follow PSCX Rearmed instructions, this emulator may need PSX bin files. Buggy on paella, low FPS.

Troubleshooting

RetroArch is highly configurable and allows some tweaks to increase performance. Please, if you find some share them here.

Buggy audio

By default RetroArch set audio driver to ALSA. This may result in buggy audio. I had to change it to pulse to have a smooth audio:

audio_driver = "pulse"

If this doesn't solve the audio issue it may be that the device is not powerful enought to emulate the game/platform under some conditions (overlays, shaders). Enabling video threading can be a possible solution:

video_threaded = "true"

Rotated display (postmarketos-ui-retroarch)

RetroArch does not support display rotation in KMS mode, so if your device has a rotated display panel RetroArch will display sideways. (upstream issue) To work around this, you can run RetroArch inside xorg, or a wayland compositor, which will handle the rotation.

The easiest way is to use postmarketos-ui-cage

$ sudo apk add postmarketos-ui-cage polkit-elogind # polkit-elogind is needed to be able to power off system
$ sudo mkdir /etc/cage-ui
$ printf '#!/bin/sh\nretroarch && loginctl poweroff\n' | sudo tee /usr/local/bin/cage-ui-retroarch # Wrapper script to power off the device when exiting RetroArch
$ sudo chmod +x /usr/local/bin/cage-ui-retroarch
$ echo 'export CAGE_UI_COMMAND=/usr/local/bin/cage-ui-retroarch' | sudo tee /etc/cage-ui/retroarch.sh

Related