[Scummvm-cvs-logs] SF.net SVN: scummvm:[49338] scummvm/trunk/engines/sci
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Mon May 31 01:31:33 CEST 2010
Revision: 49338
http://scummvm.svn.sourceforge.net/scummvm/?rev=49338&view=rev
Author: thebluegr
Date: 2010-05-30 23:31:33 +0000 (Sun, 30 May 2010)
Log Message:
-----------
Limited access to the script export table and synonyms block
Modified Paths:
--------------
scummvm/trunk/engines/sci/console.cpp
scummvm/trunk/engines/sci/engine/kscripts.cpp
scummvm/trunk/engines/sci/engine/segment.cpp
scummvm/trunk/engines/sci/engine/segment.h
Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp 2010-05-30 23:00:32 UTC (rev 49337)
+++ scummvm/trunk/engines/sci/console.cpp 2010-05-30 23:31:33 UTC (rev 49338)
@@ -1246,12 +1246,12 @@
case SEG_TYPE_SCRIPT: {
Script *scr = (Script *)mobj;
DebugPrintf("script.%03d locked by %d, bufsize=%d (%x)\n", scr->_nr, scr->getLockers(), (uint)scr->getBufSize(), (uint)scr->getBufSize());
- if (scr->_exportTable)
- DebugPrintf(" Exports: %4d at %d\n", scr->_numExports, (int)(((const byte *)scr->_exportTable) - ((const byte *)scr->_buf)));
+ if (scr->getExportTable())
+ DebugPrintf(" Exports: %4d at %d\n", scr->getExportsNr(), (int)(((const byte *)scr->getExportTable()) - ((const byte *)scr->_buf)));
else
DebugPrintf(" Exports: none\n");
- DebugPrintf(" Synonyms: %4d\n", scr->_numSynonyms);
+ DebugPrintf(" Synonyms: %4d\n", scr->getSynonymsNr());
if (scr->_localsBlock)
DebugPrintf(" Locals : %4d in segment 0x%x\n", scr->_localsBlock->_locals.size(), scr->_localsSegment);
Modified: scummvm/trunk/engines/sci/engine/kscripts.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kscripts.cpp 2010-05-30 23:00:32 UTC (rev 49337)
+++ scummvm/trunk/engines/sci/engine/kscripts.cpp 2010-05-30 23:31:33 UTC (rev 49338)
@@ -181,7 +181,7 @@
// Returns script dispatch address index in the supplied script
reg_t kScriptID(EngineState *s, int argc, reg_t *argv) {
int script = argv[0].toUint16();
- int index = (argc > 1) ? argv[1].toUint16() : 0;
+ uint16 index = (argc > 1) ? argv[1].toUint16() : 0;
if (argv[0].segment)
return argv[0];
@@ -193,7 +193,7 @@
Script *scr = s->_segMan->getScript(scriptSeg);
- if (!scr->_numExports) {
+ if (!scr->getExportsNr()) {
// This is normal. Some scripts don't have a dispatch (exports) table,
// and this call is probably used to load them in memory, ignoring
// the return value. If only one argument is passed, this call is done
@@ -205,8 +205,8 @@
return NULL_REG;
}
- if (index > scr->_numExports) {
- error("Dispatch index too big: %d > %d", index, scr->_numExports);
+ if (index > scr->getExportsNr()) {
+ error("Dispatch index too big: %d > %d", index, scr->getExportsNr());
return NULL_REG;
}
Modified: scummvm/trunk/engines/sci/engine/segment.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/segment.cpp 2010-05-30 23:00:32 UTC (rev 49337)
+++ scummvm/trunk/engines/sci/engine/segment.cpp 2010-05-30 23:31:33 UTC (rev 49338)
@@ -384,14 +384,6 @@
return offset;
}
-const byte *Script::getSynonyms() const {
- return _synonyms;
-}
-
-int Script::getSynonymsNr() const {
- return _numSynonyms;
-}
-
byte *Script::findBlock(int type) {
byte *buf = _buf;
bool oldScriptHeader = (getSciVersion() == SCI_VERSION_0_EARLY);
Modified: scummvm/trunk/engines/sci/engine/segment.h
===================================================================
--- scummvm/trunk/engines/sci/engine/segment.h 2010-05-30 23:00:32 UTC (rev 49337)
+++ scummvm/trunk/engines/sci/engine/segment.h 2010-05-30 23:31:33 UTC (rev 49338)
@@ -325,12 +325,6 @@
byte *_buf; /**< Static data buffer, or NULL if not used */
byte *_heapStart; /**< Start of heap if SCI1.1, NULL otherwise */
- const uint16 *_exportTable; /**< Abs. offset of the export table or 0 if not present */
- int _numExports; /**< Number of entries in the exports table */
-
- const byte *_synonyms; /**< Synonyms block or 0 if not present*/
- int _numSynonyms; /**< Number of entries in the synonyms block */
-
uint32 getScriptSize() { return _scriptSize; }
uint32 getHeapSize() { return _heapSize; }
uint32 getBufSize() { return _bufSize; }
@@ -342,6 +336,13 @@
size_t _scriptSize;
size_t _heapSize;
size_t _bufSize;
+
+ const uint16 *_exportTable; /**< Abs. offset of the export table or 0 if not present */
+ uint16 _numExports; /**< Number of entries in the exports table */
+
+ const byte *_synonyms; /**< Synonyms block or 0 if not present*/
+ uint16 _numSynonyms; /**< Number of entries in the synonyms block */
+
Common::Array<CodeBlock> _codeBlocks;
public:
@@ -432,16 +433,28 @@
void setLockers(int lockers);
/**
+ * Retrieves a pointer to the exports of this script
+ * @return pointer to the exports.
+ */
+ const uint16 *getExportTable() const { return _exportTable; }
+
+ /**
+ * Retrieves the number of exports of script.
+ * @return the number of exports of this script
+ */
+ uint16 getExportsNr() const { return _numExports; }
+
+ /**
* Retrieves a pointer to the synonyms associated with this script
* @return pointer to the synonyms, in non-parsed format.
*/
- const byte *getSynonyms() const;
+ const byte *getSynonyms() const { return _synonyms; }
/**
* Retrieves the number of synonyms associated with this script.
* @return the number of synonyms associated with this script
*/
- int getSynonymsNr() const;
+ uint16 getSynonymsNr() const { return _numSynonyms; }
/**
* Validate whether the specified public function is exported by
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