summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/input_default.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/main/input_default.cpp b/main/input_default.cpp
index 820069dba3..a13ddeb2b6 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -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) {