diff --git a/Quake/main_sdl.c b/Quake/main_sdl.c index feb77dd3..03952e37 100644 --- a/Quake/main_sdl.c +++ b/Quake/main_sdl.c @@ -24,6 +24,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "SDL.h" #include +/* 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)) + +static void Sys_CheckSDL (void) +{ + const SDL_version *sdl_version = SDL_Linked_Version(); + + 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); + } +} + #define DEFAULT_MEMORY 0x4000000 static quakeparms_t parms; @@ -44,6 +68,8 @@ int main(int argc, char *argv[]) isDedicated = (COM_CheckParm("-dedicated") != 0); + Sys_CheckSDL (); + Sys_Init(); // default memory size