• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

GMS 2.3+ Nintendo Switch Pro Controller Not Mapped Properly

I am having an issue with getting useable inputs from a Nintendo Switch Pro Controller. Win7, GMS2 2.3.1. It's plugged in via USB.

First off, the working bits. I have this in the Async System event for my control object, which I found from some other threads. It works great - I can see the discovery case firing in the debugger and also I added a debug printout to show the button mapping. That mapping is down below.

Code:
switch(async_load[? "event_type"])        
{
case "gamepad discovered":              

   var padnew = async_load[? "pad_index"];  
   if global.playerInput[0] == noone
   {
   global.playerInput[0] = padnew;
       switch ( gamepad_get_description(global.playerInput[0])) {
            case "Nintendo Switch Pro Controller":
                global.playerDeviceType[0] = inputType.ProController;
                show_debug_message(gamepad_get_mapping(global.playerInput[0]));
            break;
       }
   }
   break;

case "gamepad lost":              

   var padlost = async_load[? "pad_index"];  
   if global.playerInput[0] == padlost
   {
   global.playerInput[0] = noone;
   global.playerDeviceType[0] = inputType.Keyboard;
   }
   break;
}
Code:
7e050920000000000000504944564944,Nintendo Switch Pro Controller,platform:Windows,a:b0,b:b1,x:b2,y:b3,leftshoulder:b4,rightshoulder:b5,lefttrigger:b6,righttrigger:b7,guide:b12,start:b13,leftstick:b10,rightstick:b11,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,
That mapping looks really normal and believable (it's the default and I never tried changing it), but unfortunately once the controller is connected all the inputs look wrong. I noticed that it connects as device ID 4 which I think is the first DirectInput device.

I wrote some code to print out all the button/axis/hat data and I get a jittering mess of zeroes and ones flipping constantly.

GML:
for ( var i = 0; i < 32; i++ ) {
    str += ( i mod 4 ) ? "   " : "\n";  
    str += string(i) + ": " + string( gamepad_button_check( global.playerInput[0], i ) );  
}
for ( var i = 0; i < 10; i++ ) {
    str += "\n Axis" + string(i) + ": " + string( gamepad_axis_value( global.playerInput[0], i ) );
}
for ( var i = 0; i < 4; i++ ) {
    str += "\n Hat" + string(i) + ": " + string( gamepad_hat_value( global.playerInput[0], i ) );
}
1609107836655.png

Many buttons seem to be actually subdivisions of "Axis0". For example if I press the home button I see Axis0 move to 0.25, and if I press the capture button I see it move to 0.13. Pressing the two together is enough to break the movement threshold in my code and my character starts walking! So at least it's kind of working!

Other buttons seem to have no effect at all. And there's still the matter of about half of these so-called buttons flipping state from 0 to 1 and back every frame or few frames.

Has anyone encountered this? How would I even go about remapping this? Is there a way to access the raw data (0s and 1s) coming from the device and try to figure out what it's saying?

Thanks in advance.
 
And good luck getting an answer from Nintendo, this is from their own forums:

Despite what the lights on the controller may do [when plugged in a PC], The Nintendo Switch Pro Controller is intended only for use with the Nintendo Switch gaming console. Attempting to use the controller with devices other than the Nintendo Switch gaming console may not only void any manufacturer's warranty your controller may have remaining on it, but it may also cause damage to the device you are attempting to use it on or the Nintendo Switch Pro Controller itself, and as per the tech-support forum rules, we cannot suggest or give advice on any topic which may cause a person to be exposed to any type of possible harm or injury or cause damage to a Nintendo product.
 
And good luck getting an answer from Nintendo, this is from their own forums:
Yeah, there's no chance with Nintendo :p

Is there even a driver for the Switch Pro Controller on Windows 7? The only one I know of supports only Windows 10.
So, what I do know is that the Pro Controller works with Steam games on the same Win7 PC. But, I think it is emulating keyboard inputs, which means I'm probably doing no better than JoyToKey if I try to natively support it in my game. But even speaking of JoyToKey, it can detect the Pro Controller but not read any inputs. When I open Steam (just have the process running), which has it configured for mouse/keyboard input, I get the glitchy pattern of data below, which matches what I see in my test program in the OP.

mystery.gif

So while GameMaker and JoyToKey are smart enough to recognize the device name and things, they can't parse the data coming from it. My next idea is a bit extreme, but I'm thinking if there's some way to read the raw data (0s and 1s) coming from the device, I could parse it. I've done similar before so I think I could... as long as it's not scrambled like Ethernet or something anyway! Does anyone know of a way to get this raw data into GameMaker?
 
Things like rumbling and Gyroscope are never going to work properly (if at all) without the proper drivers...and I would have my doubts about those inputs 1-8 as well, loll. But have you tried one of those app that convert your gamepad to an xinput mapping? If that works, maybe go the lazy way and ask the user to download said app if he's having the same troubles. You could even get the OS version of the user to target only those on Win 7. Just a thought, I know it's not helping it integrating in GM, but as Nintendo said, they are made for the Switch (and cost twice as much as PC gamepads...), so no guarantees it's going to be easy or elegant, lol.
 
Things like rumbling and Gyroscope are never going to work properly (if at all) without the proper drivers...and I would have my doubts about those inputs 1-8 as well, loll. But have you tried one of those app that convert your gamepad to an xinput mapping? If that works, maybe go the lazy way and ask the user to download said app if he's having the same troubles. You could even get the OS version of the user to target only those on Win 7.
I don't know if something like x360ce would even work considering there's no driver support for the controller in the first place. It would just map the wonky button/axis problems to an emulated xinput controller.

Your only solutions would be to either write your own drivers (good luck with that) or go with a hardware solution like the 8bitdo USB adapter. No idea if even that has support for Windows 7, though.
 
I don't know if something like x360ce would even work considering there's no driver support for the controller in the first place. It would just map the wonky button/axis problems to an emulated xinput controller.

Your only solutions would be to either write your own drivers (good luck with that) or go with a hardware solution like the 8bitdo USB adapter. No idea if even that has support for Windows 7, though.
Agree with all that. I will even add coding with Win7 users in mind (as well as 32 bits Windows version) is kind of useless, they represent only a tiny part of PC users, and much smaller part in the gamer's world.
I think one'd be better off making an amazing PC game, getting a dev license from Nintendo, and releasing on Switch, if playing with a Switch Pro Controller is a matter of life or death...
 
Yeah, a remapping program is one solution but it's a bit strange that it should be required. I downloaded reWASD and it was able to auto detect my switch controller and map it to an x360 controller which then works with JoyToKey and GameMaker with no issues. What I'd like is the ability to read those buttons coming from the controller as well as reWASD and Steam can - clearly they have the capability to do it on this Win7 PC after all. But I suspect the issue is actually a lack of proper support on the GameMaker side. It can detect the device but its driver to parse its inputs is wrong. So at that point yeah, the only alternative for Win7 users is a remapper program.
 

kburkhart84

Firehammer Games
GMS just uses standard gamepad stuff as provided by the OS(I believe through SDL but it could be DInput, along with the XInput). If the OS doesn't provide that standard support correctly, GMS won't pick it up, and its not really their job to do so either, considering the device isn't really supposed to be used on PC. So if a user wants to force the issue, it is up to them to do so.
 
Top