[Scummvm-cvs-logs] SF.net SVN: scummvm:[53398] scummvm/trunk/engines/gob
tdhs at users.sourceforge.net
tdhs at users.sourceforge.net
Wed Oct 13 05:49:54 CEST 2010
Revision: 53398
http://scummvm.svn.sourceforge.net/scummvm/?rev=53398&view=rev
Author: tdhs
Date: 2010-10-13 03:49:54 +0000 (Wed, 13 Oct 2010)
Log Message:
-----------
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.
Modified Paths:
--------------
scummvm/trunk/engines/gob/gob.cpp
scummvm/trunk/engines/gob/gob.h
scummvm/trunk/engines/gob/module.mk
scummvm/trunk/engines/gob/util.cpp
Added Paths:
-----------
scummvm/trunk/engines/gob/console.cpp
scummvm/trunk/engines/gob/console.h
Added: scummvm/trunk/engines/gob/console.cpp
===================================================================
--- scummvm/trunk/engines/gob/console.cpp (rev 0)
+++ scummvm/trunk/engines/gob/console.cpp 2010-10-13 03:49:54 UTC (rev 53398)
@@ -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
Property changes on: scummvm/trunk/engines/gob/console.cpp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
Added: scummvm/trunk/engines/gob/console.h
===================================================================
--- scummvm/trunk/engines/gob/console.h (rev 0)
+++ scummvm/trunk/engines/gob/console.h 2010-10-13 03:49:54 UTC (rev 53398)
@@ -0,0 +1,52 @@
+/* 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 GOB_CONSOLE_H
+#define GOB_CONSOLE_H
+
+#include "gui/debugger.h"
+
+namespace Gob {
+
+class GobEngine;
+
+class GobConsole : public GUI::Debugger {
+public:
+ GobConsole(GobEngine *vm);
+ virtual ~GobConsole(void);
+
+protected:
+ virtual void preEnter();
+ virtual void postEnter();
+
+private:
+ GobEngine *_vm;
+
+ bool Cmd_Var(int argc, const char **argv);
+};
+
+} // End of namespace Mohawk
+
+#endif
Property changes on: scummvm/trunk/engines/gob/console.h
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
Modified: scummvm/trunk/engines/gob/gob.cpp
===================================================================
--- scummvm/trunk/engines/gob/gob.cpp 2010-10-13 03:28:59 UTC (rev 53397)
+++ scummvm/trunk/engines/gob/gob.cpp 2010-10-13 03:49:54 UTC (rev 53398)
@@ -136,6 +136,8 @@
_copyProtection = ConfMan.getBool("copy_protection");
+ _console = new GobConsole(this);
+
DebugMan.addDebugChannel(kDebugFuncOp, "FuncOpcodes", "Script FuncOpcodes debug level");
DebugMan.addDebugChannel(kDebugDrawOp, "DrawOpcodes", "Script DrawOpcodes debug level");
DebugMan.addDebugChannel(kDebugGobOp, "GoblinOpcodes", "Script GoblinOpcodes debug level");
@@ -153,6 +155,8 @@
}
GobEngine::~GobEngine() {
+ delete _console;
+
deinitGameParts();
}
Modified: scummvm/trunk/engines/gob/gob.h
===================================================================
--- scummvm/trunk/engines/gob/gob.h 2010-10-13 03:28:59 UTC (rev 53397)
+++ scummvm/trunk/engines/gob/gob.h 2010-10-13 03:49:54 UTC (rev 53398)
@@ -32,6 +32,8 @@
#include "engines/engine.h"
+#include "gob/console.h"
+
namespace GUI {
class StaticTextWidget;
}
@@ -62,6 +64,7 @@
class Scenery;
class Util;
class SaveLoad;
+class GobConsole;
#define WRITE_VAR_UINT32(var, val) _vm->_inter->_variables->writeVar32(var, val)
#define WRITE_VAR_UINT16(var, val) _vm->_inter->_variables->writeVar16(var, val)
@@ -152,6 +155,7 @@
GameType _gameType;
int32 _features;
Common::Platform _platform;
+ GobConsole *_console;
uint32 _pauseStart;
@@ -221,6 +225,8 @@
bool isTrueColor() const;
bool isDemo() const;
+ GUI::Debugger *getDebugger() { return _console; }
+
const Graphics::PixelFormat &getPixelFormat() const;
GobEngine(OSystem *syst);
Modified: scummvm/trunk/engines/gob/module.mk
===================================================================
--- scummvm/trunk/engines/gob/module.mk 2010-10-13 03:28:59 UTC (rev 53397)
+++ scummvm/trunk/engines/gob/module.mk 2010-10-13 03:49:54 UTC (rev 53398)
@@ -1,6 +1,7 @@
MODULE := engines/gob
MODULE_OBJS := \
+ console.o \
dataio.o \
detection.o \
draw.o \
Modified: scummvm/trunk/engines/gob/util.cpp
===================================================================
--- scummvm/trunk/engines/gob/util.cpp 2010-10-13 03:28:59 UTC (rev 53397)
+++ scummvm/trunk/engines/gob/util.cpp 2010-10-13 03:49:54 UTC (rev 53398)
@@ -121,6 +121,10 @@
_fastMode ^= 2;
else if (event.kbd.keycode == Common::KEYCODE_p)
_vm->pauseGame();
+ else if (event.kbd.keycode == Common::KEYCODE_d) {
+ _vm->getDebugger()->attach();
+ _vm->getDebugger()->onFrame();
+ }
break;
}
addKeyToBuffer(event.kbd);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list