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

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Wed Jul 28 21:03:49 CEST 2010


Revision: 51432
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51432&view=rev
Author:   mthreepwood
Date:     2010-07-28 19:03:49 +0000 (Wed, 28 Jul 2010)

Log Message:
-----------
SCI: Fix using the parser in SCI Fan Games

Get a pointer to the said spec instead of copying to a buffer. The fan games use a said spec with size < 64. Also, make said() take a const pointer as the spec cannot change. Thanks to waltervn and wjp.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/graphics/menu.cpp
    scummvm/trunk/engines/sci/parser/said.cpp
    scummvm/trunk/engines/sci/parser/vocabulary.h

Modified: scummvm/trunk/engines/sci/graphics/menu.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/menu.cpp	2010-07-28 18:37:13 UTC (rev 51431)
+++ scummvm/trunk/engines/sci/graphics/menu.cpp	2010-07-28 19:03:49 UTC (rev 51432)
@@ -397,7 +397,6 @@
 	GuiMenuItemEntry *itemEntry = NULL;
 	bool forceClaimed = false;
 	EngineState *s;
-	byte saidSpec[64];
 
 	switch (eventType) {
 	case SCI_EVENT_KEYBOARD:
@@ -437,8 +436,13 @@
 			itemEntry = *itemIterator;
 
 			if (!itemEntry->saidVmPtr.isNull()) {
-				// TODO: get a pointer to saidVmPtr or make said() work on VmPtrs
-				_segMan->memcpy(saidSpec, itemEntry->saidVmPtr, 64);
+				byte *saidSpec = _segMan->derefBulkPtr(itemEntry->saidVmPtr, 0);
+
+				if (!saidSpec) {
+					warning("Could not dereference saidSpec");
+					continue;
+				}
+
 				if (said(s, saidSpec, 0) != SAID_NO_MATCH)
 					break;
 			}

Modified: scummvm/trunk/engines/sci/parser/said.cpp
===================================================================
--- scummvm/trunk/engines/sci/parser/said.cpp	2010-07-28 18:37:13 UTC (rev 51431)
+++ scummvm/trunk/engines/sci/parser/said.cpp	2010-07-28 19:03:49 UTC (rev 51432)
@@ -657,7 +657,7 @@
 	return true;
 }
 
-static int said_parse_spec(byte *spec) {
+static int said_parse_spec(const byte *spec) {
 	int nextitem;
 
 	said_token = 0;
@@ -996,7 +996,7 @@
 /**** Main code ****/
 /*******************/
 
-int said(EngineState *s, byte *spec, bool verbose) {
+int said(EngineState *s, const byte *spec, bool verbose) {
 	int retval;
 	Vocabulary *voc = g_sci->getVocabulary();
 

Modified: scummvm/trunk/engines/sci/parser/vocabulary.h
===================================================================
--- scummvm/trunk/engines/sci/parser/vocabulary.h	2010-07-28 18:37:13 UTC (rev 51431)
+++ scummvm/trunk/engines/sci/parser/vocabulary.h	2010-07-28 19:03:49 UTC (rev 51432)
@@ -345,7 +345,7 @@
  * @param verbose	Whether to display the parse tree after building it
  * @return 1 on a match, 0 otherwise
  */
-int said(EngineState *s, byte *spec, bool verbose);
+int said(EngineState *s, const byte *spec, bool verbose);
 
 } // End of namespace Sci
 


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