Fixed gamecontroller database sorting script not sorting the whole database.
authorPhilipp Wiesemann <philipp.wiesemann@arcor.de>
Wed, 29 Oct 2014 22:44:35 +0100
changeset 9205 5302aee2916a
parent 9204 b331795924d3
child 9206 f20d288435bd
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.
src/joystick/sort_controllers.py
--- a/src/joystick/sort_controllers.py	Wed Oct 29 22:41:01 2014 +0100
+++ b/src/joystick/sort_controllers.py	Wed Oct 29 22:44:35 2014 +0100
@@ -40,15 +40,17 @@
     controller_guids = {}
 
 for line in input:
-    if ( parsing_controllers ):
+    if (parsing_controllers):
         if (line.startswith("{")):
             output.write(line)
-        elif (line.startswith("#endif")):
+        elif (line.startswith("    NULL")):
             parsing_controllers = False
             write_controllers()
             output.write(line)
-        elif (line.startswith("#")):
+        elif (line.startswith("#if")):
             print("Parsing " + line.strip())
+            output.write(line)
+        elif (line.startswith("#endif")):
             write_controllers()
             output.write(line)
         else: