|
|
#include "stdafx.h"
|
|
|
|
|
|
#if defined(WITH_SDL)
|
|
|
#include "openttd.h"
|
|
|
#include "debug.h"
|
|
|
#include "functions.h"
|
|
|
#include "gfx.h"
|
|
|
#include "mixer.h"
|
|
|
#include "window.h"
|
|
|
#include <SDL.h>
|
|
|
#include "player.h"
|
|
|
#include "hal.h"
|
|
|
#include "network.h"
|
|
|
#include "variables.h"
|
|
|
|
|
|
#ifdef UNIX
|
|
|
#include <signal.h>
|
|
|
|
|
|
#ifdef __MORPHOS__
|
|
|
// The system supplied definition of SIG_DFL is wrong on MorphOS
|
|
|
#undef SIG_DFL
|
|
|
#define SIG_DFL (void (*)(int))0
|
|
|
#endif
|
|
|
#endif
|
|
|
|
|
|
#define DYNAMICALLY_LOADED_SDL
|
|
|
|
|
|
static SDL_Surface *_sdl_screen;
|
|
|
static int _sdl_usage;
|
|
|
static bool _all_modes;
|
|
|
|
|
|
#define MAX_DIRTY_RECTS 100
|
|
|
static SDL_Rect _dirty_rects[MAX_DIRTY_RECTS];
|
|
|
static int _num_dirty_rects;
|
|
|
|
|
|
#define SDL_CALL
|
|
|
|
|
|
#if defined(DYNAMICALLY_LOADED_SDL) && defined(WIN32)
|
|
|
|
|
|
bool LoadLibraryList(void **proc, const char *dll);
|
|
|
|
|
|
typedef struct {
|
|
|
int (SDLCALL *SDL_Init)(Uint32);
|
|
|
int (SDLCALL *SDL_InitSubSystem)(Uint32);
|
|
|
char *(SDLCALL *SDL_GetError)();
|
|
|
void (SDLCALL *SDL_QuitSubSystem)(Uint32);
|
|
|
void (SDLCALL *SDL_UpdateRect)(SDL_Surface *, Sint32, Sint32, Uint32, Uint32);
|
|
|
void (SDLCALL *SDL_UpdateRects)(SDL_Surface *, int, SDL_Rect *);
|
|
|
int (SDLCALL *SDL_SetColors)(SDL_Surface *, SDL_Color *, int, int);
|
|
|
void (SDLCALL *SDL_WM_SetCaption)(const char *, const char *);
|
|
|
int (SDLCALL *SDL_ShowCursor)(int);
|
|
|
void (SDLCALL *SDL_FreeSurface)(SDL_Surface *);
|
|
|
int (SDLCALL *SDL_PollEvent)(SDL_Event *);
|
|
|
void (SDLCALL *SDL_WarpMouse)(Uint16, Uint16);
|
|
|
uint32 (SDLCALL *SDL_GetTicks)();
|
|
|
int (SDLCALL *SDL_OpenAudio)(SDL_AudioSpec *, SDL_AudioSpec*);
|
|
|
void (SDLCALL *SDL_PauseAudio)(int);
|
|
|
void (SDLCALL *SDL_CloseAudio)();
|
|
|
int (SDLCALL *SDL_LockSurface)(SDL_Surface*);
|
|
|
void (SDLCALL *SDL_UnlockSurface)(SDL_Surface*);
|
|
|
SDLMod (SDLCALL *SDL_GetModState)();
|
|
|
void (SDLCALL *SDL_Delay)(Uint32);
|
|
|
void (SDLCALL *SDL_Quit)();
|
|
|
SDL_Surface *(SDLCALL *SDL_SetVideoMode)(int, int, int, Uint32);
|
|
|
int (SDLCALL *SDL_EnableKeyRepeat)(int, int);
|
|
|
void (SDLCALL *SDL_EnableUNICODE)(int);
|
|
|
void (SDLCALL *SDL_VideoDriverName)(char *, int);
|
|
|
SDL_Rect **(SDLCALL *SDL_ListModes)(void *, int);
|
|
|
Uint8 *(SDLCALL *SDL_GetKeyState)(int *);
|
|
|
} SDLProcs;
|
|
|
|
|
|
#define M(x) x "\0"
|
|
|
static const char sdl_files[] =
|
|
|
M("sdl.dll")
|
|
|
M("SDL_Init")
|
|
|
M("SDL_InitSubSystem")
|
|
|
M("SDL_GetError")
|
|
|
M("SDL_QuitSubSystem")
|
|
|
M("SDL_UpdateRect")
|
|
|
M("SDL_UpdateRects")
|
|
|
M("SDL_SetColors")
|
|
|
M("SDL_WM_SetCaption")
|
|
|
M("SDL_ShowCursor")
|
|
|
M("SDL_FreeSurface")
|
|
|
M("SDL_PollEvent")
|
|
|
M("SDL_WarpMouse")
|
|
|
M("SDL_GetTicks")
|
|
|
M("SDL_OpenAudio")
|
|
|
M("SDL_PauseAudio")
|
|
|
M("SDL_CloseAudio")
|
|
|
M("SDL_LockSurface")
|
|
|
M("SDL_UnlockSurface")
|
|
|
M("SDL_GetModState")
|
|
|
M("SDL_Delay")
|
|
|
M("SDL_Quit")
|
|
|
M("SDL_SetVideoMode")
|
|
|
M("SDL_EnableKeyRepeat")
|
|
|
M("SDL_EnableUNICODE")
|
|
|
M("SDL_VideoDriverName")
|
|
|
M("SDL_ListModes")
|
|
|
M("SDL_GetKeyState")
|
|
|
M("")
|