Guide to Retroarch, system, emulator, core, and rom config files

 

Over in the thread “Configuration changes not saving on x86 Retropie” @eddygenotype asked “Are game specific configs stored somewhere other than the ROM folder?” And my answer got out of hand. I started it as a reply to that thread, but it got so big that it quickly seemed to merit its own post so that others could see it too.

Are game specific configs stored somewhere other than the ROM folder?

Oh… there are so many other places they are stored. 🙂 Sorry to tell you…!

Here’s a list of all the ones I know of that affect this sort of option (there are plenty more that affect other sorts of options, such as emulators.cfg which controls what emulators try to boot a given rom). There’s also documentation on the Wiki but I don’t think it covers everything. You may also want to look at the Libretro docs which have additional detail.

The config files!

Most of the below are what I would call “retroarch.cfg compatible.” Often this means they are literally in a file called “retroarch.cfg”, just in different folders. But not always. All “retroarch.cfg compatible” accept the exact same keys, and are all in
keyname = "value" format, e.g.

aspect_ratio_index = "23"

There is a skeleton version of this file located at /opt/retropie/emulators/retroarch/retroarch.cfg which has comments explaining the options. If you intend to dive in, it’s worth reading.

Some of these files point at others of these files, so it’s possible to end up with a different folder structure for where things live! Overlays, for example, can be done in several ways. Some of the various scripts and packages to set up config files may choose different structures for them too. So this is a general guide, not something that will be 100% accurate for your specific setup. In fact, I don’t even recall where exactly my setup may deviate from the default. 🙂

Base retroarch.cfg:

/opt/retropie/configs/all/retroarch.cfg
This is the base retroarch.cfg-compatible file. This covers the options for everything in the RGUI except the Options screen. Unless you have “Save on exit” enabled (which isn’t recommended), it will only save when you manually hit Save Configuration (which is different from Save Core Override).

If you ever need to reset this file to defaults, there is a /opt/retropie/configs/all/retroarch.cfg.rp-distfile that contains the defaults that you can copy and rename.

Emu-specific config files:

/opt/retropie/configs/<systemname>/<something else>.cfg
Some cores have their own config files for settings not covered by Retroarch. All non-libretro cores also tend to have these. One example would be

/opt/retropie/configs/atari800/atari800.cfg

which is used by both atari800 (which is not a libretro emu) and by lr-atari800 which is. The config files are subtly different, but on top of that, in the lr-atari800 case some of them are actually overridden by the retroarch config (see the next entry)…

Another example would be

/opt/retropie/configs/nds/drastic/

where you will find an entire directory worth of options including savestates, scripts, cheats, and much more, used by the non-libretro Drastic emulator for Nintendo DS. The actual config file is therefore all the way in /opt/retropie/configs/nds/drastic/config/drastic.cfg!

Worse, sometimes these aren’t under configs at all. I’ve got all these in /home/pi for example:

coolcv_mapping.txt
.hatari
.reicast
.supertux
.vice
vicerc0

These are NOT retroarch.cfg-compatible.

Core options:

/opt/retropie/configs/all/retroarch-core-options.cfg
(the stuff under the Options menu ONLY). Saves all the emulators in one file, and does it the instant you change an option. This is NOT retroarch.cfg-compatible, it holds keys that are core-specific.

System options:

/opt/retropie/configs/<systemname>/retroarch.cfg will override the basic options for every game run by this system. Retroarch.cfg-compatible. Example:

/opt/retropie/configs/atari2600/retroarch.cfg

Core override:

/opt/retropie/configs/all/retroarch/config/<emu name>/<emu name>.cfg
For example,

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

Retroarch.cfg-compatible. This will override the above only for this core. Remember, you can have multiple cores per system. This gets manually saved with “Save Core Override.”

Game override:

/opt/retropie/configs/all/retroarch/config/<emu name>/<rom name>.cfg
For example,

/opt/retropie/configs/all/retroarch/config/Stella/Atlantis (1982) (Activision) [a1].cfg

Retroarch.cfg-compatible. This will override all the above except any emu-specific config files.

Rom configs:

/home/pi/RetroPie/roms/<systemname>/<rom name>.cfg
These are the ones that live in the /roms folder. You can create them from the runcommand menu. They are retroarch.cfg compatible. They have exactly the same name as the rom, but ending in .cfg. This means you have this in your /roms/systemname/ folder:

supermariobros.zip.cfg
supermariobros.zip

Overlay config files

/opt/retropie/emulators/retroarch/overlays/systemname.cfg
This is a common pattern, anyway, but this path is actually set in a different config file (the one in /opt/retropie/configs/systemname/retroarch.cfg so it doesn’t actually have to be here.

These are the ones that set the overlay for an entire system. They look like this:

overlays = 1
overlay0_overlay = intellivision.png
overlay0_full_screen = true
overlay0_descs = 0

That gets set by /opt/retropie/configs/intellivision/retroarch.cfg which in my case has this in it. Note where it is pointing at the overlay cfg, and where it has in it all the overlay and window settings needed to get the overlay and the game screen to play well together.

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

input_overlay = /opt/retropie/emulators/retroarch/overlays/intellivision.cfg
input_overlay_enable = "true"
input_overlay_opacity = 1.000000
input_overlay_scale = 1.000000

aspect_ratio_index = "23"
custom_viewport_height = "906"
custom_viewport_width = "1188"
custom_viewport_x = "6"
custom_viewport_y = "480"

input_remapping_directory = "/opt/retropie/configs/intellivision/"

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

That makes all Intellivision games use the same settings. The intellivision.png image is located right in this same directory, so it looks like

intellivision.cfg
intellivision.png

Rom-specific overlays

If you are using rom-specific overlays (say, Vectrex ones) then there won’t be a /opt/retropie/emulators/retroarch/overlays/systemname.cfgInstead, there will likely be a /home/pi/RetroPie/roms/<systemname>/overlay/ folder with the .cfg files in there.

For example, for Vectrex you want to have config files for every rom, because the games depend on a plastic overlay on top of a black and white vector screen.

My /home/pi/RetroPie/roms/vectrex/overlays/folder therefore has

2dnarrowescapehack.cfg  hyperchase.cfg          spaceassault.cfg
2dnarrowescapehack.png  hyperchase.png          spaceassault.png
3dcrazycoaster.cfg      keyboardhero.cfg        spaceball.cfg
3dcrazycoaster.png      keyboardhero.png        spaceball.png
3dminestorm.cfg         kingdomofheaven.cfg     spacepatrol.cfg
3dminestorm.png         kingdomofheaven.png     spacepatrol.png
3dnarrowescape.cfg      knight_rider.cfg        spaceshipcentauri.cfg
3dnarrowescape.png      knight_rider.png        spaceshipcentauri.png
3dpoleposition.cfg      laserwars.cfg           spacewar.cfg
3dpoleposition.png      laserwars.png           spacewar.png
...

These do not need to match the rom name, because they are pointed at from elsewhere.

Some people keep the above in different places. In my case, I point at them from /opt/retropie/configs/all/retroarch/config/VecX/<romname>.cfg — e.g., from Game Overrides, because that’s how I happened to do it. But they COULD be in rom-specific config files instead, which would probably be better. But this system happened to be the first time I set up something like this, so I did it this way.

Similarly, I use two different overlays for arcade games, one for portrait and the other for landscape. That requires config files for every arcade rom. I didn’t hand create all those; they’re procedurally generated. A horizontal one:

# Auto-generated crt-pi-curvature.glslp .cfg
# Place in /opt/retropie/configs/all/retroarch/config/MAME 2003/
video_shader_enable = "true"
video_shader = "/opt/retropie/configs/all/retroarch/shaders/crt-pi-curvature.glslp"
input_overlay = "~/.config/retroarch/overlay/arcade-horiz-generic.cfg"
input_overlay_enable = "true"
input_overlay_opacity = "1.000000"
input_overlay_scale = "1.000000"
aspect_ratio_index = "23"
custom_viewport_height = "846"
custom_viewport_width = "1128"
custom_viewport_x = "34"
custom_viewport_y = "535"

As you might guess, there’s a ~/.config/retroarch/overlay/arcade-horiz-generic.cfg (the .config bit is just a shortcut to /opt/retropie/config) and matching .png alongside it.

Many of the various “overlay packs” will do a lot of this sort of config generating for you. I had to hack one of them because I have a portrait monitor setup, and they’re all designed for landscape 1920×1080 screens.

Screwing yourself up

One thing that can easily mess you up is that “Save Config on Exit” is in fact a retroarch option that gets saved into any retroarch config file. So you could easily make a core or game override that has it turned on, try to turn it off globally, and then get unpredictable results, because it’s still on in the override!

In fact, you can actually turn on and off loading a number of these from the Configuration menu in RGUI:

Save configuration on exit
Configuration per core
Use per game core option 
Load override files automatically 
Load remap files automatically

…but these settings are stored in retroarch config files, which means they may themselves get overridden… which is why it’s best to avoid creating the spaghetti in the first place.

Another way you can mess yourself up is by using the runcommand menu to use one core for one game in a system, and another core for a different game. Those options are stored in /opt/retropie/configs/all/emulators.cfg, one line per game regardless of system or core. But this means that the games by definition will launch with the same system config but different core configs, which may be confusing. if you use a libretro core for all your MAME games except a few games which use a non-libretro core, and have set up overlays, you may be baffled when you launch one of the non-libretro emulated games and don’t see any overlays. But overlays only work with libretro cores. Your options are intact, they’re just not being invoked because you’re not loading the libretro options for that game.

Hope this helps!