aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/wintermute/debugger.cpp23
-rw-r--r--engines/wintermute/debugger.h41
-rw-r--r--engines/wintermute/module.mk1
-rw-r--r--engines/wintermute/platform_osystem.cpp15
-rw-r--r--engines/wintermute/platform_osystem.h6
-rw-r--r--engines/wintermute/wintermute.cpp17
-rw-r--r--engines/wintermute/wintermute.h13
7 files changed, 102 insertions, 14 deletions
diff --git a/engines/wintermute/debugger.cpp b/engines/wintermute/debugger.cpp
new file mode 100644
index 0000000000..22e7b1c37b
--- /dev/null
+++ b/engines/wintermute/debugger.cpp
@@ -0,0 +1,23 @@
+/* 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.
+ *
+ */
+
+#include "engines/wintermute/debugger.h" \ No newline at end of file
diff --git a/engines/wintermute/debugger.h b/engines/wintermute/debugger.h
new file mode 100644
index 0000000000..00dd8a3ac6
--- /dev/null
+++ b/engines/wintermute/debugger.h
@@ -0,0 +1,41 @@
+/* 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.
+ *
+ */
+
+#ifndef WINTERMUTE_DEBUGGER_H
+#define WINTERMUTE_DEBUGGER_H
+
+#include "gui/debugger.h"
+
+namespace Wintermute {
+
+class WintermuteEngine;
+class Console : public GUI::Debugger {
+public:
+ Console(WintermuteEngine *vm) : GUI::Debugger(), _engineRef(vm) {}
+ virtual ~Console(void) {}
+private:
+ WintermuteEngine *_engineRef;
+};
+
+}
+
+#endif // WINTERMUTE_DEBUGGER_H
diff --git a/engines/wintermute/module.mk b/engines/wintermute/module.mk
index 2bd71f1b6b..f61e61f6db 100644
--- a/engines/wintermute/module.mk
+++ b/engines/wintermute/module.mk
@@ -110,6 +110,7 @@ MODULE_OBJS := \
utils/utils.o \
video/video_player.o \
video/video_theora_player.o \
+ debugger.o \
wintermute.o \
persistent.o
diff --git a/engines/wintermute/platform_osystem.cpp b/engines/wintermute/platform_osystem.cpp
index 0bd99b11cd..f13bdd2a3c 100644
--- a/engines/wintermute/platform_osystem.cpp
+++ b/engines/wintermute/platform_osystem.cpp
@@ -26,6 +26,7 @@
* Copyright (c) 2011 Jan Nedoma
*/
+#include "engines/wintermute/wintermute.h"
#include "engines/wintermute/base/base_game.h"
#include "engines/wintermute/base/gfx/osystem/base_render_osystem.h"
#include "engines/wintermute/platform_osystem.h"
@@ -36,13 +37,20 @@
namespace Wintermute {
BaseGame *BasePlatform::_gameRef = NULL;
+WintermuteEngine *BasePlatform::_engineRef = NULL;
#define CLASS_NAME "GF_FRAME"
-int BasePlatform::initialize(BaseGame *inGame, int argc, char *argv[]) {
+int BasePlatform::initialize(WintermuteEngine *engineRef, BaseGame *inGame, int argc, char *argv[]) {
_gameRef = inGame;
+ _engineRef = engineRef;
return true;
}
+void BasePlatform::deinit() {
+ _gameRef = NULL;
+ _engineRef = NULL;
+}
+
//////////////////////////////////////////////////////////////////////////
void BasePlatform::handleEvent(Common::Event *event) {
switch (event->type) {
@@ -86,6 +94,11 @@ void BasePlatform::handleEvent(Common::Event *event) {
}
break;
case Common::EVENT_KEYDOWN:
+ if (event->kbd.flags & Common::KBD_CTRL) {
+ if (event->kbd.keycode == Common::KEYCODE_d) {
+ _engineRef->trigDebugger();
+ }
+ }
if (_gameRef) {
_gameRef->handleKeypress(event);
}
diff --git a/engines/wintermute/platform_osystem.h b/engines/wintermute/platform_osystem.h
index 21a77e0a0e..8c39b29ea9 100644
--- a/engines/wintermute/platform_osystem.h
+++ b/engines/wintermute/platform_osystem.h
@@ -36,11 +36,12 @@
namespace Wintermute {
class BaseGame;
-
+class WintermuteEngine;
//////////////////////////////////////////////////////////////////////////
class BasePlatform {
public:
- static int initialize(BaseGame *inGame, int argc, char *argv[]);
+ static int initialize(WintermuteEngine *engineRef, BaseGame *inGame, int argc, char *argv[]);
+ static void deinit();
static void handleEvent(Common::Event *event);
static AnsiString getPlatformName();
@@ -66,6 +67,7 @@ public:
private:
// Set by initialize on game-startup, the object referred to is also deleted by deinit in WintermuteEngine
static BaseGame *_gameRef;
+ static WintermuteEngine *_engineRef;
};
} // end of namespace Wintermute
diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp
index bf8b1bbe11..a4f1827442 100644
--- a/engines/wintermute/wintermute.cpp
+++ b/engines/wintermute/wintermute.cpp
@@ -34,6 +34,7 @@
#include "engines/util.h"
#include "engines/wintermute/ad/ad_game.h"
#include "engines/wintermute/wintermute.h"
+#include "engines/wintermute/debugger.h"
#include "engines/wintermute/platform_osystem.h"
#include "engines/wintermute/base/base_engine.h"
@@ -48,6 +49,8 @@ namespace Wintermute {
// This might not be the prettiest solution
WintermuteEngine::WintermuteEngine() : Engine(g_system) {
_game = new AdGame("");
+ _debugger = NULL;
+ _trigDebug = false;
}
WintermuteEngine::WintermuteEngine(OSystem *syst, const ADGameDescription *desc)
@@ -78,7 +81,7 @@ WintermuteEngine::~WintermuteEngine() {
// Dispose your resources here
deinit();
delete _game;
- delete _console;
+ delete _debugger;
// Remove all of our debug levels here
DebugMan.clearAllDebugChannels();
@@ -107,7 +110,7 @@ Common::Error WintermuteEngine::run() {
}
// Create debugger console. It requires GFX to be initialized
- _console = new Console(this);
+ _debugger = new Console(this);
// DebugMan.enableDebugChannel("enginelog");
debugC(1, kWintermuteDebugLog, "Engine Debug-LOG enabled");
@@ -134,7 +137,7 @@ int WintermuteEngine::init() {
return 1;
}
BaseEngine::instance().setGameRef(_game);
- BasePlatform::initialize(_game, 0, NULL);
+ BasePlatform::initialize(this, _game, 0, NULL);
bool windowedMode = !ConfMan.getBool("fullscreen");
@@ -233,11 +236,18 @@ int WintermuteEngine::messageLoop() {
const uint32 maxFPS = 60;
const uint32 frameTime = 2 * (uint32)((1.0 / maxFPS) * 1000);
while (!done) {
+ _debugger->onFrame();
+
Common::Event event;
while (_system->getEventManager()->pollEvent(event)) {
BasePlatform::handleEvent(&event);
}
+ if (_trigDebug) {
+ _debugger->attach();
+ _trigDebug = false;
+ }
+
if (_game && _game->_renderer->_active && _game->_renderer->_ready) {
_game->displayContent();
_game->displayQuickMsg();
@@ -273,6 +283,7 @@ int WintermuteEngine::messageLoop() {
void WintermuteEngine::deinit() {
BaseEngine::destroy();
+ BasePlatform::deinit();
}
Common::Error WintermuteEngine::loadGameState(int slot) {
diff --git a/engines/wintermute/wintermute.h b/engines/wintermute/wintermute.h
index d24b120658..1c5b902143 100644
--- a/engines/wintermute/wintermute.h
+++ b/engines/wintermute/wintermute.h
@@ -48,6 +48,9 @@ public:
WintermuteEngine();
~WintermuteEngine();
+ virtual GUI::Debugger *getDebugger() { return _debugger; }
+ void trigDebugger() { _trigDebug = true; }
+
virtual Common::Error run();
virtual bool hasFeature(EngineFeature f) const;
Common::SaveFileManager *getSaveFileMan() { return _saveFileMan; }
@@ -58,21 +61,15 @@ public:
// For detection-purposes:
static bool getGameInfo(const Common::FSList &fslist, Common::String &name, Common::String &caption);
private:
+ bool _trigDebug;
int init();
void deinit();
int messageLoop();
- Console *_console;
+ GUI::Debugger *_debugger;
BaseGame *_game;
const ADGameDescription *_gameDescription;
};
-// Example console class
-class Console : public GUI::Debugger {
-public:
- Console(WintermuteEngine *vm) {}
- virtual ~Console(void) {}
-};
-
} // End of namespace Wintermute
#endif