SDL: Fixed parsing symbols from SDL_oldnames.h

From 566a559beb6a3a9b622f23ab875798b814abcd09 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 4 Jan 2023 13:51:00 -0800
Subject: [PATCH] Fixed parsing symbols from SDL_oldnames.h

---
 build-scripts/rename_symbols.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/build-scripts/rename_symbols.py b/build-scripts/rename_symbols.py
index ab65c60a1ea8..ec6f705b9b1f 100755
--- a/build-scripts/rename_symbols.py
+++ b/build-scripts/rename_symbols.py
@@ -55,14 +55,21 @@ def get_all_replacements():
                 mode = 1
             else:
                 raise Exception("get_all_replacements(): expected mode 0")
-        elif line == "#else /* !SDL_ENABLE_OLD_NAMES */":
+        elif line == "#elif !defined(SDL_DISABLE_OLD_NAMES)":
             if mode == 1:
                 mode = 2
             else:
                 raise Exception("get_all_replacements(): expected mode 1")
+        elif line == "#endif /* SDL_ENABLE_OLD_NAMES */":
+            if mode == 2:
+                mode = 3
+            else:
+                raise Exception("add_symbol_to_oldnames(): expected mode 2")
         elif mode == 1 and line.startswith("#define "):
             words = line.split()
             replacements[words[1]] = words[2]
+            # In case things are accidentally renamed to the "X_renamed_Y" symbol
+            #replacements[words[1] + "_renamed_" + words[2]] = words[2]
 
     return replacements