Windows Gamepad detected but inputs not working

ajrdesign

Member
A weird issue has popped up with my gamepad implementation:

Gamepad is being detected but none of the inputs are responding at all. This was with an implementation that I had previously had working (And works for Mac just fine). I've paired it down in a separate project to try and debug but it's still not working as expected. This is all the code I have in the secondary project:

System Event:

GML:
show_debug_message("Event = " + async_load[? "event_type"]);        // Debug cocde so you can see which event has been
show_debug_message("Pad = " + string(async_load[? "pad_index"]));   // triggered and the pad associated with it.

switch(async_load[? "event_type"])             // Parse the async_load map to see which event has been triggered
{
case "gamepad discovered":                     // A game pad has been discovered
    var gpad = async_load[? "pad_index"];       // Get the pad index value from the async_load map
    gamepad_set_axis_deadzone(gpad, 0.2);       // Set the "deadzone" for the axis
    gamepad_set_button_threshold(gpad, 0.2);    // Set the "threshold" for the triggers
    pad_num = gpad
    gamepad = true;
    break;
case "gamepad lost":                           // Gamepad has been removed or otherwise disabled
    var gpad = async_load[? "pad_index"];       // Get the pad index
    pad_num = -1;
    gamepad = false
    break;
}
Draw Event (For testing if inputs are working):

GML:
draw_set_font(ariel)
draw_set_color(c_white)
var spacer = 8
var xx = 0;
var yy =  0;

if gamepad
    {
    draw_text(xx, yy, "Gamepad Slot - " + string(pad_num));
    draw_text(xx, yy + spacer*2, "Gamepad Type - " + string(gamepad_get_description(pad_num)));
    var lefthaxis = gamepad_axis_value(pad_num, gp_axislh);
    var leftvaxis = gamepad_axis_value(pad_num, gp_axislv);
    draw_text(xx, yy + spacer*4, "Left H Axis - " + string(lefthaxis));
    draw_text(xx, yy + spacer*6, "Left V Axis - " + string(leftvaxis));
    draw_text(xx, yy + spacer*8, "Right H Axis - " + string(gamepad_axis_value(pad_num, gp_axisrh)));
    draw_text(xx, yy + spacer*10, "Right V Axis - " + string(gamepad_axis_value(pad_num, gp_axisrv)));   
    draw_text(xx, yy + spacer*12, "R1 - " + string(gamepad_button_value(pad_num, gp_shoulderr)));
    draw_text(xx, yy + spacer*14, "R2 - " + string(gamepad_button_value(pad_num, gp_shoulderrb)));
    draw_text(xx, yy + spacer*16, "B - " + string(gamepad_button_value(pad_num, gp_face1)));
    draw_text(xx, yy + spacer*18, "A - " + string(gamepad_button_value(pad_num, gp_face2)));
    draw_text(xx, yy + spacer*20, "Y - " + string(gamepad_button_value(pad_num, gp_face3)));
    draw_text(xx, yy + spacer*22, "X - " + string(gamepad_button_value(pad_num, gp_face4)));
    draw_text(xx, yy + spacer*24, "Down - " + string(gamepad_button_value(pad_num, gp_padd)));
    draw_text(xx, yy + spacer*26, "Left - " + string(gamepad_button_value(pad_num, gp_padl)));
    draw_text(xx, yy + spacer*28, "Right - " + string(gamepad_button_value(pad_num, gp_padr)));
    draw_text(xx, yy + spacer*30, "Up - " + string(gamepad_button_value(pad_num, gp_padu)));
    var hvaxis = abs(lefthaxis) + abs(leftvaxis)
    draw_text(xx, yy + spacer*36, "V+H speed - " + string(hvaxis));
    }
That's it really. I'm seeing the Gamepad type and Slot numbers registering correctly but there's no indication that any inputs are being pressed when they are. This is with a Switch Pro Controller that works just fine for other games on the same computer in Steam.

What's going wrong?
 

Slyddar

Member
Try this tool by Mick, which might help identify if the inputs are being registered as different then expected.
 

ajrdesign

Member
Try this tool by Mick, which might help identify if the inputs are being registered as different then expected.
hmmm this seems like a different issue. Correct me if I'm wrong. It's not that the gamepad inputs are registering as the wrong face button it's that they aren't registering at ALL.

I tried out the tool anyways and it showed the controller on the 4th input like I expected. No inputs registering still. Controller works perfectly fine outside of GMS2 though.
 

TheouAegis

Member
Loop through all pad numbers (0 thru 12) and check for a button press. When one is detected, have a popup tell you which pad number worked. If one of the pad numbers works right, that might give you insight into why the other one's not working.
 

ajrdesign

Member
There's only one controller connected.

I tried checking all devices for a button press but no luck. No inputs are triggering at all.

This is how I did it:
GML:
for (var i = 0; i < 12; ++i) {
    if gamepad_button_check(i, gp_face1) {
    draw_text(xx, yy, "GP_face1 - " + string(i));
    }
}
Nothing ever pops up.
 

ajrdesign

Member
Yes the gamepad works in other programs (steam) and I just checked the Devices Control Panel and it's appearing there as well.
 
Top