aboutsummaryrefslogtreecommitdiff
path: root/common/EventRecorder.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2011-08-09 16:26:25 -0400
committerMatthew Hoops2011-08-09 16:26:25 -0400
commitacb0a36b6e9f2d2c07a8f96801a9041b15bbf9d7 (patch)
treecd2902a84c83989c8a6f80d989626a0bc24e6c12 /common/EventRecorder.cpp
parentb087acd793e8780fe13d72c202330098652f10a3 (diff)
parent00d25a77a9d8297fdc356c7a10f9dc2d94903a5f (diff)
downloadscummvm-rg350-acb0a36b6e9f2d2c07a8f96801a9041b15bbf9d7.tar.gz
scummvm-rg350-acb0a36b6e9f2d2c07a8f96801a9041b15bbf9d7.tar.bz2
scummvm-rg350-acb0a36b6e9f2d2c07a8f96801a9041b15bbf9d7.zip
Merge remote branch 'upstream/master' into soccer
Diffstat (limited to 'common/EventRecorder.cpp')
-rw-r--r--common/EventRecorder.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/common/EventRecorder.cpp b/common/EventRecorder.cpp
index cf3c8b391f..3be3161203 100644
--- a/common/EventRecorder.cpp
+++ b/common/EventRecorder.cpp
@@ -133,6 +133,9 @@ EventRecorder::EventRecorder() {
EventRecorder::~EventRecorder() {
deinit();
+
+ g_system->deleteMutex(_timeMutex);
+ g_system->deleteMutex(_recorderMutex);
}
void EventRecorder::init() {
@@ -282,9 +285,6 @@ void EventRecorder::deinit() {
//TODO: remove recordTempFileName'ed file
}
-
- g_system->deleteMutex(_timeMutex);
- g_system->deleteMutex(_recorderMutex);
}
void EventRecorder::registerRandomSource(RandomSource &rnd, const String &name) {
@@ -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;
}