Tuesday, December 5, 2023

RGBCommander Update (and possible fix)


If you have recently been working on your own arcade and ran across posts referencing a utility for RetroPie called RGBCommander that can control the LEDs on your RGB-enabled controls, you have probably also discovered that the original site is now gone and the original author is no longer supporting the great add-on.  Well, I might have a little good news.

Control buttons and colors for Defender

If you are not familiar with RGBCommander, it will not only light up the appropriate controls on your panel for a selected game, but if you have RGB LEDs, it will also light them up in the same color as the original arcade cabinet (or console).

Original Track & Field on the left and the buttons lit up by RGBCommander on the right

In addition, if you have supported joysticks like the Ultimarc ServoStik or Ultrastik360 that can be converted from 8-way to 4-way, RGBCommmander can handle that as well, switching the joystick configuration based on the game/ROM being launched. And it has configurations already included for hundreds of different arcade (MAME) games and quite a few different emulators.  And adding new ones is as simple as adding an XML element to the configuration (I'll give an example of this at the end).

If you want to see RGBCommander in action on my cabinet, including managing the joystick 4-way/8-way setting, you can watch this YouTube video (skip ahead to about 5:20 if you just want to see the RGBCommander features).

Even though the original RGBCommander site is no longer available, not all is lost.  There is still an archive of the site available at: archive.org 

This includes the original instructions and information, along with a download of the original .tar file.  Hint: You might want to grab a copy now, even if you are only thinking about building an arcade because there's no guarantee this site will remain available.

There is some setup information on the RGBCommander archived site and extensive documentation within the main rgbcmdd.xml configuration file.  So this article is NOT about how to install and configure RGBCommander for your hardware.  That's all in the documentation... and due to the wide variety of hardware configurations, I simply won't be able to assist you in the installation and configuration for your hardware.... read all the documentation in the rgbcmdd.xml carefully.

But what if you have everything configured correctly and are even getting random flashing lights (attract pattern) when not in a game, but whenever you launch a game or emulator, all the control LEDs turn off and remain off?  Well, that's where the reminder of this article might be helpful as the last version of RGBCommander was released in 2018 and there have been multiple version of RetroPie (at least 5), EmulationStation and emulators released since then.  It's not surprising that RGBCommander no longer works "out of the box". 

But before beginning, you should at least have random flashing lights when sitting at the RetroPie main menu.  If no LEDs are lighting at all, then you don't have your configuration/hardware settings correct.  See two paragraphs up!

Resolving No LEDs upon game/emulator launch


So an individual named "Weston" reached out to me because despite trying all sorts of configuration options and posting on numerous forums (with no real responses), he found himself in this exact situation.  He had flashing LEDs when not "in-game" but whenever he launched a game (using any emulator), all the LEDs would turn off and none would light up.  Through a lot of trial-and-error (mostly on his part) and comparing his configuration and setup to mine, we believe we found the issue.. along with the fix.

First, check the configuration line for the particular emulator.  I'll show an example for a minimal arcade/MAME setup here:

<emulator binary="arcade" name="MAME core" arcade="1" retropie="1">

There are a few specific things to note here.  First if this is a RetroPie managed emulator (e.g RetroPie is launching the emulator), then the retropie tag must be set to "1" (retropie="1").  When retropie="1", then the binary is the name of the folder where the ROMs are located and NOT the name of the emulator binary executable.  This is one of the most common mistakes I've seen made.  If the emulator being used is MAME or a MAME-derivative, then you indicated by setting the arcade="1" flag.

In my example above, RGBCommander expects the ROMs to be located in:

 /home/pi/RetroPie/roms/arcade

as indicated by my binary="arcade".

Next, RGBCommander uses a 'runcommand-onstart.sh' to get the name of the ROM being executed.  This is actually part of RetroPie for running custom scripts when launching a game. You see more about the runcommand-onstart and other options on the RetroPie website.  

However, it appears that the runcommand-onstart.sh file is not created automatically when RetroPie is installed (or at least not anymore... this might have occurred with a new versions).  When RGBCommander is installed, it attempts to modify this file but will not create it if it doesn't exist!   This means that nothing is happening with RGBCommander when you launch a game. But don't worry, it's a pretty easy fix.

One... you can uninstall RGBCommander and create an empty runcommand-onstart.sh file in the following location:

/opt/retropie/configs/all/

You can then reinstall RGBCommander and the appropriate commands will be added to this file.  

Alternatively, you can just add the following line to the runcommand-onstart.sh file yourself (created in the same location above it if doesn't exist):

rgbparse "$1" "$3" > /dev/null 2>&1  #RGBcommander - installation tag do not remove#

The above should be on a single line.  Save the file.  I recommend a reboot of the system after making this change, but you may not need to do that.  Now try a launching a game.  If the name of the ROM  (minus the .zip) matches one of the ROMs defined in the rgbcmdd.xml file, RGBCommander should light up the appropriate buttons in the correct colors.

For example, here's the xml configuration for 'Track and Field ' referenced in the photos above:

<rom id="trackfld">
  <control name="P1_COIN" colour="White"/>
  <control name="P1_START" colour="White"/>
  <control name="P1_BUTTON1" colour="Red"/>
  <control name="P1_BUTTON2" colour="White"/>
  <control name="P1_BUTTON3" colour="Red"/>
  <control name="P2_COIN" colour="Blue"/>
  <control name="P2_START" colour="Blue"/>
  <control name="P2_BUTTON1" colour="Red"/>
  <control name="P2_BUTTON2" colour="White"/>
</rom>

If the ROM you launched has a name of trackfld.zip, then RGBCommander will use this configuration to light up buttons 1 and 3 in red and button 2 in white for players 1 and 2.  The Player 1 start button will be white and the Player 2 start button will be blue.  All other buttons will be unlit.  What if there is a button defined here that you don't have on your cabinet (say, 'coin' for example)?  It's not a problem, any buttons you don't have defined in the configuration file will just be ignored.

As mentioned, RGBCommander comes with arcade game definitions for hundreds of games.  But what about other emulators like console systems?  Well, individual games aren't defined by default because , well frankly, the buttons are generally the same for all games.  But each emulator section (including arcade) has a 'default' ROM setting.  This is what is used when a matching ROM isn't found or included.  This means you don't have to define button configurations for every game on every emulator... the default will be used if the game-specific configuration isn't found.

<emulator binary="atari2600" name="Atari" active="Lime" inactive="Off" retropie="1">
  <rom id="default">
    <control name="P1_BUTTON1" colour="Orange"/>
    <control name="P1_BUTTON2" colour="Off"/>
    <control name="P1_BUTTON3" colour="Off"/>
    <control name="P1_BUTTON4" colour="Off"/>
    <control name="P1_BUTTON5" colour="Off"/>
    <control name="P1_BUTTON6" colour="Off"/>
    <control name="P1_BUTTON7" colour="Off"/>
    <control name="P1_BUTTON8" colour="Off"/>
    <control name="P1_START" colour="White"/>
  </rom>
</emulator> 

The above is my configuration for the Atari 2600 emulator.  Note that like arcade/MAME, it has the retropie parameter set to "1", so the binary parameter indicates the folder where the Atari 2600 ROMs are located... and not the name of the executable binary.

But the rom ID is "default", meaning these buttons will be lit for any games where a specific rom configuration isn't found.  In the case of an Atari 2600, that's pretty much one button lit up in orange.  Note that the listing to turn the other buttons"off" really isn't needed because the default color for inactive buttons is also listed as off in the emulator line.

Adding Your Own ROM Configurations


If you do have arcade ROMs that aren't defined, or want to add game-specific buttons to other emulators, you simply need to add a new <rom></rom> element between the <emulator></emulator> tags of the appropriate emulator:

<rom id="rom_name">

This is the first line and the 'rom_name' needs to exactly match the name of ROM file for this game minus any extension.  For example, do not include the .zip for MAME ROMs.

<control name="defined_control_name" colour="defined_color" />

For each button you want lit, give it the defined name from the controls section of this same configuration file and a defined color name from the defined colors.  For those of us in the U.S.... note the use of colour instead of color.  If you use "color", it will not work.

Note that if you have an inactive="off" in the main emulation definition, you don't need to explicitly turn "off" any unused controls.  If the control isn't included in the list, it will take on the 'inactive' color by default... in this case "off" (which is the same as "black").

Creating Custom Animation Patterns


When not in a particular game/emulator, RGBCommander will by default run an 'attact pattern'.  If a custom animation file doesn't exist, the LEDs will just light up in random orders and colors.  However, you can create a custom attract pattern animation.  Be forewarned, it is a pretty manual and tedious process but if you want to know more about how to accomplish it, I cover the primary steps in this separate article:  RGBCommander Wiring and Custom Animations

Final Thoughts


Unfortunately, the original author of RGBCommander opted to not continue maintaining the utility.  I am not able, nor do I have the capacity, to maintain or support it either.  Since my cabinet is now nearly five years old (and still running all the original versions of the software of that time), I likely won't be able to offer any assistance other than what is posted here and in other articles in my blog.  There are just too many combinations of hardware and software versions.  My advice is to read the documentation carefully and assure the settings match how you have your hardware configured.

I'm simply publishing this article in the hopes that it might help someone else that runs into the same wall as Weston.  And a big shout out goes to him as well for actually finding the final solution.

Best of luck with your own cabinet build!

If you'd like to support future content on this blog and the related YouTube channel, or just say thanks for something that helped you out, you can say thanks by buying me a one-off cup of coffee at:

No comments:

Post a Comment

RGBCommander Update (and possible fix)

If you have recently been working on your own arcade and ran across posts referencing a utility for RetroPie called RGBCommander that can co...