From d5e7de306e7e643373870aea28a975cb1fed793c Mon Sep 17 00:00:00 2001 From: stephena Date: Thu, 14 Jul 2005 00:54:28 +0000 Subject: [PATCH] Some work on the 'height' command. It isn't working correctly yet, but at least Stella doesn't crash. I have to implement dialog resizing to take care of the remaining problem (vs. just deleting and re-creating the debugger dialog). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@639 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/debugger/Debugger.cxx | 40 +++++++++++++++++++------- stella/src/debugger/Debugger.hxx | 8 +++--- stella/src/debugger/DebuggerParser.cxx | 16 +++++++++-- stella/src/debugger/DebuggerParser.hxx | 3 +- stella/src/emucore/OSystem.cxx | 12 +------- stella/src/emucore/OSystem.hxx | 9 ++---- stella/src/emucore/Settings.cxx | 4 +-- 7 files changed, 55 insertions(+), 37 deletions(-) diff --git a/stella/src/debugger/Debugger.cxx b/stella/src/debugger/Debugger.cxx index 5e996e609..4980d7709 100644 --- a/stella/src/debugger/Debugger.cxx +++ b/stella/src/debugger/Debugger.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Debugger.cxx,v 1.60 2005-07-12 02:27:04 urchlay Exp $ +// $Id: Debugger.cxx,v 1.61 2005-07-14 00:54:27 stephena Exp $ //============================================================================ #include "bspf.hxx" @@ -77,12 +77,16 @@ Debugger::~Debugger() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Debugger::initialize() { +cerr << "Debugger::initialize()\n"; // Calculate the actual pixels required for the # of lines // This is currently a bit of a hack, since it uses pixel // values that it shouldn't know about (font and tab height, etc) int userHeight = myOSystem->settings().getInt("debugheight"); if(userHeight < kDebuggerLines) + { userHeight = kDebuggerLines; + myOSystem->settings().setInt("debugheight", userHeight); + } userHeight = (userHeight + 3) * kDebuggerLineHeight - 8; int x = 0, @@ -90,6 +94,12 @@ void Debugger::initialize() w = kDebuggerWidth, h = userHeight; +cerr << "x = " << x << endl + << "y = " << y << endl + << "w = " << w << endl + << "h = " << h << endl + << endl; + delete myBaseDialog; DebuggerDialog *dd = new DebuggerDialog(myOSystem, this, x, y, w, h); myPrompt = dd->prompt(); @@ -105,6 +115,8 @@ void Debugger::initialize() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Debugger::initializeVideo() { +cerr << "Debugger::initializeVideo()\n"; + // Calculate the actual pixels required for entire screen // This is currently a bit of a hack, since it uses pixel // values that it shouldn't know about (font and tab height, etc) @@ -114,6 +126,10 @@ void Debugger::initializeVideo() userHeight = (userHeight + 3) * kDebuggerLineHeight - 8 + myConsole->mediaSource().height(); +cerr << "w = " << kDebuggerWidth << endl + << "h = " << userHeight << endl + << endl; + string title = string("Stella ") + STELLA_VERSION + ": Debugger mode"; myOSystem->frameBuffer().initialize(title, kDebuggerWidth, userHeight, false); } @@ -671,24 +687,28 @@ int Debugger::dpeek(int addr) { } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool Debugger::setHeight(int height) +int Debugger::setHeight(int height) { // FIXME - this doesn't seem to work ... - myOSystem->settings().getInt("debugheight"); - - if(height == 0) - height = kDebuggerLines; +cerr << "debugheight: " << + myOSystem->settings().getInt("debugheight") +<< endl; if(height < kDebuggerLines) - return false; + height = kDebuggerLines; myOSystem->settings().setInt("debugheight", height); - // Restart the debugger subsystem - myOSystem->resetDebugger(); +cerr << "height: " << height << endl; - return true; + quit(); + + // FIXME - implement ScummVM resize code + + start(); + + return height; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/debugger/Debugger.hxx b/stella/src/debugger/Debugger.hxx index c4a7494cd..c033fcdda 100644 --- a/stella/src/debugger/Debugger.hxx +++ b/stella/src/debugger/Debugger.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Debugger.hxx,v 1.48 2005-07-12 02:27:05 urchlay Exp $ +// $Id: Debugger.hxx,v 1.49 2005-07-14 00:54:28 stephena Exp $ //============================================================================ #ifndef DEBUGGER_HXX @@ -38,7 +38,7 @@ class TIADebug; enum { kDebuggerWidth = 639, kDebuggerLineHeight = 12, // based on the height of the console font - kDebuggerLines = 15, + kDebuggerLines = 20, }; // Constants for RAM area @@ -52,7 +52,7 @@ enum { for all debugging operations in Stella (parser, 6502 debugger, etc). @author Stephen Anthony - @version $Id: Debugger.hxx,v 1.48 2005-07-12 02:27:05 urchlay Exp $ + @version $Id: Debugger.hxx,v 1.49 2005-07-14 00:54:28 stephena Exp $ */ class Debugger : public DialogContainer { @@ -232,7 +232,7 @@ class Debugger : public DialogContainer bool writeTrap(int t); void clearAllTraps(); - bool setHeight(int height); + int setHeight(int height); void reloadROM(); diff --git a/stella/src/debugger/DebuggerParser.cxx b/stella/src/debugger/DebuggerParser.cxx index c378b1f0e..445a5e6dc 100644 --- a/stella/src/debugger/DebuggerParser.cxx +++ b/stella/src/debugger/DebuggerParser.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: DebuggerParser.cxx,v 1.52 2005-07-13 02:54:13 urchlay Exp $ +// $Id: DebuggerParser.cxx,v 1.53 2005-07-14 00:54:28 stephena Exp $ //============================================================================ #include "bspf.hxx" @@ -145,7 +145,13 @@ Command DebuggerParser::commands[] = { &DebuggerParser::executeFrame }, - // TODO: height command + { + "height", + "Change height of debugger window", + true, + { kARG_WORD, kARG_END_ARGS }, + &DebuggerParser::executeHeight + }, { "help", @@ -1096,6 +1102,12 @@ void DebuggerParser::executeDump() { commandResult = dump(); } +// "height" +void DebuggerParser::executeHeight() { + int height = debugger->setHeight(args[0]); + commandResult = "height set to " + debugger->valueToString(height, kBASE_10); +} + // "help" void DebuggerParser::executeHelp() { static char buf[256]; diff --git a/stella/src/debugger/DebuggerParser.hxx b/stella/src/debugger/DebuggerParser.hxx index 61acb7354..00e9fc43e 100644 --- a/stella/src/debugger/DebuggerParser.hxx +++ b/stella/src/debugger/DebuggerParser.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: DebuggerParser.hxx,v 1.28 2005-07-11 18:56:27 urchlay Exp $ +// $Id: DebuggerParser.hxx,v 1.29 2005-07-14 00:54:28 stephena Exp $ //============================================================================ #ifndef DEBUGGER_PARSER_HXX @@ -107,6 +107,7 @@ class DebuggerParser void executeDisasm(); void executeDump(); void executeFrame(); + void executeHeight(); void executeHelp(); void executeListbreaks(); void executeListtraps(); diff --git a/stella/src/emucore/OSystem.cxx b/stella/src/emucore/OSystem.cxx index 932927187..65e1ce651 100644 --- a/stella/src/emucore/OSystem.cxx +++ b/stella/src/emucore/OSystem.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: OSystem.cxx,v 1.27 2005-06-23 14:33:11 stephena Exp $ +// $Id: OSystem.cxx,v 1.28 2005-07-14 00:54:28 stephena Exp $ //============================================================================ #include @@ -344,16 +344,6 @@ void OSystem::createLauncher() mySound->mute(true); } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void OSystem::resetDebugger() -{ - // FIXME - this isn't working yet - myDebugger->quit(); - myDebugger->setConsole(myConsole); - myDebugger->initialize(); - myDebugger->start(); -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool OSystem::openROM(const string& rom, uInt8** image, int* size) { diff --git a/stella/src/emucore/OSystem.hxx b/stella/src/emucore/OSystem.hxx index 847002565..504bf386b 100644 --- a/stella/src/emucore/OSystem.hxx +++ b/stella/src/emucore/OSystem.hxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: OSystem.hxx,v 1.24 2005-07-07 02:30:48 urchlay Exp $ +// $Id: OSystem.hxx,v 1.25 2005-07-14 00:54:28 stephena Exp $ //============================================================================ #ifndef OSYSTEM_HXX @@ -44,7 +44,7 @@ class Debugger; other objects belong. @author Stephen Anthony - @version $Id: OSystem.hxx,v 1.24 2005-07-07 02:30:48 urchlay Exp $ + @version $Id: OSystem.hxx,v 1.25 2005-07-14 00:54:28 stephena Exp $ */ class OSystem { @@ -265,11 +265,6 @@ class OSystem */ void createLauncher(); - /** - Restarts the debugger subsystem. - */ - void resetDebugger(); - /** The features which are conditionally compiled into Stella. diff --git a/stella/src/emucore/Settings.cxx b/stella/src/emucore/Settings.cxx index 05c7f863d..a41e857fd 100644 --- a/stella/src/emucore/Settings.cxx +++ b/stella/src/emucore/Settings.cxx @@ -13,7 +13,7 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: Settings.cxx,v 1.53 2005-06-28 23:18:16 stephena Exp $ +// $Id: Settings.cxx,v 1.54 2005-07-14 00:54:28 stephena Exp $ //============================================================================ #include @@ -50,7 +50,7 @@ Settings::Settings(OSystem* osystem) set("grabmouse", "false"); set("center", "true"); set("palette", "standard"); - set("debugheight", "15"); + set("debugheight", "0"); set("sound", "true"); set("fragsize", "512");