From f06d6c62815ebf10f70f680a82b30313d8c5f8b6 Mon Sep 17 00:00:00 2001 From: Sasha Szpakowski Date: Sat, 17 Jun 2023 20:33:59 -0300 Subject: [PATCH] Only add platform field to love.joystick.getGamepadMappingString's result if it's not there already. --- src/modules/joystick/sdl/Joystick.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/joystick/sdl/Joystick.cpp b/src/modules/joystick/sdl/Joystick.cpp index f451cbaf1..5d860cceb 100644 --- a/src/modules/joystick/sdl/Joystick.cpp +++ b/src/modules/joystick/sdl/Joystick.cpp @@ -323,7 +323,9 @@ std::string Joystick::getGamepadMappingString() const // Matches SDL_GameControllerAddMappingsFromRW. if (mappingstr.find_last_of(',') != mappingstr.length() - 1) mappingstr += ","; - mappingstr += "platform:" + std::string(SDL_GetPlatform()); + + if (mappingstr.find("platform:") == std::string::npos) + mappingstr += "platform:" + std::string(SDL_GetPlatform()); return mappingstr; }