I just published an article about playing Pokémon Red on my Linux computer with the Gambatte Game Boy emulator using a genuine NES 2 (sometimes known as the top-loader NES) controller (the “NES” is the Nintendo Entertainment System). As I explained in that post, I used an NES-to-USB adapter because my computers (unsurprisingly) do not have native NES controller ports. I had an easy time using the user interface in RetroArch to configure the buttons on my controller (RetroArch did not have a good working profile for my adapter). However, I had one minor issue: I am actually using the Lutris game launcher with the Libretro core, not RetroArch proper, for my current Pokémon Red play-through.
![Dogbone-shaped NES 2 controller sitting on a petrified wood coaster.](https://thenewleafjournal.com/wp-content/uploads/2024/08/nes2-controller.jpg)
(Definitions: RetroArch is a front-end for launching retro games and managing different emulators and cores, including the Gambatte core I am using to play Pokémon Red. Lutris is a Linux game launcher that also works as a WINE front-end. One can install RetroArch cores for Lutris and use it as a retro game launcher.)
![Mapping buttons for NES2 controller attached to Mayflash NES adapter in RetroArch.](https://thenewleafjournal.com/wp-content/uploads/2024/08/mapping-nes2-controller-with-mayflash-adapter-in-retroarch-2.jpg)
I learned that creating a controller profile in RetroArch did not transfer to Lutris. While I received a message upon launching Pokémon Red from Lutris that my controller was recognized, none of the buttons worked as expected because from the perspective of Lutris’s Libretro implementation, the controller was not configured. I decided to look into how to resolve the issue.
My first thought was to see if I could easily configure the controller from Lutris by using its default options. While I have written at least one Lutris guide in the past, my main limited experience with doing anything in Lutris beyond just launching games concerns using it as a WINE front-end. I had never used it for setting up a controller. While the functionality may be hidden somewhere, I did not find it – so I decided to change my approach before looking into whether I needed to install something new.
Now, before continuing – note that this guide is not a recommendation for how you should tackle the same problem. I simply wanted to figure out how to get my controller picked up by Lutris quickly so I could (A) continue with my Pokémon Red run without needing to take the time to figure out new things, and (B) publish my article on using the NES 2 controller for my play-through. I suspect that my fix is a bit – for lack of a better term – hacky, and that there are better ways to do what I accomplished (I can even imagine some of them off the top of my head). But my fix did work, so let us see how and why it succeeded. With that being said, some hacky fixes work for the long haul.
I had already created and saved a controller configuration for my adapter in RetroArch. Lutris’ Libretro core, as far as I understand, is essentially its own separate implementation of what RetroArch provides as a front-end for various emulators. Notably in the context of Game Boy emulation, I use the Gambatte core on RetroArch and Lutris’ Libretro at least defaults to Gambatte. Because both RetroArch and Lutris are using the same thing under the hood, they have similar file structures.
The first thing I needed to do was figure out where my controller configuration for my NES adapter was stored in RetroArch’s files. If you are taking this as a guide – do note that I am running an Arch-based Linux distribution called EndeavourOS and I installed both RetroArch and Lutris from the regular Arch Linux packages. If you are using flatpaks or installed RetroArch through Steam (much less not using Linux at all), you may have different file paths – but that is not an issue I have looked into.
I found my controller configuration from RetroArch in the following directory:
~/.config/retroarch/autoconfig
I had only created a configuration for my adapter as of when I wrote this (note this is the mini PC I use with my TV, not my regular workstation) – so it was easy enough to find it. If you have configured multiple controllers, you will need to identify the one you are looking for. In my case I copied the entire path to the configuration for my NES adapter:
~/.config/retroarch/autoconfig/HuiJia NES_FC_SFC Joypad To USB BOX.cfg
Now I needed to find my Lutris configuration files. On my system at least, Lutris is found in ~/.local instead of /.config like RetroArch. Having found RetroArch’s controller profiles in the autoconfig directory, I looked for, and found, the same directory in for Lutris’s RetroArch runner:
~/.local/share/lutris/runners/retroarch/autoconfig/
In Lutris’ case, you will see many sub-directories full of controller profiles. I opened the configuration file for my NES adapter and saw that it belongs in /udev. So I copied the profile into the following directory:
~/.local/share/lutris/runners/retroarch/autoconfig/udev
That udev directory is already populated with many pre-set controller profiles for Lutris (for example, I did not need to do any configuration for my Nintendo Switch Online SNES controller because Lutris’ RetroArch configuration already has a properly-configured profile for it by default). After I added my NES adapter profile, I started Pokémon Red:
As I reported in my companion article, my controller now worked with Lutris, and I have been using it to play Pokémon Red without any problems thus far.
Again – there are probably better ways to do what I did – but I can confirm that my solution worked in a pinch. If you happen to also have or otherwise acquire a Mayflash NES/FC/SNES/SFC Controller Adapter for PC USB, you can get my controller configuration for an NES controller (it should work for the ubiquitous rectangle NES controllers just as well as it does for my wishbone-shaped NES 2 controller). Note that I do not have an SNES controller on hand, so if you want to use the adapter for SNES, I assume you will have to add the additional SNES buttons to my config file (I think it should be a single profile because the “controller” from the computer’s perspective is the adapter itself). Fun note: I tried to see if it worked with an NES light gun – but it did not (alas).