diff options
| -rw-r--r-- | scumm/debugger.cpp | 17 | ||||
| -rw-r--r-- | scumm/debugger.h | 18 | 
2 files changed, 26 insertions, 9 deletions
| diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp index 6c5b0d2e96..bbb927b616 100644 --- a/scumm/debugger.cpp +++ b/scumm/debugger.cpp @@ -17,6 +17,15 @@  	#define Debug_Printf printf  #endif +ScummDebugger::ScummDebugger() +{ +	_s = 0; +	_frame_countdown = 0; +	_dvar_count = 0; +	_dcmd_count = 0; +	_detach_now = false; +} +  // Initialisation Functions  void ScummDebugger::attach(Scumm *s)  { @@ -77,7 +86,7 @@ void ScummDebugger::on_frame() {  		_s->_sound->pauseSounds(old_soundsPaused);	// Resume previous sound state  		if (_detach_now)	// Detach if we're finished with the debugger -		detach(); +			detach();  	}  } @@ -95,7 +104,8 @@ bool ScummDebugger::debuggerInputCallback(ConsoleDialog *console, const char *in  // Now the fun stuff:  // Command/Variable registration functions -void ScummDebugger::DVar_Register(char *varname, void *pointer, int type, int optional) { +void ScummDebugger::DVar_Register(const char *varname, void *pointer, int type, int optional) { +	assert(_dvar_count < (int)sizeof(_dvars));  	strcpy(_dvars[_dvar_count].name, varname);  	_dvars[_dvar_count].type = type;  	_dvars[_dvar_count].variable = pointer; @@ -104,7 +114,8 @@ void ScummDebugger::DVar_Register(char *varname, void *pointer, int type, int op  	_dvar_count++;  } -void ScummDebugger::DCmd_Register(char *cmdname, DebugProc pointer) { +void ScummDebugger::DCmd_Register(const char *cmdname, DebugProc pointer) { +	assert(_dcmd_count < (int)sizeof(_dcmds));  	strcpy(_dcmds[_dcmd_count].name, cmdname);  	_dcmds[_dcmd_count].function = pointer; diff --git a/scumm/debugger.h b/scumm/debugger.h index afae964c11..3c80fe4699 100644 --- a/scumm/debugger.h +++ b/scumm/debugger.h @@ -20,8 +20,12 @@  #ifndef DEBUG_H  #define DEBUG_H +  #define USE_CONSOLE +  class Scumm; +class ScummDebugger; +  typedef bool (ScummDebugger::*DebugProc)();  enum { @@ -44,21 +48,23 @@ struct DCmd {  class ScummDebugger {  public: +	ScummDebugger(); +	  	void on_frame();  	void attach(Scumm *s);  protected:  	Scumm *_s; -        int _frame_countdown, _dvar_count, _dcmd_count; -	DVar _dvars[255]; -	DCmd _dcmds[255]; +	int _frame_countdown, _dvar_count, _dcmd_count; +	DVar _dvars[256]; +	DCmd _dcmds[256];  	bool _detach_now;  	void enter(); -        void detach(); +	void detach(); -	void DVar_Register(char *varname, void *pointer, int type, int optional); -	void DCmd_Register(char *cmdname, DebugProc pointer); +	void DVar_Register(const char *varname, void *pointer, int type, int optional); +	void DCmd_Register(const char *cmdname, DebugProc pointer);  	bool RunCommand(char *input);  	// Commands | 
