[Scummvm-cvs-logs] SF.net SVN: scummvm:[49389] scummvm/trunk/engines/sci
mthreepwood at users.sourceforge.net
mthreepwood at users.sourceforge.net
Wed Jun 2 04:55:55 CEST 2010
Revision: 49389
http://scummvm.svn.sourceforge.net/scummvm/?rev=49389&view=rev
Author: mthreepwood
Date: 2010-06-02 02:55:55 +0000 (Wed, 02 Jun 2010)
Log Message:
-----------
If we can't find the game object or game ID in fallback detection, break out instead of assuming the script is there. Fixes a segfault when detecting an LSCI game.
Modified Paths:
--------------
scummvm/trunk/engines/sci/detection.cpp
scummvm/trunk/engines/sci/resource.cpp
Modified: scummvm/trunk/engines/sci/detection.cpp
===================================================================
--- scummvm/trunk/engines/sci/detection.cpp 2010-06-02 00:52:57 UTC (rev 49388)
+++ scummvm/trunk/engines/sci/detection.cpp 2010-06-02 02:55:55 UTC (rev 49389)
@@ -464,7 +464,16 @@
s_fallbackDesc.platform = Common::kPlatformAmiga;
// Determine the game id
- Common::String gameId = convertSierraGameId(resMan->findSierraGameId(), &s_fallbackDesc.flags, resMan);
+ Common::String sierraGameId = resMan->findSierraGameId();
+
+ // If we don't have a game id, the game is not SCI
+ if (sierraGameId.empty()) {
+ SearchMan.remove("SCI_detection");
+ delete resMan;
+ return 0;
+ }
+
+ Common::String gameId = convertSierraGameId(sierraGameId, &s_fallbackDesc.flags, resMan);
strncpy(s_fallbackGameIdBuf, gameId.c_str(), sizeof(s_fallbackGameIdBuf) - 1);
s_fallbackGameIdBuf[sizeof(s_fallbackGameIdBuf) - 1] = 0; // Make sure string is NULL terminated
s_fallbackDesc.gameid = s_fallbackGameIdBuf;
Modified: scummvm/trunk/engines/sci/resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/resource.cpp 2010-06-02 00:52:57 UTC (rev 49388)
+++ scummvm/trunk/engines/sci/resource.cpp 2010-06-02 02:55:55 UTC (rev 49389)
@@ -1935,6 +1935,10 @@
reg_t ResourceManager::findGameObject(bool addSci11ScriptOffset) {
Resource *script = findResource(ResourceId(kResourceTypeScript, 0), false);
+
+ if (!script)
+ return NULL_REG;
+
int extraBytes = 0;
if (getSciVersion() == SCI_VERSION_0_EARLY || getSciVersion() >= SCI_VERSION_1_1)
extraBytes = 2;
@@ -1966,8 +1970,14 @@
nameSelector += 5;
}
+ if (!heap)
+ return "";
+
int16 gameObjectOffset = findGameObject(false).offset;
+ if (!gameObjectOffset)
+ return "";
+
// Seek to the name selector of the first export
byte *seeker = heap->data + READ_UINT16(heap->data + gameObjectOffset + nameSelector * 2);
Common::String sierraId;
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