aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
Diffstat (limited to 'backends')
-rw-r--r--backends/events/default/default-events.cpp3
-rw-r--r--backends/events/sdl/sdl-events.cpp4
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp30
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.h3
-rw-r--r--backends/mixer/nullmixer/nullsdl-mixer.cpp75
-rw-r--r--backends/mixer/nullmixer/nullsdl-mixer.h62
-rw-r--r--backends/modular-backend.cpp3
-rw-r--r--backends/module.mk8
-rw-r--r--backends/mutex/sdl/sdl-mutex.cpp6
-rw-r--r--backends/platform/android/android.cpp2
-rw-r--r--backends/platform/android/android.h2
-rw-r--r--backends/platform/bada/system.cpp2
-rw-r--r--backends/platform/bada/system.h2
-rw-r--r--backends/platform/dc/dc.h2
-rw-r--r--backends/platform/dc/time.cpp2
-rw-r--r--backends/platform/ds/arm9/source/dsmain.cpp2
-rw-r--r--backends/platform/ds/arm9/source/dsmain.h2
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp2
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.h2
-rw-r--r--backends/platform/iphone/osys_main.cpp2
-rw-r--r--backends/platform/iphone/osys_main.h2
-rw-r--r--backends/platform/n64/osys_n64.h2
-rw-r--r--backends/platform/n64/osys_n64_base.cpp2
-rw-r--r--backends/platform/null/null.cpp2
-rw-r--r--backends/platform/ps2/systemps2.cpp2
-rw-r--r--backends/platform/ps2/systemps2.h2
-rw-r--r--backends/platform/psp/osys_psp.cpp2
-rw-r--r--backends/platform/psp/osys_psp.h2
-rw-r--r--backends/platform/psp/rtc.cpp2
-rw-r--r--backends/platform/psp/rtc.h2
-rw-r--r--backends/platform/sdl/sdl.cpp28
-rw-r--r--backends/platform/sdl/sdl.h3
-rw-r--r--backends/platform/wii/osystem.cpp2
-rw-r--r--backends/platform/wii/osystem.h2
-rw-r--r--backends/saves/recorder/recorder-saves.cpp35
-rw-r--r--backends/saves/recorder/recorder-saves.h36
-rw-r--r--backends/timer/default/default-timer.cpp2
37 files changed, 297 insertions, 47 deletions
diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp
index 38a0c8d46f..bf76bbc1cb 100644
--- a/backends/events/default/default-events.cpp
+++ b/backends/events/default/default-events.cpp
@@ -84,7 +84,8 @@ void DefaultEventManager::init() {
}
bool DefaultEventManager::pollEvent(Common::Event &event) {
- uint32 time = g_system->getMillis();
+ // Skip recording of these events
+ uint32 time = g_system->getMillis(true);
bool result = false;
_dispatcher.dispatch();
diff --git a/backends/events/sdl/sdl-events.cpp b/backends/events/sdl/sdl-events.cpp
index 0ca5bbb059..e2ef7f6bf6 100644
--- a/backends/events/sdl/sdl-events.cpp
+++ b/backends/events/sdl/sdl-events.cpp
@@ -106,7 +106,9 @@ void SdlEventSource::processMouseEvent(Common::Event &event, int x, int y) {
}
void SdlEventSource::handleKbdMouse() {
- uint32 curTime = g_system->getMillis();
+ // Skip recording of these events
+ uint32 curTime = g_system->getMillis(true);
+
if (curTime >= _km.last_time + _km.delay_time) {
_km.last_time = curTime;
if (_km.x_down_count == 1) {
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 02e58ab319..e174a6e807 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -40,6 +40,7 @@
#include "graphics/scaler.h"
#include "graphics/scaler/aspect.h"
#include "graphics/surface.h"
+#include "gui/EventRecorder.h"
static const OSystem::GraphicsMode s_supportedGraphicsModes[] = {
{"1x", _s("Normal (no scaling)"), GFX_NORMAL},
@@ -135,6 +136,7 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou
_paletteDirtyStart(0), _paletteDirtyEnd(0),
_screenIsLocked(false),
_graphicsMutex(0),
+ _displayDisabled(false),
#ifdef USE_SDL_DEBUG_FOCUSRECT
_enableFocusRectDebugCode(false), _enableFocusRect(false), _focusRect(),
#endif
@@ -765,9 +767,20 @@ bool SurfaceSdlGraphicsManager::loadGFXMode() {
fixupResolutionForAspectRatio(_videoMode.desiredAspectRatio, _videoMode.hardwareWidth, _videoMode.hardwareHeight);
}
- _hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 16,
- _videoMode.fullscreen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
- );
+
+#ifdef ENABLE_KEYMAPPER
+ _displayDisabled = ConfMan.getBool("disable_display");
+
+ if (_displayDisabled) {
+ _hwscreen = g_eventRec.getSurface(_videoMode.hardwareWidth, _videoMode.hardwareHeight);
+ } else
+#endif
+ {
+ _hwscreen = SDL_SetVideoMode(_videoMode.hardwareWidth, _videoMode.hardwareHeight, 16,
+ _videoMode.fullscreen ? (SDL_FULLSCREEN|SDL_SWSURFACE) : SDL_SWSURFACE
+ );
+ }
+
#ifdef USE_RGB_COLOR
detectSupportedFormats();
#endif
@@ -865,7 +878,12 @@ void SurfaceSdlGraphicsManager::unloadGFXMode() {
}
if (_hwscreen) {
- SDL_FreeSurface(_hwscreen);
+ if (_displayDisabled) {
+ delete _hwscreen;
+ } else {
+ SDL_FreeSurface(_hwscreen);
+ }
+
_hwscreen = NULL;
}
@@ -1188,7 +1206,9 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
#endif
// Finally, blit all our changes to the screen
- SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList);
+ if (!_displayDisabled) {
+ SDL_UpdateRects(_hwscreen, _numDirtyRects, _dirtyRectList);
+ }
}
_numDirtyRects = 0;
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index 21444cc25d..97de0f9c97 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -232,6 +232,9 @@ protected:
int _scalerType;
int _transactionMode;
+ // Indicates whether it is needed to free _hwsurface in destructor
+ bool _displayDisabled;
+
bool _screenIsLocked;
Graphics::Surface _framebuffer;
diff --git a/backends/mixer/nullmixer/nullsdl-mixer.cpp b/backends/mixer/nullmixer/nullsdl-mixer.cpp
new file mode 100644
index 0000000000..2fd652e19f
--- /dev/null
+++ b/backends/mixer/nullmixer/nullsdl-mixer.cpp
@@ -0,0 +1,75 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "backends/mixer/nullmixer/nullsdl-mixer.h"
+#include "common/savefile.h"
+
+NullSdlMixerManager::NullSdlMixerManager() : SdlMixerManager() {
+ _outputRate = 22050;
+ _callsCounter = 0;
+ _callbackPeriod = 10;
+ _samples = 8192;
+ while (_samples * 16 > _outputRate * 2)
+ _samples >>= 1;
+ _samplesBuf = new uint8[_samples * 4];
+}
+
+NullSdlMixerManager::~NullSdlMixerManager() {
+ delete _samplesBuf;
+}
+
+void NullSdlMixerManager::init() {
+ _mixer = new Audio::MixerImpl(g_system, _outputRate);
+ assert(_mixer);
+ _mixer->setReady(true);
+}
+
+void NullSdlMixerManager::suspendAudio() {
+ _audioSuspended = true;
+}
+
+int NullSdlMixerManager::resumeAudio() {
+ if (!_audioSuspended) {
+ return -2;
+ }
+ _audioSuspended = false;
+ return 0;
+}
+
+
+void NullSdlMixerManager::startAudio() {
+}
+
+void NullSdlMixerManager::callbackHandler(byte *samples, int len) {
+ assert(_mixer);
+ _mixer->mixCallback(samples, len);
+}
+
+void NullSdlMixerManager::update() {
+ if (_audioSuspended) {
+ return;
+ }
+ _callsCounter++;
+ if ((_callsCounter % _callbackPeriod) == 0) {
+ callbackHandler(_samplesBuf, _samples);
+ }
+}
diff --git a/backends/mixer/nullmixer/nullsdl-mixer.h b/backends/mixer/nullmixer/nullsdl-mixer.h
new file mode 100644
index 0000000000..94248ced66
--- /dev/null
+++ b/backends/mixer/nullmixer/nullsdl-mixer.h
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef BACKENDS_MIXER_NULLSDL_H
+#define BACKENDS_MIXER_NULLSDL_H
+
+#include "backends/mixer/sdl/sdl-mixer.h"
+#include "common/str.h"
+
+/** Audio mixer which in fact does not output audio.
+ *
+ * It is used by events recorder since the recorder is intentionally
+ * turning sound off to avoid stuttering.
+ *
+ * It returns correct output and shoots callbacks, so all OSystem
+ * users could work without modifications.
+ */
+
+class NullSdlMixerManager : public SdlMixerManager {
+public:
+ NullSdlMixerManager();
+ virtual ~NullSdlMixerManager();
+
+ virtual void init();
+ void update();
+
+ virtual void suspendAudio();
+ virtual int resumeAudio();
+
+protected:
+
+ virtual void startAudio();
+ virtual void callbackHandler(byte *samples, int len);
+
+private:
+ uint32 _outputRate;
+ uint32 _callsCounter;
+ uint8 _callbackPeriod;
+ uint32 _samples;
+ uint8 *_samplesBuf;
+};
+
+#endif
diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp
index b46f33a2bc..94d0595fea 100644
--- a/backends/modular-backend.cpp
+++ b/backends/modular-backend.cpp
@@ -26,6 +26,7 @@
#include "backends/graphics/graphics.h"
#include "backends/mutex/mutex.h"
+#include "gui/EventRecorder.h"
#include "audio/mixer.h"
#include "graphics/pixelformat.h"
@@ -141,7 +142,9 @@ void ModularBackend::fillScreen(uint32 col) {
}
void ModularBackend::updateScreen() {
+ g_eventRec.preDrawOverlayGui();
_graphicsManager->updateScreen();
+ g_eventRec.postDrawOverlayGui();
}
void ModularBackend::setShakePos(int shakeOffset) {
diff --git a/backends/module.mk b/backends/module.mk
index a4f525d21d..12cdc3d029 100644
--- a/backends/module.mk
+++ b/backends/module.mk
@@ -70,7 +70,7 @@ 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 += \
@@ -214,5 +214,11 @@ MODULE_OBJS += \
plugins/wii/wii-provider.o
endif
+ifdef ENABLE_EVENTRECORDER
+MODULE_OBJS += \
+ mixer/nullmixer/nullsdl-mixer.o \
+ saves/recorder/recorder-saves.o
+endif
+
# Include common rules
include $(srcdir)/rules.mk
diff --git a/backends/mutex/sdl/sdl-mutex.cpp b/backends/mutex/sdl/sdl-mutex.cpp
index 8491ae468c..a51e6f0e38 100644
--- a/backends/mutex/sdl/sdl-mutex.cpp
+++ b/backends/mutex/sdl/sdl-mutex.cpp
@@ -33,15 +33,15 @@ OSystem::MutexRef SdlMutexManager::createMutex() {
}
void SdlMutexManager::lockMutex(OSystem::MutexRef mutex) {
- SDL_mutexP((SDL_mutex *) mutex);
+ SDL_mutexP((SDL_mutex *)mutex);
}
void SdlMutexManager::unlockMutex(OSystem::MutexRef mutex) {
- SDL_mutexV((SDL_mutex *) mutex);
+ SDL_mutexV((SDL_mutex *)mutex);
}
void SdlMutexManager::deleteMutex(OSystem::MutexRef mutex) {
- SDL_DestroyMutex((SDL_mutex *) mutex);
+ SDL_DestroyMutex((SDL_mutex *)mutex);
}
#endif
diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp
index 0b31ee717c..e066ea0239 100644
--- a/backends/platform/android/android.cpp
+++ b/backends/platform/android/android.cpp
@@ -450,7 +450,7 @@ bool OSystem_Android::getFeatureState(Feature f) {
}
}
-uint32 OSystem_Android::getMillis() {
+uint32 OSystem_Android::getMillis(bool skipRecord) {
timeval curTime;
gettimeofday(&curTime, 0);
diff --git a/backends/platform/android/android.h b/backends/platform/android/android.h
index 5f2f40b726..b4813b3bdf 100644
--- a/backends/platform/android/android.h
+++ b/backends/platform/android/android.h
@@ -274,7 +274,7 @@ public:
virtual void setCursorPalette(const byte *colors, uint start, uint num);
virtual bool pollEvent(Common::Event &event);
- virtual uint32 getMillis();
+ virtual uint32 getMillis(bool skipRecord = false);
virtual void delayMillis(uint msecs);
virtual MutexRef createMutex(void);
diff --git a/backends/platform/bada/system.cpp b/backends/platform/bada/system.cpp
index 3f862c2571..5c3c25c63d 100644
--- a/backends/platform/bada/system.cpp
+++ b/backends/platform/bada/system.cpp
@@ -373,7 +373,7 @@ bool BadaSystem::pollEvent(Common::Event &event) {
return _appForm->pollEvent(event);
}
-uint32 BadaSystem::getMillis() {
+uint32 BadaSystem::getMillis(bool skipRecord) {
long long result, ticks = 0;
SystemTime::GetTicks(ticks);
result = ticks - _epoch;
diff --git a/backends/platform/bada/system.h b/backends/platform/bada/system.h
index c28686cb3d..89394c58ec 100644
--- a/backends/platform/bada/system.h
+++ b/backends/platform/bada/system.h
@@ -83,7 +83,7 @@ private:
void updateScreen();
bool pollEvent(Common::Event &event);
- uint32 getMillis();
+ uint32 getMillis(bool skipRecord = false);
void delayMillis(uint msecs);
void getTimeAndDate(TimeDate &t) const;
void fatalError();
diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h
index d41839d961..d62ced02e1 100644
--- a/backends/platform/dc/dc.h
+++ b/backends/platform/dc/dc.h
@@ -151,7 +151,7 @@ public:
void setShakePos(int shake_pos);
// Get the number of milliseconds since the program was started.
- uint32 getMillis();
+ uint32 getMillis(bool skipRecord = false);
// Delay for a specified amount of milliseconds
void delayMillis(uint msecs);
diff --git a/backends/platform/dc/time.cpp b/backends/platform/dc/time.cpp
index 8cc3a71e8d..1e5f44ec85 100644
--- a/backends/platform/dc/time.cpp
+++ b/backends/platform/dc/time.cpp
@@ -26,7 +26,7 @@
#include "dc.h"
-uint32 OSystem_Dreamcast::getMillis()
+uint32 OSystem_Dreamcast::getMillis(bool skipRecord)
{
static uint32 msecs=0;
static unsigned int t0=0;
diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp
index 830c782b90..9dc66e80d7 100644
--- a/backends/platform/ds/arm9/source/dsmain.cpp
+++ b/backends/platform/ds/arm9/source/dsmain.cpp
@@ -2280,7 +2280,7 @@ void VBlankHandler(void) {
//REG_IF = IRQ_VBLANK;
}
-int getMillis() {
+int getMillis(bool skipRecord) {
return currentTimeMillis;
// return frameCount * FRAME_TIME;
}
diff --git a/backends/platform/ds/arm9/source/dsmain.h b/backends/platform/ds/arm9/source/dsmain.h
index ad49ae276d..5e91fae13a 100644
--- a/backends/platform/ds/arm9/source/dsmain.h
+++ b/backends/platform/ds/arm9/source/dsmain.h
@@ -88,7 +88,7 @@ void setGamma(int gamma);
// Timers
void setTimerCallback(OSystem_DS::TimerProc proc, int interval); // Setup a callback function at a regular interval
-int getMillis(); // Return the current runtime in milliseconds
+int getMillis(bool skipRecord = false); // Return the current runtime in milliseconds
void doTimerCallback(); // Call callback function if required
// Sound
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index a4b9c842fc..2f6358d8ee 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -656,7 +656,7 @@ bool OSystem_DS::pollEvent(Common::Event &event) {
return false;
}
-uint32 OSystem_DS::getMillis() {
+uint32 OSystem_DS::getMillis(bool skipRecord) {
return DS::getMillis();
}
diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h
index a6001da764..4550e22b2c 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.h
+++ b/backends/platform/ds/arm9/source/osystem_ds.h
@@ -117,7 +117,7 @@ public:
virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspotX, int hotspotY, u32 keycolor, bool dontScale, const Graphics::PixelFormat *format);
virtual bool pollEvent(Common::Event &event);
- virtual uint32 getMillis();
+ virtual uint32 getMillis(bool skipRecord = false);
virtual void delayMillis(uint msecs);
virtual void getTimeAndDate(TimeDate &t) const;
diff --git a/backends/platform/iphone/osys_main.cpp b/backends/platform/iphone/osys_main.cpp
index ed2c886213..460d3fd2ac 100644
--- a/backends/platform/iphone/osys_main.cpp
+++ b/backends/platform/iphone/osys_main.cpp
@@ -166,7 +166,7 @@ void OSystem_IPHONE::suspendLoop() {
_timeSuspended += getMillis() - startTime;
}
-uint32 OSystem_IPHONE::getMillis() {
+uint32 OSystem_IPHONE::getMillis(bool skipRecord) {
//printf("getMillis()\n");
struct timeval currentTime;
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index 037125490d..811a8ddb2e 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -165,7 +165,7 @@ public:
virtual void setCursorPalette(const byte *colors, uint start, uint num);
virtual bool pollEvent(Common::Event &event);
- virtual uint32 getMillis();
+ virtual uint32 getMillis(bool skipRecord = false);
virtual void delayMillis(uint msecs);
virtual MutexRef createMutex(void);
diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h
index bc6b3cb1a5..10138b230a 100644
--- a/backends/platform/n64/osys_n64.h
+++ b/backends/platform/n64/osys_n64.h
@@ -184,7 +184,7 @@ public:
virtual void setCursorPalette(const byte *colors, uint start, uint num);
virtual bool pollEvent(Common::Event &event);
- virtual uint32 getMillis();
+ virtual uint32 getMillis(bool skipRecord = false);
virtual void delayMillis(uint msecs);
virtual MutexRef createMutex(void);
diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp
index 1e2aca9e51..afd93f5e09 100644
--- a/backends/platform/n64/osys_n64_base.cpp
+++ b/backends/platform/n64/osys_n64_base.cpp
@@ -810,7 +810,7 @@ void OSystem_N64::setMouseCursor(const void *buf, uint w, uint h, int hotspotX,
return;
}
-uint32 OSystem_N64::getMillis() {
+uint32 OSystem_N64::getMillis(bool skipRecord) {
return getMilliTick();
}
diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp
index 4690a67c55..9e05539799 100644
--- a/backends/platform/null/null.cpp
+++ b/backends/platform/null/null.cpp
@@ -49,7 +49,7 @@ public:
virtual bool pollEvent(Common::Event &event);
- virtual uint32 getMillis();
+ virtual uint32 getMillis(bool skipRecord = false);
virtual void delayMillis(uint msecs);
virtual void getTimeAndDate(TimeDate &t) const {}
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index 5628658381..a7d782b07c 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -571,7 +571,7 @@ void OSystem_PS2::displayMessageOnOSD(const char *msg) {
printf("displayMessageOnOSD: %s\n", msg);
}
-uint32 OSystem_PS2::getMillis(void) {
+uint32 OSystem_PS2::getMillis(bool skipRecord) {
return msecCount;
}
diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h
index 99482d4da4..3ba40a70f9 100644
--- a/backends/platform/ps2/systemps2.h
+++ b/backends/platform/ps2/systemps2.h
@@ -82,7 +82,7 @@ public:
virtual void warpMouse(int x, int y);
virtual void setMouseCursor(const void *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, bool dontScale = false, const Graphics::PixelFormat *format = 0);
- virtual uint32 getMillis();
+ virtual uint32 getMillis(bool skipRecord = false);
virtual void delayMillis(uint msecs);
virtual bool pollEvent(Common::Event &event);
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index fb8c1c60bf..8559066e53 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -349,7 +349,7 @@ bool OSystem_PSP::pollEvent(Common::Event &event) {
return _inputHandler.getAllInputs(event);
}
-uint32 OSystem_PSP::getMillis() {
+uint32 OSystem_PSP::getMillis(bool skipRecord) {
return PspRtc::instance().getMillis();
}
diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h
index 2afdabd0fc..f4591e476d 100644
--- a/backends/platform/psp/osys_psp.h
+++ b/backends/platform/psp/osys_psp.h
@@ -125,7 +125,7 @@ public:
bool processInput(Common::Event &event);
// Time
- uint32 getMillis();
+ uint32 getMillis(bool skipRecord = false);
void delayMillis(uint msecs);
// Timer
diff --git a/backends/platform/psp/rtc.cpp b/backends/platform/psp/rtc.cpp
index cbbb7d3f80..4f15e45535 100644
--- a/backends/platform/psp/rtc.cpp
+++ b/backends/platform/psp/rtc.cpp
@@ -52,7 +52,7 @@ void PspRtc::init() { // init our starting ticks
// Note that after we fill up 32 bits ie 50 days we'll loop back to 0, which may cause
// unpredictable results
-uint32 PspRtc::getMillis() {
+uint32 PspRtc::getMillis(bool skipRecord) {
uint32 ticks[2];
sceRtcGetCurrentTick((u64 *)ticks); // can introduce weird thread delays
diff --git a/backends/platform/psp/rtc.h b/backends/platform/psp/rtc.h
index 45885c3e66..d2689681dd 100644
--- a/backends/platform/psp/rtc.h
+++ b/backends/platform/psp/rtc.h
@@ -40,7 +40,7 @@ public:
init();
}
void init();
- uint32 getMillis();
+ uint32 getMillis(bool skipRecord = false);
uint32 getMicros();
};
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index d54854352d..77e6f73d48 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,9 @@ OSystem_SDL::~OSystem_SDL() {
_audiocdManager = 0;
delete _mixerManager;
_mixerManager = 0;
- delete _timerManager;
+
+ delete g_eventRec.getTimerManager();
+
_timerManager = 0;
delete _mutexManager;
_mutexManager = 0;
@@ -131,9 +133,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,10 +190,12 @@ void OSystem_SDL::initBackend() {
if (_mixerManager == 0) {
_mixerManager = new SdlMixerManager();
-
// Setup and start mixer
_mixerManager->init();
}
+ g_eventRec.registerMixerManager(_mixerManager);
+
+ g_eventRec.registerTimerManager(new SdlTimerManager());
if (_audiocdManager == 0) {
// Audio CD support was removed with SDL 1.3
@@ -466,14 +467,15 @@ void OSystem_SDL::setupIcon() {
free(icon);
}
-uint32 OSystem_SDL::getMillis() {
+
+uint32 OSystem_SDL::getMillis(bool skipRecord) {
uint32 millis = SDL_GetTicks();
- g_eventRec.processMillis(millis);
+ g_eventRec.processMillis(millis, skipRecord);
return millis;
}
void OSystem_SDL::delayMillis(uint msecs) {
- if (!g_eventRec.processDelayMillis(msecs))
+ if (!g_eventRec.processDelayMillis())
SDL_Delay(msecs);
}
@@ -491,12 +493,12 @@ 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);
- return _mixerManager;
+ return g_eventRec.getMixerManager();
}
#ifdef USE_OPENGL
@@ -654,4 +656,8 @@ void OSystem_SDL::setupGraphicsModes() {
}
}
+Common::TimerManager *OSystem_SDL::getTimerManager() {
+ return g_eventRec.getTimerManager();
+}
+
#endif
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;
diff --git a/backends/platform/wii/osystem.cpp b/backends/platform/wii/osystem.cpp
index 22a6495f8f..9d3a7473e3 100644
--- a/backends/platform/wii/osystem.cpp
+++ b/backends/platform/wii/osystem.cpp
@@ -203,7 +203,7 @@ bool OSystem_Wii::getFeatureState(Feature f) {
}
}
-uint32 OSystem_Wii::getMillis() {
+uint32 OSystem_Wii::getMillis(bool skipRecord) {
return ticks_to_millisecs(diff_ticks(_startup_time, gettime()));
}
diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h
index 5d6998d0b6..287c70ad6b 100644
--- a/backends/platform/wii/osystem.h
+++ b/backends/platform/wii/osystem.h
@@ -193,7 +193,7 @@ public:
const Graphics::PixelFormat *format);
virtual bool pollEvent(Common::Event &event);
- virtual uint32 getMillis();
+ virtual uint32 getMillis(bool skipRecord = false);
virtual void delayMillis(uint msecs);
virtual MutexRef createMutex();
diff --git a/backends/saves/recorder/recorder-saves.cpp b/backends/saves/recorder/recorder-saves.cpp
new file mode 100644
index 0000000000..49b4672913
--- /dev/null
+++ b/backends/saves/recorder/recorder-saves.cpp
@@ -0,0 +1,35 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "backends/saves/recorder/recorder-saves.h"
+#include "gui/EventRecorder.h"
+#include "common/savefile.h"
+
+Common::InSaveFile *RecorderSaveFileManager::openForLoading(const Common::String &filename) {
+ Common::InSaveFile *result = g_eventRec.processSaveStream(filename);
+ return result;
+}
+
+Common::StringArray RecorderSaveFileManager::listSaveFiles(const Common::String &pattern) {
+ return g_eventRec.listSaveFiles(pattern);
+}
+
diff --git a/backends/saves/recorder/recorder-saves.h b/backends/saves/recorder/recorder-saves.h
new file mode 100644
index 0000000000..692aeca329
--- /dev/null
+++ b/backends/saves/recorder/recorder-saves.h
@@ -0,0 +1,36 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef BACKEND_SAVES_RECORDER_H
+#define BACKEND_SAVES_RECORDER_H
+
+#include "backends/saves/default/default-saves.h"
+
+/**
+ * Provides a savefile manager implementation for event recorder.
+ */
+class RecorderSaveFileManager : public DefaultSaveFileManager {
+ virtual Common::StringArray listSaveFiles(const Common::String &pattern);
+ virtual Common::InSaveFile *openForLoading(const Common::String &filename);
+};
+
+#endif
diff --git a/backends/timer/default/default-timer.cpp b/backends/timer/default/default-timer.cpp
index 9f56d58b12..ce93320f3d 100644
--- a/backends/timer/default/default-timer.cpp
+++ b/backends/timer/default/default-timer.cpp
@@ -80,7 +80,7 @@ DefaultTimerManager::~DefaultTimerManager() {
void DefaultTimerManager::handler() {
Common::StackLock lock(_mutex);
- const uint32 curTime = g_system->getMillis();
+ uint32 curTime = g_system->getMillis(true);
// Repeat as long as there is a TimerSlot that is scheduled to fire.
TimerSlot *slot = _head->next;