[Scummvm-cvs-logs] SF.net SVN: scummvm:[55046] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sun Dec 26 16:28:03 CET 2010


Revision: 55046
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55046&view=rev
Author:   thebluegr
Date:     2010-12-26 15:28:02 +0000 (Sun, 26 Dec 2010)

Log Message:
-----------
SCI: A more efficient solution for bug #3037874 (SCI high CPU usage), which will hopefully
not clash with the speed throttler. This is a more proper fix for bug #3058865, and a
partial fix for bug #3127824

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kevent.cpp
    scummvm/trunk/engines/sci/engine/state.cpp
    scummvm/trunk/engines/sci/engine/state.h
    scummvm/trunk/engines/sci/graphics/animate.cpp

Modified: scummvm/trunk/engines/sci/engine/kevent.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kevent.cpp	2010-12-26 15:10:33 UTC (rev 55045)
+++ scummvm/trunk/engines/sci/engine/kevent.cpp	2010-12-26 15:28:02 UTC (rev 55046)
@@ -176,15 +176,11 @@
 
 	// Wait a bit here, so that the CPU isn't maxed out when the game
 	// is waiting for user input (e.g. when showing text boxes) - bug
-	// #3037874. This works when games do benchmarking at the beginning,
-	// because most of them call kAnimate for benchmarking without
-	// calling kGetEvent in between (rightly so).
-	if (g_sci->getGameId() == GID_JONES && g_sci->getEngineState()->currentRoomNumber() == 764) {
-		// Jones CD is an exception, as it incorrectly calls GetEvent
-		// while benchmarking. Thus, don't delay here for room 764 in
-		// Jones (the speed test room), otherwise speed testing will
-		// fail and the game won't show any views, as it will think that
-		// the user has a slow machine - bug #3058865
+	// #3037874. Make sure that we're not delaying while the game is
+	// benchmarking, as that will affect the final benchmarked result - 
+	// check bugs #3058865 and #3127824
+	if (s->_gameIsBenchmarking) {
+		// Game is benchmarking, don't add a delay
 	} else {
 		g_system->delayMillis(10);
 	}

Modified: scummvm/trunk/engines/sci/engine/state.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/state.cpp	2010-12-26 15:10:33 UTC (rev 55045)
+++ scummvm/trunk/engines/sci/engine/state.cpp	2010-12-26 15:28:02 UTC (rev 55046)
@@ -106,6 +106,7 @@
 	_throttleCounter = 0;
 	_throttleLastTime = 0;
 	_throttleTrigger = false;
+	_gameIsBenchmarking = false;
 
 	_lastSaveVirtualId = SAVEGAMEID_OFFICIALRANGE_START;
 	_lastSaveNewId = 0;

Modified: scummvm/trunk/engines/sci/engine/state.h
===================================================================
--- scummvm/trunk/engines/sci/engine/state.h	2010-12-26 15:10:33 UTC (rev 55045)
+++ scummvm/trunk/engines/sci/engine/state.h	2010-12-26 15:28:02 UTC (rev 55046)
@@ -159,6 +159,7 @@
 	uint32 _throttleCounter; /**< total times kAnimate was invoked */
 	uint32 _throttleLastTime; /**< last time kAnimate was invoked */
 	bool _throttleTrigger;
+	bool _gameIsBenchmarking;
 
 	/* Kernel File IO stuff */
 

Modified: scummvm/trunk/engines/sci/graphics/animate.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/animate.cpp	2010-12-26 15:10:33 UTC (rev 55045)
+++ scummvm/trunk/engines/sci/graphics/animate.cpp	2010-12-26 15:28:02 UTC (rev 55046)
@@ -686,7 +686,6 @@
 
 	_ports->setPort(oldPort);
 
-
 	// Now trigger speed throttler
 	switch (_lastCastData.size()) {
 	case 0:
@@ -698,8 +697,10 @@
 		AnimateEntry *onlyCast = &_lastCastData[0];
 		if ((onlyCast->viewId == 0) && (onlyCast->loopNo == 13) && (onlyCast->celNo == 0)) {
 			// this one is used by jones talkie
-			if ((onlyCast->celRect.height() == 8) && (onlyCast->celRect.width() == 8))
+			if ((onlyCast->celRect.height() == 8) && (onlyCast->celRect.width() == 8)) {
+				_s->_gameIsBenchmarking = true;
 				return;
+			}
 		}
 		// first loop and first cel used?
 		if ((onlyCast->loopNo == 0) && (onlyCast->celNo == 0)) {
@@ -712,15 +713,19 @@
 				((onlyWidth == 1) && (onlyHeight == 1))) { // Laura Bow 2 Talkie
 				// check further that there is only one cel in that view
 				GfxView *onlyView = _cache->getView(onlyCast->viewId);
-				if ((onlyView->getLoopCount() == 1) && (onlyView->getCelCount(0)))
+				if ((onlyView->getLoopCount() == 1) && (onlyView->getCelCount(0))) {
+					_s->_gameIsBenchmarking = true;
 					return;
+				}
 			}
 		}
+		_s->_gameIsBenchmarking = false;
 		_s->_throttleTrigger = true;
 		break;
 	}
 	default:
 		// More than 1 entry drawn -> time for speed throttling
+		_s->_gameIsBenchmarking = false;
 		_s->_throttleTrigger = true;
 		break;
 	}


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