Add SDL_SemWait and SDL_SemPost hooks

develop
lethosor 2015-03-25 16:08:25 -04:00
parent 5c877e4012
commit 42e4f584b9
2 changed files with 19 additions and 0 deletions

@ -253,6 +253,19 @@ DFhackCExport int SDL_UpperBlit(DFHack::DFSDL_Surface* src, DFHack::DFSDL_Rect*
return _SDL_UpperBlit(src, srcrect, dst, dstrect);
}
static int (*_SDL_SemWait)(vPtr) = 0;
DFhackCExport int SDL_SemWait(vPtr sem)
{
return _SDL_SemWait(sem);
}
static int (*_SDL_SemPost)(vPtr) = 0;
DFhackCExport int SDL_SemPost(vPtr sem)
{
return _SDL_SemPost(sem);
}
// hook - called at program start, initialize some stuffs we'll use later
static int (*_SDL_Init)(uint32_t flags) = 0;
DFhackCExport int DFH_SDL_Init(uint32_t flags)
@ -281,6 +294,9 @@ DFhackCExport int DFH_SDL_Init(uint32_t flags)
bind(SDL_UnlockSurface);
bind(SDL_GetMouseState);
bind(SDL_GetVideoSurface);
bind(SDL_SemWait);
bind(SDL_SemPost);
#undef bind
fprintf(stderr, "dfhack: saved real SDL functions\n");

@ -72,6 +72,9 @@ DFhackCExport void SDL_UnlockSurface(vPtr surface);
DFhackCExport uint8_t SDL_GetMouseState(int *x, int *y);
DFhackCExport void * SDL_GetVideoSurface(void);
DFhackCExport int SDL_SemWait(vPtr sem);
DFhackCExport int SDL_SemPost(vPtr sem);
// hook - called early from DF's main()
DFhackCExport int egg_init(void);