add in-game debugger
svn-id: r12634
This commit is contained in:
parent
0b34435070
commit
832155b8cf
5 changed files with 127 additions and 0 deletions
65
simon/debugger.cpp
Normal file
65
simon/debugger.cpp
Normal file
|
@ -0,0 +1,65 @@
|
|||
/* ScummVM - Scumm Interpreter
|
||||
* Copyright (C) 2003-2004 The ScummVM project
|
||||
*
|
||||
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "common/debugger.cpp"
|
||||
#include "simon/debugger.h"
|
||||
#include "simon/simon.h"
|
||||
|
||||
namespace Simon {
|
||||
|
||||
Debugger::Debugger(SimonEngine *vm)
|
||||
: Common::Debugger<Debugger>() {
|
||||
_vm = vm;
|
||||
|
||||
DCmd_Register("exit", &Debugger::Cmd_Exit);
|
||||
DCmd_Register("quit", &Debugger::Cmd_Exit);
|
||||
DCmd_Register("playVoice", &Debugger::Cmd_PlayVoice);
|
||||
}
|
||||
|
||||
|
||||
void Debugger::preEnter() {
|
||||
_vm->midi.pause(1);
|
||||
}
|
||||
|
||||
|
||||
void Debugger::postEnter() {
|
||||
_vm->midi.pause(0);
|
||||
}
|
||||
|
||||
|
||||
bool Debugger::Cmd_Exit(int argc, const char **argv) {
|
||||
_detach_now = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Debugger::Cmd_PlayVoice(int argc, const char **argv) {
|
||||
if (argc > 1) {
|
||||
uint voice = atoi(argv[1]);
|
||||
_vm->_sound->playVoice(voice);
|
||||
} else
|
||||
DebugPrintf("Syntax: playvoice <soundnum>\n");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // End of namespace Simon
|
||||
|
47
simon/debugger.h
Normal file
47
simon/debugger.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
/* ScummVM - Scumm Interpreter
|
||||
* Copyright (C) 2003-2004 The ScummVM project
|
||||
*
|
||||
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SIMON_DEBUGGER_H
|
||||
#define SIMON_DEBUGGER_H
|
||||
|
||||
#include "common/debugger.h"
|
||||
|
||||
namespace Simon {
|
||||
|
||||
class SimonEngine;
|
||||
|
||||
class Debugger : public Common::Debugger<Debugger> {
|
||||
public:
|
||||
Debugger(SimonEngine *vm);
|
||||
|
||||
protected:
|
||||
SimonEngine *_vm;
|
||||
|
||||
virtual void preEnter();
|
||||
virtual void postEnter();
|
||||
|
||||
bool Cmd_Exit(int argc, const char **argv);
|
||||
bool Cmd_PlayVoice(int argc, const char **argv);
|
||||
};
|
||||
|
||||
} // End of namespace Simon
|
||||
|
||||
#endif
|
|
@ -3,6 +3,7 @@ MODULE := simon
|
|||
MODULE_OBJS := \
|
||||
simon/charset.o \
|
||||
simon/debug.o \
|
||||
simon/debugger.o \
|
||||
simon/items.o \
|
||||
simon/midi.o \
|
||||
simon/midiparser_s1d.o \
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "simon/simon.h"
|
||||
#include "simon/intern.h"
|
||||
#include "simon/vga.h"
|
||||
#include "simon/debugger.h"
|
||||
|
||||
#include "sound/mididrv.h"
|
||||
|
||||
|
@ -599,6 +600,7 @@ SimonEngine::~SimonEngine() {
|
|||
delete [] _fcs_list;
|
||||
|
||||
delete _sound;
|
||||
delete _debugger;
|
||||
}
|
||||
|
||||
void SimonEngine::errorString(const char *buf1, char *buf2) {
|
||||
|
@ -4785,6 +4787,7 @@ void SimonEngine::go() {
|
|||
setup_vga_file_buf_pointers();
|
||||
|
||||
_sound = new Sound(_game, gss, _gameDataPath, _mixer);
|
||||
_debugger = new Debugger(this);
|
||||
|
||||
if (ConfMan.hasKey("sfx_mute") && ConfMan.getBool("sfx_mute") == 1) {
|
||||
if (_game == GAME_SIMON1DOS)
|
||||
|
@ -4896,6 +4899,9 @@ void SimonEngine::delay(uint amount) {
|
|||
uint32 cur = start;
|
||||
uint this_delay, vga_period;
|
||||
|
||||
if (_debugger->isAttached())
|
||||
_debugger->onFrame();
|
||||
|
||||
if (_fast_mode)
|
||||
vga_period = 10;
|
||||
else if (_game & GF_SIMON2)
|
||||
|
@ -4944,6 +4950,8 @@ void SimonEngine::delay(uint amount) {
|
|||
_aboutDialog->runModal();
|
||||
} else if (event.kbd.keycode == 'f')
|
||||
_fast_mode ^= 1;
|
||||
else if (event.kbd.keycode == 'd')
|
||||
_debugger->attach();
|
||||
}
|
||||
// Make sure backspace works right (this fixes a small issue on OS X)
|
||||
if (event.kbd.keycode == 8)
|
||||
|
|
|
@ -103,7 +103,11 @@ struct VgaTimerEntry {
|
|||
|
||||
struct GameSpecificSettings;
|
||||
|
||||
class Debugger;
|
||||
|
||||
class SimonEngine : public Engine {
|
||||
friend class Debugger;
|
||||
|
||||
void errorString(const char *buf_input, char *buf_output);
|
||||
protected:
|
||||
void playSting(uint a);
|
||||
|
@ -344,6 +348,8 @@ protected:
|
|||
bool _ambient_paused;
|
||||
bool _music_paused;
|
||||
|
||||
Debugger *_debugger;
|
||||
|
||||
int _timer_id;
|
||||
|
||||
FILE *_dump_file;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue