• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Windows A bit of help with Gamepad Description

So, I'm getting really annoyed with this thing. I know the function gamepad_get_description() returns a string that is hardware-dependant.
I could live with descriptions like
Code:
XInput STANDARD GAMEPAD
for an XBox controller (and even then, I thought it looked like ****).
But now, I plug in a Nintendo Switch controller, you know...to test stuff...and this is what the description returns:
Code:
4 axis 14 bouton boîtier de commande avec commande de pouce
This doesn't even fit as a string in my menu, has a grammar error in it, and tells the user absolutely nothing about which gamepad the machine is talking about.

So, considering this, I'm thinking of making a simple extension (free and for everyone to use, of course) that simply returns a more readable string to work with, but obviously, I need some data to go on.
If anyone has knowledge about what controller type returns what string, please let me know.
There must be a database somewhere where this is archived...
For sure I won't be able to cover them all, but it's something that would be easily expendable and would never go out of date (tho could very well not be UP to date, lol)
 

kburkhart84

Firehammer Games
If there is such a database, I've never heard of it. You are really dependent on luck of the draw honestly. I considered adding a bit about that in my input system but I ran into the same problem as you are looking at, with useless descriptions. Even if there is such a database, you would have to make an extension to handle accessing the data(unless you made it local). But Gamemaker doesn't have anything to get GUIDs or anything like that, so I'm unsure how you would know what database fields to look at. I guess you could make an extension to help, but then you would have to have the extension handle ALL the gamepad stuff as well, because there is no way I know of to correlate gamepad IDs with indices you might get from external stuff. All in all, it seems like a worthless cause to me, considering I have something close enough to a solution I do.

I get around it by having the action mapping be done by the user actually pressing the keys/buttons. Then, there is no doubt about which gamepad it was since the player pressed the button(or moved the axis).

EDIT****

See below, gamemaker does indeed allow you to retrieve GUIDs. I guess that was added at some point and I didn't notice.
 
Last edited:

kburkhart84

Firehammer Games
gamepad_get_guid()?
What the?!?!?! When did that get made available? All the input crap I mess with and I never noticed that. I stand corrected.

I guess then, you could possibly do something with SDL if you can find a database of these things. I would only worry about some stuff I just found about several controllers using the same base board and therefore having the same GUIDs. It still seems like lots of work for something that may or may not be very useful.
 
yeah, GUID is a thing, I don't know since when, tho.
The extension I'm thinking of would be quite simple, more akin to a database...maybe just a big-*** switch case where if the returned string is
"4 shoulders, 2 joyaticks, 8 trigger multidirectional awesome gamepad", it could just return [Some Brand] Gamepad #n, instead.
So if you have a menu that asks which gamepad you'd like to use, you kind of have a better way to make it a string that actually means something.

My guess is the GM "description" is embedded somewhere in the GUID (which is not a cool string to read either), but how do find that?
I went to some website that checks the gamepad inputs, and the description of the Switch controller did indeed read as "Switch Controller", or something.
So there must be a way if this site uses the GUID as a basis to extract this data.

source: GitHub - e7d/gamepad-viewer: Gamepad Viewer : You controller live status in your browser.

gamepad_get_guid()?
Yeah, but if my menu asks:
Which Controller do you want to use, and the choices are
000f0df2555sdf000sd
and
00sdf000g000e0h0gv

that's not really helping me sort things out, lol

**********************************************************************************
EDIT:
I think I found the database by looking at the github script...sweet jesus almighty...
Gamepad Tester - Controllers (gamepad-tester.com)
But these are not GUID's that are listed, am I right? Still need help at least deciphering all this to get me started, but this will be a heck of a job!

*******************************************************************************
EDIT#2
So, consider this GUID returned by GM
GML:
1a25bc3d00000000000000000000000
You have to look at the first 8 characters.
They are weirdly inversed. In our case:
Chars 0-3 = the VENDOR code is 251a (instead of 1a25 as displayed in GM)
Chars 4 -7 = the PRODUCT code is 3dbc (instead of bc3d as displayed)

So far, it works with all my controllers. But for some reason, xbox seems to have no GUID, that's kind of a big edge case..
But just naming by Vendor is already an improvement... "Nintendo Controller" sounds better than "4-axis-2 joystick 16 buttons gamepad"
 
Last edited:
Top