mirror of
https://github.com/love2d/love.git
synced 2026-08-12 00:20:52 +02:00
love.joystick: more fixes for duplicate platform fields in gamepad mapping strings.
This commit is contained in:
@@ -470,7 +470,9 @@ std::string JoystickModule::getGamepadMappingString(const std::string &guid) con
|
||||
// Matches SDL_GameControllerAddMappingsFromRW.
|
||||
if (mapping.find_last_of(',') != mapping.length() - 1)
|
||||
mapping += ",";
|
||||
mapping += "platform:" + std::string(SDL_GetPlatform());
|
||||
|
||||
if (mapping.find("platform:") == std::string::npos)
|
||||
mapping += "platform:" + std::string(SDL_GetPlatform());
|
||||
|
||||
return mapping;
|
||||
}
|
||||
@@ -494,8 +496,10 @@ std::string JoystickModule::saveGamepadMappings()
|
||||
mapping += ",";
|
||||
|
||||
// Matches SDL_GameControllerAddMappingsFromRW.
|
||||
mapping += "platform:" + std::string(SDL_GetPlatform()) + ",\n";
|
||||
mappings += mapping;
|
||||
if (mapping.find("platform:") == std::string::npos)
|
||||
mapping += "platform:" + std::string(SDL_GetPlatform()) + ",";
|
||||
|
||||
mappings += mapping + "\n";
|
||||
}
|
||||
|
||||
return mappings;
|
||||
|
||||
Reference in New Issue
Block a user