mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-22 01:57:16 +00:00
GNAP: Add debugger
This commit is contained in:
parent
03027be392
commit
52f0712b66
42
engines/gnap/debugger.cpp
Normal file
42
engines/gnap/debugger.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
/* 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 "gnap/debugger.h"
|
||||
#include "gnap/gnap.h"
|
||||
|
||||
namespace Gnap {
|
||||
|
||||
Debugger::Debugger(GnapEngine *vm) : GUI::Debugger(), _vm(vm) {
|
||||
// Register methods
|
||||
registerCmd("hotspots", WRAP_METHOD(Debugger, Cmd_Hotspots));
|
||||
|
||||
// Set fields
|
||||
_showHotspotNumber = false;
|
||||
}
|
||||
|
||||
bool Debugger::Cmd_Hotspots(int argc, const char **argv) {
|
||||
_showHotspotNumber ^= 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // End of namespace Gnap
|
54
engines/gnap/debugger.h
Normal file
54
engines/gnap/debugger.h
Normal file
@ -0,0 +1,54 @@
|
||||
/* 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 GNAP_DEBUGGER_H
|
||||
#define GNAP_DEBUGGER_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "gui/debugger.h"
|
||||
|
||||
namespace Gnap {
|
||||
|
||||
class GnapEngine;
|
||||
|
||||
class Debugger : public GUI::Debugger {
|
||||
private:
|
||||
GnapEngine *_vm;
|
||||
public:
|
||||
/*
|
||||
* Specifies whether to show the hotspot IDs
|
||||
*/
|
||||
bool _showHotspotNumber;
|
||||
protected:
|
||||
/**
|
||||
* List the active hotspots during the current time period
|
||||
*/
|
||||
bool Cmd_Hotspots(int argc, const char **argv);
|
||||
|
||||
public:
|
||||
Debugger(GnapEngine *vm);
|
||||
virtual ~Debugger() {}
|
||||
};
|
||||
|
||||
} // End of namespace Gnap
|
||||
|
||||
#endif
|
@ -139,7 +139,8 @@ Common::Error GnapEngine::run() {
|
||||
_sequenceCache = new SequenceCache(_dat);
|
||||
_gameSys = new GameSys(this);
|
||||
_soundMan = new SoundMan(this);
|
||||
|
||||
_debugger = new Debugger(this);
|
||||
|
||||
_menuBackgroundSurface = nullptr;
|
||||
|
||||
initGlobalSceneVars();
|
||||
@ -213,6 +214,7 @@ Common::Error GnapEngine::run() {
|
||||
delete _soundCache;
|
||||
delete _spriteCache;
|
||||
delete _dat;
|
||||
delete _debugger;
|
||||
|
||||
delete _exe;
|
||||
|
||||
@ -227,6 +229,13 @@ void GnapEngine::updateEvents() {
|
||||
while (_eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_KEYDOWN:
|
||||
// Check for debugger
|
||||
if (event.kbd.keycode == Common::KEYCODE_d && (event.kbd.flags & Common::KBD_CTRL)) {
|
||||
// Attach to the debugger
|
||||
_debugger->attach();
|
||||
_debugger->onFrame();
|
||||
}
|
||||
|
||||
_keyPressState[event.kbd.keycode] = 1;
|
||||
_keyDownState[event.kbd.keycode] = 1;
|
||||
break;
|
||||
@ -387,13 +396,13 @@ void GnapEngine::updateCursorByHotspot() {
|
||||
if (!_isWaiting) {
|
||||
int hotspotIndex = getHotspotIndexAtPos(_mouseX, _mouseY);
|
||||
|
||||
#if 1
|
||||
// NOTE This causes some display glitches so don't worry
|
||||
char t[256];
|
||||
sprintf(t, "hotspot = %d", hotspotIndex);
|
||||
_gameSys->fillSurface(0, 10, 10, 80, 16, 0, 0, 0);
|
||||
_gameSys->drawTextToSurface(0, 10, 10, 255, 255, 255, t);
|
||||
#endif
|
||||
if (_debugger->_showHotspotNumber) {
|
||||
// NOTE This causes some display glitches so don't worry
|
||||
char t[256];
|
||||
sprintf(t, "hotspot = %d", hotspotIndex);
|
||||
_gameSys->fillSurface(0, 10, 10, 80, 16, 0, 0, 0);
|
||||
_gameSys->drawTextToSurface(0, 10, 10, 255, 255, 255, t);
|
||||
}
|
||||
|
||||
if (hotspotIndex < 0)
|
||||
setCursor(kDisabledCursors[_verbCursor]);
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "graphics/pixelformat.h"
|
||||
#include "graphics/wincursor.h"
|
||||
|
||||
#include "gnap/debugger.h"
|
||||
#include "gnap/resource.h"
|
||||
|
||||
struct ADGameDescription;
|
||||
@ -304,6 +305,7 @@ public:
|
||||
SequenceCache *_sequenceCache;
|
||||
GameSys *_gameSys;
|
||||
SoundMan *_soundMan;
|
||||
Debugger *_debugger;
|
||||
|
||||
int _lastUpdateClock;
|
||||
|
||||
|
@ -2,6 +2,7 @@ MODULE := engines/gnap
|
||||
|
||||
MODULE_OBJS := \
|
||||
datarchive.o \
|
||||
debugger.o \
|
||||
detection.o \
|
||||
gamesys.o \
|
||||
gnap.o \
|
||||
|
Loading…
x
Reference in New Issue
Block a user