diff --git a/src/init.c b/src/init.c index 4f424c4a9..17dcb2062 100644 --- a/src/init.c +++ b/src/init.c @@ -227,6 +227,19 @@ GLFWAPI int glfwInit(void) memset(&_glfw, 0, sizeof(_glfw)); _glfw.hints.init = _glfwInitHints; + { + int i; + + for (i = 0; _glfwDefaultMappings[i]; i++) + { + if (!_glfwInputUpdateGamepadMappings(_glfwDefaultMappings[i])) + { + terminate(); + return GLFW_FALSE; + } + } + } + if (!_glfwPlatformInit()) { terminate(); @@ -248,19 +261,6 @@ GLFWAPI int glfwInit(void) glfwDefaultWindowHints(); - { - int i; - - for (i = 0; _glfwDefaultMappings[i]; i++) - { - if (!glfwUpdateGamepadMappings(_glfwDefaultMappings[i])) - { - terminate(); - return GLFW_FALSE; - } - } - } - return GLFW_TRUE; } diff --git a/src/input.c b/src/input.c index 33ed06045..5b8201676 100644 --- a/src/input.c +++ b/src/input.c @@ -1083,15 +1083,13 @@ GLFWAPI GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun cbfun) return cbfun; } -GLFWAPI int glfwUpdateGamepadMappings(const char* string) +int _glfwInputUpdateGamepadMappings(const char* string) { int jid; const char* c = string; assert(string != NULL); - _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); - while (*c) { if ((*c >= '0' && *c <= '9') || @@ -1143,6 +1141,13 @@ GLFWAPI int glfwUpdateGamepadMappings(const char* string) return GLFW_TRUE; } +GLFWAPI int glfwUpdateGamepadMappings(const char* string) +{ + _GLFW_REQUIRE_INIT_OR_RETURN(GLFW_FALSE); + + return _glfwInputUpdateGamepadMappings(string); +} + GLFWAPI int glfwJoystickIsGamepad(int jid) { _GLFWjoystick* js; diff --git a/src/internal.h b/src/internal.h index e8df80a07..f0e388477 100644 --- a/src/internal.h +++ b/src/internal.h @@ -722,6 +722,8 @@ void _glfwInputJoystickAxis(_GLFWjoystick* js, int axis, float value); void _glfwInputJoystickButton(_GLFWjoystick* js, int button, char value); void _glfwInputJoystickHat(_GLFWjoystick* js, int hat, char value); +int _glfwInputUpdateGamepadMappings(const char* string); + void _glfwInputMonitor(_GLFWmonitor* monitor, int action, int placement); void _glfwInputMonitorWindow(_GLFWmonitor* monitor, _GLFWwindow* window);