HOPKINS: Added debugger skeleton

This commit is contained in:
Paul Gilbert 2012-10-14 13:43:29 +11:00
parent e23f91472e
commit af2824da82
6 changed files with 97 additions and 0 deletions

View File

@ -0,0 +1,38 @@
/* 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 "hopkins/debugger.h"
#include "hopkins/globals.h"
#include "hopkins/graphics.h"
#include "hopkins/hopkins.h"
namespace Hopkins {
Debugger::Debugger() : GUI::Debugger() {
DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit));
}
void Debugger::setParent(HopkinsEngine *vm) {
_vm = vm;
}
} // End of namespace Tony

View File

@ -0,0 +1,45 @@
/* 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 HOPKINS_DEBUGGER_H
#define HOPKINS_DEBUGGER_H
#include "common/scummsys.h"
#include "gui/debugger.h"
namespace Hopkins {
class HopkinsEngine;
class Debugger : public GUI::Debugger {
private:
HopkinsEngine *_vm;
public:
Debugger();
virtual ~Debugger() {}
void setParent(HopkinsEngine *vm);
};
} // End of namespace Hopkins
#endif

View File

@ -198,6 +198,9 @@ void EventsManager::checkForNextFrameCounter() {
if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) {
_priorFrameTime = milli;
g_system->updateScreen();
// Signal the ScummVM debugger
_vm->_debugger.onFrame();
}
}
@ -222,6 +225,13 @@ void EventsManager::pollEvents() {
case Common::EVENT_KEYDOWN:
ESC_KEY = event.kbd.keycode == Common::KEYCODE_ESCAPE;
// Check for debugger
if ((event.kbd.keycode == Common::KEYCODE_d) && (event.kbd.flags & Common::KBD_CTRL)) {
// Attach to the debugger
_vm->_debugger.attach();
_vm->_debugger.onFrame();
}
return;
case Common::EVENT_LBUTTONDOWN:

View File

@ -38,6 +38,7 @@ HopkinsEngine *g_vm;
HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDesc) : Engine(syst),
_gameDescription(gameDesc), _randomSource("Hopkins"), _animationManager() {
g_vm = this;
_debugger.setParent(this);
_animationManager.setParent(this);
_eventsManager.setParent(this);
_fileManager.setParent(this);

View File

@ -32,6 +32,7 @@
#include "engines/engine.h"
#include "graphics/surface.h"
#include "hopkins/anim.h"
#include "hopkins/debugger.h"
#include "hopkins/events.h"
#include "hopkins/files.h"
#include "hopkins/font.h"
@ -93,6 +94,7 @@ protected:
virtual bool hasFeature(EngineFeature f) const;
public:
Debugger _debugger;
AnimationManager _animationManager;
EventsManager _eventsManager;
FontManager _fontManager;

View File

@ -2,6 +2,7 @@ MODULE := engines/hopkins
MODULE_OBJS := \
anim.o \
debugger.o \
detection.o \
dialogs.o \
events.o \