[Scummvm-cvs-logs] SF.net SVN: scummvm:[55780] scummvm/trunk/engines/sci/engine/kernel.cpp

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Sat Feb 5 09:16:30 CET 2011


Revision: 55780
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55780&view=rev
Author:   mthreepwood
Date:     2011-02-05 08:16:29 +0000 (Sat, 05 Feb 2011)

Log Message:
-----------
SCI: Add support for BE selector name tables

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel.cpp

Modified: scummvm/trunk/engines/sci/engine/kernel.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.cpp	2011-02-05 08:14:05 UTC (rev 55779)
+++ scummvm/trunk/engines/sci/engine/kernel.cpp	2011-02-05 08:16:29 UTC (rev 55780)
@@ -111,6 +111,11 @@
 	Resource *r = _resMan->findResource(ResourceId(kResourceTypeVocab, VOCAB_RESOURCE_SELECTORS), 0);
 	bool oldScriptHeader = (getSciVersion() == SCI_VERSION_0_EARLY);
 
+	// Starting with KQ7, Mac versions have a BE name table. GK1 Mac and earlier (and all
+	// other platforms) always use LE.
+	bool isBE = (g_sci->getPlatform() == Common::kPlatformMacintosh && getSciVersion() >= SCI_VERSION_2_1
+			&& g_sci->getGameId() != GID_GK1);
+
 	if (!r) { // No such resource?
 		// Check if we have a table for this game
 		// Some demos do not have a selector table
@@ -130,11 +135,11 @@
 		return;
 	}
 
-	int count = READ_LE_UINT16(r->data) + 1; // Counter is slightly off
+	int count = isBE ? READ_BE_UINT16(r->data) : READ_LE_UINT16(r->data) + 1; // Counter is slightly off
 
 	for (int i = 0; i < count; i++) {
-		int offset = READ_LE_UINT16(r->data + 2 + i * 2);
-		int len = READ_LE_UINT16(r->data + offset);
+		int offset = isBE ? READ_BE_UINT16(r->data + 2 + i * 2) : READ_LE_UINT16(r->data + 2 + i * 2);
+		int len = isBE ? READ_BE_UINT16(r->data + offset) : READ_LE_UINT16(r->data + offset);
 
 		Common::String tmp((const char *)r->data + offset + 2, len);
 		_selectorNames.push_back(tmp);


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