sdl2-compat: Updated for the removal of SDL_SCALEMODE_BEST

From 61962d482971bb17571a7a7574d02dc928bcdb28 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 31 Aug 2024 08:43:40 -0700
Subject: [PATCH] Updated for the removal of SDL_SCALEMODE_BEST

---
 src/sdl2_compat.c | 14 +++++++++++---
 src/sdl3_syms.h   |  2 +-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index 629f629..2552fc8 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -4791,10 +4791,9 @@ static SDL_ScaleMode SDL_GetScaleMode(void)
 
     if (!hint || SDL3_strcasecmp(hint, "nearest") == 0) {
         return SDL_SCALEMODE_NEAREST;
-    } else if (SDL3_strcasecmp(hint, "linear") == 0) {
+    } else if (SDL3_strcasecmp(hint, "linear") == 0 ||
+               SDL3_strcasecmp(hint, "best") == 0) {
         return SDL_SCALEMODE_LINEAR;
-    } else if (SDL3_strcasecmp(hint, "best") == 0) {
-        return SDL_SCALEMODE_BEST;
     } else {
         return (SDL_ScaleMode)SDL3_atoi(hint);
     }
@@ -4844,6 +4843,15 @@ SDL_QueryTexture(SDL_Texture *texture, Uint32 *format, int *access, int *w, int
     return 0;
 }
 
+SDL_DECLSPEC int SDLCALL
+SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode)
+{
+    if (scaleMode > SDL_SCALEMODE_LINEAR) {
+        scaleMode = SDL_SCALEMODE_LINEAR;
+    }
+    return SDL3_SetTextureScaleMode(texture, scaleMode) ? 0 : -1;
+}
+
 SDL_DECLSPEC int SDLCALL
 SDL_LockMutex(SDL_Mutex *a)
 {
diff --git a/src/sdl3_syms.h b/src/sdl3_syms.h
index c1b1c13..4fd44c5 100644
--- a/src/sdl3_syms.h
+++ b/src/sdl3_syms.h
@@ -647,7 +647,7 @@ SDL3_SYM(SDL_bool,SetTextInputArea,(SDL_Window *a, const SDL_Rect *b, int c),(a,
 SDL3_SYM_PASSTHROUGH_RETCODE(SDL_bool,SetTextureAlphaMod,(SDL_Texture *a, Uint8 b),(a,b),return)
 SDL3_SYM_PASSTHROUGH_RETCODE(SDL_bool,SetTextureBlendMode,(SDL_Texture *a, SDL_BlendMode b),(a,b),return)
 SDL3_SYM_PASSTHROUGH_RETCODE(SDL_bool,SetTextureColorMod,(SDL_Texture *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return)
-SDL3_SYM_PASSTHROUGH_RETCODE(SDL_bool,SetTextureScaleMode,(SDL_Texture *a, SDL_ScaleMode b),(a,b),return)
+SDL3_SYM(SDL_bool,SetTextureScaleMode,(SDL_Texture *a, SDL_ScaleMode b),(a,b),return)
 SDL3_SYM_PASSTHROUGH_RETCODE(SDL_bool,SetThreadPriority,(SDL_ThreadPriority a),(a),return)
 SDL3_SYM(SDL_bool,SetWindowAlwaysOnTop,(SDL_Window *a, SDL_bool b),(a,b),return)
 SDL3_SYM(SDL_bool,SetWindowBordered,(SDL_Window *a, SDL_bool b),(a,b),return)