Skip to content

Commit

Permalink
HOPKINS: Added debugger skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Oct 14, 2012
1 parent e23f914 commit af2824d
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 0 deletions.
38 changes: 38 additions & 0 deletions engines/hopkins/debugger.cpp
@@ -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
45 changes: 45 additions & 0 deletions engines/hopkins/debugger.h
@@ -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
10 changes: 10 additions & 0 deletions engines/hopkins/events.cpp
Expand Up @@ -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();
}
}

Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions engines/hopkins/hopkins.cpp
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions engines/hopkins/hopkins.h
Expand Up @@ -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"
Expand Down Expand Up @@ -93,6 +94,7 @@ class HopkinsEngine : public Engine {
virtual bool hasFeature(EngineFeature f) const;

public:
Debugger _debugger;
AnimationManager _animationManager;
EventsManager _eventsManager;
FontManager _fontManager;
Expand Down
1 change: 1 addition & 0 deletions engines/hopkins/module.mk
Expand Up @@ -2,6 +2,7 @@ MODULE := engines/hopkins

MODULE_OBJS := \
anim.o \
debugger.o \
detection.o \
dialogs.o \
events.o \
Expand Down

0 comments on commit af2824d

Please sign in to comment.