diff --git a/stella/src/debugger/Debugger.cxx b/stella/src/debugger/Debugger.cxx index 20812c4fb..c30a5b2ec 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.69 2005-07-19 02:24:12 urchlay Exp $ +// $Id: Debugger.cxx,v 1.70 2005-07-19 17:59:57 stephena Exp $ //============================================================================ #include "bspf.hxx" @@ -35,6 +35,7 @@ #include "RamDebug.hxx" #include "TIADebug.hxx" +#include "TiaOutputWidget.hxx" #include "Debugger.hxx" Debugger* Debugger::myStaticDebugger; @@ -48,6 +49,7 @@ Debugger::Debugger(OSystem* osystem) myCpuDebug(NULL), myRamDebug(NULL), myTiaDebug(NULL), + myTiaOutput(NULL), equateList(NULL), breakPoints(NULL), readTraps(NULL), @@ -85,14 +87,16 @@ Debugger::~Debugger() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Debugger::initialize() { - int x, y, w, h; - getDialogBounds(&x, &y, &w, &h); + GUI::Rect r = getDialogBounds(); delete myBaseDialog; - DebuggerDialog *dd = new DebuggerDialog(myOSystem, this, x, y, w, h); + DebuggerDialog *dd = new DebuggerDialog(myOSystem, this, + r.left, r.top, r.width(), r.height()); myPrompt = dd->prompt(); myBaseDialog = dd; + myTiaOutput = dd->tiaOutput(); + // set up any breakpoint that was on the command line // (and remove the key from the settings, so they won't get set again) string initBreak = myOSystem->settings().getString("break"); @@ -104,11 +108,10 @@ void Debugger::initialize() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Debugger::initializeVideo() { - int x, y, w, h; - getDialogBounds(&x, &y, &w, &h); + GUI::Rect r = getDialogBounds(); string title = string("Stella ") + STELLA_VERSION + ": Debugger mode"; - myOSystem->frameBuffer().initialize(title, w, y+h, false); + myOSystem->frameBuffer().initialize(title, r.width(), r.height(), false); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -513,11 +516,6 @@ int Debugger::step() mySystem->m6502().execute(1); mySystem->lockDataBus(); - // FIXME - this doesn't work yet, pending a partial rewrite of TIA class - myTiaDebug->updateTIA(); - myOSystem->frameBuffer().refreshTIA(true); - /////////////////////////////////////////////////////// - return mySystem->cycles() - cyc; } @@ -532,8 +530,6 @@ int Debugger::step() // to share between stack and variables, I doubt any 2600 games will ever // use recursion... -// FIXME: TIA framebuffer should be updated during tracing! - int Debugger::trace() { @@ -551,11 +547,6 @@ int Debugger::trace() mySystem->lockDataBus(); - // FIXME - this doesn't work yet, pending a partial rewrite of TIA class - myTiaDebug->updateTIA(); - myOSystem->frameBuffer().refreshTIA(true); - /////////////////////////////////////////////////////// - return mySystem->cycles() - cyc; } else { return step(); @@ -647,13 +638,7 @@ const string& Debugger::disassemble(int start, int lines) { void Debugger::nextScanline(int lines) { saveOldState(); mySystem->unlockDataBus(); -// FIXME - add code to 'darken' the current TIA framebuffer, so we can -// differentiate between old content and newly drawn scanlines -// myTiaDebug->clearTIA(); - - myOSystem->frameBuffer().advanceScanline(lines); - myOSystem->frameBuffer().refreshTIA(); - + myTiaOutput->advanceScanline(lines); mySystem->lockDataBus(); } @@ -661,8 +646,7 @@ void Debugger::nextScanline(int lines) { void Debugger::nextFrame(int frames) { saveOldState(); mySystem->unlockDataBus(); - myOSystem->frameBuffer().advance(frames); - myOSystem->frameBuffer().refreshTIA(); + myTiaOutput->advance(frames); mySystem->lockDataBus(); } @@ -785,7 +769,7 @@ void Debugger::setQuitState() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Debugger::getDialogBounds(int* x, int* y, int* w, int* h) +GUI::Rect Debugger::getDialogBounds() const { int userHeight = myOSystem->settings().getInt("debugheight"); if(userHeight < kDebuggerLines) @@ -795,10 +779,43 @@ void Debugger::getDialogBounds(int* x, int* y, int* w, int* h) } userHeight = (userHeight + 3) * kDebuggerLineHeight - 8; - *x = 0; - *y = myConsole->mediaSource().height(); - *w = kDebuggerWidth; - *h = userHeight; + GUI::Rect r(0, 0, kDebuggerWidth, userHeight + myConsole->mediaSource().height()); + return r; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +GUI::Rect Debugger::getTiaBounds() const +{ + GUI::Rect r(0, 0, + myConsole->mediaSource().width() << 1, // width is doubled + myConsole->mediaSource().height()); + return r; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +GUI::Rect Debugger::getStatusBounds() const +{ + // The status area is the full area to the right of the TIA image + GUI::Rect dialog = getDialogBounds(); + GUI::Rect tia = getTiaBounds(); + + GUI::Rect r(tia.width() + 1, 0, + dialog.width(), + tia.height()); + return r; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +GUI::Rect Debugger::getTabBounds() const +{ + // The tab area is the full area below the TIA image + GUI::Rect dialog = getDialogBounds(); + GUI::Rect tia = getTiaBounds(); + + GUI::Rect r(0, tia.height() + 1, + dialog.width(), + dialog.height()); + return r; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/debugger/Debugger.hxx b/stella/src/debugger/Debugger.hxx index 7a8ad9141..726dc6f02 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.56 2005-07-19 01:31:36 urchlay Exp $ +// $Id: Debugger.hxx,v 1.57 2005-07-19 17:59:58 stephena Exp $ //============================================================================ #ifndef DEBUGGER_HXX @@ -25,6 +25,7 @@ class System; class CpuDebug; class RamDebug; class TIADebug; +class TiaOutputWidget; #include "Array.hxx" #include "DialogContainer.hxx" @@ -33,6 +34,7 @@ class TIADebug; #include "EquateList.hxx" #include "PackedBitArray.hxx" #include "PromptWidget.hxx" +#include "Rect.hxx" #include "bspf.hxx" enum { @@ -63,10 +65,11 @@ typedef uInt16 (Debugger::*DEBUGGER_WORD_METHOD)(); for all debugging operations in Stella (parser, 6502 debugger, etc). @author Stephen Anthony - @version $Id: Debugger.hxx,v 1.56 2005-07-19 01:31:36 urchlay Exp $ + @version $Id: Debugger.hxx,v 1.57 2005-07-19 17:59:58 stephena Exp $ */ class Debugger : public DialogContainer { + friend class DebuggerDialog; friend class DebuggerParser; friend class EventHandler; @@ -251,9 +254,13 @@ class Debugger : public DialogContainer void setQuitState(); /** - Get the dimensions of the debugger dialog (takes mediasource into account) + Get the dimensions of the various debugger dialog areas + (takes mediasource into account) */ - void getDialogBounds(int* x, int* y, int* w, int* h); + GUI::Rect getDialogBounds() const; + GUI::Rect getStatusBounds() const; + GUI::Rect getTiaBounds() const; + GUI::Rect getTabBounds() const; /** Resize the debugger dialog based on the current dimensions from @@ -311,6 +318,8 @@ class Debugger : public DialogContainer RamDebug* myRamDebug; TIADebug* myTiaDebug; + TiaOutputWidget* myTiaOutput; + EquateList *equateList; PackedBitArray *breakPoints; PackedBitArray *readTraps; diff --git a/stella/src/debugger/TIADebug.cxx b/stella/src/debugger/TIADebug.cxx index 1c3a8db1b..d56042d63 100644 --- a/stella/src/debugger/TIADebug.cxx +++ b/stella/src/debugger/TIADebug.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: TIADebug.cxx,v 1.13 2005-07-15 18:19:29 stephena Exp $ +// $Id: TIADebug.cxx,v 1.14 2005-07-19 17:59:58 stephena Exp $ //============================================================================ #include "System.hxx" @@ -67,12 +67,6 @@ void TIADebug::saveOldState() myOldState.coluRegs.push_back(coluBK()); } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TIADebug::clearTIA() -{ - myTIA->clearBuffers(); -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt8 TIADebug::coluP0(int newVal) { @@ -141,13 +135,6 @@ bool TIADebug::vblank() return (myTIA->myVBLANK & 2) == 2; } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TIADebug::updateTIA() -{ - // not working the way I expected: - // myTIA->updateFrame(myTIA->mySystem->cycles() * 3); -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - string TIADebug::colorSwatch(uInt8 c) { diff --git a/stella/src/debugger/TIADebug.hxx b/stella/src/debugger/TIADebug.hxx index 7ac45d13d..35debb796 100644 --- a/stella/src/debugger/TIADebug.hxx +++ b/stella/src/debugger/TIADebug.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: TIADebug.hxx,v 1.11 2005-07-19 00:05:21 urchlay Exp $ +// $Id: TIADebug.hxx,v 1.12 2005-07-19 17:59:58 stephena Exp $ //============================================================================ #ifndef TIA_DEBUG_HXX @@ -50,8 +50,6 @@ class TIADebug : public DebuggerSystem void saveOldState(); - void clearTIA(); - // FIXME - add whole slew of setXXX() methods uInt8 coluP0(int newVal = -1); uInt8 coluP1(int newVal = -1); @@ -62,7 +60,6 @@ class TIADebug : public DebuggerSystem int frameCount(); bool vsync(); bool vblank(); - void updateTIA(); string state(); private: diff --git a/stella/src/debugger/TiaOutputWidget.cxx b/stella/src/debugger/TiaOutputWidget.cxx new file mode 100644 index 000000000..86920c0d5 --- /dev/null +++ b/stella/src/debugger/TiaOutputWidget.cxx @@ -0,0 +1,73 @@ +//============================================================================ +// +// SSSS tt lll lll +// SS SS tt ll ll +// SS tttttt eeee ll ll aaaa +// SSSS tt ee ee ll ll aa +// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" +// SS SS tt ee ll ll aa aa +// SSSS ttt eeeee llll llll aaaaa +// +// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team +// +// See the file "license" for information on usage and redistribution of +// this file, and for a DISCLAIMER OF ALL WARRANTIES. +// +// $Id: TiaOutputWidget.cxx,v 1.1 2005-07-19 17:59:58 stephena Exp $ +// +// Based on code from ScummVM - Scumm Interpreter +// Copyright (C) 2002-2004 The ScummVM project +//============================================================================ + +#include "OSystem.hxx" +#include "FrameBuffer.hxx" +#include "Widget.hxx" +#include "GuiObject.hxx" + +#include "TiaOutputWidget.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +TiaOutputWidget::TiaOutputWidget(GuiObject* boss, int x, int y, int w, int h) + : Widget(boss, x, y, w, h), + CommandSender(boss), + _dirty(true) +{ +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +TiaOutputWidget::~TiaOutputWidget() +{ +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void TiaOutputWidget::advanceScanline(int lines) +{ + while(lines) + { + instance()->console().mediaSource().updateScanline(); + --lines; + } + _dirty = true; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void TiaOutputWidget::advance(int frames) +{ + while(frames) + { + instance()->console().mediaSource().update(); + --frames; + } + _dirty = true; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void TiaOutputWidget::drawWidget(bool hilite) +{ +// if(_dirty) // FIXME - only redraw this when necessary?? + { + instance()->frameBuffer().refreshTIA(); + instance()->frameBuffer().drawMediaSource(); + _dirty = false; + } +} diff --git a/stella/src/debugger/TiaOutputWidget.hxx b/stella/src/debugger/TiaOutputWidget.hxx new file mode 100644 index 000000000..fd4ace163 --- /dev/null +++ b/stella/src/debugger/TiaOutputWidget.hxx @@ -0,0 +1,60 @@ +//============================================================================ +// +// SSSS tt lll lll +// SS SS tt ll ll +// SS tttttt eeee ll ll aaaa +// SSSS tt ee ee ll ll aa +// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" +// SS SS tt ee ll ll aa aa +// SSSS ttt eeeee llll llll aaaaa +// +// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team +// +// See the file "license" for information on usage and redistribution of +// this file, and for a DISCLAIMER OF ALL WARRANTIES. +// +// $Id: TiaOutputWidget.hxx,v 1.1 2005-07-19 17:59:58 stephena Exp $ +// +// Based on code from ScummVM - Scumm Interpreter +// Copyright (C) 2002-2004 The ScummVM project +//============================================================================ + +#ifndef TIA_OUTPUT_WIDGET_HXX +#define TIA_OUTPUT_WIDGET_HXX + +class GuiObject; + +#include "Widget.hxx" +#include "Command.hxx" + + +class TiaOutputWidget : public Widget, public CommandSender +{ + public: + TiaOutputWidget(GuiObject *boss, int x, int y, int w, int h); + virtual ~TiaOutputWidget(); + +// Eventually, these methods will enable access to the onscreen TIA image +// For example, clicking an area may cause an action +// (fill to this scanline, etc). +/* + virtual void handleMouseDown(int x, int y, int button, int clickCount); + virtual void handleMouseUp(int x, int y, int button, int clickCount); + virtual void handleMouseWheel(int x, int y, int direction); + virtual bool handleKeyDown(int ascii, int keycode, int modifiers); + virtual bool handleKeyUp(int ascii, int keycode, int modifiers); + virtual void handleCommand(CommandSender* sender, int cmd, int data, int id); +*/ + virtual bool wantsFocus() { return false; } + + void advanceScanline(int lines); + void advance(int frames); + + protected: + void drawWidget(bool hilite); + + private: + bool _dirty; +}; + +#endif diff --git a/stella/src/debugger/module.mk b/stella/src/debugger/module.mk index 56fd61c80..c69d30e0e 100644 --- a/stella/src/debugger/module.mk +++ b/stella/src/debugger/module.mk @@ -38,7 +38,8 @@ MODULE_OBJS := \ src/debugger/PackedBitArray.o \ src/debugger/CpuDebug.o \ src/debugger/RamDebug.o \ - src/debugger/TIADebug.o + src/debugger/TIADebug.o \ + src/debugger/TiaOutputWidget.o MODULE_DIRS += \ src/debugger diff --git a/stella/src/emucore/FrameBuffer.cxx b/stella/src/emucore/FrameBuffer.cxx index 88560b49b..c3b86f964 100644 --- a/stella/src/emucore/FrameBuffer.cxx +++ b/stella/src/emucore/FrameBuffer.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: FrameBuffer.cxx,v 1.52 2005-07-15 18:19:29 stephena Exp $ +// $Id: FrameBuffer.cxx,v 1.53 2005-07-19 17:59:58 stephena Exp $ //============================================================================ #include @@ -130,6 +130,10 @@ void FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height, // Initialize video subsystem initSubsystem(); + // Set emulation palette if a console exists + if(&myOSystem->console()) + setPalette(myOSystem->console().mediaSource().palette()); + // Enable unicode so we can see translated key events // (lowercase vs. uppercase characters) SDL_EnableUNICODE(1); @@ -231,26 +235,6 @@ void FrameBuffer::update() case EventHandler::S_DEBUGGER: { - // Get one frames' worth of data - bool advance = false; - if(theFrameAdvanceIndicator > 0) - { - myOSystem->console().mediaSource().update(); - advance = true; - --theFrameAdvanceIndicator; - } - else if(theScanlineAdvanceIndicator > 0) - { - myOSystem->console().mediaSource().updateScanline(); - advance = true; - --theScanlineAdvanceIndicator; - } - - // Only update the screen if it's been invalidated or we're in - // frame advance mode - if(advance || theRedrawTIAIndicator) - drawMediaSource(); - // Only update the overlay if it's changed if(theRedrawOverlayIndicator) { @@ -301,28 +285,6 @@ void FrameBuffer::refreshOverlay(bool now) if(now) update(); } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FrameBuffer::advanceScanline(int lines) -{ - if(myOSystem->eventHandler().state() != EventHandler::S_DEBUGGER) - return; - - theScanlineAdvanceIndicator = lines; - while(theScanlineAdvanceIndicator) - update(); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FrameBuffer::advance(int frames) -{ - if(myOSystem->eventHandler().state() != EventHandler::S_DEBUGGER) - return; - - theFrameAdvanceIndicator = frames; - while(theFrameAdvanceIndicator) - update(); -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void FrameBuffer::showMessage(const string& message) { diff --git a/stella/src/emucore/FrameBuffer.hxx b/stella/src/emucore/FrameBuffer.hxx index bc8c3fc38..d97c73ac2 100644 --- a/stella/src/emucore/FrameBuffer.hxx +++ b/stella/src/emucore/FrameBuffer.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: FrameBuffer.hxx,v 1.47 2005-07-15 18:19:29 stephena Exp $ +// $Id: FrameBuffer.hxx,v 1.48 2005-07-19 17:59:59 stephena Exp $ //============================================================================ #ifndef FRAMEBUFFER_HXX @@ -52,7 +52,7 @@ enum FrameStyle { All GUI elements (ala ScummVM) are drawn here as well. @author Stephen Anthony - @version $Id: FrameBuffer.hxx,v 1.47 2005-07-15 18:19:29 stephena Exp $ + @version $Id: FrameBuffer.hxx,v 1.48 2005-07-19 17:59:59 stephena Exp $ */ class FrameBuffer { @@ -145,16 +145,6 @@ class FrameBuffer */ void refreshOverlay(bool now = false); - /** - Indicates that the emulation should advance given number of scanlines. - */ - void advanceScanline(int lines); - - /** - Indicates that the emulation should advance given number of frames. - */ - void advance(int frames); - /** Toggles between fullscreen and window mode. Grabmouse activated when in fullscreen mode. diff --git a/stella/src/gui/DebuggerDialog.cxx b/stella/src/gui/DebuggerDialog.cxx index c2a0b7ac1..315693e7f 100644 --- a/stella/src/gui/DebuggerDialog.cxx +++ b/stella/src/gui/DebuggerDialog.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: DebuggerDialog.cxx,v 1.25 2005-07-16 21:29:46 stephena Exp $ +// $Id: DebuggerDialog.cxx,v 1.26 2005-07-19 17:59:59 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -22,11 +22,13 @@ #include "Widget.hxx" #include "Dialog.hxx" #include "TabWidget.hxx" +#include "TiaOutputWidget.hxx" #include "PromptWidget.hxx" #include "CpuWidget.hxx" #include "RamWidget.hxx" #include "TiaWidget.hxx" #include "CheatWidget.hxx" +#include "Rect.hxx" #include "Debugger.hxx" #include "DebuggerDialog.hxx" @@ -45,61 +47,9 @@ DebuggerDialog::DebuggerDialog(OSystem* osystem, DialogContainer* parent, : Dialog(osystem, parent, x, y, w, h), myTab(NULL) { - const int vBorder = 4; - const int vWidth = _w - kButtonWidth - 20; - - // The tab widget - myTab = new TabWidget(this, 0, vBorder, vWidth, _h - vBorder - 1); - - // 1) The Prompt/console tab - myTab->addTab("Prompt"); - myPrompt = new PromptWidget(myTab, 2, 2, vWidth - vBorder, _h - 25); - myTab->setParentWidget(0, myPrompt, myPrompt); - - // 2) The CPU tab - myTab->addTab("CPU"); - CpuWidget* cpu = new CpuWidget(myTab, 2, 2, vWidth - vBorder, _h - 25); - myTab->setParentWidget(1, cpu, cpu->activeWidget()); - - // 3) The RAM tab (part of RIOT) - myTab->addTab("RAM"); - RamWidget* ram = new RamWidget(myTab, 2, 2, vWidth - vBorder, _h - 25); - myTab->setParentWidget(2, ram, ram->activeWidget()); - - // 4) The input/output tab (part of RIOT) - myTab->addTab("I/O"); - - - // 5) The TIA tab - myTab->addTab("TIA"); - TiaWidget* tia = new TiaWidget(myTab, 2, 2, vWidth - vBorder, _h - 25); - myTab->setParentWidget(4, tia, tia->activeWidget()); - - - // 6) The ROM tab - myTab->addTab("ROM"); - - - // 7) The Cheat tab - myTab->addTab("Cheat"); - CheatWidget* cheat = new CheatWidget(myTab, 2, 2, - vWidth - vBorder, _h - 25); - myTab->setParentWidget(6, cheat, cheat->activeWidget()); - - // Set active tab to prompt - myTab->setActiveTab(0); - - // Add some buttons that are always shown, no matter which tab we're in - int yoff = vBorder + kTabHeight + 5; - addButton(vWidth + 10, yoff, "Step", kDDStepCmd, 0); - yoff += 22; - addButton(vWidth + 10, yoff, "Trace", kDDTraceCmd, 0); - yoff += 22; - addButton(vWidth + 10, yoff, "Scan +1", kDDSAdvCmd, 0); - yoff += 22; - addButton(vWidth + 10, yoff, "Frame +1", kDDAdvCmd, 0); - - addButton(vWidth + 10, _h - 22 - 10, "Exit", kDDExitCmd, 0); + addTiaArea(); + addTabArea(); + addStatusArea(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -165,6 +115,90 @@ void DebuggerDialog::handleCommand(CommandSender* sender, int cmd, } } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void DebuggerDialog::addTiaArea() +{ + GUI::Rect r = instance()->debugger().getTiaBounds(); + + myTiaOutput = new TiaOutputWidget(this, r.left, r.top, r.width(), r.height()); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void DebuggerDialog::addTabArea() +{ + const int vBorder = 4; + const int vWidth = _w - kButtonWidth - 20; + + GUI::Rect r = instance()->debugger().getTabBounds(); + + // The tab widget + myTab = new TabWidget(this, r.left, r.top + vBorder, vWidth, + r.height() - vBorder); + + // 1) The Prompt/console tab + myTab->addTab("Prompt"); + myPrompt = new PromptWidget(myTab, 2, 2, vWidth - vBorder, + r.height() - 25); + myTab->setParentWidget(0, myPrompt, myPrompt); + + // 2) The CPU tab + myTab->addTab("CPU"); + CpuWidget* cpu = new CpuWidget(myTab, 2, 2, vWidth - vBorder, + r.height() - 25); + myTab->setParentWidget(1, cpu, cpu->activeWidget()); + + // 3) The RAM tab (part of RIOT) + myTab->addTab("RAM"); + RamWidget* ram = new RamWidget(myTab, 2, 2, vWidth - vBorder, + r.height() - 25); + myTab->setParentWidget(2, ram, ram->activeWidget()); + + // 4) The input/output tab (part of RIOT) + myTab->addTab("I/O"); + + + // 5) The TIA tab + myTab->addTab("TIA"); + TiaWidget* tia = new TiaWidget(myTab, 2, 2, vWidth - vBorder, + r.height() - 25); + myTab->setParentWidget(4, tia, tia->activeWidget()); + + + // 6) The ROM tab + myTab->addTab("ROM"); + + + // 7) The Cheat tab + myTab->addTab("Cheat"); + CheatWidget* cheat = new CheatWidget(myTab, 2, 2, + vWidth - vBorder, r.height() - 25); + myTab->setParentWidget(6, cheat, cheat->activeWidget()); + + // Set active tab to prompt + myTab->setActiveTab(0); + + // Add some buttons that are always shown, no matter which tab we're in + int yoff = r.top + vBorder + kTabHeight + 5; + addButton(vWidth + 10, yoff, "Step", kDDStepCmd, 0); + yoff += 22; + addButton(vWidth + 10, yoff, "Trace", kDDTraceCmd, 0); + yoff += 22; + addButton(vWidth + 10, yoff, "Scan +1", kDDSAdvCmd, 0); + yoff += 22; + addButton(vWidth + 10, yoff, "Frame +1", kDDAdvCmd, 0); + + addButton(vWidth + 10, r.bottom - 22 - 10, "Exit", kDDExitCmd, 0); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void DebuggerDialog::addStatusArea() +{ + GUI::Rect r = instance()->debugger().getStatusBounds(); + + new StaticTextWidget(this, r.left, r.top, 100, kLineHeight, + "Just a test", kTextAlignLeft); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DebuggerDialog::doStep() { @@ -198,9 +232,3 @@ void DebuggerDialog::doExit() { instance()->debugger().quit(); } - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -PromptWidget *DebuggerDialog::prompt() -{ - return myPrompt; -} diff --git a/stella/src/gui/DebuggerDialog.hxx b/stella/src/gui/DebuggerDialog.hxx index 518c7c0a9..5e09fc707 100644 --- a/stella/src/gui/DebuggerDialog.hxx +++ b/stella/src/gui/DebuggerDialog.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: DebuggerDialog.hxx,v 1.12 2005-07-15 15:27:29 stephena Exp $ +// $Id: DebuggerDialog.hxx,v 1.13 2005-07-19 17:59:59 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -22,9 +22,11 @@ #ifndef DEBUGGER_DIALOG_HXX #define DEBUGGER_DIALOG_HXX +class Debugger; class OSystem; class DialogContainer; class TabWidget; +class TiaOutputWidget; #include "Dialog.hxx" #include "PromptWidget.hxx" @@ -36,16 +38,23 @@ class DebuggerDialog : public Dialog int x, int y, int w, int h); ~DebuggerDialog(); - PromptWidget *prompt(); + PromptWidget* prompt() { return myPrompt; } + TiaOutputWidget* tiaOutput() { return myTiaOutput; } + virtual void loadConfig(); virtual void handleKeyDown(int ascii, int keycode, int modifiers); virtual void handleCommand(CommandSender* sender, int cmd, int data, int id); protected: TabWidget* myTab; + TiaOutputWidget* myTiaOutput; PromptWidget *myPrompt; private: + void addTiaArea(); + void addTabArea(); + void addStatusArea(); + void doStep(); void doTrace(); void doScanlineAdvance();