mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-05 01:16:26 +00:00
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:
@@ -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))
|
||||
|
Reference in New Issue
Block a user