aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/sdl
diff options
context:
space:
mode:
Diffstat (limited to 'backends/platform/sdl')
-rw-r--r--backends/platform/sdl/sdl-sys.h3
-rw-r--r--backends/platform/sdl/sdl.cpp51
-rw-r--r--backends/platform/sdl/sdl.h3
3 files changed, 47 insertions, 10 deletions
diff --git a/backends/platform/sdl/sdl-sys.h b/backends/platform/sdl/sdl-sys.h
index ca3c586e03..eccf73815d 100644
--- a/backends/platform/sdl/sdl-sys.h
+++ b/backends/platform/sdl/sdl-sys.h
@@ -35,8 +35,11 @@
// it with an alternate slightly less unfriendly override.
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_FILE)
#undef FILE
+// Solaris has typedef __FILE FILE in several places already
+#if !defined(__sun)
typedef struct { int FAKE; } FAKE_FILE;
#define FILE FAKE_FILE
+#endif // (__sun)
#endif
#if !defined(FORBIDDEN_SYMBOL_ALLOW_ALL) && !defined(FORBIDDEN_SYMBOL_EXCEPTION_strcasecmp)
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index d54854352d..7ab367d4a4 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -30,7 +30,7 @@
#include "backends/platform/sdl/sdl.h"
#include "common/config-manager.h"
-#include "common/EventRecorder.h"
+#include "gui/EventRecorder.h"
#include "common/taskbar.h"
#include "common/textconsole.h"
@@ -97,7 +97,15 @@ OSystem_SDL::~OSystem_SDL() {
_audiocdManager = 0;
delete _mixerManager;
_mixerManager = 0;
+
+#ifdef ENABLE_EVENTRECORDER
+ // HACK HACK HACK
+ // This is nasty.
+ delete g_eventRec.getTimerManager();
+#else
delete _timerManager;
+#endif
+
_timerManager = 0;
delete _mutexManager;
_mutexManager = 0;
@@ -131,9 +139,6 @@ void OSystem_SDL::init() {
if (_mutexManager == 0)
_mutexManager = new SdlMutexManager();
- if (_timerManager == 0)
- _timerManager = new SdlTimerManager();
-
#if defined(USE_TASKBAR)
if (_taskbarManager == 0)
_taskbarManager = new Common::TaskbarManager();
@@ -191,11 +196,19 @@ void OSystem_SDL::initBackend() {
if (_mixerManager == 0) {
_mixerManager = new SdlMixerManager();
-
// Setup and start mixer
_mixerManager->init();
}
+#ifdef ENABLE_EVENTRECORDER
+ g_eventRec.registerMixerManager(_mixerManager);
+
+ g_eventRec.registerTimerManager(new SdlTimerManager());
+#else
+ if (_timerManager == 0)
+ _timerManager = new SdlTimerManager();
+#endif
+
if (_audiocdManager == 0) {
// Audio CD support was removed with SDL 1.3
#if SDL_VERSION_ATLEAST(1, 3, 0)
@@ -466,14 +479,21 @@ void OSystem_SDL::setupIcon() {
free(icon);
}
-uint32 OSystem_SDL::getMillis() {
+
+uint32 OSystem_SDL::getMillis(bool skipRecord) {
uint32 millis = SDL_GetTicks();
- g_eventRec.processMillis(millis);
+
+#ifdef ENABLE_EVENTRECORDER
+ g_eventRec.processMillis(millis, skipRecord);
+#endif
+
return millis;
}
void OSystem_SDL::delayMillis(uint msecs) {
- if (!g_eventRec.processDelayMillis(msecs))
+#ifdef ENABLE_EVENTRECORDER
+ if (!g_eventRec.processDelayMillis())
+#endif
SDL_Delay(msecs);
}
@@ -491,12 +511,25 @@ void OSystem_SDL::getTimeAndDate(TimeDate &td) const {
Audio::Mixer *OSystem_SDL::getMixer() {
assert(_mixerManager);
- return _mixerManager->getMixer();
+ return getMixerManager()->getMixer();
}
SdlMixerManager *OSystem_SDL::getMixerManager() {
assert(_mixerManager);
+
+#ifdef ENABLE_EVENTRECORDER
+ return g_eventRec.getMixerManager();
+#else
return _mixerManager;
+#endif
+}
+
+Common::TimerManager *OSystem_SDL::getTimerManager() {
+#ifdef ENABLE_EVENTRECORDER
+ return g_eventRec.getTimerManager();
+#else
+ return _timerManager;
+#endif
}
#ifdef USE_OPENGL
diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h
index f05207b482..840e73ff09 100644
--- a/backends/platform/sdl/sdl.h
+++ b/backends/platform/sdl/sdl.h
@@ -68,10 +68,11 @@ public:
virtual void setWindowCaption(const char *caption);
virtual void addSysArchivesToSearchSet(Common::SearchSet &s, int priority = 0);
- virtual uint32 getMillis();
+ virtual uint32 getMillis(bool skipRecord = false);
virtual void delayMillis(uint msecs);
virtual void getTimeAndDate(TimeDate &td) const;
virtual Audio::Mixer *getMixer();
+ virtual Common::TimerManager *getTimerManager();
protected:
bool _inited;