SDL: Added a hint to return the version in the old format

From 4e375996d3c935e78fe7f83fd12cc529d7b0eb80 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 26 Sep 2022 17:06:18 -0700
Subject: [PATCH] Added a hint to return the version in the old format

Workaround for https://github.com/libsdl-org/SDL/issues/6177 for games that can't be updated.
---
 src/SDL.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/SDL.c b/src/SDL.c
index 9bdc67fa380c..0e1c32a92c6a 100644
--- a/src/SDL.c
+++ b/src/SDL.c
@@ -514,7 +514,17 @@ SDL_Quit(void)
 void
 SDL_GetVersion(SDL_version * ver)
 {
+    if (!ver) {
+        return;
+    }
+
     SDL_VERSION(ver);
+
+    if (SDL_GetHintBoolean("SDL_LEGACY_VERSION", SDL_FALSE)) {
+        /* Prior to SDL 2.24.0, the patch version was incremented with every release */
+        ver->patch = ver->minor;
+        ver->minor = 0;
+    }
 }
 
 /* Get the library source revision */