2009-02-20 21:26:31 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Console module header file
|
|
|
|
|
|
|
|
#ifndef SCI_CONSOLE_H
|
|
|
|
#define SCI_CONSOLE_H
|
|
|
|
|
|
|
|
#include "gui/debugger.h"
|
2009-08-17 07:36:08 +00:00
|
|
|
#include "sci/engine/vm.h"
|
2009-02-20 21:26:31 +00:00
|
|
|
|
|
|
|
namespace Sci {
|
|
|
|
|
2009-02-21 09:45:34 +00:00
|
|
|
class SciEngine;
|
2009-06-04 11:45:17 +00:00
|
|
|
struct List;
|
2009-02-21 09:45:34 +00:00
|
|
|
|
2012-06-23 18:38:46 +00:00
|
|
|
reg_t disassemble(EngineState *s, reg32_t pos, bool printBWTag, bool printBytecode);
|
2011-03-12 22:43:29 +00:00
|
|
|
bool isJumpOpcode(EngineState *s, reg_t pos, reg_t& jumpOffset);
|
2009-06-02 21:07:34 +00:00
|
|
|
|
2009-02-20 21:26:31 +00:00
|
|
|
class Console : public GUI::Debugger {
|
|
|
|
public:
|
2010-02-03 01:32:03 +00:00
|
|
|
Console(SciEngine *engine);
|
2009-02-21 15:30:47 +00:00
|
|
|
virtual ~Console();
|
2009-02-20 21:26:31 +00:00
|
|
|
|
2009-07-08 13:08:51 +00:00
|
|
|
int printObject(reg_t pos);
|
|
|
|
|
2010-12-07 18:54:21 +00:00
|
|
|
private:
|
|
|
|
virtual void preEnter();
|
|
|
|
virtual void postEnter();
|
|
|
|
|
2009-02-20 21:26:31 +00:00
|
|
|
private:
|
2009-06-03 09:45:16 +00:00
|
|
|
// General
|
|
|
|
bool cmdHelp(int argc, const char **argv);
|
|
|
|
// Kernel
|
2009-05-26 15:06:21 +00:00
|
|
|
// bool cmdClasses(int argc, const char **argv); // TODO
|
|
|
|
bool cmdOpcodes(int argc, const char **argv);
|
2009-07-04 15:22:42 +00:00
|
|
|
bool cmdSelector(int argc, const char **argv);
|
2009-05-11 17:10:36 +00:00
|
|
|
bool cmdSelectors(int argc, const char **argv);
|
2009-06-03 09:45:16 +00:00
|
|
|
bool cmdKernelFunctions(int argc, const char **argv);
|
|
|
|
bool cmdClassTable(int argc, const char **argv);
|
|
|
|
// Parser
|
2009-05-12 08:14:24 +00:00
|
|
|
bool cmdSuffixes(int argc, const char **argv);
|
2009-06-03 09:45:16 +00:00
|
|
|
bool cmdParseGrammar(int argc, const char **argv);
|
|
|
|
bool cmdParserNodes(int argc, const char **argv);
|
2010-01-25 01:39:44 +00:00
|
|
|
bool cmdParserWords(int argc, const char **argv);
|
2009-06-03 09:45:16 +00:00
|
|
|
bool cmdSentenceFragments(int argc, const char **argv);
|
2009-06-03 11:38:12 +00:00
|
|
|
bool cmdParse(int argc, const char **argv);
|
2009-06-06 16:43:13 +00:00
|
|
|
bool cmdSetParseNodes(int argc, const char **argv);
|
2010-07-18 13:31:05 +00:00
|
|
|
bool cmdSaid(int argc, const char **argv);
|
2009-06-03 09:45:16 +00:00
|
|
|
// Resources
|
2010-01-28 01:45:20 +00:00
|
|
|
bool cmdDiskDump(int argc, const char **argv);
|
2009-05-23 19:59:42 +00:00
|
|
|
bool cmdHexDump(int argc, const char **argv);
|
2009-06-02 19:03:43 +00:00
|
|
|
bool cmdResourceId(int argc, const char **argv);
|
2010-09-10 14:07:32 +00:00
|
|
|
bool cmdResourceInfo(int argc, const char **argv);
|
2009-05-29 17:19:39 +00:00
|
|
|
bool cmdResourceTypes(int argc, const char **argv);
|
2009-05-30 10:22:53 +00:00
|
|
|
bool cmdList(int argc, const char **argv);
|
2009-06-03 09:45:16 +00:00
|
|
|
bool cmdHexgrep(int argc, const char **argv);
|
2010-05-31 22:57:05 +00:00
|
|
|
bool cmdVerifyScripts(int argc, const char **argv);
|
2009-06-03 09:45:16 +00:00
|
|
|
// Game
|
2009-05-30 13:04:09 +00:00
|
|
|
bool cmdSaveGame(int argc, const char **argv);
|
|
|
|
bool cmdRestoreGame(int argc, const char **argv);
|
|
|
|
bool cmdRestartGame(int argc, const char **argv);
|
2009-06-03 09:45:16 +00:00
|
|
|
bool cmdGetVersion(int argc, const char **argv);
|
|
|
|
bool cmdRoomNumber(int argc, const char **argv);
|
2010-01-27 20:03:45 +00:00
|
|
|
bool cmdQuit(int argc, const char **argv);
|
2010-01-02 14:08:26 +00:00
|
|
|
bool cmdListSaves(int argc, const char **argv);
|
2009-06-03 09:45:16 +00:00
|
|
|
// Screen
|
|
|
|
bool cmdShowMap(int argc, const char **argv);
|
|
|
|
// Graphics
|
2010-01-05 21:25:59 +00:00
|
|
|
bool cmdSetPalette(int argc, const char **argv);
|
2009-05-30 18:22:55 +00:00
|
|
|
bool cmdDrawPic(int argc, const char **argv);
|
2010-01-05 21:03:33 +00:00
|
|
|
bool cmdDrawCel(int argc, const char **argv);
|
2009-10-07 21:47:34 +00:00
|
|
|
bool cmdUndither(int argc, const char **argv);
|
2010-01-09 14:09:45 +00:00
|
|
|
bool cmdPicVisualize(int argc, const char **argv);
|
2009-10-17 10:42:00 +00:00
|
|
|
bool cmdPlayVideo(int argc, const char **argv);
|
2011-03-20 02:10:29 +00:00
|
|
|
bool cmdAnimateList(int argc, const char **argv);
|
2011-03-20 12:56:13 +00:00
|
|
|
bool cmdWindowList(int argc, const char **argv);
|
2012-05-20 22:29:30 +00:00
|
|
|
bool cmdPlaneList(int argc, const char **argv);
|
|
|
|
bool cmdPlaneItemList(int argc, const char **argv);
|
2011-06-11 20:40:56 +00:00
|
|
|
bool cmdSavedBits(int argc, const char **argv);
|
|
|
|
bool cmdShowSavedBits(int argc, const char **argv);
|
2009-06-03 09:45:16 +00:00
|
|
|
// Segments
|
2009-05-30 14:30:39 +00:00
|
|
|
bool cmdPrintSegmentTable(int argc, const char **argv);
|
2009-05-30 16:36:37 +00:00
|
|
|
bool cmdSegmentInfo(int argc, const char **argv);
|
|
|
|
bool cmdKillSegment(int argc, const char **argv);
|
2009-06-03 09:45:16 +00:00
|
|
|
// Garbage collection
|
2009-06-02 19:03:43 +00:00
|
|
|
bool cmdGCInvoke(int argc, const char **argv);
|
2009-05-30 13:36:51 +00:00
|
|
|
bool cmdGCObjects(int argc, const char **argv);
|
2009-06-02 21:07:34 +00:00
|
|
|
bool cmdGCShowReachable(int argc, const char **argv);
|
|
|
|
bool cmdGCShowFreeable(int argc, const char **argv);
|
|
|
|
bool cmdGCNormalize(int argc, const char **argv);
|
2009-06-03 09:45:16 +00:00
|
|
|
// Music/SFX
|
|
|
|
bool cmdSongLib(int argc, const char **argv);
|
2010-01-23 14:39:03 +00:00
|
|
|
bool cmdSongInfo(int argc, const char **argv);
|
2009-06-02 19:03:43 +00:00
|
|
|
bool cmdIsSample(int argc, const char **argv);
|
2010-01-23 14:39:03 +00:00
|
|
|
bool cmdStartSound(int argc, const char **argv);
|
|
|
|
bool cmdToggleSound(int argc, const char **argv);
|
|
|
|
bool cmdStopAllSounds(int argc, const char **argv);
|
2009-06-02 19:03:43 +00:00
|
|
|
bool cmdSfx01Header(int argc, const char **argv);
|
|
|
|
bool cmdSfx01Track(int argc, const char **argv);
|
2010-10-28 12:48:51 +00:00
|
|
|
bool cmdShowInstruments(int argc, const char **argv);
|
|
|
|
bool cmdMapInstrument(int argc, const char **argv);
|
2009-06-03 09:45:16 +00:00
|
|
|
// Script
|
|
|
|
bool cmdAddresses(int argc, const char **argv);
|
|
|
|
bool cmdRegisters(int argc, const char **argv);
|
|
|
|
bool cmdDissectScript(int argc, const char **argv);
|
2009-06-03 14:47:32 +00:00
|
|
|
bool cmdBacktrace(int argc, const char **argv);
|
2010-06-27 19:58:32 +00:00
|
|
|
bool cmdTrace(int argc, const char **argv);
|
|
|
|
bool cmdStepOver(int argc, const char **argv);
|
2009-06-06 16:43:13 +00:00
|
|
|
bool cmdStepEvent(int argc, const char **argv);
|
|
|
|
bool cmdStepRet(int argc, const char **argv);
|
|
|
|
bool cmdStepGlobal(int argc, const char **argv);
|
2009-06-06 20:29:37 +00:00
|
|
|
bool cmdStepCallk(int argc, const char **argv);
|
2009-10-03 20:25:27 +00:00
|
|
|
bool cmdDisassemble(int argc, const char **argv);
|
|
|
|
bool cmdDisassembleAddress(int argc, const char **argv);
|
2010-10-20 17:31:29 +00:00
|
|
|
bool cmdFindKernelFunctionCall(int argc, const char **argv);
|
2009-06-08 08:38:10 +00:00
|
|
|
bool cmdSend(int argc, const char **argv);
|
|
|
|
bool cmdGo(int argc, const char **argv);
|
2010-07-23 20:47:15 +00:00
|
|
|
bool cmdLogKernel(int argc, const char **argv);
|
2009-06-03 11:38:12 +00:00
|
|
|
// Breakpoints
|
2009-06-02 23:29:58 +00:00
|
|
|
bool cmdBreakpointList(int argc, const char **argv);
|
|
|
|
bool cmdBreakpointDelete(int argc, const char **argv);
|
2010-08-03 19:06:40 +00:00
|
|
|
bool cmdBreakpointMethod(int argc, const char **argv);
|
2010-09-02 09:05:08 +00:00
|
|
|
bool cmdBreakpointRead(int argc, const char **argv);
|
|
|
|
bool cmdBreakpointWrite(int argc, const char **argv);
|
2010-08-03 19:06:40 +00:00
|
|
|
bool cmdBreakpointKernel(int argc, const char **argv);
|
|
|
|
bool cmdBreakpointFunction(int argc, const char **argv);
|
2009-06-03 09:45:16 +00:00
|
|
|
// VM
|
|
|
|
bool cmdScriptSteps(int argc, const char **argv);
|
|
|
|
bool cmdVMVarlist(int argc, const char **argv);
|
2009-06-03 11:38:12 +00:00
|
|
|
bool cmdVMVars(int argc, const char **argv);
|
2009-06-03 09:45:16 +00:00
|
|
|
bool cmdStack(int argc, const char **argv);
|
|
|
|
bool cmdValueType(int argc, const char **argv);
|
|
|
|
bool cmdViewListNode(int argc, const char **argv);
|
2009-06-03 14:47:32 +00:00
|
|
|
bool cmdViewReference(int argc, const char **argv);
|
2009-06-03 09:45:16 +00:00
|
|
|
bool cmdViewObject(int argc, const char **argv);
|
|
|
|
bool cmdViewActiveObject(int argc, const char **argv);
|
|
|
|
bool cmdViewAccumulatorObject(int argc, const char **argv);
|
2009-02-20 21:26:31 +00:00
|
|
|
|
2010-07-07 14:19:36 +00:00
|
|
|
bool parseInteger(const char *argument, int &result);
|
|
|
|
|
2010-06-27 20:38:41 +00:00
|
|
|
void printBasicVarInfo(reg_t variable);
|
|
|
|
|
2009-05-30 16:36:37 +00:00
|
|
|
bool segmentInfo(int nr);
|
2010-06-25 19:09:19 +00:00
|
|
|
void printList(List *list);
|
2009-06-02 23:29:58 +00:00
|
|
|
int printNode(reg_t addr);
|
2010-07-04 23:38:08 +00:00
|
|
|
void hexDumpReg(const reg_t *data, int len, int regsPerLine = 4, int startOffset = 0, bool isArray = false);
|
2009-05-30 16:36:37 +00:00
|
|
|
|
2009-02-20 21:26:31 +00:00
|
|
|
private:
|
2011-01-07 18:25:38 +00:00
|
|
|
/**
|
|
|
|
* Prints all the scripts calling the specified kernel function.
|
|
|
|
* NOTE: The results produced by this aren't 100% correct, as it
|
|
|
|
* does not dissect script exports
|
|
|
|
*/
|
|
|
|
void printKernelCallsFound(int kernelFuncNum, bool showFoundScripts);
|
|
|
|
|
2010-02-03 01:32:03 +00:00
|
|
|
SciEngine *_engine;
|
2010-07-12 23:20:33 +00:00
|
|
|
DebugState &_debugState;
|
2009-07-03 14:22:50 +00:00
|
|
|
bool _mouseVisible;
|
2009-10-17 10:42:00 +00:00
|
|
|
Common::String _videoFile;
|
|
|
|
int _videoFrameDelay;
|
2009-02-20 21:26:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Sci
|
|
|
|
|
|
|
|
#endif
|