diff options
Diffstat (limited to 'engines/sci/console.cpp')
-rw-r--r-- | engines/sci/console.cpp | 1780 |
1 files changed, 902 insertions, 878 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index 50fae61de0..565e9752c3 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -8,12 +8,12 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -79,148 +79,151 @@ Console::Console(SciEngine *engine) : GUI::Debugger(), assert(_engine->_gamestate); // Variables - DVar_Register("sleeptime_factor", &g_debug_sleeptime_factor, DVAR_INT, 0); - DVar_Register("gc_interval", &engine->_gamestate->scriptGCInterval, DVAR_INT, 0); - DVar_Register("simulated_key", &g_debug_simulated_key, DVAR_INT, 0); - DVar_Register("track_mouse_clicks", &g_debug_track_mouse_clicks, DVAR_BOOL, 0); - DVar_Register("script_abort_flag", &_engine->_gamestate->abortScriptProcessing, DVAR_INT, 0); + registerVar("sleeptime_factor", &g_debug_sleeptime_factor); + registerVar("gc_interval", &engine->_gamestate->scriptGCInterval); + registerVar("simulated_key", &g_debug_simulated_key); + registerVar("track_mouse_clicks", &g_debug_track_mouse_clicks); + // FIXME: This actually passes an enum type instead of an integer but no + // precaution is taken to assure that all assigned values are in the range + // of the enum type. We should handle this more carefully... + registerVar("script_abort_flag", (int *)&_engine->_gamestate->abortScriptProcessing); // General - DCmd_Register("help", WRAP_METHOD(Console, cmdHelp)); + registerCmd("help", WRAP_METHOD(Console, cmdHelp)); // Kernel -// DCmd_Register("classes", WRAP_METHOD(Console, cmdClasses)); // TODO - DCmd_Register("opcodes", WRAP_METHOD(Console, cmdOpcodes)); - DCmd_Register("selector", WRAP_METHOD(Console, cmdSelector)); - DCmd_Register("selectors", WRAP_METHOD(Console, cmdSelectors)); - DCmd_Register("functions", WRAP_METHOD(Console, cmdKernelFunctions)); - DCmd_Register("class_table", WRAP_METHOD(Console, cmdClassTable)); +// registerCmd("classes", WRAP_METHOD(Console, cmdClasses)); // TODO + registerCmd("opcodes", WRAP_METHOD(Console, cmdOpcodes)); + registerCmd("selector", WRAP_METHOD(Console, cmdSelector)); + registerCmd("selectors", WRAP_METHOD(Console, cmdSelectors)); + registerCmd("functions", WRAP_METHOD(Console, cmdKernelFunctions)); + registerCmd("class_table", WRAP_METHOD(Console, cmdClassTable)); // Parser - DCmd_Register("suffixes", WRAP_METHOD(Console, cmdSuffixes)); - DCmd_Register("parse_grammar", WRAP_METHOD(Console, cmdParseGrammar)); - DCmd_Register("parser_nodes", WRAP_METHOD(Console, cmdParserNodes)); - DCmd_Register("parser_words", WRAP_METHOD(Console, cmdParserWords)); - DCmd_Register("sentence_fragments", WRAP_METHOD(Console, cmdSentenceFragments)); - DCmd_Register("parse", WRAP_METHOD(Console, cmdParse)); - DCmd_Register("set_parse_nodes", WRAP_METHOD(Console, cmdSetParseNodes)); - DCmd_Register("said", WRAP_METHOD(Console, cmdSaid)); + registerCmd("suffixes", WRAP_METHOD(Console, cmdSuffixes)); + registerCmd("parse_grammar", WRAP_METHOD(Console, cmdParseGrammar)); + registerCmd("parser_nodes", WRAP_METHOD(Console, cmdParserNodes)); + registerCmd("parser_words", WRAP_METHOD(Console, cmdParserWords)); + registerCmd("sentence_fragments", WRAP_METHOD(Console, cmdSentenceFragments)); + registerCmd("parse", WRAP_METHOD(Console, cmdParse)); + registerCmd("set_parse_nodes", WRAP_METHOD(Console, cmdSetParseNodes)); + registerCmd("said", WRAP_METHOD(Console, cmdSaid)); // Resources - DCmd_Register("diskdump", WRAP_METHOD(Console, cmdDiskDump)); - DCmd_Register("hexdump", WRAP_METHOD(Console, cmdHexDump)); - DCmd_Register("resource_id", WRAP_METHOD(Console, cmdResourceId)); - DCmd_Register("resource_info", WRAP_METHOD(Console, cmdResourceInfo)); - DCmd_Register("resource_types", WRAP_METHOD(Console, cmdResourceTypes)); - DCmd_Register("list", WRAP_METHOD(Console, cmdList)); - DCmd_Register("hexgrep", WRAP_METHOD(Console, cmdHexgrep)); - DCmd_Register("verify_scripts", WRAP_METHOD(Console, cmdVerifyScripts)); + registerCmd("diskdump", WRAP_METHOD(Console, cmdDiskDump)); + registerCmd("hexdump", WRAP_METHOD(Console, cmdHexDump)); + registerCmd("resource_id", WRAP_METHOD(Console, cmdResourceId)); + registerCmd("resource_info", WRAP_METHOD(Console, cmdResourceInfo)); + registerCmd("resource_types", WRAP_METHOD(Console, cmdResourceTypes)); + registerCmd("list", WRAP_METHOD(Console, cmdList)); + registerCmd("hexgrep", WRAP_METHOD(Console, cmdHexgrep)); + registerCmd("verify_scripts", WRAP_METHOD(Console, cmdVerifyScripts)); // Game - DCmd_Register("save_game", WRAP_METHOD(Console, cmdSaveGame)); - DCmd_Register("restore_game", WRAP_METHOD(Console, cmdRestoreGame)); - DCmd_Register("restart_game", WRAP_METHOD(Console, cmdRestartGame)); - DCmd_Register("version", WRAP_METHOD(Console, cmdGetVersion)); - DCmd_Register("room", WRAP_METHOD(Console, cmdRoomNumber)); - DCmd_Register("quit", WRAP_METHOD(Console, cmdQuit)); - DCmd_Register("list_saves", WRAP_METHOD(Console, cmdListSaves)); + registerCmd("save_game", WRAP_METHOD(Console, cmdSaveGame)); + registerCmd("restore_game", WRAP_METHOD(Console, cmdRestoreGame)); + registerCmd("restart_game", WRAP_METHOD(Console, cmdRestartGame)); + registerCmd("version", WRAP_METHOD(Console, cmdGetVersion)); + registerCmd("room", WRAP_METHOD(Console, cmdRoomNumber)); + registerCmd("quit", WRAP_METHOD(Console, cmdQuit)); + registerCmd("list_saves", WRAP_METHOD(Console, cmdListSaves)); // Graphics - DCmd_Register("show_map", WRAP_METHOD(Console, cmdShowMap)); - DCmd_Register("set_palette", WRAP_METHOD(Console, cmdSetPalette)); - DCmd_Register("draw_pic", WRAP_METHOD(Console, cmdDrawPic)); - DCmd_Register("draw_cel", WRAP_METHOD(Console, cmdDrawCel)); - DCmd_Register("undither", WRAP_METHOD(Console, cmdUndither)); - DCmd_Register("pic_visualize", WRAP_METHOD(Console, cmdPicVisualize)); - DCmd_Register("play_video", WRAP_METHOD(Console, cmdPlayVideo)); - DCmd_Register("animate_list", WRAP_METHOD(Console, cmdAnimateList)); - 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)); + registerCmd("show_map", WRAP_METHOD(Console, cmdShowMap)); + registerCmd("set_palette", WRAP_METHOD(Console, cmdSetPalette)); + registerCmd("draw_pic", WRAP_METHOD(Console, cmdDrawPic)); + registerCmd("draw_cel", WRAP_METHOD(Console, cmdDrawCel)); + registerCmd("undither", WRAP_METHOD(Console, cmdUndither)); + registerCmd("pic_visualize", WRAP_METHOD(Console, cmdPicVisualize)); + registerCmd("play_video", WRAP_METHOD(Console, cmdPlayVideo)); + registerCmd("animate_list", WRAP_METHOD(Console, cmdAnimateList)); + registerCmd("al", WRAP_METHOD(Console, cmdAnimateList)); // alias + registerCmd("window_list", WRAP_METHOD(Console, cmdWindowList)); + registerCmd("wl", WRAP_METHOD(Console, cmdWindowList)); // alias + registerCmd("plane_list", WRAP_METHOD(Console, cmdPlaneList)); + registerCmd("pl", WRAP_METHOD(Console, cmdPlaneList)); // alias + registerCmd("plane_items", WRAP_METHOD(Console, cmdPlaneItemList)); + registerCmd("pi", WRAP_METHOD(Console, cmdPlaneItemList)); // alias + registerCmd("saved_bits", WRAP_METHOD(Console, cmdSavedBits)); + registerCmd("show_saved_bits", WRAP_METHOD(Console, cmdShowSavedBits)); // Segments - DCmd_Register("segment_table", WRAP_METHOD(Console, cmdPrintSegmentTable)); - DCmd_Register("segtable", WRAP_METHOD(Console, cmdPrintSegmentTable)); // alias - DCmd_Register("segment_info", WRAP_METHOD(Console, cmdSegmentInfo)); - DCmd_Register("seginfo", WRAP_METHOD(Console, cmdSegmentInfo)); // alias - DCmd_Register("segment_kill", WRAP_METHOD(Console, cmdKillSegment)); - DCmd_Register("segkill", WRAP_METHOD(Console, cmdKillSegment)); // alias + registerCmd("segment_table", WRAP_METHOD(Console, cmdPrintSegmentTable)); + registerCmd("segtable", WRAP_METHOD(Console, cmdPrintSegmentTable)); // alias + registerCmd("segment_info", WRAP_METHOD(Console, cmdSegmentInfo)); + registerCmd("seginfo", WRAP_METHOD(Console, cmdSegmentInfo)); // alias + registerCmd("segment_kill", WRAP_METHOD(Console, cmdKillSegment)); + registerCmd("segkill", WRAP_METHOD(Console, cmdKillSegment)); // alias // Garbage collection - DCmd_Register("gc", WRAP_METHOD(Console, cmdGCInvoke)); - DCmd_Register("gc_objects", WRAP_METHOD(Console, cmdGCObjects)); - DCmd_Register("gc_reachable", WRAP_METHOD(Console, cmdGCShowReachable)); - DCmd_Register("gc_freeable", WRAP_METHOD(Console, cmdGCShowFreeable)); - DCmd_Register("gc_normalize", WRAP_METHOD(Console, cmdGCNormalize)); + registerCmd("gc", WRAP_METHOD(Console, cmdGCInvoke)); + registerCmd("gc_objects", WRAP_METHOD(Console, cmdGCObjects)); + registerCmd("gc_reachable", WRAP_METHOD(Console, cmdGCShowReachable)); + registerCmd("gc_freeable", WRAP_METHOD(Console, cmdGCShowFreeable)); + registerCmd("gc_normalize", WRAP_METHOD(Console, cmdGCNormalize)); // Music/SFX - DCmd_Register("songlib", WRAP_METHOD(Console, cmdSongLib)); - DCmd_Register("songinfo", WRAP_METHOD(Console, cmdSongInfo)); - DCmd_Register("is_sample", WRAP_METHOD(Console, cmdIsSample)); - DCmd_Register("startsound", WRAP_METHOD(Console, cmdStartSound)); - DCmd_Register("togglesound", WRAP_METHOD(Console, cmdToggleSound)); - DCmd_Register("stopallsounds", WRAP_METHOD(Console, cmdStopAllSounds)); - DCmd_Register("sfx01_header", WRAP_METHOD(Console, cmdSfx01Header)); - DCmd_Register("sfx01_track", WRAP_METHOD(Console, cmdSfx01Track)); - DCmd_Register("show_instruments", WRAP_METHOD(Console, cmdShowInstruments)); - DCmd_Register("map_instrument", WRAP_METHOD(Console, cmdMapInstrument)); + registerCmd("songlib", WRAP_METHOD(Console, cmdSongLib)); + registerCmd("songinfo", WRAP_METHOD(Console, cmdSongInfo)); + registerCmd("is_sample", WRAP_METHOD(Console, cmdIsSample)); + registerCmd("startsound", WRAP_METHOD(Console, cmdStartSound)); + registerCmd("togglesound", WRAP_METHOD(Console, cmdToggleSound)); + registerCmd("stopallsounds", WRAP_METHOD(Console, cmdStopAllSounds)); + registerCmd("sfx01_header", WRAP_METHOD(Console, cmdSfx01Header)); + registerCmd("sfx01_track", WRAP_METHOD(Console, cmdSfx01Track)); + registerCmd("show_instruments", WRAP_METHOD(Console, cmdShowInstruments)); + registerCmd("map_instrument", WRAP_METHOD(Console, cmdMapInstrument)); // Script - DCmd_Register("addresses", WRAP_METHOD(Console, cmdAddresses)); - DCmd_Register("registers", WRAP_METHOD(Console, cmdRegisters)); - DCmd_Register("dissect_script", WRAP_METHOD(Console, cmdDissectScript)); - DCmd_Register("backtrace", WRAP_METHOD(Console, cmdBacktrace)); - DCmd_Register("bt", WRAP_METHOD(Console, cmdBacktrace)); // alias - DCmd_Register("trace", WRAP_METHOD(Console, cmdTrace)); - DCmd_Register("t", WRAP_METHOD(Console, cmdTrace)); // alias - DCmd_Register("s", WRAP_METHOD(Console, cmdTrace)); // alias - DCmd_Register("stepover", WRAP_METHOD(Console, cmdStepOver)); - DCmd_Register("p", WRAP_METHOD(Console, cmdStepOver)); // alias - DCmd_Register("step_ret", WRAP_METHOD(Console, cmdStepRet)); - DCmd_Register("pret", WRAP_METHOD(Console, cmdStepRet)); // alias - DCmd_Register("step_event", WRAP_METHOD(Console, cmdStepEvent)); - DCmd_Register("se", WRAP_METHOD(Console, cmdStepEvent)); // alias - DCmd_Register("step_global", WRAP_METHOD(Console, cmdStepGlobal)); - DCmd_Register("sg", WRAP_METHOD(Console, cmdStepGlobal)); // alias - DCmd_Register("step_callk", WRAP_METHOD(Console, cmdStepCallk)); - DCmd_Register("snk", WRAP_METHOD(Console, cmdStepCallk)); // alias - DCmd_Register("disasm", WRAP_METHOD(Console, cmdDisassemble)); - DCmd_Register("disasm_addr", WRAP_METHOD(Console, cmdDisassembleAddress)); - DCmd_Register("find_callk", WRAP_METHOD(Console, cmdFindKernelFunctionCall)); - DCmd_Register("send", WRAP_METHOD(Console, cmdSend)); - DCmd_Register("go", WRAP_METHOD(Console, cmdGo)); - DCmd_Register("logkernel", WRAP_METHOD(Console, cmdLogKernel)); + registerCmd("addresses", WRAP_METHOD(Console, cmdAddresses)); + registerCmd("registers", WRAP_METHOD(Console, cmdRegisters)); + registerCmd("dissect_script", WRAP_METHOD(Console, cmdDissectScript)); + registerCmd("backtrace", WRAP_METHOD(Console, cmdBacktrace)); + registerCmd("bt", WRAP_METHOD(Console, cmdBacktrace)); // alias + registerCmd("trace", WRAP_METHOD(Console, cmdTrace)); + registerCmd("t", WRAP_METHOD(Console, cmdTrace)); // alias + registerCmd("s", WRAP_METHOD(Console, cmdTrace)); // alias + registerCmd("stepover", WRAP_METHOD(Console, cmdStepOver)); + registerCmd("p", WRAP_METHOD(Console, cmdStepOver)); // alias + registerCmd("step_ret", WRAP_METHOD(Console, cmdStepRet)); + registerCmd("pret", WRAP_METHOD(Console, cmdStepRet)); // alias + registerCmd("step_event", WRAP_METHOD(Console, cmdStepEvent)); + registerCmd("se", WRAP_METHOD(Console, cmdStepEvent)); // alias + registerCmd("step_global", WRAP_METHOD(Console, cmdStepGlobal)); + registerCmd("sg", WRAP_METHOD(Console, cmdStepGlobal)); // alias + registerCmd("step_callk", WRAP_METHOD(Console, cmdStepCallk)); + registerCmd("snk", WRAP_METHOD(Console, cmdStepCallk)); // alias + registerCmd("disasm", WRAP_METHOD(Console, cmdDisassemble)); + registerCmd("disasm_addr", WRAP_METHOD(Console, cmdDisassembleAddress)); + registerCmd("find_callk", WRAP_METHOD(Console, cmdFindKernelFunctionCall)); + registerCmd("send", WRAP_METHOD(Console, cmdSend)); + registerCmd("go", WRAP_METHOD(Console, cmdGo)); + registerCmd("logkernel", WRAP_METHOD(Console, cmdLogKernel)); // Breakpoints - DCmd_Register("bp_list", WRAP_METHOD(Console, cmdBreakpointList)); - DCmd_Register("bplist", WRAP_METHOD(Console, cmdBreakpointList)); // alias - DCmd_Register("bl", WRAP_METHOD(Console, cmdBreakpointList)); // alias - DCmd_Register("bp_del", WRAP_METHOD(Console, cmdBreakpointDelete)); - DCmd_Register("bpdel", WRAP_METHOD(Console, cmdBreakpointDelete)); // alias - DCmd_Register("bc", WRAP_METHOD(Console, cmdBreakpointDelete)); // alias - DCmd_Register("bp_method", WRAP_METHOD(Console, cmdBreakpointMethod)); - DCmd_Register("bpx", WRAP_METHOD(Console, cmdBreakpointMethod)); // alias - DCmd_Register("bp_read", WRAP_METHOD(Console, cmdBreakpointRead)); - DCmd_Register("bpr", WRAP_METHOD(Console, cmdBreakpointRead)); // alias - DCmd_Register("bp_write", WRAP_METHOD(Console, cmdBreakpointWrite)); - DCmd_Register("bpw", WRAP_METHOD(Console, cmdBreakpointWrite)); // alias - DCmd_Register("bp_kernel", WRAP_METHOD(Console, cmdBreakpointKernel)); - DCmd_Register("bpk", WRAP_METHOD(Console, cmdBreakpointKernel)); // alias - DCmd_Register("bp_function", WRAP_METHOD(Console, cmdBreakpointFunction)); - DCmd_Register("bpe", WRAP_METHOD(Console, cmdBreakpointFunction)); // alias + registerCmd("bp_list", WRAP_METHOD(Console, cmdBreakpointList)); + registerCmd("bplist", WRAP_METHOD(Console, cmdBreakpointList)); // alias + registerCmd("bl", WRAP_METHOD(Console, cmdBreakpointList)); // alias + registerCmd("bp_del", WRAP_METHOD(Console, cmdBreakpointDelete)); + registerCmd("bpdel", WRAP_METHOD(Console, cmdBreakpointDelete)); // alias + registerCmd("bc", WRAP_METHOD(Console, cmdBreakpointDelete)); // alias + registerCmd("bp_method", WRAP_METHOD(Console, cmdBreakpointMethod)); + registerCmd("bpx", WRAP_METHOD(Console, cmdBreakpointMethod)); // alias + registerCmd("bp_read", WRAP_METHOD(Console, cmdBreakpointRead)); + registerCmd("bpr", WRAP_METHOD(Console, cmdBreakpointRead)); // alias + registerCmd("bp_write", WRAP_METHOD(Console, cmdBreakpointWrite)); + registerCmd("bpw", WRAP_METHOD(Console, cmdBreakpointWrite)); // alias + registerCmd("bp_kernel", WRAP_METHOD(Console, cmdBreakpointKernel)); + registerCmd("bpk", WRAP_METHOD(Console, cmdBreakpointKernel)); // alias + registerCmd("bp_function", WRAP_METHOD(Console, cmdBreakpointFunction)); + registerCmd("bpe", WRAP_METHOD(Console, cmdBreakpointFunction)); // alias // VM - DCmd_Register("script_steps", WRAP_METHOD(Console, cmdScriptSteps)); - DCmd_Register("vm_varlist", WRAP_METHOD(Console, cmdVMVarlist)); - DCmd_Register("vmvarlist", WRAP_METHOD(Console, cmdVMVarlist)); // alias - DCmd_Register("vl", WRAP_METHOD(Console, cmdVMVarlist)); // alias - DCmd_Register("vm_vars", WRAP_METHOD(Console, cmdVMVars)); - DCmd_Register("vmvars", WRAP_METHOD(Console, cmdVMVars)); // alias - DCmd_Register("vv", WRAP_METHOD(Console, cmdVMVars)); // alias - DCmd_Register("stack", WRAP_METHOD(Console, cmdStack)); - DCmd_Register("value_type", WRAP_METHOD(Console, cmdValueType)); - DCmd_Register("view_listnode", WRAP_METHOD(Console, cmdViewListNode)); - DCmd_Register("view_reference", WRAP_METHOD(Console, cmdViewReference)); - DCmd_Register("vr", WRAP_METHOD(Console, cmdViewReference)); // alias - DCmd_Register("view_object", WRAP_METHOD(Console, cmdViewObject)); - DCmd_Register("vo", WRAP_METHOD(Console, cmdViewObject)); // alias - DCmd_Register("active_object", WRAP_METHOD(Console, cmdViewActiveObject)); - DCmd_Register("acc_object", WRAP_METHOD(Console, cmdViewAccumulatorObject)); + registerCmd("script_steps", WRAP_METHOD(Console, cmdScriptSteps)); + registerCmd("vm_varlist", WRAP_METHOD(Console, cmdVMVarlist)); + registerCmd("vmvarlist", WRAP_METHOD(Console, cmdVMVarlist)); // alias + registerCmd("vl", WRAP_METHOD(Console, cmdVMVarlist)); // alias + registerCmd("vm_vars", WRAP_METHOD(Console, cmdVMVars)); + registerCmd("vmvars", WRAP_METHOD(Console, cmdVMVars)); // alias + registerCmd("vv", WRAP_METHOD(Console, cmdVMVars)); // alias + registerCmd("stack", WRAP_METHOD(Console, cmdStack)); + registerCmd("value_type", WRAP_METHOD(Console, cmdValueType)); + registerCmd("view_listnode", WRAP_METHOD(Console, cmdViewListNode)); + registerCmd("view_reference", WRAP_METHOD(Console, cmdViewReference)); + registerCmd("vr", WRAP_METHOD(Console, cmdViewReference)); // alias + registerCmd("view_object", WRAP_METHOD(Console, cmdViewObject)); + registerCmd("vo", WRAP_METHOD(Console, cmdViewObject)); // alias + registerCmd("active_object", WRAP_METHOD(Console, cmdViewActiveObject)); + registerCmd("acc_object", WRAP_METHOD(Console, cmdViewAccumulatorObject)); _debugState.seeking = kDebugSeekNothing; _debugState.seekLevel = 0; @@ -307,137 +310,137 @@ void Console::postEnter() { } bool Console::cmdHelp(int argc, const char **argv) { - DebugPrintf("\n"); - DebugPrintf("Variables\n"); - DebugPrintf("---------\n"); - DebugPrintf("sleeptime_factor: Factor to multiply with wait times in kWait()\n"); - DebugPrintf("gc_interval: Number of kernel calls in between garbage collections\n"); - DebugPrintf("simulated_key: Add a key with the specified scan code to the event list\n"); - DebugPrintf("track_mouse_clicks: Toggles mouse click tracking to the console\n"); - DebugPrintf("weak_validations: Turns some validation errors into warnings\n"); - DebugPrintf("script_abort_flag: Set to 1 to abort script execution. Set to 2 to force a replay afterwards\n"); - DebugPrintf("\n"); - DebugPrintf("Debug flags\n"); - DebugPrintf("-----------\n"); - DebugPrintf("debugflag_list - Lists the available debug flags and their status\n"); - DebugPrintf("debugflag_enable - Enables a debug flag\n"); - DebugPrintf("debugflag_disable - Disables a debug flag\n"); - DebugPrintf("\n"); - DebugPrintf("Commands\n"); - DebugPrintf("--------\n"); - DebugPrintf("Kernel:\n"); - DebugPrintf(" opcodes - Lists the opcode names\n"); - DebugPrintf(" selectors - Lists the selector names\n"); - DebugPrintf(" selector - Attempts to find the requested selector by name\n"); - DebugPrintf(" functions - Lists the kernel functions\n"); - DebugPrintf(" class_table - Shows the available classes\n"); - DebugPrintf("\n"); - DebugPrintf("Parser:\n"); - DebugPrintf(" suffixes - Lists the vocabulary suffixes\n"); - DebugPrintf(" parse_grammar - Shows the parse grammar, in strict GNF\n"); - DebugPrintf(" parser_nodes - Shows the specified number of nodes from the parse node tree\n"); - DebugPrintf(" parser_words - Shows the words from the parse node tree\n"); - DebugPrintf(" sentence_fragments - Shows the sentence fragments (used to build Parse trees)\n"); - DebugPrintf(" parse - Parses a sequence of words and prints the resulting parse tree\n"); - DebugPrintf(" set_parse_nodes - Sets the contents of all parse nodes\n"); - DebugPrintf(" said - Match a string against a said spec\n"); - DebugPrintf("\n"); - DebugPrintf("Resources:\n"); - DebugPrintf(" diskdump - Dumps the specified resource to disk as a patch file\n"); - DebugPrintf(" hexdump - Dumps the specified resource to standard output\n"); - DebugPrintf(" resource_id - Identifies a resource number by splitting it up in resource type and resource number\n"); - DebugPrintf(" resource_info - Shows info about a resource\n"); - DebugPrintf(" resource_types - Shows the valid resource types\n"); - DebugPrintf(" list - Lists all the resources of a given type\n"); - DebugPrintf(" hexgrep - Searches some resources for a particular sequence of bytes, represented as hexadecimal numbers\n"); - DebugPrintf(" verify_scripts - Performs sanity checks on SCI1.1-SCI2.1 game scripts (e.g. if they're up to 64KB in total)\n"); - DebugPrintf("\n"); - DebugPrintf("Game:\n"); - DebugPrintf(" save_game - Saves the current game state to the hard disk\n"); - DebugPrintf(" restore_game - Restores a saved game from the hard disk\n"); - DebugPrintf(" list_saves - List all saved games including filenames\n"); - DebugPrintf(" restart_game - Restarts the game\n"); - DebugPrintf(" version - Shows the resource and interpreter versions\n"); - DebugPrintf(" room - Gets or sets the current room number\n"); - DebugPrintf(" quit - Quits the game\n"); - DebugPrintf("\n"); - DebugPrintf("Graphics:\n"); - DebugPrintf(" show_map - Switches to visual, priority, control or display screen\n"); - DebugPrintf(" set_palette - Sets a palette resource\n"); - DebugPrintf(" draw_pic - Draws a pic resource\n"); - DebugPrintf(" draw_cel - Draws a cel from a view resource\n"); - 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_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"); - DebugPrintf("Segments:\n"); - DebugPrintf(" segment_table / segtable - Lists all segments\n"); - DebugPrintf(" segment_info / seginfo - Provides information on the specified segment\n"); - DebugPrintf(" segment_kill / segkill - Deletes the specified segment\n"); - DebugPrintf("\n"); - DebugPrintf("Garbage collection:\n"); - DebugPrintf(" gc - Invokes the garbage collector\n"); - DebugPrintf(" gc_objects - Lists all reachable objects, normalized\n"); - DebugPrintf(" gc_reachable - Lists all addresses directly reachable from a given memory object\n"); - DebugPrintf(" gc_freeable - Lists all addresses freeable in a given segment\n"); - DebugPrintf(" gc_normalize - Prints the \"normal\" address of a given address\n"); - DebugPrintf("\n"); - DebugPrintf("Music/SFX:\n"); - DebugPrintf(" songlib - Shows the song library\n"); - DebugPrintf(" songinfo - Shows information about a specified song in the song library\n"); - DebugPrintf(" togglesound - Starts/stops a sound in the song library\n"); - DebugPrintf(" stopallsounds - Stops all sounds in the playlist\n"); - DebugPrintf(" startsound - Starts the specified sound resource, replacing the first song in the song library\n"); - DebugPrintf(" is_sample - Shows information on a given sound resource, if it's a PCM sample\n"); - DebugPrintf(" sfx01_header - Dumps the header of a SCI01 song\n"); - DebugPrintf(" sfx01_track - Dumps a track of a SCI01 song\n"); - DebugPrintf(" show_instruments - Shows the instruments of a specific song, or all songs\n"); - DebugPrintf(" map_instrument - Dynamically maps an MT-32 instrument to a GM instrument\n"); - DebugPrintf("\n"); - DebugPrintf("Script:\n"); - DebugPrintf(" addresses - Provides information on how to pass addresses\n"); - DebugPrintf(" registers - Shows the current register values\n"); - DebugPrintf(" dissect_script - Examines a script\n"); - DebugPrintf(" backtrace / bt - Dumps the send/self/super/call/calle/callb stack\n"); - DebugPrintf(" trace / t / s - Executes one operation (no parameters) or several operations (specified as a parameter) \n"); - DebugPrintf(" stepover / p - Executes one operation, skips over call/send\n"); - DebugPrintf(" step_ret / pret - Steps forward until ret is called on the current execution stack level.\n"); - DebugPrintf(" step_event / se - Steps forward until a SCI event is received.\n"); - DebugPrintf(" step_global / sg - Steps until the global variable with the specified index is modified.\n"); - DebugPrintf(" step_callk / snk - Steps forward until it hits the next callk operation, or a specific callk (specified as a parameter)\n"); - DebugPrintf(" disasm - Disassembles a method by name\n"); - DebugPrintf(" disasm_addr - Disassembles one or more commands\n"); - DebugPrintf(" send - Sends a message to an object\n"); - DebugPrintf(" go - Executes the script\n"); - DebugPrintf(" logkernel - Logs kernel calls\n"); - DebugPrintf("\n"); - DebugPrintf("Breakpoints:\n"); - DebugPrintf(" bp_list / bplist / bl - Lists the current breakpoints\n"); - DebugPrintf(" bp_del / bpdel / bc - Deletes a breakpoint with the specified index\n"); - DebugPrintf(" bp_method / bpx - Sets a breakpoint on the execution of a specified method/selector\n"); - DebugPrintf(" bp_read / bpr - Sets a breakpoint on reading of a specified selector\n"); - DebugPrintf(" bp_write / bpw - Sets a breakpoint on writing to a specified selector\n"); - DebugPrintf(" bp_kernel / bpk - Sets a breakpoint on execution of a kernel function\n"); - DebugPrintf(" bp_function / bpe - Sets a breakpoint on the execution of the specified exported function\n"); - DebugPrintf("\n"); - DebugPrintf("VM:\n"); - DebugPrintf(" script_steps - Shows the number of executed SCI operations\n"); - DebugPrintf(" vm_varlist / vmvarlist / vl - Shows the addresses of variables in the VM\n"); - DebugPrintf(" vm_vars / vmvars / vv - Displays or changes variables in the VM\n"); - DebugPrintf(" stack - Lists the specified number of stack elements\n"); - DebugPrintf(" value_type - Determines the type of a value\n"); - DebugPrintf(" view_listnode - Examines the list node at the given address\n"); - DebugPrintf(" view_reference / vr - Examines an arbitrary reference\n"); - DebugPrintf(" view_object / vo - Examines the object at the given address\n"); - DebugPrintf(" active_object - Shows information on the currently active object or class\n"); - DebugPrintf(" acc_object - Shows information on the object or class at the address indexed by the accumulator\n"); - DebugPrintf("\n"); + debugPrintf("\n"); + debugPrintf("Variables\n"); + debugPrintf("---------\n"); + debugPrintf("sleeptime_factor: Factor to multiply with wait times in kWait()\n"); + debugPrintf("gc_interval: Number of kernel calls in between garbage collections\n"); + debugPrintf("simulated_key: Add a key with the specified scan code to the event list\n"); + debugPrintf("track_mouse_clicks: Toggles mouse click tracking to the console\n"); + debugPrintf("weak_validations: Turns some validation errors into warnings\n"); + debugPrintf("script_abort_flag: Set to 1 to abort script execution. Set to 2 to force a replay afterwards\n"); + debugPrintf("\n"); + debugPrintf("Debug flags\n"); + debugPrintf("-----------\n"); + debugPrintf("debugflag_list - Lists the available debug flags and their status\n"); + debugPrintf("debugflag_enable - Enables a debug flag\n"); + debugPrintf("debugflag_disable - Disables a debug flag\n"); + debugPrintf("\n"); + debugPrintf("Commands\n"); + debugPrintf("--------\n"); + debugPrintf("Kernel:\n"); + debugPrintf(" opcodes - Lists the opcode names\n"); + debugPrintf(" selectors - Lists the selector names\n"); + debugPrintf(" selector - Attempts to find the requested selector by name\n"); + debugPrintf(" functions - Lists the kernel functions\n"); + debugPrintf(" class_table - Shows the available classes\n"); + debugPrintf("\n"); + debugPrintf("Parser:\n"); + debugPrintf(" suffixes - Lists the vocabulary suffixes\n"); + debugPrintf(" parse_grammar - Shows the parse grammar, in strict GNF\n"); + debugPrintf(" parser_nodes - Shows the specified number of nodes from the parse node tree\n"); + debugPrintf(" parser_words - Shows the words from the parse node tree\n"); + debugPrintf(" sentence_fragments - Shows the sentence fragments (used to build Parse trees)\n"); + debugPrintf(" parse - Parses a sequence of words and prints the resulting parse tree\n"); + debugPrintf(" set_parse_nodes - Sets the contents of all parse nodes\n"); + debugPrintf(" said - Match a string against a said spec\n"); + debugPrintf("\n"); + debugPrintf("Resources:\n"); + debugPrintf(" diskdump - Dumps the specified resource to disk as a patch file\n"); + debugPrintf(" hexdump - Dumps the specified resource to standard output\n"); + debugPrintf(" resource_id - Identifies a resource number by splitting it up in resource type and resource number\n"); + debugPrintf(" resource_info - Shows info about a resource\n"); + debugPrintf(" resource_types - Shows the valid resource types\n"); + debugPrintf(" list - Lists all the resources of a given type\n"); + debugPrintf(" hexgrep - Searches some resources for a particular sequence of bytes, represented as hexadecimal numbers\n"); + debugPrintf(" verify_scripts - Performs sanity checks on SCI1.1-SCI2.1 game scripts (e.g. if they're up to 64KB in total)\n"); + debugPrintf("\n"); + debugPrintf("Game:\n"); + debugPrintf(" save_game - Saves the current game state to the hard disk\n"); + debugPrintf(" restore_game - Restores a saved game from the hard disk\n"); + debugPrintf(" list_saves - List all saved games including filenames\n"); + debugPrintf(" restart_game - Restarts the game\n"); + debugPrintf(" version - Shows the resource and interpreter versions\n"); + debugPrintf(" room - Gets or sets the current room number\n"); + debugPrintf(" quit - Quits the game\n"); + debugPrintf("\n"); + debugPrintf("Graphics:\n"); + debugPrintf(" show_map - Switches to visual, priority, control or display screen\n"); + debugPrintf(" set_palette - Sets a palette resource\n"); + debugPrintf(" draw_pic - Draws a pic resource\n"); + debugPrintf(" draw_cel - Draws a cel from a view resource\n"); + 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_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"); + debugPrintf("Segments:\n"); + debugPrintf(" segment_table / segtable - Lists all segments\n"); + debugPrintf(" segment_info / seginfo - Provides information on the specified segment\n"); + debugPrintf(" segment_kill / segkill - Deletes the specified segment\n"); + debugPrintf("\n"); + debugPrintf("Garbage collection:\n"); + debugPrintf(" gc - Invokes the garbage collector\n"); + debugPrintf(" gc_objects - Lists all reachable objects, normalized\n"); + debugPrintf(" gc_reachable - Lists all addresses directly reachable from a given memory object\n"); + debugPrintf(" gc_freeable - Lists all addresses freeable in a given segment\n"); + debugPrintf(" gc_normalize - Prints the \"normal\" address of a given address\n"); + debugPrintf("\n"); + debugPrintf("Music/SFX:\n"); + debugPrintf(" songlib - Shows the song library\n"); + debugPrintf(" songinfo - Shows information about a specified song in the song library\n"); + debugPrintf(" togglesound - Starts/stops a sound in the song library\n"); + debugPrintf(" stopallsounds - Stops all sounds in the playlist\n"); + debugPrintf(" startsound - Starts the specified sound resource, replacing the first song in the song library\n"); + debugPrintf(" is_sample - Shows information on a given sound resource, if it's a PCM sample\n"); + debugPrintf(" sfx01_header - Dumps the header of a SCI01 song\n"); + debugPrintf(" sfx01_track - Dumps a track of a SCI01 song\n"); + debugPrintf(" show_instruments - Shows the instruments of a specific song, or all songs\n"); + debugPrintf(" map_instrument - Dynamically maps an MT-32 instrument to a GM instrument\n"); + debugPrintf("\n"); + debugPrintf("Script:\n"); + debugPrintf(" addresses - Provides information on how to pass addresses\n"); + debugPrintf(" registers - Shows the current register values\n"); + debugPrintf(" dissect_script - Examines a script\n"); + debugPrintf(" backtrace / bt - Dumps the send/self/super/call/calle/callb stack\n"); + debugPrintf(" trace / t / s - Executes one operation (no parameters) or several operations (specified as a parameter) \n"); + debugPrintf(" stepover / p - Executes one operation, skips over call/send\n"); + debugPrintf(" step_ret / pret - Steps forward until ret is called on the current execution stack level.\n"); + debugPrintf(" step_event / se - Steps forward until a SCI event is received.\n"); + debugPrintf(" step_global / sg - Steps until the global variable with the specified index is modified.\n"); + debugPrintf(" step_callk / snk - Steps forward until it hits the next callk operation, or a specific callk (specified as a parameter)\n"); + debugPrintf(" disasm - Disassembles a method by name\n"); + debugPrintf(" disasm_addr - Disassembles one or more commands\n"); + debugPrintf(" send - Sends a message to an object\n"); + debugPrintf(" go - Executes the script\n"); + debugPrintf(" logkernel - Logs kernel calls\n"); + debugPrintf("\n"); + debugPrintf("Breakpoints:\n"); + debugPrintf(" bp_list / bplist / bl - Lists the current breakpoints\n"); + debugPrintf(" bp_del / bpdel / bc - Deletes a breakpoint with the specified index\n"); + debugPrintf(" bp_method / bpx - Sets a breakpoint on the execution of a specified method/selector\n"); + debugPrintf(" bp_read / bpr - Sets a breakpoint on reading of a specified selector\n"); + debugPrintf(" bp_write / bpw - Sets a breakpoint on writing to a specified selector\n"); + debugPrintf(" bp_kernel / bpk - Sets a breakpoint on execution of a kernel function\n"); + debugPrintf(" bp_function / bpe - Sets a breakpoint on the execution of the specified exported function\n"); + debugPrintf("\n"); + debugPrintf("VM:\n"); + debugPrintf(" script_steps - Shows the number of executed SCI operations\n"); + debugPrintf(" vm_varlist / vmvarlist / vl - Shows the addresses of variables in the VM\n"); + debugPrintf(" vm_vars / vmvars / vv - Displays or changes variables in the VM\n"); + debugPrintf(" stack - Lists the specified number of stack elements\n"); + debugPrintf(" value_type - Determines the type of a value\n"); + debugPrintf(" view_listnode - Examines the list node at the given address\n"); + debugPrintf(" view_reference / vr - Examines an arbitrary reference\n"); + debugPrintf(" view_object / vo - Examines the object at the given address\n"); + debugPrintf(" active_object - Shows information on the currently active object or class\n"); + debugPrintf(" acc_object - Shows information on the object or class at the address indexed by the accumulator\n"); + debugPrintf("\n"); return true; } @@ -464,30 +467,30 @@ bool Console::cmdGetVersion(int argc, const char **argv) { versionFile.close(); } - DebugPrintf("Game ID: %s\n", _engine->getGameIdStr()); - DebugPrintf("Emulated interpreter version: %s\n", getSciVersionDesc(getSciVersion())); - DebugPrintf("\n"); - DebugPrintf("Detected features:\n"); - DebugPrintf("------------------\n"); - DebugPrintf("Sound type: %s\n", getSciVersionDesc(_engine->_features->detectDoSoundType())); - DebugPrintf("Graphics functions type: %s\n", getSciVersionDesc(_engine->_features->detectGfxFunctionsType())); - DebugPrintf("Lofs type: %s\n", getSciVersionDesc(_engine->_features->detectLofsType())); - DebugPrintf("Move count type: %s\n", (_engine->_features->handleMoveCount()) ? "increment" : "ignore"); - DebugPrintf("SetCursor type: %s\n", getSciVersionDesc(_engine->_features->detectSetCursorType())); + debugPrintf("Game ID: %s\n", _engine->getGameIdStr()); + debugPrintf("Emulated interpreter version: %s\n", getSciVersionDesc(getSciVersion())); + debugPrintf("\n"); + debugPrintf("Detected features:\n"); + debugPrintf("------------------\n"); + debugPrintf("Sound type: %s\n", getSciVersionDesc(_engine->_features->detectDoSoundType())); + debugPrintf("Graphics functions type: %s\n", getSciVersionDesc(_engine->_features->detectGfxFunctionsType())); + debugPrintf("Lofs type: %s\n", getSciVersionDesc(_engine->_features->detectLofsType())); + debugPrintf("Move count type: %s\n", (_engine->_features->handleMoveCount()) ? "increment" : "ignore"); + debugPrintf("SetCursor type: %s\n", getSciVersionDesc(_engine->_features->detectSetCursorType())); #ifdef ENABLE_SCI32 if (getSciVersion() >= SCI_VERSION_2) - DebugPrintf("kString type: %s\n", (_engine->_features->detectSci2StringFunctionType() == kSci2StringFunctionOld) ? "SCI2 (old)" : "SCI2.1 (new)"); + debugPrintf("kString type: %s\n", (_engine->_features->detectSci2StringFunctionType() == kSci2StringFunctionOld) ? "SCI2 (old)" : "SCI2.1 (new)"); if (getSciVersion() == SCI_VERSION_2_1) - DebugPrintf("SCI2.1 kernel table: %s\n", (_engine->_features->detectSci21KernelType() == SCI_VERSION_2) ? "modified SCI2 (old)" : "SCI2.1 (new)"); + debugPrintf("SCI2.1 kernel table: %s\n", (_engine->_features->detectSci21KernelType() == SCI_VERSION_2) ? "modified SCI2 (old)" : "SCI2.1 (new)"); #endif - DebugPrintf("View type: %s\n", viewTypeDesc[g_sci->getResMan()->getViewType()]); - DebugPrintf("Uses palette merging: %s\n", g_sci->_gfxPalette->isMerging() ? "yes" : "no"); - DebugPrintf("Resource volume version: %s\n", g_sci->getResMan()->getVolVersionDesc()); - DebugPrintf("Resource map version: %s\n", g_sci->getResMan()->getMapVersionDesc()); - DebugPrintf("Contains selector vocabulary (vocab.997): %s\n", hasVocab997 ? "yes" : "no"); - DebugPrintf("Has CantBeHere selector: %s\n", g_sci->getKernel()->_selectorCache.cantBeHere != -1 ? "yes" : "no"); - DebugPrintf("Game version (VERSION file): %s\n", gameVersion.c_str()); - DebugPrintf("\n"); + debugPrintf("View type: %s\n", viewTypeDesc[g_sci->getResMan()->getViewType()]); + debugPrintf("Uses palette merging: %s\n", g_sci->_gfxPalette->isMerging() ? "yes" : "no"); + debugPrintf("Resource volume version: %s\n", g_sci->getResMan()->getVolVersionDesc()); + debugPrintf("Resource map version: %s\n", g_sci->getResMan()->getMapVersionDesc()); + debugPrintf("Contains selector vocabulary (vocab.997): %s\n", hasVocab997 ? "yes" : "no"); + debugPrintf("Has CantBeHere selector: %s\n", g_sci->getKernel()->_selectorCache.cantBeHere != -1 ? "yes" : "no"); + debugPrintf("Game version (VERSION file): %s\n", gameVersion.c_str()); + debugPrintf("\n"); return true; } @@ -498,13 +501,13 @@ bool Console::cmdOpcodes(int argc, const char **argv) { // If the resource couldn't be loaded, leave if (!r) { - DebugPrintf("unable to load vocab.998"); + debugPrintf("unable to load vocab.998"); return true; } int count = READ_LE_UINT16(r->data); - DebugPrintf("Opcode names in numeric order [index: type name]:\n"); + debugPrintf("Opcode names in numeric order [index: type name]:\n"); for (int i = 0; i < count; i++) { int offset = READ_LE_UINT16(r->data + 2 + i * 2); @@ -512,49 +515,49 @@ bool Console::cmdOpcodes(int argc, const char **argv) { int type = READ_LE_UINT16(r->data + offset + 2); // QFG3 has empty opcodes Common::String name = len > 0 ? Common::String((const char *)r->data + offset + 4, len) : "Dummy"; - DebugPrintf("%03x: %03x %20s | ", i, type, name.c_str()); + debugPrintf("%03x: %03x %20s | ", i, type, name.c_str()); if ((i % 3) == 2) - DebugPrintf("\n"); + debugPrintf("\n"); } - DebugPrintf("\n"); + debugPrintf("\n"); return true; } bool Console::cmdSelector(int argc, const char **argv) { if (argc < 2) { - DebugPrintf("Attempts to find the requested selector by name.\n"); - DebugPrintf("Usage: %s <selector name>\n", argv[0]); + debugPrintf("Attempts to find the requested selector by name.\n"); + debugPrintf("Usage: %s <selector name>\n", argv[0]); return true; } Common::String name = argv[1]; int seeker = _engine->getKernel()->findSelector(name.c_str()); if (seeker >= 0) { - DebugPrintf("Selector %s found at %03x (%d)\n", name.c_str(), seeker, seeker); + debugPrintf("Selector %s found at %03x (%d)\n", name.c_str(), seeker, seeker); return true; } - DebugPrintf("Selector %s wasn't found\n", name.c_str()); + debugPrintf("Selector %s wasn't found\n", name.c_str()); return true; } bool Console::cmdSelectors(int argc, const char **argv) { - DebugPrintf("Selector names in numeric order:\n"); + debugPrintf("Selector names in numeric order:\n"); Common::String selectorName; for (uint seeker = 0; seeker < _engine->getKernel()->getSelectorNamesSize(); seeker++) { selectorName = _engine->getKernel()->getSelectorName(seeker); if (selectorName != "BAD SELECTOR") - DebugPrintf("%03x: %20s | ", seeker, selectorName.c_str()); + debugPrintf("%03x: %20s | ", seeker, selectorName.c_str()); else continue; if ((seeker % 3) == 2) - DebugPrintf("\n"); + debugPrintf("\n"); } - DebugPrintf("\n"); + debugPrintf("\n"); #if 0 // For debug/development @@ -584,14 +587,14 @@ bool Console::cmdSelectors(int argc, const char **argv) { } bool Console::cmdKernelFunctions(int argc, const char **argv) { - DebugPrintf("Kernel function names in numeric order:\n"); + debugPrintf("Kernel function names in numeric order:\n"); for (uint seeker = 0; seeker < _engine->getKernel()->getKernelNamesSize(); seeker++) { - DebugPrintf("%03x: %20s | ", seeker, _engine->getKernel()->getKernelName(seeker).c_str()); + debugPrintf("%03x: %20s | ", seeker, _engine->getKernel()->getKernelName(seeker).c_str()); if ((seeker % 3) == 2) - DebugPrintf("\n"); + debugPrintf("\n"); } - DebugPrintf("\n"); + debugPrintf("\n"); return true; } @@ -610,9 +613,9 @@ bool Console::cmdParserWords(int argc, const char **argv) { bool Console::cmdSetParseNodes(int argc, const char **argv) { if (argc < 2) { - DebugPrintf("Sets the contents of all parse nodes.\n"); - DebugPrintf("Usage: %s <parse node1> <parse node2> ... <parse noden>\n", argv[0]); - DebugPrintf("Tokens should be separated by blanks and enclosed in parentheses\n"); + debugPrintf("Sets the contents of all parse nodes.\n"); + debugPrintf("Usage: %s <parse node1> <parse node2> ... <parse noden>\n", argv[0]); + debugPrintf("Tokens should be separated by blanks and enclosed in parentheses\n"); return true; } @@ -643,46 +646,62 @@ bool Console::cmdSetParseNodes(int argc, const char **argv) { bool Console::cmdRegisters(int argc, const char **argv) { EngineState *s = _engine->_gamestate; - DebugPrintf("Current register values:\n"); - DebugPrintf("acc=%04x:%04x prev=%04x:%04x &rest=%x\n", PRINT_REG(s->r_acc), PRINT_REG(s->r_prev), s->r_rest); + debugPrintf("Current register values:\n"); + debugPrintf("acc=%04x:%04x prev=%04x:%04x &rest=%x\n", PRINT_REG(s->r_acc), PRINT_REG(s->r_prev), s->r_rest); if (!s->_executionStack.empty()) { - DebugPrintf("pc=%04x:%04x obj=%04x:%04x fp=ST:%04x sp=ST:%04x\n", + debugPrintf("pc=%04x:%04x obj=%04x:%04x fp=ST:%04x sp=ST:%04x\n", PRINT_REG(s->xs->addr.pc), PRINT_REG(s->xs->objp), (unsigned)(s->xs->fp - s->stack_base), (unsigned)(s->xs->sp - s->stack_base)); } else - DebugPrintf("<no execution stack: pc,obj,fp omitted>\n"); + debugPrintf("<no execution stack: pc,obj,fp omitted>\n"); return true; } bool Console::cmdDiskDump(int argc, const char **argv) { + int resNumFrom = 0; + int resNumTo = 0; + int resNumCur = 0; + if (argc != 3) { - DebugPrintf("Dumps the specified resource to disk as a patch file\n"); - DebugPrintf("Usage: %s <resource type> <resource number>\n", argv[0]); + debugPrintf("Dumps the specified resource to disk as a patch file\n"); + debugPrintf("Usage: %s <resource type> <resource number>\n", argv[0]); + debugPrintf(" <resource number> may be '*' to dump all resources of given type\n"); cmdResourceTypes(argc, argv); return true; } + + if (strcmp(argv[2], "*") == 0) { + resNumFrom = 0; + resNumTo = 65535; + } else { + resNumFrom = atoi(argv[2]); + resNumTo = resNumFrom; + } - int resNum = atoi(argv[2]); ResourceType res = parseResourceType(argv[1]); if (res == kResourceTypeInvalid) - DebugPrintf("Resource type '%s' is not valid\n", argv[1]); + debugPrintf("Resource type '%s' is not valid\n", argv[1]); else { - Resource *resource = _engine->getResMan()->findResource(ResourceId(res, resNum), 0); - if (resource) { - char outFileName[50]; - sprintf(outFileName, "%s.%03d", getResourceTypeName(res), resNum); - Common::DumpFile *outFile = new Common::DumpFile(); - outFile->open(outFileName); - resource->writeToStream(outFile); - outFile->finalize(); - outFile->close(); - delete outFile; - DebugPrintf("Resource %s.%03d (located in %s) has been dumped to disk\n", argv[1], resNum, resource->getResourceLocation().c_str()); - } else { - DebugPrintf("Resource %s.%03d not found\n", argv[1], resNum); + for (resNumCur = resNumFrom; resNumCur <= resNumTo; resNumCur++) { + Resource *resource = _engine->getResMan()->findResource(ResourceId(res, resNumCur), 0); + if (resource) { + char outFileName[50]; + sprintf(outFileName, "%s.%03d", getResourceTypeName(res), resNumCur); + Common::DumpFile *outFile = new Common::DumpFile(); + outFile->open(outFileName); + resource->writeToStream(outFile); + outFile->finalize(); + outFile->close(); + delete outFile; + debugPrintf("Resource %s.%03d (located in %s) has been dumped to disk\n", argv[1], resNumCur, resource->getResourceLocation().c_str()); + } else { + if (resNumFrom == resNumTo) { + debugPrintf("Resource %s.%03d not found\n", argv[1], resNumCur); + } + } } } @@ -691,8 +710,8 @@ bool Console::cmdDiskDump(int argc, const char **argv) { bool Console::cmdHexDump(int argc, const char **argv) { if (argc != 3) { - DebugPrintf("Dumps the specified resource to standard output\n"); - DebugPrintf("Usage: %s <resource type> <resource number>\n", argv[0]); + debugPrintf("Dumps the specified resource to standard output\n"); + debugPrintf("Usage: %s <resource type> <resource number>\n", argv[0]); cmdResourceTypes(argc, argv); return true; } @@ -701,14 +720,14 @@ bool Console::cmdHexDump(int argc, const char **argv) { ResourceType res = parseResourceType(argv[1]); if (res == kResourceTypeInvalid) - DebugPrintf("Resource type '%s' is not valid\n", argv[1]); + debugPrintf("Resource type '%s' is not valid\n", argv[1]); else { Resource *resource = _engine->getResMan()->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); + debugPrintf("Resource %s.%03d has been dumped to standard output\n", argv[1], resNum); } else { - DebugPrintf("Resource %s.%03d not found\n", argv[1], resNum); + debugPrintf("Resource %s.%03d not found\n", argv[1], resNum); } } @@ -717,21 +736,21 @@ bool Console::cmdHexDump(int argc, const char **argv) { bool Console::cmdResourceId(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Identifies a resource number by splitting it up in resource type and resource number\n"); - DebugPrintf("Usage: %s <resource number>\n", argv[0]); + debugPrintf("Identifies a resource number by splitting it up in resource type and resource number\n"); + debugPrintf("Usage: %s <resource number>\n", argv[0]); return true; } int id = atoi(argv[1]); - DebugPrintf("%s.%d (0x%x)\n", getResourceTypeName((ResourceType)(id >> 11)), id & 0x7ff, id & 0x7ff); + debugPrintf("%s.%d (0x%x)\n", getResourceTypeName((ResourceType)(id >> 11)), id & 0x7ff, id & 0x7ff); return true; } bool Console::cmdDissectScript(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Examines a script\n"); - DebugPrintf("Usage: %s <script number>\n", argv[0]); + debugPrintf("Examines a script\n"); + debugPrintf("Usage: %s <script number>\n", argv[0]); return true; } @@ -745,13 +764,13 @@ bool Console::cmdRoomNumber(int argc, const char **argv) { // The same functionality is provided by "vmvars g 13" (but this one is more straighforward) if (argc != 2) { - DebugPrintf("Current room number is %d\n", _engine->_gamestate->currentRoomNumber()); - DebugPrintf("Calling this command with the room number (in decimal or hexadecimal) changes the room\n"); + debugPrintf("Current room number is %d\n", _engine->_gamestate->currentRoomNumber()); + debugPrintf("Calling this command with the room number (in decimal or hexadecimal) changes the room\n"); } else { Common::String roomNumberStr = argv[1]; int roomNumber = strtol(roomNumberStr.c_str(), NULL, roomNumberStr.hasSuffix("h") ? 16 : 10); _engine->_gamestate->setRoomNumber(roomNumber); - DebugPrintf("Room number changed to %d (%x in hex)\n", roomNumber, roomNumber); + debugPrintf("Room number changed to %d (%x in hex)\n", roomNumber, roomNumber); } return true; @@ -759,8 +778,8 @@ bool Console::cmdRoomNumber(int argc, const char **argv) { bool Console::cmdResourceInfo(int argc, const char **argv) { if (argc != 3) { - DebugPrintf("Shows information about a resource\n"); - DebugPrintf("Usage: %s <resource type> <resource number>\n", argv[0]); + debugPrintf("Shows information about a resource\n"); + debugPrintf("Usage: %s <resource type> <resource number>\n", argv[0]); return true; } @@ -768,14 +787,14 @@ bool Console::cmdResourceInfo(int argc, const char **argv) { ResourceType res = parseResourceType(argv[1]); if (res == kResourceTypeInvalid) - DebugPrintf("Resource type '%s' is not valid\n", argv[1]); + debugPrintf("Resource type '%s' is not valid\n", argv[1]); else { Resource *resource = _engine->getResMan()->findResource(ResourceId(res, resNum), 0); if (resource) { - DebugPrintf("Resource size: %d\n", resource->size); - DebugPrintf("Resource location: %s\n", resource->getResourceLocation().c_str()); + debugPrintf("Resource size: %d\n", resource->size); + debugPrintf("Resource location: %s\n", resource->getResourceLocation().c_str()); } else { - DebugPrintf("Resource %s.%03d not found\n", argv[1], resNum); + debugPrintf("Resource %s.%03d not found\n", argv[1], resNum); } } @@ -783,10 +802,10 @@ bool Console::cmdResourceInfo(int argc, const char **argv) { } bool Console::cmdResourceTypes(int argc, const char **argv) { - DebugPrintf("The %d valid resource types are:\n", kResourceTypeInvalid); + debugPrintf("The %d valid resource types are:\n", kResourceTypeInvalid); for (int i = 0; i < kResourceTypeInvalid; i++) { - DebugPrintf("%s", getResourceTypeName((ResourceType) i)); - DebugPrintf((i < kResourceTypeInvalid - 1) ? ", " : "\n"); + debugPrintf("%s", getResourceTypeName((ResourceType) i)); + debugPrintf((i < kResourceTypeInvalid - 1) ? ", " : "\n"); } return true; @@ -794,10 +813,10 @@ bool Console::cmdResourceTypes(int argc, const char **argv) { bool Console::cmdHexgrep(int argc, const char **argv) { if (argc < 4) { - DebugPrintf("Searches some resources for a particular sequence of bytes, represented as decimal or hexadecimal numbers.\n"); - DebugPrintf("Usage: %s <resource type> <resource number> <search string>\n", argv[0]); - DebugPrintf("<resource number> can be a specific resource number, or \"all\" for all of the resources of the specified type\n"); - DebugPrintf("EXAMPLES:\n hexgrep script all 0xe8 0x03 0xc8 0x00\n hexgrep pic 0x42 0xfe\n"); + debugPrintf("Searches some resources for a particular sequence of bytes, represented as decimal or hexadecimal numbers.\n"); + debugPrintf("Usage: %s <resource type> <resource number> <search string>\n", argv[0]); + debugPrintf("<resource number> can be a specific resource number, or \"all\" for all of the resources of the specified type\n"); + debugPrintf("EXAMPLES:\n hexgrep script all 0xe8 0x03 0xc8 0x00\n hexgrep pic 0x42 0xfe\n"); cmdResourceTypes(argc, argv); return true; } @@ -807,7 +826,7 @@ bool Console::cmdHexgrep(int argc, const char **argv) { Resource *script = NULL; if (restype == kResourceTypeInvalid) { - DebugPrintf("Resource type '%s' is not valid\n", argv[1]); + debugPrintf("Resource type '%s' is not valid\n", argv[1]); return true; } @@ -845,10 +864,10 @@ bool Console::cmdHexgrep(int argc, const char **argv) { seeker = seekerold + 1; if (!output_script_name) { - DebugPrintf("\nIn %s.%03d:\n", getResourceTypeName((ResourceType)restype), resNumber); + debugPrintf("\nIn %s.%03d:\n", getResourceTypeName((ResourceType)restype), resNumber); output_script_name = 1; } - DebugPrintf(" 0x%04x\n", seekerold); + debugPrintf(" 0x%04x\n", seekerold); } } else comppos = 0; @@ -863,38 +882,38 @@ bool Console::cmdHexgrep(int argc, const char **argv) { bool Console::cmdVerifyScripts(int argc, const char **argv) { if (getSciVersion() < SCI_VERSION_1_1) { - DebugPrintf("This script check is only meant for SCI1.1-SCI3 games\n"); + debugPrintf("This script check is only meant for SCI1.1-SCI3 games\n"); return true; } Common::List<ResourceId> resources = _engine->getResMan()->listResources(kResourceTypeScript); Common::sort(resources.begin(), resources.end()); - DebugPrintf("%d SCI1.1-SCI3 scripts found, performing sanity checks...\n", resources.size()); + debugPrintf("%d SCI1.1-SCI3 scripts found, performing sanity checks...\n", resources.size()); Resource *script, *heap; Common::List<ResourceId>::iterator itr; for (itr = resources.begin(); itr != resources.end(); ++itr) { script = _engine->getResMan()->findResource(*itr, false); if (!script) - DebugPrintf("Error: script %d couldn't be loaded\n", itr->getNumber()); + debugPrintf("Error: script %d couldn't be loaded\n", itr->getNumber()); if (getSciVersion() <= SCI_VERSION_2_1) { heap = _engine->getResMan()->findResource(ResourceId(kResourceTypeHeap, itr->getNumber()), false); if (!heap) - DebugPrintf("Error: script %d doesn't have a corresponding heap\n", itr->getNumber()); + debugPrintf("Error: script %d doesn't have a corresponding heap\n", itr->getNumber()); if (script && heap && (script->size + heap->size > 65535)) - DebugPrintf("Error: script and heap %d together are larger than 64KB (%d bytes)\n", + debugPrintf("Error: script and heap %d together are larger than 64KB (%d bytes)\n", itr->getNumber(), script->size + heap->size); } else { // SCI3 if (script && script->size > 65535) - DebugPrintf("Error: script %d is larger than 64KB (%d bytes)\n", + debugPrintf("Error: script %d is larger than 64KB (%d bytes)\n", itr->getNumber(), script->size); } } - DebugPrintf("SCI1.1-SCI2.1 script check finished\n"); + debugPrintf("SCI1.1-SCI2.1 script check finished\n"); return true; } @@ -931,9 +950,9 @@ bool Console::cmdShowInstruments(int argc, const char **argv) { instrumentsSongs[i][j] = false; if (songNumber == -1) { - DebugPrintf("%d sounds found, checking their instrument mappings...\n", resources.size()); - DebugPrintf("Instruments:\n"); - DebugPrintf("============\n"); + debugPrintf("%d sounds found, checking their instrument mappings...\n", resources.size()); + debugPrintf("Instruments:\n"); + debugPrintf("============\n"); } Common::List<ResourceId>::iterator itr; @@ -956,7 +975,7 @@ bool Console::cmdShowInstruments(int argc, const char **argv) { bool endOfTrack = false; bool firstOneShown = false; - DebugPrintf("Song %d: ", itr->getNumber()); + debugPrintf("Song %d: ", itr->getNumber()); do { while (*channelData == 0xF8) @@ -984,9 +1003,9 @@ bool Console::cmdShowInstruments(int argc, const char **argv) { if (!firstOneShown) firstOneShown = true; else - DebugPrintf(","); + debugPrintf(","); - DebugPrintf(" %d", instrument); + debugPrintf(" %d", instrument); instruments[instrument]++; instrumentsSongs[instrument][itr->getNumber()] = true; } else { @@ -1024,44 +1043,44 @@ bool Console::cmdShowInstruments(int argc, const char **argv) { } } while (!endOfTrack); - DebugPrintf("\n"); + debugPrintf("\n"); } delete parser; delete player; - DebugPrintf("\n"); + debugPrintf("\n"); if (songNumber == -1) { - DebugPrintf("Used instruments: "); + debugPrintf("Used instruments: "); for (int i = 0; i < 128; i++) { if (instruments[i] > 0) - DebugPrintf("%d, ", i); + debugPrintf("%d, ", i); } - DebugPrintf("\n\n"); + debugPrintf("\n\n"); } - DebugPrintf("Instruments not mapped in the MT32->GM map: "); + debugPrintf("Instruments not mapped in the MT32->GM map: "); for (int i = 0; i < 128; i++) { if (instruments[i] > 0 && getGmInstrument(Mt32MemoryTimbreMaps[i]) == MIDI_UNMAPPED) - DebugPrintf("%d, ", i); + debugPrintf("%d, ", i); } - DebugPrintf("\n\n"); + debugPrintf("\n\n"); if (songNumber == -1) { - DebugPrintf("Used instruments in songs:\n"); + debugPrintf("Used instruments in songs:\n"); for (int i = 0; i < 128; i++) { if (instruments[i] > 0) { - DebugPrintf("Instrument %d: ", i); + debugPrintf("Instrument %d: ", i); for (int j = 0; j < 1000; j++) { if (instrumentsSongs[i][j]) - DebugPrintf("%d, ", j); + debugPrintf("%d, ", j); } - DebugPrintf("\n"); + debugPrintf("\n"); } } - DebugPrintf("\n\n"); + debugPrintf("\n\n"); } return true; @@ -1069,13 +1088,13 @@ bool Console::cmdShowInstruments(int argc, const char **argv) { bool Console::cmdMapInstrument(int argc, const char **argv) { if (argc != 4) { - DebugPrintf("Maps an MT-32 custom instrument to a GM instrument on the fly\n\n"); - DebugPrintf("Usage %s <MT-32 instrument name> <GM instrument> <GM rhythm key>\n", argv[0]); - DebugPrintf("Each MT-32 instrument is always 10 characters and is mapped to either a GM instrument, or a GM rhythm key\n"); - DebugPrintf("A value of 255 (0xff) signifies an unmapped instrument\n"); - DebugPrintf("Please replace the spaces in the instrument name with underscores (\"_\"). They'll be converted to spaces afterwards\n\n"); - DebugPrintf("Example: %s test_0__XX 1 255\n", argv[0]); - DebugPrintf("The above example will map the MT-32 instrument \"test 0 XX\" to GM instrument 1\n\n"); + debugPrintf("Maps an MT-32 custom instrument to a GM instrument on the fly\n\n"); + debugPrintf("Usage %s <MT-32 instrument name> <GM instrument> <GM rhythm key>\n", argv[0]); + debugPrintf("Each MT-32 instrument is always 10 characters and is mapped to either a GM instrument, or a GM rhythm key\n"); + debugPrintf("A value of 255 (0xff) signifies an unmapped instrument\n"); + debugPrintf("Please replace the spaces in the instrument name with underscores (\"_\"). They'll be converted to spaces afterwards\n\n"); + debugPrintf("Example: %s test_0__XX 1 255\n", argv[0]); + debugPrintf("The above example will map the MT-32 instrument \"test 0 XX\" to GM instrument 1\n\n"); } else { if (Mt32dynamicMappings != NULL) { Mt32ToGmMap newMapping; @@ -1093,11 +1112,11 @@ bool Console::cmdMapInstrument(int argc, const char **argv) { } } - DebugPrintf("Current dynamic mappings:\n"); + debugPrintf("Current dynamic mappings:\n"); if (Mt32dynamicMappings != NULL) { const Mt32ToGmMapList::iterator end = Mt32dynamicMappings->end(); for (Mt32ToGmMapList::iterator it = Mt32dynamicMappings->begin(); it != end; ++it) { - DebugPrintf("\"%s\" -> %d / %d\n", (*it).name, (*it).gmInstr, (*it).gmRhythmKey); + debugPrintf("\"%s\" -> %d / %d\n", (*it).name, (*it).gmInstr, (*it).gmRhythmKey); } } @@ -1106,7 +1125,7 @@ bool Console::cmdMapInstrument(int argc, const char **argv) { bool Console::cmdList(int argc, const char **argv) { if (argc < 2) { - DebugPrintf("Lists all the resources of a given type\n"); + debugPrintf("Lists all the resources of a given type\n"); cmdResourceTypes(argc, argv); return true; } @@ -1114,13 +1133,13 @@ bool Console::cmdList(int argc, const char **argv) { ResourceType res = parseResourceType(argv[1]); if (res == kResourceTypeInvalid) - DebugPrintf("Unknown resource type: '%s'\n", argv[1]); + debugPrintf("Unknown resource type: '%s'\n", argv[1]); else { int number = -1; if ((res == kResourceTypeAudio36) || (res == kResourceTypeSync36)) { if (argc != 3) { - DebugPrintf("Please specify map number (-1: all maps)\n"); + debugPrintf("Please specify map number (-1: all maps)\n"); return true; } number = atoi(argv[2]); @@ -1133,18 +1152,18 @@ bool Console::cmdList(int argc, const char **argv) { Common::List<ResourceId>::iterator itr; for (itr = resources.begin(); itr != resources.end(); ++itr) { if (number == -1) { - DebugPrintf("%8i", itr->getNumber()); + debugPrintf("%8i", itr->getNumber()); if (++cnt % 10 == 0) - DebugPrintf("\n"); + debugPrintf("\n"); } else if (number == (int)itr->getNumber()) { const uint32 tuple = itr->getTuple(); - DebugPrintf("(%3i, %3i, %3i, %3i) ", (tuple >> 24) & 0xff, (tuple >> 16) & 0xff, + debugPrintf("(%3i, %3i, %3i, %3i) ", (tuple >> 24) & 0xff, (tuple >> 16) & 0xff, (tuple >> 8) & 0xff, tuple & 0xff); if (++cnt % 4 == 0) - DebugPrintf("\n"); + debugPrintf("\n"); } } - DebugPrintf("\n"); + debugPrintf("\n"); } return true; @@ -1152,8 +1171,8 @@ bool Console::cmdList(int argc, const char **argv) { bool Console::cmdSaveGame(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Saves the current game state to the hard disk\n"); - DebugPrintf("Usage: %s <filename>\n", argv[0]); + debugPrintf("Saves the current game state to the hard disk\n"); + debugPrintf("Usage: %s <filename>\n", argv[0]); return true; } @@ -1163,19 +1182,19 @@ bool Console::cmdSaveGame(int argc, const char **argv) { result++; if (result) - DebugPrintf("Note: Game state has %d open file handles.\n", result); + debugPrintf("Note: Game state has %d open file handles.\n", result); Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager(); Common::OutSaveFile *out = saveFileMan->openForSaving(argv[1]); const char *version = ""; if (!out) { - DebugPrintf("Error opening savegame \"%s\" for writing\n", argv[1]); + debugPrintf("Error opening savegame \"%s\" for writing\n", argv[1]); return true; } // TODO: enable custom descriptions? force filename into a specific format? if (!gamestate_save(_engine->_gamestate, out, "debugging", version)) { - DebugPrintf("Saving the game state to '%s' failed\n", argv[1]); + debugPrintf("Saving the game state to '%s' failed\n", argv[1]); } else { out->finalize(); if (out->err()) { @@ -1189,8 +1208,8 @@ bool Console::cmdSaveGame(int argc, const char **argv) { bool Console::cmdRestoreGame(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Restores a saved game from the hard disk\n"); - DebugPrintf("Usage: %s <filename>\n", argv[0]); + debugPrintf("Restores a saved game from the hard disk\n"); + debugPrintf("Usage: %s <filename>\n", argv[0]); return true; } @@ -1203,17 +1222,17 @@ bool Console::cmdRestoreGame(int argc, const char **argv) { } if (_engine->_gamestate->r_acc == make_reg(0, 1)) { - DebugPrintf("Restoring gamestate '%s' failed.\n", argv[1]); + debugPrintf("Restoring gamestate '%s' failed.\n", argv[1]); return true; } - return Cmd_Exit(0, 0); + return cmdExit(0, 0); } bool Console::cmdRestartGame(int argc, const char **argv) { _engine->_gamestate->abortScriptProcessing = kAbortRestartGame; - return Cmd_Exit(0, 0); + return cmdExit(0, 0); } // The scripts get IDs ranging from 100->199, because the scripts require us to assign unique ids THAT EVEN STAY BETWEEN @@ -1231,25 +1250,25 @@ bool Console::cmdListSaves(int argc, const char **argv) { 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); + 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"); + debugPrintf("Available classes (parse a parameter to filter the table by a specific class):\n"); for (uint i = 0; i < _engine->_gamestate->_segMan->classTableSize(); i++) { Class temp = _engine->_gamestate->_segMan->_classTable[i]; 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, + debugPrintf(" Class 0x%x (%s) at %04x:%04x (script %d)\n", i, className, PRINT_REG(temp.reg), temp.script); - } else DebugPrintf(" Class 0x%x (not loaded; can't get name) (script %d)\n", i, temp.script); + } else debugPrintf(" Class 0x%x (not loaded; can't get name) (script %d)\n", i, temp.script); } } @@ -1257,52 +1276,52 @@ bool Console::cmdClassTable(int argc, const char **argv) { } bool Console::cmdSentenceFragments(int argc, const char **argv) { - DebugPrintf("Sentence fragments (used to build Parse trees)\n"); + debugPrintf("Sentence fragments (used to build Parse trees)\n"); for (uint i = 0; i < _engine->getVocabulary()->getParserBranchesSize(); i++) { int j = 0; const parse_tree_branch_t &branch = _engine->getVocabulary()->getParseTreeBranch(i); - DebugPrintf("R%02d: [%x] ->", i, branch.id); + debugPrintf("R%02d: [%x] ->", i, branch.id); while ((j < 10) && branch.data[j]) { int dat = branch.data[j++]; switch (dat) { case VOCAB_TREE_NODE_COMPARE_TYPE: dat = branch.data[j++]; - DebugPrintf(" C(%x)", dat); + debugPrintf(" C(%x)", dat); break; case VOCAB_TREE_NODE_COMPARE_GROUP: dat = branch.data[j++]; - DebugPrintf(" WG(%x)", dat); + debugPrintf(" WG(%x)", dat); break; case VOCAB_TREE_NODE_FORCE_STORAGE: dat = branch.data[j++]; - DebugPrintf(" FORCE(%x)", dat); + debugPrintf(" FORCE(%x)", dat); break; default: if (dat > VOCAB_TREE_NODE_LAST_WORD_STORAGE) { int dat2 = branch.data[j++]; - DebugPrintf(" %x[%x]", dat, dat2); + debugPrintf(" %x[%x]", dat, dat2); } else - DebugPrintf(" ?%x?", dat); + debugPrintf(" ?%x?", dat); } } - DebugPrintf("\n"); + debugPrintf("\n"); } - DebugPrintf("%d rules.\n", _engine->getVocabulary()->getParserBranchesSize()); + debugPrintf("%d rules.\n", _engine->getVocabulary()->getParserBranchesSize()); return true; } bool Console::cmdParse(int argc, const char **argv) { if (argc < 2) { - DebugPrintf("Parses a sequence of words with a GNF rule set and prints the resulting parse tree\n"); - DebugPrintf("Usage: %s <word1> <word2> ... <wordn>\n", argv[0]); + debugPrintf("Parses a sequence of words with a GNF rule set and prints the resulting parse tree\n"); + debugPrintf("Usage: %s <word1> <word2> ... <wordn>\n", argv[0]); return true; } @@ -1316,7 +1335,7 @@ bool Console::cmdParse(int argc, const char **argv) { strcat(string, argv[i]); } - DebugPrintf("Parsing '%s'\n", string); + debugPrintf("Parsing '%s'\n", string); ResultWordListList words; bool res = _engine->getVocabulary()->tokenizeString(words, string, &error); @@ -1325,26 +1344,26 @@ bool Console::cmdParse(int argc, const char **argv) { _engine->getVocabulary()->synonymizeTokens(words); - DebugPrintf("Parsed to the following blocks:\n"); + debugPrintf("Parsed to the following blocks:\n"); for (ResultWordListList::const_iterator i = words.begin(); i != words.end(); ++i) { - DebugPrintf(" "); + debugPrintf(" "); for (ResultWordList::const_iterator j = i->begin(); j != i->end(); ++j) { - DebugPrintf("%sType[%04x] Group[%04x]", j == i->begin() ? "" : " / ", j->_class, j->_group); + debugPrintf("%sType[%04x] Group[%04x]", j == i->begin() ? "" : " / ", j->_class, j->_group); } - DebugPrintf("\n"); + debugPrintf("\n"); } if (_engine->getVocabulary()->parseGNF(words, true)) syntax_fail = 1; // Building a tree failed if (syntax_fail) - DebugPrintf("Building a tree failed.\n"); + debugPrintf("Building a tree failed.\n"); else _engine->getVocabulary()->dumpParseTree(); } else { - DebugPrintf("Unknown word: '%s'\n", error); + debugPrintf("Unknown word: '%s'\n", error); free(error); } @@ -1353,10 +1372,10 @@ bool Console::cmdParse(int argc, const char **argv) { bool Console::cmdSaid(int argc, const char **argv) { if (argc < 2) { - DebugPrintf("Matches a string against a said spec\n"); - DebugPrintf("Usage: %s <string> > & <said spec>\n", argv[0]); - DebugPrintf("<string> is a sequence of actual words.\n"); - DebugPrintf("<said spec> is a sequence of hex tokens.\n"); + debugPrintf("Matches a string against a said spec\n"); + debugPrintf("Usage: %s <string> > & <said spec>\n", argv[0]); + debugPrintf("<string> is a sequence of actual words.\n"); + debugPrintf("<said spec> is a sequence of hex tokens.\n"); return true; } @@ -1373,10 +1392,10 @@ bool Console::cmdSaid(int argc, const char **argv) { } if (p >= argc-1) { - DebugPrintf("Matches a string against a said spec\n"); - DebugPrintf("Usage: %s <string> > & <said spec>\n", argv[0]); - DebugPrintf("<string> is a sequence of actual words.\n"); - DebugPrintf("<said spec> is a sequence of hex tokens.\n"); + debugPrintf("Matches a string against a said spec\n"); + debugPrintf("Usage: %s <string> > & <said spec>\n", argv[0]); + debugPrintf("<string> is a sequence of actual words.\n"); + debugPrintf("<said spec> is a sequence of hex tokens.\n"); return true; } @@ -1440,14 +1459,14 @@ bool Console::cmdSaid(int argc, const char **argv) { _engine->getVocabulary()->synonymizeTokens(words); - DebugPrintf("Parsed to the following blocks:\n"); + debugPrintf("Parsed to the following blocks:\n"); for (ResultWordListList::const_iterator i = words.begin(); i != words.end(); ++i) { - DebugPrintf(" "); + debugPrintf(" "); for (ResultWordList::const_iterator j = i->begin(); j != i->end(); ++j) { - DebugPrintf("%sType[%04x] Group[%04x]", j == i->begin() ? "" : " / ", j->_class, j->_group); + debugPrintf("%sType[%04x] Group[%04x]", j == i->begin() ? "" : " / ", j->_class, j->_group); } - DebugPrintf("\n"); + debugPrintf("\n"); } @@ -1456,17 +1475,17 @@ bool Console::cmdSaid(int argc, const char **argv) { syntax_fail = 1; // Building a tree failed if (syntax_fail) - DebugPrintf("Building a tree failed.\n"); + debugPrintf("Building a tree failed.\n"); else { _engine->getVocabulary()->dumpParseTree(); _engine->getVocabulary()->parserIsValid = true; int ret = said((byte *)spec, true); - DebugPrintf("kSaid: %s\n", (ret == SAID_NO_MATCH ? "No match" : "Match")); + debugPrintf("kSaid: %s\n", (ret == SAID_NO_MATCH ? "No match" : "Match")); } } else { - DebugPrintf("Unknown word: '%s'\n", error); + debugPrintf("Unknown word: '%s'\n", error); free(error); } @@ -1476,9 +1495,9 @@ bool Console::cmdSaid(int argc, const char **argv) { bool Console::cmdParserNodes(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Shows the specified number of nodes from the parse node tree\n"); - DebugPrintf("Usage: %s <nr>\n", argv[0]); - DebugPrintf("where <nr> is the number of nodes to show from the parse node tree\n"); + debugPrintf("Shows the specified number of nodes from the parse node tree\n"); + debugPrintf("Usage: %s <nr>\n", argv[0]); + debugPrintf("where <nr> is the number of nodes to show from the parse node tree\n"); return true; } @@ -1491,9 +1510,9 @@ bool Console::cmdParserNodes(int argc, const char **argv) { bool Console::cmdSetPalette(int argc, const char **argv) { if (argc < 2) { - DebugPrintf("Sets a palette resource\n"); - DebugPrintf("Usage: %s <resourceId>\n", argv[0]); - DebugPrintf("where <resourceId> is the number of the palette resource to set\n"); + debugPrintf("Sets a palette resource\n"); + debugPrintf("Usage: %s <resourceId>\n", argv[0]); + debugPrintf("where <resourceId> is the number of the palette resource to set\n"); return true; } @@ -1505,9 +1524,9 @@ bool Console::cmdSetPalette(int argc, const char **argv) { bool Console::cmdDrawPic(int argc, const char **argv) { if (argc < 2) { - DebugPrintf("Draws a pic resource\n"); - DebugPrintf("Usage: %s <resourceId>\n", argv[0]); - DebugPrintf("where <resourceId> is the number of the pic resource to draw\n"); + debugPrintf("Draws a pic resource\n"); + debugPrintf("Usage: %s <resourceId>\n", argv[0]); + debugPrintf("where <resourceId> is the number of the pic resource to draw\n"); return true; } @@ -1532,9 +1551,9 @@ bool Console::cmdDrawPic(int argc, const char **argv) { bool Console::cmdDrawCel(int argc, const char **argv) { if (argc < 4) { - DebugPrintf("Draws a cel from a view resource\n"); - DebugPrintf("Usage: %s <resourceId> <loopNr> <celNr> \n", argv[0]); - DebugPrintf("where <resourceId> is the number of the view resource to draw\n"); + debugPrintf("Draws a cel from a view resource\n"); + debugPrintf("Usage: %s <resourceId> <loopNr> <celNr> \n", argv[0]); + debugPrintf("where <resourceId> is the number of the view resource to draw\n"); return true; } @@ -1555,24 +1574,24 @@ bool Console::cmdDrawCel(int argc, const char **argv) { bool Console::cmdUndither(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Enable/disable undithering.\n"); - DebugPrintf("Usage: %s <0/1>\n", argv[0]); + debugPrintf("Enable/disable undithering.\n"); + debugPrintf("Usage: %s <0/1>\n", argv[0]); return true; } bool flag = atoi(argv[1]) ? true : false; _engine->_gfxScreen->enableUndithering(flag); if (flag) - DebugPrintf("undithering ENABLED\n"); + debugPrintf("undithering ENABLED\n"); else - DebugPrintf("undithering DISABLED\n"); + debugPrintf("undithering DISABLED\n"); return true; } bool Console::cmdPicVisualize(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Enable/disable picture visualization (EGA only)\n"); - DebugPrintf("Usage: %s <0/1>\n", argv[0]); + debugPrintf("Enable/disable picture visualization (EGA only)\n"); + debugPrintf("Usage: %s <0/1>\n", argv[0]); return true; } @@ -1581,21 +1600,21 @@ bool Console::cmdPicVisualize(int argc, const char **argv) { if (_engine->_resMan->getViewType() == kViewEga) { _engine->_gfxPaint16->debugSetEGAdrawingVisualize(state); if (state) - DebugPrintf("picture visualization ENABLED\n"); + debugPrintf("picture visualization ENABLED\n"); else - DebugPrintf("picture visualization DISABLED\n"); + debugPrintf("picture visualization DISABLED\n"); } else { - DebugPrintf("picture visualization only available for EGA games\n"); + debugPrintf("picture visualization only available for EGA games\n"); } return true; } bool Console::cmdPlayVideo(int argc, const char **argv) { if (argc < 2) { - DebugPrintf("Plays a SEQ, AVI, VMD, RBT or DUK video.\n"); - DebugPrintf("Usage: %s <video file name> <delay>\n", argv[0]); - DebugPrintf("The video file name should include the extension\n"); - DebugPrintf("Delay is only used in SEQ videos and is measured in ticks (default: 10)\n"); + debugPrintf("Plays a SEQ, AVI, VMD, RBT or DUK video.\n"); + debugPrintf("Usage: %s <video file name> <delay>\n", argv[0]); + debugPrintf("The video file name should include the extension\n"); + debugPrintf("Delay is only used in SEQ videos and is measured in ticks (default: 10)\n"); return true; } @@ -1606,29 +1625,29 @@ bool Console::cmdPlayVideo(int argc, const char **argv) { filename.hasSuffix(".rbt") || filename.hasSuffix(".duk")) { _videoFile = filename; _videoFrameDelay = (argc == 2) ? 10 : atoi(argv[2]); - return Cmd_Exit(0, 0); + return cmdExit(0, 0); } else { - DebugPrintf("Unknown video file type\n"); + debugPrintf("Unknown video file type\n"); return true; } } bool Console::cmdAnimateList(int argc, const char **argv) { if (_engine->_gfxAnimate) { - DebugPrintf("Animate list:\n"); + debugPrintf("Animate list:\n"); _engine->_gfxAnimate->printAnimateList(this); } else { - DebugPrintf("This SCI version does not have an animate list\n"); + debugPrintf("This SCI version does not have an animate list\n"); } return true; } bool Console::cmdWindowList(int argc, const char **argv) { if (_engine->_gfxPorts) { - DebugPrintf("Window list:\n"); + debugPrintf("Window list:\n"); _engine->_gfxPorts->printWindowList(this); } else { - DebugPrintf("This SCI version does not have a list of ports\n"); + debugPrintf("This SCI version does not have a list of ports\n"); } return true; } @@ -1636,41 +1655,41 @@ bool Console::cmdWindowList(int argc, const char **argv) { bool Console::cmdPlaneList(int argc, const char **argv) { #ifdef ENABLE_SCI32 if (_engine->_gfxFrameout) { - DebugPrintf("Plane list:\n"); + debugPrintf("Plane list:\n"); _engine->_gfxFrameout->printPlaneList(this); } else { - DebugPrintf("This SCI version does not have a list of planes\n"); + debugPrintf("This SCI version does not have a list of planes\n"); } #else - DebugPrintf("SCI32 isn't included in this compiled executable\n"); + 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 <plane address>\n", argv[0]); + 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"); + 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"); + debugPrintf("Plane item list:\n"); _engine->_gfxFrameout->printPlaneItemList(this, planeObject); } else { - DebugPrintf("This SCI version does not have a list of plane items\n"); + debugPrintf("This SCI version does not have a list of plane items\n"); } #else - DebugPrintf("SCI32 isn't included in this compiled executable\n"); + debugPrintf("SCI32 isn't included in this compiled executable\n"); #endif return true; } @@ -1680,7 +1699,7 @@ bool Console::cmdSavedBits(int argc, const char **argv) { SegmentId id = segman->findSegmentByType(SEG_TYPE_HUNK); HunkTable* hunks = (HunkTable *)segman->getSegmentObj(id); if (!hunks) { - DebugPrintf("No hunk segment found.\n"); + debugPrintf("No hunk segment found.\n"); return true; } @@ -1693,7 +1712,7 @@ bool Console::cmdSavedBits(int argc, const char **argv) { byte* memoryPtr = (byte *)h.mem; if (memoryPtr) { - DebugPrintf("%04x:%04x:", PRINT_REG(entries[i])); + debugPrintf("%04x:%04x:", PRINT_REG(entries[i])); Common::Rect rect; byte mask; @@ -1702,17 +1721,17 @@ bool Console::cmdSavedBits(int argc, const char **argv) { memcpy((void *)&rect, memoryPtr, sizeof(rect)); memcpy((void *)&mask, memoryPtr + sizeof(rect), sizeof(mask)); - DebugPrintf(" %d,%d - %d,%d", rect.top, rect.left, + debugPrintf(" %d,%d - %d,%d", rect.top, rect.left, rect.bottom, rect.right); if (mask & GFX_SCREEN_MASK_VISUAL) - DebugPrintf(" visual"); + debugPrintf(" visual"); if (mask & GFX_SCREEN_MASK_PRIORITY) - DebugPrintf(" priority"); + debugPrintf(" priority"); if (mask & GFX_SCREEN_MASK_CONTROL) - DebugPrintf(" control"); + debugPrintf(" control"); if (mask & GFX_SCREEN_MASK_DISPLAY) - DebugPrintf(" display"); - DebugPrintf("\n"); + debugPrintf(" display"); + debugPrintf("\n"); } } } @@ -1723,22 +1742,22 @@ bool Console::cmdSavedBits(int argc, const char **argv) { bool Console::cmdShowSavedBits(int argc, const char **argv) { if (argc < 2) { - DebugPrintf("Display saved bits.\n"); - DebugPrintf("Usage: %s <address>\n", argv[0]); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Display saved bits.\n"); + debugPrintf("Usage: %s <address>\n", argv[0]); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } reg_t memoryHandle = NULL_REG; if (parse_reg_t(_engine->_gamestate, argv[1], &memoryHandle, false)) { - DebugPrintf("Invalid address passed.\n"); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Invalid address passed.\n"); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } if (memoryHandle.isNull()) { - DebugPrintf("Invalid address.\n"); + debugPrintf("Invalid address.\n"); return true; } @@ -1746,26 +1765,26 @@ bool Console::cmdShowSavedBits(int argc, const char **argv) { SegmentId id = segman->findSegmentByType(SEG_TYPE_HUNK); HunkTable* hunks = (HunkTable *)segman->getSegmentObj(id); if (!hunks) { - DebugPrintf("No hunk segment found.\n"); + debugPrintf("No hunk segment found.\n"); return true; } if (memoryHandle.getSegment() != id || !hunks->isValidOffset(memoryHandle.getOffset())) { - DebugPrintf("Invalid address.\n"); + debugPrintf("Invalid address.\n"); return true; } const Hunk& h = hunks->_table[memoryHandle.getOffset()]; if (strcmp(h.type, "SaveBits()") != 0) { - DebugPrintf("Invalid address.\n"); + debugPrintf("Invalid address.\n"); return true; } byte *memoryPtr = segman->getHunkPointer(memoryHandle); if (!memoryPtr) { - DebugPrintf("Invalid or freed bits.\n"); + debugPrintf("Invalid or freed bits.\n"); return true; } @@ -1783,17 +1802,17 @@ bool Console::cmdShowSavedBits(int argc, const char **argv) { Common::Point bl(rect.left, rect.bottom-1); Common::Point br(rect.right-1, rect.bottom-1); - DebugPrintf(" %d,%d - %d,%d", rect.top, rect.left, + debugPrintf(" %d,%d - %d,%d", rect.top, rect.left, rect.bottom, rect.right); if (mask & GFX_SCREEN_MASK_VISUAL) - DebugPrintf(" visual"); + debugPrintf(" visual"); if (mask & GFX_SCREEN_MASK_PRIORITY) - DebugPrintf(" priority"); + debugPrintf(" priority"); if (mask & GFX_SCREEN_MASK_CONTROL) - DebugPrintf(" control"); + debugPrintf(" control"); if (mask & GFX_SCREEN_MASK_DISPLAY) - DebugPrintf(" display"); - DebugPrintf("\n"); + debugPrintf(" display"); + debugPrintf("\n"); if (!_engine->_gfxPaint16 || !_engine->_gfxScreen) return true; @@ -1843,7 +1862,7 @@ bool Console::cmdShowSavedBits(int argc, const char **argv) { bool Console::cmdParseGrammar(int argc, const char **argv) { - DebugPrintf("Parse grammar, in strict GNF:\n"); + debugPrintf("Parse grammar, in strict GNF:\n"); _engine->getVocabulary()->buildGNF(true); @@ -1851,71 +1870,71 @@ bool Console::cmdParseGrammar(int argc, const char **argv) { } bool Console::cmdPrintSegmentTable(int argc, const char **argv) { - DebugPrintf("Segment table:\n"); + debugPrintf("Segment table:\n"); for (uint i = 0; i < _engine->_gamestate->_segMan->_heap.size(); i++) { SegmentObj *mobj = _engine->_gamestate->_segMan->_heap[i]; if (mobj && mobj->getType()) { - DebugPrintf(" [%04x] ", i); + debugPrintf(" [%04x] ", i); switch (mobj->getType()) { case SEG_TYPE_SCRIPT: - DebugPrintf("S script.%03d l:%d ", (*(Script *)mobj).getScriptNumber(), (*(Script *)mobj).getLockers()); + debugPrintf("S script.%03d l:%d ", (*(Script *)mobj).getScriptNumber(), (*(Script *)mobj).getLockers()); break; case SEG_TYPE_CLONES: - DebugPrintf("C clones (%d allocd)", (*(CloneTable *)mobj).entries_used); + debugPrintf("C clones (%d allocd)", (*(CloneTable *)mobj).entries_used); break; case SEG_TYPE_LOCALS: - DebugPrintf("V locals %03d", (*(LocalVariables *)mobj).script_id); + debugPrintf("V locals %03d", (*(LocalVariables *)mobj).script_id); break; case SEG_TYPE_STACK: - DebugPrintf("D data stack (%d)", (*(DataStack *)mobj)._capacity); + debugPrintf("D data stack (%d)", (*(DataStack *)mobj)._capacity); break; case SEG_TYPE_LISTS: - DebugPrintf("L lists (%d)", (*(ListTable *)mobj).entries_used); + debugPrintf("L lists (%d)", (*(ListTable *)mobj).entries_used); break; case SEG_TYPE_NODES: - DebugPrintf("N nodes (%d)", (*(NodeTable *)mobj).entries_used); + debugPrintf("N nodes (%d)", (*(NodeTable *)mobj).entries_used); break; case SEG_TYPE_HUNK: - DebugPrintf("H hunk (%d)", (*(HunkTable *)mobj).entries_used); + debugPrintf("H hunk (%d)", (*(HunkTable *)mobj).entries_used); break; case SEG_TYPE_DYNMEM: - DebugPrintf("M dynmem: %d bytes", (*(DynMem *)mobj)._size); + debugPrintf("M dynmem: %d bytes", (*(DynMem *)mobj)._size); break; #ifdef ENABLE_SCI32 case SEG_TYPE_ARRAY: - DebugPrintf("A SCI32 arrays (%d)", (*(ArrayTable *)mobj).entries_used); + debugPrintf("A SCI32 arrays (%d)", (*(ArrayTable *)mobj).entries_used); break; case SEG_TYPE_STRING: - DebugPrintf("T SCI32 strings (%d)", (*(StringTable *)mobj).entries_used); + debugPrintf("T SCI32 strings (%d)", (*(StringTable *)mobj).entries_used); break; #endif default: - DebugPrintf("I Invalid (type = %x)", mobj->getType()); + debugPrintf("I Invalid (type = %x)", mobj->getType()); break; } - DebugPrintf(" \n"); + debugPrintf(" \n"); } } - DebugPrintf("\n"); + debugPrintf("\n"); return true; } bool Console::segmentInfo(int nr) { - DebugPrintf("[%04x] ", nr); + debugPrintf("[%04x] ", nr); if ((nr < 0) || ((uint)nr >= _engine->_gamestate->_segMan->_heap.size()) || !_engine->_gamestate->_segMan->_heap[nr]) return false; @@ -1926,30 +1945,30 @@ bool Console::segmentInfo(int nr) { case SEG_TYPE_SCRIPT: { Script *scr = (Script *)mobj; - DebugPrintf("script.%03d locked by %d, bufsize=%d (%x)\n", scr->getScriptNumber(), scr->getLockers(), (uint)scr->getBufSize(), (uint)scr->getBufSize()); + debugPrintf("script.%03d locked by %d, bufsize=%d (%x)\n", scr->getScriptNumber(), scr->getLockers(), (uint)scr->getBufSize(), (uint)scr->getBufSize()); if (scr->getExportTable()) - DebugPrintf(" Exports: %4d at %d\n", scr->getExportsNr(), (int)(((const byte *)scr->getExportTable()) - ((const byte *)scr->getBuf()))); + debugPrintf(" Exports: %4d at %d\n", scr->getExportsNr(), (int)(((const byte *)scr->getExportTable()) - ((const byte *)scr->getBuf()))); else - DebugPrintf(" Exports: none\n"); + debugPrintf(" Exports: none\n"); - DebugPrintf(" Synonyms: %4d\n", scr->getSynonymsNr()); + debugPrintf(" Synonyms: %4d\n", scr->getSynonymsNr()); if (scr->getLocalsCount() > 0) - DebugPrintf(" Locals : %4d in segment 0x%x\n", scr->getLocalsCount(), scr->getLocalsSegment()); + debugPrintf(" Locals : %4d in segment 0x%x\n", scr->getLocalsCount(), scr->getLocalsSegment()); else - DebugPrintf(" Locals : none\n"); + debugPrintf(" Locals : none\n"); ObjMap objects = scr->getObjectMap(); - DebugPrintf(" Objects: %4d\n", objects.size()); + debugPrintf(" Objects: %4d\n", objects.size()); ObjMap::iterator it; const ObjMap::iterator end = objects.end(); for (it = objects.begin(); it != end; ++it) { - DebugPrintf(" "); + debugPrintf(" "); // Object header const Object *obj = _engine->_gamestate->_segMan->getObject(it->_value.getPos()); if (obj) - DebugPrintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(it->_value.getPos()), + debugPrintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(it->_value.getPos()), _engine->_gamestate->_segMan->getObjectName(it->_value.getPos()), obj->getVarCount(), obj->getMethodCount()); } @@ -1958,31 +1977,31 @@ bool Console::segmentInfo(int nr) { case SEG_TYPE_LOCALS: { LocalVariables *locals = (LocalVariables *)mobj; - DebugPrintf("locals for script.%03d\n", locals->script_id); - DebugPrintf(" %d (0x%x) locals\n", locals->_locals.size(), locals->_locals.size()); + debugPrintf("locals for script.%03d\n", locals->script_id); + debugPrintf(" %d (0x%x) locals\n", locals->_locals.size(), locals->_locals.size()); } break; case SEG_TYPE_STACK: { DataStack *stack = (DataStack *)mobj; - DebugPrintf("stack\n"); - DebugPrintf(" %d (0x%x) entries\n", stack->_capacity, stack->_capacity); + debugPrintf("stack\n"); + debugPrintf(" %d (0x%x) entries\n", stack->_capacity, stack->_capacity); } break; case SEG_TYPE_CLONES: { CloneTable *ct = (CloneTable *)mobj; - DebugPrintf("clones\n"); + debugPrintf("clones\n"); for (uint i = 0; i < ct->_table.size(); i++) if (ct->isValidEntry(i)) { reg_t objpos = make_reg(nr, i); - DebugPrintf(" [%04x] %s; copy of ", i, _engine->_gamestate->_segMan->getObjectName(objpos)); + debugPrintf(" [%04x] %s; copy of ", i, _engine->_gamestate->_segMan->getObjectName(objpos)); // Object header const Object *obj = _engine->_gamestate->_segMan->getObject(ct->_table[i].getPos()); if (obj) - DebugPrintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(ct->_table[i].getPos()), + debugPrintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(ct->_table[i].getPos()), _engine->_gamestate->_segMan->getObjectName(ct->_table[i].getPos()), obj->getVarCount(), obj->getMethodCount()); } @@ -1992,34 +2011,34 @@ bool Console::segmentInfo(int nr) { case SEG_TYPE_LISTS: { ListTable *lt = (ListTable *)mobj; - DebugPrintf("lists\n"); + debugPrintf("lists\n"); for (uint i = 0; i < lt->_table.size(); i++) if (lt->isValidEntry(i)) { - DebugPrintf(" [%04x]: ", i); + debugPrintf(" [%04x]: ", i); printList(&(lt->_table[i])); } } break; case SEG_TYPE_NODES: { - DebugPrintf("nodes (total %d)\n", (*(NodeTable *)mobj).entries_used); + debugPrintf("nodes (total %d)\n", (*(NodeTable *)mobj).entries_used); break; } case SEG_TYPE_HUNK: { HunkTable *ht = (HunkTable *)mobj; - DebugPrintf("hunk (total %d)\n", ht->entries_used); + debugPrintf("hunk (total %d)\n", ht->entries_used); for (uint i = 0; i < ht->_table.size(); i++) if (ht->isValidEntry(i)) { - DebugPrintf(" [%04x] %d bytes at %p, type=%s\n", + debugPrintf(" [%04x] %d bytes at %p, type=%s\n", i, ht->_table[i].size, ht->_table[i].mem, ht->_table[i].type); } } break; case SEG_TYPE_DYNMEM: { - DebugPrintf("dynmem (%s): %d bytes\n", + debugPrintf("dynmem (%s): %d bytes\n", (*(DynMem *)mobj)._description.c_str(), (*(DynMem *)mobj)._size); Common::hexdump((*(DynMem *)mobj)._buf, (*(DynMem *)mobj)._size, 16, 0); @@ -2028,28 +2047,28 @@ bool Console::segmentInfo(int nr) { #ifdef ENABLE_SCI32 case SEG_TYPE_STRING: - DebugPrintf("SCI32 strings\n"); + debugPrintf("SCI32 strings\n"); break; case SEG_TYPE_ARRAY: - DebugPrintf("SCI32 arrays\n"); + debugPrintf("SCI32 arrays\n"); break; #endif default : - DebugPrintf("Invalid type %d\n", mobj->getType()); + debugPrintf("Invalid type %d\n", mobj->getType()); break; } - DebugPrintf("\n"); + debugPrintf("\n"); return true; } bool Console::cmdSegmentInfo(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Provides information on the specified segment(s)\n"); - DebugPrintf("Usage: %s <segment number>\n", argv[0]); - DebugPrintf("<segment number> can be a number, which shows the information of the segment with\n"); - DebugPrintf("the specified number, or \"all\" to show information on all active segments\n"); + debugPrintf("Provides information on the specified segment(s)\n"); + debugPrintf("Usage: %s <segment number>\n", argv[0]); + debugPrintf("<segment number> can be a number, which shows the information of the segment with\n"); + debugPrintf("the specified number, or \"all\" to show information on all active segments\n"); return true; } @@ -2061,7 +2080,7 @@ bool Console::cmdSegmentInfo(int argc, const char **argv) { if (!parseInteger(argv[1], segmentNr)) return true; if (!segmentInfo(segmentNr)) - DebugPrintf("Segment %04xh does not exist\n", segmentNr); + debugPrintf("Segment %04xh does not exist\n", segmentNr); } return true; @@ -2070,8 +2089,8 @@ bool Console::cmdSegmentInfo(int argc, const char **argv) { bool Console::cmdKillSegment(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Deletes the specified segment\n"); - DebugPrintf("Usage: %s <segment number>\n", argv[0]); + debugPrintf("Deletes the specified segment\n"); + debugPrintf("Usage: %s <segment number>\n", argv[0]); return true; } int segmentNumber; @@ -2084,13 +2103,13 @@ bool Console::cmdKillSegment(int argc, const char **argv) { bool Console::cmdShowMap(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Switches to one of the following screen maps\n"); - DebugPrintf("Usage: %s <screen map>\n", argv[0]); - DebugPrintf("Screen maps:\n"); - DebugPrintf("- 0: visual map\n"); - DebugPrintf("- 1: priority map\n"); - DebugPrintf("- 2: control map\n"); - DebugPrintf("- 3: display screen\n"); + debugPrintf("Switches to one of the following screen maps\n"); + debugPrintf("Usage: %s <screen map>\n", argv[0]); + debugPrintf("Screen maps:\n"); + debugPrintf("- 0: visual map\n"); + debugPrintf("- 1: priority map\n"); + debugPrintf("- 2: control map\n"); + debugPrintf("- 3: display screen\n"); return true; } @@ -2105,14 +2124,14 @@ bool Console::cmdShowMap(int argc, const char **argv) { break; default: - DebugPrintf("Map %d is not available.\n", map); + debugPrintf("Map %d is not available.\n", map); return true; } - return Cmd_Exit(0, 0); + return cmdExit(0, 0); } bool Console::cmdSongLib(int argc, const char **argv) { - DebugPrintf("Song library:\n"); + debugPrintf("Song library:\n"); g_sci->_soundCmd->printPlayList(this); return true; @@ -2120,16 +2139,16 @@ bool Console::cmdSongLib(int argc, const char **argv) { bool Console::cmdSongInfo(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Shows information about a given song in the playlist\n"); - DebugPrintf("Usage: %s <song object>\n", argv[0]); + debugPrintf("Shows information about a given song in the playlist\n"); + debugPrintf("Usage: %s <song object>\n", argv[0]); return true; } reg_t addr; if (parse_reg_t(_engine->_gamestate, argv[1], &addr, false)) { - DebugPrintf("Invalid address passed.\n"); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Invalid address passed.\n"); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } @@ -2140,38 +2159,38 @@ bool Console::cmdSongInfo(int argc, const char **argv) { bool Console::cmdStartSound(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Adds the requested sound resource to the playlist, and starts playing it\n"); - DebugPrintf("Usage: %s <sound resource id>\n", argv[0]); + debugPrintf("Adds the requested sound resource to the playlist, and starts playing it\n"); + debugPrintf("Usage: %s <sound resource id>\n", argv[0]); return true; } int16 number = atoi(argv[1]); if (!_engine->getResMan()->testResource(ResourceId(kResourceTypeSound, number))) { - DebugPrintf("Unable to load this sound resource, most probably it has an equivalent audio resource (SCI1.1)\n"); + debugPrintf("Unable to load this sound resource, most probably it has an equivalent audio resource (SCI1.1)\n"); return true; } g_sci->_soundCmd->startNewSound(number); - return Cmd_Exit(0, 0); + return cmdExit(0, 0); } bool Console::cmdToggleSound(int argc, const char **argv) { if (argc != 3) { - DebugPrintf("Plays or stops the specified sound in the playlist\n"); - DebugPrintf("Usage: %s <address> <state>\n", argv[0]); - DebugPrintf("Where:\n"); - DebugPrintf("- <address> is the address of the sound to play or stop.\n"); - DebugPrintf("- <state> is the new state (play or stop).\n"); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Plays or stops the specified sound in the playlist\n"); + debugPrintf("Usage: %s <address> <state>\n", argv[0]); + debugPrintf("Where:\n"); + debugPrintf("- <address> is the address of the sound to play or stop.\n"); + debugPrintf("- <state> is the new state (play or stop).\n"); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } reg_t id; if (parse_reg_t(_engine->_gamestate, argv[1], &id, false)) { - DebugPrintf("Invalid address passed.\n"); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Invalid address passed.\n"); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } @@ -2183,7 +2202,7 @@ bool Console::cmdToggleSound(int argc, const char **argv) { else if (newState == "stop") g_sci->_soundCmd->processStopSound(id, false); else - DebugPrintf("New state can either be 'play' or 'stop'"); + debugPrintf("New state can either be 'play' or 'stop'"); return true; } @@ -2191,40 +2210,40 @@ bool Console::cmdToggleSound(int argc, const char **argv) { bool Console::cmdStopAllSounds(int argc, const char **argv) { g_sci->_soundCmd->stopAllSounds(); - DebugPrintf("All sounds have been stopped\n"); + debugPrintf("All sounds have been stopped\n"); return true; } bool Console::cmdIsSample(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Tests whether a given sound resource is a PCM sample, \n"); - DebugPrintf("and displays information on it if it is.\n"); - DebugPrintf("Usage: %s <sample id>\n", argv[0]); + debugPrintf("Tests whether a given sound resource is a PCM sample, \n"); + debugPrintf("and displays information on it if it is.\n"); + debugPrintf("Usage: %s <sample id>\n", argv[0]); return true; } int16 number = atoi(argv[1]); if (!_engine->getResMan()->testResource(ResourceId(kResourceTypeSound, number))) { - DebugPrintf("Unable to load this sound resource, most probably it has an equivalent audio resource (SCI1.1)\n"); + debugPrintf("Unable to load this sound resource, most probably it has an equivalent audio resource (SCI1.1)\n"); return true; } SoundResource *soundRes = new SoundResource(number, _engine->getResMan(), _engine->_features->detectDoSoundType()); if (!soundRes) { - DebugPrintf("Not a sound resource!\n"); + debugPrintf("Not a sound resource!\n"); return true; } SoundResource::Track *track = soundRes->getDigitalTrack(); if (!track || track->digitalChannelNr == -1) { - DebugPrintf("Valid song, but not a sample.\n"); + debugPrintf("Valid song, but not a sample.\n"); delete soundRes; return true; } - DebugPrintf("Sample size: %d, sample rate: %d, channels: %d, digital channel number: %d\n", + debugPrintf("Sample size: %d, sample rate: %d, channels: %d, digital channel number: %d\n", track->digitalSampleSize, track->digitalSampleRate, track->channelCount, track->digitalChannelNr); delete soundRes; @@ -2232,7 +2251,7 @@ bool Console::cmdIsSample(int argc, const char **argv) { } bool Console::cmdGCInvoke(int argc, const char **argv) { - DebugPrintf("Performing garbage collection...\n"); + debugPrintf("Performing garbage collection...\n"); run_gc(_engine->_gamestate); return true; } @@ -2240,9 +2259,9 @@ bool Console::cmdGCInvoke(int argc, const char **argv) { bool Console::cmdGCObjects(int argc, const char **argv) { AddrSet *use_map = findAllActiveReferences(_engine->_gamestate); - DebugPrintf("Reachable object references (normalised):\n"); + debugPrintf("Reachable object references (normalised):\n"); for (AddrSet::iterator i = use_map->begin(); i != use_map->end(); ++i) { - DebugPrintf(" - %04x:%04x\n", PRINT_REG(i->_key)); + debugPrintf(" - %04x:%04x\n", PRINT_REG(i->_key)); } delete use_map; @@ -2252,93 +2271,93 @@ bool Console::cmdGCObjects(int argc, const char **argv) { bool Console::cmdGCShowReachable(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Prints all addresses directly reachable from the memory object specified as parameter.\n"); - DebugPrintf("Usage: %s <address>\n", argv[0]); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Prints all addresses directly reachable from the memory object specified as parameter.\n"); + debugPrintf("Usage: %s <address>\n", argv[0]); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } reg_t addr; if (parse_reg_t(_engine->_gamestate, argv[1], &addr, false)) { - DebugPrintf("Invalid address passed.\n"); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Invalid address passed.\n"); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } SegmentObj *mobj = _engine->_gamestate->_segMan->getSegmentObj(addr.getSegment()); if (!mobj) { - DebugPrintf("Unknown segment : %x\n", addr.getSegment()); + debugPrintf("Unknown segment : %x\n", addr.getSegment()); return 1; } - DebugPrintf("Reachable from %04x:%04x:\n", PRINT_REG(addr)); + debugPrintf("Reachable from %04x:%04x:\n", PRINT_REG(addr)); const Common::Array<reg_t> tmp = mobj->listAllOutgoingReferences(addr); for (Common::Array<reg_t>::const_iterator it = tmp.begin(); it != tmp.end(); ++it) if (it->getSegment()) - g_sci->getSciDebugger()->DebugPrintf(" %04x:%04x\n", PRINT_REG(*it)); + g_sci->getSciDebugger()->debugPrintf(" %04x:%04x\n", PRINT_REG(*it)); return true; } bool Console::cmdGCShowFreeable(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Prints all addresses freeable in the segment associated with the\n"); - DebugPrintf("given address (offset is ignored).\n"); - DebugPrintf("Usage: %s <address>\n", argv[0]); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Prints all addresses freeable in the segment associated with the\n"); + debugPrintf("given address (offset is ignored).\n"); + debugPrintf("Usage: %s <address>\n", argv[0]); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } reg_t addr; if (parse_reg_t(_engine->_gamestate, argv[1], &addr, false)) { - DebugPrintf("Invalid address passed.\n"); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Invalid address passed.\n"); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } SegmentObj *mobj = _engine->_gamestate->_segMan->getSegmentObj(addr.getSegment()); if (!mobj) { - DebugPrintf("Unknown segment : %x\n", addr.getSegment()); + debugPrintf("Unknown segment : %x\n", addr.getSegment()); return true; } - DebugPrintf("Freeable in segment %04x:\n", addr.getSegment()); + debugPrintf("Freeable in segment %04x:\n", addr.getSegment()); const Common::Array<reg_t> tmp = mobj->listAllDeallocatable(addr.getSegment()); for (Common::Array<reg_t>::const_iterator it = tmp.begin(); it != tmp.end(); ++it) if (it->getSegment()) - g_sci->getSciDebugger()->DebugPrintf(" %04x:%04x\n", PRINT_REG(*it)); + g_sci->getSciDebugger()->debugPrintf(" %04x:%04x\n", PRINT_REG(*it)); return true; } bool Console::cmdGCNormalize(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Prints the \"normal\" address of a given address,\n"); - DebugPrintf("i.e. the address we would free in order to free\n"); - DebugPrintf("the object associated with the original address.\n"); - DebugPrintf("Usage: %s <address>\n", argv[0]); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Prints the \"normal\" address of a given address,\n"); + debugPrintf("i.e. the address we would free in order to free\n"); + debugPrintf("the object associated with the original address.\n"); + debugPrintf("Usage: %s <address>\n", argv[0]); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } reg_t addr; if (parse_reg_t(_engine->_gamestate, argv[1], &addr, false)) { - DebugPrintf("Invalid address passed.\n"); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Invalid address passed.\n"); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } SegmentObj *mobj = _engine->_gamestate->_segMan->getSegmentObj(addr.getSegment()); if (!mobj) { - DebugPrintf("Unknown segment : %x\n", addr.getSegment()); + debugPrintf("Unknown segment : %x\n", addr.getSegment()); return true; } addr = mobj->findCanonicAddress(_engine->_gamestate->_segMan, addr); - DebugPrintf(" %04x:%04x\n", PRINT_REG(addr)); + debugPrintf(" %04x:%04x\n", PRINT_REG(addr)); return true; } @@ -2347,12 +2366,12 @@ bool Console::cmdVMVarlist(int argc, const char **argv) { EngineState *s = _engine->_gamestate; const char *varnames[] = {"global", "local", "temp", "param"}; - DebugPrintf("Addresses of variables in the VM:\n"); + debugPrintf("Addresses of variables in the VM:\n"); for (int i = 0; i < 4; i++) { - DebugPrintf("%s vars at %04x:%04x ", varnames[i], PRINT_REG(make_reg(s->variablesSegment[i], s->variables[i] - s->variablesBase[i]))); - DebugPrintf(" total %d", s->variablesMax[i]); - DebugPrintf("\n"); + debugPrintf("%s vars at %04x:%04x ", varnames[i], PRINT_REG(make_reg(s->variablesSegment[i], s->variables[i] - s->variablesBase[i]))); + debugPrintf(" total %d", s->variablesMax[i]); + debugPrintf("\n"); } return true; @@ -2360,12 +2379,12 @@ bool Console::cmdVMVarlist(int argc, const char **argv) { bool Console::cmdVMVars(int argc, const char **argv) { if (argc < 2) { - DebugPrintf("Displays or changes variables in the VM\n"); - DebugPrintf("Usage: %s <type> <varnum> [<value>]\n", argv[0]); - DebugPrintf("First parameter is either g(lobal), l(ocal), t(emp), p(aram) or a(cc).\n"); - DebugPrintf("Second parameter is the var number (not specified on acc)\n"); - DebugPrintf("Third parameter (if specified) is the value to set the variable to, in address form\n"); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Displays or changes variables in the VM\n"); + debugPrintf("Usage: %s <type> <varnum> [<value>]\n", argv[0]); + debugPrintf("First parameter is either g(lobal), l(ocal), t(emp), p(aram) or a(cc).\n"); + debugPrintf("Second parameter is the var number (not specified on acc)\n"); + debugPrintf("Third parameter (if specified) is the value to set the variable to, in address form\n"); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } @@ -2379,7 +2398,7 @@ bool Console::cmdVMVars(int argc, const char **argv) { const char *setValue = NULL; if (!varType_pre) { - DebugPrintf("Invalid variable type '%c'\n", *argv[1]); + debugPrintf("Invalid variable type '%c'\n", *argv[1]); return true; } @@ -2392,11 +2411,11 @@ bool Console::cmdVMVars(int argc, const char **argv) { case 3: { // for global, local, temp and param, we need an index if (argc < 3) { - DebugPrintf("Variable number must be specified for requested type\n"); + debugPrintf("Variable number must be specified for requested type\n"); return true; } if (argc > 4) { - DebugPrintf("Too many arguments\n"); + debugPrintf("Too many arguments\n"); return true; } @@ -2404,12 +2423,12 @@ bool Console::cmdVMVars(int argc, const char **argv) { return true; if (varIndex < 0) { - DebugPrintf("Variable number may not be negative\n"); + debugPrintf("Variable number may not be negative\n"); return true; } if (s->variablesMax[varType] <= varIndex) { - DebugPrintf("Maximum variable number for this type is %d (0x%x)\n", s->variablesMax[varType], s->variablesMax[varType]); + debugPrintf("Maximum variable number for this type is %d (0x%x)\n", s->variablesMax[varType], s->variablesMax[varType]); return true; } curValue = &s->variables[varType][varIndex]; @@ -2421,7 +2440,7 @@ bool Console::cmdVMVars(int argc, const char **argv) { case 4: // acc if (argc > 3) { - DebugPrintf("Too many arguments\n"); + debugPrintf("Too many arguments\n"); return true; } curValue = &s->r_acc; @@ -2435,16 +2454,16 @@ bool Console::cmdVMVars(int argc, const char **argv) { if (!setValue) { if (varType == 4) - DebugPrintf("%s == %04x:%04x", varNames[varType], PRINT_REG(*curValue)); + debugPrintf("%s == %04x:%04x", varNames[varType], PRINT_REG(*curValue)); else - DebugPrintf("%s var %d == %04x:%04x", varNames[varType], varIndex, PRINT_REG(*curValue)); + debugPrintf("%s var %d == %04x:%04x", varNames[varType], varIndex, PRINT_REG(*curValue)); printBasicVarInfo(*curValue); - DebugPrintf("\n"); + debugPrintf("\n"); } else { if (parse_reg_t(s, setValue, curValue, true)) { - DebugPrintf("Invalid value/address passed.\n"); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); - DebugPrintf("Or pass a decimal or hexadecimal value directly (e.g. 12, 1Ah)\n"); + debugPrintf("Invalid value/address passed.\n"); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Or pass a decimal or hexadecimal value directly (e.g. 12, 1Ah)\n"); return true; } } @@ -2453,13 +2472,13 @@ bool Console::cmdVMVars(int argc, const char **argv) { bool Console::cmdStack(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Lists the specified number of stack elements.\n"); - DebugPrintf("Usage: %s <elements>\n", argv[0]); + debugPrintf("Lists the specified number of stack elements.\n"); + debugPrintf("Usage: %s <elements>\n", argv[0]); return true; } if (_engine->_gamestate->_executionStack.empty()) { - DebugPrintf("No exec stack!"); + debugPrintf("No exec stack!"); return true; } @@ -2468,9 +2487,9 @@ bool Console::cmdStack(int argc, const char **argv) { for (int i = nr; i > 0; i--) { if ((xs.sp - xs.fp - i) == 0) - DebugPrintf("-- temp variables --\n"); + debugPrintf("-- temp variables --\n"); if (xs.sp - i >= _engine->_gamestate->stack_base) - DebugPrintf("ST:%04x = %04x:%04x\n", (unsigned)(xs.sp - i - _engine->_gamestate->stack_base), PRINT_REG(xs.sp[-i])); + debugPrintf("ST:%04x = %04x:%04x\n", (unsigned)(xs.sp - i - _engine->_gamestate->stack_base), PRINT_REG(xs.sp[-i])); } return true; @@ -2478,19 +2497,19 @@ bool Console::cmdStack(int argc, const char **argv) { bool Console::cmdValueType(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Determines the type of a value.\n"); - DebugPrintf("The type can be one of the following:\n"); - DebugPrintf("Invalid, list, object, reference or arithmetic\n"); - DebugPrintf("Usage: %s <address>\n", argv[0]); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Determines the type of a value.\n"); + debugPrintf("The type can be one of the following:\n"); + debugPrintf("Invalid, list, object, reference or arithmetic\n"); + debugPrintf("Usage: %s <address>\n", argv[0]); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } reg_t val; if (parse_reg_t(_engine->_gamestate, argv[1], &val, false)) { - DebugPrintf("Invalid address passed.\n"); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Invalid address passed.\n"); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } @@ -2498,22 +2517,22 @@ bool Console::cmdValueType(int argc, const char **argv) { switch (t) { case SIG_TYPE_LIST: - DebugPrintf("List"); + debugPrintf("List"); break; case SIG_TYPE_OBJECT: - DebugPrintf("Object"); + debugPrintf("Object"); break; case SIG_TYPE_REFERENCE: - DebugPrintf("Reference"); + debugPrintf("Reference"); break; case SIG_TYPE_INTEGER: - DebugPrintf("Integer"); + debugPrintf("Integer"); break; case SIG_TYPE_INTEGER | SIG_TYPE_NULL: - DebugPrintf("Null"); + debugPrintf("Null"); break; default: - DebugPrintf("Erroneous unknown type 0x%02x (%d decimal)\n", t, t); + debugPrintf("Erroneous unknown type 0x%02x (%d decimal)\n", t, t); } return true; @@ -2521,17 +2540,17 @@ bool Console::cmdValueType(int argc, const char **argv) { bool Console::cmdViewListNode(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Examines the list node at the given address.\n"); - DebugPrintf("Usage: %s <address>\n", argv[0]); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Examines the list node at the given address.\n"); + debugPrintf("Usage: %s <address>\n", argv[0]); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } reg_t addr; if (parse_reg_t(_engine->_gamestate, argv[1], &addr, false)) { - DebugPrintf("Invalid address passed.\n"); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Invalid address passed.\n"); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } @@ -2541,11 +2560,11 @@ bool Console::cmdViewListNode(int argc, const char **argv) { bool Console::cmdViewReference(int argc, const char **argv) { if (argc < 2) { - DebugPrintf("Examines an arbitrary reference.\n"); - DebugPrintf("Usage: %s <start address> [<end address>]\n", argv[0]); - DebugPrintf("Where <start address> is the starting address to examine\n"); - DebugPrintf("<end address>, if provided, is the address where examining ends at\n"); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Examines an arbitrary reference.\n"); + debugPrintf("Usage: %s <start address> [<end address>]\n", argv[0]); + debugPrintf("Where <start address> is the starting address to examine\n"); + debugPrintf("<end address>, if provided, is the address where examining ends at\n"); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } @@ -2553,15 +2572,15 @@ bool Console::cmdViewReference(int argc, const char **argv) { reg_t reg_end = NULL_REG; if (parse_reg_t(_engine->_gamestate, argv[1], ®, false)) { - DebugPrintf("Invalid address passed.\n"); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Invalid address passed.\n"); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } if (argc > 2) { if (parse_reg_t(_engine->_gamestate, argv[2], ®_end, false)) { - DebugPrintf("Invalid address passed.\n"); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Invalid address passed.\n"); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } } @@ -2570,15 +2589,15 @@ bool Console::cmdViewReference(int argc, const char **argv) { int filter; int found = 0; - DebugPrintf("%04x:%04x is of type 0x%x: ", PRINT_REG(reg), type_mask); + debugPrintf("%04x:%04x is of type 0x%x: ", PRINT_REG(reg), type_mask); if (reg.getSegment() == 0 && reg.getOffset() == 0) { - DebugPrintf("Null.\n"); + debugPrintf("Null.\n"); return true; } if (reg_end.getSegment() != reg.getSegment() && reg_end != NULL_REG) { - DebugPrintf("Ending segment different from starting segment. Assuming no bound on dump.\n"); + debugPrintf("Ending segment different from starting segment. Assuming no bound on dump.\n"); reg_end = NULL_REG; } @@ -2586,7 +2605,7 @@ bool Console::cmdViewReference(int argc, const char **argv) { int type = type_mask & filter; if (found && type) { - DebugPrintf("--- Alternatively, it could be a "); + debugPrintf("--- Alternatively, it could be a "); } @@ -2596,33 +2615,33 @@ bool Console::cmdViewReference(int argc, const char **argv) { case SIG_TYPE_LIST: { List *list = _engine->_gamestate->_segMan->lookupList(reg); - DebugPrintf("list\n"); + debugPrintf("list\n"); if (list) printList(list); else - DebugPrintf("Invalid list.\n"); + debugPrintf("Invalid list.\n"); } break; case SIG_TYPE_NODE: - DebugPrintf("list node\n"); + debugPrintf("list node\n"); printNode(reg); break; case SIG_TYPE_OBJECT: - DebugPrintf("object\n"); + debugPrintf("object\n"); printObject(reg); break; case SIG_TYPE_REFERENCE: { switch (_engine->_gamestate->_segMan->getSegmentType(reg.getSegment())) { #ifdef ENABLE_SCI32 case SEG_TYPE_STRING: { - DebugPrintf("SCI32 string\n"); + debugPrintf("SCI32 string\n"); const SciString *str = _engine->_gamestate->_segMan->lookupString(reg); Common::hexdump((const byte *) str->getRawData(), str->getSize(), 16, 0); break; } case SEG_TYPE_ARRAY: { - DebugPrintf("SCI32 array:\n"); + debugPrintf("SCI32 array:\n"); const SciArray<reg_t> *array = _engine->_gamestate->_segMan->lookupArray(reg); hexDumpReg(array->getRawData(), array->getSize(), 4, 0, true); break; @@ -2632,10 +2651,10 @@ bool Console::cmdViewReference(int argc, const char **argv) { const SegmentRef block = _engine->_gamestate->_segMan->dereference(reg); uint16 size = block.maxSize; - DebugPrintf("raw data\n"); + debugPrintf("raw data\n"); if (reg_end.getSegment() != 0 && (size < reg_end.getOffset() - reg.getOffset())) { - DebugPrintf("Block end out of bounds (size %d). Resetting.\n", size); + debugPrintf("Block end out of bounds (size %d). Resetting.\n", size); reg_end = NULL_REG; } @@ -2643,7 +2662,7 @@ bool Console::cmdViewReference(int argc, const char **argv) { size = reg_end.getOffset() - reg.getOffset(); if (reg_end.getSegment() != 0) - DebugPrintf("Block size less than or equal to %d\n", size); + debugPrintf("Block size less than or equal to %d\n", size); if (block.isRaw) Common::hexdump(block.raw, size, 16, 0); @@ -2654,14 +2673,14 @@ bool Console::cmdViewReference(int argc, const char **argv) { break; } case SIG_TYPE_INTEGER: - DebugPrintf("arithmetic value\n %d (%04x)\n", (int16) reg.getOffset(), reg.getOffset()); + debugPrintf("arithmetic value\n %d (%04x)\n", (int16) reg.getOffset(), reg.getOffset()); break; default: - DebugPrintf("unknown type %d.\n", type); + debugPrintf("unknown type %d.\n", type); } if (type) { - DebugPrintf("\n"); + debugPrintf("\n"); found = 1; } } @@ -2671,47 +2690,47 @@ bool Console::cmdViewReference(int argc, const char **argv) { bool Console::cmdViewObject(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Examines the object at the given address.\n"); - DebugPrintf("Usage: %s <address>\n", argv[0]); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Examines the object at the given address.\n"); + debugPrintf("Usage: %s <address>\n", argv[0]); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } reg_t addr; if (parse_reg_t(_engine->_gamestate, argv[1], &addr, false)) { - DebugPrintf("Invalid address passed.\n"); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Invalid address passed.\n"); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } - DebugPrintf("Information on the object at the given address:\n"); + debugPrintf("Information on the object at the given address:\n"); printObject(addr); return true; } bool Console::cmdViewActiveObject(int argc, const char **argv) { - DebugPrintf("Information on the currently active object or class:\n"); + debugPrintf("Information on the currently active object or class:\n"); printObject(_engine->_gamestate->xs->objp); return true; } bool Console::cmdViewAccumulatorObject(int argc, const char **argv) { - DebugPrintf("Information on the currently active object or class at the address indexed by the accumulator:\n"); + debugPrintf("Information on the currently active object or class at the address indexed by the accumulator:\n"); printObject(_engine->_gamestate->r_acc); return true; } bool Console::cmdScriptSteps(int argc, const char **argv) { - DebugPrintf("Number of executed SCI operations: %d\n", _engine->_gamestate->scriptStepCounter); + debugPrintf("Number of executed SCI operations: %d\n", _engine->_gamestate->scriptStepCounter); return true; } bool Console::cmdBacktrace(int argc, const char **argv) { - DebugPrintf("Call stack (current base: 0x%x):\n", _engine->_gamestate->executionStackBase); + debugPrintf("Call stack (current base: 0x%x):\n", _engine->_gamestate->executionStackBase); Common::List<ExecStack>::const_iterator iter; uint i = 0; @@ -2724,22 +2743,22 @@ 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.getSegment()]).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()); + debugPrintf("%s::%s(", objname, _engine->getKernel()->getSelectorName(call.debugSelector).c_str()); } else if (call.debugExportId != -1) { - DebugPrintf("export %d (", call.debugExportId); + debugPrintf("export %d (", call.debugExportId); } else if (call.debugLocalCallOffset != -1) { - DebugPrintf("call %x (", call.debugLocalCallOffset); + debugPrintf("call %x (", call.debugLocalCallOffset); } break; case EXEC_STACK_TYPE_KERNEL: // Kernel function - DebugPrintf(" %x:[%x] k%s(", i, call.debugOrigin, _engine->getKernel()->getKernelName(call.debugSelector).c_str()); + debugPrintf(" %x:[%x] k%s(", i, call.debugOrigin, _engine->getKernel()->getKernelName(call.debugSelector).c_str()); break; case EXEC_STACK_TYPE_VARSELECTOR: - DebugPrintf(" %x:[%x] vs%s %s::%s (", i, call.debugOrigin, (call.argc) ? "write" : "read", + debugPrintf(" %x:[%x] vs%s %s::%s (", i, call.debugOrigin, (call.argc) ? "write" : "read", objname, _engine->getKernel()->getSelectorName(call.debugSelector).c_str()); break; } @@ -2750,32 +2769,32 @@ bool Console::cmdBacktrace(int argc, const char **argv) { totalparamc = 16; for (paramc = 1; paramc <= totalparamc; paramc++) { - DebugPrintf("%04x:%04x", PRINT_REG(call.variables_argp[paramc])); + debugPrintf("%04x:%04x", PRINT_REG(call.variables_argp[paramc])); if (paramc < call.argc) - DebugPrintf(", "); + debugPrintf(", "); } if (call.argc > 16) - DebugPrintf("..."); + debugPrintf("..."); - DebugPrintf(")\n "); + debugPrintf(")\n "); if (call.debugOrigin != -1) - DebugPrintf("by %x ", call.debugOrigin); - DebugPrintf("obj@%04x:%04x", PRINT_REG(call.objp)); + debugPrintf("by %x ", call.debugOrigin); + debugPrintf("obj@%04x:%04x", PRINT_REG(call.objp)); if (call.type == EXEC_STACK_TYPE_CALL) { - DebugPrintf(" pc=%04x:%04x", PRINT_REG(call.addr.pc)); + debugPrintf(" pc=%04x:%04x", PRINT_REG(call.addr.pc)); if (call.sp == CALL_SP_CARRY) - DebugPrintf(" sp,fp:carry"); + debugPrintf(" sp,fp:carry"); else { - DebugPrintf(" sp=ST:%04x", (unsigned)(call.sp - _engine->_gamestate->stack_base)); - DebugPrintf(" fp=ST:%04x", (unsigned)(call.fp - _engine->_gamestate->stack_base)); + debugPrintf(" sp=ST:%04x", (unsigned)(call.sp - _engine->_gamestate->stack_base)); + debugPrintf(" fp=ST:%04x", (unsigned)(call.fp - _engine->_gamestate->stack_base)); } } else - DebugPrintf(" pc:none"); + debugPrintf(" pc:none"); - DebugPrintf(" argp:ST:%04x", (unsigned)(call.variables_argp - _engine->_gamestate->stack_base)); - DebugPrintf("\n"); + debugPrintf(" argp:ST:%04x", (unsigned)(call.variables_argp - _engine->_gamestate->stack_base)); + debugPrintf("\n"); } return true; @@ -2786,7 +2805,7 @@ bool Console::cmdTrace(int argc, const char **argv) { _debugState.runningStep = atoi(argv[1]) - 1; _debugState.debugging = true; - return Cmd_Exit(0, 0); + return cmdExit(0, 0); } bool Console::cmdStepOver(int argc, const char **argv) { @@ -2794,14 +2813,14 @@ bool Console::cmdStepOver(int argc, const char **argv) { _debugState.seekLevel = _engine->_gamestate->_executionStack.size(); _debugState.debugging = true; - return Cmd_Exit(0, 0); + return cmdExit(0, 0); } bool Console::cmdStepEvent(int argc, const char **argv) { _debugState.stopOnEvent = true; _debugState.debugging = true; - return Cmd_Exit(0, 0); + return cmdExit(0, 0); } bool Console::cmdStepRet(int argc, const char **argv) { @@ -2809,13 +2828,13 @@ bool Console::cmdStepRet(int argc, const char **argv) { _debugState.seekLevel = _engine->_gamestate->_executionStack.size() - 1; _debugState.debugging = true; - return Cmd_Exit(0, 0); + return cmdExit(0, 0); } bool Console::cmdStepGlobal(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Steps until the global variable with the specified index is modified.\n"); - DebugPrintf("Usage: %s <global variable index>\n", argv[0]); + debugPrintf("Steps until the global variable with the specified index is modified.\n"); + debugPrintf("Usage: %s <global variable index>\n", argv[0]); return true; } @@ -2823,7 +2842,7 @@ bool Console::cmdStepGlobal(int argc, const char **argv) { _debugState.seekSpecial = atoi(argv[1]); _debugState.debugging = true; - return Cmd_Exit(0, 0); + return cmdExit(0, 0); } bool Console::cmdStepCallk(int argc, const char **argv) { @@ -2844,7 +2863,7 @@ bool Console::cmdStepCallk(int argc, const char **argv) { } if (callk_index == -1) { - DebugPrintf("Unknown kernel function '%s'\n", argv[1]); + debugPrintf("Unknown kernel function '%s'\n", argv[1]); return true; } } @@ -2856,16 +2875,16 @@ bool Console::cmdStepCallk(int argc, const char **argv) { } _debugState.debugging = true; - return Cmd_Exit(0, 0); + return cmdExit(0, 0); } bool Console::cmdDisassemble(int argc, const char **argv) { if (argc < 3) { - DebugPrintf("Disassembles a method by name.\n"); - DebugPrintf("Usage: %s <object> <method> <options>\n", argv[0]); - DebugPrintf("Valid options are:\n"); - DebugPrintf(" bwt : Print byte/word tag\n"); - DebugPrintf(" bc : Print bytecode\n"); + debugPrintf("Disassembles a method by name.\n"); + debugPrintf("Usage: %s <object> <method> <options>\n", argv[0]); + debugPrintf("Valid options are:\n"); + debugPrintf(" bwt : Print byte/word tag\n"); + debugPrintf(" bc : Print bytecode\n"); return true; } @@ -2874,8 +2893,8 @@ bool Console::cmdDisassemble(int argc, const char **argv) { bool printBWTag = false; if (parse_reg_t(_engine->_gamestate, argv[1], &objAddr, false)) { - DebugPrintf("Invalid address passed.\n"); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Invalid address passed.\n"); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } @@ -2884,17 +2903,17 @@ bool Console::cmdDisassemble(int argc, const char **argv) { reg_t addr = NULL_REG; if (!obj) { - DebugPrintf("Not an object.\n"); + debugPrintf("Not an object.\n"); return true; } if (selectorId < 0) { - DebugPrintf("Not a valid selector name.\n"); + debugPrintf("Not a valid selector name.\n"); return true; } if (lookupSelector(_engine->_gamestate->_segMan, objAddr, selectorId, NULL, &addr) != kSelectorMethod) { - DebugPrintf("Not a method.\n"); + debugPrintf("Not a method.\n"); return true; } @@ -2924,12 +2943,12 @@ bool Console::cmdDisassemble(int argc, const char **argv) { bool Console::cmdDisassembleAddress(int argc, const char **argv) { if (argc < 2) { - DebugPrintf("Disassembles one or more commands.\n"); - DebugPrintf("Usage: %s [startaddr] <options>\n", argv[0]); - DebugPrintf("Valid options are:\n"); - DebugPrintf(" bwt : Print byte/word tag\n"); - DebugPrintf(" c<x> : Disassemble <x> bytes\n"); - DebugPrintf(" bc : Print bytecode\n"); + debugPrintf("Disassembles one or more commands.\n"); + debugPrintf("Usage: %s [startaddr] <options>\n", argv[0]); + debugPrintf("Valid options are:\n"); + debugPrintf(" bwt : Print byte/word tag\n"); + debugPrintf(" c<x> : Disassemble <x> bytes\n"); + debugPrintf(" bc : Print bytecode\n"); return true; } @@ -2940,8 +2959,8 @@ bool Console::cmdDisassembleAddress(int argc, const char **argv) { uint16 size; if (parse_reg_t(_engine->_gamestate, argv[1], &vpc, false)) { - DebugPrintf("Invalid address passed.\n"); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Invalid address passed.\n"); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } @@ -2956,7 +2975,7 @@ bool Console::cmdDisassembleAddress(int argc, const char **argv) { else if (toupper(argv[i][0]) == 'C') opCount = atoi(argv[i] + 1); else { - DebugPrintf("Invalid option '%s'\n", argv[i]); + debugPrintf("Invalid option '%s'\n", argv[i]); return true; } } @@ -2974,13 +2993,13 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) { Common::sort(resources.begin(), resources.end()); if (showFoundScripts) - DebugPrintf("%d scripts found, dissassembling...\n", resources.size()); + debugPrintf("%d scripts found, dissassembling...\n", resources.size()); int scriptSegment; Script *script; // Create a custom segment manager here, so that the game's segment // manager won't be affected by loading and unloading scripts here. - SegManager *customSegMan = new SegManager(_engine->getResMan()); + SegManager *customSegMan = new SegManager(_engine->getResMan(), _engine->getScriptPatcher()); Common::List<ResourceId>::iterator itr; for (itr = resources.begin(); itr != resources.end(); ++itr) { @@ -3023,7 +3042,7 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) { uint16 argc2 = opparams[1]; if (kFuncNum == kernelFuncNum) { - DebugPrintf("Called from script %d, object %s, method %s(%d) with %d bytes for arguments\n", + debugPrintf("Called from script %d, object %s, method %s(%d) with %d bytes for arguments\n", itr->getNumber(), objName, _engine->getKernel()->getSelectorName(obj->getFuncSelector(i)).c_str(), i, argc2); } @@ -3055,19 +3074,19 @@ void Console::printKernelCallsFound(int kernelFuncNum, bool showFoundScripts) { bool Console::cmdFindKernelFunctionCall(int argc, const char **argv) { if (argc < 2) { - DebugPrintf("Finds the scripts and methods that call a specific kernel function.\n"); - DebugPrintf("Usage: %s <kernel function>\n", argv[0]); - DebugPrintf("Example: %s Display\n", argv[0]); - DebugPrintf("Special usage:\n"); - DebugPrintf("%s Dummy - find all calls to actual dummy functions " + debugPrintf("Finds the scripts and methods that call a specific kernel function.\n"); + debugPrintf("Usage: %s <kernel function>\n", argv[0]); + debugPrintf("Example: %s Display\n", argv[0]); + debugPrintf("Special usage:\n"); + debugPrintf("%s Dummy - find all calls to actual dummy functions " "(mapped to kDummy, and dummy in the kernel table). " "There shouldn't be calls to these (apart from a known " "one in Shivers)\n", argv[0]); - DebugPrintf("%s Unused - find all calls to unused functions (mapped to " + debugPrintf("%s Unused - find all calls to unused functions (mapped to " "kDummy - i.e. mapped in SSCI but dummy in ScummVM, thus " "they'll error out when called). Only debug scripts should " "be calling these\n", argv[0]); - DebugPrintf("%s Unmapped - find all calls to currently unmapped or " + debugPrintf("%s Unmapped - find all calls to currently unmapped or " "unimplemented functions (mapped to kStub/kStubNull)\n", argv[0]); return true; } @@ -3080,7 +3099,7 @@ bool Console::cmdFindKernelFunctionCall(int argc, const char **argv) { int kernelFuncNum = kernel->findKernelFuncPos(argv[1]); if (kernelFuncNum < 0) { - DebugPrintf("Invalid kernel function requested\n"); + debugPrintf("Invalid kernel function requested\n"); return true; } @@ -3090,7 +3109,7 @@ bool Console::cmdFindKernelFunctionCall(int argc, const char **argv) { // in the kernel table) for (uint i = 0; i < kernel->_kernelFuncs.size(); i++) { if (kernel->_kernelFuncs[i].function == &kDummy && kernel->getKernelName(i) == "Dummy") { - DebugPrintf("Searching for kernel function %d (%s)...\n", i, kernel->getKernelName(i).c_str()); + debugPrintf("Searching for kernel function %d (%s)...\n", i, kernel->getKernelName(i).c_str()); printKernelCallsFound(i, false); } } @@ -3100,7 +3119,7 @@ bool Console::cmdFindKernelFunctionCall(int argc, const char **argv) { // called) for (uint i = 0; i < kernel->_kernelFuncs.size(); i++) { if (kernel->_kernelFuncs[i].function == &kDummy && kernel->getKernelName(i) != "Dummy") { - DebugPrintf("Searching for kernel function %d (%s)...\n", i, kernel->getKernelName(i).c_str()); + debugPrintf("Searching for kernel function %d (%s)...\n", i, kernel->getKernelName(i).c_str()); printKernelCallsFound(i, false); } } @@ -3109,7 +3128,7 @@ bool Console::cmdFindKernelFunctionCall(int argc, const char **argv) { for (uint i = 0; i < kernel->_kernelFuncs.size(); i++) { if (kernel->_kernelFuncs[i].function == &kStub || kernel->_kernelFuncs[i].function == &kStubNull) { - DebugPrintf("Searching for kernel function %d (%s)...\n", i, kernel->getKernelName(i).c_str()); + debugPrintf("Searching for kernel function %d (%s)...\n", i, kernel->getKernelName(i).c_str()); printKernelCallsFound(i, false); } } @@ -3120,17 +3139,17 @@ bool Console::cmdFindKernelFunctionCall(int argc, const char **argv) { bool Console::cmdSend(int argc, const char **argv) { if (argc < 3) { - DebugPrintf("Sends a message to an object.\n"); - DebugPrintf("Usage: %s <object> <selector name> <param1> <param2> ... <paramn>\n", argv[0]); - DebugPrintf("Example: %s ?fooScript cue\n", argv[0]); + debugPrintf("Sends a message to an object.\n"); + debugPrintf("Usage: %s <object> <selector name> <param1> <param2> ... <paramn>\n", argv[0]); + debugPrintf("Example: %s ?fooScript cue\n", argv[0]); return true; } reg_t object; if (parse_reg_t(_engine->_gamestate, argv[1], &object, false)) { - DebugPrintf("Invalid address \"%s\" passed.\n", argv[1]); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Invalid address \"%s\" passed.\n", argv[1]); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } @@ -3138,20 +3157,20 @@ bool Console::cmdSend(int argc, const char **argv) { int selectorId = _engine->getKernel()->findSelector(selectorName); if (selectorId < 0) { - DebugPrintf("Unknown selector: \"%s\"\n", selectorName); + debugPrintf("Unknown selector: \"%s\"\n", selectorName); return true; } const Object *o = _engine->_gamestate->_segMan->getObject(object); if (o == NULL) { - DebugPrintf("Address \"%04x:%04x\" is not an object\n", PRINT_REG(object)); + debugPrintf("Address \"%04x:%04x\" is not an object\n", PRINT_REG(object)); return true; } SelectorType selector_type = lookupSelector(_engine->_gamestate->_segMan, object, selectorId, NULL, NULL); if (selector_type == kSelectorNone) { - DebugPrintf("Object does not support selector: \"%s\"\n", selectorName); + debugPrintf("Object does not support selector: \"%s\"\n", selectorName); return true; } @@ -3165,8 +3184,8 @@ bool Console::cmdSend(int argc, const char **argv) { stackframe[1] = make_reg(0, send_argc); for (int i = 0; i < send_argc; i++) { if (parse_reg_t(_engine->_gamestate, argv[3+i], &stackframe[2+i], false)) { - DebugPrintf("Invalid address \"%s\" passed.\n", argv[3+i]); - DebugPrintf("Check the \"addresses\" command on how to use addresses\n"); + debugPrintf("Invalid address \"%s\" passed.\n", argv[3+i]); + debugPrintf("Check the \"addresses\" command on how to use addresses\n"); return true; } } @@ -3184,7 +3203,7 @@ bool Console::cmdSend(int argc, const char **argv) { if (old_xstack != xstack) { _engine->_gamestate->_executionStackPosChanged = true; - DebugPrintf("Message scheduled for execution\n"); + debugPrintf("Message scheduled for execution\n"); // We call run_engine explictly so we can restore the value of r_acc // after execution. @@ -3194,7 +3213,7 @@ bool Console::cmdSend(int argc, const char **argv) { if (restore_acc) { // varselector read or message executed - DebugPrintf("Message completed. Value returned: %04x:%04x\n", PRINT_REG(_engine->_gamestate->r_acc)); + debugPrintf("Message completed. Value returned: %04x:%04x\n", PRINT_REG(_engine->_gamestate->r_acc)); _engine->_gamestate->r_acc = old_acc; } @@ -3205,14 +3224,14 @@ bool Console::cmdGo(int argc, const char **argv) { // CHECKME: is this necessary? _debugState.seeking = kDebugSeekNothing; - return Cmd_Exit(argc, argv); + return cmdExit(argc, argv); } bool Console::cmdLogKernel(int argc, const char **argv) { if (argc < 3) { - DebugPrintf("Logs calls to specified kernel function.\n"); - DebugPrintf("Usage: %s <kernel function/*> <on/off>\n", argv[0]); - DebugPrintf("Example: %s StrCpy on\n", argv[0]); + debugPrintf("Logs calls to specified kernel function.\n"); + debugPrintf("Usage: %s <kernel function/*> <on/off>\n", argv[0]); + debugPrintf("Example: %s StrCpy on\n", argv[0]); return true; } @@ -3222,14 +3241,14 @@ bool Console::cmdLogKernel(int argc, const char **argv) { else if (strcmp(argv[2], "off") == 0) logging = false; else { - DebugPrintf("2nd parameter must be either on or off\n"); + debugPrintf("2nd parameter must be either on or off\n"); return true; } if (g_sci->getKernel()->debugSetFunction(argv[1], logging, -1)) - DebugPrintf("Logging %s for k%s\n", logging ? "enabled" : "disabled", argv[1]); + debugPrintf("Logging %s for k%s\n", logging ? "enabled" : "disabled", argv[1]); else - DebugPrintf("Unknown kernel function %s\n", argv[1]); + debugPrintf("Unknown kernel function %s\n", argv[1]); return true; } @@ -3237,25 +3256,25 @@ bool Console::cmdBreakpointList(int argc, const char **argv) { int i = 0; int bpdata; - DebugPrintf("Breakpoint list:\n"); + debugPrintf("Breakpoint list:\n"); Common::List<Breakpoint>::const_iterator bp = _debugState._breakpoints.begin(); Common::List<Breakpoint>::const_iterator end = _debugState._breakpoints.end(); for (; bp != end; ++bp) { - DebugPrintf(" #%i: ", i); + debugPrintf(" #%i: ", i); switch (bp->type) { case BREAK_SELECTOREXEC: - DebugPrintf("Execute %s\n", bp->name.c_str()); + debugPrintf("Execute %s\n", bp->name.c_str()); break; case BREAK_SELECTORREAD: - DebugPrintf("Read %s\n", bp->name.c_str()); + debugPrintf("Read %s\n", bp->name.c_str()); break; case BREAK_SELECTORWRITE: - DebugPrintf("Write %s\n", bp->name.c_str()); + debugPrintf("Write %s\n", bp->name.c_str()); break; case BREAK_EXPORT: bpdata = bp->address; - DebugPrintf("Execute script %d, export %d\n", bpdata >> 16, bpdata & 0xFFFF); + debugPrintf("Execute script %d, export %d\n", bpdata >> 16, bpdata & 0xFFFF); break; } @@ -3263,16 +3282,16 @@ bool Console::cmdBreakpointList(int argc, const char **argv) { } if (!i) - DebugPrintf(" No breakpoints defined.\n"); + debugPrintf(" No breakpoints defined.\n"); return true; } bool Console::cmdBreakpointDelete(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Deletes a breakpoint with the specified index.\n"); - DebugPrintf("Usage: %s <breakpoint index>\n", argv[0]); - DebugPrintf("<index> * will remove all breakpoints\n"); + debugPrintf("Deletes a breakpoint with the specified index.\n"); + debugPrintf("Usage: %s <breakpoint index>\n", argv[0]); + debugPrintf("<index> * will remove all breakpoints\n"); return true; } @@ -3292,7 +3311,7 @@ bool Console::cmdBreakpointDelete(int argc, const char **argv) { } if (bp == end) { - DebugPrintf("Invalid breakpoint index %i\n", idx); + debugPrintf("Invalid breakpoint index %i\n", idx); return true; } @@ -3312,11 +3331,11 @@ bool Console::cmdBreakpointDelete(int argc, const char **argv) { bool Console::cmdBreakpointMethod(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Sets a breakpoint on execution of a specified method/selector.\n"); - DebugPrintf("Usage: %s <name>\n", argv[0]); - DebugPrintf("Example: %s ego::doit\n", argv[0]); - DebugPrintf("May also be used to set a breakpoint that applies whenever an object\n"); - DebugPrintf("of a specific type is touched: %s foo::\n", argv[0]); + debugPrintf("Sets a breakpoint on execution of a specified method/selector.\n"); + debugPrintf("Usage: %s <name>\n", argv[0]); + debugPrintf("Example: %s ego::doit\n", argv[0]); + debugPrintf("May also be used to set a breakpoint that applies whenever an object\n"); + debugPrintf("of a specific type is touched: %s foo::\n", argv[0]); return true; } @@ -3334,9 +3353,9 @@ bool Console::cmdBreakpointMethod(int argc, const char **argv) { bool Console::cmdBreakpointRead(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Sets a breakpoint on reading of a specified selector.\n"); - DebugPrintf("Usage: %s <name>\n", argv[0]); - DebugPrintf("Example: %s ego::view\n", argv[0]); + debugPrintf("Sets a breakpoint on reading of a specified selector.\n"); + debugPrintf("Usage: %s <name>\n", argv[0]); + debugPrintf("Example: %s ego::view\n", argv[0]); return true; } @@ -3351,9 +3370,9 @@ bool Console::cmdBreakpointRead(int argc, const char **argv) { bool Console::cmdBreakpointWrite(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Sets a breakpoint on writing of a specified selector.\n"); - DebugPrintf("Usage: %s <name>\n", argv[0]); - DebugPrintf("Example: %s ego::view\n", argv[0]); + debugPrintf("Sets a breakpoint on writing of a specified selector.\n"); + debugPrintf("Usage: %s <name>\n", argv[0]); + debugPrintf("Example: %s ego::view\n", argv[0]); return true; } @@ -3368,9 +3387,9 @@ bool Console::cmdBreakpointWrite(int argc, const char **argv) { bool Console::cmdBreakpointKernel(int argc, const char **argv) { if (argc < 3) { - DebugPrintf("Sets a breakpoint on execution of a kernel function.\n"); - DebugPrintf("Usage: %s <name> <on/off>\n", argv[0]); - DebugPrintf("Example: %s DrawPic on\n", argv[0]); + debugPrintf("Sets a breakpoint on execution of a kernel function.\n"); + debugPrintf("Usage: %s <name> <on/off>\n", argv[0]); + debugPrintf("Example: %s DrawPic on\n", argv[0]); return true; } @@ -3380,22 +3399,22 @@ bool Console::cmdBreakpointKernel(int argc, const char **argv) { else if (strcmp(argv[2], "off") == 0) breakpoint = false; else { - DebugPrintf("2nd parameter must be either on or off\n"); + debugPrintf("2nd parameter must be either on or off\n"); return true; } if (g_sci->getKernel()->debugSetFunction(argv[1], -1, breakpoint)) - DebugPrintf("Breakpoint %s for k%s\n", (breakpoint ? "enabled" : "disabled"), argv[1]); + debugPrintf("Breakpoint %s for k%s\n", (breakpoint ? "enabled" : "disabled"), argv[1]); else - DebugPrintf("Unknown kernel function %s\n", argv[1]); + debugPrintf("Unknown kernel function %s\n", argv[1]); return true; } bool Console::cmdBreakpointFunction(int argc, const char **argv) { if (argc != 3) { - DebugPrintf("Sets a breakpoint on the execution of the specified exported function.\n"); - DebugPrintf("Usage: %s <script number> <export number\n", argv[0]); + debugPrintf("Sets a breakpoint on the execution of the specified exported function.\n"); + debugPrintf("Usage: %s <script number> <export number\n", argv[0]); return true; } @@ -3415,21 +3434,21 @@ bool Console::cmdBreakpointFunction(int argc, const char **argv) { bool Console::cmdSfx01Header(int argc, const char **argv) { if (argc != 2) { - DebugPrintf("Dumps the header of a SCI01 song\n"); - DebugPrintf("Usage: %s <track>\n", argv[0]); + debugPrintf("Dumps the header of a SCI01 song\n"); + debugPrintf("Usage: %s <track>\n", argv[0]); return true; } Resource *song = _engine->getResMan()->findResource(ResourceId(kResourceTypeSound, atoi(argv[1])), 0); if (!song) { - DebugPrintf("Doesn't exist\n"); + debugPrintf("Doesn't exist\n"); return true; } uint32 offset = 0; - DebugPrintf("SCI01 song track mappings:\n"); + debugPrintf("SCI01 song track mappings:\n"); if (*song->data == 0xf0) // SCI1 priority spec offset = 8; @@ -3439,7 +3458,7 @@ bool Console::cmdSfx01Header(int argc, const char **argv) { while (song->data[offset] != 0xff) { byte device_id = song->data[offset]; - DebugPrintf("* Device %02x:\n", device_id); + debugPrintf("* Device %02x:\n", device_id); offset++; if (offset + 1 >= song->size) @@ -3461,12 +3480,12 @@ bool Console::cmdSfx01Header(int argc, const char **argv) { track_offset += 2; end = READ_LE_UINT16(song->data + offset + 2); - DebugPrintf(" - %04x -- %04x", track_offset, track_offset + end); + debugPrintf(" - %04x -- %04x", track_offset, track_offset + end); if (track_offset == 0xfe) - DebugPrintf(" (PCM data)\n"); + debugPrintf(" (PCM data)\n"); else - DebugPrintf(" (channel %d, special %d, %d playing notes, %d foo)\n", + debugPrintf(" (channel %d, special %d, %d playing notes, %d foo)\n", header1 & 0xf, header1 >> 4, header2 & 0xf, header2 >> 4); offset += 4; } @@ -3580,8 +3599,8 @@ static void midi_hexdump(byte *data, int size, int notational_offset) { bool Console::cmdSfx01Track(int argc, const char **argv) { if (argc != 3) { - DebugPrintf("Dumps a track of a SCI01 song\n"); - DebugPrintf("Usage: %s <track> <offset>\n", argv[0]); + debugPrintf("Dumps a track of a SCI01 song\n"); + debugPrintf("Usage: %s <track> <offset>\n", argv[0]); return true; } @@ -3590,7 +3609,7 @@ bool Console::cmdSfx01Track(int argc, const char **argv) { int offset = atoi(argv[2]); if (!song) { - DebugPrintf("Doesn't exist\n"); + debugPrintf("Doesn't exist\n"); return true; } @@ -3614,29 +3633,29 @@ bool Console::cmdQuit(int argc, const char **argv) { _debugState.runningStep = 0; } else { - DebugPrintf("%s [game] - exit gracefully\n", argv[0]); - DebugPrintf("%s now - exit ungracefully\n", argv[0]); + debugPrintf("%s [game] - exit gracefully\n", argv[0]); + debugPrintf("%s now - exit ungracefully\n", argv[0]); return true; } - return Cmd_Exit(0, 0); + return cmdExit(0, 0); } bool Console::cmdAddresses(int argc, const char **argv) { - DebugPrintf("Address parameters may be passed in one of three forms:\n"); - DebugPrintf(" - ssss:oooo -- where 'ssss' denotes a segment and 'oooo' an offset.\n"); - DebugPrintf(" Example: \"a:c5\" would address something in segment 0xa at offset 0xc5.\n"); - DebugPrintf(" - &scr:oooo -- where 'scr' is a script number and oooo an offset within that script; will\n"); - DebugPrintf(" fail if the script is not currently loaded\n"); - DebugPrintf(" - $REG -- where 'REG' is one of 'PC', 'ACC', 'PREV' or 'OBJ': References the address\n"); - DebugPrintf(" indicated by the register of this name.\n"); - DebugPrintf(" - $REG+n (or -n) -- Like $REG, but modifies the offset part by a specific amount (which\n"); - DebugPrintf(" is specified in hexadecimal).\n"); - DebugPrintf(" - ?obj -- Looks up an object with the specified name, uses its address. This will abort if\n"); - DebugPrintf(" the object name is ambiguous; in that case, a list of addresses and indices is provided.\n"); - DebugPrintf(" ?obj.idx may be used to disambiguate 'obj' by the index 'idx'.\n"); - DebugPrintf(" Underscores are used as substitute characters for spaces in object names.\n"); - DebugPrintf(" For example, an object named \"Glass Jar\" can be accessed as \"Glass_Jar\".\n"); + debugPrintf("Address parameters may be passed in one of three forms:\n"); + debugPrintf(" - ssss:oooo -- where 'ssss' denotes a segment and 'oooo' an offset.\n"); + debugPrintf(" Example: \"a:c5\" would address something in segment 0xa at offset 0xc5.\n"); + debugPrintf(" - &scr:oooo -- where 'scr' is a script number and oooo an offset within that script; will\n"); + debugPrintf(" fail if the script is not currently loaded\n"); + debugPrintf(" - $REG -- where 'REG' is one of 'PC', 'ACC', 'PREV' or 'OBJ': References the address\n"); + debugPrintf(" indicated by the register of this name.\n"); + debugPrintf(" - $REG+n (or -n) -- Like $REG, but modifies the offset part by a specific amount (which\n"); + debugPrintf(" is specified in hexadecimal).\n"); + debugPrintf(" - ?obj -- Looks up an object with the specified name, uses its address. This will abort if\n"); + debugPrintf(" the object name is ambiguous; in that case, a list of addresses and indices is provided.\n"); + debugPrintf(" ?obj.idx may be used to disambiguate 'obj' by the index 'idx'.\n"); + debugPrintf(" Underscores are used as substitute characters for spaces in object names.\n"); + debugPrintf(" For example, an object named \"Glass Jar\" can be accessed as \"Glass_Jar\".\n"); return true; } @@ -3840,10 +3859,15 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV const char *tmp = Common::find(str_objname.begin(), str_objname.end(), '.'); if (tmp != str_objname.end()) { index = strtol(tmp + 1, &endptr, 16); - if (*endptr) - return -1; - // Chop off the index - str_objname = Common::String(str_objname.c_str(), tmp); + if (*endptr) { + // The characters after the dot do not represent an index. + // This can happen if an object contains a dot in its name, + // like 'dominoes.opt' in Hoyle 3. + index = -1; + } else { + // Valid index found, chop it off + str_objname = Common::String(str_objname.c_str(), tmp); + } } // Replace all underscores in the name with spaces @@ -3882,14 +3906,14 @@ bool Console::parseInteger(const char *argument, int &result) { // hexadecimal number result = strtol(argument, &endPtr, 16); if ((*endPtr != 0) && (*endPtr != 'h')) { - DebugPrintf("Invalid hexadecimal number '%s'\n", argument); + debugPrintf("Invalid hexadecimal number '%s'\n", argument); return false; } } else { // decimal number result = strtol(argument, &endPtr, 10); if (*endPtr != 0) { - DebugPrintf("Invalid decimal number '%s'\n", argument); + debugPrintf("Invalid decimal number '%s'\n", argument); return false; } } @@ -3907,57 +3931,57 @@ void Console::printBasicVarInfo(reg_t variable) { case SIG_TYPE_INTEGER: { uint16 content = variable.toUint16(); if (content >= 10) - DebugPrintf(" (%dd)", content); + debugPrintf(" (%dd)", content); break; } case SIG_TYPE_OBJECT: - DebugPrintf(" (object '%s')", segMan->getObjectName(variable)); + debugPrintf(" (object '%s')", segMan->getObjectName(variable)); break; case SIG_TYPE_REFERENCE: - DebugPrintf(" (reference)"); + debugPrintf(" (reference)"); break; case SIG_TYPE_NODE: - DebugPrintf(" (node)"); + debugPrintf(" (node)"); break; case SIG_TYPE_LIST: - DebugPrintf(" (list)"); + debugPrintf(" (list)"); break; case SIG_TYPE_UNINITIALIZED: - DebugPrintf(" (uninitialized)"); + debugPrintf(" (uninitialized)"); break; case SIG_TYPE_ERROR: - DebugPrintf(" (error)"); + debugPrintf(" (error)"); break; default: - DebugPrintf(" (??\?)"); + debugPrintf(" (??\?)"); } if (regType & SIG_IS_INVALID) - DebugPrintf(" IS INVALID!"); + debugPrintf(" IS INVALID!"); } void Console::printList(List *list) { reg_t pos = list->first; reg_t my_prev = NULL_REG; - DebugPrintf("\t<\n"); + debugPrintf("\t<\n"); while (!pos.isNull()) { Node *node; NodeTable *nt = (NodeTable *)_engine->_gamestate->_segMan->getSegment(pos.getSegment(), SEG_TYPE_NODES); if (!nt || !nt->isValidEntry(pos.getOffset())) { - DebugPrintf(" WARNING: %04x:%04x: Doesn't contain list node!\n", + debugPrintf(" WARNING: %04x:%04x: Doesn't contain list node!\n", PRINT_REG(pos)); return; } 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)); + debugPrintf("\t%04x:%04x : %04x:%04x -> %04x:%04x\n", PRINT_REG(pos), PRINT_REG(node->key), PRINT_REG(node->value)); if (my_prev != node->pred) - DebugPrintf(" WARNING: current node gives %04x:%04x as predecessor!\n", + debugPrintf(" WARNING: current node gives %04x:%04x as predecessor!\n", PRINT_REG(node->pred)); my_prev = pos; @@ -3965,9 +3989,9 @@ void Console::printList(List *list) { } if (my_prev != list->last) - DebugPrintf(" WARNING: Last node was expected to be %04x:%04x, was %04x:%04x!\n", + debugPrintf(" WARNING: Last node was expected to be %04x:%04x, was %04x:%04x!\n", PRINT_REG(list->last), PRINT_REG(my_prev)); - DebugPrintf("\t>\n"); + debugPrintf("\t>\n"); } int Console::printNode(reg_t addr) { @@ -3978,32 +4002,32 @@ int Console::printNode(reg_t addr) { List *list; if (!lt->isValidEntry(addr.getOffset())) { - DebugPrintf("Address does not contain a list\n"); + debugPrintf("Address does not contain a list\n"); return 1; } 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)); + 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.getSegment(), SEG_TYPE_NODES); if (!mobj) { - DebugPrintf("Segment #%04x is not a list or node segment\n", addr.getSegment()); + debugPrintf("Segment #%04x is not a list or node segment\n", addr.getSegment()); return 1; } nt = (NodeTable *)mobj; if (!nt->isValidEntry(addr.getOffset())) { - DebugPrintf("Address does not contain a node\n"); + debugPrintf("Address does not contain a node\n"); return 1; } node = &(nt->_table[addr.getOffset()]); - DebugPrintf("%04x:%04x : prev x next = (%04x:%04x, %04x:%04x); maps %04x:%04x -> %04x:%04x\n", + 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)); } @@ -4017,44 +4041,44 @@ int Console::printObject(reg_t pos) { uint i; if (!obj) { - DebugPrintf("[%04x:%04x]: Not an object.", PRINT_REG(pos)); + debugPrintf("[%04x:%04x]: Not an object.", PRINT_REG(pos)); return 1; } // Object header - DebugPrintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(pos), s->_segMan->getObjectName(pos), + debugPrintf("[%04x:%04x] %s : %3d vars, %3d methods\n", PRINT_REG(pos), s->_segMan->getObjectName(pos), obj->getVarCount(), obj->getMethodCount()); if (!obj->isClass() && getSciVersion() != SCI_VERSION_3) var_container = s->_segMan->getObject(obj->getSuperClassSelector()); - DebugPrintf(" -- member variables:\n"); + debugPrintf(" -- member variables:\n"); for (i = 0; (uint)i < obj->getVarCount(); i++) { - DebugPrintf(" "); + debugPrintf(" "); if (var_container && i < var_container->getVarCount()) { uint16 varSelector = var_container->getVarSelector(i); - DebugPrintf("[%03x] %s = ", varSelector, _engine->getKernel()->getSelectorName(varSelector).c_str()); + debugPrintf("[%03x] %s = ", varSelector, _engine->getKernel()->getSelectorName(varSelector).c_str()); } else - DebugPrintf("p#%x = ", i); + debugPrintf("p#%x = ", i); reg_t val = obj->getVariable(i); - DebugPrintf("%04x:%04x", PRINT_REG(val)); + debugPrintf("%04x:%04x", PRINT_REG(val)); if (!val.getSegment()) - DebugPrintf(" (%d)", val.getOffset()); + debugPrintf(" (%d)", val.getOffset()); const Object *ref = s->_segMan->getObject(val); if (ref) - DebugPrintf(" (%s)", s->_segMan->getObjectName(val)); + debugPrintf(" (%s)", s->_segMan->getObjectName(val)); - DebugPrintf("\n"); + debugPrintf("\n"); } - DebugPrintf(" -- methods:\n"); + debugPrintf(" -- methods:\n"); for (i = 0; i < obj->getMethodCount(); i++) { 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)); + 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.getSegment()]->getType() == SEG_TYPE_SCRIPT) - DebugPrintf("\nOwner script: %d\n", s->_segMan->getScript(pos.getSegment())->getScriptNumber()); + debugPrintf("\nOwner script: %d\n", s->_segMan->getScript(pos.getSegment())->getScriptNumber()); return 0; } |