diff options
author | Bastien Bouclet | 2011-06-02 10:03:01 +0200 |
---|---|---|
committer | Bastien Bouclet | 2011-06-22 19:44:46 +0200 |
commit | 872d672c335febce0c1d5dff3843b00c0016fce2 (patch) | |
tree | 97b3284ccdf4f6bf3b76df0ce96e85028cbe8985 | |
parent | cb37f4517baa4435c7cc0774d5a830173a6dc0db (diff) | |
download | scummvm-rg350-872d672c335febce0c1d5dff3843b00c0016fce2.tar.gz scummvm-rg350-872d672c335febce0c1d5dff3843b00c0016fce2.tar.bz2 scummvm-rg350-872d672c335febce0c1d5dff3843b00c0016fce2.zip |
SDL: Allow building with current SDL 1.3hg
-rw-r--r-- | backends/events/sdl/sdl-events.cpp | 21 | ||||
-rw-r--r-- | backends/module.mk | 7 | ||||
-rw-r--r-- | backends/platform/sdl/sdl-sys.h | 23 | ||||
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 16 | ||||
-rwxr-xr-x | configure | 9 |
5 files changed, 62 insertions, 14 deletions
diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp index 835d98e718..4489a2e580 100644 --- a/backends/events/sdl/sdl-events.cpp +++ b/backends/events/sdl/sdl-events.cpp @@ -206,7 +206,6 @@ bool SdlEventSource::pollEvent(Common::Event &event) { } SDL_Event ev; - ev.type = SDL_NOEVENT; while (SDL_PollEvent(&ev)) { preprocessEvents(&ev); if (dispatchSDLEvent(ev, event)) @@ -304,7 +303,7 @@ bool SdlEventSource::handleKeyDown(SDL_Event &ev, Common::Event &event) { event.type = Common::EVENT_KEYDOWN; event.kbd.keycode = (Common::KeyCode)ev.key.keysym.sym; - event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); + event.kbd.ascii = mapKey(ev.key.keysym.sym, (SDLMod)ev.key.keysym.mod, (Uint16)ev.key.keysym.unicode); return true; } @@ -348,7 +347,7 @@ bool SdlEventSource::handleKeyUp(SDL_Event &ev, Common::Event &event) { event.type = Common::EVENT_KEYUP; event.kbd.keycode = (Common::KeyCode)ev.key.keysym.sym; - event.kbd.ascii = mapKey(ev.key.keysym.sym, ev.key.keysym.mod, ev.key.keysym.unicode); + event.kbd.ascii = mapKey(ev.key.keysym.sym, (SDLMod)ev.key.keysym.mod, (Uint16)ev.key.keysym.unicode); // Ctrl-Alt-<key> will change the GFX mode SDLModToOSystemKeyFlags(mod, event); @@ -418,19 +417,19 @@ bool SdlEventSource::handleJoyButtonDown(SDL_Event &ev, Common::Event &event) { switch (ev.jbutton.button) { case JOY_BUT_ESCAPE: event.kbd.keycode = Common::KEYCODE_ESCAPE; - event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0); + event.kbd.ascii = mapKey(SDLK_ESCAPE, (SDLMod)ev.key.keysym.mod, 0); break; case JOY_BUT_PERIOD: event.kbd.keycode = Common::KEYCODE_PERIOD; - event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0); + event.kbd.ascii = mapKey(SDLK_PERIOD, (SDLMod)ev.key.keysym.mod, 0); break; case JOY_BUT_SPACE: event.kbd.keycode = Common::KEYCODE_SPACE; - event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0); + event.kbd.ascii = mapKey(SDLK_SPACE, (SDLMod)ev.key.keysym.mod, 0); break; case JOY_BUT_F5: event.kbd.keycode = Common::KEYCODE_F5; - event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); + event.kbd.ascii = mapKey(SDLK_F5, (SDLMod)ev.key.keysym.mod, 0); break; } } @@ -449,19 +448,19 @@ bool SdlEventSource::handleJoyButtonUp(SDL_Event &ev, Common::Event &event) { switch (ev.jbutton.button) { case JOY_BUT_ESCAPE: event.kbd.keycode = Common::KEYCODE_ESCAPE; - event.kbd.ascii = mapKey(SDLK_ESCAPE, ev.key.keysym.mod, 0); + event.kbd.ascii = mapKey(SDLK_ESCAPE, (SDLMod)ev.key.keysym.mod, 0); break; case JOY_BUT_PERIOD: event.kbd.keycode = Common::KEYCODE_PERIOD; - event.kbd.ascii = mapKey(SDLK_PERIOD, ev.key.keysym.mod, 0); + event.kbd.ascii = mapKey(SDLK_PERIOD, (SDLMod)ev.key.keysym.mod, 0); break; case JOY_BUT_SPACE: event.kbd.keycode = Common::KEYCODE_SPACE; - event.kbd.ascii = mapKey(SDLK_SPACE, ev.key.keysym.mod, 0); + event.kbd.ascii = mapKey(SDLK_SPACE, (SDLMod)ev.key.keysym.mod, 0); break; case JOY_BUT_F5: event.kbd.keycode = Common::KEYCODE_F5; - event.kbd.ascii = mapKey(SDLK_F5, ev.key.keysym.mod, 0); + event.kbd.ascii = mapKey(SDLK_F5, (SDLMod)ev.key.keysym.mod, 0); break; } } diff --git a/backends/module.mk b/backends/module.mk index 8063bcf619..ff2411a63d 100644 --- a/backends/module.mk +++ b/backends/module.mk @@ -60,7 +60,6 @@ endif # derive from the SDL backend, and they all need the following files. ifdef SDL_BACKEND MODULE_OBJS += \ - audiocd/sdl/sdl-audiocd.o \ events/sdl/sdl-events.o \ graphics/surfacesdl/surfacesdl-graphics.o \ mixer/doublebuffersdl/doublebuffersdl-mixer.o \ @@ -68,6 +67,12 @@ MODULE_OBJS += \ mutex/sdl/sdl-mutex.o \ plugins/sdl/sdl-provider.o \ timer/sdl/sdl-timer.o + +# SDL 1.3 removed audio CD support +ifndef USE_SDL13 +MODULE_OBJS += \ + audiocd/sdl/sdl-audiocd.o +endif endif ifdef POSIX diff --git a/backends/platform/sdl/sdl-sys.h b/backends/platform/sdl/sdl-sys.h index 63bfc58617..ca3c586e03 100644 --- a/backends/platform/sdl/sdl-sys.h +++ b/backends/platform/sdl/sdl-sys.h @@ -27,7 +27,7 @@ // fashion, even on the Symbian port. // Moreover, it contains a workaround for the fact that SDL_rwops.h uses // a FILE pointer in one place, which conflicts with common/forbidden.h. - +// The SDL 1.3 headers also include strings.h #include "common/scummsys.h" @@ -39,6 +39,16 @@ typedef struct { int FAKE; } FAKE_FILE; #define FILE FAKE_FILE #endif +#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strcasecmp) +#undef strcasecmp +#define strcasecmp FAKE_strcasecmp +#endif + +#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strncasecmp) +#undef strncasecmp +#define strncasecmp FAKE_strncasecmp +#endif + #if defined(__SYMBIAN32__) #include <esdl\SDL.h> #else @@ -51,4 +61,15 @@ typedef struct { int FAKE; } FAKE_FILE; #define FILE FORBIDDEN_SYMBOL_REPLACEMENT #endif +#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strcasecmp) +#undef strcasecmp +#define strcasecmp FORBIDDEN_SYMBOL_REPLACEMENT +#endif + +#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strncasecmp) +#undef strncasecmp +#define strncasecmp FORBIDDEN_SYMBOL_REPLACEMENT +#endif + + #endif diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index ecaeabf4e1..7972b19689 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -34,7 +34,14 @@ #include "common/textconsole.h" #include "backends/saves/default/default-saves.h" + +// Audio CD support was removed with SDL 1.3 +#if SDL_VERSION_ATLEAST(1, 3, 0) +#include "backends/audiocd/default/default-audiocd.h" +#else #include "backends/audiocd/sdl/sdl-audiocd.h" +#endif + #include "backends/events/sdl/sdl-events.h" #include "backends/mutex/sdl/sdl-mutex.h" #include "backends/timer/sdl/sdl-timer.h" @@ -182,8 +189,15 @@ void OSystem_SDL::initBackend() { _mixerManager->init(); } - if (_audiocdManager == 0) + if (_audiocdManager == 0) { + // Audio CD support was removed with SDL 1.3 +#if SDL_VERSION_ATLEAST(1, 3, 0) + _audiocdManager = new DefaultAudioCDManager(); +#else _audiocdManager = new SdlAudioCDManager(); +#endif + + } // Setup a custom program icon. setupIcon(); @@ -2379,6 +2379,15 @@ case $_backend in LIBS="$LIBS `$_sdlconfig --prefix="$_sdlpath" --libs`" DEFINES="$DEFINES -DSDL_BACKEND" add_line_to_config_mk "SDL_BACKEND = 1" + + _sdlversion=`$_sdlconfig --version` + case $_sdlversion in + 1.3.*) + add_line_to_config_mk "USE_SDL13 = 1" + ;; + *) + ;; + esac ;; esac |