main_sdl.c: added SDL version check at runtime requiring at least SDL-1.2.10

and rejecting SDL >= 1.3.x.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@533 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2011-12-22 21:20:19 +00:00
parent bb5a1d6e38
commit 88c0c09e88
1 changed files with 26 additions and 0 deletions

View File

@ -24,6 +24,30 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "SDL.h"
#include <stdio.h>
/* 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