diff --git a/src/debugger/gui/AtariVoxWidget.cxx b/src/debugger/gui/AtariVoxWidget.cxx index 865f1fcb5..c1892b580 100644 --- a/src/debugger/gui/AtariVoxWidget.cxx +++ b/src/debugger/gui/AtariVoxWidget.cxx @@ -25,15 +25,14 @@ AtariVoxWidget::AtariVoxWidget(GuiObject* boss, const GUI::Font& font, : ControllerWidget(boss, font, x, y, controller) { bool leftport = myController.jack() == Controller::Left; - const string& label = leftport ? "Left (AtariVox):" : "Right (AtariVox):"; + const string& label = leftport ? "Left (AtariVox)" : "Right (AtariVox)"; - const int fontWidth = font.getMaxCharWidth(), - fontHeight = font.getFontHeight(), + const int fontHeight = font.getFontHeight(), lineHeight = font.getLineHeight(), bwidth = font.getStringWidth("Erase EEPROM") + 20, bheight = lineHeight + 4; - int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (AtariVox):"); + int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (AtariVox)"); StaticTextWidget* t; t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, @@ -46,16 +45,18 @@ AtariVoxWidget::AtariVoxWidget(GuiObject* boss, const GUI::Font& font, myEEPROMErase->setTarget(this); ypos += lineHeight + 20; - new StaticTextWidget(boss, font, xpos, ypos, fontWidth*22, + const GUI::Font& ifont = instance().frameBuffer().infoFont(); + lwidth = ifont.getMaxCharWidth() * 20; + new StaticTextWidget(boss, ifont, xpos, ypos, lwidth, fontHeight, "(*) This will erase", kTextAlignLeft); ypos += lineHeight + 2; - new StaticTextWidget(boss, font, xpos, ypos, fontWidth*22, + new StaticTextWidget(boss, ifont, xpos, ypos, lwidth, fontHeight, "all EEPROM data, not", kTextAlignLeft); ypos += lineHeight + 2; - new StaticTextWidget(boss, font, xpos, ypos, fontWidth*22, + new StaticTextWidget(boss, ifont, xpos, ypos, lwidth, fontHeight, "just the range used", kTextAlignLeft); ypos += lineHeight + 2; - new StaticTextWidget(boss, font, xpos, ypos, fontWidth*22, + new StaticTextWidget(boss, ifont, xpos, ypos, lwidth, fontHeight, "for this ROM", kTextAlignLeft); } diff --git a/src/debugger/gui/BoosterWidget.cxx b/src/debugger/gui/BoosterWidget.cxx index 7281c0594..6f5d83352 100644 --- a/src/debugger/gui/BoosterWidget.cxx +++ b/src/debugger/gui/BoosterWidget.cxx @@ -25,10 +25,10 @@ BoosterWidget::BoosterWidget(GuiObject* boss, const GUI::Font& font, : ControllerWidget(boss, font, x, y, controller) { bool leftport = myController.jack() == Controller::Left; - const string& label = leftport ? "Left (Booster):" : "Right (Booster):"; + const string& label = leftport ? "Left (Booster)" : "Right (Booster)"; const int fontHeight = font.getFontHeight(); - int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Booster):"); + int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Booster)"); StaticTextWidget* t; t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, diff --git a/src/debugger/gui/DrivingWidget.cxx b/src/debugger/gui/DrivingWidget.cxx index 58bc4c10a..447b4196c 100644 --- a/src/debugger/gui/DrivingWidget.cxx +++ b/src/debugger/gui/DrivingWidget.cxx @@ -25,12 +25,12 @@ DrivingWidget::DrivingWidget(GuiObject* boss, const GUI::Font& font, myGreyIndex(0) { bool leftport = myController.jack() == Controller::Left; - const string& label = leftport ? "Left (Driving):" : "Right (Driving):"; + const string& label = leftport ? "Left (Driving)" : "Right (Driving)"; const int fontHeight = font.getFontHeight(), bwidth = font.getStringWidth("Grey code +") + 10, bheight = font.getLineHeight() + 4; - int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Driving):"); + int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Driving)"); StaticTextWidget* t; t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, diff --git a/src/debugger/gui/GenesisWidget.cxx b/src/debugger/gui/GenesisWidget.cxx index 668e2cf20..04626a954 100644 --- a/src/debugger/gui/GenesisWidget.cxx +++ b/src/debugger/gui/GenesisWidget.cxx @@ -25,10 +25,10 @@ GenesisWidget::GenesisWidget(GuiObject* boss, const GUI::Font& font, : ControllerWidget(boss, font, x, y, controller) { bool leftport = myController.jack() == Controller::Left; - const string& label = leftport ? "Left (Genesis):" : "Right (Genesis):"; + const string& label = leftport ? "Left (Genesis)" : "Right (Genesis)"; const int fontHeight = font.getFontHeight(); - int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Genesis):"); + int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Genesis)"); StaticTextWidget* t; t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, diff --git a/src/debugger/gui/JoystickWidget.cxx b/src/debugger/gui/JoystickWidget.cxx index 6d9bc3453..21698f2aa 100644 --- a/src/debugger/gui/JoystickWidget.cxx +++ b/src/debugger/gui/JoystickWidget.cxx @@ -25,10 +25,10 @@ JoystickWidget::JoystickWidget(GuiObject* boss, const GUI::Font& font, : ControllerWidget(boss, font, x, y, controller) { bool leftport = myController.jack() == Controller::Left; - const string& label = leftport ? "Left (Joystick):" : "Right (Joystick):"; + const string& label = leftport ? "Left (Joystick)" : "Right (Joystick)"; const int fontHeight = font.getFontHeight(); - int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Joystick):"); + int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Joystick)"); StaticTextWidget* t; t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, diff --git a/src/debugger/gui/KeyboardWidget.cxx b/src/debugger/gui/KeyboardWidget.cxx index d25f3e357..567aed9bf 100644 --- a/src/debugger/gui/KeyboardWidget.cxx +++ b/src/debugger/gui/KeyboardWidget.cxx @@ -25,10 +25,10 @@ KeyboardWidget::KeyboardWidget(GuiObject* boss, const GUI::Font& font, : ControllerWidget(boss, font, x, y, controller) { bool leftport = myController.jack() == Controller::Left; - const string& label = leftport ? "Left (Keyboard):" : "Right (Keyboard):"; + const string& label = leftport ? "Left (Keyboard)" : "Right (Keyboard)"; const int fontHeight = font.getFontHeight(); - int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Keyboard):"); + int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Keyboard)"); StaticTextWidget* t; t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, diff --git a/src/debugger/gui/PaddleWidget.cxx b/src/debugger/gui/PaddleWidget.cxx index 5a9ae75a6..301f183cd 100644 --- a/src/debugger/gui/PaddleWidget.cxx +++ b/src/debugger/gui/PaddleWidget.cxx @@ -16,6 +16,7 @@ //============================================================================ #include "OSystem.hxx" +#include "Paddles.hxx" #include "EventHandler.hxx" #include "PaddleWidget.hxx" @@ -25,25 +26,26 @@ PaddleWidget::PaddleWidget(GuiObject* boss, const GUI::Font& font, : ControllerWidget(boss, font, x, y, controller) { bool leftport = myController.jack() == Controller::Left; - const string& label = leftport ? "Left (Paddles):" : "Right (Paddles):"; + const string& label = leftport ? "Left (Paddles)" : "Right (Paddles)"; const int fontWidth = font.getMaxCharWidth(), fontHeight = font.getFontHeight(), lineHeight = font.getLineHeight(); - int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Paddles):"); + int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Paddles)"); new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, fontHeight, label, kTextAlignLeft); ypos += lineHeight + 20; - const string& p0string = leftport ? "P0 pot: " : "P2 pot: "; - const string& p1string = leftport ? "P1 pot: " : "P3 pot: "; + const string& p0string = leftport ? "P0 pot " : "P2 pot "; + const string& p1string = leftport ? "P1 pot " : "P3 pot "; lwidth = font.getStringWidth("P3 pot: "); myP0Resistance = new SliderWidget(boss, font, xpos, ypos, 10*fontWidth, lineHeight, p0string, lwidth, kP0Changed); - myP0Resistance->setMinValue(0); myP0Resistance->setMaxValue(1400000); - myP0Resistance->setStepValue(1400000/100); + myP0Resistance->setMinValue(0); + myP0Resistance->setMaxValue(Paddles::MAX_RESISTANCE); + myP0Resistance->setStepValue(Paddles::MAX_RESISTANCE/100); myP0Resistance->setTarget(this); xpos += 20; ypos += myP0Resistance->getHeight() + 4; @@ -55,8 +57,9 @@ PaddleWidget::PaddleWidget(GuiObject* boss, const GUI::Font& font, myP1Resistance = new SliderWidget(boss, font, xpos, ypos, 10*fontWidth, lineHeight, p1string, lwidth, kP1Changed); - myP1Resistance->setMinValue(0); myP1Resistance->setMaxValue(1400000); - myP1Resistance->setStepValue(1400000/100); + myP1Resistance->setMinValue(0); + myP1Resistance->setMaxValue(Paddles::MAX_RESISTANCE); + myP1Resistance->setStepValue(Paddles::MAX_RESISTANCE/100); myP1Resistance->setTarget(this); xpos += 20; ypos += myP1Resistance->getHeight() + 4; @@ -68,8 +71,10 @@ PaddleWidget::PaddleWidget(GuiObject* boss, const GUI::Font& font, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PaddleWidget::loadConfig() { - myP0Resistance->setValue(1400000 - Int32(myController.read(Controller::Nine))); - myP1Resistance->setValue(1400000 - Int32(myController.read(Controller::Five))); + myP0Resistance->setValue(Paddles::MAX_RESISTANCE - + Int32(myController.read(Controller::Nine))); + myP1Resistance->setValue(Paddles::MAX_RESISTANCE - + Int32(myController.read(Controller::Five))); myP0Fire->setState(!myController.read(Controller::Four)); myP1Fire->setState(!myController.read(Controller::Three)); } @@ -81,10 +86,12 @@ void PaddleWidget::handleCommand( switch(cmd) { case kP0Changed: - myController.set(Controller::Nine, 1400000 - myP0Resistance->getValue()); + myController.set(Controller::Nine, + Paddles::MAX_RESISTANCE - myP0Resistance->getValue()); break; case kP1Changed: - myController.set(Controller::Five, 1400000 - myP1Resistance->getValue()); + myController.set(Controller::Five, + Paddles::MAX_RESISTANCE - myP1Resistance->getValue()); break; case kP0Fire: myController.set(Controller::Four, !myP0Fire->getState()); diff --git a/src/debugger/gui/RamWidget.cxx b/src/debugger/gui/RamWidget.cxx index 1d7f218cd..9b09a79ff 100644 --- a/src/debugger/gui/RamWidget.cxx +++ b/src/debugger/gui/RamWidget.cxx @@ -115,18 +115,18 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n // Add Binary display of selected RAM cell xpos = x + w - 13*myFontWidth - 20; - new StaticTextWidget(boss, lfont, xpos, ypos, 4*myFontWidth, myFontHeight, + new StaticTextWidget(boss, lfont, xpos, ypos, 3*myFontWidth, myFontHeight, "Bin", kTextAlignLeft); - myBinValue = new DataGridWidget(boss, nfont, xpos + 4*myFontWidth + 5, ypos-2, + myBinValue = new DataGridWidget(boss, nfont, xpos + 3*myFontWidth + 5, ypos-2, 1, 1, 8, 8, Common::Base::F_2); myBinValue->setTarget(this); myBinValue->setID(kRamBinID); // Add Decimal display of selected RAM cell xpos -= 8*myFontWidth + 5 + 20; - new StaticTextWidget(boss, lfont, xpos, ypos, 4*myFontWidth, myFontHeight, + new StaticTextWidget(boss, lfont, xpos, ypos, 3*myFontWidth, myFontHeight, "Dec", kTextAlignLeft); - myDecValue = new DataGridWidget(boss, nfont, xpos + 4*myFontWidth + 5, ypos-2, + myDecValue = new DataGridWidget(boss, nfont, xpos + 3*myFontWidth + 5, ypos-2, 1, 1, 3, 8, Common::Base::F_10); myDecValue->setTarget(this); myDecValue->setID(kRamDecID); @@ -137,9 +137,9 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n // Add Label of selected RAM cell int xpos_r = xpos - 20; xpos = x + 10; - new StaticTextWidget(boss, lfont, xpos, ypos, 6*myFontWidth, myFontHeight, + new StaticTextWidget(boss, lfont, xpos, ypos, 5*myFontWidth, myFontHeight, "Label", kTextAlignLeft); - xpos += 6*myFontWidth + 5; + xpos += 5*myFontWidth + 5; myLabel = new EditTextWidget(boss, nfont, xpos, ypos-2, xpos_r-xpos, myLineHeight); myLabel->setEditable(false, true); diff --git a/src/debugger/gui/RiotWidget.cxx b/src/debugger/gui/RiotWidget.cxx index 95a8be853..d35e6fbfa 100644 --- a/src/debugger/gui/RiotWidget.cxx +++ b/src/debugger/gui/RiotWidget.cxx @@ -48,7 +48,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont, const int fontWidth = lfont.getMaxCharWidth(), fontHeight = lfont.getFontHeight(), lineHeight = lfont.getLineHeight(); - int xpos = 10, ypos = 25, lwidth = 9 * fontWidth, col = 0; + int xpos = 10, ypos = 25, lwidth = 8 * fontWidth, col = 0; StaticTextWidget* t; VariantList items; @@ -73,50 +73,50 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont, bits->setList(off, on); // SWCHA bits in 'poke' mode - CREATE_IO_REGS("SWCHA(W):", mySWCHAWriteBits, kSWCHABitsID, true); + CREATE_IO_REGS("SWCHA(W)", mySWCHAWriteBits, kSWCHABitsID, true); col = xpos + 20; // remember this for adding widgets to the second column // SWACNT bits xpos = 10; ypos += lineHeight + 5; - CREATE_IO_REGS("SWACNT:", mySWACNTBits, kSWACNTBitsID, true); + CREATE_IO_REGS("SWACNT", mySWACNTBits, kSWACNTBitsID, true); // SWCHA bits in 'peek' mode xpos = 10; ypos += lineHeight + 5; - CREATE_IO_REGS("SWCHA(R):", mySWCHAReadBits, 0, false); + CREATE_IO_REGS("SWCHA(R)", mySWCHAReadBits, 0, false); // SWCHB bits in 'poke' mode xpos = 10; ypos += 2 * lineHeight; - CREATE_IO_REGS("SWCHB(W):", mySWCHBWriteBits, kSWCHBBitsID, true); + CREATE_IO_REGS("SWCHB(W)", mySWCHBWriteBits, kSWCHBBitsID, true); // SWBCNT bits xpos = 10; ypos += lineHeight + 5; - CREATE_IO_REGS("SWBCNT:", mySWBCNTBits, kSWBCNTBitsID, true); + CREATE_IO_REGS("SWBCNT", mySWBCNTBits, kSWBCNTBitsID, true); // SWCHB bits in 'peek' mode xpos = 10; ypos += lineHeight + 5; - CREATE_IO_REGS("SWCHB(R):", mySWCHBReadBits, 0, false); + CREATE_IO_REGS("SWCHB(R)", mySWCHBReadBits, 0, false); // Timer registers (R/W) - const char* writeNames[] = { "TIM1T:", "TIM8T:", "TIM64T:", "T1024T:" }; + const char* writeNames[] = { "TIM1T", "TIM8T", "TIM64T", "T1024T" }; xpos = 10; ypos += 2*lineHeight; for(int row = 0; row < 4; ++row) { t = new StaticTextWidget(boss, lfont, xpos, ypos + row*lineHeight + 2, - 9*fontWidth, fontHeight, writeNames[row], kTextAlignLeft); + lwidth, fontHeight, writeNames[row], kTextAlignLeft); } - xpos += 9*fontWidth + 5; + xpos += t->getWidth() + 5; myTimWrite = new DataGridWidget(boss, nfont, xpos, ypos, 1, 4, 2, 8, Common::Base::F_16); myTimWrite->setTarget(this); myTimWrite->setID(kTimWriteID); addFocusWidget(myTimWrite); // Timer registers (RO) - const char* readNames[] = { "INTIM:", "TIMINT:", "Total Clks:", "INTIM Clks:" }; + const char* readNames[] = { "INTIM", "TIMINT", "Total Clks", "INTIM Clks" }; xpos = 10; ypos += myTimWrite->getHeight() + lineHeight; for(int row = 0; row < 4; ++row) { t = new StaticTextWidget(boss, lfont, xpos, ypos + row*lineHeight + 2, - 11*fontWidth, fontHeight, readNames[row], kTextAlignLeft); + 10*fontWidth, fontHeight, readNames[row], kTextAlignLeft); } xpos += t->getWidth() + 5; myTimRead = new DataGridWidget(boss, nfont, xpos, ypos, 1, 4, 8, 32, Common::Base::F_16); @@ -133,27 +133,27 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont, riot.controller(Controller::Right)); // TIA INPTx registers (R), left port - const char* contLeftReadNames[] = { "INPT0:", "INPT1:", "INPT4:" }; + const char* contLeftReadNames[] = { "INPT0", "INPT1", "INPT4" }; xpos = col; ypos += myLeftControl->getHeight() + 2 * lineHeight; for(int row = 0; row < 3; ++row) { new StaticTextWidget(boss, lfont, xpos, ypos + row*lineHeight + 2, - 6*fontWidth, fontHeight, contLeftReadNames[row], kTextAlignLeft); + 5*fontWidth, fontHeight, contLeftReadNames[row], kTextAlignLeft); } - xpos += 6*fontWidth + 5; + xpos += 5*fontWidth + 5; myLeftINPT = new DataGridWidget(boss, nfont, xpos, ypos, 1, 3, 2, 8, Common::Base::F_16); myLeftINPT->setTarget(this); myLeftINPT->setEditable(false); // TIA INPTx registers (R), right port - const char* contRightReadNames[] = { "INPT2:", "INPT3:", "INPT5:" }; + const char* contRightReadNames[] = { "INPT2", "INPT3", "INPT5" }; xpos = col + myLeftControl->getWidth() + 15; for(int row = 0; row < 3; ++row) { new StaticTextWidget(boss, lfont, xpos, ypos + row*lineHeight + 2, - 6*fontWidth, fontHeight, contRightReadNames[row], kTextAlignLeft); + 5*fontWidth, fontHeight, contRightReadNames[row], kTextAlignLeft); } - xpos += 6*fontWidth + 5; + xpos += 5*fontWidth + 5; myRightINPT = new DataGridWidget(boss, nfont, xpos, ypos, 1, 3, 2, 8, Common::Base::F_16); myRightINPT->setTarget(this); myRightINPT->setEditable(false); @@ -170,19 +170,19 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont, // PO & P1 difficulty switches int pwidth = lfont.getStringWidth("B/easy"); - lwidth = lfont.getStringWidth("P0 Diff: "); + lwidth = lfont.getStringWidth("P0 Diff "); xpos = col; ypos += 2 * lineHeight; int col2_ypos = ypos; items.clear(); VarList::push_back(items, "B/easy", "b"); VarList::push_back(items, "A/hard", "a"); myP0Diff = new PopUpWidget(boss, lfont, xpos, ypos, pwidth, lineHeight, items, - "P0 Diff: ", lwidth, kP0DiffChanged); + "P0 Diff ", lwidth, kP0DiffChanged); myP0Diff->setTarget(this); addFocusWidget(myP0Diff); ypos += myP0Diff->getHeight() + 5; myP1Diff = new PopUpWidget(boss, lfont, xpos, ypos, pwidth, lineHeight, items, - "P1 Diff: ", lwidth, kP1DiffChanged); + "P1 Diff ", lwidth, kP1DiffChanged); myP1Diff->setTarget(this); addFocusWidget(myP1Diff); @@ -192,7 +192,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont, VarList::push_back(items, "B&W", "bw"); VarList::push_back(items, "Color", "color"); myTVType = new PopUpWidget(boss, lfont, xpos, ypos, pwidth, lineHeight, items, - "TV Type: ", lwidth, kTVTypeChanged); + "TV Type ", lwidth, kTVTypeChanged); myTVType->setTarget(this); addFocusWidget(myTVType); @@ -436,23 +436,33 @@ ControllerWidget* RiotWidget::addControlWidget(GuiObject* boss, const GUI::Font& { switch(controller.type()) { - case Controller::Joystick: - return new JoystickWidget(boss, font, x, y, controller); - case Controller::Paddles: - return new PaddleWidget(boss, font, x, y, controller); + case Controller::AmigaMouse: // TODO - implement this + return new NullControlWidget(boss, font, x, y, controller); + case Controller::AtariMouse: // TODO - implement this + return new NullControlWidget(boss, font, x, y, controller); + case Controller::AtariVox: + return new AtariVoxWidget(boss, font, x, y, controller); case Controller::BoosterGrip: return new BoosterWidget(boss, font, x, y, controller); + case Controller::CompuMate: // TODO - implement this + return new NullControlWidget(boss, font, x, y, controller); case Controller::Driving: return new DrivingWidget(boss, font, x, y, controller); case Controller::Genesis: return new GenesisWidget(boss, font, x, y, controller); + case Controller::Joystick: + return new JoystickWidget(boss, font, x, y, controller); case Controller::Keyboard: return new KeyboardWidget(boss, font, x, y, controller); - case Controller::AtariVox: - return new AtariVoxWidget(boss, font, x, y, controller); + case Controller::KidVid: // TODO - implement this + return new NullControlWidget(boss, font, x, y, controller); + case Controller::MindLink: // TODO - implement this + return new NullControlWidget(boss, font, x, y, controller); + case Controller::Paddles: + return new PaddleWidget(boss, font, x, y, controller); case Controller::SaveKey: return new SaveKeyWidget(boss, font, x, y, controller); - default: + case Controller::TrakBall: // TODO - implement this return new NullControlWidget(boss, font, x, y, controller); } } diff --git a/src/debugger/gui/SaveKeyWidget.cxx b/src/debugger/gui/SaveKeyWidget.cxx index 8988cc8c9..02e903022 100644 --- a/src/debugger/gui/SaveKeyWidget.cxx +++ b/src/debugger/gui/SaveKeyWidget.cxx @@ -25,15 +25,14 @@ SaveKeyWidget::SaveKeyWidget(GuiObject* boss, const GUI::Font& font, : ControllerWidget(boss, font, x, y, controller) { bool leftport = myController.jack() == Controller::Left; - const string& label = leftport ? "Left (SaveKey):" : "Right (SaveKey):"; + const string& label = leftport ? "Left (SaveKey)" : "Right (SaveKey)"; - const int fontWidth = font.getMaxCharWidth(), - fontHeight = font.getFontHeight(), + const int fontHeight = font.getFontHeight(), lineHeight = font.getLineHeight(), bwidth = font.getStringWidth("Erase EEPROM") + 20, bheight = lineHeight + 4; - int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (SaveKey):"); + int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (SaveKey)"); StaticTextWidget* t; t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, @@ -46,16 +45,18 @@ SaveKeyWidget::SaveKeyWidget(GuiObject* boss, const GUI::Font& font, myEEPROMErase->setTarget(this); ypos += lineHeight + 20; - new StaticTextWidget(boss, font, xpos, ypos, fontWidth*22, + const GUI::Font& ifont = instance().frameBuffer().infoFont(); + lwidth = ifont.getMaxCharWidth() * 20; + new StaticTextWidget(boss, ifont, xpos, ypos, lwidth, fontHeight, "(*) This will erase", kTextAlignLeft); ypos += lineHeight + 2; - new StaticTextWidget(boss, font, xpos, ypos, fontWidth*22, + new StaticTextWidget(boss, ifont, xpos, ypos, lwidth, fontHeight, "all EEPROM data, not", kTextAlignLeft); ypos += lineHeight + 2; - new StaticTextWidget(boss, font, xpos, ypos, fontWidth*22, + new StaticTextWidget(boss, ifont, xpos, ypos, lwidth, fontHeight, "just the range used", kTextAlignLeft); ypos += lineHeight + 2; - new StaticTextWidget(boss, font, xpos, ypos, fontWidth*22, + new StaticTextWidget(boss, ifont, xpos, ypos, lwidth, fontHeight, "for this ROM", kTextAlignLeft); } diff --git a/src/emucore/Control.hxx b/src/emucore/Control.hxx index 0c6263d48..7645f7693 100644 --- a/src/emucore/Control.hxx +++ b/src/emucore/Control.hxx @@ -87,9 +87,9 @@ class Controller : public Serializable */ enum Type { - BoosterGrip, Driving, Keyboard, Paddles, Joystick, - AmigaMouse, AtariMouse, TrakBall, AtariVox, SaveKey, - KidVid, Genesis, MindLink, CompuMate + AmigaMouse, AtariMouse, AtariVox, BoosterGrip, CompuMate, + Driving, Genesis, Joystick, Keyboard, KidVid, MindLink, + Paddles, SaveKey, TrakBall }; public: diff --git a/src/emucore/Paddles.cxx b/src/emucore/Paddles.cxx index 52b0b33d6..106f93715 100644 --- a/src/emucore/Paddles.cxx +++ b/src/emucore/Paddles.cxx @@ -260,12 +260,12 @@ void Paddles::update() int sa_yaxis = myEvent.get(myP1AxisValue); if(abs(myLastAxisX - sa_xaxis) > 10) { - myAnalogPinValue[Nine] = Int32(1400000 * ((32767 - Int16(sa_xaxis)) / 65536.0)); + myAnalogPinValue[Nine] = Int32(MAX_RESISTANCE * ((32767 - Int16(sa_xaxis)) / 65536.0)); sa_changed = true; } if(abs(myLastAxisY - sa_yaxis) > 10) { - myAnalogPinValue[Five] = Int32(1400000 * ((32767 - Int16(sa_yaxis)) / 65536.0)); + myAnalogPinValue[Five] = Int32(MAX_RESISTANCE * ((32767 - Int16(sa_yaxis)) / 65536.0)); sa_changed = true; } myLastAxisX = sa_xaxis; @@ -353,10 +353,10 @@ void Paddles::update() // Only change state if the charge has actually changed if(myCharge[1] != myLastCharge[1]) myAnalogPinValue[Five] = - Int32(1400000 * (myCharge[1] / float(TRIGMAX))); + Int32(MAX_RESISTANCE * (myCharge[1] / float(TRIGMAX))); if(myCharge[0] != myLastCharge[0]) myAnalogPinValue[Nine] = - Int32(1400000 * (myCharge[0] / float(TRIGMAX))); + Int32(MAX_RESISTANCE * (myCharge[0] / float(TRIGMAX))); myLastCharge[1] = myCharge[1]; myLastCharge[0] = myCharge[0]; diff --git a/src/emucore/Paddles.hxx b/src/emucore/Paddles.hxx index 31f716565..3d126381c 100644 --- a/src/emucore/Paddles.hxx +++ b/src/emucore/Paddles.hxx @@ -104,6 +104,8 @@ class Paddles : public Controller */ static void setPaddleRange(int range); + static constexpr double MAX_RESISTANCE = 1400000.0; + private: // Pre-compute the events we care about based on given port // This will eliminate test for left or right port in update() diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index fefd711ea..47c96fc70 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -19,6 +19,7 @@ #include "M6502.hxx" #include "Console.hxx" #include "Control.hxx" +#include "Paddles.hxx" #ifdef DEBUGGER_SUPPORT #include "CartDebug.hxx" @@ -1326,8 +1327,6 @@ void TIA::delayedWrite(uInt8 address, uInt8 value) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TIA::updatePaddle(uInt8 idx) { - static constexpr double MAX_RESISTANCE = 1400000; - Int32 resistance; switch (idx) { case 0: @@ -1351,7 +1350,7 @@ void TIA::updatePaddle(uInt8 idx) } myPaddleReaders[idx].update( - (resistance == Controller::maximumResistance ? -1 : double(resistance)) / MAX_RESISTANCE, + (resistance == Controller::maximumResistance ? -1 : double(resistance)) / Paddles::MAX_RESISTANCE, myTimestamp, myFrameManager.layout() ); diff --git a/src/emucore/tia/TIA.hxx b/src/emucore/tia/TIA.hxx index 061f426c0..4227dcd28 100644 --- a/src/emucore/tia/TIA.hxx +++ b/src/emucore/tia/TIA.hxx @@ -52,7 +52,6 @@ class TIA : public Device { public: - enum DummyRegisters: uInt8 { shuffleP0 = 0xF0, shuffleP1 = 0xF1,