diff --git a/stella/src/debugger/CpuWidget.cxx b/stella/src/debugger/CpuWidget.cxx deleted file mode 100644 index 0da615a85..000000000 --- a/stella/src/debugger/CpuWidget.cxx +++ /dev/null @@ -1,280 +0,0 @@ -//============================================================================ -// -// 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: CpuWidget.cxx,v 1.8 2005-08-19 15:05:09 stephena Exp $ -// -// Based on code from ScummVM - Scumm Interpreter -// Copyright (C) 2002-2004 The ScummVM project -//============================================================================ - -#include - -#include "OSystem.hxx" -#include "GuiUtils.hxx" -#include "GuiObject.hxx" -#include "Debugger.hxx" -#include "CpuDebug.hxx" -#include "Widget.hxx" -#include "DataGridWidget.hxx" -#include "EditTextWidget.hxx" -#include "ToggleBitWidget.hxx" - -#include "CpuWidget.hxx" - -// ID's for the various widgets -// We need ID's, since there are more than one of several types of widgets -enum { - kPCRegID, - kCpuRegID -}; - -enum { - kPCRegAddr, - kSPRegAddr, - kARegAddr, - kXRegAddr, - kYRegAddr -}; - -enum { - kPSRegN = 0, - kPSRegV = 1, - kPSRegB = 3, - kPSRegD = 4, - kPSRegI = 5, - kPSRegZ = 6, - kPSRegC = 7 -}; - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y) - : Widget(boss, x, y, 16, 16), - CommandSender(boss) -{ - const int fontWidth = font.getMaxCharWidth(), - fontHeight = font.getFontHeight(), - lineHeight = font.getLineHeight(); - int xpos, ypos, lwidth; - StaticTextWidget* t; - - // Create a 1x1 grid with label for the PC register - xpos = x; ypos = y; lwidth = 4 * fontWidth; - t = new StaticTextWidget(boss, xpos, ypos+2, lwidth-2, fontHeight, - "PC:", kTextAlignLeft); - t->setFont(font); - myPCGrid = new DataGridWidget(boss, font, xpos + lwidth, ypos, 1, 1, 16, 16); - myPCGrid->setTarget(this); - myPCGrid->setID(kPCRegID); - addFocusWidget(myPCGrid); - - // Create a read-only textbox containing the current PC label - xpos += lwidth + myPCGrid->getWidth() + 10; - myPCLabel = new EditTextWidget(boss, xpos, ypos, fontWidth*15, lineHeight, ""); - myPCLabel->setFont(font); - myPCLabel->setEditable(false); - - // Create a 1x4 grid with labels for the other CPU registers - xpos = x; ypos += myPCGrid->getHeight() + 1; - myCpuGrid = new DataGridWidget(boss, font, xpos + lwidth, ypos, 1, 4, 8, 8); - myCpuGrid->setTarget(this); - myCpuGrid->setID(kCpuRegID); - addFocusWidget(myCpuGrid); - - string labels[4] = { "SP:", "A:", "X:", "Y:" }; - for(int row = 0; row < 4; ++row) - { - t = new StaticTextWidget(boss, xpos, ypos + row*lineHeight + 2, - lwidth-2, fontHeight, - labels[row], kTextAlignLeft); - t->setFont(font); - } - - // Create a bitfield widget for changing the processor status - xpos = x; ypos += 4*lineHeight + 2; - t = new StaticTextWidget(boss, xpos, ypos+2, lwidth-2, fontHeight, - "PS:", kTextAlignLeft); - t->setFont(font); - myPSRegister = new ToggleBitWidget(boss, font, xpos+lwidth, ypos, 8, 1); - myPSRegister->setTarget(this); - addFocusWidget(myPSRegister); - - // Set the strings to be used in the PSRegister - // We only do this once because it's the state that changes, not the strings - const char* offstr[] = { "n", "v", "-", "b", "d", "i", "z", "c" }; - const char* onstr[] = { "N", "V", "-", "B", "D", "I", "Z", "C" }; - StringList off, on; - for(int i = 0; i < 8; ++i) - { - off.push_back(offstr[i]); - on.push_back(onstr[i]); - } - myPSRegister->setList(off, on); - - // Calculate real dimensions - _w = lwidth + myPCGrid->getWidth() + myPCLabel->getWidth() + 20; - _h = ypos + myPSRegister->getHeight() - y; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -CpuWidget::~CpuWidget() -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CpuWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) -{ - int addr = -1, value = -1; - CpuDebug& dbg = instance()->debugger().cpuDebug(); - - switch(cmd) - { - case kDGItemDataChangedCmd: - switch(id) - { - case kPCRegID: - addr = myPCGrid->getSelectedAddr(); - value = myPCGrid->getSelectedValue(); - break; - - case kCpuRegID: - addr = myCpuGrid->getSelectedAddr(); - value = myCpuGrid->getSelectedValue(); - break; - } - - switch(addr) - { - case kPCRegAddr: - dbg.setPC(value); - break; - - case kSPRegAddr: - dbg.setSP(value); - break; - - case kARegAddr: - dbg.setA(value); - break; - - case kXRegAddr: - dbg.setX(value); - break; - - case kYRegAddr: - dbg.setY(value); - break; - } - break; - - case kTWItemDataChangedCmd: - { - bool state = myPSRegister->getSelectedState(); - - switch(data) - { - case kPSRegN: - dbg.setN(state); - break; - - case kPSRegV: - dbg.setV(state); - break; - - case kPSRegB: - dbg.setB(state); - break; - - case kPSRegD: - dbg.setD(state); - break; - - case kPSRegI: - dbg.setI(state); - break; - - case kPSRegZ: - dbg.setZ(state); - break; - - case kPSRegC: - dbg.setC(state); - break; - } - } - } -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CpuWidget::loadConfig() -{ - fillGrid(); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CpuWidget::setOpsWidget(DataGridOpsWidget* w) -{ - myPCGrid->setOpsWidget(w); - myCpuGrid->setOpsWidget(w); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CpuWidget::fillGrid() -{ - IntArray alist; - IntArray vlist; - BoolArray changed; - - // We push the enumerated items as addresses, and deal with the real - // address in the callback (handleCommand) - CpuDebug& cpu = instance()->debugger().cpuDebug(); - CpuState state = (CpuState&) cpu.getState(); - CpuState oldstate = (CpuState&) cpu.getOldState(); - - // Add PC to its own DataGridWidget - alist.push_back(kPCRegAddr); - vlist.push_back(state.PC); - changed.push_back(state.PC != oldstate.PC); - - myPCGrid->setList(alist, vlist, changed); - - // Add the other registers - alist.clear(); vlist.clear(); changed.clear(); - alist.push_back(kSPRegAddr); - alist.push_back(kARegAddr); - alist.push_back(kXRegAddr); - alist.push_back(kYRegAddr); - - // And now fill the values - vlist.push_back(state.SP); - vlist.push_back(state.A); - vlist.push_back(state.X); - vlist.push_back(state.Y); - - // Figure out which items have changed - changed.push_back(state.SP != oldstate.SP); - changed.push_back(state.A != oldstate.A); - changed.push_back(state.X != oldstate.X); - changed.push_back(state.Y != oldstate.Y); - - // Finally, update the register list - myCpuGrid->setList(alist, vlist, changed); - - // Update the PS register booleans - changed.clear(); - for(unsigned int i = 0; i < state.PSbits.size(); ++i) - changed.push_back(state.PSbits[i] != oldstate.PSbits[i]); - - myPSRegister->setState(state.PSbits, changed); -} diff --git a/stella/src/debugger/CpuWidget.hxx b/stella/src/debugger/CpuWidget.hxx deleted file mode 100644 index 132de7a5d..000000000 --- a/stella/src/debugger/CpuWidget.hxx +++ /dev/null @@ -1,57 +0,0 @@ -//============================================================================ -// -// 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: CpuWidget.hxx,v 1.4 2005-08-12 17:12:43 stephena Exp $ -// -// Based on code from ScummVM - Scumm Interpreter -// Copyright (C) 2002-2004 The ScummVM project -//============================================================================ - -#ifndef CPU_WIDGET_HXX -#define CPU_WIDGET_HXX - -class GuiObject; -class ButtonWidget; -class EditTextWidget; -class ToggleBitWidget; - -#include "Array.hxx" -#include "Widget.hxx" -#include "Command.hxx" -#include "DataGridWidget.hxx" - - -class CpuWidget : public Widget, public CommandSender -{ - public: - CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y); - virtual ~CpuWidget(); - - void handleCommand(CommandSender* sender, int cmd, int data, int id); - - void loadConfig(); - void setOpsWidget(DataGridOpsWidget* w); - - private: - void fillGrid(); - - private: - DataGridWidget* myPCGrid; - DataGridWidget* myCpuGrid; - ToggleBitWidget* myPSRegister; - EditTextWidget* myPCLabel; -}; - -#endif diff --git a/stella/src/debugger/PromptWidget.cxx b/stella/src/debugger/PromptWidget.cxx deleted file mode 100644 index 691b49ad3..000000000 --- a/stella/src/debugger/PromptWidget.cxx +++ /dev/null @@ -1,879 +0,0 @@ -//============================================================================ -// -// 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: PromptWidget.cxx,v 1.3 2005-08-15 18:52:15 stephena Exp $ -// -// Based on code from ScummVM - Scumm Interpreter -// Copyright (C) 2002-2004 The ScummVM project -//============================================================================ - -#include -#include - -#include "ScrollBarWidget.hxx" -#include "FrameBuffer.hxx" -#include "EventHandler.hxx" -#include "Version.hxx" -#include "Debugger.hxx" -#include "DebuggerDialog.hxx" -#include "DebuggerParser.hxx" - -#include "PromptWidget.hxx" -#include "EquateList.hxx" - -#define PROMPT "> " - -/* TODO: - * - it is very inefficient to redraw the full thingy when just one char is added/removed. - * Instead, we could just copy the GFX of the blank console (i.e. after the transparent - * background is drawn, before any text is drawn). Then using that, it becomes trivial - * to erase a single character, do scrolling etc. - * - a *lot* of others things, this code is in no way complete and heavily under progress - */ - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -PromptWidget::PromptWidget(GuiObject* boss, int x, int y, int w, int h) - : Widget(boss, x, y, w - kScrollBarWidth, h), - CommandSender(boss), - _makeDirty(false), - _firstTime(true) -{ - _flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | - WIDGET_WANTS_TAB; - _type = kPromptWidget; - - _kConsoleCharWidth = instance()->consoleFont().getMaxCharWidth(); - _kConsoleCharHeight = instance()->consoleFont().getFontHeight(); - _kConsoleLineHeight = _kConsoleCharHeight + 2; - - // Calculate depending values - _lineWidth = (_w - kScrollBarWidth - 2) / _kConsoleCharWidth; - _linesPerPage = (_h - 2) / _kConsoleLineHeight; - - memset(_buffer, 0, kBufferSize * sizeof(int)); - _linesInBuffer = kBufferSize / _lineWidth; - - _currentPos = 0; - _scrollLine = _linesPerPage - 1; - _firstLineInBuffer = 0; - - // Add scrollbar - _scrollBar = new ScrollBarWidget(boss, _x + _w, _y, kScrollBarWidth, _h); - _scrollBar->setTarget(this); - - // Init colors - defaultTextColor = kTextColor; - defaultBGColor = kBGColor; - textColor = defaultTextColor; - bgColor = defaultBGColor; - _inverse = false; - - // Init History - _historyIndex = 0; - _historyLine = 0; - _historySize = 0; - for (int i = 0; i < kHistorySize; i++) - _history[i][0] = '\0'; - - _promptStartPos = _promptEndPos = -1; - - addFocusWidget(this); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -PromptWidget::~PromptWidget() -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::drawWidget(bool hilite) -{ -//cerr << "PromptWidget::drawWidget\n"; - OverlayColor fgcolor, bgcolor; - - FrameBuffer& fb = _boss->instance()->frameBuffer(); - - // Draw text - int start = _scrollLine - _linesPerPage + 1; - int y = _y + 2; - - for (int line = 0; line < _linesPerPage; line++) - { - int x = _x + 1; - for (int column = 0; column < _lineWidth; column++) { - int c = buffer((start + line) * _lineWidth + column); - - if(c & (1 << 17)) { // inverse video flag - fgcolor = bgColor; - bgcolor = (OverlayColor)((c & 0x1ffff) >> 8); - fb.fillRect(x, y, _kConsoleCharWidth, _kConsoleCharHeight, bgcolor); - } else { - fgcolor = (OverlayColor)(c >> 8); - bgcolor = bgColor; - } - fb.drawChar(&instance()->consoleFont(), c & 0x7f, x, y, fgcolor); - x += _kConsoleCharWidth; - } - y += _kConsoleLineHeight; - } - - // Draw the caret - drawCaret(); - - // Draw the scrollbar - _scrollBar->draw(); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::handleMouseDown(int x, int y, int button, int clickCount) -{ - cerr << "PromptWidget::handleMouseDown\n"; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::handleMouseWheel(int x, int y, int direction) -{ - _scrollBar->handleMouseWheel(x, y, direction); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::printPrompt() -{ -// FIXME - the following will probably be permanantly removed -// since it's always shown in the main dialog area -/* - print( instance()->debugger().showWatches() ); - print( instance()->debugger().cpuState() ); - print("\n"); -*/ - print(PROMPT); - _promptStartPos = _promptEndPos = _currentPos; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool PromptWidget::handleKeyDown(int ascii, int keycode, int modifiers) -{ - int i; - bool handled = true; - bool dirty = false; - - switch (keycode) - { - case '\n': // enter/return - case '\r': - { - nextLine(); - - assert(_promptEndPos >= _promptStartPos); - int len = _promptEndPos - _promptStartPos; - - if (len > 0) - { - // We have to allocate the string buffer with new, since VC++ sadly does not - // comply to the C++ standard, so we can't use a dynamic sized stack array. - char *str = new char[len + 1]; - - // Copy the user input to str - for (i = 0; i < len; i++) - str[i] = buffer(_promptStartPos + i) & 0x7f; - str[len] = '\0'; - - // Add the input to the history - addToHistory(str); - - // Pass the command to the debugger, and print the result - print( instance()->debugger().run(str) + "\n"); - - // Get rid of the string buffer - delete [] str; - } - - printPrompt(); - dirty = true; - break; - } - - case 9: // tab - { - // Tab completion: we complete either commands or labels, but not - // both at once. - - if(_currentPos <= _promptStartPos) - break; - - scrollToCurrent(); - int len = _promptEndPos - _promptStartPos; - - int lastDelimPos = -1; - char delimiter = '\0'; - - char *str = new char[len + 1]; - for (i = 0; i < len; i++) { - str[i] = buffer(_promptStartPos + i) & 0x7f; - if(strchr("*@<> ", str[i]) != NULL ) { - lastDelimPos = i; - delimiter = str[i]; - } - } - str[len] = '\0'; - - const char *completionList; - const char *prefix; - int possibilities; - - if(lastDelimPos < 0) { - // no delimiters, do command completion: - DebuggerParser *parser = instance()->debugger().parser(); - possibilities = parser->countCompletions(str); - - if(possibilities < 1) { - delete[] str; - break; - } - - completionList = parser->getCompletions(); - prefix = parser->getCompletionPrefix(); - } else { - // we got a delimiter, so this must be a label: - EquateList *equates = instance()->debugger().equates(); - possibilities = equates->countCompletions(str + lastDelimPos + 1); - - if(possibilities < 1) { - delete[] str; - break; - } - - completionList = equates->getCompletions(); - prefix = equates->getCompletionPrefix(); - } - - if(possibilities == 1) { - // add to buffer as though user typed it (plus a space) - _currentPos = _promptStartPos + lastDelimPos + 1; - while(*completionList != '\0') { - putcharIntern(*completionList++); - } - putcharIntern(' '); - _promptEndPos = _currentPos; - } else { - nextLine(); - // add to buffer as-is, then add PROMPT plus whatever we have so far - _currentPos = _promptStartPos + lastDelimPos + 1; - - print("\n"); - print(completionList); - print("\n"); - print(PROMPT); - - _promptStartPos = _currentPos; - - for(i=0; i 0) - putcharIntern(delimiter); - - print(prefix); - _promptEndPos = _currentPos; - } - delete[] str; - dirty = true; - break; - } - - case 8: // backspace - if (_currentPos > _promptStartPos) - killChar(-1); - - scrollToCurrent(); - dirty = true; - break; - - case 127: - killChar(+1); - dirty = true; - break; - - case 256 + 24: // pageup - if (instance()->eventHandler().kbdShift(modifiers)) - { - // Don't scroll up when at top of buffer - if(_scrollLine < _linesPerPage) - break; - - _scrollLine -= _linesPerPage - 1; - if (_scrollLine < _firstLineInBuffer + _linesPerPage - 1) - _scrollLine = _firstLineInBuffer + _linesPerPage - 1; - updateScrollBuffer(); - - dirty = true; - } - break; - - case 256 + 25: // pagedown - if (instance()->eventHandler().kbdShift(modifiers)) - { - // Don't scroll down when at bottom of buffer - if(_scrollLine >= _promptEndPos / _lineWidth) - break; - - _scrollLine += _linesPerPage - 1; - if (_scrollLine > _promptEndPos / _lineWidth) - _scrollLine = _promptEndPos / _lineWidth; - updateScrollBuffer(); - - dirty = true; - } - break; - - case 256 + 22: // home - if (instance()->eventHandler().kbdShift(modifiers)) - { - _scrollLine = _firstLineInBuffer + _linesPerPage - 1; - updateScrollBuffer(); - } - else - _currentPos = _promptStartPos; - - dirty = true; - break; - - case 256 + 23: // end - if (instance()->eventHandler().kbdShift(modifiers)) - { - _scrollLine = _promptEndPos / _lineWidth; - if (_scrollLine < _linesPerPage - 1) - _scrollLine = _linesPerPage - 1; - updateScrollBuffer(); - } - else - _currentPos = _promptEndPos; - - dirty = true; - break; - - case 273: // cursor up - if (instance()->eventHandler().kbdShift(modifiers)) - { - if(_scrollLine <= _firstLineInBuffer + _linesPerPage - 1) - break; - - _scrollLine -= 1; - updateScrollBuffer(); - - dirty = true; - } - else - historyScroll(+1); - break; - - case 274: // cursor down - if (instance()->eventHandler().kbdShift(modifiers)) - { - // Don't scroll down when at bottom of buffer - if(_scrollLine >= _promptEndPos / _lineWidth) - break; - - _scrollLine += 1; - updateScrollBuffer(); - - dirty = true; - } - else - historyScroll(-1); - break; - - case 275: // cursor right - if (_currentPos < _promptEndPos) - _currentPos++; - - dirty = true; - break; - - case 276: // cursor left - if (_currentPos > _promptStartPos) - _currentPos--; - - dirty = true; - break; - - default: - if (instance()->eventHandler().kbdControl(modifiers)) - { - specialKeys(keycode); - } - else if (instance()->eventHandler().kbdAlt(modifiers)) - { - } - else if (isprint(ascii)) - { - for (i = _promptEndPos - 1; i >= _currentPos; i--) - buffer(i + 1) = buffer(i); - _promptEndPos++; - putchar(ascii); - scrollToCurrent(); - } - else - handled = false; - break; - } - - // Take care of changes made above - if(dirty) - { - setDirty(); draw(); - } - - // There are times when we want the prompt and scrollbar to be marked - // as dirty *after* they've been drawn above. One such occurrence is - // when we issue a command that indirectly redraws the entire parent - // dialog (such as 'scanline' or 'frame'). - // In those cases, the return code of the command must be shown, but the - // entire dialog contents are redrawn at a later time. So the prompt and - // scrollbar won't be redrawn unless they're dirty again. - if(_makeDirty) - { - setDirty(); - _scrollBar->setDirty(); - _makeDirty = false; - } - - return handled; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::insertIntoPrompt(const char* str) -{ - unsigned int l = strlen(str); - - for (int i = _promptEndPos - 1; i >= _currentPos; i--) - buffer(i + l) = buffer(i); - - for (unsigned int j = 0; j < l; ++j) - { - _promptEndPos++; - putcharIntern(str[j]); - } -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::handleCommand(CommandSender* sender, int cmd, - int data, int id) -{ - switch (cmd) - { - case kSetPositionCmd: - int newPos = (int)data + _linesPerPage - 1 + _firstLineInBuffer; - if (newPos != _scrollLine) - { - _scrollLine = newPos; - setDirty(); draw(); - } - break; - } -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::loadConfig() -{ - // See logic at the end of handleKeyDown for an explanation of this - _makeDirty = true; - - // Show the prompt the first time we draw this widget - if(_firstTime) - { - // Display greetings & prompt - string version = string("Stella ") + STELLA_VERSION + "\n"; - print(version.c_str()); - print("Debugger is ready\n"); - print(PROMPT); - _promptStartPos = _promptEndPos = _currentPos; - - // Take care of one-time debugger stuff - instance()->debugger().autoExec(); - - _firstTime = false; - } -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::specialKeys(int keycode) -{ - bool handled = false; - - switch (keycode) - { - case 'a': - _currentPos = _promptStartPos; - handled = true; - break; - - case 'd': - killChar(+1); - handled = true; - break; - - case 'e': - _currentPos = _promptEndPos; - handled = true; - break; - - case 'k': - killLine(+1); - handled = true; - break; - - case 'u': - killLine(-1); - handled = true; - break; - - case 'w': - killLastWord(); - handled = true; - break; - } - - if(handled) - { - setDirty(); draw(); - } -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::killChar(int direction) -{ - if(direction == -1) // Delete previous character (backspace) - { - if(_currentPos <= _promptStartPos) - return; - - _currentPos--; - for (int i = _currentPos; i < _promptEndPos; i++) - buffer(i) = buffer(i + 1); - - buffer(_promptEndPos) = ' '; - _promptEndPos--; - } - else if(direction == 1) // Delete next character (delete) - { - if(_currentPos >= _promptEndPos) - return; - - // There are further characters to the right of cursor - if(_currentPos + 1 <= _promptEndPos) - { - for (int i = _currentPos; i < _promptEndPos; i++) - buffer(i) = buffer(i + 1); - - buffer(_promptEndPos) = ' '; - _promptEndPos--; - } - } -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::killLine(int direction) -{ - if(direction == -1) // erase from current position to beginning of line - { - int count = _currentPos - _promptStartPos; - if(count > 0) - for (int i = 0; i < count; i++) - killChar(-1); - } - else if(direction == 1) // erase from current position to end of line - { - for (int i = _currentPos; i < _promptEndPos; i++) - buffer(i) = ' '; - - _promptEndPos = _currentPos; - } -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::killLastWord() -{ - int cnt = 0; - bool space = true; - while (_currentPos > _promptStartPos) - { - if (buffer(_currentPos - 1) == ' ') - { - if (!space) - break; - } - else - space = false; - - _currentPos--; - cnt++; - } - - for (int i = _currentPos; i < _promptEndPos; i++) - buffer(i) = buffer(i + cnt); - - buffer(_promptEndPos) = ' '; - _promptEndPos -= cnt; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::addToHistory(const char *str) -{ - strcpy(_history[_historyIndex], str); - _historyIndex = (_historyIndex + 1) % kHistorySize; - _historyLine = 0; - - if (_historySize < kHistorySize) - _historySize++; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int PromptWidget::compareHistory(const char *histLine) { - return 1; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::historyScroll(int direction) -{ - if (_historySize == 0) - return; - - if (_historyLine == 0 && direction > 0) - { - int i; - for (i = 0; i < _promptEndPos - _promptStartPos; i++) - _history[_historyIndex][i] = buffer(_promptStartPos + i); - - _history[_historyIndex][i] = '\0'; - } - - // Advance to the next line in the history - int line = _historyLine + direction; - if ((direction < 0 && line < 0) || (direction > 0 && line > _historySize)) - return; - - // If they press arrow-up with anything in the buffer, search backwards - // in the history. - /* - if(direction < 0 && _currentPos > _promptStartPos) { - for(;line > 0; line--) { - if(compareHistory(_history[line]) == 0) - break; - } - } - */ - - _historyLine = line; - - // Remove the current user text - _currentPos = _promptStartPos; - killLine(1); // to end of line - - // ... and ensure the prompt is visible - scrollToCurrent(); - - // Print the text from the history - int idx; - if (_historyLine > 0) - idx = (_historyIndex - _historyLine + _historySize) % _historySize; - else - idx = _historyIndex; - - for (int i = 0; i < kLineBufferSize && _history[idx][i] != '\0'; i++) - putcharIntern(_history[idx][i]); - - _promptEndPos = _currentPos; - - // Ensure once more the caret is visible (in case of very long history entries) - scrollToCurrent(); - - setDirty(); draw(); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::nextLine() -{ - // reset colors every line, so I don't have to remember to do it myself - textColor = defaultTextColor; - bgColor = defaultBGColor; - _inverse = false; - - int line = _currentPos / _lineWidth; - if (line == _scrollLine) - _scrollLine++; - - _currentPos = (line + 1) * _lineWidth; - - updateScrollBuffer(); -} - - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// Call this (at least) when the current line changes or when a new line is added -void PromptWidget::updateScrollBuffer() -{ - int lastchar = MAX(_promptEndPos, _currentPos); - int line = lastchar / _lineWidth; - int numlines = (line < _linesInBuffer) ? line + 1 : _linesInBuffer; - int firstline = line - numlines + 1; - - if (firstline > _firstLineInBuffer) - { - // clear old line from buffer - for (int i = lastchar; i < (line+1) * _lineWidth; ++i) - buffer(i) = ' '; - - _firstLineInBuffer = firstline; - } - - _scrollBar->_numEntries = numlines; - _scrollBar->_currentPos = _scrollBar->_numEntries - (line - _scrollLine + _linesPerPage); - _scrollBar->_entriesPerPage = _linesPerPage; - _scrollBar->recalc(); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int PromptWidget::printf(const char *format, ...) -{ - va_list argptr; - - va_start(argptr, format); - int count = this->vprintf(format, argptr); - va_end (argptr); - return count; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int PromptWidget::vprintf(const char *format, va_list argptr) -{ - char buf[2048]; - -#if defined(WIN32) - int count = _vsnprintf(buf, sizeof(buf), format, argptr); -#else - int count = vsnprintf(buf, sizeof(buf), format, argptr); -#endif - print(buf); - return count; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::putchar(int c) -{ - putcharIntern(c); - - setDirty(); draw(); // FIXME - not nice to redraw the full console just for one char! -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::putcharIntern(int c) -{ - if (c == '\n') - nextLine(); - else if(c & 0x80) { // set foreground color to TIA color - // don't print or advance cursor - // there are only 128 TIA colors, but - // OverlayColor contains 256 of them - textColor = (OverlayColor) ((c & 0x7f) << 1); - } - else if(c < ' ') { // More colors (the regular GUI ones) - textColor = (OverlayColor) (c + 0x100); - } - else if(c == 0x7f) { // toggle inverse video (DEL char) - _inverse = !_inverse; - } - else - { - buffer(_currentPos) = c | (textColor << 8) | (_inverse << 17); - _currentPos++; - if ((_scrollLine + 1) * _lineWidth == _currentPos) - { - _scrollLine++; - updateScrollBuffer(); - } - } -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::print(const string& str) -{ - const char* c = str.c_str(); - while(*c) - putcharIntern(*c++); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::drawCaret() -{ - FrameBuffer& fb = _boss->instance()->frameBuffer(); - - int line = _currentPos / _lineWidth; - - // Don't draw the cursor if it's not in the current view - if(_scrollLine < line) - return; - - int displayLine = line - _scrollLine + _linesPerPage - 1; - int x = _x + 1 + (_currentPos % _lineWidth) * _kConsoleCharWidth; - int y = _y + displayLine * _kConsoleLineHeight; - - char c = buffer(_currentPos); - fb.fillRect(x, y, _kConsoleCharWidth, _kConsoleLineHeight, kTextColor); - fb.drawChar(&_boss->instance()->consoleFont(), c, x, y + 2, kBGColor); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::scrollToCurrent() -{ - int line = _promptEndPos / _lineWidth; - - if (line + _linesPerPage <= _scrollLine) - { - // TODO - this should only occur for loong edit lines, though - } - else if (line > _scrollLine) - { - _scrollLine = line; - updateScrollBuffer(); - } -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool PromptWidget::saveBuffer(string& filename) -{ - ofstream out(filename.c_str()); - if(!out.is_open()) - return false; - - for(int start=0; start<_promptStartPos; start+=_lineWidth) { - int end = start+_lineWidth-1; - - // look for first non-space, printing char from end of line - while( char(_buffer[end] & 0xff) <= ' ' && end >= start) - end--; - - // spit out the line minus its trailing junk. - // Strip off any color/inverse bits - for(int j=start; j<=end; j++) - out << char(_buffer[j] & 0xff); - - // add a \n - out << endl; - } - - out.close(); - return true; -} diff --git a/stella/src/debugger/PromptWidget.hxx b/stella/src/debugger/PromptWidget.hxx deleted file mode 100644 index 6e2be7955..000000000 --- a/stella/src/debugger/PromptWidget.hxx +++ /dev/null @@ -1,120 +0,0 @@ -//============================================================================ -// -// 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: PromptWidget.hxx,v 1.2 2005-08-10 12:23:42 stephena Exp $ -// -// Based on code from ScummVM - Scumm Interpreter -// Copyright (C) 2002-2004 The ScummVM project -//============================================================================ - -#ifndef PROMPT_WIDGET_HXX -#define PROMPT_WIDGET_HXX - -class ScrollBarWidget; - -#include - -#include "GuiObject.hxx" -#include "Widget.hxx" -#include "Command.hxx" -#include "bspf.hxx" - -enum { - kBufferSize = 32768, - kLineBufferSize = 256, - - kHistorySize = 20 -}; - -class PromptWidget : public Widget, public CommandSender -{ - public: - PromptWidget(GuiObject* boss, int x, int y, int w, int h); - virtual ~PromptWidget(); - - public: - int printf(const char *format, ...); - int vprintf(const char *format, va_list argptr); -#undef putchar - void putchar(int c); - void print(const string& str); - void printPrompt(); - bool saveBuffer(string& filename); - - protected: - inline int &buffer(int idx) { return _buffer[idx % kBufferSize]; } - - void drawWidget(bool hilite); - void drawCaret(); - void putcharIntern(int c); - void insertIntoPrompt(const char *str); - void updateScrollBuffer(); - void scrollToCurrent(); - - // Line editing - void specialKeys(int keycode); - void nextLine(); - void killChar(int direction); - void killLine(int direction); - void killLastWord(); - - // History - void addToHistory(const char *str); - void historyScroll(int direction); - - void handleMouseDown(int x, int y, int button, int clickCount); - void handleMouseWheel(int x, int y, int direction); - bool handleKeyDown(int ascii, int keycode, int modifiers); - void handleCommand(CommandSender* sender, int cmd, int data, int id); - - virtual bool wantsFocus() { return true; } - - void loadConfig(); - - protected: - int _buffer[kBufferSize]; - int _linesInBuffer; - - int _lineWidth; - int _linesPerPage; - - int _currentPos; - int _scrollLine; - int _firstLineInBuffer; - - int _promptStartPos; - int _promptEndPos; - - ScrollBarWidget* _scrollBar; - - char _history[kHistorySize][kLineBufferSize]; - int _historySize; - int _historyIndex; - int _historyLine; - - int _kConsoleCharWidth, _kConsoleCharHeight, _kConsoleLineHeight; - - OverlayColor defaultTextColor; - OverlayColor defaultBGColor; - OverlayColor textColor; - OverlayColor bgColor; - bool _inverse; - bool _makeDirty; - bool _firstTime; - - int compareHistory(const char *histLine); -}; - -#endif diff --git a/stella/src/debugger/RamWidget.cxx b/stella/src/debugger/RamWidget.cxx deleted file mode 100644 index 43912baf8..000000000 --- a/stella/src/debugger/RamWidget.cxx +++ /dev/null @@ -1,419 +0,0 @@ -//============================================================================ -// -// 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: RamWidget.cxx,v 1.10 2005-08-22 13:53:23 stephena Exp $ -// -// Based on code from ScummVM - Scumm Interpreter -// Copyright (C) 2002-2004 The ScummVM project -//============================================================================ - -#include - -#include "OSystem.hxx" -#include "FrameBuffer.hxx" -#include "GuiUtils.hxx" -#include "GuiObject.hxx" -#include "InputTextDialog.hxx" -#include "Widget.hxx" -#include "EditTextWidget.hxx" -#include "DataGridWidget.hxx" -#include "RamDebug.hxx" -#include "RamWidget.hxx" - -enum { - kUndoCmd = 'RWud', - kRevertCmd = 'RWrv', - kSearchCmd = 'RWse', - kCmpCmd = 'RWcp', - kRestartCmd = 'RWrs', - kSValEntered = 'RWsv', - kCValEntered = 'RWcv' -}; - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y) - : Widget(boss, x, y, 16, 16), - CommandSender(boss), - myUndoAddress(-1), - myUndoValue(-1) -{ - const int fontWidth = font.getMaxCharWidth(), - fontHeight = font.getFontHeight(), - lineHeight = font.getLineHeight(), - bwidth = 44, - bheight = 16; - int xpos, ypos, lwidth; - StaticTextWidget* t; - - // Create a 16x8 grid holding byte values (16 x 8 = 128 RAM bytes) with labels - xpos = x; ypos = y + lineHeight; lwidth = 4 * fontWidth; - myRamGrid = new DataGridWidget(boss, font, xpos + lwidth, ypos, - 16, 8, 2, 8, kBASE_16); - myRamGrid->setTarget(this); - addFocusWidget(myRamGrid); - - // Create actions buttons to the left of the RAM grid - xpos += lwidth + myRamGrid->getWidth() + 4; - myUndoButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight, - "Undo", kUndoCmd, 0); - myUndoButton->setTarget(this); - - ypos += bheight + bheight/2; - myRevertButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight, - "Revert", kRevertCmd, 0); - myRevertButton->setTarget(this); - - ypos += 2 * bheight + 2; - mySearchButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight, - "Search", kSearchCmd, 0); - mySearchButton->setTarget(this); - - ypos += bheight + bheight/2; - myCompareButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight, - "Compare", kCmpCmd, 0); - myCompareButton->setTarget(this); - - ypos += bheight + bheight/2; - myRestartButton = new ButtonWidget(boss, xpos, ypos, bwidth, bheight, - "Reset", kRestartCmd, 0); - myRestartButton->setTarget(this); - - // Labels for RAM grid - xpos = x; ypos = y + lineHeight; - for(int row = 0; row < 8; ++row) - { - t = new StaticTextWidget(boss, xpos-2, ypos + row*lineHeight + 2, - lwidth-2, fontHeight, - Debugger::to_hex_8(row*16 + kRamStart) + string(":"), - kTextAlignLeft); - t->setFont(font); - } - for(int col = 0; col < 16; ++col) - { - t = new StaticTextWidget(boss, xpos + col*myRamGrid->colWidth() + lwidth + 8, - ypos - lineHeight, - fontWidth, fontHeight, - Debugger::to_hex_4(col), - kTextAlignLeft); - t->setFont(font); - } - - xpos = x + 10; ypos += 9 * lineHeight; - t = new StaticTextWidget(boss, xpos, ypos, - 6*fontWidth, fontHeight, - "Label:", kTextAlignLeft); - t->setFont(font); - xpos += 6*fontWidth + 5; - myLabel = new EditTextWidget(boss, xpos, ypos-2, 17*fontWidth, lineHeight, ""); - myLabel->setFont(font); - myLabel->setEditable(false); - - xpos += 17*fontWidth + 20; - t = new StaticTextWidget(boss, xpos, ypos, - 4*fontWidth, fontHeight, - "Dec:", kTextAlignLeft); - t->setFont(font); - xpos += 4*fontWidth + 5; - myDecValue = new EditTextWidget(boss, xpos, ypos-2, 4*fontWidth, lineHeight, ""); - myDecValue->setFont(font); - myDecValue->setEditable(false); - - xpos += 4*fontWidth + 20; - t = new StaticTextWidget(boss, xpos, ypos, - 4*fontWidth, fontHeight, - "Bin:", kTextAlignLeft); - t->setFont(font); - xpos += 4*fontWidth + 5; - myBinValue = new EditTextWidget(boss, xpos, ypos-2, 9*fontWidth, lineHeight, ""); - myBinValue->setFont(font); - myBinValue->setEditable(false); - - // Inputbox which will pop up when searching RAM - myInputBox = new InputTextDialog(boss, font, - x + lwidth + 20, y + 2*lineHeight - 5); - myInputBox->setTarget(this); - - // Start with these buttons disabled - myCompareButton->clearFlags(WIDGET_ENABLED); - myRestartButton->clearFlags(WIDGET_ENABLED); - - // Calculate real dimensions - _w = lwidth + myRamGrid->getWidth(); - _h = ypos + lineHeight - y; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -RamWidget::~RamWidget() -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) -{ - // We simply change the values in the ByteGridWidget - // It will then send the 'kDGItemDataChangedCmd' signal to change the actual - // memory location - int addr, value; - const char* buf; - - RamDebug& dbg = instance()->debugger().ramDebug(); - switch(cmd) - { - case kDGItemDataChangedCmd: - addr = myRamGrid->getSelectedAddr(); - value = myRamGrid->getSelectedValue(); - - myUndoAddress = addr; - myUndoValue = dbg.read(addr); - - dbg.write(addr, value); - myDecValue->setEditString(instance()->debugger().valueToString(value, kBASE_10)); - myBinValue->setEditString(instance()->debugger().valueToString(value, kBASE_2)); - myRevertButton->setEnabled(true); - myUndoButton->setEnabled(true); - break; - - case kDGSelectionChangedCmd: - addr = myRamGrid->getSelectedAddr(); - value = myRamGrid->getSelectedValue(); - - buf = instance()->debugger().equates()->getLabel(addr+kRamStart).c_str(); - if(*buf) myLabel->setEditString(buf); - else myLabel->setEditString(""); - - myDecValue->setEditString(instance()->debugger().valueToString(value, kBASE_10)); - myBinValue->setEditString(instance()->debugger().valueToString(value, kBASE_2)); - break; - - case kRevertCmd: - for(unsigned int i = 0; i < kRamSize; i++) - dbg.write(i, myOldValueList[i]); - fillGrid(true); - break; - - case kUndoCmd: - dbg.write(myUndoAddress, myUndoValue); - myUndoButton->setEnabled(false); - fillGrid(false); - break; - - case kSearchCmd: - myInputBox->setEditString(""); - myInputBox->setTitle(""); - myInputBox->setEmitSignal(kSValEntered); - parent()->addDialog(myInputBox); - break; - - case kCmpCmd: - myInputBox->setEditString(""); - myInputBox->setTitle(""); - myInputBox->setEmitSignal(kCValEntered); - parent()->addDialog(myInputBox); - break; - - case kRestartCmd: - doRestart(); - break; - - case kSValEntered: - { - const string& result = doSearch(myInputBox->getResult()); - if(result != "") - myInputBox->setTitle(result); - else - parent()->removeDialog(); - break; - } - - case kCValEntered: - { - const string& result = doCompare(myInputBox->getResult()); - if(result != "") - myInputBox->setTitle(result); - else - parent()->removeDialog(); - break; - } - } -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void RamWidget::loadConfig() -{ -//cerr << "RamWidget::loadConfig()\n"; - fillGrid(true); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void RamWidget::fillGrid(bool updateOld) -{ - IntArray alist; - IntArray vlist; - BoolArray changed; - - if(updateOld) myOldValueList.clear(); - - RamDebug& dbg = instance()->debugger().ramDebug(); - - RamState state = (RamState&) dbg.getState(); - RamState oldstate = (RamState&) dbg.getOldState(); - - vlist = state.ram; - if(updateOld) myOldValueList = state.ram; - - for(unsigned int i = 0; i < 16*8; i++) - { - alist.push_back(i); - changed.push_back(state.ram[i] != oldstate.ram[i]); - } - - myRamGrid->setList(alist, vlist, changed); - if(updateOld) - { - myRevertButton->setEnabled(false); - myUndoButton->setEnabled(false); - } -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const string RamWidget::doSearch(const string& str) -{ - bool comparisonSearch = true; - - if(str.length() == 0) - { - // An empty field means return all memory locations - comparisonSearch = false; - } - else if(str.find_first_of("+-", 0) != string::npos) - { - // Don't accept these characters here, only in compare - return "Invalid input +|-"; - } - - int searchVal = instance()->debugger().stringToValue(str); - - // Clear the search array of previous items - mySearchAddr.clear(); - mySearchValue.clear(); - - // Now, search all memory locations for this value, and add it to the - // search array - RamDebug& dbg = instance()->debugger().ramDebug(); - for(int addr = 0; addr < kRamSize; ++addr) - { - int value = dbg.read(addr); - - if(comparisonSearch && searchVal != value) - continue; - - mySearchAddr.push_back(addr); - mySearchValue.push_back(value); - } - - // If we have some hits, enable the comparison methods - if(mySearchAddr.size() > 0) - { - mySearchButton->setEnabled(false); - myCompareButton->setEnabled(true); - myRestartButton->setEnabled(true); - } - - // Finally, show the search results in the list - myRamGrid->setHiliteList(mySearchAddr); - - return ""; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const string RamWidget::doCompare(const string& str) -{ - bool comparitiveSearch = false; - int searchVal = 0, offset = 0; - - if(str.length() == 0) - return "Enter an absolute or comparitive value"; - - // Do some pre-processing on the string - string::size_type pos = str.find_first_of("+-", 0); - if(pos > 0 && pos != string::npos) - { - // Only accept '+' or '-' at the start of the string - return "Input must be [+|-]NUM"; - } - - // A comparitive search searches memory for locations that have changed by - // the specified amount, vs. for exact values - if(str[0] == '+' || str[0] == '-') - { - comparitiveSearch = true; - bool negative = false; - if(str[0] == '-') - negative = true; - - string tmp = str; - tmp.erase(0, 1); // remove the operator - offset = instance()->debugger().stringToValue(tmp); - if(negative) - offset = -offset; - } - else - searchVal = instance()->debugger().stringToValue(str); - - // Now, search all memory locations specified in mySearchArray for this value - RamDebug& dbg = instance()->debugger().ramDebug(); - IntArray tempList; - for(unsigned int i = 0; i < mySearchAddr.size(); ++i) - { - if(comparitiveSearch) - { - searchVal = mySearchValue[i] + offset; - if(searchVal < 0 || searchVal > 255) - continue; - } - - int addr = mySearchAddr[i]; - if(dbg.read(addr) == searchVal) - tempList.push_back(addr); - } - - // Update the searchArray to the new results - mySearchAddr = tempList; - - // If we have some hits, enable the comparison methods - if(mySearchAddr.size() > 0) - { - myCompareButton->setEnabled(true); - myRestartButton->setEnabled(true); - } - - // Finally, show the search results in the list - myRamGrid->setHiliteList(mySearchAddr); - - return ""; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void RamWidget::doRestart() -{ - // Erase all search buffers, reset to start mode - mySearchAddr.clear(); - mySearchValue.clear(); - myRamGrid->setHiliteList(mySearchAddr); - - mySearchButton->setEnabled(true); - myCompareButton->setEnabled(false); - myRestartButton->setEnabled(false); -} diff --git a/stella/src/debugger/RamWidget.hxx b/stella/src/debugger/RamWidget.hxx deleted file mode 100644 index 4b92817de..000000000 --- a/stella/src/debugger/RamWidget.hxx +++ /dev/null @@ -1,77 +0,0 @@ -//============================================================================ -// -// 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: RamWidget.hxx,v 1.6 2005-08-11 21:57:30 stephena Exp $ -// -// Based on code from ScummVM - Scumm Interpreter -// Copyright (C) 2002-2004 The ScummVM project -//============================================================================ - -#ifndef RAM_WIDGET_HXX -#define RAM_WIDGET_HXX - -class GuiObject; -class InputTextDialog; -class ButtonWidget; -class EditTextWidget; -class StaticTextWidget; - -#include "Array.hxx" -#include "Widget.hxx" -#include "Command.hxx" -#include "DataGridWidget.hxx" - - -class RamWidget : public Widget, public CommandSender -{ - public: - RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y); - virtual ~RamWidget(); - - void handleCommand(CommandSender* sender, int cmd, int data, int id); - - void loadConfig(); - void setOpsWidget(DataGridOpsWidget* w) { myRamGrid->setOpsWidget(w); } - - private: - void fillGrid(bool updateOld); - - const string doSearch(const string& str); - const string doCompare(const string& str); - void doRestart(); - - private: - int myUndoAddress; - int myUndoValue; - - DataGridWidget* myRamGrid; - EditTextWidget* myBinValue; - EditTextWidget* myDecValue; - EditTextWidget* myLabel; - - ButtonWidget* myRevertButton; - ButtonWidget* myUndoButton; - ButtonWidget* mySearchButton; - ButtonWidget* myCompareButton; - ButtonWidget* myRestartButton; - - InputTextDialog* myInputBox; - - IntArray myOldValueList; - IntArray mySearchAddr; - IntArray mySearchValue; -}; - -#endif diff --git a/stella/src/debugger/RomListWidget.cxx b/stella/src/debugger/RomListWidget.cxx deleted file mode 100644 index 675777cc7..000000000 --- a/stella/src/debugger/RomListWidget.cxx +++ /dev/null @@ -1,143 +0,0 @@ -//============================================================================ -// -// 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: RomListWidget.cxx,v 1.1 2005-08-26 16:44:16 stephena Exp $ -// -// Based on code from ScummVM - Scumm Interpreter -// Copyright (C) 2002-2004 The ScummVM project -//============================================================================ - -#include "RomListWidget.hxx" - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& font, - int x, int y, int w, int h) - : CheckListWidget(boss, font, x, y, w, h), - myHighlightedItem(-1) -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -RomListWidget::~RomListWidget() -{ -} - -/* -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void RomListWidget::setList(const StringList& list, const BoolArray& state) -{ - _list = list; - _stateList = state; - - assert(_list.size() == _stateList.size()); - - // Enable all checkboxes - for(int i = 0; i < _rows; ++i) - _checkList[i]->setFlags(WIDGET_ENABLED); - - // Then turn off any extras - if((int)_stateList.size() < _rows) - for(int i = _stateList.size(); i < _rows; ++i) - _checkList[i]->clearFlags(WIDGET_ENABLED); - - ListWidget::recalc(); -} -*/ - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void RomListWidget::drawWidget(bool hilite) -{ -//cerr << "RomListWidget::drawWidget\n"; - FrameBuffer& fb = _boss->instance()->frameBuffer(); - int i, pos, len = _list.size(); - string buffer; - int deltax; - - // Draw a thin frame around the list and to separate columns - fb.hLine(_x, _y, _x + _w - 1, kColor); - fb.hLine(_x, _y + _h - 1, _x + _w - 1, kShadowColor); - fb.vLine(_x, _y, _y + _h - 1, kColor); - - fb.vLine(_x + CheckboxWidget::boxSize() + 5, _y, _y + _h - 1, kColor); - - // Draw the list items - for (i = 0, pos = _currentPos; i < _rows && pos < len; i++, pos++) - { - // Draw checkboxes for correct lines (takes scrolling into account) - _checkList[i]->setState(_stateList[pos]); - _checkList[i]->setDirty(); - _checkList[i]->draw(); - - const int y = _y + 2 + _rowHeight * i; - - GUI::Rect r(getEditRect()); - - // Draw highlighted item inverted, on a highlighted background. - if (_highlightedItem == pos) - { - fb.fillRect(_x + r.left - 3, _y + 1 + _rowHeight * i, - _w - r.left, _rowHeight, - kHiliteColor); - } - - // Draw the selected item inverted, on a highlighted background. - if (_selectedItem == pos) - { - if (_hasFocus && !_editMode) - fb.fillRect(_x + r.left - 3, _y + 1 + _rowHeight * i, - _w - r.left, _rowHeight, - kTextColorHi); - else - fb.frameRect(_x + r.left - 3, _y + 1 + _rowHeight * i, - _w - r.left, _rowHeight, - kTextColorHi); - } - - if (_selectedItem == pos && _editMode) - { - buffer = _editString; - adjustOffset(); - deltax = -_editScrollOffset; - - fb.drawString(_font, buffer, _x + r.left, y, r.width(), kTextColor, - kTextAlignLeft, deltax, false); - } - else - { - buffer = _list[pos]; - deltax = 0; - fb.drawString(_font, buffer, _x + r.left, y, r.width(), kTextColor); - } - } - - // Only draw the caret while editing, and if it's in the current viewport - if(_editMode && (_selectedItem >= _scrollBar->_currentPos) && - (_selectedItem < _scrollBar->_currentPos + _rows)) - drawCaret(); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -GUI::Rect RomListWidget::getEditRect() const -{ - GUI::Rect r(2, 1, _w, _rowHeight); - const int yoffset = (_selectedItem - _currentPos) * _rowHeight, - xoffset = CheckboxWidget::boxSize() + 10; - r.top += yoffset; - r.bottom += yoffset; - r.left += xoffset; - r.right -= xoffset - 15; - - return r; -} diff --git a/stella/src/debugger/RomListWidget.hxx b/stella/src/debugger/RomListWidget.hxx deleted file mode 100644 index 20426af11..000000000 --- a/stella/src/debugger/RomListWidget.hxx +++ /dev/null @@ -1,46 +0,0 @@ -//============================================================================ -// -// 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: RomListWidget.hxx,v 1.1 2005-08-26 16:44:16 stephena Exp $ -// -// Based on code from ScummVM - Scumm Interpreter -// Copyright (C) 2002-2004 The ScummVM project -//============================================================================ - -#ifndef ROM_LIST_WIDGET_HXX -#define ROM_LIST_WIDGET_HXX - -class CheckboxWidget; - -#include "CheckListWidget.hxx" - - -/** RomListWidget */ -class RomListWidget : public CheckListWidget -{ - public: - RomListWidget(GuiObject* boss, const GUI::Font& font, - int x, int y, int w, int h); - virtual ~RomListWidget(); - - protected: - void drawWidget(bool hilite); - GUI::Rect getEditRect() const; - - private: - int myHighlightedItem; -}; - -#endif diff --git a/stella/src/debugger/RomWidget.cxx b/stella/src/debugger/RomWidget.cxx deleted file mode 100644 index c3abb1cc9..000000000 --- a/stella/src/debugger/RomWidget.cxx +++ /dev/null @@ -1,139 +0,0 @@ -//============================================================================ -// -// 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: RomWidget.cxx,v 1.7 2005-08-26 16:44:17 stephena Exp $ -// -// Based on code from ScummVM - Scumm Interpreter -// Copyright (C) 2002-2004 The ScummVM project -//============================================================================ - -#include - -#include "Debugger.hxx" -#include "CpuDebug.hxx" -#include "GuiObject.hxx" -#include "RomListWidget.hxx" -#include "RomWidget.hxx" - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y) - : Widget(boss, x, y, 16, 16), - CommandSender(boss), - myFirstLoad(true), - mySourceAvailable(false), - myCurrentBank(-1) -{ - int w = 58 * font.getMaxCharWidth(), - h = 31 * font.getLineHeight(); - - myRomList = new RomListWidget(boss, font, x, y, w, h); - myRomList->setTarget(this); - myRomList->setStyle(kSolidFill); - addFocusWidget(myRomList); - - // Calculate real dimensions - _w = myRomList->getWidth(); - _h = myRomList->getHeight(); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -RomWidget::~RomWidget() -{ - myAddrList.clear(); - myLineList.clear(); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) -{ - switch(cmd) - { - case kListScrolledCmd: - incrementalUpdate(); - break; - - case kListItemChecked: - { - // We don't care about state, as breakpoints are turned on - // and off with the same command - // FIXME - at some point, we might want to add 'breakon' - // and 'breakoff' to DebuggerParser, so the states - // don't get out of sync - ostringstream cmd; - cmd << "break #" << myAddrList[data]; - instance()->debugger().run(cmd.str()); - - break; - } - } -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void RomWidget::loadConfig() -{ -//cerr << "RomWidget::loadConfig()\n"; - // Only reload full bank when necessary - if(myFirstLoad || myCurrentBank != instance()->debugger().getBank()) - { - initialUpdate(); - myFirstLoad = false; - } - else // only reload what's in current view - { - incrementalUpdate(); - } - - // Update romlist to point to current PC - int pc = instance()->debugger().cpuDebug().pc(); - AddrToLine::iterator iter = myLineList.find(pc); - if(iter != myLineList.end()) - myRomList->setHighlighted(iter->second); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void RomWidget::initialUpdate() -{ - Debugger& dbg = instance()->debugger(); - - myCurrentBank = dbg.getBank(); - - // Fill romlist the current bank of source or disassembly - if(mySourceAvailable) - ; // FIXME - else - { - StringList label, data; - BoolArray state; - myAddrList.clear(); - myLineList.clear(); - - // Disassemble entire bank (up to 4096 lines) - dbg.disassemble(label, myAddrList, data, 0xf000, 4096); - for(unsigned int i = 0; i < data.size(); ++i) - state.push_back(false); - - // Create a mapping from addresses to line numbers - myLineList.clear(); - for(unsigned int i = 0; i < myAddrList.size(); ++i) - myLineList.insert(make_pair(myAddrList[i], i)); - - myRomList->setList(data, state); - } -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void RomWidget::incrementalUpdate() -{ -} diff --git a/stella/src/debugger/RomWidget.hxx b/stella/src/debugger/RomWidget.hxx deleted file mode 100644 index 3c41568ce..000000000 --- a/stella/src/debugger/RomWidget.hxx +++ /dev/null @@ -1,66 +0,0 @@ -//============================================================================ -// -// 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: RomWidget.hxx,v 1.5 2005-08-26 16:44:17 stephena Exp $ -// -// Based on code from ScummVM - Scumm Interpreter -// Copyright (C) 2002-2004 The ScummVM project -//============================================================================ - -#ifndef ROM_WIDGET_HXX -#define ROM_WIDGET_HXX - -class GuiObject; -class RomListWidget; -class StringList; - -#include - -#include "Array.hxx" -#include "Widget.hxx" -#include "Command.hxx" - -typedef map AddrToLine; - - -class RomWidget : public Widget, public CommandSender -{ - public: - RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y); - virtual ~RomWidget(); - - void handleCommand(CommandSender* sender, int cmd, int data, int id); - - void loadConfig(); - - private: - void initialUpdate(); - void incrementalUpdate(); - - private: - RomListWidget* myRomList; - - /** List of addresses indexed by line number */ - IntArray myAddrList; - - /** List of line numbers indexed by address */ - AddrToLine myLineList; - - bool myFirstLoad; - bool mySourceAvailable; - int myCurrentBank; -}; - -#endif diff --git a/stella/src/debugger/TiaInfoWidget.cxx b/stella/src/debugger/TiaInfoWidget.cxx deleted file mode 100644 index d2f7b1f19..000000000 --- a/stella/src/debugger/TiaInfoWidget.cxx +++ /dev/null @@ -1,125 +0,0 @@ -//============================================================================ -// -// 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: TiaInfoWidget.cxx,v 1.3 2005-08-16 18:34:12 stephena Exp $ -// -// Based on code from ScummVM - Scumm Interpreter -// Copyright (C) 2002-2004 The ScummVM project -//============================================================================ - -#include "OSystem.hxx" -#include "FrameBuffer.hxx" -#include "Debugger.hxx" -#include "TIADebug.hxx" -#include "Widget.hxx" -#include "EditTextWidget.hxx" -#include "GuiObject.hxx" - -#include "TiaInfoWidget.hxx" - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -TiaInfoWidget::TiaInfoWidget(GuiObject* boss, int x, int y, int w, int h) - : Widget(boss, x, y, w, h), - CommandSender(boss) -{ - int xpos = x, ypos = y, lwidth = 45; - const GUI::Font& font = instance()->font(); - - // Add frame info - xpos = x + 10; ypos = y + 10; - new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "Frame:", kTextAlignLeft); - xpos += lwidth; - myFrameCount = new EditTextWidget(boss, xpos, ypos-2, 45, kLineHeight, ""); - myFrameCount->setFont(font); - myFrameCount->setEditable(false); - - xpos = x + 10; ypos += kLineHeight + 5; - new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "F. Cycles:", kTextAlignLeft); - xpos += lwidth; - myFrameCycles = new EditTextWidget(boss, xpos, ypos-2, 45, kLineHeight, ""); - myFrameCycles->setFont(font); - myFrameCycles->setEditable(false); - - xpos = x + 20; ypos += kLineHeight + 5; - myVSync = new CheckboxWidget(boss, font, xpos, ypos-3, "VSync", 0); - myVSync->setEditable(false); - - xpos = x + 20; ypos += kLineHeight + 5; - myVBlank = new CheckboxWidget(boss, font, xpos, ypos-3, "VBlank", 0); - myVBlank->setEditable(false); - - xpos = x + 10 + 100; ypos = y + 10; - new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "Scanline:", kTextAlignLeft); - xpos += lwidth; - myScanlineCount = new EditTextWidget(boss, xpos, ypos-2, 30, kLineHeight, ""); - myScanlineCount->setFont(font); - myScanlineCount->setEditable(false); - - xpos = x + 10 + 100; ypos += kLineHeight + 5; - new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "S. Cycles:", kTextAlignLeft); - xpos += lwidth; - myScanlineCycles = new EditTextWidget(boss, xpos, ypos-2, 30, kLineHeight, ""); - myScanlineCycles->setFont(font); - myScanlineCycles->setEditable(false); - - xpos = x + 10 + 100; ypos += kLineHeight + 5; - new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "Pixel Pos:", kTextAlignLeft); - xpos += lwidth; - myPixelPosition = new EditTextWidget(boss, xpos, ypos-2, 30, kLineHeight, ""); - myPixelPosition->setFont(font); - myPixelPosition->setEditable(false); - - xpos = x + 10 + 100; ypos += kLineHeight + 5; - new StaticTextWidget(boss, xpos, ypos, lwidth, kLineHeight, "Color Clk:", kTextAlignLeft); - xpos += lwidth; - myColorClocks = new EditTextWidget(boss, xpos, ypos-2, 30, kLineHeight, ""); - myColorClocks->setFont(font); - myColorClocks->setEditable(false); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -TiaInfoWidget::~TiaInfoWidget() -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TiaInfoWidget::handleMouseDown(int x, int y, int button, int clickCount) -{ -cerr << "TiaInfoWidget button press: x = " << x << ", y = " << y << endl; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TiaInfoWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TiaInfoWidget::loadConfig() -{ - Debugger& dbg = instance()->debugger(); - TIADebug& tia = dbg.tiaDebug(); - - myFrameCount->setEditString(dbg.valueToString(tia.frameCount(), kBASE_10)); - myFrameCycles->setEditString(dbg.valueToString(dbg.cycles(), kBASE_10)); - - myVSync->setState(tia.vsync()); - myVBlank->setState(tia.vblank()); - - int clk = tia.clocksThisLine(); - myScanlineCount->setEditString(dbg.valueToString(tia.scanlines(), kBASE_10)); - myScanlineCycles->setEditString(dbg.valueToString(clk/3, kBASE_10)); - myPixelPosition->setEditString(dbg.valueToString(clk-68, kBASE_10)); - myColorClocks->setEditString(dbg.valueToString(clk, kBASE_10)); -} diff --git a/stella/src/debugger/TiaInfoWidget.hxx b/stella/src/debugger/TiaInfoWidget.hxx deleted file mode 100644 index 99ec602fb..000000000 --- a/stella/src/debugger/TiaInfoWidget.hxx +++ /dev/null @@ -1,57 +0,0 @@ -//============================================================================ -// -// 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: TiaInfoWidget.hxx,v 1.1 2005-07-21 19:30:15 stephena Exp $ -// -// Based on code from ScummVM - Scumm Interpreter -// Copyright (C) 2002-2004 The ScummVM project -//============================================================================ - -#ifndef TIA_INFO_WIDGET_HXX -#define TIA_INFO_WIDGET_HXX - -class GuiObject; -class EditTextWidget; - -#include "Widget.hxx" -#include "Command.hxx" - - -class TiaInfoWidget : public Widget, public CommandSender -{ - public: - TiaInfoWidget(GuiObject *boss, int x, int y, int w, int h); - virtual ~TiaInfoWidget(); - - void loadConfig(); - - protected: - void handleMouseDown(int x, int y, int button, int clickCount); - void handleCommand(CommandSender* sender, int cmd, int data, int id); - - private: - EditTextWidget* myFrameCount; - EditTextWidget* myFrameCycles; - - EditTextWidget* myScanlineCount; - EditTextWidget* myScanlineCycles; - EditTextWidget* myPixelPosition; - EditTextWidget* myColorClocks; - - CheckboxWidget* myVSync; - CheckboxWidget* myVBlank; -}; - -#endif diff --git a/stella/src/debugger/TiaOutputWidget.cxx b/stella/src/debugger/TiaOutputWidget.cxx deleted file mode 100644 index 4a9460a0d..000000000 --- a/stella/src/debugger/TiaOutputWidget.cxx +++ /dev/null @@ -1,85 +0,0 @@ -//============================================================================ -// -// 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.6 2005-08-26 16:44:17 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) -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -TiaOutputWidget::~TiaOutputWidget() -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TiaOutputWidget::loadConfig() -{ - setDirty(); draw(); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TiaOutputWidget::advanceScanline(int lines) -{ - while(lines) - { - instance()->console().mediaSource().updateScanline(); - --lines; - } -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TiaOutputWidget::advance(int frames) -{ - while(frames) - { - instance()->console().mediaSource().update(); - --frames; - } -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TiaOutputWidget::handleMouseDown(int x, int y, int button, int clickCount) -{ - int xstart = atoi(instance()->console().properties().get("Display.XStart").c_str()); - int ystart = atoi(instance()->console().properties().get("Display.YStart").c_str()); - -cerr << "TiaOutputWidget button press:" << endl - << "x = " << x << ", y = " << y << endl - << "xstart = " << xstart << ", ystart = " << ystart << endl - << endl; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TiaOutputWidget::drawWidget(bool hilite) -{ -//cerr << "TiaOutputWidget::drawWidget\n"; - instance()->frameBuffer().refresh(); - instance()->frameBuffer().drawMediaSource(); -} diff --git a/stella/src/debugger/TiaOutputWidget.hxx b/stella/src/debugger/TiaOutputWidget.hxx deleted file mode 100644 index 8ae115da6..000000000 --- a/stella/src/debugger/TiaOutputWidget.hxx +++ /dev/null @@ -1,58 +0,0 @@ -//============================================================================ -// -// 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.5 2005-08-11 19:12:38 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(); - - void handleMouseDown(int x, int y, int button, int clickCount); - void loadConfig(); - -// 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 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); -*/ - void advanceScanline(int lines); - void advance(int frames); - - protected: - void drawWidget(bool hilite); - bool wantsFocus() { return false; } -}; - -#endif diff --git a/stella/src/debugger/TiaWidget.cxx b/stella/src/debugger/TiaWidget.cxx deleted file mode 100644 index 1056746c1..000000000 --- a/stella/src/debugger/TiaWidget.cxx +++ /dev/null @@ -1,1193 +0,0 @@ -//============================================================================ -// -// 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: TiaWidget.cxx,v 1.11 2005-08-19 23:02:08 stephena Exp $ -// -// Based on code from ScummVM - Scumm Interpreter -// Copyright (C) 2002-2004 The ScummVM project -//============================================================================ - -#include "OSystem.hxx" -#include "FrameBuffer.hxx" -#include "GuiUtils.hxx" -#include "GuiObject.hxx" -#include "TIADebug.hxx" -#include "Widget.hxx" -#include "EditTextWidget.hxx" -#include "DataGridWidget.hxx" -#include "ColorWidget.hxx" -#include "ToggleBitWidget.hxx" -#include "TogglePixelWidget.hxx" -#include "TiaWidget.hxx" - -// ID's for the various widgets -// We need ID's, since there are more than one of several types of widgets -enum { - kP0_PFID, kP0_BLID, kP0_M1ID, kP0_M0ID, kP0_P1ID, - kP1_PFID, kP1_BLID, kP1_M1ID, kP1_M0ID, - kM0_PFID, kM0_BLID, kM0_M1ID, - kM1_PFID, kM1_BLID, - kBL_PFID, // Make these first, since we want them to start from 0 - - kRamID, - kColorRegsID, - kGRP0ID, kGRP1ID, - kPosP0ID, kPosP1ID, - kPosM0ID, kPosM1ID, kPosBLID, - kHMP0ID, kHMP1ID, - kHMM0ID, kHMM1ID, kHMBLID, - kRefP0ID, kRefP1ID, - kDelP0ID, kDelP1ID, kDelBLID, - kNusizP0ID, kNusizP1ID, - kNusizM0ID, kNusizM1ID, kSizeBLID, - kEnaM0ID, kEnaM1ID, kEnaBLID, - kResMP0ID, kResMP1ID, - kPF0ID, kPF1ID, kPF2ID, - kRefPFID, kScorePFID, kPriorityPFID -}; - -// Strobe button commands -enum { - kWsyncCmd = 'Swsy', - kRsyncCmd = 'Srsy', - kResP0Cmd = 'Srp0', - kResP1Cmd = 'Srp1', - kResM0Cmd = 'Srm0', - kResM1Cmd = 'Srm1', - kResBLCmd = 'Srbl', - kHmoveCmd = 'Shmv', - kHmclrCmd = 'Shmc', - kCxclrCmd = 'Scxl' -}; - -// Color registers -enum { - kCOLUP0Addr, - kCOLUP1Addr, - kCOLUPFAddr, - kCOLUBKAddr -}; - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h) - : Widget(boss, x, y, w, h), - CommandSender(boss) -{ - const GUI::Font& font = instance()->consoleFont(); - const int fontWidth = font.getMaxCharWidth(), - fontHeight = font.getFontHeight(), - lineHeight = font.getLineHeight(); - int xpos = 10, ypos = 25, lwidth = 4 * font.getMaxCharWidth(); - StaticTextWidget* t; - - // Create a 16x1 grid holding byte values with labels - myRamGrid = new DataGridWidget(boss, font, xpos + lwidth, ypos, - 16, 1, 2, 8, kBASE_16); - myRamGrid->setEditable(false); - myRamGrid->setTarget(this); - myRamGrid->setID(kRamID); - addFocusWidget(myRamGrid); - - t = new StaticTextWidget(boss, xpos, ypos + 2, - lwidth-2, fontHeight, - "00:", kTextAlignLeft); - t->setFont(font); - for(int col = 0; col < 16; ++col) - { - t = new StaticTextWidget(boss, xpos + col*myRamGrid->colWidth() + lwidth + 7, - ypos - lineHeight, - fontWidth, fontHeight, - Debugger::to_hex_4(col), - kTextAlignLeft); - t->setFont(font); - } - - xpos = 20; ypos += 2 * lineHeight; - t = new StaticTextWidget(boss, xpos, ypos, - 6*fontWidth, fontHeight, - "Label:", kTextAlignLeft); - t->setFont(font); - xpos += 6*fontWidth + 5; - myLabel = new EditTextWidget(boss, xpos, ypos-2, 15*fontWidth, lineHeight, ""); - myLabel->setFont(font); - myLabel->setEditable(false); - - xpos += 15*fontWidth + 20; - t = new StaticTextWidget(boss, xpos, ypos, - 4*fontWidth, fontHeight, - "Dec:", kTextAlignLeft); - t->setFont(font); - xpos += 4*fontWidth + 5; - myDecValue = new EditTextWidget(boss, xpos, ypos-2, 4*fontWidth, lineHeight, ""); - myDecValue->setFont(font); - myDecValue->setEditable(false); - - xpos += 4*fontWidth + 20; - t = new StaticTextWidget(boss, xpos, ypos, - 4*fontWidth, fontHeight, - "Bin:", kTextAlignLeft); - t->setFont(font); - xpos += 4*fontWidth + 5; - myBinValue = new EditTextWidget(boss, xpos, ypos-2, 9*fontWidth, lineHeight, ""); - myBinValue->setFont(font); - myBinValue->setEditable(false); - - // Color registers - const char* regNames[] = { "COLUP0:", "COLUP1:", "COLUPF:", "COLUBK:" }; - xpos = 10; ypos += 3*lineHeight; - for(int row = 0; row < 4; ++row) - { - t = new StaticTextWidget(boss, xpos, ypos + row*lineHeight + 2, - 7*fontWidth, fontHeight, - regNames[row], - kTextAlignLeft); - t->setFont(font); - } - xpos += 7*fontWidth + 5; - myColorRegs = new DataGridWidget(boss, font, xpos, ypos, - 1, 4, 2, 8, kBASE_16); - myColorRegs->setTarget(this); - myColorRegs->setID(kColorRegsID); - addFocusWidget(myColorRegs); - - xpos += myColorRegs->colWidth() + 5; - myCOLUP0Color = new ColorWidget(boss, xpos, ypos+2, 20, lineHeight - 4); - myCOLUP0Color->setTarget(this); - - ypos += lineHeight; - myCOLUP1Color = new ColorWidget(boss, xpos, ypos+2, 20, lineHeight - 4); - myCOLUP1Color->setTarget(this); - - ypos += lineHeight; - myCOLUPFColor = new ColorWidget(boss, xpos, ypos+2, 20, lineHeight - 4); - myCOLUPFColor->setTarget(this); - - ypos += lineHeight; - myCOLUBKColor = new ColorWidget(boss, xpos, ypos+2, 20, lineHeight - 4); - myCOLUBKColor->setTarget(this); - - //////////////////////////// - // Collision register bits - //////////////////////////// - // Add horizontal labels - xpos += myCOLUBKColor->getWidth() + 2*fontWidth + 30; ypos -= 4*lineHeight + 5; - t = new StaticTextWidget(boss, xpos, ypos, - 14*fontWidth, fontHeight, - "PF BL M1 M0 P1", kTextAlignLeft); - t->setFont(font); - - // Add label for Strobes; buttons will be added later - t = new StaticTextWidget(boss, xpos + t->getWidth() + 9*fontWidth, ypos, - 8*fontWidth, fontHeight, - "Strobes:", kTextAlignLeft); - t->setFont(font); - - // Add vertical labels - xpos -= 2*fontWidth + 5; ypos += lineHeight; - const char* collLabel[] = { "P0", "P1", "M0", "M1", "BL" }; - for(int row = 0; row < 5; ++row) - { - t = new StaticTextWidget(boss, xpos, ypos + row*(lineHeight+3), - 2*fontWidth, fontHeight, - collLabel[row], kTextAlignLeft); - t->setFont(font); - } - - // Finally, add all 15 collision bits - xpos += 2 * fontWidth + 5; - unsigned int collX = xpos, collY = ypos, idx = 0; - for(unsigned int row = 0; row < 5; ++row) - { - for(unsigned int col = 0; col < 5 - row; ++col) - { - myCollision[idx] = new CheckboxWidget(boss, font, collX, collY, - "", kCheckActionCmd); - myCollision[idx]->setFont(font); - myCollision[idx]->setTarget(this); - myCollision[idx]->setID(idx); -// TODO - make collisions editable in TIA // - myCollision[idx]->setEditable(false); -// addFocusWidget(myCollision[idx]); -//////////////////////////////////////////// - - collX += myCollision[idx]->getWidth() + 10; - idx++; - } - collX = xpos; - collY += lineHeight+3; - } - - //////////////////////////// - // Strobe buttons - //////////////////////////// - ButtonWidget* b; - unsigned int buttonX, buttonY; - buttonX = collX + 20*fontWidth; buttonY = ypos; - b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, - "WSync", kWsyncCmd); - b->setTarget(this); - - buttonY += lineHeight + 3; - b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, - "ResP0", kResP0Cmd); - b->setTarget(this); - - buttonY += lineHeight + 3; - b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, - "ResM0", kResM0Cmd); - b->setTarget(this); - - buttonY += lineHeight + 3; - b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, - "ResBL", kResBLCmd); - b->setTarget(this); - - buttonY += lineHeight + 3; - b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, - "HmClr", kHmclrCmd); - b->setTarget(this); - - buttonX += 50 + 10; buttonY = ypos; - b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, - "RSync", kRsyncCmd); - b->setTarget(this); - - buttonY += lineHeight + 3; - b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, - "ResP1", kResP1Cmd); - b->setTarget(this); - - buttonY += lineHeight + 3; - b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, - "ResM1", kResM1Cmd); - b->setTarget(this); - - buttonY += lineHeight + 3; - b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, - "HMove", kHmoveCmd); - b->setTarget(this); - - buttonY += lineHeight + 3; - b = new ButtonWidget(boss, buttonX, buttonY, 50, lineHeight, - "CxClr", kCxclrCmd); - b->setTarget(this); - - // Set the strings to be used in the grPx registers - // We only do this once because it's the state that changes, not the strings - const char* offstr[] = { "0", "0", "0", "0", "0", "0", "0", "0" }; - const char* onstr[] = { "1", "1", "1", "1", "1", "1", "1", "1" }; - StringList off, on; - for(int i = 0; i < 8; ++i) - { - off.push_back(offstr[i]); - on.push_back(onstr[i]); - } - - //////////////////////////// - // P0 register info - //////////////////////////// - // grP0 - xpos = 10; ypos = 13*lineHeight; - t = new StaticTextWidget(boss, xpos, ypos+2, - 7*fontWidth, fontHeight, - "P0: GR:", kTextAlignLeft); - t->setFont(font); - xpos += 7*fontWidth + 5; - myGRP0 = new TogglePixelWidget(boss, xpos, ypos+2, 8, 1); - myGRP0->setTarget(this); - myGRP0->setID(kGRP0ID); - addFocusWidget(myGRP0); - - // posP0 - xpos += myGRP0->getWidth() + 8; - t = new StaticTextWidget(boss, xpos, ypos+2, - 4*fontWidth, fontHeight, - "Pos:", kTextAlignLeft); - t->setFont(font); - xpos += 4*fontWidth + 5; - myPosP0 = new DataGridWidget(boss, font, xpos, ypos, - 1, 1, 2, 8, kBASE_16); - myPosP0->setTarget(this); - myPosP0->setID(kPosP0ID); - addFocusWidget(myPosP0); - - // hmP0 - xpos += myPosP0->getWidth() + 8; - t = new StaticTextWidget(boss, xpos, ypos+2, - 3*fontWidth, fontHeight, - "HM:", kTextAlignLeft); - t->setFont(font); - xpos += 3*fontWidth + 5; - myHMP0 = new DataGridWidget(boss, font, xpos, ypos, - 1, 1, 1, 4, kBASE_16_4); - myHMP0->setTarget(this); - myHMP0->setID(kHMP0ID); - addFocusWidget(myHMP0); - - // P0 reflect and delay - xpos += myHMP0->getWidth() + 15; - myRefP0 = new CheckboxWidget(boss, font, xpos, ypos+1, - "Reflect", kCheckActionCmd); - myRefP0->setFont(font); - myRefP0->setTarget(this); - myRefP0->setID(kRefP0ID); - addFocusWidget(myRefP0); - - xpos += myRefP0->getWidth() + 15; - myDelP0 = new CheckboxWidget(boss, font, xpos, ypos+1, - "Delay", kCheckActionCmd); - myDelP0->setFont(font); - myDelP0->setTarget(this); - myDelP0->setID(kDelP0ID); - addFocusWidget(myDelP0); - - // NUSIZ0 (player portion) - xpos = 10 + lwidth; ypos += myGRP0->getHeight() + 5; - t = new StaticTextWidget(boss, xpos, ypos+2, - 8*fontWidth, fontHeight, - "NusizP0:", kTextAlignLeft); - t->setFont(font); - xpos += 8*fontWidth + 5; - myNusizP0 = new DataGridWidget(boss, font, xpos, ypos, - 1, 1, 1, 3, kBASE_16_4); - myNusizP0->setTarget(this); - myNusizP0->setID(kNusizP0ID); - addFocusWidget(myNusizP0); - - xpos += myNusizP0->getWidth() + 5; - myNusizP0Text = new EditTextWidget(boss, xpos, ypos+1, 23*fontWidth, lineHeight, ""); - myNusizP0Text->setFont(font); - myNusizP0Text->setEditable(false); - - //////////////////////////// - // P1 register info - //////////////////////////// - // grP1 - xpos = 10; ypos += 2*lineHeight; - t = new StaticTextWidget(boss, xpos, ypos+2, - 7*fontWidth, fontHeight, - "P1: GR:", kTextAlignLeft); - t->setFont(font); - xpos += 7*fontWidth + 5; - myGRP1 = new TogglePixelWidget(boss, xpos, ypos+2, 8, 1); - myGRP1->setTarget(this); - myGRP1->setID(kGRP1ID); - addFocusWidget(myGRP1); - - // posP1 - xpos += myGRP1->getWidth() + 8; - t = new StaticTextWidget(boss, xpos, ypos+2, - 4*fontWidth, fontHeight, - "Pos:", kTextAlignLeft); - t->setFont(font); - xpos += 4*fontWidth + 5; - myPosP1 = new DataGridWidget(boss, font, xpos, ypos, - 1, 1, 2, 8, kBASE_16); - myPosP1->setTarget(this); - myPosP1->setID(kPosP1ID); - addFocusWidget(myPosP1); - - // hmP1 - xpos += myPosP1->getWidth() + 8; - t = new StaticTextWidget(boss, xpos, ypos+2, - 3*fontWidth, fontHeight, - "HM:", kTextAlignLeft); - t->setFont(font); - xpos += 3*fontWidth + 5; - myHMP1 = new DataGridWidget(boss, font, xpos, ypos, - 1, 1, 1, 4, kBASE_16_4); - myHMP1->setTarget(this); - myHMP1->setID(kHMP1ID); - addFocusWidget(myHMP1); - - // P1 reflect and delay - xpos += myHMP1->getWidth() + 15; - myRefP1 = new CheckboxWidget(boss, font, xpos, ypos+1, - "Reflect", kCheckActionCmd); - myRefP1->setFont(font); - myRefP1->setTarget(this); - myRefP1->setID(kRefP1ID); - addFocusWidget(myRefP1); - - xpos += myRefP1->getWidth() + 15; - myDelP1 = new CheckboxWidget(boss, font, xpos, ypos+1, - "Delay", kCheckActionCmd); - myDelP1->setFont(font); - myDelP1->setTarget(this); - myDelP1->setID(kDelP1ID); - addFocusWidget(myDelP1); - - // NUSIZ1 (player portion) - xpos = 10 + lwidth; ypos += myGRP1->getHeight() + 5; - t = new StaticTextWidget(boss, xpos, ypos+2, - 8*fontWidth, fontHeight, - "NusizP1:", kTextAlignLeft); - t->setFont(font); - xpos += 8*fontWidth + 5; - myNusizP1 = new DataGridWidget(boss, font, xpos, ypos, - 1, 1, 1, 3, kBASE_16_4); - myNusizP1->setTarget(this); - myNusizP1->setID(kNusizP1ID); - addFocusWidget(myNusizP1); - - xpos += myNusizP1->getWidth() + 5; - myNusizP1Text = new EditTextWidget(boss, xpos, ypos+1, 23*fontWidth, lineHeight, ""); - myNusizP1Text->setFont(font); - myNusizP1Text->setEditable(false); - - //////////////////////////// - // M0 register info - //////////////////////////// - // enaM0 - xpos = 10; ypos += 2*lineHeight; - t = new StaticTextWidget(boss, xpos, ypos+2, - 3*fontWidth, fontHeight, - "M0:", kTextAlignLeft); - t->setFont(font); - xpos += 3*fontWidth + 8; - myEnaM0 = new CheckboxWidget(boss, font, xpos, ypos+2, - "Enable", kCheckActionCmd); - myEnaM0->setFont(font); - myEnaM0->setTarget(this); - myEnaM0->setID(kEnaM0ID); - addFocusWidget(myEnaM0); - - // posM0 - xpos += myEnaM0->getWidth() + 12; - t = new StaticTextWidget(boss, xpos, ypos+2, - 4*fontWidth, fontHeight, - "Pos:", kTextAlignLeft); - t->setFont(font); - xpos += 4*fontWidth + 5; - myPosM0 = new DataGridWidget(boss, font, xpos, ypos, - 1, 1, 2, 8, kBASE_16); - myPosM0->setTarget(this); - myPosM0->setID(kPosM0ID); - addFocusWidget(myPosM0); - - // hmM0 - xpos += myPosM0->getWidth() + 8; - t = new StaticTextWidget(boss, xpos, ypos+2, - 3*fontWidth, fontHeight, - "HM:", kTextAlignLeft); - t->setFont(font); - xpos += 3*fontWidth + 5; - myHMM0 = new DataGridWidget(boss, font, xpos, ypos, - 1, 1, 1, 4, kBASE_16_4); - myHMM0->setTarget(this); - myHMM0->setID(kHMM0ID); - addFocusWidget(myHMM0); - - // NUSIZ0 (missile portion) - xpos += myHMM0->getWidth() + 8; - t = new StaticTextWidget(boss, xpos, ypos+2, - 5*fontWidth, fontHeight, - "Size:", kTextAlignLeft); - t->setFont(font); - xpos += 5*fontWidth + 5; - myNusizM0 = new DataGridWidget(boss, font, xpos, ypos, - 1, 1, 1, 2, kBASE_16_4); - myNusizM0->setTarget(this); - myNusizM0->setID(kNusizM0ID); - addFocusWidget(myNusizM0); - - // M0 reset - xpos += myNusizM0->getWidth() + 15; - myResMP0 = new CheckboxWidget(boss, font, xpos, ypos+1, - "Reset", kCheckActionCmd); - myResMP0->setFont(font); - myResMP0->setTarget(this); - myResMP0->setID(kResMP0ID); - addFocusWidget(myResMP0); - - //////////////////////////// - // M1 register info - //////////////////////////// - // enaM1 - xpos = 10; ypos += 2*lineHeight; - t = new StaticTextWidget(boss, xpos, ypos+2, - 3*fontWidth, fontHeight, - "M1:", kTextAlignLeft); - t->setFont(font); - xpos += 3*fontWidth + 8; - myEnaM1 = new CheckboxWidget(boss, font, xpos, ypos+2, - "Enable", kCheckActionCmd); - myEnaM1->setFont(font); - myEnaM1->setTarget(this); - myEnaM1->setID(kEnaM1ID); - addFocusWidget(myEnaM1); - - // posM0 - xpos += myEnaM1->getWidth() + 12; - t = new StaticTextWidget(boss, xpos, ypos+2, - 4*fontWidth, fontHeight, - "Pos:", kTextAlignLeft); - t->setFont(font); - xpos += 4*fontWidth + 5; - myPosM1 = new DataGridWidget(boss, font, xpos, ypos, - 1, 1, 2, 8, kBASE_16); - myPosM1->setTarget(this); - myPosM1->setID(kPosM1ID); - addFocusWidget(myPosM1); - - // hmM0 - xpos += myPosM1->getWidth() + 8; - t = new StaticTextWidget(boss, xpos, ypos+2, - 3*fontWidth, fontHeight, - "HM:", kTextAlignLeft); - t->setFont(font); - xpos += 3*fontWidth + 5; - myHMM1 = new DataGridWidget(boss, font, xpos, ypos, - 1, 1, 1, 4, kBASE_16_4); - myHMM1->setTarget(this); - myHMM1->setID(kHMM1ID); - addFocusWidget(myHMM1); - - // NUSIZ1 (missile portion) - xpos += myHMM1->getWidth() + 8; - t = new StaticTextWidget(boss, xpos, ypos+2, - 5*fontWidth, fontHeight, - "Size:", kTextAlignLeft); - t->setFont(font); - xpos += 5*fontWidth + 5; - myNusizM1 = new DataGridWidget(boss, font, xpos, ypos, - 1, 1, 1, 2, kBASE_16_4); - myNusizM1->setTarget(this); - myNusizM1->setID(kNusizM1ID); - addFocusWidget(myNusizM1); - - // M1 reset - xpos += myNusizM1->getWidth() + 15; - myResMP1 = new CheckboxWidget(boss, font, xpos, ypos+1, - "Reset", kCheckActionCmd); - myResMP1->setFont(font); - myResMP1->setTarget(this); - myResMP1->setID(kResMP1ID); - addFocusWidget(myResMP1); - - //////////////////////////// - // BL register info - //////////////////////////// - // enaBL - xpos = 10; ypos += 2*lineHeight; - t = new StaticTextWidget(boss, xpos, ypos+2, - 3*fontWidth, fontHeight, - "BL:", kTextAlignLeft); - t->setFont(font); - xpos += 3*fontWidth + 8; - myEnaBL = new CheckboxWidget(boss, font, xpos, ypos+2, - "Enable", kCheckActionCmd); - myEnaBL->setFont(font); - myEnaBL->setTarget(this); - myEnaBL->setID(kEnaBLID); - addFocusWidget(myEnaBL); - - // posBL - xpos += myEnaBL->getWidth() + 12; - t = new StaticTextWidget(boss, xpos, ypos+2, - 4*fontWidth, fontHeight, - "Pos:", kTextAlignLeft); - t->setFont(font); - xpos += 4*fontWidth + 5; - myPosBL = new DataGridWidget(boss, font, xpos, ypos, - 1, 1, 2, 8, kBASE_16); - myPosBL->setTarget(this); - myPosBL->setID(kPosBLID); - addFocusWidget(myPosBL); - - // hmBL - xpos += myPosBL->getWidth() + 8; - t = new StaticTextWidget(boss, xpos, ypos+2, - 3*fontWidth, fontHeight, - "HM:", kTextAlignLeft); - t->setFont(font); - xpos += 3*fontWidth + 5; - myHMBL = new DataGridWidget(boss, font, xpos, ypos, - 1, 1, 1, 4, kBASE_16_4); - myHMBL->setTarget(this); - myHMBL->setID(kHMBLID); - addFocusWidget(myHMBL); - - // CTRLPF (size portion) - xpos += myHMBL->getWidth() + 8; - t = new StaticTextWidget(boss, xpos, ypos+2, - 5*fontWidth, fontHeight, - "Size:", kTextAlignLeft); - t->setFont(font); - xpos += 5*fontWidth + 5; - mySizeBL = new DataGridWidget(boss, font, xpos, ypos, - 1, 1, 1, 2, kBASE_16_4); - mySizeBL->setTarget(this); - mySizeBL->setID(kSizeBLID); - addFocusWidget(mySizeBL); - - // BL delay - xpos += mySizeBL->getWidth() + 15; - myDelBL = new CheckboxWidget(boss, font, xpos, ypos+1, - "Delay", kCheckActionCmd); - myDelBL->setFont(font); - myDelBL->setTarget(this); - myDelBL->setID(kDelBLID); - addFocusWidget(myDelBL); - - //////////////////////////// - // PF 0/1/2 registers - //////////////////////////// - // PF0 - xpos = 10; ypos += 2*lineHeight; - t = new StaticTextWidget(boss, xpos, ypos+2, - 4*fontWidth, fontHeight, - "PF:", kTextAlignLeft); - t->setFont(font); - xpos += 4*fontWidth; - myPF[0] = new TogglePixelWidget(boss, xpos, ypos+2, 4, 1); - myPF[0]->setTarget(this); - myPF[0]->setID(kPF0ID); - addFocusWidget(myPF[0]); - - // PF1 - xpos += myPF[0]->getWidth() + 2; - myPF[1] = new TogglePixelWidget(boss, xpos, ypos+2, 8, 1); - myPF[1]->setTarget(this); - myPF[1]->setID(kPF1ID); - addFocusWidget(myPF[1]); - - // PF2 - xpos += myPF[1]->getWidth() + 2; - myPF[2] = new TogglePixelWidget(boss, xpos, ypos+2, 8, 1); - myPF[2]->setTarget(this); - myPF[2]->setID(kPF2ID); - addFocusWidget(myPF[2]); - - // PF reflect, score, priority - xpos = 10 + 4*fontWidth; ypos += lineHeight + 2; - myRefPF = new CheckboxWidget(boss, font, xpos, ypos+1, - "Reflect", kCheckActionCmd); - myRefPF->setFont(font); - myRefPF->setTarget(this); - myRefPF->setID(kRefPFID); - addFocusWidget(myRefPF); - - xpos += myRefPF->getWidth() + 15; - myScorePF = new CheckboxWidget(boss, font, xpos, ypos+1, - "Score", kCheckActionCmd); - myScorePF->setFont(font); - myScorePF->setTarget(this); - myScorePF->setID(kScorePFID); - addFocusWidget(myScorePF); - - xpos += myScorePF->getWidth() + 15; - myPriorityPF = new CheckboxWidget(boss, font, xpos, ypos+1, - "Priority", kCheckActionCmd); - myPriorityPF->setFont(font); - myPriorityPF->setTarget(this); - myPriorityPF->setID(kPriorityPFID); - addFocusWidget(myPriorityPF); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -TiaWidget::~TiaWidget() -{ -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) -{ - // We simply change the values in the DataGridWidget - // It will then send the 'kDGItemDataChangedCmd' signal to change the actual - // memory location - int addr, value; - string buf; - - Debugger& dbg = instance()->debugger(); - TIADebug& tia = dbg.tiaDebug(); - - switch(cmd) - { - case kWsyncCmd: - tia.strobeWsync(); - break; - - case kRsyncCmd: - tia.strobeRsync(); - break; - - case kResP0Cmd: - tia.strobeResP0(); - break; - - case kResP1Cmd: - tia.strobeResP1(); - break; - - case kResM0Cmd: - tia.strobeResM0(); - break; - - case kResM1Cmd: - tia.strobeResM1(); - break; - - case kResBLCmd: - tia.strobeResBL(); - break; - - case kHmoveCmd: - tia.strobeHmove(); - break; - - case kHmclrCmd: - tia.strobeHmclr(); - break; - - case kCxclrCmd: - tia.strobeCxclr(); - break; - - case kDGItemDataChangedCmd: - switch(id) - { - case kColorRegsID: - changeColorRegs(); - break; - - case kPosP0ID: - tia.posP0(myPosP0->getSelectedValue()); - break; - - case kPosP1ID: - tia.posP1(myPosP1->getSelectedValue()); - break; - - case kPosM0ID: - tia.posM0(myPosM0->getSelectedValue()); - break; - - case kPosM1ID: - tia.posM1(myPosM1->getSelectedValue()); - break; - - case kPosBLID: - tia.posBL(myPosBL->getSelectedValue()); - break; - - case kHMP0ID: - tia.hmP0(myHMP0->getSelectedValue()); - break; - - case kHMP1ID: - tia.hmP1(myHMP1->getSelectedValue()); - break; - - case kHMM0ID: - tia.hmM0(myHMM0->getSelectedValue()); - break; - - case kHMM1ID: - tia.hmM1(myHMM1->getSelectedValue()); - break; - - case kHMBLID: - tia.hmBL(myHMBL->getSelectedValue()); - break; - - case kNusizP0ID: - tia.nusizP0(myNusizP0->getSelectedValue()); - myNusizP0Text->setEditString(tia.nusizP0String()); - break; - - case kNusizP1ID: - tia.nusizP1(myNusizP1->getSelectedValue()); - myNusizP1Text->setEditString(tia.nusizP1String()); - break; - - case kNusizM0ID: - tia.nusizM0(myNusizM0->getSelectedValue()); - break; - - case kNusizM1ID: - tia.nusizM1(myNusizM1->getSelectedValue()); - break; - - case kSizeBLID: - tia.sizeBL(mySizeBL->getSelectedValue()); - break; - - default: - cerr << "TiaWidget DG changed\n"; - break; - } - break; - - case kTWItemDataChangedCmd: - switch(id) - { - case kGRP0ID: - tia.grP0(myGRP0->getIntState()); - break; - - case kGRP1ID: - tia.grP1(myGRP1->getIntState()); - break; - - case kPF0ID: - tia.pf0(myPF[0]->getIntState()); - break; - - case kPF1ID: - tia.pf1(myPF[1]->getIntState()); - break; - - case kPF2ID: - tia.pf2(myPF[2]->getIntState()); - break; - } - break; - - case kDGSelectionChangedCmd: - switch(id) - { - case kRamID: - addr = myRamGrid->getSelectedAddr(); - value = myRamGrid->getSelectedValue(); - - myLabel->setEditString(dbg.equates()->getLabel(addr)); - - myDecValue->setEditString(dbg.valueToString(value, kBASE_10)); - myBinValue->setEditString(dbg.valueToString(value, kBASE_2)); - break; - } - break; - - case kCheckActionCmd: - switch(id) - { - case kP0_PFID: - tia.collP0_PF(myCollision[kP0_PFID]->getState() ? 1 : 0); - break; - - case kP0_BLID: - tia.collP0_BL(myCollision[kP0_BLID]->getState() ? 1 : 0); - break; - - case kP0_M1ID: - tia.collM1_P0(myCollision[kP0_M1ID]->getState() ? 1 : 0); - break; - - case kP0_M0ID: - tia.collM0_P0(myCollision[kP0_M0ID]->getState() ? 1 : 0); - break; - - case kP0_P1ID: - tia.collP0_P1(myCollision[kP0_P1ID]->getState() ? 1 : 0); - break; - - case kP1_PFID: - tia.collP1_PF(myCollision[kP1_PFID]->getState() ? 1 : 0); - break; - - case kP1_BLID: - tia.collP1_BL(myCollision[kP1_BLID]->getState() ? 1 : 0); - break; - - case kP1_M1ID: - tia.collM1_P1(myCollision[kP1_M1ID]->getState() ? 1 : 0); - break; - - case kP1_M0ID: - tia.collM0_P1(myCollision[kP1_M0ID]->getState() ? 1 : 0); - break; - - case kM0_PFID: - tia.collM0_PF(myCollision[kM0_PFID]->getState() ? 1 : 0); - break; - - case kM0_BLID: - tia.collM0_BL(myCollision[kM0_BLID]->getState() ? 1 : 0); - break; - - case kM0_M1ID: - tia.collM0_M1(myCollision[kM0_M1ID]->getState() ? 1 : 0); - break; - - case kM1_PFID: - tia.collM1_PF(myCollision[kM1_PFID]->getState() ? 1 : 0); - break; - - case kM1_BLID: - tia.collM1_BL(myCollision[kM1_BLID]->getState() ? 1 : 0); - break; - - case kBL_PFID: - tia.collBL_PF(myCollision[kBL_PFID]->getState() ? 1 : 0); - break; - - case kRefP0ID: - tia.refP0(myRefP0->getState() ? 1 : 0); - break; - - case kRefP1ID: - tia.refP1(myRefP1->getState() ? 1 : 0); - break; - - case kDelP0ID: - tia.vdelP0(myDelP0->getState() ? 1 : 0); - break; - - case kDelP1ID: - tia.vdelP1(myDelP1->getState() ? 1 : 0); - break; - - case kDelBLID: - tia.vdelBL(myDelBL->getState() ? 1 : 0); - break; - - case kResMP0ID: - tia.resMP0(myResMP0->getState() ? 1 : 0); - break; - - case kResMP1ID: - tia.resMP1(myResMP1->getState() ? 1 : 0); - break; - - case kRefPFID: - tia.refPF(myRefPF->getState() ? 1 : 0); - break; - - case kScorePFID: - tia.scorePF(myScorePF->getState() ? 1 : 0); - break; - - case kPriorityPFID: - tia.priorityPF(myPriorityPF->getState() ? 1 : 0); - break; - } - break; - } -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TiaWidget::loadConfig() -{ -//cerr << "TiaWidget::loadConfig()\n"; - fillGrid(); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TiaWidget::fillGrid() -{ - IntArray alist; - IntArray vlist; - BoolArray blist, changed, grNew, grOld; - - Debugger& dbg = instance()->debugger(); - TIADebug& tia = dbg.tiaDebug(); - TiaState state = (TiaState&) tia.getState(); - TiaState oldstate = (TiaState&) tia.getOldState(); - - // TIA RAM - alist.clear(); vlist.clear(); changed.clear(); - for(unsigned int i = 0; i < 16; i++) - { - alist.push_back(i); - vlist.push_back(state.ram[i]); - changed.push_back(state.ram[i] != oldstate.ram[i]); - } - myRamGrid->setList(alist, vlist, changed); - - // Color registers - alist.clear(); vlist.clear(); changed.clear(); - for(unsigned int i = 0; i < 4; i++) - { - alist.push_back(i); - vlist.push_back(state.coluRegs[i]); - changed.push_back(state.coluRegs[i] != oldstate.coluRegs[i]); - } - myColorRegs->setList(alist, vlist, changed); - - myCOLUP0Color->setColor(state.coluRegs[0]); - myCOLUP1Color->setColor(state.coluRegs[1]); - myCOLUPFColor->setColor(state.coluRegs[2]); - myCOLUBKColor->setColor(state.coluRegs[3]); - - //////////////////////////// - // Collision register bits - //////////////////////////// - myCollision[kP0_PFID]->setState(tia.collP0_PF()); - myCollision[kP0_BLID]->setState(tia.collP0_BL()); - myCollision[kP0_M1ID]->setState(tia.collM1_P0()); - myCollision[kP0_M0ID]->setState(tia.collM0_P0()); - myCollision[kP0_P1ID]->setState(tia.collP0_P1()); - myCollision[kP1_PFID]->setState(tia.collP1_PF()); - myCollision[kP1_BLID]->setState(tia.collP1_BL()); - myCollision[kP1_M1ID]->setState(tia.collM1_P1()); - myCollision[kP1_M0ID]->setState(tia.collM0_P1()); - myCollision[kM0_PFID]->setState(tia.collM0_PF()); - myCollision[kM0_BLID]->setState(tia.collM0_BL()); - myCollision[kM0_M1ID]->setState(tia.collM0_M1()); - myCollision[kM1_PFID]->setState(tia.collM1_PF()); - myCollision[kM1_BLID]->setState(tia.collM1_BL()); - myCollision[kBL_PFID]->setState(tia.collBL_PF()); - - //////////////////////////// - // P0 register info - //////////////////////////// - // grP0 - myGRP0->setColor((OverlayColor)state.coluRegs[0]); - myGRP0->setIntState(state.gr[P0], false); - - // posP0 - myPosP0->setList(0, state.pos[P0], state.pos[P0] != oldstate.pos[P0]); - - // hmP0 - myHMP0->setList(0, state.hm[P0], state.hm[P0] != oldstate.hm[P0]); - - // refP0 & vdelP0 - myRefP0->setState(tia.refP0()); - myDelP0->setState(tia.vdelP0()); - - // NUSIZ0 (player portion) - myNusizP0->setList(0, state.size[P0], state.size[P0] != oldstate.size[P0]); - myNusizP0Text->setEditString(tia.nusizP0String()); - - //////////////////////////// - // P1 register info - //////////////////////////// - // grP1 - myGRP1->setColor((OverlayColor)state.coluRegs[1]); - myGRP1->setIntState(state.gr[P1], false); - - // posP1 - myPosP1->setList(0, state.pos[P1], state.pos[P1] != oldstate.pos[P1]); - - // hmP1 - myHMP1->setList(0, state.hm[P1], state.hm[P1] != oldstate.hm[P1]); - - // refP1 & vdelP1 - myRefP1->setState(tia.refP1()); - myDelP1->setState(tia.vdelP1()); - - // NUSIZ1 (player portion) - myNusizP1->setList(0, state.size[P1], state.size[P1] != oldstate.size[P1]); - myNusizP1Text->setEditString(tia.nusizP1String()); - - //////////////////////////// - // M0 register info - //////////////////////////// - // enaM0 - myEnaM0->setState(tia.enaM0()); - - // posM0 - myPosM0->setList(0, state.pos[M0], state.pos[M0] != oldstate.pos[M0]); - - // hmM0 - myHMM0->setList(0, state.hm[M0], state.hm[M0] != oldstate.hm[M0]); - - // NUSIZ0 (missile portion) - myNusizM0->setList(0, state.size[M0], state.size[M0] != oldstate.size[M0]); - - // resMP0 - myResMP0->setState(tia.resMP0()); - - //////////////////////////// - // M1 register info - //////////////////////////// - // enaM1 - myEnaM1->setState(tia.enaM1()); - - // posM1 - myPosM1->setList(0, state.pos[M1], state.pos[M1] != oldstate.pos[M1]); - - // hmM1 - myHMM1->setList(0, state.hm[M1], state.hm[M1] != oldstate.hm[M1]); - - // NUSIZ1 (missile portion) - myNusizM1->setList(0, state.size[M1], state.size[M1] != oldstate.size[M1]); - - // resMP1 - myResMP1->setState(tia.resMP1()); - - //////////////////////////// - // BL register info - //////////////////////////// - // enaBL - myEnaBL->setState(tia.enaBL()); - - // posBL - myPosBL->setList(0, state.pos[BL], state.pos[BL] != oldstate.pos[BL]); - - // hmBL - myHMBL->setList(0, state.hm[BL], state.hm[BL] != oldstate.hm[BL]); - - // CTRLPF (size portion) - mySizeBL->setList(0, state.size[BL], state.size[BL] != oldstate.size[BL]); - - // vdelBL - myDelBL->setState(tia.vdelBL()); - - //////////////////////////// - // PF register info - //////////////////////////// - // PF0 - myPF[0]->setColor((OverlayColor)state.coluRegs[2]); - myPF[0]->setIntState(state.pf[0], true); // reverse bit order - - // PF1 - myPF[1]->setColor((OverlayColor)state.coluRegs[2]); - myPF[1]->setIntState(state.pf[1], false); - - // PF2 - myPF[2]->setColor((OverlayColor)state.coluRegs[2]); - myPF[2]->setIntState(state.pf[2], true); // reverse bit order - - // Reflect - myRefPF->setState(tia.refPF()); - - // Score - myScorePF->setState(tia.scorePF()); - - // Priority - myPriorityPF->setState(tia.priorityPF()); -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void TiaWidget::changeColorRegs() -{ - int addr = myColorRegs->getSelectedAddr(); - int value = myColorRegs->getSelectedValue(); - - switch(addr) - { - case kCOLUP0Addr: - instance()->debugger().tiaDebug().coluP0(value); - myCOLUP0Color->setColor(value); - break; - - case kCOLUP1Addr: - instance()->debugger().tiaDebug().coluP1(value); - myCOLUP1Color->setColor(value); - break; - - case kCOLUPFAddr: - instance()->debugger().tiaDebug().coluPF(value); - myCOLUPFColor->setColor(value); - break; - - case kCOLUBKAddr: - instance()->debugger().tiaDebug().coluBK(value); - myCOLUBKColor->setColor(value); - break; - } -} diff --git a/stella/src/debugger/TiaWidget.hxx b/stella/src/debugger/TiaWidget.hxx deleted file mode 100644 index 1bf423e96..000000000 --- a/stella/src/debugger/TiaWidget.hxx +++ /dev/null @@ -1,111 +0,0 @@ -//============================================================================ -// -// 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: TiaWidget.hxx,v 1.9 2005-08-19 23:02:08 stephena Exp $ -// -// Based on code from ScummVM - Scumm Interpreter -// Copyright (C) 2002-2004 The ScummVM project -//============================================================================ - -#ifndef TIA_WIDGET_HXX -#define TIA_WIDGET_HXX - -class GuiObject; -class ButtonWidget; -class DataGridWidget; -class StaticTextWidget; -class ToggleBitWidget; -class TogglePixelWidget; -class EditTextWidget; -class ColorWidget; - -#include "Widget.hxx" -#include "Command.hxx" - - -class TiaWidget : public Widget, public CommandSender -{ - public: - TiaWidget(GuiObject* boss, int x, int y, int w, int h); - virtual ~TiaWidget(); - - void handleCommand(CommandSender* sender, int cmd, int data, int id); - void loadConfig(); - - private: - void fillGrid(); - void changeColorRegs(); - void convertCharToBool(BoolArray& b, unsigned char value); - int convertBoolToInt(const BoolArray& b); - - private: - DataGridWidget* myRamGrid; - EditTextWidget* myBinValue; - EditTextWidget* myDecValue; - EditTextWidget* myLabel; - - DataGridWidget* myColorRegs; - - ColorWidget* myCOLUP0Color; - ColorWidget* myCOLUP1Color; - ColorWidget* myCOLUPFColor; - ColorWidget* myCOLUBKColor; - - TogglePixelWidget* myGRP0; - TogglePixelWidget* myGRP1; - - DataGridWidget* myPosP0; - DataGridWidget* myPosP1; - DataGridWidget* myPosM0; - DataGridWidget* myPosM1; - DataGridWidget* myPosBL; - - DataGridWidget* myHMP0; - DataGridWidget* myHMP1; - DataGridWidget* myHMM0; - DataGridWidget* myHMM1; - DataGridWidget* myHMBL; - - DataGridWidget* myNusizP0; - DataGridWidget* myNusizP1; - DataGridWidget* myNusizM0; - DataGridWidget* myNusizM1; - DataGridWidget* mySizeBL; - EditTextWidget* myNusizP0Text; - EditTextWidget* myNusizP1Text; - - CheckboxWidget* myRefP0; - CheckboxWidget* myRefP1; - CheckboxWidget* myDelP0; - CheckboxWidget* myDelP1; - CheckboxWidget* myDelBL; - - CheckboxWidget* myEnaM0; - CheckboxWidget* myEnaM1; - CheckboxWidget* myEnaBL; - - CheckboxWidget* myResMP0; - CheckboxWidget* myResMP1; - - /** Collision register bits */ - CheckboxWidget* myCollision[15]; - - TogglePixelWidget* myPF[3]; - CheckboxWidget* myRefPF; - CheckboxWidget* myScorePF; - CheckboxWidget* myPriorityPF; -}; - -#endif