diff --git a/src/emucore/PlusROM.cxx b/src/emucore/PlusROM.cxx index a4dcc890a..4bbec15f4 100644 --- a/src/emucore/PlusROM.cxx +++ b/src/emucore/PlusROM.cxx @@ -326,7 +326,7 @@ void PlusROM::send() { #if defined(HTTP_LIB_SUPPORT) if (myPendingRequests.size() >= MAX_CONCURRENT_REQUESTS) { - // Try to make room by cosuming any requests that have completed. + // Try to make room by consuming any requests that have completed. receive(); } diff --git a/src/gui/InputDialog.cxx b/src/gui/InputDialog.cxx index 8d75d4e4f..25adb16ab 100644 --- a/src/gui/InputDialog.cxx +++ b/src/gui/InputDialog.cxx @@ -54,7 +54,7 @@ InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent, // Set real dimensions setSize(48 * fontWidth + PopUpWidget::dropDownWidth(_font) + HBORDER * 2, - _th + VGAP * 3 + lineHeight + 13 * (lineHeight + VGAP) + VGAP * 8 + buttonHeight + VBORDER * 3, + _th + VGAP * 3 + lineHeight + 13 * (lineHeight + VGAP) + VGAP * 9 + buttonHeight + VBORDER * 3, max_w, max_h); // The tab widget @@ -115,26 +115,48 @@ void InputDialog::addDevicePortTab() lwidth = _font.getStringWidth("Digital paddle sensitivity "); // Add joystick deadzone setting - myDeadzone = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight, - "Joystick deadzone size", lwidth, kDeadzoneChanged, 5 * fontWidth); - myDeadzone->setMinValue(Joystick::DEAD_ZONE_MIN); - myDeadzone->setMaxValue(Joystick::DEAD_ZONE_MAX); - myDeadzone->setTickmarkIntervals(4); - wid.push_back(myDeadzone); + myJoystickDeadzone = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight, + "Joystick deadzone size", lwidth, kJDeadzoneChanged, 5 * fontWidth); + myJoystickDeadzone->setMinValue(Joystick::DEAD_ZONE_MIN); + myJoystickDeadzone->setMaxValue(Joystick::DEAD_ZONE_MAX); + myJoystickDeadzone->setTickmarkIntervals(4); + wid.push_back(myJoystickDeadzone); - xpos = HBORDER; ypos += lineHeight + VGAP * 3; + xpos = HBORDER; ypos += lineHeight + VGAP * (3 - 2); new StaticTextWidget(myTab, _font, xpos, ypos+1, "Analog paddle:"); xpos += fontWidth * 2; - // Add analog paddle sensitivity + // Add analog paddle deadzone ypos += lineHeight; + myPaddleDeadzone = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight, + "Deadzone size", + lwidth - fontWidth * 2, 0, 5 * fontWidth); + myPaddleDeadzone->setMinValue(Paddles::MIN_ANALOG_DEADZONE); + myPaddleDeadzone->setMaxValue(Paddles::MAX_ANALOG_DEADZONE); + myPaddleDeadzone->setStepValue(500); + myPaddleDeadzone->setTickmarkIntervals(3); + wid.push_back(myPaddleDeadzone); + + // Add analog paddle sensitivity + ypos += lineHeight + VGAP; myPaddleSpeed = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight, - "Sensitivity", - lwidth - fontWidth * 2, kPSpeedChanged, 4 * fontWidth, "%"); - myPaddleSpeed->setMinValue(0); myPaddleSpeed->setMaxValue(Paddles::MAX_ANALOG_SENSE); + "Sensitivity", + lwidth - fontWidth * 2, kPSpeedChanged, 4 * fontWidth, "%"); + myPaddleSpeed->setMinValue(0); + myPaddleSpeed->setMaxValue(Paddles::MAX_ANALOG_SENSE); myPaddleSpeed->setTickmarkIntervals(3); wid.push_back(myPaddleSpeed); + // Add analog paddle acceleration + ypos += lineHeight + VGAP; + myPaddleAccel = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight, + "Acceleration", + lwidth - fontWidth * 2, kPAccelChanged, 4 * fontWidth); + myPaddleAccel->setMinValue(Paddles::MIN_ANALOG_ACCEL); + myPaddleAccel->setMaxValue(Paddles::MAX_ANALOG_ACCEL); + myPaddleAccel->setStepValue(5); + myPaddleAccel->setTickmarkIntervals(4); + wid.push_back(myPaddleAccel); // Add dejitter (analog paddles) ypos += lineHeight + VGAP; @@ -160,7 +182,7 @@ void InputDialog::addDevicePortTab() wid.push_back(myDejitterDiff); // Add paddle speed (digital emulation) - ypos += lineHeight + VGAP * 3; + ypos += lineHeight + VGAP * (3 - 2); myDPaddleSpeed = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight, "Digital paddle sensitivity", lwidth, kDPSpeedChanged, 4 * fontWidth, "%"); @@ -168,7 +190,7 @@ void InputDialog::addDevicePortTab() myDPaddleSpeed->setTickmarkIntervals(4); wid.push_back(myDPaddleSpeed); - ypos += lineHeight + VGAP * 3; + ypos += lineHeight + VGAP * (3 - 2); myAutoFireRate = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight, "Autofire rate", lwidth, kAutoFireChanged, 5 * fontWidth, "Hz"); @@ -177,7 +199,7 @@ void InputDialog::addDevicePortTab() wid.push_back(myAutoFireRate); // Add 'allow all 4 directions' for joystick - ypos += lineHeight + VGAP * 4; + ypos += lineHeight + VGAP * (4 - 2); myAllowAll4 = new CheckboxWidget(myTab, _font, HBORDER, ypos, "Allow all 4 directions on joystick"); wid.push_back(myAllowAll4); @@ -197,7 +219,7 @@ void InputDialog::addDevicePortTab() int fwidth; // Add EEPROM erase (part 1/2) - ypos += VGAP * 3; + ypos += VGAP * (3 - 1); fwidth = _font.getStringWidth("AtariVox/SaveKey"); new StaticTextWidget(myTab, _font, _w - HBORDER - 2 - fwidth, ypos, "AtariVox/SaveKey"); @@ -338,10 +360,14 @@ void InputDialog::loadConfig() handleCursorState(); // Joystick deadzone - myDeadzone->setValue(settings.getInt("joydeadzone")); + myJoystickDeadzone->setValue(settings.getInt("joydeadzone")); + // Paddle deadzone (analog) + myPaddleDeadzone->setValue(settings.getInt("pdeadzone")); // Paddle speed (analog) myPaddleSpeed->setValue(settings.getInt("psense")); + // Paddle acceleration (analog) + myPaddleAccel->setValue(settings.getInt("paccel")); // Paddle dejitter (analog) myDejitterBase->setValue(settings.getInt("dejitter.base")); myDejitterDiff->setValue(settings.getInt("dejitter.diff")); @@ -404,16 +430,24 @@ void InputDialog::saveConfig() // *** Device & Ports *** // Joystick deadzone - int deadzone = myDeadzone->getValue(); + int deadzone = myJoystickDeadzone->getValue(); settings.setValue("joydeadzone", deadzone); Joystick::setDeadZone(deadzone); + // Paddle deadzone (analog) + deadzone = myPaddleDeadzone->getValue(); + settings.setValue("pdeadzone", deadzone); + Paddles::setAnalogDeadzone(deadzone); // Paddle speed (analog) int sensitivity = myPaddleSpeed->getValue(); settings.setValue("psense", sensitivity); Paddles::setAnalogSensitivity(sensitivity); + // Paddle acceleration (analog) + int accel = myPaddleAccel->getValue(); + settings.setValue("paccel", accel); + Paddles::setAnalogAccel(accel); - // Paddle speed (digital and mouse) + // Paddle dejitter (analog) int dejitter = myDejitterBase->getValue(); settings.setValue("dejitter.base", dejitter); Paddles::setDejitterBase(dejitter); @@ -491,10 +525,16 @@ void InputDialog::setDefaults() case 1: // Devices & Ports // Joystick deadzone - myDeadzone->setValue(0); + myJoystickDeadzone->setValue(0); + + // Paddle deadzone + myPaddleDeadzone->setValue(0); // Paddle speed (analog) myPaddleSpeed->setValue(20); + + // Paddle acceleration + myPaddleAccel->setValue(0); #if defined(RETRON77) myDejitterBase->setValue(2); myDejitterDiff->setValue(6); @@ -653,8 +693,8 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd, setDefaults(); break; - case kDeadzoneChanged: - myDeadzone->setValueLabel(Joystick::deadZoneValue(myDeadzone->getValue())); + case kJDeadzoneChanged: + myJoystickDeadzone->setValueLabel(Joystick::deadZoneValue(myJoystickDeadzone->getValue())); break; case kPSpeedChanged: @@ -662,6 +702,10 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd, myPaddleSpeed->getValue()) * 100.F)); break; + case kPAccelChanged: + updatePaddleAccel(); + break; + case kDejitterAvChanged: updateDejitterAveraging(); break; @@ -737,6 +781,13 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd, } } +void InputDialog::updatePaddleAccel() +{ + int strength = myPaddleAccel->getValue(); + + myPaddleAccel->setValueLabel(strength ? std::to_string(strength) + "%" : "Off"); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void InputDialog::updateDejitterAveraging() { diff --git a/src/gui/InputDialog.hxx b/src/gui/InputDialog.hxx index e2faeca0f..6b75eb80a 100644 --- a/src/gui/InputDialog.hxx +++ b/src/gui/InputDialog.hxx @@ -64,6 +64,7 @@ class InputDialog : public Dialog void handleMouseControlState(); void handleCursorState(); + void updatePaddleAccel(); void updateDejitterAveraging(); void updateDejitterReaction(); void updateAutoFireRate(); @@ -71,8 +72,9 @@ class InputDialog : public Dialog private: enum { - kDeadzoneChanged = 'DZch', + kJDeadzoneChanged = 'DZch', kPSpeedChanged = 'Ppch', + kPAccelChanged = 'PAch', kDejitterAvChanged = 'JAch', kDejitterReChanged = 'JRch', kDPSpeedChanged = 'PDch', @@ -96,8 +98,10 @@ class InputDialog : public Dialog PopUpWidget* myAVoxPort{nullptr}; - SliderWidget* myDeadzone{nullptr}; + SliderWidget* myJoystickDeadzone{nullptr}; SliderWidget* myPaddleSpeed{nullptr}; + SliderWidget* myPaddleDeadzone{nullptr}; + SliderWidget* myPaddleAccel{nullptr}; SliderWidget* myDejitterBase{nullptr}; SliderWidget* myDejitterDiff{nullptr}; SliderWidget* myDPaddleSpeed{nullptr}; diff --git a/src/gui/PlusRomsSetupDialog.cxx b/src/gui/PlusRomsSetupDialog.cxx index 5da2e55df..0d112b124 100644 --- a/src/gui/PlusRomsSetupDialog.cxx +++ b/src/gui/PlusRomsSetupDialog.cxx @@ -20,9 +20,7 @@ #include "PlusRomsSetupDialog.hxx" -static const int MIN_NICK_LEN = 2; static const int MAX_NICK_LEN = 16; -static const char* MIN_NICK_LEN_STR = "Two"; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PlusRomsSetupDialog::PlusRomsSetupDialog(OSystem& osystem, DialogContainer& parent, @@ -33,7 +31,8 @@ PlusRomsSetupDialog::PlusRomsSetupDialog(OSystem& osystem, DialogContainer& pare return isalnum(c) || (c == '_'); }; - setTextFilter(filter, 0); + setTextFilter(filter); + setToolTip("Enter your PlusCart High Score Club nickname here."); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -46,6 +45,9 @@ void PlusRomsSetupDialog::loadConfig() void PlusRomsSetupDialog::saveConfig() { instance().settings().setValue("plusroms.nick", getResult(0)); + if(instance().settings().getString("plusroms.id") == EmptyString) + instance().settings().setValue("plusroms.id", "12345678901234567890123456789012"); // TODO: generate in PlusROM class + // Note: The user can cancel, so the existance of an ID must be checked (and generated if not existing) when transmitting scores } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -56,13 +58,8 @@ void PlusRomsSetupDialog::handleCommand(CommandSender* sender, int cmd, { case GuiObject::kOKCmd: case EditableWidget::kAcceptCmd: - if(getResult(0).length() >= MIN_NICK_LEN) - { - saveConfig(); - instance().eventHandler().leaveMenuMode(); - } - else - setMessage(MIN_NICK_LEN_STR + string(" characters minimum")); + saveConfig(); + instance().eventHandler().leaveMenuMode(); break; case kCloseCmd: