diff --git a/src/cocoa_joystick.h b/src/cocoa_joystick.h index 7a121c8b..cfcb7ca3 100644 --- a/src/cocoa_joystick.h +++ b/src/cocoa_joystick.h @@ -32,7 +32,6 @@ #define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickNS ns #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyJoystick; } -#define _GLFW_PLATFORM_MAPPING_NAME "Mac OS X" #define GLFW_BUILD_COCOA_MAPPINGS // Cocoa-specific per-joystick data diff --git a/src/cocoa_joystick.m b/src/cocoa_joystick.m index a8081d2c..5e2666b2 100644 --- a/src/cocoa_joystick.m +++ b/src/cocoa_joystick.m @@ -469,6 +469,11 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode) return js->present; } +const char* _glfwPlatformGetMappingName(void) +{ + return "Mac OS X"; +} + void _glfwPlatformUpdateGamepadGUID(char* guid) { if ((strncmp(guid + 4, "000000000000", 12) == 0) && diff --git a/src/input.c b/src/input.c index 83ef6921..920db8de 100644 --- a/src/input.c +++ b/src/input.c @@ -234,8 +234,9 @@ static GLFWbool parseMapping(_GLFWmapping* mapping, const char* string) } else { - length = strlen(_GLFW_PLATFORM_MAPPING_NAME); - if (strncmp(c, _GLFW_PLATFORM_MAPPING_NAME, length) != 0) + const char* name = _glfwPlatformGetMappingName(); + length = strlen(name); + if (strncmp(c, name, length) != 0) return GLFW_FALSE; } diff --git a/src/internal.h b/src/internal.h index f41db3c3..0a9a965a 100644 --- a/src/internal.h +++ b/src/internal.h @@ -642,6 +642,7 @@ GLFWbool _glfwPlatformInitJoysticks(void); void _glfwPlatformTerminateJoysticks(void); int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode); void _glfwPlatformUpdateGamepadGUID(char* guid); +const char* _glfwPlatformGetMappingName(void); uint64_t _glfwPlatformGetTimerValue(void); uint64_t _glfwPlatformGetTimerFrequency(void); diff --git a/src/linux_joystick.c b/src/linux_joystick.c index 122bc66a..edb53e4c 100644 --- a/src/linux_joystick.c +++ b/src/linux_joystick.c @@ -422,6 +422,11 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode) return js->present; } +const char* _glfwPlatformGetMappingName(void) +{ + return "Linux"; +} + void _glfwPlatformUpdateGamepadGUID(char* guid) { } diff --git a/src/linux_joystick.h b/src/linux_joystick.h index 1c3ca751..1766a3bf 100644 --- a/src/linux_joystick.h +++ b/src/linux_joystick.h @@ -31,7 +31,6 @@ #define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickLinux linjs #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE _GLFWlibraryLinux linjs -#define _GLFW_PLATFORM_MAPPING_NAME "Linux" #define GLFW_BUILD_LINUX_MAPPINGS // Linux-specific joystick data diff --git a/src/null_joystick.c b/src/null_joystick.c index 27756a61..de5066ca 100644 --- a/src/null_joystick.c +++ b/src/null_joystick.c @@ -47,6 +47,11 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode) return GLFW_FALSE; } +const char* _glfwPlatformGetMappingName(void) +{ + return ""; +} + void _glfwPlatformUpdateGamepadGUID(char* guid) { } diff --git a/src/null_joystick.h b/src/null_joystick.h index 5d19a451..a1ff7fcd 100644 --- a/src/null_joystick.h +++ b/src/null_joystick.h @@ -27,5 +27,3 @@ #define _GLFW_PLATFORM_JOYSTICK_STATE struct { int dummyJoystick; } #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyLibraryJoystick; } -#define _GLFW_PLATFORM_MAPPING_NAME "" - diff --git a/src/win32_joystick.c b/src/win32_joystick.c index 3ac29d1d..bb5ed1a3 100644 --- a/src/win32_joystick.c +++ b/src/win32_joystick.c @@ -740,6 +740,11 @@ int _glfwPlatformPollJoystick(_GLFWjoystick* js, int mode) return GLFW_TRUE; } +const char* _glfwPlatformGetMappingName(void) +{ + return "Windows"; +} + void _glfwPlatformUpdateGamepadGUID(char* guid) { if (strcmp(guid + 20, "504944564944") == 0) diff --git a/src/win32_joystick.h b/src/win32_joystick.h index c469fcdc..b9bb6779 100644 --- a/src/win32_joystick.h +++ b/src/win32_joystick.h @@ -27,7 +27,6 @@ #define _GLFW_PLATFORM_JOYSTICK_STATE _GLFWjoystickWin32 win32 #define _GLFW_PLATFORM_LIBRARY_JOYSTICK_STATE struct { int dummyLibraryJoystick; } -#define _GLFW_PLATFORM_MAPPING_NAME "Windows" #define GLFW_BUILD_WIN32_MAPPINGS // Joystick element (axis, button or slider)