diff options
author | David Turner | 2010-11-08 03:55:16 +0000 |
---|---|---|
committer | David Turner | 2010-11-08 03:55:16 +0000 |
commit | f0fe060cc3a17f6bcb5e9253fbce0605a88cc0c2 (patch) | |
tree | 467f7cc62ee91cdf747412778aaaf2a093b57858 /engines | |
parent | 5d30eeea95be5a295ac17b0736779297606a08a8 (diff) | |
download | scummvm-rg350-f0fe060cc3a17f6bcb5e9253fbce0605a88cc0c2.tar.gz scummvm-rg350-f0fe060cc3a17f6bcb5e9253fbce0605a88cc0c2.tar.bz2 scummvm-rg350-f0fe060cc3a17f6bcb5e9253fbce0605a88cc0c2.zip |
TOUCHE: Added basic debugging console to engine
Since TOUCHE uses Debug Channels, this allows for the interactive setting of debugflags as well as providing a base for adding further debugging commands.
svn-id: r54137
Diffstat (limited to 'engines')
-rw-r--r-- | engines/touche/console.cpp | 43 | ||||
-rw-r--r-- | engines/touche/console.h | 50 | ||||
-rw-r--r-- | engines/touche/module.mk | 1 | ||||
-rw-r--r-- | engines/touche/touche.cpp | 7 | ||||
-rw-r--r-- | engines/touche/touche.h | 5 |
5 files changed, 106 insertions, 0 deletions
diff --git a/engines/touche/console.cpp b/engines/touche/console.cpp new file mode 100644 index 0000000000..9d2b94d31c --- /dev/null +++ b/engines/touche/console.cpp @@ -0,0 +1,43 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + +#include "touche/console.h" +#include "touche/touche.h" + +namespace Touche { + +ToucheConsole::ToucheConsole(ToucheEngine *vm) : GUI::Debugger(), _vm(vm) { +} + +ToucheConsole::~ToucheConsole() { +} + +void ToucheConsole::preEnter() { +} + +void ToucheConsole::postEnter() { +} + +} // End of namespace Touche diff --git a/engines/touche/console.h b/engines/touche/console.h new file mode 100644 index 0000000000..bcb947cf2e --- /dev/null +++ b/engines/touche/console.h @@ -0,0 +1,50 @@ +/* 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. + * + * $URL$ + * $Id$ + * + */ + +#ifndef TOUCHE_CONSOLE_H +#define TOUCHE_CONSOLE_H + +#include "gui/debugger.h" + +namespace Touche { + +class ToucheEngine; + +class ToucheConsole : public GUI::Debugger { +public: + ToucheConsole(ToucheEngine *vm); + virtual ~ToucheConsole(void); + +protected: + virtual void preEnter(); + virtual void postEnter(); + +private: + ToucheEngine *_vm; +}; + +} // End of namespace Touche + +#endif diff --git a/engines/touche/module.mk b/engines/touche/module.mk index 30965e1155..710b3169de 100644 --- a/engines/touche/module.mk +++ b/engines/touche/module.mk @@ -1,6 +1,7 @@ MODULE := engines/touche MODULE_OBJS := \ + console.o \ detection.o \ graphics.o \ menu.o \ diff --git a/engines/touche/touche.cpp b/engines/touche/touche.cpp index 2dc8b76b4f..0bfb43a27a 100644 --- a/engines/touche/touche.cpp +++ b/engines/touche/touche.cpp @@ -82,11 +82,15 @@ ToucheEngine::ToucheEngine(OSystem *system, Common::Language language) DebugMan.addDebugChannel(kDebugOpcodes, "Opcodes", "Opcodes debug level"); DebugMan.addDebugChannel(kDebugMenu, "Menu", "Menu debug level"); + _console = new ToucheConsole(this); + g_eventRec.registerRandomSource(_rnd, "touche"); } ToucheEngine::~ToucheEngine() { DebugMan.clearAllDebugChannels(); + delete _console; + delete _midiPlayer; } @@ -324,6 +328,9 @@ void ToucheEngine::processEvents(bool handleKeyEvents) { if (event.kbd.hasFlags(Common::KBD_CTRL)) { if (event.kbd.keycode == Common::KEYCODE_f) { _fastMode = !_fastMode; + } else if (event.kbd.keycode == Common::KEYCODE_d) { + this->getDebugger()->attach(); + this->getDebugger()->onFrame(); } } else { if (event.kbd.ascii == 't') { diff --git a/engines/touche/touche.h b/engines/touche/touche.h index 0081cadbae..926dab04b2 100644 --- a/engines/touche/touche.h +++ b/engines/touche/touche.h @@ -37,6 +37,8 @@ #include "engines/engine.h" +#include "touche/console.h" + /** * This is the namespace of the Touche engine. * @@ -382,6 +384,7 @@ public: virtual Common::Error run(); virtual bool hasFeature(EngineFeature f) const; virtual void syncSoundSettings(); + GUI::Debugger *getDebugger() { return _console; } protected: @@ -518,6 +521,8 @@ protected: virtual bool canLoadGameStateCurrently(); virtual bool canSaveGameStateCurrently(); + ToucheConsole *_console; + void setupOpcodes(); void op_nop(); void op_jnz(); |