Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 57dd04d1 authored by deuce's avatar deuce

Initial SDL2 work. This is rough and only lightly tested.

It's not unlikely that any utilities using SDL will have new issues... you
may want to hold off on updates for a bit until this settles unless you
don't use SDL mode.
parent 05109630
!ifdef USE_SDL
CIOLIB-MT_CFLAGS = $(CIOLIB-MT_CFLAGS) -DHAS_VSTAT -DWITH_SDL -DWIN32 -I${SRC_ROOT}/../include/sdl
CIOLIB_CFLAGS = $(CIOLIB_CFLAGS) -DHAS_VSTAT -DWITH_SDL -DWIN32 -I${SRC_ROOT}/../include/sdl
CIOLIB-MT_CFLAGS = $(CIOLIB-MT_CFLAGS) -DHAS_VSTAT -DWITH_SDL -DWIN32 -I${3RDP_ROOT}/win32.release/sdl2/include
CIOLIB_CFLAGS = $(CIOLIB_CFLAGS) -DHAS_VSTAT -DWITH_SDL -DWIN32 -I${3RDP_ROOT}/win32.release/sdl2/include
!ifdef STATIC_SDL
CIOLIB-MT_CFLAGS = $(CIOLIB-MT_CFLAGS) -DSTATIC_SDL
CIOLIB_CFLAGS = $(CIOLIB_CFLAGS) -DSTATIC_SDL
......
......@@ -21,7 +21,7 @@ ifeq ($(os),openbsd)
CFLAGS += -DHAVE_VASPRINTF
endif
ifeq ($(os),win32)
CFLAGS += -I${SRC_ROOT}/../include/sdl
CFLAGS += -I${3RDP_ROOT}/win32.release/sdl2/include
endif
ifneq ($(os),win32)
......@@ -60,33 +60,28 @@ endif
ifdef USE_SDL
ifndef WITH_SDL_AUDIO
ifdef SDL_CONFIG
ifeq ($(shell ${SDL_CONFIG} --cflags > /dev/null 2>&1 && echo YES),YES)
WITH_SDL := 1
ifeq ($(shell if [ `${SDL_CONFIG} --version | sed -E 's/\..*$$//'` -ge 2 ] ; then echo 'YES' ; fi),YES)
WITH_SDL := 1
endif
else
ifeq ($(os),darwin)
ifeq ($(shell if [ -d /Library/Frameworks/SDL.framework ] ; then echo YES ; fi),YES)
ifeq ($(shell if [ -d /Library/Frameworks/SDL.framework ] ; then echo YES ; fi),YES)
SDL_FRAMEWORK_PATH ?= /Library/Frameworks
endif
endif
ifdef SDL_FRAMEWORK_PATH
WITH_SDL := 1
CIOLIB-MT_LDFLAGS += -Wl,-rpath,@executable_path/../Frameworks
endif
else
ifeq ($(shell sdl12-config --cflags > /dev/null 2>&1 && echo YES),YES)
SDL_CONFIG := sdl12-config
ifeq ($(shell sdl2-config --cflags > /dev/null 2>&1 && echo YES),YES)
SDL_CONFIG := sdl2-config
WITH_SDL := 1
else
ifeq ($(shell sdl-config --cflags > /dev/null 2>&1 && echo YES),YES)
ifeq ($(shell if [ `sdl-config --version | sed -E 's/\..*$$//'` -ge 2 ] ; then echo 'YES' ; fi),YES)
SDL_CONFIG := sdl-config
WITH_SDL := 1
else
ifeq ($(shell sdl11-config --cflags > /dev/null 2>&1 && echo YES),YES)
SDL_CONFIG := sdl11-config
WITH_SDL := 1
endif
endif
endif
endif
endif
endif
endif
......
......@@ -5,7 +5,6 @@ include $(SRC_ROOT)/build/Common.gmake # defines clean and output directory rule
CFLAGS += $(XPDEV-MT_CFLAGS) $(ENCODE_CFLAGS) $(CIOLIB-MT_CFLAGS)
ifeq ($(os),win32)
OBJS += $(MTOBJODIR)$(DIRSEP)SDL_win32_main$(OFILE)
OBJS += $(MTOBJODIR)$(DIRSEP)win32cio$(OFILE)
OBJS += $(MTOBJODIR)$(DIRSEP)ciolib_res$(OFILE)
else
......@@ -31,7 +30,6 @@ else
OBJS += $(MTOBJODIR)$(DIRSEP)sdl_con$(OFILE)
OBJS += $(MTOBJODIR)$(DIRSEP)sdlfuncs$(OFILE)
ifeq ($(os),darwin)
OBJS += $(MTOBJODIR)$(DIRSEP)SDLMain$(OFILE)
OBJS += $(MTOBJODIR)$(DIRSEP)pasteboard$(OFILE)
endif
endif
......@@ -58,10 +56,6 @@ $(CIOLIB-MT_SHLIB_BUILD): $(MTOBJODIR) $(OBJS)
$(QUIET)$(MKSHLIB) $(LDFLAGS) $(OBJS) $(SHLIBOPTS) -o $@
ifeq ($(os),darwin)
$(MTOBJODIR)$(DIRSEP)SDLMain$(OFILE): SDLMain.m
@echo $(COMPILE_MSG) $<
$(QUIET)$(CC) $(CFLAGS) $(CCFLAGS) -o $@ -c $<
$(MTOBJODIR)$(DIRSEP)pasteboard$(OFILE): pasteboard.m
@echo $(COMPILE_MSG) $<
$(QUIET)$(CC) $(CFLAGS) $(CCFLAGS) -o $@ -c $<
......
......@@ -544,11 +544,6 @@ CIOLIBEXPORT void CIOLIBCALL ansi_ciolib_setdoorway(int enable);
#ifdef WITH_SDL
#include <gen_defs.h>
#include <SDL.h>
#ifdef main
#undef main
#endif
#define main CIOLIB_main
#endif
#define CIOLIB_BUTTON_1 1
......
This diff is collapsed.
......@@ -11,6 +11,7 @@ int sdl_init_mode(int mode);
int sdl_setup_colours(void);
int sdl_draw_char(unsigned short vch, int xpos, int ypos);
int sdl_screen_redraw(void);
void exit_sdl_con(void);
/* High-level stuff */
void sdl_setscaling(int new_value);
......
......@@ -4,13 +4,8 @@
#include "gen_defs.h"
#include "threadwrap.h"
#include <SDL.h>
#ifndef main
#define USE_REAL_MAIN
#endif
#ifdef USE_REAL_MAIN
#undef main
#endif
#include "sdlfuncs.h"
#include "sdl_con.h"
extern int sdl_video_initialized;
#ifndef _WIN32
......@@ -26,23 +21,13 @@ struct sdlfuncs sdl;
static int sdl_funcs_loaded=0;
static int sdl_initialized=0;
static int sdl_audio_initialized=0;
static int (*sdl_drawing_thread)(void *data)=NULL;
static void (*sdl_exit_drawing_thread)(void)=NULL;
static int main_returned=0;
static SDL_sem *sdl_main_sem;
SDL_sem *sdl_exit_sem;
int CIOLIB_main(int argc, char **argv, char **enviro);
int XPDEV_main(int argc, char **argv, char **enviro)
{
return CIOLIB_main(argc, argv, enviro);
}
static void QuitWrap(void);
int load_sdl_funcs(struct sdlfuncs *sdlf)
{
dll_handle sdl_dll;
const char *libnames[]={"SDL", "SDL-1.2", "SDL-1.1", NULL};
const char *libnames[]={"SDL2", "SDL", NULL};
putenv("SDL_VIDEO_ALLOW_SCREENSAVER=1");
sdlf->gotfuncs=0;
......@@ -63,11 +48,12 @@ int load_sdl_funcs(struct sdlfuncs *sdlf)
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->mutexP=xp_dlsym(sdl_dll, SDL_mutexP))==NULL) {
// SDL2: Rename from mutexP/mutexV to LockMutex/UnlockMutex
if((sdlf->mutexP=xp_dlsym(sdl_dll, SDL_LockMutex))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->mutexV=xp_dlsym(sdl_dll, SDL_mutexV))==NULL) {
if((sdlf->mutexV=xp_dlsym(sdl_dll, SDL_UnlockMutex))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
......@@ -75,7 +61,7 @@ int load_sdl_funcs(struct sdlfuncs *sdlf)
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->VideoDriverName=xp_dlsym(sdl_dll, SDL_VideoDriverName))==NULL) {
if((sdlf->GetCurrentVideoDriver=xp_dlsym(sdl_dll, SDL_GetCurrentVideoDriver))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
......@@ -107,19 +93,11 @@ int load_sdl_funcs(struct sdlfuncs *sdlf)
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->SetColors=xp_dlsym(sdl_dll, SDL_SetColors))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->BlitSurface=xp_dlsym(sdl_dll, SDL_UpperBlit))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->UpdateRects=xp_dlsym(sdl_dll, SDL_UpdateRects))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->UpdateRect=xp_dlsym(sdl_dll, SDL_UpdateRect))==NULL) {
if((sdlf->RenderPresent=xp_dlsym(sdl_dll, SDL_RenderPresent))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
......@@ -139,23 +117,27 @@ int load_sdl_funcs(struct sdlfuncs *sdlf)
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->KillThread=xp_dlsym(sdl_dll, SDL_KillThread))==NULL) {
if((sdlf->WaitThread=xp_dlsym(sdl_dll, SDL_WaitThread))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->WaitThread=xp_dlsym(sdl_dll, SDL_WaitThread))==NULL) {
if((sdlf->WaitEventTimeout=xp_dlsym(sdl_dll, SDL_WaitEventTimeout))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->WaitEvent=xp_dlsym(sdl_dll, SDL_WaitEvent))==NULL) {
if((sdlf->PollEvent=xp_dlsym(sdl_dll, SDL_PollEvent))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->PollEvent=xp_dlsym(sdl_dll, SDL_PollEvent))==NULL) {
if((sdlf->CreateWindow=xp_dlsym(sdl_dll, SDL_CreateWindow))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->SetVideoMode=xp_dlsym(sdl_dll, SDL_SetVideoMode))==NULL) {
if((sdlf->CreateWindowAndRenderer=xp_dlsym(sdl_dll, SDL_CreateWindowAndRenderer))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->CreateRenderer=xp_dlsym(sdl_dll, SDL_CreateRenderer))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
......@@ -163,31 +145,31 @@ int load_sdl_funcs(struct sdlfuncs *sdlf)
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->WM_SetCaption=xp_dlsym(sdl_dll, SDL_WM_SetCaption))==NULL) {
if((sdlf->SetWindowTitle=xp_dlsym(sdl_dll, SDL_SetWindowTitle))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->WM_SetIcon=xp_dlsym(sdl_dll, SDL_WM_SetIcon))==NULL) {
if((sdlf->GetWindowSize=xp_dlsym(sdl_dll, SDL_GetWindowSize))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->ShowCursor=xp_dlsym(sdl_dll, SDL_ShowCursor))==NULL) {
if((sdlf->GetWindowSurface=xp_dlsym(sdl_dll, SDL_GetWindowSurface))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->WasInit=xp_dlsym(sdl_dll, SDL_WasInit))==NULL) {
if((sdlf->SetWindowIcon=xp_dlsym(sdl_dll, SDL_SetWindowIcon))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->EnableUNICODE=xp_dlsym(sdl_dll, SDL_EnableUNICODE))==NULL) {
if((sdlf->ShowCursor=xp_dlsym(sdl_dll, SDL_ShowCursor))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->EnableKeyRepeat=xp_dlsym(sdl_dll, SDL_EnableKeyRepeat))==NULL) {
if((sdlf->WasInit=xp_dlsym(sdl_dll, SDL_WasInit))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->GetWMInfo=xp_dlsym(sdl_dll, SDL_GetWMInfo))==NULL) {
if((sdlf->GetWindowWMInfo=xp_dlsym(sdl_dll, SDL_GetWindowWMInfo))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
......@@ -239,42 +221,31 @@ int load_sdl_funcs(struct sdlfuncs *sdlf)
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->DisplayFormat=xp_dlsym(sdl_dll, SDL_DisplayFormat))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->Flip=xp_dlsym(sdl_dll, SDL_Flip))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->CreateYUVOverlay=xp_dlsym(sdl_dll, SDL_CreateYUVOverlay))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->DisplayYUVOverlay=xp_dlsym(sdl_dll, SDL_DisplayYUVOverlay))==NULL) {
if((sdlf->ConvertSurface=xp_dlsym(sdl_dll, SDL_ConvertSurface))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->FreeYUVOverlay=xp_dlsym(sdl_dll, SDL_FreeYUVOverlay))==NULL) {
if((sdlf->CreateTexture=xp_dlsym(sdl_dll, SDL_CreateTexture))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->LockYUVOverlay=xp_dlsym(sdl_dll, SDL_LockYUVOverlay))==NULL) {
if((sdlf->UpdateTexture=xp_dlsym(sdl_dll, SDL_UpdateTexture))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->UnlockYUVOverlay=xp_dlsym(sdl_dll, SDL_UnlockYUVOverlay))==NULL) {
if((sdlf->RenderClear=xp_dlsym(sdl_dll, SDL_RenderClear))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->GetVideoInfo=xp_dlsym(sdl_dll, SDL_GetVideoInfo))==NULL) {
if((sdlf->RenderCopy=xp_dlsym(sdl_dll, SDL_RenderCopy))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
if((sdlf->Linked_Version=xp_dlsym(sdl_dll, SDL_Linked_Version))==NULL) {
if((sdlf->SetHint=xp_dlsym(sdl_dll, SDL_SetHint))==NULL) {
xp_dlclose(sdl_dll);
return(-1);
}
sdlf->gotfuncs=1;
sdl_funcs_loaded=1;
return(0);
......@@ -282,164 +253,112 @@ int load_sdl_funcs(struct sdlfuncs *sdlf)
int init_sdl_video(void)
{
/* This is all handled in SDL_main_env() */
if(sdl_video_initialized)
return(0);
else
return(-1);
}
int init_sdl_audio(void)
{
if(!sdl_initialized)
return(-1);
if(sdl_audio_initialized)
return(0);
if(sdl.InitSubSystem(SDL_INIT_AUDIO)==0) {
sdl_audio_initialized=TRUE;
return(0);
}
return(-1);
}
struct main_args {
int argc;
char **argv;
char **enviro;
};
static int sdl_run_main(void *data)
{
struct main_args *args;
int ret;
args=data;
ret=CIOLIB_main(args->argc, args->argv, args->enviro);
main_returned=1;
sdl.SemPost(sdl_main_sem);
if(sdl_exit_drawing_thread!=NULL)
sdl_exit_drawing_thread();
sdl.SemPost(sdl_exit_sem);
return(ret);
}
void run_sdl_drawing_thread(int (*drawing_thread)(void *data), void (*exit_drawing_thread)(void))
{
sdl_drawing_thread=drawing_thread;
sdl_exit_drawing_thread=exit_drawing_thread;
sdl.SemPost(sdl_main_sem);
}
static void QuitWrap(void)
{
if(sdl.Quit && sdl_initialized)
sdl.Quit();
}
#ifndef main
int main(int argc, char **argv, char **env)
#else
int SDL_main_env(int argc, char **argv, char **env)
#endif
{
char drivername[64];
struct main_args ma;
SDL_Thread *main_thread;
int main_ret=0;
char *drivername;
int use_sdl_video=FALSE;
#ifdef _WIN32
char *driver_env=NULL;
#endif
ma.argc=argc;
ma.argv=argv;
ma.enviro=env;
if(sdl_video_initialized)
return(0);
#ifndef _WIN32
load_sdl_funcs(&sdl);
#endif
if(sdl.gotfuncs) {
use_sdl_video=TRUE;
if (!sdl.gotfuncs)
return -1;
use_sdl_video=TRUE;
sdl.SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1" );
#ifdef _WIN32
/* Fail to windib (ie: No mouse attached) */
if(sdl.Init(SDL_INIT_VIDEO)) {
driver_env=getenv("SDL_VIDEODRIVER");
if(driver_env==NULL || strcmp(driver_env,"windib")) {
putenv("SDL_VIDEODRIVER=windib");
WinExec(GetCommandLine(), SW_SHOWDEFAULT);
return(0);
}
/* Sure ,we can't use video, but audio is still valid! */
if(sdl.Init(0)==0)
sdl_initialized=TRUE;
/* Fail to windib (ie: No mouse attached) */
if(sdl.Init(SDL_INIT_VIDEO)) {
// SDL2: We can likely do better now...
driver_env=getenv("SDL_VIDEODRIVER");
if(driver_env==NULL || strcmp(driver_env,"windib")) {
putenv("SDL_VIDEODRIVER=windib");
WinExec(GetCommandLine(), SW_SHOWDEFAULT);
return(0);
}
else {
sdl_video_initialized=TRUE;
/* Sure ,we can't use video, but audio is still valid! */
if(sdl.Init(0)==0)
sdl_initialized=TRUE;
}
}
else {
sdl_video_initialized=TRUE;
sdl_initialized=TRUE;
}
#else
/*
* On Linux, SDL doesn't properly detect availability of the
* framebuffer apparently. This results in remote connections
* displaying on the local framebuffer... a definate no-no.
* This ugly hack attempts to prevent this... of course, remote X11
* connections must still be allowed.
*/
if((!use_sdl_video) || ((getenv("REMOTEHOST")!=NULL || getenv("SSH_CLIENT")!=NULL) && getenv("DISPLAY")==NULL)) {
/* Sure ,we can't use video, but audio is still valid! */
if(sdl.Init(0)==0)
sdl_initialized=TRUE;
/*
* SDL2: Is the below comment still true for SDL2?
* On Linux, SDL doesn't properly detect availability of the
* framebuffer apparently. This results in remote connections
* displaying on the local framebuffer... a definate no-no.
* This ugly hack attempts to prevent this... of course, remote X11
* connections must still be allowed.
*/
if((!use_sdl_video) || ((getenv("REMOTEHOST")!=NULL || getenv("SSH_CLIENT")!=NULL) && getenv("DISPLAY")==NULL)) {
/* Sure ,we can't use video, but audio is still valid! */
if(sdl.Init(0)==0)
sdl_initialized=TRUE;
}
else {
if(sdl.Init(SDL_INIT_VIDEO)==0) {
sdl_initialized=TRUE;
sdl_video_initialized=TRUE;
}
else {
if(sdl.Init(SDL_INIT_VIDEO)==0) {
/* Sure ,we can't use video, but audio is still valid! */
if(sdl.Init(0)==0)
sdl_initialized=TRUE;
sdl_video_initialized=TRUE;
}
else {
/* Sure ,we can't use video, but audio is still valid! */
if(sdl.Init(0)==0)
sdl_initialized=TRUE;
}
}
}
#endif
if(sdl_video_initialized && sdl.VideoDriverName(drivername, sizeof(drivername))!=NULL) {
/* Unacceptable drivers */
if((!strcmp(drivername, "caca")) || (!strcmp(drivername,"aalib")) || (!strcmp(drivername,"dummy"))) {
sdl.QuitSubSystem(SDL_INIT_VIDEO);
sdl_video_initialized=FALSE;
}
else {
const SDL_VideoInfo *initial=sdl.GetVideoInfo();
/* Save initial video mode */
if(initial)
sdl.initial_videoinfo=*initial;
else
memset(&sdl.initial_videoinfo, 0, sizeof(sdl.initial_videoinfo));
sdl_video_initialized=TRUE;
}
if(sdl_video_initialized && (drivername = sdl.GetCurrentVideoDriver())!=NULL) {
/* Unacceptable drivers */
if((!strcmp(drivername, "caca")) || (!strcmp(drivername,"aalib")) || (!strcmp(drivername,"dummy"))) {
sdl.QuitSubSystem(SDL_INIT_VIDEO);
sdl_video_initialized=FALSE;
}
else {
sdl_video_initialized=TRUE;
}
}
if(sdl_video_initialized) {
SetThreadName("SDL Main");
atexit(QuitWrap);
sdl_main_sem=sdl.SDL_CreateSemaphore(0);
sdl_exit_sem=sdl.SDL_CreateSemaphore(0);
main_thread=sdl.CreateThread(sdl_run_main,&ma);
sdl.SemWait(sdl_main_sem);
if(sdl_drawing_thread!=NULL) {
sdl_drawing_thread(NULL);
sdl_exit_drawing_thread=NULL;
if(!main_returned) {
main_ret=0;
}
}
sdl.SemWait(sdl_exit_sem);
if(main_returned)
sdl.WaitThread(main_thread, &main_ret);
return 0;
}
return(-1);
}
int init_sdl_audio(void)
{
if(!sdl_initialized)
return(-1);
if(sdl_audio_initialized)
return(0);
if(sdl.InitSubSystem(SDL_INIT_AUDIO)==0) {
sdl_audio_initialized=TRUE;
return(0);
}
return(-1);
}
void run_sdl_drawing_thread(int (*drawing_thread)(void *data))
{
sdl.CreateThread(drawing_thread, NULL);
}
static void QuitWrap(void)
{
if (sdl_initialized) {
exit_sdl_con();
if(sdl.Quit)
sdl.Quit();
}
else
main_ret=CIOLIB_main(argc, argv, env);
return(main_ret);
}
......@@ -19,38 +19,37 @@ struct sdlfuncs {
int (HACK_HACK_HACK *mutexV) (SDL_mutex *mutex);
int (HACK_HACK_HACK *PeepEvents) (SDL_Event *events, int numevents,
SDL_eventaction action, Uint32 mask);
char *(HACK_HACK_HACK *VideoDriverName) (char *namebuf, int maxlen);
char *(HACK_HACK_HACK *GetCurrentVideoDriver) (void);
int (HACK_HACK_HACK *SemWait) (SDL_sem *sem);
int (HACK_HACK_HACK *SemWaitTimeout)(SDL_sem *sem, Uint32 timeout);
int (HACK_HACK_HACK *SemPost) (SDL_sem *sem);
Uint8 (HACK_HACK_HACK *EventState) (Uint8 type, int state);
Uint8 (HACK_HACK_HACK *EventState) (Uint32 type, int state);
SDL_Surface *(HACK_HACK_HACK *CreateRGBSurface) (Uint32 flags, int width, int height, int depth,
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
SDL_Surface *(HACK_HACK_HACK *CreateRGBSurfaceFrom)(void *pixels, int width, int height, int depth, int pitch,
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
int (HACK_HACK_HACK *FillRect) (SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);
int (HACK_HACK_HACK *SetColors) (SDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors);
int (HACK_HACK_HACK *BlitSurface) (SDL_Surface *src, SDL_Rect *srcrect,
SDL_Surface *dst, SDL_Rect *dstrect);
void (HACK_HACK_HACK *UpdateRects) (SDL_Surface *screen, int numrects, SDL_Rect *rects);
void (HACK_HACK_HACK *UpdateRect) (SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h);
void (HACK_HACK_HACK *RenderPresent) (SDL_Renderer *renderer);
SDL_sem *(HACK_HACK_HACK *SDL_CreateSemaphore) (Uint32 initial_value);
void (HACK_HACK_HACK *SDL_DestroySemaphore) (SDL_sem *semaphore);
SDL_mutex *(HACK_HACK_HACK *SDL_CreateMutex) (void);
struct SDL_Thread *(HACK_HACK_HACK *CreateThread) (int (*fn)(void *), void *data);
void (HACK_HACK_HACK *KillThread) (SDL_Thread *thread);
void (HACK_HACK_HACK *WaitThread) (SDL_Thread *thread, int *status);
int (HACK_HACK_HACK *WaitEvent) (SDL_Event *event);
int (HACK_HACK_HACK *WaitEventTimeout) (SDL_Event *event, int timeout);
int (HACK_HACK_HACK *PollEvent) (SDL_Event *event);
SDL_Surface *(HACK_HACK_HACK *SetVideoMode) (int width, int height, int bpp, Uint32 flags);
SDL_Window *(HACK_HACK_HACK *CreateWindow) (const char *title, int x, int y, int w, int h, Uint32 flags);
int (HACK_HACK_HACK *CreateWindowAndRenderer) (int w, int h, Uint32 flags, SDL_Window **win, SDL_Renderer **ren);
SDL_Renderer *(HACK_HACK_HACK *CreateRenderer) (SDL_Window* window, int index, Uint32 flags);
void (HACK_HACK_HACK *FreeSurface) (SDL_Surface *surface);
void (HACK_HACK_HACK *WM_SetCaption) (const char *title, const char *icon);
void (HACK_HACK_HACK *WM_SetIcon) (SDL_Surface *icon, Uint8 *mask);
void (HACK_HACK_HACK *SetWindowTitle) (SDL_Window *window, const char *title);
void (HACK_HACK_HACK *GetWindowSize) (SDL_Window *window, int *w, int *h);
SDL_Surface *(HACK_HACK_HACK *GetWindowSurface) (SDL_Window *window);
void (HACK_HACK_HACK *SetWindowIcon) (SDL_Window *win, SDL_Surface *icon);
int (HACK_HACK_HACK *ShowCursor) (int toggle);
Uint32 (HACK_HACK_HACK *WasInit) (Uint32 flags);