From 55b023c96139cb26a944c97a0f998acec0c96a67 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 6 Jun 2025 09:22:14 -0700
Subject: [PATCH] Remove the CRC from automatically generated gamepad mappings
Fixes https://github.com/libsdl-org/SDL/issues/13127
(cherry picked from commit 638acdc02a8dd6314674775dfec37ac6b90dd8cf)
---
src/joystick/SDL_gamepad.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/joystick/SDL_gamepad.c b/src/joystick/SDL_gamepad.c
index 385e890cf9809..3fc952090e26d 100644
--- a/src/joystick/SDL_gamepad.c
+++ b/src/joystick/SDL_gamepad.c
@@ -1786,6 +1786,11 @@ static GamepadMapping_t *SDL_PrivateGenerateAutomaticGamepadMapping(const char *
char name_string[128];
char mapping[1024];
+ // Remove the CRC from the GUID
+ // We already know that this GUID doesn't have a mapping without the CRC, and we want newly
+ // added mappings without a CRC to override this mapping.
+ SDL_SetJoystickGUIDCRC(&guid, 0);
+
// Remove any commas in the name
SDL_strlcpy(name_string, name, sizeof(name_string));
{