From 8487a60faafa597f5f623fbe1e275bf511d4c7c3 Mon Sep 17 00:00:00 2001 From: stephena Date: Wed, 17 Apr 2013 15:00:32 +0000 Subject: [PATCH] Fixed configure script wrt Thumb ARM support; the help message never actually included info on how to enable/disable it. StringParser is now width-sensitive, in that it can also split on a maximum string length. This is useful for making the various UI items font-size independent, and to flow the text accordingly. Increased minimum size of debugger window to 1080x720, which allows things to be laid out a little nicer, and gives some much needed extra room. Sorry guys, the most common resolution now in use is 1366x768, so it's time to move with the times. Cleaned up some of the descriptions in the ROM debugger tab(s). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2694 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- configure | 2 ++ src/common/StringParser.hxx | 47 +++++++++++++++++++++++----- src/debugger/Debugger.cxx | 8 ++--- src/debugger/gui/Cart3EWidget.cxx | 10 +++--- src/debugger/gui/CartDebugWidget.hxx | 5 +-- src/debugger/gui/CartE0Widget.cxx | 24 +++++++------- src/debugger/gui/CartF0Widget.cxx | 32 +++++++++---------- src/debugger/gui/CartFEWidget.cxx | 22 ++++++------- src/debugger/gui/RamWidget.cxx | 10 +++--- src/emucore/OSystem.cxx | 2 ++ src/gui/UIDialog.cxx | 16 +++++----- 11 files changed, 106 insertions(+), 72 deletions(-) diff --git a/configure b/configure index b589003d6..419eb8a5f 100755 --- a/configure +++ b/configure @@ -213,6 +213,8 @@ Optional Features: --disable-joystick --enable-cheats enable/disable cheatcode support [enabled] --disable-cheats + --enable-thumb enable/disable Thumb ARM support [enabled] + --disable-thumb --enable-shared build shared binary [enabled] --enable-static build static binary (if possible) [disabled] --disable-static diff --git a/src/common/StringParser.hxx b/src/common/StringParser.hxx index 700120802..63eb9b50d 100644 --- a/src/common/StringParser.hxx +++ b/src/common/StringParser.hxx @@ -33,20 +33,51 @@ class StringParser { public: /** - Split the given string based on delimiter (by default, the newline - character, and by desired length (by default, not used). + Split the given string based on the newline character. - @param str The string to split - @param len The maximum length of string to generate (0 means unlimited) - @param delim The character indicating the end of a line (newline by default) + @param str The string to split */ - StringParser(const string& str, uInt32 len = 0, char delim = '\n') + StringParser(const string& str) { stringstream buf(str); string line; - while(std::getline(buf, line, delim)) - { + + while(std::getline(buf, line, '\n')) myStringList.push_back(line); + } + + /** + Split the given string based on the newline character, making sure that + no string is longer than maximum string length. + + @param str The string to split + @param maxlen The maximum length of string to generate + */ + StringParser(const string& str, uInt16 maxlen) + { + stringstream buf(str); + string line; + + while(std::getline(buf, line, '\n')) + { + size_t beg = 0, len = maxlen, size = line.size(); + + if(size <= len) + myStringList.push_back(line); + else + { + while((beg+maxlen) < size) + { + size_t spos = line.find_last_of(' ', beg+len); + if(spos > beg) + len = spos - beg; + + myStringList.push_back(line.substr(beg, len)); + beg += len + 1; + len = maxlen; + } + myStringList.push_back(line.substr(beg)); + } } } diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index 748edc27a..4ecbb4537 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -121,8 +121,8 @@ Debugger::Debugger(OSystem& osystem, Console& console) myBreakPoints(NULL), myReadTraps(NULL), myWriteTraps(NULL), - myWidth(1050), - myHeight(620), + myWidth(1080), + myHeight(720), myRewindManager(NULL) { // Init parser @@ -169,8 +169,8 @@ void Debugger::initialize() myOSystem->settings().getSize("debuggerres", w, h); myWidth = BSPF_max(w, 0); myHeight = BSPF_max(h, 0); - myWidth = BSPF_max(myWidth, 1050u); - myHeight = BSPF_max(myHeight, 700u); + myWidth = BSPF_max(myWidth, 1080u); + myHeight = BSPF_max(myHeight, 720u); myOSystem->settings().setSize("debuggerres", myWidth, myHeight); const GUI::Rect& r = getDialogBounds(); diff --git a/src/debugger/gui/Cart3EWidget.cxx b/src/debugger/gui/Cart3EWidget.cxx index 852e26e60..0681365ac 100644 --- a/src/debugger/gui/Cart3EWidget.cxx +++ b/src/debugger/gui/Cart3EWidget.cxx @@ -33,12 +33,12 @@ Cartridge3EWidget::Cartridge3EWidget( uInt32 size = cart.mySize; ostringstream info; - info << "Tigervision 3E cartridge - (3E + RAM)\n" + info << "3E cartridge - (3F + RAM)\n" << " 2-256 2K ROM (currently " << myNumRomBanks << "), 32 1K RAM\n" - << "(ROM) First 2K selected by writing to $3F\n" - << "(RAM) First 2K selected by writing to $3E\n" - << " $F000 - $F3FF (R), $F400 - $F7FF (W)\n" - << "Last 2K always points to last 2K of ROM\n"; + << "First 2K (ROM) selected by writing to $3F\n" + "First 2K (RAM) selected by writing to $3E\n" + " $F000 - $F3FF (R), $F400 - $F7FF (W)\n" + "Last 2K always points to last 2K of ROM\n"; if(cart.myStartBank < myNumRomBanks) info << "Startup bank = " << cart.myStartBank << " (ROM)\n"; else diff --git a/src/debugger/gui/CartDebugWidget.hxx b/src/debugger/gui/CartDebugWidget.hxx index 654cbfecf..9b613052b 100644 --- a/src/debugger/gui/CartDebugWidget.hxx +++ b/src/debugger/gui/CartDebugWidget.hxx @@ -53,7 +53,7 @@ class CartDebugWidget : public Widget, public CommandSender const string& desc) { const int lwidth = _font.getStringWidth("Manufacturer: "), - fwidth = _w - lwidth - 30; + fwidth = _w - lwidth - 20; EditTextWidget* w = 0; ostringstream buf; @@ -78,7 +78,7 @@ class CartDebugWidget : public Widget, public CommandSender w->setEditable(false); y += myLineHeight + 4; - StringParser bs(desc); + StringParser bs(desc, (fwidth - kScrollBarWidth) / myFontWidth); const StringList& sl = bs.stringList(); uInt32 lines = sl.size(); if(lines < 3) lines = 3; @@ -110,6 +110,7 @@ class CartDebugWidget : public Widget, public CommandSender // we may as well make them protected variables int myFontWidth, myFontHeight, myLineHeight; + private: StringListWidget* myDesc; }; diff --git a/src/debugger/gui/CartE0Widget.cxx b/src/debugger/gui/CartE0Widget.cxx index 6f4fde217..996cb61bb 100644 --- a/src/debugger/gui/CartE0Widget.cxx +++ b/src/debugger/gui/CartE0Widget.cxx @@ -30,17 +30,17 @@ CartridgeE0Widget::CartridgeE0Widget( { uInt32 size = 8 * 1024; - ostringstream info; - info << "Parker Bros E0 cartridge, 8 1K slices\n" - << "Segment 0 accessible @ $F000 - $F3FF\n" - << " Hotspots $FE0 to $FE7\n" - << "Segment 1 accessible @ $F400 - $F7FF\n" - << " Hotspots $FE8 to $FEF\n" - << "Segment 2 accessible @ $F800 - $FBFF\n" - << " Hotspots $FF0 to $FF7\n" - << "Segment 3 accessible @ $FC00 - $FFFF\n" - << " Always points to last 1K of ROM\n" - << "Startup slices = 0 / 1 / 2\n"; + string info = + "E0 cartridge, eight 1K slices\n" + "Segment 0 accessible @ $F000 - $F3FF\n" + " Hotspots $FE0 to $FE7\n" + "Segment 1 accessible @ $F400 - $F7FF\n" + " Hotspots $FE8 to $FEF\n" + "Segment 2 accessible @ $F800 - $FBFF\n" + " Hotspots $FF0 to $FF7\n" + "Segment 3 accessible @ $FC00 - $FFFF\n" + " Always points to last 1K of ROM\n" + "Startup slices = 0 / 1 / 2\n"; #if 0 // Eventually, we should query this from the debugger/disassembler @@ -49,7 +49,7 @@ CartridgeE0Widget::CartridgeE0Widget( info << "Bank RORG" << " = $" << HEX4 << start << "\n"; #endif int xpos = 10, - ypos = addBaseInformation(size, "Parker Brothers", info.str()) + myLineHeight; + ypos = addBaseInformation(size, "Parker Brothers", info) + myLineHeight; StringMap items0, items1, items2; items0.push_back("0 ($FE0)", "0"); diff --git a/src/debugger/gui/CartF0Widget.cxx b/src/debugger/gui/CartF0Widget.cxx index dbbf67cc2..19301d464 100644 --- a/src/debugger/gui/CartF0Widget.cxx +++ b/src/debugger/gui/CartF0Widget.cxx @@ -49,22 +49,22 @@ CartridgeF0Widget::CartridgeF0Widget( info.str()) + myLineHeight; StringMap items; - items.push_back(" 0", "0"); - items.push_back(" 1", "1"); - items.push_back(" 2", "2"); - items.push_back(" 3", "3"); - items.push_back(" 4", "4"); - items.push_back(" 5", "5"); - items.push_back(" 6", "6"); - items.push_back(" 7", "7"); - items.push_back(" 8", "8"); - items.push_back(" 9", "9"); - items.push_back("10", "10"); - items.push_back("11", "11"); - items.push_back("12", "12"); - items.push_back("13", "13"); - items.push_back("14", "14"); - items.push_back("15", "15"); + items.push_back(" 0", "0"); + items.push_back(" 1", "1"); + items.push_back(" 2", "2"); + items.push_back(" 3", "3"); + items.push_back(" 4", "4"); + items.push_back(" 5", "5"); + items.push_back(" 6", "6"); + items.push_back(" 7", "7"); + items.push_back(" 8", "8"); + items.push_back(" 9", "9"); + items.push_back(" 10", "10"); + items.push_back(" 11", "11"); + items.push_back(" 12", "12"); + items.push_back(" 13", "13"); + items.push_back(" 14", "14"); + items.push_back(" 15", "15"); myBank = new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth(" 15 "), myLineHeight, items, "Set bank: ", diff --git a/src/debugger/gui/CartFEWidget.cxx b/src/debugger/gui/CartFEWidget.cxx index 87631d547..04a60fdf7 100644 --- a/src/debugger/gui/CartFEWidget.cxx +++ b/src/debugger/gui/CartFEWidget.cxx @@ -26,17 +26,15 @@ CartridgeFEWidget::CartridgeFEWidget( int x, int y, int w, int h, CartridgeFE& cart) : CartDebugWidget(boss, font, x, y, w, h) { - uInt16 size = 2 * 4096; + string info = + "FE cartridge, two 4K banks\n" + "Doesn't support bankswitching with hotspots, " + "but instead watches A13 of called addresses:\n" + "Bank 0 @ $F000 - $FFFF (A13 = 1)\n" + "Bank 1 @ $D000 - $DFFF (A13 = 0)\n" + "\n" + "Changing banks is not supported, since it " + "would immediately switch on the next address\n"; - ostringstream info; - info << "FE cartridge, two 4K banks\n" - << "Doesn't support bankswitching with hotspots,\n" - << "but instead watches A13 of called addresses:\n" - << "Bank 0 @ $F000 - $FFFF (A13 = 1)\n" - << "Bank 1 @ $D000 - $DFFF (A13 = 0)\n" - << "\n" - << "Changing banks is not supported, since it\n" - << "would immediately switch on the next address\n"; - - addBaseInformation(size, "Activision", info.str()); + addBaseInformation(2 * 4096, "Activision", info); } diff --git a/src/debugger/gui/RamWidget.cxx b/src/debugger/gui/RamWidget.cxx index e876f2715..25845016c 100644 --- a/src/debugger/gui/RamWidget.cxx +++ b/src/debugger/gui/RamWidget.cxx @@ -46,7 +46,7 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y) const int fontWidth = font.getMaxCharWidth(), fontHeight = font.getFontHeight(), lineHeight = font.getLineHeight(), - bwidth = 44,//font.getStringWidth("Undo "), + bwidth = font.getStringWidth("Compare "), bheight = lineHeight + 2; int xpos, ypos, lwidth; @@ -66,22 +66,22 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y) ypos += bheight + 4; myRevertButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight, - "Rev", kRevertCmd); + "Revert", kRevertCmd); myRevertButton->setTarget(this); ypos += 2 * bheight + 2; mySearchButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight, - "Srch", kSearchCmd); + "Search", kSearchCmd); mySearchButton->setTarget(this); ypos += bheight + 4; myCompareButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight, - "Cmp", kCmpCmd); + "Compare", kCmpCmd); myCompareButton->setTarget(this); ypos += bheight + 4; myRestartButton = new ButtonWidget(boss, font, xpos, ypos, bwidth, bheight, - "Rset", kRestartCmd); + "Reset", kRestartCmd); myRestartButton->setTarget(this); // Labels for RAM grid diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index 2e7850b4f..88ba57a37 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -612,7 +612,9 @@ void OSystem::deleteConsole() logMessage(buf.str(), 1); delete myConsole; myConsole = NULL; + #ifdef DEBUGGER_SUPPORT delete myDebugger; myDebugger = NULL; + #endif } } diff --git a/src/gui/UIDialog.cxx b/src/gui/UIDialog.cxx index 927559030..3efa6c284 100644 --- a/src/gui/UIDialog.cxx +++ b/src/gui/UIDialog.cxx @@ -169,7 +169,7 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent, myDebuggerWidthSlider = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight, "Debugger Width: ", lwidth, kDWidthChanged); - myDebuggerWidthSlider->setMinValue(1050); + myDebuggerWidthSlider->setMinValue(1080); myDebuggerWidthSlider->setMaxValue(1920); myDebuggerWidthSlider->setStepValue(10); wid.push_back(myDebuggerWidthSlider); @@ -183,7 +183,7 @@ UIDialog::UIDialog(OSystem* osystem, DialogContainer* parent, myDebuggerHeightSlider = new SliderWidget(myTab, font, xpos, ypos, pwidth, lineHeight, "Debugger Height: ", lwidth, kDHeightChanged); - myDebuggerHeightSlider->setMinValue(700); + myDebuggerHeightSlider->setMinValue(720); myDebuggerHeightSlider->setMaxValue(1200); myDebuggerHeightSlider->setStepValue(10); wid.push_back(myDebuggerHeightSlider); @@ -314,8 +314,8 @@ void UIDialog::loadConfig() #ifdef DEBUGGER_SUPPORT // Debugger size instance().settings().getSize("debuggerres", w, h); - w = BSPF_max(w, 1050); - h = BSPF_max(h, 620); + w = BSPF_max(w, 1080); + h = BSPF_max(h, 720); w = BSPF_min(w, 1920); h = BSPF_min(h, 1200); @@ -398,10 +398,10 @@ void UIDialog::setDefaults() } case 1: // Debugger options - myDebuggerWidthSlider->setValue(1050); - myDebuggerWidthLabel->setValue(1050); - myDebuggerHeightSlider->setValue(700); - myDebuggerHeightLabel->setValue(700); + myDebuggerWidthSlider->setValue(1080); + myDebuggerWidthLabel->setValue(1080); + myDebuggerHeightSlider->setValue(720); + myDebuggerHeightLabel->setValue(720); break; case 2: // Misc. options