Fixed gamecontroller database sorting script not sorting the whole database.
The script was originally written for an SDL_gamecontrollerdb.h which had groups
of mappings separated by single lines starting with a "#". This was changed some
time ago to #endif/#if pairs. Because the script assumed only a single #endif in
the whole file it no longer worked correctly and only processed the first group.
1.1 --- a/src/joystick/sort_controllers.py Wed Oct 29 22:41:01 2014 +0100
1.2 +++ b/src/joystick/sort_controllers.py Wed Oct 29 22:44:35 2014 +0100
1.3 @@ -40,15 +40,17 @@
1.4 controller_guids = {}
1.5
1.6 for line in input:
1.7 - if ( parsing_controllers ):
1.8 + if (parsing_controllers):
1.9 if (line.startswith("{")):
1.10 output.write(line)
1.11 - elif (line.startswith("#endif")):
1.12 + elif (line.startswith(" NULL")):
1.13 parsing_controllers = False
1.14 write_controllers()
1.15 output.write(line)
1.16 - elif (line.startswith("#")):
1.17 + elif (line.startswith("#if")):
1.18 print("Parsing " + line.strip())
1.19 + output.write(line)
1.20 + elif (line.startswith("#endif")):
1.21 write_controllers()
1.22 output.write(line)
1.23 else: