aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25
diff options
context:
space:
mode:
authorDavid Turner2010-11-10 04:30:24 +0000
committerDavid Turner2010-11-10 04:30:24 +0000
commit7ad677afc8ad3768a8c903afed5881403e1a026d (patch)
tree1eb5eb729a46ef2bfa086d510ff05fd6de9c7cab /engines/sword25
parentc9969d2be02f640026a1be229c16527e953de83e (diff)
downloadscummvm-rg350-7ad677afc8ad3768a8c903afed5881403e1a026d.tar.gz
scummvm-rg350-7ad677afc8ad3768a8c903afed5881403e1a026d.tar.bz2
scummvm-rg350-7ad677afc8ad3768a8c903afed5881403e1a026d.zip
SWORD25: Added basic debugging console to engine (Command Key Disabled)
Since SWORD25 uses Debug Channels, this allows for the interactive setting of debugflags as well as providing a base for adding further debugging commands. However, this is not currently usable as the command key code is commented out. This is due to the event loop which reads keyboard input being buried 2 object layers below the Engine VM object and I am unsure how the engine development team would want this exposed / interfaced. svn-id: r54184
Diffstat (limited to 'engines/sword25')
-rw-r--r--engines/sword25/console.cpp43
-rw-r--r--engines/sword25/console.h50
-rw-r--r--engines/sword25/input/inputengine.cpp6
-rw-r--r--engines/sword25/module.mk1
-rw-r--r--engines/sword25/sword25.cpp4
-rw-r--r--engines/sword25/sword25.h5
6 files changed, 109 insertions, 0 deletions
diff --git a/engines/sword25/console.cpp b/engines/sword25/console.cpp
new file mode 100644
index 0000000000..014c748182
--- /dev/null
+++ b/engines/sword25/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 "sword25/console.h"
+#include "sword25/sword25.h"
+
+namespace Sword25 {
+
+Sword25Console::Sword25Console(Sword25Engine *vm) : GUI::Debugger(), _vm(vm) {
+}
+
+Sword25Console::~Sword25Console() {
+}
+
+void Sword25Console::preEnter() {
+}
+
+void Sword25Console::postEnter() {
+}
+
+} // End of namespace Sword25
diff --git a/engines/sword25/console.h b/engines/sword25/console.h
new file mode 100644
index 0000000000..dd053c19f6
--- /dev/null
+++ b/engines/sword25/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 SWORD25_CONSOLE_H
+#define SWORD25_CONSOLE_H
+
+#include "gui/debugger.h"
+
+namespace Sword25 {
+
+class Sword25Engine;
+
+class Sword25Console : public GUI::Debugger {
+public:
+ Sword25Console(Sword25Engine *vm);
+ virtual ~Sword25Console(void);
+
+protected:
+ virtual void preEnter();
+ virtual void postEnter();
+
+private:
+ Sword25Engine *_vm;
+};
+
+} // End of namespace Sword25
+
+#endif
diff --git a/engines/sword25/input/inputengine.cpp b/engines/sword25/input/inputengine.cpp
index 8dc98ba3fb..82d5cad588 100644
--- a/engines/sword25/input/inputengine.cpp
+++ b/engines/sword25/input/inputengine.cpp
@@ -121,6 +121,12 @@ void InputEngine::update() {
case Common::EVENT_KEYDOWN:
case Common::EVENT_KEYUP:
+ // FIXME - Need to work out how to expose getDebugger() to this module
+ //if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_d && event.type == Common::EVENT_KEYDOWN) {
+ // _vm->getDebugger()->attach();
+ // _vm->getDebugger()->onFrame();
+ //}
+
alterKeyboardState(event.kbd.keycode, (event.type == Common::EVENT_KEYDOWN) ? 0x80 : 0);
break;
diff --git a/engines/sword25/module.mk b/engines/sword25/module.mk
index f10c6be5a9..944e2c49c3 100644
--- a/engines/sword25/module.mk
+++ b/engines/sword25/module.mk
@@ -1,6 +1,7 @@
MODULE := engines/sword25
MODULE_OBJS := \
+ console.o \
detection.o \
sword25.o \
fmv/movieplayer.o \
diff --git a/engines/sword25/sword25.cpp b/engines/sword25/sword25.cpp
index 5864057423..4c188fe7ea 100644
--- a/engines/sword25/sword25.cpp
+++ b/engines/sword25/sword25.cpp
@@ -61,9 +61,13 @@ Sword25Engine::Sword25Engine(OSystem *syst, const ADGameDescription *gameDesc):
DebugMan.addDebugChannel(kDebugScript, "Script", "Script debug level");
DebugMan.addDebugChannel(kDebugScript, "Scripts", "Script debug level");
DebugMan.addDebugChannel(kDebugSound, "Sound", "Sound debug level");
+
+ _console = new Sword25Console(this);
}
Sword25Engine::~Sword25Engine() {
+ DebugMan.clearAllDebugChannels();
+ delete _console;
}
Common::Error Sword25Engine::run() {
diff --git a/engines/sword25/sword25.h b/engines/sword25/sword25.h
index 2d93e2267c..91b62cba09 100644
--- a/engines/sword25/sword25.h
+++ b/engines/sword25/sword25.h
@@ -32,6 +32,7 @@
#include "engines/engine.h"
#include "sword25/kernel/log.h"
+#include "sword25/console.h"
struct ADGameDescription;
@@ -70,6 +71,8 @@ private:
bool loadPackages();
+ Sword25Console *_console;
+
protected:
virtual Common::Error run();
bool hasFeature(EngineFeature f) const;
@@ -80,6 +83,8 @@ protected:
// bool canLoadGameStateCurrently(); // TODO: Implement this?
// bool canSaveGameStateCurrently(); // TODO: Implement this?
+ GUI::Debugger *getDebugger() { return _console; }
+
void shutdown();
public: