Post by spannernick on Jan 30, 2021 14:15:25 GMT
Updated first post now.. 

How to add or edit a Game Controller or Joystick to PCU in THEC64 Mini/Maxi
Updated.
I made this a separate post so users could find it better.
The SDL2 Game 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 github.com/gabomdq/SDL_GameControllerDB
You can use the SDL2 Game tool Its now included with PCU in "/Carousel_Games/Options/controllers/gamepad-tool/" for Windows and Linux.
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 Game 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 gameapad to a computer(PC) using Windows 10, you can get a MacOSX and Linux version on there site.
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, then..
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 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.
If there is anything you don't understand please post here...
Worked it out from this post... thec64community.online/post/3116 and with jj0 help..
Updated.
I made this a separate post so users could find it better.
The SDL2 Game 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 github.com/gabomdq/SDL_GameControllerDB
You can use the SDL2 Game tool Its now included with PCU in "/Carousel_Games/Options/controllers/gamepad-tool/" for Windows and Linux.
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 Game Tool on windows, the GUID it shows is wrong for it to work on Linux but not on Windows(its a Windows thing..

How To Use
1. Connect the gameapad to a computer(PC) using Windows 10, you can get a MacOSX and Linux version on there site.
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, then..
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..?
03000000a30c00002500000000000000
03000000a30c00002500000000010000
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 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.
If there is anything you don't understand please post here...
Worked it out from this post... thec64community.online/post/3116 and with jj0 help..
