RetroArch Configuration - eddywebs/RetroPie-Setup GitHub Wiki

Retroarch Logo


RetroArch is the official front end for the Libretro API which essentially means that RetroArch will be what manages controls and configurations for all of the emulators that are part of the Libretro-Core (i.e. any emulator with an "lr" before it). This is a beautiful thing because it means you can configure controllers only once for many emulators instead of having to configure each emulator individually. RetroArch also gives us the freedom to configure emulators individually as discussed below under "Custom RetroArch Controls" (There are also emulator specific configurations for emulators not part of the libretro core under their respective emulator wiki page.)

Retroarch Controls

There are 3 main ways that RetroArch handles controls:

AutoConfigurations

Starting with Retropie 3.0 retroarch controls have been integrated into emulationstation and will be the first thing you see when you boot from the RetroPie SD image the first time. You can also access it from the start menu within emulationstation under the configure input option. Your joypad is automagically configured for libretro (retroarch) emulators when you configure your controller for the first time in emulationstation. You'll know if your controller has been automagically configured if you see a flash of yellow text on the bottom of the screen with your gamepad ID when you start a game.

The following diagrams are for the 3 most common controllers: Super Nintendo, Xbox 360, and PlayStation 3. They can be used as a reference when configuring your controllers. Each emulator page on the wiki has a diagram of the original controller for its respective console that will correspond to the same inputs listed below.

Super Nintendo Controller

Xbox 360 Controller

PlayStation 3 Controller

After you've configured your controller the autoconfig will be created here:

/opt/retropie/configs/all/retroarch-joypads

This is an example config for a snes controller

input_device = "USB gamepad           "
input_driver = "udev"
input_r_btn = "5"
input_save_state_btn = "5"
input_start_btn = "9"
input_exit_emulator_btn = "9"
input_l_btn = "4"
input_load_state_btn = "4"
input_up_axis = "-1"
input_a_btn = "1"
input_b_btn = "2"
input_reset_btn = "2"
input_down_axis = "+1"
input_right_axis = "+0"
input_state_slot_increase_axis = "+0"
input_x_btn = "0"
input_menu_toggle_btn = "0"
input_select_btn = "8"
input_enable_hotkey_btn = "8"
input_y_btn = "3"
input_left_axis = "-0"
input_state_slot_decrease_axis = "-0"

Hotkeys

Hotkeys are combinations of buttons you can press in order to access options such as saving, loading, and exiting games. The following defaults are set automatically the first time you set up your controller from emulationstation (The numbers will vary depending the controller you use).

Default joypad hotkeys:

Hotkeys Action Code Example
Select Hotkey input_enable_hotkey_btn = "6"
Select+Start Exit input_exit_emulator_btn = "7"
Select+Right Shoulder Save input_save_state_btn = "5"
Select+Left Shoulder Load input_load_state_btn = "4"
Select+Right Input State Slot Increase input_state_slot_increase_btn = "h0right"
Select+Left Input State Slot Decrease input_state_slot_decrease_btn = "h0left"
Select+X RGUI Menu input_menu_toggle_btn = "3"
Select+B Reset input_reset_btn = "0"

see this video:

Hardcoded Configurations

These configurations are manual edits you can make that are locked to a specific port and controller. Hardcoded controls can be configured either globally, by emulator, or by game- see the following paragraphs.

Config Hierarchy

All RetroArch based emulators can be configured in the following way:

Global settings - that are settings which should apply to all systems - are done in the file

/opt/retropie/configs/all/retroarch.cfg 

System-specific settings are done in the files

/opt/retropie/configs/SYSTEMNAME/retroarch.cfg

Here, SYSTEMNAME is atari2600, snes, etc.. All settings in these files will overwrite the corresponding global setting as long as they are placed above the #includeconfig line.

ROM-specific settings can be created in the runcommand menu and show up as configuration files by rom title. It follows the same pattern as the other hardcoded configs.

/home/pi/RetroPie/roms/SYSTEMNAME/ROMNAME.cfg

These configurations are used when starting a rom for a specific system. The individually used commands for starting a single rom are called through runcommand but can also be manually edited in the following file.

/opt/retropie/configs/SYSTEMNAME/emulators.cfg

Custom Retroarch Override Examples

Example Default Per System Retroarch.cfg

# Settings made here will only override settings in the global retroarch.cfg if placed above the #include line

input_remapping_directory = /opt/retropie/configs/megadrive/


#include "/opt/retropie/configs/all/retroarch.cfg"

Example Per System Control Override retroarch.cfg:

Note the values below are for one person's controller, your values may differ. Make sure that these values are placed above the #includeconfig line

# Settings made here will only override settings in the global retroarch.cfg if placed above the #include line

input_remapping_directory = /opt/retropie/configs/megadrive/

input_player1_joypad_index = 0
input_player1_b_btn = 2
input_player1_a_btn = 1
input_player1_y_btn = 3
input_player1_x_btn = 0
input_player1_l_btn = 4
input_player1_r_btn = 5
input_player1_start_btn = 9
input_player1_select_btn = 8
input_player2_joypad_index = 1
input_player2_b_btn = 2
input_player2_a_btn = 1
input_player2_y_btn = 3
input_player2_x_btn = 0
input_player2_l_btn = 4
input_player2_r_btn = 5
input_player2_start_btn = 9
input_player2_select_btn = 8

# Axis for RetroArch D-Pad. 
# Needs to be either '+' or '-' in the first character signaling either positive or negative direction of the axis, then the axis number. 
input_player1_up_axis = -1
input_player1_down_axis = +1
input_player1_left_axis = -0
input_player1_right_axis = +0
input_player2_up_axis = -1
input_player2_down_axis = +1
input_player2_left_axis = -0
input_player2_right_axis = +0

#Hotkeys- Hotkeys enable you to press a combination of buttons to do such things as exit emulators, save states,
# and load states, as well as any other functionality in an emulator. (In the example below 8 is the select key
# and 9 is the start key so when I hold down select and press start it will exit the emulator.)
input_enable_hotkey_btn = 8
input_exit_emulator_btn = 9
input_save_state_btn = 5
input_load_state_btn = 4
input_menu_toggle_btn = 0
input_state_slot_increase_axis = +0
input_state_slot_decrease_axis = -0


#include "/opt/retropie/configs/all/retroarch.cfg"

Core Input Remapping

Core Input Remapping differs from the other two methods as it remaps how the core receives input rather than how the gamepad is coded, for example you can tell the snes core to switch button A and B on the controller for gameplay, but you can still use "A" to select in the RGUI and "B" to go back where as hardcoding would make B select and A back. Core Remapping is much more practical than hardcoded mapping but is limited to the cores that support it.

Core Input Remapping

Video Tutorials

Testing Joypad

Setting up USB controllers

Wireless PS3 controller

Wireless Xbox controller

Default Core Controls for All Emulators:


3do

3dodiagram

Atari 2600

atari2600diagram

Atari Lynx

atari_lynx

Gameboy

gameboy

Gameboy Color

gameboycolor

Gameboy Advance

gameboyadvance

Game Gear

segagamegeardiagram

Mastersystem

mastersystem

Megadrive/Genesis (3 Button)

genesis

Megadrive/Genesis (6 Button)

genesis6btn

Nintendo 64

nintendo_n64_diagram

Nintendo DS

dsdiagram

NES

nesdiagram

Neo Geo

neogeodiagram

Neo Geo Pocket

neogeopocketdiagram

PS1

playstation

SG-1000

sg-1000diagram

Super Nintendo

snes

Sega Saturn

saturn

Turbografx16

turbografx16diagram

Videopac/Odyssey2

videopacdiagram

Vectrex

vectrex

VirtualBoy

virtualboydiagram


Sega Dreamcast

sega_dreamcast_diagram

Intellivision

intellivision