sdl12-compat: quirks: Force X11 if plib (specifically libplibssg) is detected

From 38132e2e828bf6a8865c69351632395dbe0f02ec Mon Sep 17 00:00:00 2001
From: Simon McVittie <[EMAIL REDACTED]>
Date: Mon, 24 Oct 2022 14:29:41 +0100
Subject: [PATCH] quirks: Force X11 if plib (specifically libplibssg) is
 detected

crrcsim, a model aeroplane simulator, is linked to both SDL 1.2 and
plib. I'm not entirely sure why, since plib seems to be an (unmaintained)
alternative to SDL that did many of the same things.

Because plib has a C++ ABI but dlsym() works with C-level ABI, we need
to use a C++ mangled name for the symbol we look for.

Resolves: https://github.com/libsdl-org/sdl12-compat/issues/252
Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 src/SDL12_compat.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 1077c92af..612d190fa 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -1368,6 +1368,8 @@ LoadSDL20(void)
                 force_x11 = SDL_TRUE;
             } else if (dlsym(global_symbols, "cgGLEnableProgramProfiles") != NULL) {  /* NVIDIA Cg (e.g. Awesomenauts, Braid) */
                 force_x11 = SDL_TRUE;
+            } else if (dlsym(global_symbols, "_Z7ssgInitv") != NULL) {  /* ::ssgInit(void) in plib (e.g. crrcsim) */
+                force_x11 = SDL_TRUE;
             }
             dlclose(global_symbols);
         }