From ec6571c9460f6f636117ed181a03e46d93af6f59 Mon Sep 17 00:00:00 2001
From: Cameron Gutman <[EMAIL REDACTED]>
Date: Sat, 15 Feb 2025 15:04:09 -0600
Subject: [PATCH] init: Print the required SDL3 version even if a function is
unavailable
As a side-effect, this also strictly enforces the rule of no SDL3 usage during init.
Fixes #357
---
src/sdl2_compat.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index bb921d9..7d049f6 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -834,8 +834,8 @@ LoadSDL3(void)
if (!okay) {
SDL2COMPAT_stpcpy(loaderror, "Failed loading SDL3 library.");
} else {
- #define SDL3_SYM(rc,fn,params,args,ret) SDL3_##fn = (SDL3_##fn##_t) LoadSDL3Symbol("SDL_" #fn, &okay);
- #include "sdl3_syms.h"
+ /* Load SDL_GetVersion() alone first to allow us to check and log the required SDL3 version */
+ SDL3_GetVersion = (SDL3_GetVersion_t) LoadSDL3Symbol("SDL_GetVersion", &okay);
if (okay) {
char sdl3verstr[16];
char sdl3reqverstr[16];
@@ -891,6 +891,8 @@ LoadSDL3(void)
SDL2Compat_ApplyQuirks(force_x11); /* Apply and maybe print a list of any enabled quirks. */
}
}
+ #define SDL3_SYM(rc,fn,params,args,ret) SDL3_##fn = (SDL3_##fn##_t) LoadSDL3Symbol("SDL_" #fn, &okay);
+ #include "sdl3_syms.h"
if (!okay) {
UnloadSDL3();
}