diff options
Diffstat (limited to 'engines/sci/console.cpp')
-rw-r--r-- | engines/sci/console.cpp | 71 |
1 files changed, 51 insertions, 20 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 6cd072ee8b..1661f92cfe 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -141,6 +141,8 @@ Console::Console(SciEngine *engine) : GUI::Debugger(), registerCmd("vpl", WRAP_METHOD(Console, cmdVisiblePlaneList)); // alias registerCmd("plane_items", WRAP_METHOD(Console, cmdPlaneItemList)); registerCmd("pi", WRAP_METHOD(Console, cmdPlaneItemList)); // alias + registerCmd("visible_plane_items", WRAP_METHOD(Console, cmdVisiblePlaneItemList)); + registerCmd("vpi", WRAP_METHOD(Console, cmdVisiblePlaneItemList)); // alias registerCmd("saved_bits", WRAP_METHOD(Console, cmdSavedBits)); registerCmd("show_saved_bits", WRAP_METHOD(Console, cmdShowSavedBits)); // Segments @@ -386,6 +388,7 @@ bool Console::cmdHelp(int argc, const char **argv) { debugPrintf(" plane_list / pl - Shows a list of all the planes in the draw list (SCI2+)\n"); debugPrintf(" visible_plane_list / vpl - Shows a list of all the planes in the visible draw list (SCI2+)\n"); debugPrintf(" plane_items / pi - Shows a list of all items for a plane (SCI2+)\n"); + debugPrintf(" visible_plane_items / vpi - Shows a list of all items for a plane in the visible draw list (SCI2+)\n"); debugPrintf(" saved_bits - List saved bits on the hunk\n"); debugPrintf(" show_saved_bits - Display saved bits\n"); debugPrintf("\n"); @@ -1817,6 +1820,34 @@ bool Console::cmdPlaneItemList(int argc, const char **argv) { return true; } +bool Console::cmdVisiblePlaneItemList(int argc, const char **argv) { + if (argc != 2) { + debugPrintf("Shows the list of items for a plane\n"); + debugPrintf("Usage: %s <plane address>\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("Visible plane item list:\n"); + _engine->_gfxFrameout->printVisiblePlaneItemList(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) { SegManager *segman = _engine->_gamestate->_segMan; SegmentId id = segman->findSegmentByType(SEG_TYPE_HUNK); @@ -1830,7 +1861,7 @@ bool Console::cmdSavedBits(int argc, const char **argv) { for (uint i = 0; i < entries.size(); ++i) { uint16 offset = entries[i].getOffset(); - const Hunk& h = hunks->_table[offset]; + const Hunk& h = hunks->at(offset); if (strcmp(h.type, "SaveBits()") == 0) { byte* memoryPtr = (byte *)h.mem; @@ -1897,7 +1928,7 @@ bool Console::cmdShowSavedBits(int argc, const char **argv) { return true; } - const Hunk& h = hunks->_table[memoryHandle.getOffset()]; + const Hunk& h = hunks->at(memoryHandle.getOffset()); if (strcmp(h.type, "SaveBits()") != 0) { debugPrintf("Invalid address.\n"); @@ -2113,32 +2144,32 @@ bool Console::segmentInfo(int nr) { break; case SEG_TYPE_CLONES: { - CloneTable *ct = (CloneTable *)mobj; + CloneTable &ct = *(CloneTable *)mobj; debugPrintf("clones\n"); - for (uint i = 0; i < ct->_table.size(); i++) - if (ct->isValidEntry(i)) { + for (uint i = 0; i < ct.size(); i++) + if (ct.isValidEntry(i)) { reg_t objpos = make_reg(nr, i); debugPrintf(" [%04x] %s; copy of ", i, _engine->_gamestate->_segMan->getObjectName(objpos)); // Object header - const Object *obj = _engine->_gamestate->_segMan->getObject(ct->_table[i].getPos()); + const Object *obj = _engine->_gamestate->_segMan->getObject(ct[i].getPos()); if (obj) - debugPrintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(ct->_table[i].getPos()), - _engine->_gamestate->_segMan->getObjectName(ct->_table[i].getPos()), + debugPrintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(ct[i].getPos()), + _engine->_gamestate->_segMan->getObjectName(ct[i].getPos()), obj->getVarCount(), obj->getMethodCount()); } } break; case SEG_TYPE_LISTS: { - ListTable *lt = (ListTable *)mobj; + ListTable < = *(ListTable *)mobj; debugPrintf("lists\n"); - for (uint i = 0; i < lt->_table.size(); i++) - if (lt->isValidEntry(i)) { + for (uint i = 0; i < lt.size(); i++) + if (lt.isValidEntry(i)) { debugPrintf(" [%04x]: ", i); - printList(&(lt->_table[i])); + printList(<[i]); } } break; @@ -2149,13 +2180,13 @@ bool Console::segmentInfo(int nr) { } case SEG_TYPE_HUNK: { - HunkTable *ht = (HunkTable *)mobj; + HunkTable &ht = *(HunkTable *)mobj; - debugPrintf("hunk (total %d)\n", ht->entries_used); - for (uint i = 0; i < ht->_table.size(); i++) - if (ht->isValidEntry(i)) { + debugPrintf("hunk (total %d)\n", ht.entries_used); + for (uint i = 0; i < ht.size(); i++) + if (ht.isValidEntry(i)) { debugPrintf(" [%04x] %d bytes at %p, type=%s\n", - i, ht->_table[i].size, ht->_table[i].mem, ht->_table[i].type); + i, ht[i].size, ht[i].mem, ht[i].type); } } break; @@ -4331,7 +4362,7 @@ void Console::printList(List *list) { return; } - node = &(nt->_table[pos.getOffset()]); + node = &nt->at(pos.getOffset()); debugPrintf("\t%04x:%04x : %04x:%04x -> %04x:%04x\n", PRINT_REG(pos), PRINT_REG(node->key), PRINT_REG(node->value)); @@ -4361,7 +4392,7 @@ int Console::printNode(reg_t addr) { return 1; } - list = &(lt->_table[addr.getOffset()]); + list = <->at(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 { @@ -4380,7 +4411,7 @@ int Console::printNode(reg_t addr) { debugPrintf("Address does not contain a node\n"); return 1; } - node = &(nt->_table[addr.getOffset()]); + node = &nt->at(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)); |