[Scummvm-cvs-logs] scummvm master -> 5ba950c8a485ed212543e0e784517dbb12d418a1

somaen einarjohants at gmail.com
Wed Jan 23 11:33:01 CET 2013


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
efbe9bdae1 WINTERMUTE: Add in debugger-console, enabled by Ctrl-d
5ba950c8a4 WINTERMUTE: Add the possibility of enabling/disabling FPS from Debugger.


Commit: efbe9bdae12adccf93784987e54de0d2b71a5710
    https://github.com/scummvm/scummvm/commit/efbe9bdae12adccf93784987e54de0d2b71a5710
Author: Einar Johan Trøan Sømåen (einarjohants at gmail.com)
Date: 2013-01-23T02:18:44-08:00

Commit Message:
WINTERMUTE: Add in debugger-console, enabled by Ctrl-d

Changed paths:
  A engines/wintermute/debugger.cpp
  A engines/wintermute/debugger.h
    engines/wintermute/module.mk
    engines/wintermute/platform_osystem.cpp
    engines/wintermute/platform_osystem.h
    engines/wintermute/wintermute.cpp
    engines/wintermute/wintermute.h



diff --git a/engines/wintermute/debugger.cpp b/engines/wintermute/debugger.cpp
new file mode 100644
index 0000000..22e7b1c
--- /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 0000000..00dd8a3
--- /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 2bd71f1..f61e61f 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 0bd99b1..f13bdd2 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 21a77e0..8c39b29 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 bf8b1bb..a4f1827 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 d24b120..1c5b902 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


Commit: 5ba950c8a485ed212543e0e784517dbb12d418a1
    https://github.com/scummvm/scummvm/commit/5ba950c8a485ed212543e0e784517dbb12d418a1
Author: Einar Johan Trøan Sømåen (einarjohants at gmail.com)
Date: 2013-01-23T02:32:06-08:00

Commit Message:
WINTERMUTE: Add the possibility of enabling/disabling FPS from Debugger.

Changed paths:
    engines/wintermute/debugger.cpp
    engines/wintermute/debugger.h
    engines/wintermute/wintermute.h



diff --git a/engines/wintermute/debugger.cpp b/engines/wintermute/debugger.cpp
index 22e7b1c..1160a16 100644
--- a/engines/wintermute/debugger.cpp
+++ b/engines/wintermute/debugger.cpp
@@ -20,4 +20,29 @@
  *
  */
 
-#include "engines/wintermute/debugger.h"
\ No newline at end of file
+#include "engines/wintermute/debugger.h"
+#include "engines/wintermute/wintermute.h"
+#include "engines/wintermute/base/base_game.h"
+
+namespace Wintermute {
+
+Console::Console(WintermuteEngine *vm) : GUI::Debugger(), _engineRef(vm) {
+	DCmd_Register("show_fps", WRAP_METHOD(Console, Cmd_ShowFps));
+}
+
+Console::~Console(void) {
+
+}
+
+bool Console::Cmd_ShowFps(int argc, const char **argv) {
+	if (argc > 1) {
+		if (Common::String(argv[1]) == "true") {
+			_engineRef->_game->_debugShowFPS = true;
+		} else if (Common::String(argv[1]) == "false") {
+			_engineRef->_game->_debugShowFPS = false;
+		}
+	}
+	return true;
+}
+	
+} // end of namespace Wintermute
diff --git a/engines/wintermute/debugger.h b/engines/wintermute/debugger.h
index 00dd8a3..0699803 100644
--- a/engines/wintermute/debugger.h
+++ b/engines/wintermute/debugger.h
@@ -30,8 +30,10 @@ namespace Wintermute {
 class WintermuteEngine;
 class Console : public GUI::Debugger {
 public:
-	Console(WintermuteEngine *vm) : GUI::Debugger(), _engineRef(vm) {}
-	virtual ~Console(void) {}
+	Console(WintermuteEngine *vm);
+	virtual ~Console();
+	
+	bool Cmd_ShowFps(int argc, const char **argv);
 private:
 	WintermuteEngine *_engineRef;
 };
diff --git a/engines/wintermute/wintermute.h b/engines/wintermute/wintermute.h
index 1c5b902..fcaa284 100644
--- a/engines/wintermute/wintermute.h
+++ b/engines/wintermute/wintermute.h
@@ -68,6 +68,8 @@ private:
 	GUI::Debugger *_debugger;
 	BaseGame *_game;
 	const ADGameDescription *_gameDescription;
+
+	friend class Console;
 };
 
 } // End of namespace Wintermute






More information about the Scummvm-git-logs mailing list