diff options
| author | Filippos Karapetis | 2009-05-30 14:30:39 +0000 |
|---|---|---|
| committer | Filippos Karapetis | 2009-05-30 14:30:39 +0000 |
| commit | 69582f0179c9ab9dcdc0afb2acbe659d36a37790 (patch) | |
| tree | 14a4d8507726a615e648c88cf519f8cbd137a5f8 /engines/sci/console.cpp | |
| parent | 9823f60146bedae98f2e649e7938614390fc4525 (diff) | |
| download | scummvm-rg350-69582f0179c9ab9dcdc0afb2acbe659d36a37790.tar.gz scummvm-rg350-69582f0179c9ab9dcdc0afb2acbe659d36a37790.tar.bz2 scummvm-rg350-69582f0179c9ab9dcdc0afb2acbe659d36a37790.zip | |
Moved 3 more debug commands to console.cpp ("simkey", "segment_table" and "show_map") and removed the GFXWC macro. Some cleanup
svn-id: r41032
Diffstat (limited to 'engines/sci/console.cpp')
| -rw-r--r-- | engines/sci/console.cpp | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 95c37074e0..d001cb0143 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -41,6 +41,8 @@ namespace Sci { extern EngineState *g_EngineState; +int _kdebug_cheap_event_hack = 0; + Console::Console(SciEngine *vm) : GUI::Debugger() { _vm = vm; @@ -71,6 +73,9 @@ Console::Console(SciEngine *vm) : GUI::Debugger() { DCmd_Register("visual_state", WRAP_METHOD(Console, cmdVisualState)); DCmd_Register("dynamic_views", WRAP_METHOD(Console, cmdDynamicViews)); DCmd_Register("dropped_views", WRAP_METHOD(Console, cmdDroppedViews)); + DCmd_Register("simkey", WRAP_METHOD(Console, cmdSimulateKey)); + DCmd_Register("segment_table", WRAP_METHOD(Console, cmdPrintSegmentTable)); + DCmd_Register("show_map", WRAP_METHOD(Console, cmdShowMap)); DCmd_Register("gc", WRAP_METHOD(Console, cmdInvokeGC)); DCmd_Register("gc_objects", WRAP_METHOD(Console, cmdGCObjects)); DCmd_Register("exit", WRAP_METHOD(Console, cmdExit)); @@ -607,6 +612,121 @@ bool Console::cmdDroppedViews(int argc, const char **argv) { return true; } +bool Console::cmdSimulateKey(int argc, const char **argv) { + if (argc != 2) { + DebugPrintf("Simulate a keypress with the specified scancode\n"); + DebugPrintf("Usage: %s <key scan code>\n", argv[0]); + return true; + } + + _kdebug_cheap_event_hack = atoi(argv[1]); + + return true; +} + +bool Console::cmdPrintSegmentTable(int argc, const char **argv) { + DebugPrintf("Segment table:\n"); + + for (uint i = 0; i < g_EngineState->seg_manager->_heap.size(); i++) { + MemObject *mobj = g_EngineState->seg_manager->_heap[i]; + if (mobj && mobj->getType()) { + DebugPrintf(" [%04x] ", i); + + switch (mobj->getType()) { + case MEM_OBJ_SCRIPT: + DebugPrintf("S script.%03d l:%d ", (*(Script *)mobj).nr, (*(Script *)mobj).lockers); + break; + + case MEM_OBJ_CLONES: + DebugPrintf("C clones (%d allocd)", (*(CloneTable *)mobj).entries_used); + break; + + case MEM_OBJ_LOCALS: + DebugPrintf("V locals %03d", (*(LocalVariables *)mobj).script_id); + break; + + case MEM_OBJ_STACK: + DebugPrintf("D data stack (%d)", (*(DataStack *)mobj).nr); + break; + + case MEM_OBJ_SYS_STRINGS: + DebugPrintf("Y system string table"); + break; + + case MEM_OBJ_LISTS: + DebugPrintf("L lists (%d)", (*(ListTable *)mobj).entries_used); + break; + + case MEM_OBJ_NODES: + DebugPrintf("N nodes (%d)", (*(NodeTable *)mobj).entries_used); + break; + + case MEM_OBJ_HUNK: + DebugPrintf("H hunk (%d)", (*(HunkTable *)mobj).entries_used); + break; + + case MEM_OBJ_DYNMEM: + DebugPrintf("M dynmem: %d bytes", (*(DynMem *)mobj)._size); + break; + + case MEM_OBJ_STRING_FRAG: + DebugPrintf("F string fragments"); + break; + + default: + DebugPrintf("I Invalid (type = %x)", mobj->getType()); + break; + } + + DebugPrintf(" seg_ID = %d \n", mobj->getSegMgrId()); + } + } + DebugPrintf("\n"); + + return true; +} + +bool Console::cmdShowMap(int argc, const char **argv) { + if (argc != 2) { + DebugPrintf("Shows one of the screen maps\n"); + DebugPrintf("Usage: %s <screen map>\n", argv[0]); + DebugPrintf("Screen maps:\n"); + DebugPrintf("- 0: visual map (back buffer)\n"); + DebugPrintf("- 1: priority map (back buffer)\n"); + DebugPrintf("- 2: control map (static buffer)\n"); + return true; + } + + gfxop_set_clip_zone(g_EngineState->gfx_state, gfx_rect_fullscreen); + + int map = atoi(argv[1]); + + switch (map) { + case 0: + g_EngineState->visual->add_dirty_abs((GfxContainer *)g_EngineState->visual, gfx_rect(0, 0, 320, 200), 0); + g_EngineState->visual->draw(Common::Point(0, 0)); + break; + + case 1: + gfx_xlate_pixmap(g_EngineState->gfx_state->pic->priority_map, g_EngineState->gfx_state->driver->mode, GFX_XLATE_FILTER_NONE); + gfxop_draw_pixmap(g_EngineState->gfx_state, g_EngineState->gfx_state->pic->priority_map, gfx_rect(0, 0, 320, 200), Common::Point(0, 0)); + break; + + case 2: + gfx_xlate_pixmap(g_EngineState->gfx_state->control_map, g_EngineState->gfx_state->driver->mode, GFX_XLATE_FILTER_NONE); + gfxop_draw_pixmap(g_EngineState->gfx_state, g_EngineState->gfx_state->control_map, gfx_rect(0, 0, 320, 200), Common::Point(0, 0)); + break; + + default: + DebugPrintf("Map %d is not available.\n", map); + return true; + } + + gfxop_update(g_EngineState->gfx_state); + + return false; +} + bool Console::cmdInvokeGC(int argc, const char **argv) { DebugPrintf("Performing garbage collection...\n"); run_gc(g_EngineState); |
