aboutsummaryrefslogtreecommitdiff
path: root/engines/gob
diff options
context:
space:
mode:
authorArnaud Boutonné2010-02-13 21:59:45 +0000
committerArnaud Boutonné2010-02-13 21:59:45 +0000
commit5ba36c8216e1a63064b699c6e404514dca180024 (patch)
tree6cf6591675989e85960bda529353f6ec9b091849 /engines/gob
parentb9a11ddb0b69910418d0ccc8cf303a2e2a181f3a (diff)
downloadscummvm-rg350-5ba36c8216e1a63064b699c6e404514dca180024.tar.gz
scummvm-rg350-5ba36c8216e1a63064b699c6e404514dca180024.tar.bz2
scummvm-rg350-5ba36c8216e1a63064b699c6e404514dca180024.zip
Fascination:
- Fix a potential bug in winDraw - Add a hack (and a todo) to work around the missing texts and windows in Amiga, Atari and early PC floppy version. svn-id: r48053
Diffstat (limited to 'engines/gob')
-rw-r--r--engines/gob/draw.cpp2
-rw-r--r--engines/gob/resources.cpp15
2 files changed, 13 insertions, 4 deletions
diff --git a/engines/gob/draw.cpp b/engines/gob/draw.cpp
index 5a385f5a64..75177ff02d 100644
--- a/engines/gob/draw.cpp
+++ b/engines/gob/draw.cpp
@@ -974,7 +974,7 @@ void Draw::winDraw(int16 fct) {
case DRAW_LOADSPRITE: // 5 - Uncompress and load a sprite
// TODO: check the implementation, currently dirty cut and paste of DRAW_SPRITE code
- resource = _vm->_game->_resources->getResource((uint16) _spriteLeft,
+ resource = _vm->_game->_resources->getResource((_spriteLeft & 0x3FFF),
&_spriteRight, &_spriteBottom);
if (!resource) {
diff --git a/engines/gob/resources.cpp b/engines/gob/resources.cpp
index 9e2817e4bc..ee36a1f7ce 100644
--- a/engines/gob/resources.cpp
+++ b/engines/gob/resources.cpp
@@ -277,6 +277,7 @@ bool Resources::loadTOTResourceTable() {
_totResStart = totProps.scriptEnd;
_totSize = stream->size() - _totResStart;
+
if (_totSize <= 0)
return false;
@@ -571,8 +572,14 @@ TextItem *Resources::getTextItem(uint16 id) const {
if ((totItem.offset == 0xFFFF) || (totItem.size == 0))
return 0;
- if ((totItem.offset + totItem.size) > (_totTextTable->size))
- return 0;
+ if ((totItem.offset + totItem.size) > (_totTextTable->size)) {
+// HACK: Some Fascination versions (Amiga, Atari and first PC floppies) have a different header, which is a problem here.
+// TODO: Handle that in a proper way
+ if ((_vm->getGameType() == kGameTypeFascination) & (_totTextTable->size < 0))
+ warning("totTextTable with negative size id:%d offset:%d in file %s : (size: %d)", id, totItem.offset, totItem.size, _totFile.c_str(), _totTextTable->size);
+ else
+ return 0;
+ }
return new TextItem(_totTextTable->data + totItem.offset, totItem.size);
}
@@ -701,8 +708,10 @@ byte *Resources::getTOTData(TOTResourceItem &totItem) const {
int32 offset = _totResourceTable->dataOffset + totItem.offset - _totResStart;
- if ((offset < 0) || (((uint32) (offset + totItem.size)) > _totSize))
+ if ((offset < 0) || (((uint32) (offset + totItem.size)) > _totSize)) {
+ warning("Skipping data id:%d offset:%d size :%d in file %s : out of _totTextTable", totItem.index, totItem.offset, totItem.size, _totFile.c_str());
return 0;
+ }
return _totData + offset;
}