aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/console.cpp
diff options
context:
space:
mode:
authorDavid Turner2010-10-13 03:49:54 +0000
committerDavid Turner2010-10-13 03:49:54 +0000
commit6527c01cb501958bc04117da3d965b956e77704c (patch)
tree3987ebb9fe7e91cc27882bba3f92d7e39eec7217 /engines/gob/console.cpp
parent07abe3d6038de672d82446b7a2d289977cd972fb (diff)
downloadscummvm-rg350-6527c01cb501958bc04117da3d965b956e77704c.tar.gz
scummvm-rg350-6527c01cb501958bc04117da3d965b956e77704c.tar.bz2
scummvm-rg350-6527c01cb501958bc04117da3d965b956e77704c.zip
GOB: Add Debug Console.
This allows interactive control of debug flags and variables and provides a base to allow for commands to aid in tracking down script bugs which are tricky to replicate. svn-id: r53398
Diffstat (limited to 'engines/gob/console.cpp')
-rw-r--r--engines/gob/console.cpp63
1 files changed, 63 insertions, 0 deletions
diff --git a/engines/gob/console.cpp b/engines/gob/console.cpp
new file mode 100644
index 0000000000..1909d1fcf5
--- /dev/null
+++ b/engines/gob/console.cpp
@@ -0,0 +1,63 @@
+/* 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 "gob/console.h"
+#include "gob/gob.h"
+#include "gob/inter.h"
+
+namespace Gob {
+
+GobConsole::GobConsole(GobEngine *vm) : GUI::Debugger(), _vm(vm) {
+ DCmd_Register("var", WRAP_METHOD(GobConsole, Cmd_Var));
+}
+
+GobConsole::~GobConsole() {
+}
+
+void GobConsole::preEnter() {
+}
+
+void GobConsole::postEnter() {
+}
+
+bool GobConsole::Cmd_Var(int argc, const char **argv) {
+ if (argc == 1) {
+ DebugPrintf("Usage: var <var> (<value>)\n");
+ return true;
+ }
+
+ uint32 varNum = atoi(argv[1]);
+
+ if (argc > 2) {
+ uint32 varVal = atoi(argv[2]);
+ _vm->_inter->_variables->writeVar32(varNum, varVal);
+ }
+
+ DebugPrintf("%d = %d\n", varNum, _vm->_inter->_variables->readVar32(varNum));
+
+ return true;
+}
+
+} // End of namespace Gob