Added Android SDK conditionals to game controller mappings

The Nintendo Switch Pro controller has a different mapping on Android 10 and newer
This commit is contained in:
Sam Lantinga
2020-02-17 14:15:47 -08:00
parent d7ece7ee6f
commit ad225047b6
3 changed files with 33 additions and 4 deletions

View File

@@ -11,6 +11,7 @@ output = open(filename + ".new", "w")
parsing_controllers = False
controllers = []
controller_guids = {}
sdk_conditionals = []
split_pattern = re.compile(r'([^"]*")([^,]*,)([^,]*,)([^"]*)(".*)')
def save_controller(line):
@@ -24,12 +25,15 @@ def save_controller(line):
entry.append(match.group(5))
controllers.append(entry)
if ',sdk' in line:
sdk_conditionals.append(entry[1])
def write_controllers():
global controllers
global controller_guids
# Check for duplicates
for entry in controllers:
if (entry[1] in controller_guids):
if (entry[1] in controller_guids and entry[1] not in sdk_conditionals):
current_name = entry[2]
existing_name = controller_guids[entry[1]][2]
print("Warning: entry '%s' is duplicate of entry '%s'" % (current_name, existing_name))