How to add or edit a Game Controller or Joystick to PCUAE in THEC64 Mini/Maxi


I made this a separate post so users could find it better, and could leave comments, if they have a problem and that and need help.

The SDL2 Gamepad Tool is recommended as a 3rd party tool for editing or added game controllers to the SDL2 Database text file on Github in the SDL_GameControllerDB Source

You can use the SDL2 Gamepad tool Its now included with PCUAE in “/Carousel_Games/Options/controllers/gamepad-tool/” for Windows and Linux, the MacOSX is on there site.
This does not have a virus and is safe, I use it all the time, I recommend using this tool, you can edit the gamecontrolerdb.txt file with SDL2 source too but you need it working on your computer to do it, the SDL2 Game tool is the easiest way of doing it.

I do not recommend editing the gamecontrollerdb.txt in the firmware cause if THEC64 Mini/Maxi is under warranty then if you do change it and access its firmware then THEC64 Mini/Maxi warranty will be void, this is safer too and can’t damage THEC64 Mini/Maxi firmware where you might do something wrong and stop the Carousel booting up.

I have made it easier to add a controller or joystick to PCUAE, by overmounting the gamecontrollerdb.txt on TheC64 Mini/Maxi firmware with the one in PCUAE, its on the USB Drive, the file is called gamecontrollerdb.txt, it stores all the game controllers and joystick that can be used with THEC64 Mini/Maxi, it a database file for them and is located in /Carousel_Games/Options/controllers/

This is what it looks like on Mac OSX(OS X) but looks the same on Windows or Linux.

The SDL2 Gamepad Tool on windows, the GUID it shows is wrong for it to work on Linux but not on Windows(its a Windows thing.. :) ), look down below to correct this so it works on THEC64 Mini/Maxi..

How To Use

1. Connect the gamepad to a computer(PC) using Windows 10, 

2. Launch the app on Windows 10, If you connected multiple gamepads select the one you want to use in the drop down list.

3. If the app displays that mapping is available go to step 5

4. If mapping is not available or available but you would like to change it press Make New Mapping and follow the instructions

5. Now do this, press “Copy Mapping String and find mappings database file in the “\Carousel_Games\Options\controllers” folder, it’s called gamecontrollerdb.txt and edit it with notepad

and paste the GUID mapping string line at the end of the file.

6. Add “platform:Linux,” at the end of GUID mapping string line, look for “platform:Windows,” in the line and delete it. 

7. Can you see the difference and what’s wrong in these 2 GUID lines..?



See the difference, 8 binary numbers are missing at the end of the GUID, there need to be the right number otherwise the controller/joystick will not work.

When using the SDL2 Gamepad Tool on Windows, you need to change the last 8 digits(Binary Numbers) at the end of the GUID, its the HID version, so if its HID version 0100 then its 00010000
end of the GUID then you have the right line for Linux and THEC64 Mini/Maxi and the controller will work.

The GUID line now should look something like this when you have finished editing the GUID mapping string:

This is the Mega Drive Mini Control Pad GUID mapping string and its HID version is 110100 so its 11010000:

03000000a30c00002500000011010000,Sega Megadrive Mini 3 Button Controller,a:b5,b:b1,righttrigger:b2,start:b9,dpup:-a4,dpdown:+a4,dpleft:-a3,dpright:+a3,platform:Linux,

(This line dose work, it is in PCU gamecontrollerdb.txt txt file at the end of the file, you can use the Sega Mega Drive USB 3 Button Gamepad from the Sega Mega Drive Mini, on the C64 Mini/Maxi.)

The last 8 digits relate to the HID version.
In Linux you can get the HID version from the dmesg output, or from looking up the controller in /proc/bus/input/devices or you can get the entire string from the Linux version of SDL2 Gamepad tool:

If you plug your controller or Joystick in your PC, and then using Windows 7,8,10 and selecting your controller/joystick in Device Manager and by looking at its device properties and Details tab, you will see the HID Version Number, its ends with &REV_0100, its the 0100 you need then add 2 two 0s to it so it reads 010000:

Now save it, you can test it and see if your controller works, if you have done it right, it will work as soon as you start-up PCU and able to move the square yellow box around the Carousel.

Some buttons on the SDL2 Gamepad Tool might be in a different place cause its shows a Xbox 360 Controller so you have to play around with it and work out what button is where so your controller/joystick works, it does this with DB92USB Adapters, I added USB Joy Adapter and the fire button is the right shoulder button in the SDL2 Gamepad Tool.

A lot of issues with adding joysticks start with getting the right ID string to put in the gamecontrollerdb.txt file. The attached fake update tries to help with this by getting the ID string info on the Mini/Maxi itself.

(This next bit is now a option in PCUAE 1.5.1 so it can now be all done in there, for more info look in the PCUAE WIKI.)

To use:

  • Extract the contents of this Download Attachment file to a USB stick you know works ithe the Mini/Maxi
  • Insert it in the Mini/Maxi
  • Do not connect the joystick you want to try out to the Mini/Maxi yet – only the standard Mini/Maxi joystick (or any other already working joystick) should be connected
  • Switch on the Mini/Maxi and wait until the Carousel is displayed
  • Connect the joystick you want to try out to theMini/Maxi
  • Run the fake update (using the standard Mini/Maxi joystick to navigate to the System information menu)
  • The fake update doesn’t display anything but just returns to the System information menu
  • The USB stick should now have a file ‘usbid.txt’ that contains the ID string and joystick manufacturer/name string like
03000000790000001c18000011010000,SPEEDLINK COMPETITION PRO Game Controller for Android

I haven’t tested this a lot so feedback would be welcome. Also, you can of course edit the name part to your liking.
The fake update script just gets the latest/last line containing ‘USB’ from the system log and then manipulates it to get the various parts of the ID string:

#!/bin/sh# Make USB drive rwmount -o remount,rw /mntUSBINFO=$(dmesg | grep USB | tail -n 1 | cut -d ']' -f 2)echo $USBINFOUSBID=$(echo "$USBINFO" | cut -d ' ' -f 3)echo $USBIDHIDVER=$(echo "$USBINFO" | cut -d ' ' -f 7)echo $HIDVERSDLID=$(echo ${USBID:2:2}${USBID:0:2}0000${USBID:7:2}${USBID:5:2}0000${USBID:12:2}${USBID:10:2}0000${HIDVER:3:2}0${HIDVER:1:1}0000 | awk '{ print tolower($0) }')echo $SDLIDJSNAME=$(echo "$USBINFO" | cut -d '[' -f 2)echo $JSNAMEecho ${SDLID},${JSNAME} >/mnt/usbid.txt

So I think the easiest way to map a new joystick is to use the SDL2 Gamepad Tool on a PC to map the joystick directions and buttons how one likes them, taking the way the official THE64/VIC20 joysticks are mapped into account/as a reference:

THE64 Joystickgamecontrollerdb.txt input name
Left Firelefttrigger
Right Firerighttrigger
Left Trianglex
Right Triangley
Menu 1a
Menu 2b
Menu 3back
Menu 4start

Note that for Left/Right and Up/Down it uses the left analog stick mapping, but it also works fine using dpdleft/dpright and dpup/dpdown instead. So if your controller only reports dpd<xxx> and not leftx/lefty then you can still use it.

Then take the entire mapping string that the SDL2 Gamepad Tool generates, change the ID (GUID) number (if different) to the one given by my fake update, put the line in the gamecontrolerdb.txt and remove any other lines with the same ID number.

Updated: The GUID discovery is now also available in PCUAE.

If there is anything you don’t understand please post here…

Worked it out from this post… and with jj0 help..