diff options
author | Walter van Niftrik | 2010-01-26 19:51:08 +0000 |
---|---|---|
committer | Walter van Niftrik | 2010-01-26 19:51:08 +0000 |
commit | 473d8b7c2fb8fccdf7716308a5faced5e6259566 (patch) | |
tree | 4059b553ea25867166db9718aff8832beba085cb /engines/sci/engine/segment.cpp | |
parent | 9861b04b935b84424b5b7950a2398dbfb44a99f9 (diff) | |
download | scummvm-rg350-473d8b7c2fb8fccdf7716308a5faced5e6259566.tar.gz scummvm-rg350-473d8b7c2fb8fccdf7716308a5faced5e6259566.tar.bz2 scummvm-rg350-473d8b7c2fb8fccdf7716308a5faced5e6259566.zip |
SCI: Add string support for odd-offset pointers into reg_t-based segments.
svn-id: r47572
Diffstat (limited to 'engines/sci/engine/segment.cpp')
-rw-r--r-- | engines/sci/engine/segment.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/engines/sci/engine/segment.cpp b/engines/sci/engine/segment.cpp index a76644c718..1764109581 100644 --- a/engines/sci/engine/segment.cpp +++ b/engines/sci/engine/segment.cpp @@ -247,12 +247,15 @@ bool LocalVariables::isValidOffset(uint16 offset) const { } SegmentRef LocalVariables::dereference(reg_t pointer) { - if (pointer.offset & 1) - warning("LocalVariables::dereference: Odd offset in pointer %04x:%04x", PRINT_REG(pointer)); - SegmentRef ret; ret.isRaw = false; // reg_t based data! ret.maxSize = (_locals.size() - pointer.offset / 2) * 2; + + if (pointer.offset & 1) { + ret.maxSize -= 1; + ret.skipByte = true; + } + if (ret.maxSize > 0) { ret.reg = &_locals[pointer.offset / 2]; } else { @@ -271,8 +274,11 @@ SegmentRef DataStack::dereference(reg_t pointer) { ret.isRaw = false; // reg_t based data! ret.maxSize = (_capacity - pointer.offset / 2) * 2; - if (pointer.offset & 1) - warning("LocalVariables::dereference: Odd offset in pointer %04x:%04x", PRINT_REG(pointer)); + if (pointer.offset & 1) { + ret.maxSize -= 1; + ret.skipByte = true; + } + ret.reg = &_entries[pointer.offset / 2]; return ret; } |