diff options
Diffstat (limited to 'engines/sci/console.cpp')
-rw-r--r-- | engines/sci/console.cpp | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 7b329864ce..4637004616 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -381,7 +381,7 @@ const char *selector_name(EngineState *s, int selector) { } bool Console::cmdGetVersion(int argc, const char **argv) { - DebugPrintf("Resource file version: %s\n", versionNames[_vm->getResMgr()->sciVersion()]); + DebugPrintf("Resource file version: %s\n", versionNames[_vm->getresourceManager()->sciVersion()]); DebugPrintf("Emulated interpreter version: %s\n", versionNames[_vm->getVersion()]); return true; @@ -580,7 +580,7 @@ bool Console::cmdHexDump(int argc, const char **argv) { if (res == kResourceTypeInvalid) DebugPrintf("Resource type '%s' is not valid\n", argv[1]); else { - Resource *resource = _vm->getResMgr()->findResource(ResourceId(res, resNum), 0); + Resource *resource = _vm->getresourceManager()->findResource(ResourceId(res, resNum), 0); if (resource) { Common::hexdump(resource->data, resource->size, 16, 0); DebugPrintf("Resource %s.%03d has been dumped to standard output\n", argv[1], resNum); @@ -636,7 +636,7 @@ bool Console::cmdResourceSize(int argc, const char **argv) { if (res == kResourceTypeInvalid) DebugPrintf("Resource type '%s' is not valid\n", argv[1]); else { - Resource *resource = _vm->getResMgr()->findResource(ResourceId(res, resNum), 0); + Resource *resource = _vm->getresourceManager()->findResource(ResourceId(res, resNum), 0); if (resource) { DebugPrintf("Resource size: %d\n", resource->size); } else { @@ -706,7 +706,7 @@ bool Console::cmdHexgrep(int argc, const char **argv) { } for (; resNumber <= resMax; resNumber++) { - if ((script = _vm->getResMgr()->findResource(ResourceId(restype, resNumber), 0))) { + if ((script = _vm->getresourceManager()->findResource(ResourceId(restype, resNumber), 0))) { unsigned int seeker = 0, seekerold = 0; uint32 comppos = 0; int output_script_name = 0; @@ -761,7 +761,7 @@ bool Console::cmdList(int argc, const char **argv) { number = atoi(argv[2]); } - Common::List<ResourceId> *resources = _vm->getResMgr()->listResources(res, number); + Common::List<ResourceId> *resources = _vm->getresourceManager()->listResources(res, number); sort(resources->begin(), resources->end(), ResourceIdLess()); Common::List<ResourceId>::iterator itr = resources->begin(); @@ -889,11 +889,11 @@ bool Console::cmdRestartGame(int argc, const char **argv) { bool Console::cmdClassTable(int argc, const char **argv) { DebugPrintf("Available classes:\n"); - for (uint i = 0; i < _vm->_gamestate->seg_manager->_classtable.size(); i++) { - if (_vm->_gamestate->seg_manager->_classtable[i].reg.segment) { + for (uint i = 0; i < _vm->_gamestate->segmentManager->_classtable.size(); i++) { + if (_vm->_gamestate->segmentManager->_classtable[i].reg.segment) { DebugPrintf(" Class 0x%x at %04x:%04x (script 0x%x)\n", i, - PRINT_REG(_vm->_gamestate->seg_manager->_classtable[i].reg), - _vm->_gamestate->seg_manager->_classtable[i].script); + PRINT_REG(_vm->_gamestate->segmentManager->_classtable[i].reg), + _vm->_gamestate->segmentManager->_classtable[i].script); } } @@ -1307,8 +1307,8 @@ bool Console::cmdStatusBarColors(int argc, const char **argv) { bool Console::cmdPrintSegmentTable(int argc, const char **argv) { DebugPrintf("Segment table:\n"); - for (uint i = 0; i < _vm->_gamestate->seg_manager->_heap.size(); i++) { - MemObject *mobj = _vm->_gamestate->seg_manager->_heap[i]; + for (uint i = 0; i < _vm->_gamestate->segmentManager->_heap.size(); i++) { + MemObject *mobj = _vm->_gamestate->segmentManager->_heap[i]; if (mobj && mobj->getType()) { DebugPrintf(" [%04x] ", i); @@ -1358,7 +1358,7 @@ bool Console::cmdPrintSegmentTable(int argc, const char **argv) { break; } - DebugPrintf(" seg_ID = %d \n", mobj->getSegMgrId()); + DebugPrintf(" seg_ID = %d \n", mobj->getSegmentManagerId()); } } DebugPrintf("\n"); @@ -1369,10 +1369,10 @@ bool Console::cmdPrintSegmentTable(int argc, const char **argv) { bool Console::segmentInfo(int nr) { DebugPrintf("[%04x] ", nr); - if ((nr < 0) || ((uint)nr >= _vm->_gamestate->seg_manager->_heap.size()) || !_vm->_gamestate->seg_manager->_heap[nr]) + if ((nr < 0) || ((uint)nr >= _vm->_gamestate->segmentManager->_heap.size()) || !_vm->_gamestate->segmentManager->_heap[nr]) return false; - MemObject *mobj = _vm->_gamestate->seg_manager->_heap[nr]; + MemObject *mobj = _vm->_gamestate->segmentManager->_heap[nr]; switch (mobj->getType()) { @@ -1395,10 +1395,10 @@ bool Console::segmentInfo(int nr) { for (uint i = 0; i < scr->_objects.size(); i++) { DebugPrintf(" "); // Object header - Object *obj = obj_get(_vm->_gamestate->seg_manager, _vm->_gamestate->_version, scr->_objects[i].pos); + Object *obj = obj_get(_vm->_gamestate->segmentManager, scr->_objects[i].pos); if (obj) DebugPrintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(scr->_objects[i].pos), - obj_get_name(_vm->_gamestate->seg_manager, _vm->_gamestate->_version, + obj_get_name(_vm->_gamestate->segmentManager, scr->_objects[i].pos), obj->_variables.size(), obj->methods_nr); } } @@ -1440,12 +1440,12 @@ bool Console::segmentInfo(int nr) { reg_t objpos; objpos.offset = i; objpos.segment = nr; - DebugPrintf(" [%04x] %s; copy of ", i, obj_get_name(_vm->_gamestate->seg_manager, _vm->_gamestate->_version, objpos)); + DebugPrintf(" [%04x] %s; copy of ", i, obj_get_name(_vm->_gamestate->segmentManager, objpos)); // Object header - Object *obj = obj_get(_vm->_gamestate->seg_manager, _vm->_gamestate->_version, ct->_table[i].pos); + Object *obj = obj_get(_vm->_gamestate->segmentManager, ct->_table[i].pos); if (obj) DebugPrintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(ct->_table[i].pos), - obj_get_name(_vm->_gamestate->seg_manager, _vm->_gamestate->_version, ct->_table[i].pos), + obj_get_name(_vm->_gamestate->segmentManager, ct->_table[i].pos), obj->_variables.size(), obj->methods_nr); } } @@ -1512,7 +1512,7 @@ bool Console::cmdSegmentInfo(int argc, const char **argv) { } if (!scumm_stricmp(argv[1], "all")) { - for (uint i = 0; i < _vm->_gamestate->seg_manager->_heap.size(); i++) + for (uint i = 0; i < _vm->_gamestate->segmentManager->_heap.size(); i++) segmentInfo(i); } else { int nr = atoi(argv[1]); @@ -1531,7 +1531,7 @@ bool Console::cmdKillSegment(int argc, const char **argv) { return true; } - _vm->_gamestate->seg_manager->getScript(atoi(argv[1]))->setLockers(0); + _vm->_gamestate->segmentManager->getScript(atoi(argv[1]))->setLockers(0); return true; } @@ -1636,14 +1636,14 @@ bool Console::cmdGCShowReachable(int argc, const char **argv) { return true; } - MemObject *mobj = GET_SEGMENT_ANY(*_vm->_gamestate->seg_manager, addr.segment); + MemObject *mobj = GET_SEGMENT_ANY(*_vm->_gamestate->segmentManager, addr.segment); if (!mobj) { DebugPrintf("Unknown segment : %x\n", addr.segment); return 1; } DebugPrintf("Reachable from %04x:%04x:\n", PRINT_REG(addr)); - mobj->listAllOutgoingReferences(_vm->_gamestate, addr, NULL, _print_address); + mobj->listAllOutgoingReferences(addr, NULL, _print_address, _vm->_gamestate->resourceManager->sciVersion()); return true; } @@ -1665,7 +1665,7 @@ bool Console::cmdGCShowFreeable(int argc, const char **argv) { return true; } - MemObject *mobj = GET_SEGMENT_ANY(*_vm->_gamestate->seg_manager, addr.segment); + MemObject *mobj = GET_SEGMENT_ANY(*_vm->_gamestate->segmentManager, addr.segment); if (!mobj) { DebugPrintf("Unknown segment : %x\n", addr.segment); return true; @@ -1695,13 +1695,13 @@ bool Console::cmdGCNormalize(int argc, const char **argv) { return true; } - MemObject *mobj = GET_SEGMENT_ANY(*_vm->_gamestate->seg_manager, addr.segment); + MemObject *mobj = GET_SEGMENT_ANY(*_vm->_gamestate->segmentManager, addr.segment); if (!mobj) { DebugPrintf("Unknown segment : %x\n", addr.segment); return true; } - addr = mobj->findCanonicAddress(_vm->_gamestate->seg_manager, addr); + addr = mobj->findCanonicAddress(_vm->_gamestate->segmentManager, addr); DebugPrintf(" %04x:%04x\n", PRINT_REG(addr)); return true; @@ -1817,7 +1817,7 @@ bool Console::cmdValueType(int argc, const char **argv) { return true; } - int t = determine_reg_type(_vm->_gamestate, val, true); + int t = determine_reg_type(_vm->_gamestate->segmentManager, val, true); int invalid = t & KSIG_INVALID; switch (t & ~KSIG_INVALID) { @@ -1892,7 +1892,7 @@ bool Console::cmdViewReference(int argc, const char **argv) { } } - int type_mask = determine_reg_type(_vm->_gamestate, reg, 1); + int type_mask = determine_reg_type(_vm->_gamestate->segmentManager, reg, 1); int filter; int found = 0; @@ -1942,7 +1942,7 @@ bool Console::cmdViewReference(int argc, const char **argv) { break; case KSIG_REF: { int size; - unsigned char *block = _vm->_gamestate->seg_manager->dereference(reg, &size); + unsigned char *block = _vm->_gamestate->segmentManager->dereference(reg, &size); DebugPrintf("raw data\n"); @@ -2048,7 +2048,7 @@ bool Console::cmdBacktrace(int argc, const char **argv) { for (iter = _vm->_gamestate->_executionStack.begin(); iter != _vm->_gamestate->_executionStack.end(); ++iter, ++i) { ExecStack &call = *iter; - const char *objname = obj_get_name(_vm->_gamestate->seg_manager, _vm->_gamestate->_version, call.sendp); + const char *objname = obj_get_name(_vm->_gamestate->segmentManager, call.sendp); int paramc, totalparamc; switch (call.type) { @@ -2098,7 +2098,7 @@ bool Console::cmdBacktrace(int argc, const char **argv) { printf(" argp:ST:%04x", (unsigned)(call.variables_argp - _vm->_gamestate->stack_base)); if (call.type == EXEC_STACK_TYPE_CALL) - printf(" script: %d", (*(Script *)_vm->_gamestate->seg_manager->_heap[call.addr.pc.segment]).nr); + printf(" script: %d", (*(Script *)_vm->_gamestate->segmentManager->_heap[call.addr.pc.segment]).nr); printf("\n"); } @@ -2190,7 +2190,7 @@ bool Console::cmdDissassemble(int argc, const char **argv) { return true; } - Object *obj = obj_get(_vm->_gamestate->seg_manager, _vm->_gamestate->_version, objAddr); + Object *obj = obj_get(_vm->_gamestate->segmentManager, objAddr); int selector_id = _vm->getKernel()->findSelector(argv[2]); reg_t addr; @@ -2204,7 +2204,7 @@ bool Console::cmdDissassemble(int argc, const char **argv) { return true; } - if (lookup_selector(_vm->_gamestate, objAddr, selector_id, NULL, &addr) != kSelectorMethod) { + if (lookup_selector(_vm->_gamestate->segmentManager, objAddr, selector_id, NULL, &addr) != kSelectorMethod) { DebugPrintf("Not a method."); return true; } @@ -2239,7 +2239,7 @@ bool Console::cmdDissassembleAddress(int argc, const char **argv) { return true; } - _vm->_gamestate->seg_manager->dereference(vpc, &size); + _vm->_gamestate->segmentManager->dereference(vpc, &size); size += vpc.offset; // total segment size for (int i = 2; i < argc; i++) { @@ -2298,13 +2298,13 @@ bool Console::cmdSend(int argc, const char **argv) { return true; } - o = obj_get(_vm->_gamestate->seg_manager, _vm->_gamestate->_version, object); + o = obj_get(_vm->_gamestate->segmentManager, object); if (o == NULL) { DebugPrintf("Address \"%04x:%04x\" is not an object\n", PRINT_REG(object)); return true; } - SelectorType selector_type = lookup_selector(_vm->_gamestate, object, selector_id, 0, &fptr); + SelectorType selector_type = lookup_selector(_vm->_gamestate->segmentManager, object, selector_id, 0, &fptr); if (selector_type == kSelectorNone) { DebugPrintf("Object does not support selector: \"%s\"\n", selector_name); @@ -2500,7 +2500,7 @@ bool Console::cmdIsSample(int argc, const char **argv) { return true; } - Resource *song = _vm->getResMgr()->findResource(ResourceId(kResourceTypeSound, atoi(argv[1])), 0); + Resource *song = _vm->getresourceManager()->findResource(ResourceId(kResourceTypeSound, atoi(argv[1])), 0); SongIterator *songit; Audio::AudioStream *data; @@ -2538,7 +2538,7 @@ bool Console::cmdSfx01Header(int argc, const char **argv) { return true; } - Resource *song = _vm->getResMgr()->findResource(ResourceId(kResourceTypeSound, atoi(argv[1])), 0); + Resource *song = _vm->getresourceManager()->findResource(ResourceId(kResourceTypeSound, atoi(argv[1])), 0); if (!song) { DebugPrintf("Doesn't exist\n"); @@ -2703,7 +2703,7 @@ bool Console::cmdSfx01Track(int argc, const char **argv) { return true; } - Resource *song = _vm->getResMgr()->findResource(ResourceId(kResourceTypeSound, atoi(argv[1])), 0); + Resource *song = _vm->getresourceManager()->findResource(ResourceId(kResourceTypeSound, atoi(argv[1])), 0); int offset = atoi(argv[2]); @@ -2838,7 +2838,7 @@ int parse_reg_t(EngineState *s, const char *str, reg_t *dest) { // Returns 0 on if (*endptr) return 1; - dest->segment = s->seg_manager->segGet(script_nr); + dest->segment = s->segmentManager->segGet(script_nr); if (!dest->segment) { return 1; @@ -2874,8 +2874,8 @@ int parse_reg_t(EngineState *s, const char *str, reg_t *dest) { // Returns 0 on str_objname = str + 1; // Now all values are available; iterate over all objects. - for (i = 0; i < s->seg_manager->_heap.size(); i++) { - MemObject *mobj = s->seg_manager->_heap[i]; + for (i = 0; i < s->segmentManager->_heap.size(); i++) { + MemObject *mobj = s->segmentManager->_heap[i]; int idx = 0; int max_index = 0; @@ -2903,7 +2903,7 @@ int parse_reg_t(EngineState *s, const char *str, reg_t *dest) { // Returns 0 on } if (valid) { - const char *objname = obj_get_name(s->seg_manager, s->_version, objpos); + const char *objname = obj_get_name(s->segmentManager, objpos); if (!strcmp(objname, str_objname)) { // Found a match! if ((index < 0) && (times_found > 0)) { @@ -2977,7 +2977,7 @@ void Console::printList(List *l) { while (!pos.isNull()) { Node *node; - NodeTable *nt = (NodeTable *)GET_SEGMENT(*_vm->_gamestate->seg_manager, pos.segment, MEM_OBJ_NODES); + NodeTable *nt = (NodeTable *)GET_SEGMENT(*_vm->_gamestate->segmentManager, pos.segment, MEM_OBJ_NODES); if (!nt || !nt->isValidEntry(pos.offset)) { DebugPrintf(" WARNING: %04x:%04x: Doesn't contain list node!\n", @@ -3004,7 +3004,7 @@ void Console::printList(List *l) { } int Console::printNode(reg_t addr) { - MemObject *mobj = GET_SEGMENT(*_vm->_gamestate->seg_manager, addr.segment, MEM_OBJ_LISTS); + MemObject *mobj = GET_SEGMENT(*_vm->_gamestate->segmentManager, addr.segment, MEM_OBJ_LISTS); if (mobj) { ListTable *lt = (ListTable *)mobj; @@ -3021,7 +3021,7 @@ int Console::printNode(reg_t addr) { } else { NodeTable *nt; Node *node; - mobj = GET_SEGMENT(*_vm->_gamestate->seg_manager, addr.segment, MEM_OBJ_NODES); + mobj = GET_SEGMENT(*_vm->_gamestate->segmentManager, addr.segment, MEM_OBJ_NODES); if (!mobj) { DebugPrintf("Segment #%04x is not a list or node segment\n", addr.segment); @@ -3045,10 +3045,10 @@ int Console::printNode(reg_t addr) { int Console::printObject(reg_t pos) { EngineState *s = _vm->_gamestate; // for the several defines in this function - Object *obj = obj_get(s->seg_manager, s->_version, pos); + Object *obj = obj_get(s->segmentManager, pos); Object *var_container = obj; int i; - SciVersion version = s->_version; // for the selector defines + SciVersion version = s->resourceManager->sciVersion(); // for the selector defines if (!obj) { DebugPrintf("[%04x:%04x]: Not an object.", PRINT_REG(pos)); @@ -3056,11 +3056,11 @@ int Console::printObject(reg_t pos) { } // Object header - DebugPrintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(pos), obj_get_name(s->seg_manager, s->_version, pos), + DebugPrintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(pos), obj_get_name(s->segmentManager, pos), obj->_variables.size(), obj->methods_nr); if (!(obj->_variables[SCRIPT_INFO_SELECTOR].offset & SCRIPT_INFO_CLASS)) - var_container = obj_get(s->seg_manager, s->_version, obj->_variables[SCRIPT_SUPERCLASS_SELECTOR]); + var_container = obj_get(s->segmentManager, obj->_variables[SCRIPT_SUPERCLASS_SELECTOR]); DebugPrintf(" -- member variables:\n"); for (i = 0; (uint)i < obj->_variables.size(); i++) { printf(" "); @@ -3072,9 +3072,9 @@ int Console::printObject(reg_t pos) { reg_t val = obj->_variables[i]; DebugPrintf("%04x:%04x", PRINT_REG(val)); - Object *ref = obj_get(s->seg_manager, s->_version, val); + Object *ref = obj_get(s->segmentManager, val); if (ref) - DebugPrintf(" (%s)", obj_get_name(s->seg_manager, s->_version, val)); + DebugPrintf(" (%s)", obj_get_name(s->segmentManager, val)); DebugPrintf("\n"); } @@ -3083,8 +3083,8 @@ int Console::printObject(reg_t pos) { reg_t fptr = VM_OBJECT_READ_FUNCTION(obj, i); DebugPrintf(" [%03x] %s = %04x:%04x\n", VM_OBJECT_GET_FUNCSELECTOR(obj, i), selector_name(s, VM_OBJECT_GET_FUNCSELECTOR(obj, i)), PRINT_REG(fptr)); } - if (s->seg_manager->_heap[pos.segment]->getType() == MEM_OBJ_SCRIPT) - DebugPrintf("\nOwner script:\t%d\n", s->seg_manager->getScript(pos.segment)->nr); + if (s->segmentManager->_heap[pos.segment]->getType() == MEM_OBJ_SCRIPT) + DebugPrintf("\nOwner script:\t%d\n", s->segmentManager->getScript(pos.segment)->nr); return 0; } @@ -3126,7 +3126,7 @@ static void viewobjinfo(EngineState *s, HeapPtr pos) { int have_rects = 0; Common::Rect nsrect, nsrect_clipped, brrect; - if (lookup_selector(s, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsBottom, NULL) == kSelectorVariable) { + if (lookup_selector(s->segmentManager, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsBottom, NULL) == kSelectorVariable) { GETRECT(nsLeft, nsRight, nsBottom, nsTop); GETRECT(lsLeft, lsRight, lsBottom, lsTop); GETRECT(brLeft, brRight, brBottom, brTop); @@ -3204,10 +3204,10 @@ static int c_gfx_draw_viewobj(EngineState *s, const Common::Array<cmd_param_t> & } - is_view = (lookup_selector(s, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.x, NULL) == kSelectorVariable) && - (lookup_selector(s, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.brLeft, NULL) == kSelectorVariable) && - (lookup_selector(s, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.signal, NULL) == kSelectorVariable) && - (lookup_selector(s, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsTop, NULL) == kSelectorVariable); + is_view = (lookup_selector(s->segmentManager, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.x, NULL) == kSelectorVariable) && + (lookup_selector(s->segmentManager, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.brLeft, NULL) == kSelectorVariable) && + (lookup_selector(s->segmentManager, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.signal, NULL) == kSelectorVariable) && + (lookup_selector(s->segmentManager, pos, ((SciEngine*)g_engine)->getKernel()->_selectorMap.nsTop, NULL) == kSelectorVariable); if (!is_view) { printf("Not a dynamic View object.\n"); |