diff options
author | Eugene Sandulenko | 2011-08-09 08:35:47 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2011-08-09 08:37:00 +0100 |
commit | 83eb8e7ab64949f1c039e9b73abf2ae11698148a (patch) | |
tree | 09419238388d9b36a3cca163dbe17e14579fcbfc | |
parent | 05c0c8e98bbfd9432d32d0592ad80f3f210d5bd9 (diff) | |
download | scummvm-rg350-83eb8e7ab64949f1c039e9b73abf2ae11698148a.tar.gz scummvm-rg350-83eb8e7ab64949f1c039e9b73abf2ae11698148a.tar.bz2 scummvm-rg350-83eb8e7ab64949f1c039e9b73abf2ae11698148a.zip |
RECORDER: Implement time compensation for playback
-rw-r--r-- | common/EventRecorder.cpp | 20 |
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; } |