[Scummvm-cvs-logs] SF.net SVN: scummvm:[39974] scummvm/branches/branch-0-13-0/backends/ platform/ds/arm9/source

agent-q at users.sourceforge.net agent-q at users.sourceforge.net
Sat Apr 18 00:18:49 CEST 2009


Revision: 39974
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39974&view=rev
Author:   agent-q
Date:     2009-04-17 22:18:48 +0000 (Fri, 17 Apr 2009)

Log Message:
-----------
DS: Adding Kyra1 hack, limit the amount of mousemove events that can be generated per second.

Modified Paths:
--------------
    scummvm/branches/branch-0-13-0/backends/platform/ds/arm9/source/osystem_ds.cpp
    scummvm/branches/branch-0-13-0/backends/platform/ds/arm9/source/osystem_ds.h

Modified: scummvm/branches/branch-0-13-0/backends/platform/ds/arm9/source/osystem_ds.cpp
===================================================================
--- scummvm/branches/branch-0-13-0/backends/platform/ds/arm9/source/osystem_ds.cpp	2009-04-17 20:36:57 UTC (rev 39973)
+++ scummvm/branches/branch-0-13-0/backends/platform/ds/arm9/source/osystem_ds.cpp	2009-04-17 22:18:48 UTC (rev 39974)
@@ -62,7 +62,7 @@
 
 OSystem_DS::OSystem_DS()
 	: eventNum(0), lastPenFrame(0), queuePos(0), _mixer(NULL), _timer(NULL), _frameBufferExists(false),
-	_disableCursorPalette(true), _graphicsEnable(true)
+	_disableCursorPalette(true), _graphicsEnable(true), mouseMoveReceived(false)
 {
 //	eventNum = 0;
 //	lastPenFrame = 0;
@@ -528,12 +528,39 @@
 }
 
 void OSystem_DS::addEvent(Common::Event& e) {
-	eventQueue[queuePos++] = e;
+
+#ifdef DS_BUILD_F
+	// FIXME: Hack for Kyra 1 long pauses
+	// only allow one MOUSEMOVE event in the queue
+	// every 35 milliseconds.
+
+	static int timer = 0;
+
+	if (timer != DS::getMillis() / 35) {
+		mouseMoveReceived = false;
+	}
+
+	timer = DS::getMillis() / 35;
+
+	if (e.type == Common::EVENT_MOUSEMOVE) {
+		if (!mouseMoveReceived) {
+			mouseMoveReceived = true;
+		} else {
+			// Return without adding the event to the queue
+			return;
+		}
+	}
+#endif
+
+	// Ignore events once our queue is full
+	if (queuePos < MAX_EVENTS) {
+		eventQueue[queuePos++] = e;
+	}
+
 }
 
 bool OSystem_DS::pollEvent(Common::Event &event) {
 
-	if (lastPenFrame != DS::getMillis()) {
 
 		if (eventNum == queuePos) {
 			eventNum = 0;
@@ -544,6 +571,8 @@
 			event.kbd.ascii = 0;
 			event.kbd.keycode = Common::KEYCODE_INVALID;
 			event.kbd.flags = 0;
+
+
 //			consolePrintf("type: %d\n", event.type);
 			return false;
 		} else {
@@ -551,7 +580,6 @@
 //			consolePrintf("type: %d\n", event.type);
 			return true;
 		}
-	}
 
 	return false;
 

Modified: scummvm/branches/branch-0-13-0/backends/platform/ds/arm9/source/osystem_ds.h
===================================================================
--- scummvm/branches/branch-0-13-0/backends/platform/ds/arm9/source/osystem_ds.h	2009-04-17 20:36:57 UTC (rev 39973)
+++ scummvm/branches/branch-0-13-0/backends/platform/ds/arm9/source/osystem_ds.h	2009-04-17 22:18:48 UTC (rev 39974)
@@ -45,11 +45,14 @@
 
 class OSystem_DS : public OSystem {
 protected:
+	static const int MAX_EVENTS = 96;
 
 	int eventNum;
 	int lastPenFrame;
 
-	Common::Event eventQueue[96];
+	bool mouseMoveReceived;
+
+	Common::Event eventQueue[MAX_EVENTS];
 	int queuePos;
 
 #ifdef GBA_SRAM_SAVE


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list