[Scummvm-cvs-logs] scummvm master -> 1d50a318301f69f86e4fbeda38e6fb59a12cbd0d

sev- sev at scummvm.org
Mon Aug 8 21:05:01 CEST 2011


This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
53ea7bfe34 CONFIGURE: Add more verbosity for slow shell environments like mingw
4144fef5a7 RECORDER: Add some debug output
a4029a8e94 RECORDER: Restore event recorder functionality.
1d50a31830 RECORDER: Give name to recoder priority. Added middle button storing.


Commit: 53ea7bfe3477ab53d772d53d9b43e971296597d4
    https://github.com/scummvm/scummvm/commit/53ea7bfe3477ab53d772d53d9b43e971296597d4
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2011-08-08T12:01:03-07:00

Commit Message:
CONFIGURE: Add more verbosity for slow shell environments like mingw

Changed paths:
    configure



diff --git a/configure b/configure
index d2e2aa9..3e0b84f 100755
--- a/configure
+++ b/configure
@@ -3454,6 +3454,15 @@ _engines_built_static=""
 _engines_built_dynamic=""
 _engines_skipped=""
 
+# Show a message if looping over engines takes longer than 5 secs
+sh -c "
+	touch config.gnomes
+	sleep 5
+	if test -f config.gnomes; then 
+		printf 'Employing little gnomes...'
+		rm -f config.gnomes
+	fi" 2>/dev/null &
+
 for engine in $_engines; do
 	if test "`get_engine_sub $engine`" = "no" ; then
 		# It's a main engine
@@ -3518,6 +3527,14 @@ done
 
 add_to_config_h_if_yes `get_var _tainted_build` '#define TAINTED_BUILD'
 
+# Complete the message on slow systems
+if test -f config.gnomes ; then
+	# Kill does not work well here as it produces nasty 'Killed' message
+	rm -rf config.gnomes
+else
+	echo " work is done"
+fi
+
 #
 # Show which engines ("frontends") are to be built
 #


Commit: 4144fef5a7404bfab8dd127cc9d09694de89e997
    https://github.com/scummvm/scummvm/commit/4144fef5a7404bfab8dd127cc9d09694de89e997
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2011-08-08T12:01:05-07:00

Commit Message:
RECORDER: Add some debug output

Changed paths:
    common/EventRecorder.cpp



diff --git a/common/EventRecorder.cpp b/common/EventRecorder.cpp
index 201043f..f5d8641 100644
--- a/common/EventRecorder.cpp
+++ b/common/EventRecorder.cpp
@@ -111,11 +111,15 @@ void EventRecorder::init() {
 	String recordModeString = ConfMan.get("record_mode");
 	if (recordModeString.compareToIgnoreCase("record") == 0) {
 		_recordMode = kRecorderRecord;
+
+		debug(3, "EventRecorder: record");
 	} else {
 		if (recordModeString.compareToIgnoreCase("playback") == 0) {
 			_recordMode = kRecorderPlayback;
+			debug(3, "EventRecorder: playback");
 		} else {
 			_recordMode = kPassthrough;
+			debug(3, "EventRecorder: passthrough");
 		}
 	}
 
@@ -194,6 +198,8 @@ void EventRecorder::init() {
 }
 
 void EventRecorder::deinit() {
+	debug(3, "EventRecorder: deinit");
+
 	g_system->getEventManager()->getEventDispatcher()->unregisterSource(this);
 	g_system->getEventManager()->getEventDispatcher()->unregisterObserver(this);
 


Commit: a4029a8e94a3dbbe03c0aa4571215e9a5b00058d
    https://github.com/scummvm/scummvm/commit/a4029a8e94a3dbbe03c0aa4571215e9a5b00058d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2011-08-08T12:01:07-07:00

Commit Message:
RECORDER: Restore event recorder functionality.

It was badly broken after refactoring into EventObserver.

Fitst, deinit() method was never called which lead to bad record
files. Then, the concept of counting pollEvent() calls was ignored.

Introduced dispatchPoll() method of EventObserver which is implemented
in EventRecorder. It counts calls so is able to inject events at
more proper time.

Additionally now event times are recorded.

Changed paths:
    base/main.cpp
    common/EventDispatcher.cpp
    common/EventRecorder.cpp
    common/EventRecorder.h
    common/events.h



diff --git a/base/main.cpp b/base/main.cpp
index 717ccb3..780015d 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -419,6 +419,10 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
 			// Try to run the game
 			Common::Error result = runGame(plugin, system, specialDebug);
 
+			// Flush Event recorder file. The recorder does not get reinitialized for next game
+			// which is intentional. Only single game per session is allowed.
+			g_eventRec.deinit();
+
 		#if defined(UNCACHED_PLUGINS) && defined(DYNAMIC_MODULES)
 			// do our best to prevent fragmentation by unloading as soon as we can
 			PluginManager::instance().unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false);
diff --git a/common/EventDispatcher.cpp b/common/EventDispatcher.cpp
index ce1ef0c..4e3f671 100644
--- a/common/EventDispatcher.cpp
+++ b/common/EventDispatcher.cpp
@@ -45,6 +45,8 @@ EventDispatcher::~EventDispatcher() {
 void EventDispatcher::dispatch() {
 	Event event;
 
+	dispatchPoll();
+
 	for (List<SourceEntry>::iterator i = _sources.begin(); i != _sources.end(); ++i) {
 		const bool allowMapping = i->source->allowMapping();
 
@@ -94,12 +96,13 @@ void EventDispatcher::unregisterSource(EventSource *source) {
 	}
 }
 
-void EventDispatcher::registerObserver(EventObserver *obs, uint priority, bool autoFree) {
+void EventDispatcher::registerObserver(EventObserver *obs, uint priority, bool autoFree, bool notifyPoll) {
 	ObserverEntry newEntry;
 
 	newEntry.observer = obs;
 	newEntry.priority = priority;
 	newEntry.autoFree = autoFree;
+	newEntry.poll = notifyPoll;
 
 	for (List<ObserverEntry>::iterator i = _observers.begin(); i != _observers.end(); ++i) {
 		if (i->priority < priority) {
@@ -130,4 +133,12 @@ void EventDispatcher::dispatchEvent(const Event &event) {
 	}
 }
 
+void EventDispatcher::dispatchPoll() {
+	for (List<ObserverEntry>::iterator i = _observers.begin(); i != _observers.end(); ++i) {
+		if (i->poll == true)
+			if (i->observer->notifyPoll())
+				break;
+	}
+}
+
 } // End of namespace Common
diff --git a/common/EventRecorder.cpp b/common/EventRecorder.cpp
index f5d8641..4be3ca4 100644
--- a/common/EventRecorder.cpp
+++ b/common/EventRecorder.cpp
@@ -34,7 +34,28 @@ DECLARE_SINGLETON(EventRecorder);
 #define RECORD_SIGNATURE 0x54455354
 #define RECORD_VERSION 1
 
-void readRecord(SeekableReadStream *inFile, uint32 &diff, Event &event) {
+uint32 readTime(ReadStream *inFile) {
+	uint32 d = inFile->readByte();
+	if (d == 0xff) {
+		d = inFile->readUint32LE();
+	}
+
+	return d;
+}
+
+void writeTime(WriteStream *outFile, uint32 d) {
+		//Simple RLE compression
+	if (d >= 0xff) {
+		outFile->writeByte(0xff);
+		outFile->writeUint32LE(d);
+	} else {
+		outFile->writeByte(d);
+	}
+}
+
+void readRecord(SeekableReadStream *inFile, uint32 &diff, Event &event, uint32 &millis) {
+	millis = readTime(inFile);
+
 	diff = inFile->readUint32LE();
 
 	event.type = (EventType)inFile->readUint32LE();
@@ -61,7 +82,9 @@ void readRecord(SeekableReadStream *inFile, uint32 &diff, Event &event) {
 	}
 }
 
-void writeRecord(WriteStream *outFile, uint32 diff, const Event &event) {
+void writeRecord(WriteStream *outFile, uint32 diff, const Event &event, uint32 millis) {
+	writeTime(outFile, millis);
+
 	outFile->writeUint32LE(diff);
 
 	outFile->writeUint32LE((uint32)event.type);
@@ -99,6 +122,7 @@ EventRecorder::EventRecorder() {
 	_eventCount = 0;
 	_lastEventCount = 0;
 	_lastMillis = 0;
+	_lastEventMillis = 0;
 
 	_recordMode = kPassthrough;
 }
@@ -177,6 +201,7 @@ void EventRecorder::init() {
 
 		_recordCount = _playbackFile->readUint32LE();
 		_recordTimeCount = _playbackFile->readUint32LE();
+
 		randomSourceCount = _playbackFile->readUint32LE();
 		for (uint i = 0; i < randomSourceCount; ++i) {
 			RandomSourceRecord rec;
@@ -194,7 +219,7 @@ void EventRecorder::init() {
 	}
 
 	g_system->getEventManager()->getEventDispatcher()->registerSource(this, false);
-	g_system->getEventManager()->getEventDispatcher()->registerObserver(this, 1, false);
+	g_system->getEventManager()->getEventDispatcher()->registerObserver(this, 1, false, true);
 }
 
 void EventRecorder::deinit() {
@@ -242,8 +267,9 @@ void EventRecorder::deinit() {
 		for (uint i = 0; i < _recordCount; ++i) {
 			uint32 tempDiff;
 			Event tempEvent;
-			readRecord(_playbackFile, tempDiff, tempEvent);
-			writeRecord(_recordFile, tempDiff, tempEvent);
+			uint32 millis;
+			readRecord(_playbackFile, tempDiff, tempEvent, millis);
+			writeRecord(_recordFile, tempDiff, tempEvent, millis);
 		}
 
 		_recordFile->finalize();
@@ -284,23 +310,16 @@ void EventRecorder::processMillis(uint32 &millis) {
 
 	g_system->lockMutex(_timeMutex);
 	if (_recordMode == kRecorderRecord) {
-		//Simple RLE compression
 		d = millis - _lastMillis;
-		if (d >= 0xff) {
-			_recordTimeFile->writeByte(0xff);
-			_recordTimeFile->writeUint32LE(d);
-		} else {
-			_recordTimeFile->writeByte(d);
-		}
+		writeTime(_recordTimeFile, d);
+
 		_recordTimeCount++;
 	}
 
 	if (_recordMode == kRecorderPlayback) {
 		if (_recordTimeCount > _playbackTimeCount) {
-			d = _playbackTimeFile->readByte();
-			if (d == 0xff) {
-				d = _playbackTimeFile->readUint32LE();
-			}
+			d = readTime(_playbackTimeFile);
+
 			millis = _lastMillis + d;
 			_playbackTimeCount++;
 		}
@@ -321,15 +340,27 @@ bool EventRecorder::notifyEvent(const Event &ev) {
 	StackLock lock(_recorderMutex);
 	++_eventCount;
 
-	writeRecord(_recordFile, _eventCount - _lastEventCount, ev);
+	writeRecord(_recordFile, _eventCount - _lastEventCount, ev, _lastMillis - _lastEventMillis);
 
 	_recordCount++;
 	_lastEventCount = _eventCount;
+	_lastEventMillis = _lastMillis;
+
+	return false;
+}
+
+bool EventRecorder::notifyPoll() {
+	if (_recordMode != kRecorderRecord)
+		return false;
+
+	++_eventCount;
 
 	return false;
 }
 
 bool EventRecorder::pollEvent(Event &ev) {
+	uint32 millis;
+
 	if (_recordMode != kRecorderPlayback)
 		return false;
 
@@ -338,7 +369,7 @@ bool EventRecorder::pollEvent(Event &ev) {
 
 	if (!_hasPlaybackEvent) {
 		if (_recordCount > _playbackCount) {
-			readRecord(_playbackFile, const_cast<uint32&>(_playbackDiff), _playbackEvent);
+			readRecord(_playbackFile, const_cast<uint32&>(_playbackDiff), _playbackEvent, millis);
 			_playbackCount++;
 			_hasPlaybackEvent = true;
 		}
diff --git a/common/EventRecorder.h b/common/EventRecorder.h
index e204196..43a08b0 100644
--- a/common/EventRecorder.h
+++ b/common/EventRecorder.h
@@ -61,6 +61,7 @@ public:
 
 private:
 	bool notifyEvent(const Event &ev);
+	bool notifyPoll();
 	bool pollEvent(Event &ev);
 	bool allowMapping() const { return false; }
 
@@ -75,6 +76,7 @@ private:
 	volatile uint32 _recordCount;
 	volatile uint32 _lastRecordEvent;
 	volatile uint32 _recordTimeCount;
+	volatile uint32 _lastEventMillis;
 	WriteStream *_recordFile;
 	WriteStream *_recordTimeFile;
 	MutexRef _timeMutex;
diff --git a/common/events.h b/common/events.h
index 7df2731..d48060f 100644
--- a/common/events.h
+++ b/common/events.h
@@ -184,6 +184,14 @@ public:
 	 *          false otherwise.
 	 */
 	virtual bool notifyEvent(const Event &event) = 0;
+
+	/**
+	 * Notifies the observer of pollEvent() query.
+	 *
+	 * @return  true if the event should not be passed to other observers,
+	 *          false otherwise.
+	 */
+	virtual bool notifyPoll() { return false; }
 };
 
 /**
@@ -255,8 +263,11 @@ public:
 
 	/**
 	 * Registers a new EventObserver with the Dispatcher.
+	 *
+	 * @param listenPools if set, then all pollEvent() calls are passed to observer
+	 *                    currently it is used by keyMapper
 	 */
-	void registerObserver(EventObserver *obs, uint priority, bool autoFree);
+	void registerObserver(EventObserver *obs, uint priority, bool autoFree, bool listenPolls = false);
 
 	/**
 	 * Unregisters a EventObserver.
@@ -280,11 +291,13 @@ private:
 	struct ObserverEntry : public Entry {
 		uint priority;
 		EventObserver *observer;
+		bool poll;
 	};
 
 	List<ObserverEntry> _observers;
 
 	void dispatchEvent(const Event &event);
+	void dispatchPoll();
 };
 
 class Keymapper;


Commit: 1d50a318301f69f86e4fbeda38e6fb59a12cbd0d
    https://github.com/scummvm/scummvm/commit/1d50a318301f69f86e4fbeda38e6fb59a12cbd0d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2011-08-08T12:01:09-07:00

Commit Message:
RECORDER: Give name to recoder priority. Added middle button storing.

Changed paths:
    common/EventRecorder.cpp
    common/events.h



diff --git a/common/EventRecorder.cpp b/common/EventRecorder.cpp
index 4be3ca4..cf3c8b3 100644
--- a/common/EventRecorder.cpp
+++ b/common/EventRecorder.cpp
@@ -74,6 +74,8 @@ void readRecord(SeekableReadStream *inFile, uint32 &diff, Event &event, uint32 &
 	case EVENT_RBUTTONUP:
 	case EVENT_WHEELUP:
 	case EVENT_WHEELDOWN:
+	case EVENT_MBUTTONDOWN:
+	case EVENT_MBUTTONUP:
 		event.mouse.x = inFile->readSint16LE();
 		event.mouse.y = inFile->readSint16LE();
 		break;
@@ -103,6 +105,8 @@ void writeRecord(WriteStream *outFile, uint32 diff, const Event &event, uint32 m
 	case EVENT_RBUTTONUP:
 	case EVENT_WHEELUP:
 	case EVENT_WHEELDOWN:
+	case EVENT_MBUTTONDOWN:
+	case EVENT_MBUTTONUP:
 		outFile->writeSint16LE(event.mouse.x);
 		outFile->writeSint16LE(event.mouse.y);
 		break;
@@ -219,7 +223,7 @@ void EventRecorder::init() {
 	}
 
 	g_system->getEventManager()->getEventDispatcher()->registerSource(this, false);
-	g_system->getEventManager()->getEventDispatcher()->registerObserver(this, 1, false, true);
+	g_system->getEventManager()->getEventDispatcher()->registerObserver(this, EventManager::kEventRecorderPriority, false, true);
 }
 
 void EventRecorder::deinit() {
diff --git a/common/events.h b/common/events.h
index d48060f..f5ace74 100644
--- a/common/events.h
+++ b/common/events.h
@@ -383,7 +383,12 @@ public:
 		 * Priority of the event manager, for now it's lowest since it eats
 		 * *all* events, we might to change that in the future though.
 		 */
-		kEventManPriority = 0
+		kEventManPriority = 0,
+		/**
+		 * Priority of the event recorder. It has to go after event manager
+		 * in order to record events generated by it
+		 */
+		kEventRecorderPriority = 1
 	};
 
 	/**






More information about the Scummvm-git-logs mailing list