Gamepad input not working

Monkey Targets Forums/Desktop/Gamepad input not working

Soap(Posted 2014) [#1]
Any idea on how to debug gamepad input on a glfw target for a computer it's not working on? XNA builds work with gamepad, and other games work with the gamepad, but on this user's computer glfw targets do not work with gamepad input.


Ferdi(Posted 2014) [#2]
I am going to assume you are talking about Windows. I guess the first thing to make sure is that he has winmm.dll in his computer. If not create a package with winmm.dll in it.

Why winmm.dll? Take a look at the following code from the initilization in targets\glfw\template\glfw\lib\win32\win32_init.c, function: _glfwInitLibraries

    // winmm.dll (for joystick and timer support)
#ifndef _GLFW_NO_DLOAD_WINMM
    _glfwLibrary.Libs.winmm = LoadLibrary( "winmm.dll" );
    if( _glfwLibrary.Libs.winmm != NULL )
    {
        _glfwLibrary.Libs.joyGetDevCapsA = (JOYGETDEVCAPSA_T)
            GetProcAddress( _glfwLibrary.Libs.winmm, "joyGetDevCapsA" );
        _glfwLibrary.Libs.joyGetPos      = (JOYGETPOS_T)
            GetProcAddress( _glfwLibrary.Libs.winmm, "joyGetPos" );
        _glfwLibrary.Libs.joyGetPosEx    = (JOYGETPOSEX_T)
            GetProcAddress( _glfwLibrary.Libs.winmm, "joyGetPosEx" );
        _glfwLibrary.Libs.timeGetTime    = (TIMEGETTIME_T)
            GetProcAddress( _glfwLibrary.Libs.winmm, "timeGetTime" );
        if( _glfwLibrary.Libs.joyGetDevCapsA == NULL ||
            _glfwLibrary.Libs.joyGetPos      == NULL ||
            _glfwLibrary.Libs.joyGetPosEx    == NULL ||
            _glfwLibrary.Libs.timeGetTime    == NULL )
        {
            FreeLibrary( _glfwLibrary.Libs.winmm );
            _glfwLibrary.Libs.winmm = NULL;
            return GL_FALSE;
        }
    }
    else
    {
        return GL_FALSE;
    }
#endif // _GLFW_NO_DLOAD_WINMM


I guess that will be the starting point for debugging, after that you need to look into win32_joystick.c, firstly function _glfwJoystickPresent.

Hope it is helpful.


ElectricBoogaloo(Posted 2014) [#3]
Open the control panel's USB controller setup thing, and in the main window, click Advanced.
From there, be sure that the primary Gamepad is indeed selected.
That happened on mine, a while back, and it took me AGES to figure out what was up with it!!