Skip to content

Commit

Permalink
SCI: Store script sizes in 32-bit integers
Browse files Browse the repository at this point in the history
Since scripts can be larger than 64KB, and getBufSize() returns a 32-bit
integer, adapt variables that store script sizes accordingly
  • Loading branch information
bluegr committed Jun 18, 2012
1 parent 2b50824 commit 065e83e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions engines/sci/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2630,7 +2630,7 @@ bool Console::cmdViewReference(int argc, const char **argv) {
#endif
default: {
const SegmentRef block = _engine->_gamestate->_segMan->dereference(reg);
uint16 size = block.maxSize;
uint32 size = block.maxSize;

DebugPrintf("raw data\n");

Expand Down Expand Up @@ -2936,7 +2936,7 @@ bool Console::cmdDisassembleAddress(int argc, const char **argv) {
uint opCount = 1;
bool printBWTag = false;
bool printBytes = false;
uint16 size;
uint32 size;

if (parse_reg_t(_engine->_gamestate, argv[1], &vpc, false)) {
DebugPrintf("Invalid address passed.\n");
Expand Down
4 changes: 2 additions & 2 deletions engines/sci/engine/scriptdebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ reg_t disassemble(EngineState *s, reg_t pos, bool printBWTag, bool printBytecode
SegmentObj *mobj = s->_segMan->getSegment(pos.getSegment(), SEG_TYPE_SCRIPT);
Script *script_entity = NULL;
const byte *scr;
uint scr_size;
uint32 scr_size;
reg_t retval = make_reg(pos.getSegment(), pos.getOffset() + 1);
uint16 param_value = 0xffff; // Suppress GCC warning by setting default value, chose value as invalid to getKernelName etc.
uint i = 0;
Expand Down Expand Up @@ -344,7 +344,7 @@ void SciEngine::scriptDebug() {
if (mobj) {
Script *scr = (Script *)mobj;
const byte *code_buf = scr->getBuf();
uint16 code_buf_size = scr->getBufSize();
uint32 code_buf_size = scr->getBufSize();
int opcode = pc.getOffset() >= code_buf_size ? 0 : code_buf[pc.getOffset()];
int op = opcode >> 1;
int paramb1 = pc.getOffset() + 1 >= code_buf_size ? 0 : code_buf[pc.getOffset() + 1];
Expand Down

0 comments on commit 065e83e

Please sign in to comment.