[Scummvm-cvs-logs] CVS: scummvm/simon debugger.cpp,NONE,1.1 debugger.h,NONE,1.1 module.mk,1.7,1.8 simon.cpp,1.415,1.416 simon.h,1.121,1.122
Oliver Kiehl
olki at users.sourceforge.net
Tue Jan 27 08:38:44 CET 2004
Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19622
Modified Files:
module.mk simon.cpp simon.h
Added Files:
debugger.cpp debugger.h
Log Message:
add in-game debugger
--- NEW FILE: debugger.cpp ---
/* 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: /cvsroot/scummvm/scummvm/simon/debugger.cpp,v 1.1 2004/01/27 16:28:38 olki Exp $
*
*/
#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
--- NEW FILE: debugger.h ---
/* 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: /cvsroot/scummvm/scummvm/simon/debugger.h,v 1.1 2004/01/27 16:28:38 olki Exp $
*
*/
#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
Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/module.mk,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- module.mk 18 Sep 2003 13:03:56 -0000 1.7
+++ module.mk 27 Jan 2004 16:28:38 -0000 1.8
@@ -3,6 +3,7 @@
MODULE_OBJS := \
simon/charset.o \
simon/debug.o \
+ simon/debugger.o \
simon/items.o \
simon/midi.o \
simon/midiparser_s1d.o \
Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.415
retrieving revision 1.416
diff -u -d -r1.415 -r1.416
--- simon.cpp 27 Jan 2004 13:33:17 -0000 1.415
+++ simon.cpp 27 Jan 2004 16:28:38 -0000 1.416
@@ -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 @@
delete [] _fcs_list;
delete _sound;
+ delete _debugger;
}
void SimonEngine::errorString(const char *buf1, char *buf2) {
@@ -4785,6 +4787,7 @@
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 @@
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 @@
_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)
Index: simon.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.h,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -d -r1.121 -r1.122
--- simon.h 6 Jan 2004 12:45:31 -0000 1.121
+++ simon.h 27 Jan 2004 16:28:39 -0000 1.122
@@ -102,8 +102,12 @@
};
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 @@
bool _ambient_paused;
bool _music_paused;
+ Debugger *_debugger;
+
int _timer_id;
FILE *_dump_file;
More information about the Scummvm-git-logs
mailing list