removed SDL version checks at runtime for compatibility with new SDL2:

With the new SDL2 versioning scheme, SDL_VERSIONNUM macro overflows the
minor version into the thousands digit after 2.9.0, e.g. encodes 2.23.0
as 4300, and we used to reject that thinking it is SDL v3 or something.
This commit is contained in:
Ozkan Sezer 2022-05-24 20:55:04 +03:00
parent 5ea6cdf51d
commit 2a67d5bcb2
1 changed files with 1 additions and 33 deletions

View File

@ -33,27 +33,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#include <stdio.h>
#if defined(USE_SDL2)
/* need at least SDL_2.0.0 */
#define SDL_MIN_X 2
#define SDL_MIN_Y 0
#define SDL_MIN_Z 0
#define SDL_REQUIREDVERSION (SDL_VERSIONNUM(SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z))
#define SDL_NEW_VERSION_REJECT (SDL_VERSIONNUM(3,0,0))
#else
/* need at least SDL_1.2.10 */
#define SDL_MIN_X 1
#define SDL_MIN_Y 2
#define SDL_MIN_Z 10
#define SDL_REQUIREDVERSION (SDL_VERSIONNUM(SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z))
/* reject 1.3.0 and newer at runtime. */
#define SDL_NEW_VERSION_REJECT (SDL_VERSIONNUM(1,3,0))
#endif
static void Sys_AtExit (void)
{
SDL_Quit();
@ -70,18 +49,8 @@ static void Sys_InitSDL (void)
#endif
Sys_Printf("Found SDL version %i.%i.%i\n",sdl_version->major,sdl_version->minor,sdl_version->patch);
if (SDL_VERSIONNUM(sdl_version->major,sdl_version->minor,sdl_version->patch) < SDL_REQUIREDVERSION)
{ /*reject running under older SDL versions */
Sys_Error("You need at least v%d.%d.%d of SDL to run this game.", SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z);
}
if (SDL_VERSIONNUM(sdl_version->major,sdl_version->minor,sdl_version->patch) >= SDL_NEW_VERSION_REJECT)
{ /*reject running under newer (1.3.x) SDL */
Sys_Error("Your version of SDL library is incompatible with me.\n"
"You need a library version in the line of %d.%d.%d\n", SDL_MIN_X,SDL_MIN_Y,SDL_MIN_Z);
}
if (SDL_Init(0) < 0)
{
if (SDL_Init(0) < 0) {
Sys_Error("Couldn't init SDL: %s", SDL_GetError());
}
atexit(Sys_AtExit);
@ -190,4 +159,3 @@ int main(int argc, char *argv[])
return 0;
}