Skip to content

Commit

Permalink
Fixed some symbols that aren't actually available in SDL 2.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Feb 14, 2019
1 parent b351225 commit 35d6e0e
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
48 changes: 46 additions & 2 deletions src/SDL12_compat.c
Expand Up @@ -534,6 +534,50 @@ SDL_Linked_Version(void)
return &version;
}

DECLSPEC int SDLCALL
SDL_sscanf(const char *text, const char *fmt, ...)
{
int retval;
va_list ap;
va_start(ap, fmt);
retval = (int) SDL20_sscanf(text, fmt, ap);
va_end(ap);
return retval;
}

DECLSPEC int SDLCALL
SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...)
{
int retval;
va_list ap;
va_start(ap, fmt);
retval = (int) SDL20_vsnprintf(text, maxlen, fmt, ap);
va_end(ap);
return retval;
}

DECLSPEC SDL_bool SDLCALL
SDL_HasMMXExt(void)
{
/* this isn't accurate, but SDL2 doesn't have this for some reason.
MMXExt is available in all SSE1 machines, except early Athlon chips,
so we'll just say it's available if they have SSE1. Oh well. */
return SDL20_HasSSE();
}

DECLSPEC SDL_bool SDLCALL
SDL_Has3DNowExt(void)
{
FIXME("check this");
return SDL20_HasSSE();
}

DECLSPEC int SDLCALL SDL_JoystickOpened(int device_index)
{
FIXME("write me");
return 0;
}

static int
GetVideoDisplay()
{
Expand Down Expand Up @@ -836,9 +880,9 @@ SDL_SetError(const char *fmt, ...)
DECLSPEC const char * SDLCALL
SDL_GetError(void)
{
if (!Loaded_SDL20)
if (SDL20_GetError == NULL)
{
static const char noload_errstr[] = "Failed to load SDL 2.0 shared library";
static const char noload_errstr[] = "The SDL 2.0 library that the 1.2 compatibility layer needs isn't loaded";
return noload_errstr;
}
return SDL20_GetError();
Expand Down
3 changes: 0 additions & 3 deletions src/SDL20_syms.h
Expand Up @@ -166,9 +166,7 @@ SDL20_SYM_PASSTHROUGH(void,UnloadObject,(void *a),(a),)

SDL20_SYM_PASSTHROUGH(SDL_bool,HasRDTSC,(void),(),return)
SDL20_SYM_PASSTHROUGH(SDL_bool,HasMMX,(void),(),return)
SDL20_SYM_PASSTHROUGH(SDL_bool,HasMMXExt,(void),(),return)
SDL20_SYM_PASSTHROUGH(SDL_bool,Has3DNow,(void),(),return)
SDL20_SYM_PASSTHROUGH(SDL_bool,Has3DNowExt,(void),(),return)
SDL20_SYM_PASSTHROUGH(SDL_bool,HasSSE,(void),(),return)
SDL20_SYM_PASSTHROUGH(SDL_bool,HasSSE2,(void),(),return)
SDL20_SYM_PASSTHROUGH(SDL_bool,HasAltiVec,(void),(),return)
Expand All @@ -181,7 +179,6 @@ SDL20_SYM_PASSTHROUGH(void,Delay,(Uint32 a),(a),)
SDL20_SYM_PASSTHROUGH(int,NumJoysticks,(void),(),return)
SDL20_SYM_PASSTHROUGH(const char *,JoystickName,(int a),(a),return)
SDL20_SYM_PASSTHROUGH(SDL_Joystick *,JoystickOpen,(int a),(a),return)
SDL20_SYM_PASSTHROUGH(int,JoystickOpened,(int a),(a),return)
SDL20_SYM_PASSTHROUGH(int,JoystickIndex,(SDL_Joystick *a),(a),return)
SDL20_SYM_PASSTHROUGH(int,JoystickNumAxes,(SDL_Joystick *a),(a),return)
SDL20_SYM_PASSTHROUGH(int,JoystickNumBalls,(SDL_Joystick *a),(a),return)
Expand Down

0 comments on commit 35d6e0e

Please sign in to comment.