Restore compatibility with older GameCube mappings

Restore the original button values for GameCube controllers, but swap labeled mappings to positional while loading mappings

Fixes https://github.com/libsdl-org/SDL/issues/12847
This commit is contained in:
Sam Lantinga
2025-04-30 15:21:34 -07:00
parent 3730128e33
commit 21a7bbbf14
6 changed files with 55 additions and 32 deletions

View File

@@ -2474,6 +2474,7 @@ static char *JoinMapping(MappingParts *parts)
sort_order[i].index = i;
}
SDL_qsort(sort_order, parts->num_elements, sizeof(*sort_order), SortMapping);
MoveSortedEntry("face", sort_order, parts->num_elements, true);
MoveSortedEntry("type", sort_order, parts->num_elements, true);
MoveSortedEntry("platform", sort_order, parts->num_elements, true);
MoveSortedEntry("crc", sort_order, parts->num_elements, true);
@@ -2809,6 +2810,8 @@ const char *GetGamepadTypeString(SDL_GamepadType type)
return "Joy-Con (R)";
case SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR:
return "Joy-Con Pair";
case SDL_GAMEPAD_TYPE_GAMECUBE:
return "GameCube";
default:
return "";
}