Wintermute0110.github.io

AEL, AML, ADL documentation and emulation guides.

View on GitHub

Retroarch usage notes

by Wintermute0110

Go to main page

RetroArch is a multi-system emulator that keeps separated the emulator graphical user interface from the emulation engine (referred as cores in RetroArch). This emulator is very friendly with HTPC setups because you can configure all the settings from your joystick, among other things. It takes a bit of effort to set it up, but once this is done you can emulate a vast number of systems easily.

A full list of the supported cores is here. This list is a bit outdated and a lot of work is currently going on. Have a look here for the GitHub repository where you can always find the latest information. The best source of RetroArch documentation is the GitHub Wiki.

There is a PPA offering Retroarch packages. However, it is not very difficult to build it from source. Also, be aware that the configuration depends on the installation path of the executables.

Compiling RetroArch (Manual method)

This is a step by step guide similar to the one found here.

Create the folder ~/bin/emu-libretro-super

$ mkdir ~/bin
$ mkdir ~/bin/emu-libretro-super
$ cd ~/bin/emu-libretro-super

Fetch libretro-super from GitHub

$ git clone git://github.com/libretro/libretro-super.git

Edit ./libretro-super/libretro-fetch.sh to install only the wanted emulation cores. At the end of the file you will see

...
fetch_project "$REPO_BASE/libretro/RetroArch.git" "retroarch" "libretro/RetroArch"

fetch_project_bsnes "git://gitorious.org/bsnes/bsnes.git --branch libretro" "libretro-bsnes" "libretro/bSNES"
fetch_project "$REPO_BASE/libretro/snes9x.git" "libretro-s9x" "libretro/SNES9x"
fetch_project "$REPO_BASE/libretro/snes9x-next.git" "libretro-s9x-next" "libretro/SNES9x-Next"
fetch_project "$REPO_BASE/libretro/Genesis-Plus-GX.git" "libretro-genplus" "libretro/Genplus GX"
fetch_project "$REPO_BASE/libretro/fba-libretro.git" "libretro-fba" "libretro/FBA"
...

Now place a sharp # in front of the cores you don’t want. For example, if among those cores you only want Genplus GX

...
fetch_project "$REPO_BASE/libretro/RetroArch.git" "retroarch" "libretro/RetroArch"

# fetch_project_bsnes "git://gitorious.org/bsnes/bsnes.git --branch libretro" "libretro-bsnes" "libretro/bSNES"
# fetch_project "$REPO_BASE/libretro/snes9x.git" "libretro-s9x" "libretro/SNES9x"
# fetch_project "$REPO_BASE/libretro/snes9x-next.git" "libretro-s9x-next" "libretro/SNES9x-Next"
fetch_project "$REPO_BASE/libretro/Genesis-Plus-GX.git" "libretro-genplus" "libretro/Genplus GX"
# fetch_project "$REPO_BASE/libretro/fba-libretro.git" "libretro-fba" "libretro/FBA"
...

Now grab the source code of the cores you want to compile and RetroArch graphical user interface RGUI

$ cd libretro-super
$ sh libretro-fetch.sh

Before compiling, install the mandatory dependencies (that is, software you need in order to build programs) required to build the cores. As root, execute

# apt-get install build-essential

Now compile the cores. If you choose to compile all the cores, then it can take a while.

$ sh libretro-build.sh

It’s not necessary to edit retroarch-build.sh to avoid compilation of uninstalled cores. The script automatically compiles only the cores that have been fetched.

To compile RetroArch graphical interface, RGUI</command>, first install some more dependencies. RetroArch’s dependencies can be tested with

$ cd retroarch
$ ./configure

RGUI’s to install mandatory dependencies

# apt-get install libgl1-mesa-dev libasound2-dev

to install RGUI’s optional dependencies

$ apt-get install libxml2-dev libfreetype6-dev nvidia-cg-dev libsdl1.2-dev

Compile RGUI

$ sh retroarch-build.sh

After compilation, test RetroArch

$ cd retroarch
$ ./retroarch --features

this will tell you the features Retroarch has

To install RetroArch RGUI, cores and info files, execute the following

$ mkdir /home/wintermute0110/bin/libretro/unix
$ sh libretro-install.sh /home/wintermute0110/bin/libretro/unix/
$ cp retroarch/retroarch /home/wintermute0110/bin

Also copy the info files to /home/xbmc/bin/libretro/info/, so RetroArch gives nice information about each core.

Compiling RetroArch (Scripted method)

Create directory ~/bin/emu-libretro-super

Fetch libretro-super</command> project

$ ./clone-libretro-super

Patch files

$ libretro-build-common.sh $ libretro-config.sh

Configure which cores you want to fetch/compile. Edit the file

libretro-fetch.sh

and comment out the unwanted stuff at the end of the file.

Fetch the libretro and Retroarch source code

$ ./update-retroarch

Install required dependencies

$ ./install-dependencies

Compile libretro cores

$ ./compile-libretro

Compile RetroArch RGUI executable

$ ./compile-retroarch

Install Retroarch cores, info files, and RGUI executable

<screen>$ ./install-retroarch</screen>

Basic RetroArch setup

The main configuration file is located on ~/.config/retroarch/retroarch.cfg. Execute RetroArch once to create a default configuration file. There is an example of a configuration file located in Github. Create a directory named ~/.retroarch to store RetroArch files (BIOS, saved games, screenshots, etc.) and then

Core and info directories

: configure the following

...
# Path to a libretro implementation.
# This core will be loaded by default on launching RGUI.
libretro_path = "~/bin/bin-libretro/picodrive_libretro.so"
...
# A directory for where to search for libretro implementations.
libretro_directory = ~/bin/bin-libretro/
...
# A directory where the core info files are located. This information is
# displayed on RGUI for every core (file types supported, systems supported, etc.).
libretro_info_path = "~/bin/bin-libretro/"
...
System directory

: this directory contains the BIOS necessary for running some emulators (notably Sega MegaCD and PlayStation 1).

$ mkdir ~/.retroarch/system

Change the following option in ~/.config/retroarch/retroarch.cfg

# Sets the "system" directory.
# Implementations can query for this directory to load BIOSes, system-specific configs, etc.
system_directory = "~/.retroarch/system/"
Savefile directory

stores the emulated battery-backed memory, memory cards, etc.

$ mkdir ~/.retroarch/savefile

Change the following option in ~/.config/retroarch/retroarch.cfg

savefile_directory = "~/.retroarch/savefile/" Savestate directory

stores your emulated saved games.

$ mkdir ~/.retroarch/savestate

Change the following option in ~/.config/retroarch/retroarch.cfg

savestate_directory = "~/.retroarch/savestate/" Screenshots directory

stores the screenshots you take.

$ mkdir ~/.retroarch/screenshot

Change the following option in ~/.config/retroarch/retroarch.cfg

screenshot_directory = "~/.retroarch/screenshot/"
ROM browser directory

is where your ROMs are. You can always navigate using RGUI, but if you configure it loading ROMs will be much faster.

Change the following option in ~/.config/retroarch/retroarch.cfg

rgui_browser_directory = "~/ROMs"
Cheats database (optional, avoids one warning when running RetroArch)

stores cheats for your games. Firsly, create a file named

~/.retroarch/cheat_database.xml

and insert

<?xml version="1.0" encoding="UTF-8"?>
<codelist>
<game>
</game>
</codelist>

Change the following option in ~/.config/retroarch/retroarch.cfg

cheat_database_path = "~/.retroarch/cheat_database.xml"

Running RetroArch from the command line

If you run retroarch</command> without any argument, RGUI user interface will show up. From here you can load cores, games, configuring controls, etc. (will do this in the next section).

To run retroarch from the XBMC launcher plugins, you will need to tell retroarch which core to load. You can get a list of you installed cores executing

xbmc@NUC:~/bin/emu-libretro-super$ ls -1 ~/bin/bin-libretro/*.so 
/home/xbmc/bin/bin-libretro/bnes_libretro.so
/home/xbmc/bin/bin-libretro/bsnes_accuracy_libretro.so
/home/xbmc/bin/bin-libretro/bsnes_balanced_libretro.so
/home/xbmc/bin/bin-libretro/bsnes_performance_libretro.so
/home/xbmc/bin/bin-libretro/genesis_plus_gx_libretro.so
/home/xbmc/bin/bin-libretro/mupen64plus_libretro.so
/home/xbmc/bin/bin-libretro/pcsx_rearmed_libretro.so
/home/xbmc/bin/bin-libretro/picodrive_libretro.so

For example, to execute a Super Nintendo ROM you type

$ ./retroarch -L ~/bin/bin-libretro/bsnes_accuracy_libretro.so Mario_World.zip

Basic RetroArch usage

This is a list of the basic default controls in RGUI

Arrows  Navigate through RetroArch's RGUI
X       Accept/OK
Z       Back
F1      While playing a game, pauses the game and shows up Retroarch menu
ESC     Exits RetroArch.

If you wish to test RetroArch, first load an appropiate core in Core…, and then load the ROM in Load content (CoreName)… Once you configure your joystick, you will be able to control most RetroArch settings and load cores/games with the joystick.

Control configuration

To configure the joystick, use the RGUI interface xxxxx.

Next, configure one joystick button to access the RGUI interface and other to exit RetroArch. The easiest way to do it is editing the file ~/.config/retroarch/retroarch.conf

...
input_exit_emulator = "escape"
input_exit_emulator_btn = "11"
input_exit_emulator_axis = "nul"
...
input_menu_toggle = "f1"
input_menu_toggle_btn = "13"
input_menu_toggle_axis = "nul"
...

PSX BIOS

WRITE ME

Sega MegaCD BIOS

WRITE ME