Support For Modern Atari VCS Controllers

Hi,

Has anyone any experience of integrating this controller? I’m attempting a port to the new Atari VCS and everything is working fine apart from the controller input (plugging in an xbox controller works OK).

I’ve done a couple of quick tests and see I can get values for most inputs by using JoystickState instead of GamepadState so I’m sure I can work round things that way but I just wondered if there was an easier or ‘better’ way? I’ve read about adding mappings to the SDL database but I’ve no idea how to get started with that really (and presumably I’ll have to build from source if doing this rather than using the NuGet packages)?

I’m using 3.8, DesktopGL build.

Any input appreciated.

1 Like

Yes, get a copy of the MonoGame source, add this to “MonoGame\ThirdParty\SDL_GameControllerDB\gamecontrollerdb.txt”, build MonoGame, and set your game to target this new build of MonoGame

# Atari VCS Classic Controller (PC MODE)
030000005e0400008e02000000007801,Atari VCS Classic Controller (PC MODE),platform:Windows,a:b0,b:b1,back:b6,guide:b10,start:b7,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,
030000005e0400008e02000045010000,Atari VCS Classic Controller (PC MODE),a:b0,b:b1,back:b6,guide:b8,start:b7,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,platform:Linux,


# Atari VCS Classic Controller (VCS MODE)
# the blank ones in Windows and Linux are so we can detect it and ask the user to switch modes (since some buttons don't work in Win/Linux in VCS Mode)
03000000503200000110000000000000,Atari VCS Classic Controller (VCS MODE),platform:Windows,
03000000503200000110000011010000,Atari VCS Classic Controller (VCS MODE),platform:Linux,
03000000503200000110000045010000,Atari VCS Classic Controller (VCS MODE),platform:Mac OS X,a:b0,b:b1,back:b4,guide:b3,start:b2,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,


# Atari VCS Modern Controller (PC MODE)
030000005e0400008e02000000007801,Atari VCS Modern Controller (PC MODE),platform:Windows,a:b0,b:b1,x:b2,y:b3,back:b6,guide:b10,start:b7,leftstick:b8,rightstick:b9,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,
030000005e0400008e02000046010000,Atari VCS Modern Controller (PC MODE),a:b0,b:b1,x:b2,y:b3,back:b6,guide:b8,start:b7,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Linux,


# Atari VCS Modern Controller (VCS MODE)
# the blank ones in Windows and Linux are so we can detect it and ask the user to switch modes (since some buttons don't work in Win/Linux in VCS Mode)
03000000503200000210000000000000,Atari VCS Modern Controller (VCS MODE),platform:Windows,
03000000503200000210000011010000,Atari VCS Modern Controller (VCS MODE),,platform:Linux,
03000000503200000210000046010000,Atari VCS Modern Controller (VCS MODE),platform:Mac OS X,a:b0,b:b1,x:b2,y:b3,back:b10,guide:b9,start:b8,leftstick:b6,rightstick:b7,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a5,righttrigger:a4,

This adds the necessary entries for SDL (used by MonoGame) to understand the VCS controllers input. However, note the blank DB entries. These are used so that your game can still recognize a connected controller that is set to the wrong “mode”. VCS controllers have 2 different modes: VCS Mode and PC Mode. Mac will only understand all input from the controllers in VCS Mode. Windows and Linux will only understand all input from the controllers in PC Mode. So, detect which mode your controller(s) are connected in, and if in the wrong mode for the target platform, inform the user that they need to switch modes.

For example: in this instance I have a keyboard device, an Xbox One device, and an Atari VCS Modern Controller connected (Connected in VCS Mode and running on Windows. Therefore, I inform the user they need to change to PC Mode)

Also noteworthy, I couldn’t get the VCS controller to connect to my Mac in PC Mode at all (thus, the missing Mac DB entries when in PC Mode)

1 Like

Hi,

Thank you very much for this, this really is extremely helpful! I think I have been a bit slack in my handling of controllers so far in my game.

So to get the type of controller to see if it’s in the wrong mode I presume you do it via GamePad.GetCapabilities?

cheers

Indeed. Be sure to init the controller DB during game startup so you can make use of the DisplayName property later during controller detection.

Example Code:

Init (fire once, during game startup before detecting controllers)

GamePad.InitDatabase();

Checking for VCS Controller, and for wrong mode for that controller

string displayNameLower = "";
GamePadCapabilities capabilities = GamePad.GetCapabilities(controllerIndex);
if (capabilities != null && capabilities.DisplayName != null)
    displayNameLower = capabilities.DisplayName.ToLowerInvariant();

if (displayNameLower.Contains("vcs modern") || displayNameLower.Contains("vcs classic"))
{
    controllerType = ControllerType.VcsModern;
            
    #if WINDOWS || LINUX || VCS
        try
        {
            if (capabilities != null && capabilities.Identifier != null)
            {
                string[] guidPieces = capabilities.Identifier.Split('-');
                string pieceInQuestion = guidPieces[3].ToLowerInvariant();
                if (pieceInQuestion == "0210" || pieceInQuestion == "0110") // 0210 is the VCS Modern Controller in VCS mode, 0110 is the VCS Classic Joystick in VCS mode
                    isVcsControllerAndInWrongMode = true;
            }
        }
        catch (Exception)
        {
            Debug.WriteLine("Malformed VCS Controller GUID. Cannot detect connected mode.");
        }
    #endif
}

That’s awesome - thank you very much!

1 Like