sdl12-compat: os2: make sure we be able to load SDL2.dll from LIBPATH

From 67f8b3a85b782eefb4db90f34d5b0742ef2cb5fc Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 22 Oct 2022 20:55:00 +0300
Subject: [PATCH] os2: make sure we be able to load SDL2.dll from LIBPATH

See http://www.edm2.com/index.php/DosLoadModule#Gotchas
---
 src/SDL12_compat.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index 26b5caaef..1077c92af 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -1057,6 +1057,7 @@ static char loaderror[256];
     #include <os2.h>
     #define DIRSEP "\\"
     #define SDL20_LIBNAME "SDL2.dll"
+    #define SDL20_LIBNAME2 "SDL2"       /* if loading from LIBPATH */
     #define SDL20_REQUIRED_VER SDL_VERSIONNUM(2,0,7)
     #define strcpy_fn  strcpy
     #define sprintf_fn sprintf
@@ -1064,7 +1065,9 @@ static char loaderror[256];
     static SDL_bool LoadSDL20Library(void) {
         char err[256];
         if (DosLoadModule(err, sizeof(err), SDL20_LIBNAME, &Loaded_SDL20) != 0) {
-            return SDL_FALSE;
+            if (DosLoadModule(err, sizeof(err), SDL20_LIBNAME2, &Loaded_SDL20) != 0) {
+                return SDL_FALSE;
+            }
         }
         return SDL_TRUE;
     }