[Scummvm-cvs-logs] SF.net SVN: scummvm:[49241] scummvm/trunk/engines/sci/engine
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Wed May 26 16:25:52 CEST 2010
Revision: 49241
http://scummvm.svn.sourceforge.net/scummvm/?rev=49241&view=rev
Author: thebluegr
Date: 2010-05-26 14:25:51 +0000 (Wed, 26 May 2010)
Log Message:
-----------
Made find_unique_script_block() a member of the Script class
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/savegame.cpp
scummvm/trunk/engines/sci/engine/segment.cpp
scummvm/trunk/engines/sci/engine/segment.h
Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp 2010-05-26 13:27:11 UTC (rev 49240)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp 2010-05-26 14:25:51 UTC (rev 49241)
@@ -748,26 +748,6 @@
return 0;
}
-static byte *find_unique_script_block(EngineState *s, byte *buf, int type) {
- bool oldScriptHeader = (getSciVersion() == SCI_VERSION_0_EARLY);
-
- if (oldScriptHeader)
- buf += 2;
-
- do {
- int seeker_type = READ_LE_UINT16(buf);
-
- if (seeker_type == 0) break;
- if (seeker_type == type) return buf;
-
- int seeker_size = READ_LE_UINT16(buf + 2);
- assert(seeker_size > 0);
- buf += seeker_size;
- } while (1);
-
- return NULL;
-}
-
// TODO: This should probably be turned into an EngineState or DataStack method.
static void reconstruct_stack(EngineState *retval) {
SegmentId stack_seg = retval->_segMan->findSegmentByType(SEG_TYPE_STACK);
@@ -821,8 +801,8 @@
s->_segMan->scriptRelocateExportsSci11(i);
}
} else {
- scr->_exportTable = (uint16 *) find_unique_script_block(s, scr->_buf, SCI_OBJ_EXPORTS);
- scr->_synonyms = find_unique_script_block(s, scr->_buf, SCI_OBJ_SYNONYMS);
+ scr->_exportTable = (uint16 *) scr->findBlock(SCI_OBJ_EXPORTS);
+ scr->_synonyms = scr->findBlock(SCI_OBJ_SYNONYMS);
scr->_exportTable += 3;
}
scr->_codeBlocks.clear();
Modified: scummvm/trunk/engines/sci/engine/segment.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/segment.cpp 2010-05-26 13:27:11 UTC (rev 49240)
+++ scummvm/trunk/engines/sci/engine/segment.cpp 2010-05-26 14:25:51 UTC (rev 49241)
@@ -395,6 +395,30 @@
return _numSynonyms;
}
+byte *Script::findBlock(int type) {
+ byte *buf = _buf;
+ bool oldScriptHeader = (getSciVersion() == SCI_VERSION_0_EARLY);
+
+ if (oldScriptHeader)
+ buf += 2;
+
+ do {
+ int seekerType = READ_LE_UINT16(buf);
+
+ if (seekerType == 0)
+ break;
+ if (seekerType == type)
+ return buf;
+
+ int seekerSize = READ_LE_UINT16(buf + 2);
+ assert(seekerSize > 0);
+ buf += seekerSize;
+ } while (1);
+
+ return NULL;
+}
+
+
// memory operations
void Script::mcpyInOut(int dst, const void *src, size_t n) {
Modified: scummvm/trunk/engines/sci/engine/segment.h
===================================================================
--- scummvm/trunk/engines/sci/engine/segment.h 2010-05-26 13:27:11 UTC (rev 49240)
+++ scummvm/trunk/engines/sci/engine/segment.h 2010-05-26 14:25:51 UTC (rev 49241)
@@ -498,6 +498,11 @@
*/
int16 getHeap(uint16 offset) const;
+ /**
+ * Finds the pointer where a block of a specific type starts from
+ */
+ byte *Script::findBlock(int type);
+
private:
void setScriptSize(int script_nr, ResourceManager *resMan);
};
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