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
This commit is contained in:
David Turner 2010-11-08 03:55:16 +00:00
parent 5d30eeea95
commit f0fe060cc3
5 changed files with 106 additions and 0 deletions

View File

@ -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

50
engines/touche/console.h Normal file
View File

@ -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

View File

@ -1,6 +1,7 @@
MODULE := engines/touche
MODULE_OBJS := \
console.o \
detection.o \
graphics.o \
menu.o \

View File

@ -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') {

View File

@ -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();