From 9582e485747221341ae189468db8a63284b9f2a8 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Fri, 20 Feb 2009 21:26:31 +0000 Subject: Some initial code for a debug console (still non-working) svn-id: r38623 --- engines/sci/console.cpp | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ engines/sci/console.h | 49 +++++++++++++++++++++++++++++++++++++++++++++ engines/sci/module.mk | 1 + engines/sci/sci.cpp | 11 ++++++---- engines/sci/sci.h | 14 ++----------- 5 files changed, 112 insertions(+), 16 deletions(-) create mode 100644 engines/sci/console.cpp create mode 100644 engines/sci/console.h (limited to 'engines/sci') diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp new file mode 100644 index 0000000000..1d5a544f3d --- /dev/null +++ b/engines/sci/console.cpp @@ -0,0 +1,53 @@ +/* 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$ + * + */ + +// Console module + +#include "sci/sci.h" +#include "sci/console.h" +#include "sci/versions.h" + +namespace Sci { + +Console::Console(SciEngine *vm) : GUI::Debugger() { + _vm = vm; + + DCmd_Register("version", WRAP_METHOD(Console, cmdGetVersion)); +} + +Console::~Console() { +} + +bool Console::cmdGetVersion(int argc, const char **argv) { + int ver = _vm->getVersion(); + DebugPrintf("SCI version: %d.%03d.%03d\n", + SCI_VERSION_MAJOR(ver), + SCI_VERSION_MINOR(ver), + SCI_VERSION_PATCHLEVEL(ver)); + + return true; +} + +} // End of namespace Sci diff --git a/engines/sci/console.h b/engines/sci/console.h new file mode 100644 index 0000000000..6043f84df6 --- /dev/null +++ b/engines/sci/console.h @@ -0,0 +1,49 @@ +/* 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$ + * + */ + + // Console module header file + +#ifndef SCI_CONSOLE_H +#define SCI_CONSOLE_H + +#include "gui/debugger.h" + +namespace Sci { + +class Console : public GUI::Debugger { +public: + Console(SciEngine *vm); + virtual ~Console(void); + +private: + bool cmdGetVersion(int argc, const char **argv); + +private: + SciEngine *_vm; +}; + +} // End of namespace Sci + +#endif diff --git a/engines/sci/module.mk b/engines/sci/module.mk index 0f7fe05492..bf1acef2b1 100644 --- a/engines/sci/module.mk +++ b/engines/sci/module.mk @@ -1,6 +1,7 @@ MODULE := engines/sci MODULE_OBJS = \ + console.o \ detection.o \ exereader.o \ sci.o \ diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 2de16d2f6b..f8d1f91ee6 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -29,6 +29,7 @@ #include "engines/advancedDetector.h" #include "sci/sci.h" +#include "sci/console.h" #include "sci/include/engine.h" extern gfx_driver_t gfx_driver_scummvm; @@ -138,6 +139,8 @@ SciEngine::SciEngine(OSystem *syst, const SciGameDescription *desc) //File::addDefaultDirectory(_gameDataPath + "sound/"); //printf("%s\n", _gameDataPath.c_str()); + _console = NULL; + // Set up the engine specific debug levels Common::addDebugChannel(kDebugLevelError, "Error", "Script error debugging"); Common::addDebugChannel(kDebugLevelNodes, "Lists", "Lists and nodes debugging"); @@ -166,17 +169,17 @@ SciEngine::~SciEngine() { printf("SciEngine::~SciEngine\n"); // Remove all of our debug levels here - //Common::clearAllSpecialDebugLevels(); + Common::clearAllDebugChannels(); + + delete _console; } Common::Error SciEngine::init() { initGraphics(320, 200, false); - //GUIErrorMessage("lalalal asfa w4 haha hreh au u