Files
@ r6582:0b46f6cf62fa
Branch filter:
Location: cpp/openttd-patchpack/source/src/sdl.cpp
r6582:0b46f6cf62fa
2.3 KiB
text/x-c
(svn r9796) -Update: WebTranslator2 update to 2007-05-06 19:05:33
brazilian_portuguese - 10 fixed by tucalipe (10)
bulgarian - 5 fixed by thetitan (5)
catalan - 9 fixed by arnaullv (9)
czech - 9 fixed by Hadez (9)
esperanto - 11 fixed by LaPingvino (11)
finnish - 11 fixed by habazi (11)
french - 9 fixed by belugas (9)
german - 9 fixed by Neonox (9)
hungarian - 9 fixed by miham (9)
italian - 9 fixed by lorenzodv (9)
japanese - 2 fixed by ickoonite (2)
korean - 9 fixed by darkttd (9)
norwegian_nynorsk - 11 fixed by pollux (11)
polish - 8 fixed by meush (8)
portuguese - 21 fixed, 6 changed by supra90 (27)
romanian - 11 fixed by kneekoo (11)
spanish - 2 fixed by eusebio (2)
swedish - 11 fixed by giddorah (11)
traditional_chinese - 11 fixed, 2 changed by xbddc (13)
turkish - 8 fixed by jnmbk (8)
ukrainian - 11 fixed by mad (11)
brazilian_portuguese - 10 fixed by tucalipe (10)
bulgarian - 5 fixed by thetitan (5)
catalan - 9 fixed by arnaullv (9)
czech - 9 fixed by Hadez (9)
esperanto - 11 fixed by LaPingvino (11)
finnish - 11 fixed by habazi (11)
french - 9 fixed by belugas (9)
german - 9 fixed by Neonox (9)
hungarian - 9 fixed by miham (9)
italian - 9 fixed by lorenzodv (9)
japanese - 2 fixed by ickoonite (2)
korean - 9 fixed by darkttd (9)
norwegian_nynorsk - 11 fixed by pollux (11)
polish - 8 fixed by meush (8)
portuguese - 21 fixed, 6 changed by supra90 (27)
romanian - 11 fixed by kneekoo (11)
spanish - 2 fixed by eusebio (2)
swedish - 11 fixed by giddorah (11)
traditional_chinese - 11 fixed, 2 changed by xbddc (13)
turkish - 8 fixed by jnmbk (8)
ukrainian - 11 fixed by mad (11)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | /* $Id$ */
/** @file sdl.cpp */
#include "stdafx.h"
#ifdef WITH_SDL
#include "openttd.h"
#include "sdl.h"
#include <SDL.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
static int _sdl_usage;
#ifdef DYNAMICALLY_LOADED_SDL
#include "win32.h"
#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("SDL_LoadBMP_RW")
M("SDL_RWFromFile")
M("SDL_SetColorKey")
M("SDL_WM_SetIcon")
M("SDL_MapRGB")
M("")
;
#undef M
SDLProcs sdl_proc;
static const char *LoadSdlDLL()
{
if (sdl_proc.SDL_Init != NULL)
return NULL;
if (!LoadLibraryList((Function *)(void *)&sdl_proc, sdl_files))
return "Unable to load sdl.dll";
return NULL;
}
#endif // DYNAMICALLY_LOADED_SDL
#ifdef UNIX
static void SdlAbort(int sig)
{
/* Own hand-made parachute for the cases of failed assertions. */
SDL_CALL SDL_Quit();
switch (sig) {
case SIGSEGV:
case SIGFPE:
signal(sig, SIG_DFL);
raise(sig);
break;
default:
break;
}
}
#endif
const char* SdlOpen(uint32 x)
{
#ifdef DYNAMICALLY_LOADED_SDL
{
const char *s = LoadSdlDLL();
if (s != NULL) return s;
}
#endif
if (_sdl_usage++ == 0) {
if (SDL_CALL SDL_Init(x) == -1)
return SDL_CALL SDL_GetError();
} else if (x != 0) {
if (SDL_CALL SDL_InitSubSystem(x) == -1)
return SDL_CALL SDL_GetError();
}
#ifdef UNIX
signal(SIGABRT, SdlAbort);
signal(SIGSEGV, SdlAbort);
signal(SIGFPE, SdlAbort);
#endif
return NULL;
}
void SdlClose(uint32 x)
{
if (x != 0)
SDL_CALL SDL_QuitSubSystem(x);
if (--_sdl_usage == 0) {
SDL_CALL SDL_Quit();
#ifdef UNIX
signal(SIGABRT, SIG_DFL);
signal(SIGSEGV, SIG_DFL);
signal(SIGFPE, SIG_DFL);
#endif
}
}
#endif
|