RECORDER: Implement time compensation for playback

This commit is contained in:
Eugene Sandulenko 2011-08-09 08:35:47 +01:00
parent 05c0c8e98b
commit 83eb8e7ab6

View File

@ -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;
}