diff options
| author | Filippos Karapetis | 2010-06-14 20:45:00 +0000 | 
|---|---|---|
| committer | Filippos Karapetis | 2010-06-14 20:45:00 +0000 | 
| commit | 1fde7f1abceb5f7c52982e9b2bf18188037b63d5 (patch) | |
| tree | 0ce987d7607048099598eee49c89e01c2cceabb1 /engines/sci/engine/segment.cpp | |
| parent | 86878450ee26cbf2b4f79e5e54787fe5cce2a10e (diff) | |
| download | scummvm-rg350-1fde7f1abceb5f7c52982e9b2bf18188037b63d5.tar.gz scummvm-rg350-1fde7f1abceb5f7c52982e9b2bf18188037b63d5.tar.bz2 scummvm-rg350-1fde7f1abceb5f7c52982e9b2bf18188037b63d5.zip | |
Removed the code used for tracking script code block relocations in SCI0-SCI1 games, as we don't actually relocate these blocks, and it was used solely for verification of the exports table. The issue that this warning was created for should no longer occur
svn-id: r49669
Diffstat (limited to 'engines/sci/engine/segment.cpp')
| -rw-r--r-- | engines/sci/engine/segment.cpp | 57 | 
1 files changed, 12 insertions, 45 deletions
| diff --git a/engines/sci/engine/segment.cpp b/engines/sci/engine/segment.cpp index 492e928e31..879cbc22ee 100644 --- a/engines/sci/engine/segment.cpp +++ b/engines/sci/engine/segment.cpp @@ -115,7 +115,6 @@ void Script::freeScript() {  	_bufSize = 0;  	_objects.clear(); -	_codeBlocks.clear();  }  void Script::init(int script_nr, ResourceManager *resMan) { @@ -125,8 +124,6 @@ void Script::init(int script_nr, ResourceManager *resMan) {  	_localsBlock = NULL;  	_localsCount = 0; -	_codeBlocks.clear(); -  	_markedAsDeleted = false;  	_nr = script_nr; @@ -188,8 +185,6 @@ void Script::load(ResourceManager *resMan) {  		memcpy(_heapStart, heap->data, heap->size);  	} -	_codeBlocks.clear(); -  	_exportTable = 0;  	_numExports = 0;  	_synonyms = 0; @@ -310,13 +305,6 @@ bool Script::relocateLocal(SegmentId segment, int location) {  		return false;  } -void Script::scriptAddCodeBlock(reg_t location) { -	CodeBlock cb; -	cb.pos = location; -	cb.size = READ_SCI11ENDIAN_UINT16(_buf + location.offset - 2); -	_codeBlocks.push_back(cb); -} -  void Script::relocate(reg_t block) {  	byte *heap = _buf;  	uint16 heapSize = (uint16)_bufSize; @@ -333,13 +321,14 @@ void Script::relocate(reg_t block) {  	int count = READ_SCI11ENDIAN_UINT16(heap + block.offset);  	int exportIndex = 0; +	int pos = 0;  	for (int i = 0; i < count; i++) { -		int pos = READ_SCI11ENDIAN_UINT16(heap + block.offset + 2 + (exportIndex * 2)) + heapOffset; -		// This occurs in SCI01/SCI1 games where every usually one export -		// value is zero. It seems that in this situation, we should skip -		// the export and move to the next one, though the total count -		// of valid exports remains the same +		pos = READ_SCI11ENDIAN_UINT16(heap + block.offset + 2 + (exportIndex * 2)) + heapOffset; +		// This occurs in SCI01/SCI1 games where usually one export value +		// is zero. It seems that in this situation, we should skip the +		// export and move to the next one, though the total count of valid +		// exports remains the same  		if (!pos) {  			exportIndex++;  			pos = READ_SCI11ENDIAN_UINT16(heap + block.offset + 2 + (exportIndex * 2)) + heapOffset; @@ -347,37 +336,15 @@ void Script::relocate(reg_t block) {  				error("Script::relocate(): Consecutive zero exports found");  		} +		// In SCI0-SCI1, script local variables, objects and code are relocated. We only relocate +		// locals and objects here, and ignore relocation of code blocks. In SCI1.1 and newer +		// versions, only locals and objects are relocated.  		if (!relocateLocal(block.segment, pos)) { -			bool done = false; -			uint k; - -			ObjMap::iterator it; +			// Not a local? It's probably an object or code block. If it's an object, relocate it.  			const ObjMap::iterator end = _objects.end(); -			for (it = _objects.begin(); !done && it != end; ++it) { +			for (ObjMap::iterator it = _objects.begin(); it != end; ++it)  				if (it->_value.relocate(block.segment, pos, _scriptSize)) -					done = true; -			} - -			// Sanity check for SCI0-SCI1 -			if (getSciVersion() < SCI_VERSION_1_1) { -				for (k = 0; !done && k < _codeBlocks.size(); k++) { -					if (pos >= _codeBlocks[k].pos.offset && -							pos < _codeBlocks[k].pos.offset + _codeBlocks[k].size) -						done = true; -				} -			} - -			if (!done) { -				debug("While processing relocation block %04x:%04x:\n", PRINT_REG(block)); -				debug("Relocation failed for index %04x (%d/%d)\n", pos, exportIndex + 1, count); -				if (_localsBlock) -					debug("- locals: %d at %04x\n", _localsBlock->_locals.size(), _localsOffset); -				else -					debug("- No locals\n"); -				for (it = _objects.begin(), k = 0; it != end; ++it, ++k) -					debug("- obj#%d at %04x w/ %d vars\n", k, it->_value.getPos().offset, it->_value.getVarCount()); -				debug("Trying to continue anyway...\n"); -			} +					break;  		}  		exportIndex++; | 
