aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2011-08-09 08:35:47 +0100
committerEugene Sandulenko2011-08-09 08:37:00 +0100
commit83eb8e7ab64949f1c039e9b73abf2ae11698148a (patch)
tree09419238388d9b36a3cca163dbe17e14579fcbfc
parent05c0c8e98bbfd9432d32d0592ad80f3f210d5bd9 (diff)
downloadscummvm-rg350-83eb8e7ab64949f1c039e9b73abf2ae11698148a.tar.gz
scummvm-rg350-83eb8e7ab64949f1c039e9b73abf2ae11698148a.tar.bz2
scummvm-rg350-83eb8e7ab64949f1c039e9b73abf2ae11698148a.zip
RECORDER: Implement time compensation for playback
-rw-r--r--common/EventRecorder.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/common/EventRecorder.cpp b/common/EventRecorder.cpp
index cf3c8b391f..73832482f2 100644
--- a/common/EventRecorder.cpp
+++ b/common/EventRecorder.cpp
@@ -324,6 +324,13 @@ void EventRecorder::processMillis(uint32 &millis) {
if (_recordTimeCount > _playbackTimeCount) {
d = readTime(_playbackTimeFile);
+ while ((_lastMillis + d > millis) && (_lastMillis + d - millis > 50)) {
+ _recordMode = kPassthrough;
+ g_system->delayMillis(50);
+ millis = g_system->getMillis();
+ _recordMode = kRecorderPlayback;
+ }
+
millis = _lastMillis + d;
_playbackTimeCount++;
}
@@ -334,6 +341,19 @@ void EventRecorder::processMillis(uint32 &millis) {
}
bool EventRecorder::processDelayMillis(uint &msecs) {
+ if (_recordMode == kRecorderPlayback) {
+ _recordMode = kPassthrough;
+
+ uint32 millis = g_system->getMillis();
+
+ _recordMode = kRecorderPlayback;
+
+ if (_lastMillis > millis) {
+ // Skip delay if we're getting late
+ return true;
+ }
+ }
+
return false;
}