Gamepad: Parse SDL_GAMECONTROLLERCONFIG env after default mappings

Addresses comment https://github.com/godotengine/godot/issues/21918#issuecomment-458764923.
This commit is contained in:
Rémi Verschelde 2020-01-08 11:43:44 +01:00
parent ed22a4c454
commit 0584c7f094

View file

@ -727,9 +727,17 @@ InputDefault::InputDefault() {
fallback_mapping = -1;
// Parse default mappings.
{
int i = 0;
while (DefaultControllerMappings::mappings[i]) {
parse_mapping(DefaultControllerMappings::mappings[i++]);
}
}
// If defined, parse SDL_GAMECONTROLLERCONFIG for possible new mappings/overrides.
String env_mapping = OS::get_singleton()->get_environment("SDL_GAMECONTROLLERCONFIG");
if (env_mapping != "") {
Vector<String> entries = env_mapping.split("\n");
for (int i = 0; i < entries.size(); i++) {
if (entries[i] == "")
@ -737,12 +745,6 @@ InputDefault::InputDefault() {
parse_mapping(entries[i]);
}
}
int i = 0;
while (DefaultControllerMappings::mappings[i]) {
parse_mapping(DefaultControllerMappings::mappings[i++]);
}
}
void InputDefault::joy_button(int p_device, int p_button, bool p_pressed) {