From 6cda15ba8e57891471c53449433385f5992bce3a Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 21 May 2012 01:29:30 +0300 Subject: SCI: Added two new debug commands, plane_list and plane_items These can be used to debug drawn items in SCI32 --- engines/sci/console.cpp | 54 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) (limited to 'engines/sci/console.cpp') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 9607a8e66d..5b5301b468 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -53,6 +53,7 @@ #include "video/avi_decoder.h" #include "sci/video/seq_decoder.h" #ifdef ENABLE_SCI32 +#include "sci/graphics/frameout.h" #include "video/coktel_decoder.h" #include "sci/video/robot_decoder.h" #endif @@ -131,6 +132,10 @@ Console::Console(SciEngine *engine) : GUI::Debugger(), DCmd_Register("al", WRAP_METHOD(Console, cmdAnimateList)); // alias DCmd_Register("window_list", WRAP_METHOD(Console, cmdWindowList)); DCmd_Register("wl", WRAP_METHOD(Console, cmdWindowList)); // alias + DCmd_Register("plane_list", WRAP_METHOD(Console, cmdPlaneList)); + DCmd_Register("pl", WRAP_METHOD(Console, cmdPlaneList)); // alias + DCmd_Register("plane_items", WRAP_METHOD(Console, cmdPlaneItemList)); + DCmd_Register("pi", WRAP_METHOD(Console, cmdPlaneItemList)); // alias DCmd_Register("saved_bits", WRAP_METHOD(Console, cmdSavedBits)); DCmd_Register("show_saved_bits", WRAP_METHOD(Console, cmdShowSavedBits)); // Segments @@ -365,7 +370,9 @@ bool Console::cmdHelp(int argc, const char **argv) { DebugPrintf(" pic_visualize - Enables visualization of the drawing process of EGA pictures\n"); DebugPrintf(" undither - Enable/disable undithering\n"); DebugPrintf(" play_video - Plays a SEQ, AVI, VMD, RBT or DUK video\n"); - DebugPrintf(" animate_object_list / al - Shows the current list of objects in kAnimate's draw list\n"); + DebugPrintf(" animate_list / al - Shows the current list of objects in kAnimate's draw list (SCI0 - SCI1.1)\n"); + DebugPrintf(" window_list / wl - Shows a list of all the windows (ports) in the draw list (SCI0 - SCI1.1)\n"); + DebugPrintf(" plane_list / pl - Shows a list of all the planes in the draw list (SCI2+)\n"); DebugPrintf(" saved_bits - List saved bits on the hunk\n"); DebugPrintf(" show_saved_bits - Display saved bits\n"); DebugPrintf("\n"); @@ -1589,6 +1596,8 @@ bool Console::cmdAnimateList(int argc, const char **argv) { if (_engine->_gfxAnimate) { DebugPrintf("Animate list:\n"); _engine->_gfxAnimate->printAnimateList(this); + } else { + DebugPrintf("This SCI version does not have an animate list\n"); } return true; } @@ -1597,9 +1606,52 @@ bool Console::cmdWindowList(int argc, const char **argv) { if (_engine->_gfxPorts) { DebugPrintf("Window list:\n"); _engine->_gfxPorts->printWindowList(this); + } else { + DebugPrintf("This SCI version does not have a list of ports\n"); } return true; +} +bool Console::cmdPlaneList(int argc, const char **argv) { +#ifdef ENABLE_SCI32 + if (_engine->_gfxFrameout) { + DebugPrintf("Plane list:\n"); + _engine->_gfxFrameout->printPlaneList(this); + } else { + DebugPrintf("This SCI version does not have a list of planes\n"); + } +#else + DebugPrintf("SCI32 isn't included in this compiled executable\n"); +#endif + return true; +} + +bool Console::cmdPlaneItemList(int argc, const char **argv) { + if (argc != 2) { + DebugPrintf("Shows the list of items for a plane\n"); + DebugPrintf("Usage: %s \n", argv[0]); + return true; + } + + reg_t planeObject = NULL_REG; + + if (parse_reg_t(_engine->_gamestate, argv[1], &planeObject, false)) { + DebugPrintf("Invalid address passed.\n"); + DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + return true; + } + +#ifdef ENABLE_SCI32 + if (_engine->_gfxFrameout) { + DebugPrintf("Plane item list:\n"); + _engine->_gfxFrameout->printPlaneItemList(this, planeObject); + } else { + DebugPrintf("This SCI version does not have a list of plane items\n"); + } +#else + DebugPrintf("SCI32 isn't included in this compiled executable\n"); +#endif + return true; } bool Console::cmdSavedBits(int argc, const char **argv) { -- cgit v1.2.3 From 5a17ea058583fb0a3d00392b8e07b2a1f414fded Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 13 Jun 2012 11:29:14 +0300 Subject: SCI: Move all file-related functions in file.* This way, there is a clear separation of the actual SCI kernel file functions and the file classes and wrappers of ScummVM --- engines/sci/console.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'engines/sci/console.cpp') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 5b5301b468..6a44972a4b 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -1216,6 +1216,27 @@ bool Console::cmdRestartGame(int argc, const char **argv) { return Cmd_Exit(0, 0); } +// The scripts get IDs ranging from 100->199, because the scripts require us to assign unique ids THAT EVEN STAY BETWEEN +// SAVES and the scripts also use "saves-count + 1" to create a new savedgame slot. +// SCI1.1 actually recycles ids, in that case we will currently get "0". +// This behavior is required especially for LSL6. In this game, it's possible to quick save. The scripts will use +// the last-used id for that feature. If we don't assign sticky ids, the feature will overwrite different saves all the +// time. And sadly we can't just use the actual filename ids directly, because of the creation method for new slots. + +extern void listSavegames(Common::Array &saves); + +bool Console::cmdListSaves(int argc, const char **argv) { + Common::Array saves; + listSavegames(saves); + + for (uint i = 0; i < saves.size(); i++) { + Common::String filename = g_sci->getSavegameName(saves[i].id); + DebugPrintf("%s: '%s'\n", filename.c_str(), saves[i].name); + } + + return true; +} + bool Console::cmdClassTable(int argc, const char **argv) { DebugPrintf("Available classes (parse a parameter to filter the table by a specific class):\n"); -- cgit v1.2.3 From b9057761df4de1b314aaec9eb7b14653863bb031 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 14 Jun 2012 02:36:45 +0300 Subject: SCI: Add missing documentation for the plane_items / pi console command --- engines/sci/console.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/sci/console.cpp') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 6a44972a4b..94ac437a15 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -373,6 +373,7 @@ bool Console::cmdHelp(int argc, const char **argv) { DebugPrintf(" animate_list / al - Shows the current list of objects in kAnimate's draw list (SCI0 - SCI1.1)\n"); DebugPrintf(" window_list / wl - Shows a list of all the windows (ports) in the draw list (SCI0 - SCI1.1)\n"); DebugPrintf(" plane_list / pl - Shows a list of all the planes in the draw list (SCI2+)\n"); + DebugPrintf(" plane_items / pi - Shows a list of all items for a plane (SCI2+)\n"); DebugPrintf(" saved_bits - List saved bits on the hunk\n"); DebugPrintf(" show_saved_bits - Display saved bits\n"); DebugPrintf("\n"); -- cgit v1.2.3 From 2b50824133ced47f1d8fb6407a1e0212a7eeb41c Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 18 Jun 2012 05:21:59 +0300 Subject: SCI: Add setter/getter methods to reg_t's No functionality change has been made with this commit. This avoids setting and getting the reg_t members directly, and is the basis of any future work on large SCI3 scripts (larger than 64KB) --- engines/sci/console.cpp | 105 ++++++++++++++++++++++++------------------------ 1 file changed, 52 insertions(+), 53 deletions(-) (limited to 'engines/sci/console.cpp') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 94ac437a15..7e9f9b1c38 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -1243,7 +1243,7 @@ bool Console::cmdClassTable(int argc, const char **argv) { for (uint i = 0; i < _engine->_gamestate->_segMan->classTableSize(); i++) { Class temp = _engine->_gamestate->_segMan->_classTable[i]; - if (temp.reg.segment) { + if (temp.reg.getSegment()) { const char *className = _engine->_gamestate->_segMan->getObjectName(temp.reg); if (argc == 1 || (argc == 2 && !strcmp(className, argv[1]))) { DebugPrintf(" Class 0x%x (%s) at %04x:%04x (script %d)\n", i, @@ -1688,7 +1688,7 @@ bool Console::cmdSavedBits(int argc, const char **argv) { Common::Array entries = hunks->listAllDeallocatable(id); for (uint i = 0; i < entries.size(); ++i) { - uint16 offset = entries[i].offset; + uint16 offset = entries[i].getOffset(); const Hunk& h = hunks->_table[offset]; if (strcmp(h.type, "SaveBits()") == 0) { byte* memoryPtr = (byte *)h.mem; @@ -1751,12 +1751,12 @@ bool Console::cmdShowSavedBits(int argc, const char **argv) { return true; } - if (memoryHandle.segment != id || !hunks->isValidOffset(memoryHandle.offset)) { + if (memoryHandle.getSegment() != id || !hunks->isValidOffset(memoryHandle.getOffset())) { DebugPrintf("Invalid address.\n"); return true; } - const Hunk& h = hunks->_table[memoryHandle.offset]; + const Hunk& h = hunks->_table[memoryHandle.getOffset()]; if (strcmp(h.type, "SaveBits()") != 0) { DebugPrintf("Invalid address.\n"); @@ -2266,16 +2266,16 @@ bool Console::cmdGCShowReachable(int argc, const char **argv) { return true; } - SegmentObj *mobj = _engine->_gamestate->_segMan->getSegmentObj(addr.segment); + SegmentObj *mobj = _engine->_gamestate->_segMan->getSegmentObj(addr.getSegment()); if (!mobj) { - DebugPrintf("Unknown segment : %x\n", addr.segment); + DebugPrintf("Unknown segment : %x\n", addr.getSegment()); return 1; } DebugPrintf("Reachable from %04x:%04x:\n", PRINT_REG(addr)); const Common::Array tmp = mobj->listAllOutgoingReferences(addr); for (Common::Array::const_iterator it = tmp.begin(); it != tmp.end(); ++it) - if (it->segment) + if (it->getSegment()) g_sci->getSciDebugger()->DebugPrintf(" %04x:%04x\n", PRINT_REG(*it)); return true; @@ -2298,16 +2298,16 @@ bool Console::cmdGCShowFreeable(int argc, const char **argv) { return true; } - SegmentObj *mobj = _engine->_gamestate->_segMan->getSegmentObj(addr.segment); + SegmentObj *mobj = _engine->_gamestate->_segMan->getSegmentObj(addr.getSegment()); if (!mobj) { - DebugPrintf("Unknown segment : %x\n", addr.segment); + DebugPrintf("Unknown segment : %x\n", addr.getSegment()); return true; } - DebugPrintf("Freeable in segment %04x:\n", addr.segment); - const Common::Array tmp = mobj->listAllDeallocatable(addr.segment); + DebugPrintf("Freeable in segment %04x:\n", addr.getSegment()); + const Common::Array tmp = mobj->listAllDeallocatable(addr.getSegment()); for (Common::Array::const_iterator it = tmp.begin(); it != tmp.end(); ++it) - if (it->segment) + if (it->getSegment()) g_sci->getSciDebugger()->DebugPrintf(" %04x:%04x\n", PRINT_REG(*it)); return true; @@ -2331,9 +2331,9 @@ bool Console::cmdGCNormalize(int argc, const char **argv) { return true; } - SegmentObj *mobj = _engine->_gamestate->_segMan->getSegmentObj(addr.segment); + SegmentObj *mobj = _engine->_gamestate->_segMan->getSegmentObj(addr.getSegment()); if (!mobj) { - DebugPrintf("Unknown segment : %x\n", addr.segment); + DebugPrintf("Unknown segment : %x\n", addr.getSegment()); return true; } @@ -2572,12 +2572,12 @@ bool Console::cmdViewReference(int argc, const char **argv) { DebugPrintf("%04x:%04x is of type 0x%x: ", PRINT_REG(reg), type_mask); - if (reg.segment == 0 && reg.offset == 0) { + if (reg.getSegment() == 0 && reg.getOffset() == 0) { DebugPrintf("Null.\n"); return true; } - if (reg_end.segment != reg.segment && reg_end != NULL_REG) { + if (reg_end.getSegment() != reg.getSegment() && reg_end != NULL_REG) { DebugPrintf("Ending segment different from starting segment. Assuming no bound on dump.\n"); reg_end = NULL_REG; } @@ -2613,7 +2613,7 @@ bool Console::cmdViewReference(int argc, const char **argv) { printObject(reg); break; case SIG_TYPE_REFERENCE: { - switch (_engine->_gamestate->_segMan->getSegmentType(reg.segment)) { + switch (_engine->_gamestate->_segMan->getSegmentType(reg.getSegment())) { #ifdef ENABLE_SCI32 case SEG_TYPE_STRING: { DebugPrintf("SCI32 string\n"); @@ -2629,21 +2629,20 @@ bool Console::cmdViewReference(int argc, const char **argv) { } #endif default: { - int size; const SegmentRef block = _engine->_gamestate->_segMan->dereference(reg); - size = block.maxSize; + uint16 size = block.maxSize; DebugPrintf("raw data\n"); - if (reg_end.segment != 0 && size < reg_end.offset - reg.offset) { + if (reg_end.getSegment() != 0 && size < reg_end.getOffset() - reg.getOffset()) { DebugPrintf("Block end out of bounds (size %d). Resetting.\n", size); reg_end = NULL_REG; } - if (reg_end.segment != 0 && (size >= reg_end.offset - reg.offset)) - size = reg_end.offset - reg.offset; + if (reg_end.getSegment() != 0 && (size >= reg_end.getOffset() - reg.getOffset())) + size = reg_end.getOffset() - reg.getOffset(); - if (reg_end.segment != 0) + if (reg_end.getSegment() != 0) DebugPrintf("Block size less than or equal to %d\n", size); if (block.isRaw) @@ -2655,7 +2654,7 @@ bool Console::cmdViewReference(int argc, const char **argv) { break; } case SIG_TYPE_INTEGER: - DebugPrintf("arithmetic value\n %d (%04x)\n", (int16) reg.offset, reg.offset); + DebugPrintf("arithmetic value\n %d (%04x)\n", (int16) reg.getOffset(), reg.getOffset()); break; default: DebugPrintf("unknown type %d.\n", type); @@ -2725,7 +2724,7 @@ bool Console::cmdBacktrace(int argc, const char **argv) { switch (call.type) { case EXEC_STACK_TYPE_CALL: // Normal function if (call.type == EXEC_STACK_TYPE_CALL) - DebugPrintf(" %x: script %d - ", i, (*(Script *)_engine->_gamestate->_segMan->_heap[call.addr.pc.segment]).getScriptNumber()); + DebugPrintf(" %x: script %d - ", i, (*(Script *)_engine->_gamestate->_segMan->_heap[call.addr.pc.getSegment()]).getScriptNumber()); if (call.debugSelector != -1) { DebugPrintf("%s::%s(", objname, _engine->getKernel()->getSelectorName(call.debugSelector).c_str()); } else if (call.debugExportId != -1) { @@ -2917,7 +2916,7 @@ bool Console::cmdDisassemble(int argc, const char **argv) { addr = disassemble(_engine->_gamestate, addr, printBWTag, printBytecode); if (addr.isNull() && prevAddr < farthestTarget) addr = prevAddr + 1; // skip past the ret - } while (addr.offset > 0); + } while (addr.getOffset() > 0); return true; } @@ -2934,10 +2933,10 @@ bool Console::cmdDisassembleAddress(int argc, const char **argv) { } reg_t vpc = NULL_REG; - int opCount = 1; + uint opCount = 1; bool printBWTag = false; bool printBytes = false; - int size; + uint16 size; if (parse_reg_t(_engine->_gamestate, argv[1], &vpc, false)) { DebugPrintf("Invalid address passed.\n"); @@ -2946,7 +2945,7 @@ bool Console::cmdDisassembleAddress(int argc, const char **argv) { } SegmentRef ref = _engine->_gamestate->_segMan->dereference(vpc); - size = ref.maxSize + vpc.offset; // total segment size + size = ref.maxSize + vpc.getOffset(); // total segment size for (int i = 2; i < argc; i++) { if (!scumm_stricmp(argv[i], "bwt")) @@ -2968,7 +2967,7 @@ bool Console::cmdDisassembleAddress(int argc, const char **argv) { do { vpc = disassemble(_engine->_gamestate, vpc, printBWTag, printBytes); - } while ((vpc.offset > 0) && (vpc.offset + 6 < size) && (--opCount)); + } while ((vpc.getOffset() > 0) && (vpc.getOffset() + 6 < size) && (--opCount)); return true; } @@ -3011,7 +3010,7 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) { // Now dissassemble each method of the script object for (uint16 i = 0; i < obj->getMethodCount(); i++) { reg_t fptr = obj->getFunction(i); - uint16 offset = fptr.offset; + uint16 offset = fptr.getOffset(); int16 opparams[4]; byte extOpcode; byte opcode; @@ -3699,8 +3698,8 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV return 1; // Now lookup the script's segment - dest->segment = s->_segMan->getScriptSegment(script_nr); - if (!dest->segment) { + dest->setSegment(s->_segMan->getScriptSegment(script_nr)); + if (!dest->getSegment()) { return 1; } @@ -3782,19 +3781,19 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV offsetStr = colon + 1; Common::String segmentStr(str, colon); - dest->segment = strtol(segmentStr.c_str(), &endptr, 16); + dest->setSegment(strtol(segmentStr.c_str(), &endptr, 16)); if (*endptr) return 1; } else { int val = 0; - dest->segment = 0; + dest->setSegment(0); if (charsCountNumber == charsCount) { // Only numbers in input, assume decimal value val = strtol(str, &endptr, 10); if (*endptr) return 1; // strtol failed? - dest->offset = val; + dest->setOffset(val); return 0; } else { // We also got letters, check if there were only hexadecimal letters and '0x' at the start or 'h' at the end @@ -3802,7 +3801,7 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV val = strtol(str, &endptr, 16); if ((*endptr != 'h') && (*endptr != 0)) return 1; - dest->offset = val; + dest->setOffset(val); return 0; } else { // Something else was in input, assume object name @@ -3851,9 +3850,9 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV int val = strtol(offsetStr, &endptr, 16); if (relativeOffset) - dest->offset += val; + dest->incOffset(val); else - dest->offset = val; + dest->setOffset(val); if (*endptr) return 1; @@ -3933,15 +3932,15 @@ void Console::printList(List *list) { while (!pos.isNull()) { Node *node; - NodeTable *nt = (NodeTable *)_engine->_gamestate->_segMan->getSegment(pos.segment, SEG_TYPE_NODES); + NodeTable *nt = (NodeTable *)_engine->_gamestate->_segMan->getSegment(pos.getSegment(), SEG_TYPE_NODES); - if (!nt || !nt->isValidEntry(pos.offset)) { + if (!nt || !nt->isValidEntry(pos.getOffset())) { DebugPrintf(" WARNING: %04x:%04x: Doesn't contain list node!\n", PRINT_REG(pos)); return; } - node = &(nt->_table[pos.offset]); + node = &(nt->_table[pos.getOffset()]); DebugPrintf("\t%04x:%04x : %04x:%04x -> %04x:%04x\n", PRINT_REG(pos), PRINT_REG(node->key), PRINT_REG(node->value)); @@ -3960,37 +3959,37 @@ void Console::printList(List *list) { } int Console::printNode(reg_t addr) { - SegmentObj *mobj = _engine->_gamestate->_segMan->getSegment(addr.segment, SEG_TYPE_LISTS); + SegmentObj *mobj = _engine->_gamestate->_segMan->getSegment(addr.getSegment(), SEG_TYPE_LISTS); if (mobj) { ListTable *lt = (ListTable *)mobj; List *list; - if (!lt->isValidEntry(addr.offset)) { + if (!lt->isValidEntry(addr.getOffset())) { DebugPrintf("Address does not contain a list\n"); return 1; } - list = &(lt->_table[addr.offset]); + list = &(lt->_table[addr.getOffset()]); DebugPrintf("%04x:%04x : first x last = (%04x:%04x, %04x:%04x)\n", PRINT_REG(addr), PRINT_REG(list->first), PRINT_REG(list->last)); } else { NodeTable *nt; Node *node; - mobj = _engine->_gamestate->_segMan->getSegment(addr.segment, SEG_TYPE_NODES); + mobj = _engine->_gamestate->_segMan->getSegment(addr.getSegment(), SEG_TYPE_NODES); if (!mobj) { - DebugPrintf("Segment #%04x is not a list or node segment\n", addr.segment); + DebugPrintf("Segment #%04x is not a list or node segment\n", addr.getSegment()); return 1; } nt = (NodeTable *)mobj; - if (!nt->isValidEntry(addr.offset)) { + if (!nt->isValidEntry(addr.getOffset())) { DebugPrintf("Address does not contain a node\n"); return 1; } - node = &(nt->_table[addr.offset]); + node = &(nt->_table[addr.getOffset()]); DebugPrintf("%04x:%04x : prev x next = (%04x:%04x, %04x:%04x); maps %04x:%04x -> %04x:%04x\n", PRINT_REG(addr), PRINT_REG(node->pred), PRINT_REG(node->succ), PRINT_REG(node->key), PRINT_REG(node->value)); @@ -4028,8 +4027,8 @@ int Console::printObject(reg_t pos) { reg_t val = obj->getVariable(i); DebugPrintf("%04x:%04x", PRINT_REG(val)); - if (!val.segment) - DebugPrintf(" (%d)", val.offset); + if (!val.getSegment()) + DebugPrintf(" (%d)", val.getOffset()); const Object *ref = s->_segMan->getObject(val); if (ref) @@ -4042,8 +4041,8 @@ int Console::printObject(reg_t pos) { reg_t fptr = obj->getFunction(i); DebugPrintf(" [%03x] %s = %04x:%04x\n", obj->getFuncSelector(i), _engine->getKernel()->getSelectorName(obj->getFuncSelector(i)).c_str(), PRINT_REG(fptr)); } - if (s->_segMan->_heap[pos.segment]->getType() == SEG_TYPE_SCRIPT) - DebugPrintf("\nOwner script: %d\n", s->_segMan->getScript(pos.segment)->getScriptNumber()); + if (s->_segMan->_heap[pos.getSegment()]->getType() == SEG_TYPE_SCRIPT) + DebugPrintf("\nOwner script: %d\n", s->_segMan->getScript(pos.getSegment())->getScriptNumber()); return 0; } -- cgit v1.2.3 From 065e83e44fd16571b251b227c8fb5ffaccbadbed Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 18 Jun 2012 12:20:07 +0300 Subject: SCI: Store script sizes in 32-bit integers Since scripts can be larger than 64KB, and getBufSize() returns a 32-bit integer, adapt variables that store script sizes accordingly --- engines/sci/console.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/sci/console.cpp') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 7e9f9b1c38..91795117e3 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -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"); @@ -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"); -- cgit v1.2.3 From 76f3f1b13621b43781c4a2c505e646d9d52fdab7 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Thu, 21 Jun 2012 22:24:22 +0300 Subject: SCI: Fix warnings --- engines/sci/console.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'engines/sci/console.cpp') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 91795117e3..b0ed7e6225 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -2630,11 +2630,11 @@ bool Console::cmdViewReference(int argc, const char **argv) { #endif default: { const SegmentRef block = _engine->_gamestate->_segMan->dereference(reg); - uint32 size = block.maxSize; + uint16 size = block.maxSize; DebugPrintf("raw data\n"); - if (reg_end.getSegment() != 0 && size < reg_end.getOffset() - reg.getOffset()) { + if (reg_end.getSegment() != 0 && (size < reg_end.getOffset() - reg.getOffset())) { DebugPrintf("Block end out of bounds (size %d). Resetting.\n", size); reg_end = NULL_REG; } @@ -2936,7 +2936,7 @@ bool Console::cmdDisassembleAddress(int argc, const char **argv) { uint opCount = 1; bool printBWTag = false; bool printBytes = false; - uint32 size; + uint16 size; if (parse_reg_t(_engine->_gamestate, argv[1], &vpc, false)) { DebugPrintf("Invalid address passed.\n"); @@ -2960,11 +2960,6 @@ bool Console::cmdDisassembleAddress(int argc, const char **argv) { } } - if (opCount < 0) { - DebugPrintf("Invalid op_count\n"); - return true; - } - do { vpc = disassemble(_engine->_gamestate, vpc, printBWTag, printBytes); } while ((vpc.getOffset() > 0) && (vpc.getOffset() + 6 < size) && (--opCount)); -- cgit v1.2.3 From 20b677080881580706652b17dd5a4c3ed3e36c07 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sat, 23 Jun 2012 21:38:46 +0300 Subject: SCI: Change the program counter (PC) to be a 32-bit variable This is needed for future support of large SCI3 scripts. The program counter is isolated and does not interfere with other parts of the VM, plus it does not get stored in saved games, so it's pretty straightforward to convert --- engines/sci/console.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'engines/sci/console.cpp') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index b0ed7e6225..40a6fd1415 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -2913,7 +2913,8 @@ bool Console::cmdDisassemble(int argc, const char **argv) { if (jumpTarget > farthestTarget) farthestTarget = jumpTarget; } - addr = disassemble(_engine->_gamestate, addr, printBWTag, printBytecode); + // TODO: Use a true 32-bit reg_t for the position (addr) + addr = disassemble(_engine->_gamestate, make_reg32(addr.getSegment(), addr.getOffset()), printBWTag, printBytecode); if (addr.isNull() && prevAddr < farthestTarget) addr = prevAddr + 1; // skip past the ret } while (addr.getOffset() > 0); @@ -2961,7 +2962,8 @@ bool Console::cmdDisassembleAddress(int argc, const char **argv) { } do { - vpc = disassemble(_engine->_gamestate, vpc, printBWTag, printBytes); + // TODO: Use a true 32-bit reg_t for the position (vpc) + vpc = disassemble(_engine->_gamestate, make_reg32(vpc.getSegment(), vpc.getOffset()), printBWTag, printBytes); } while ((vpc.getOffset() > 0) && (vpc.getOffset() + 6 < size) && (--opCount)); return true; @@ -3652,10 +3654,14 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV relativeOffset = true; if (!scumm_strnicmp(str + 1, "PC", 2)) { - *dest = s->_executionStack.back().addr.pc; + // TODO: Handle 32-bit PC addresses + reg32_t pc = s->_executionStack.back().addr.pc; + *dest = make_reg(pc.getSegment(), (uint16)pc.getOffset()); offsetStr = str + 3; } else if (!scumm_strnicmp(str + 1, "P", 1)) { - *dest = s->_executionStack.back().addr.pc; + // TODO: Handle 32-bit PC addresses + reg32_t pc = s->_executionStack.back().addr.pc; + *dest = make_reg(pc.getSegment(), (uint16)pc.getOffset()); offsetStr = str + 2; } else if (!scumm_strnicmp(str + 1, "PREV", 4)) { *dest = s->r_prev; -- cgit v1.2.3 From 50dc5009c85f3713d6917d5aba1cbb1428da1c30 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Sun, 8 Jul 2012 21:58:47 +0300 Subject: SCI: Ignore another leftover script from KQ7 in the debugger --- engines/sci/console.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'engines/sci/console.cpp') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 40a6fd1415..564bbbbd79 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -2987,8 +2987,9 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) { // Ignore specific leftover scripts, which require other non-existing scripts if ((_engine->getGameId() == GID_HOYLE3 && itr->getNumber() == 995) || (_engine->getGameId() == GID_KQ5 && itr->getNumber() == 980) || - (_engine->getGameId() == GID_SLATER && itr->getNumber() == 947) || - (_engine->getGameId() == GID_MOTHERGOOSE256 && itr->getNumber() == 980)) { + (_engine->getGameId() == GID_KQ7 && itr->getNumber() == 111) || + (_engine->getGameId() == GID_MOTHERGOOSE256 && itr->getNumber() == 980) || + (_engine->getGameId() == GID_SLATER && itr->getNumber() == 947)) { continue; } -- cgit v1.2.3 From a12b3ea2dde9db348424f401a35fca3167120011 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Fri, 20 Jul 2012 20:52:58 -0400 Subject: SCI: Move the SEQ code to the new VideoDecoder API --- engines/sci/console.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'engines/sci/console.cpp') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 564bbbbd79..2a4ad1743d 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -250,9 +250,8 @@ void Console::postEnter() { #endif if (_videoFile.hasSuffix(".seq")) { - SeqDecoder *seqDecoder = new SeqDecoder(); - seqDecoder->setFrameDelay(_videoFrameDelay); - videoDecoder = seqDecoder; + videoDecoder = new SEQDecoder(_videoFrameDelay); + ((Video::AdvancedVideoDecoder *)videoDecoder)->start(); // TODO: Remove after new API is complete #ifdef ENABLE_SCI32 } else if (_videoFile.hasSuffix(".vmd")) { videoDecoder = new Video::VMDDecoder(g_system->getMixer()); -- cgit v1.2.3 From 0f0c6f935443212d76422959d040b87fc78d02c7 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sun, 22 Jul 2012 14:13:20 -0400 Subject: VIDEO: Rewrite the AVI code to use AdvancedVideoDecoder In addition to using the new API, it should theoretically support multiple audio and video tracks now but that has not been tested. --- engines/sci/console.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'engines/sci/console.cpp') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 2a4ad1743d..a6a6d4496f 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -259,10 +259,12 @@ void Console::postEnter() { videoDecoder = new RobotDecoder(g_system->getMixer(), _engine->getPlatform() == Common::kPlatformMacintosh); } else if (_videoFile.hasSuffix(".duk")) { duckMode = true; - videoDecoder = new Video::AviDecoder(g_system->getMixer()); + videoDecoder = new Video::AVIDecoder(); + ((Video::AdvancedVideoDecoder *)videoDecoder)->start(); #endif } else if (_videoFile.hasSuffix(".avi")) { - videoDecoder = new Video::AviDecoder(g_system->getMixer()); + videoDecoder = new Video::AVIDecoder(); + ((Video::AdvancedVideoDecoder *)videoDecoder)->start(); } else { warning("Unrecognized video type"); } -- cgit v1.2.3 From d4231fda1cb2399e123054ddaaeca2b4c2749966 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Sun, 22 Jul 2012 23:17:36 -0400 Subject: SCI: Rewrite RobotDecoder to use the AdvancedVideoDecoder API --- engines/sci/console.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/sci/console.cpp') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index a6a6d4496f..9b5ef35e92 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -251,25 +251,25 @@ void Console::postEnter() { if (_videoFile.hasSuffix(".seq")) { videoDecoder = new SEQDecoder(_videoFrameDelay); - ((Video::AdvancedVideoDecoder *)videoDecoder)->start(); // TODO: Remove after new API is complete #ifdef ENABLE_SCI32 } else if (_videoFile.hasSuffix(".vmd")) { videoDecoder = new Video::VMDDecoder(g_system->getMixer()); } else if (_videoFile.hasSuffix(".rbt")) { - videoDecoder = new RobotDecoder(g_system->getMixer(), _engine->getPlatform() == Common::kPlatformMacintosh); + videoDecoder = new RobotDecoder(_engine->getPlatform() == Common::kPlatformMacintosh); } else if (_videoFile.hasSuffix(".duk")) { duckMode = true; videoDecoder = new Video::AVIDecoder(); - ((Video::AdvancedVideoDecoder *)videoDecoder)->start(); #endif } else if (_videoFile.hasSuffix(".avi")) { videoDecoder = new Video::AVIDecoder(); - ((Video::AdvancedVideoDecoder *)videoDecoder)->start(); } else { warning("Unrecognized video type"); } if (videoDecoder && videoDecoder->loadFile(_videoFile)) { + if (!_videoFile.hasSuffix(".vmd")) // TODO: Remove after new API is complete + ((Video::AdvancedVideoDecoder *)videoDecoder)->start(); + _engine->_gfxCursor->kernelHide(); #ifdef ENABLE_SCI32 -- cgit v1.2.3 From 7294a1cbcf1cf5e8c846faf8838e537bd8c638dc Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 16 Aug 2012 12:17:23 -0400 Subject: VIDEO: Remove the Coktel video code from using the VideoDecoder API After discussing with DrMcCoy, we felt this the best way to proceed. A wrapper class that implements AdvancedVideoDecoder is still around for use in SCI. --- engines/sci/console.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'engines/sci/console.cpp') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 9b5ef35e92..de852ca9c0 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -253,7 +253,7 @@ void Console::postEnter() { videoDecoder = new SEQDecoder(_videoFrameDelay); #ifdef ENABLE_SCI32 } else if (_videoFile.hasSuffix(".vmd")) { - videoDecoder = new Video::VMDDecoder(g_system->getMixer()); + videoDecoder = new Video::AdvancedVMDDecoder(); } else if (_videoFile.hasSuffix(".rbt")) { videoDecoder = new RobotDecoder(_engine->getPlatform() == Common::kPlatformMacintosh); } else if (_videoFile.hasSuffix(".duk")) { @@ -267,8 +267,7 @@ void Console::postEnter() { } if (videoDecoder && videoDecoder->loadFile(_videoFile)) { - if (!_videoFile.hasSuffix(".vmd")) // TODO: Remove after new API is complete - ((Video::AdvancedVideoDecoder *)videoDecoder)->start(); + ((Video::AdvancedVideoDecoder *)videoDecoder)->start(); _engine->_gfxCursor->kernelHide(); -- cgit v1.2.3 From 18823198ad4e7dedd0ca33760eb453e9fe673551 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 16 Aug 2012 14:00:14 -0400 Subject: VIDEO: Merge AdvancedVideoDecoder into VideoDecoder --- engines/sci/console.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'engines/sci/console.cpp') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index de852ca9c0..1889d53480 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -267,8 +267,6 @@ void Console::postEnter() { } if (videoDecoder && videoDecoder->loadFile(_videoFile)) { - ((Video::AdvancedVideoDecoder *)videoDecoder)->start(); - _engine->_gfxCursor->kernelHide(); #ifdef ENABLE_SCI32 -- cgit v1.2.3