mirror of https://github.com/stella-emu/stella.git
some work on PlusROMs support
This commit is contained in:
parent
d4d34faf53
commit
d809a4983d
|
@ -326,7 +326,7 @@ void PlusROM::send()
|
||||||
{
|
{
|
||||||
#if defined(HTTP_LIB_SUPPORT)
|
#if defined(HTTP_LIB_SUPPORT)
|
||||||
if (myPendingRequests.size() >= MAX_CONCURRENT_REQUESTS) {
|
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();
|
receive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
|
|
||||||
// Set real dimensions
|
// Set real dimensions
|
||||||
setSize(48 * fontWidth + PopUpWidget::dropDownWidth(_font) + HBORDER * 2,
|
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);
|
max_w, max_h);
|
||||||
|
|
||||||
// The tab widget
|
// The tab widget
|
||||||
|
@ -115,26 +115,48 @@ void InputDialog::addDevicePortTab()
|
||||||
lwidth = _font.getStringWidth("Digital paddle sensitivity ");
|
lwidth = _font.getStringWidth("Digital paddle sensitivity ");
|
||||||
|
|
||||||
// Add joystick deadzone setting
|
// Add joystick deadzone setting
|
||||||
myDeadzone = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight,
|
myJoystickDeadzone = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight,
|
||||||
"Joystick deadzone size", lwidth, kDeadzoneChanged, 5 * fontWidth);
|
"Joystick deadzone size", lwidth, kJDeadzoneChanged, 5 * fontWidth);
|
||||||
myDeadzone->setMinValue(Joystick::DEAD_ZONE_MIN);
|
myJoystickDeadzone->setMinValue(Joystick::DEAD_ZONE_MIN);
|
||||||
myDeadzone->setMaxValue(Joystick::DEAD_ZONE_MAX);
|
myJoystickDeadzone->setMaxValue(Joystick::DEAD_ZONE_MAX);
|
||||||
myDeadzone->setTickmarkIntervals(4);
|
myJoystickDeadzone->setTickmarkIntervals(4);
|
||||||
wid.push_back(myDeadzone);
|
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:");
|
new StaticTextWidget(myTab, _font, xpos, ypos+1, "Analog paddle:");
|
||||||
xpos += fontWidth * 2;
|
xpos += fontWidth * 2;
|
||||||
|
|
||||||
// Add analog paddle sensitivity
|
// Add analog paddle deadzone
|
||||||
ypos += lineHeight;
|
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,
|
myPaddleSpeed = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
||||||
"Sensitivity",
|
"Sensitivity",
|
||||||
lwidth - fontWidth * 2, kPSpeedChanged, 4 * fontWidth, "%");
|
lwidth - fontWidth * 2, kPSpeedChanged, 4 * fontWidth, "%");
|
||||||
myPaddleSpeed->setMinValue(0); myPaddleSpeed->setMaxValue(Paddles::MAX_ANALOG_SENSE);
|
myPaddleSpeed->setMinValue(0);
|
||||||
|
myPaddleSpeed->setMaxValue(Paddles::MAX_ANALOG_SENSE);
|
||||||
myPaddleSpeed->setTickmarkIntervals(3);
|
myPaddleSpeed->setTickmarkIntervals(3);
|
||||||
wid.push_back(myPaddleSpeed);
|
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)
|
// Add dejitter (analog paddles)
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
@ -160,7 +182,7 @@ void InputDialog::addDevicePortTab()
|
||||||
wid.push_back(myDejitterDiff);
|
wid.push_back(myDejitterDiff);
|
||||||
|
|
||||||
// Add paddle speed (digital emulation)
|
// 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,
|
myDPaddleSpeed = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight,
|
||||||
"Digital paddle sensitivity",
|
"Digital paddle sensitivity",
|
||||||
lwidth, kDPSpeedChanged, 4 * fontWidth, "%");
|
lwidth, kDPSpeedChanged, 4 * fontWidth, "%");
|
||||||
|
@ -168,7 +190,7 @@ void InputDialog::addDevicePortTab()
|
||||||
myDPaddleSpeed->setTickmarkIntervals(4);
|
myDPaddleSpeed->setTickmarkIntervals(4);
|
||||||
wid.push_back(myDPaddleSpeed);
|
wid.push_back(myDPaddleSpeed);
|
||||||
|
|
||||||
ypos += lineHeight + VGAP * 3;
|
ypos += lineHeight + VGAP * (3 - 2);
|
||||||
myAutoFireRate = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight,
|
myAutoFireRate = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight,
|
||||||
"Autofire rate",
|
"Autofire rate",
|
||||||
lwidth, kAutoFireChanged, 5 * fontWidth, "Hz");
|
lwidth, kAutoFireChanged, 5 * fontWidth, "Hz");
|
||||||
|
@ -177,7 +199,7 @@ void InputDialog::addDevicePortTab()
|
||||||
wid.push_back(myAutoFireRate);
|
wid.push_back(myAutoFireRate);
|
||||||
|
|
||||||
// Add 'allow all 4 directions' for joystick
|
// Add 'allow all 4 directions' for joystick
|
||||||
ypos += lineHeight + VGAP * 4;
|
ypos += lineHeight + VGAP * (4 - 2);
|
||||||
myAllowAll4 = new CheckboxWidget(myTab, _font, HBORDER, ypos,
|
myAllowAll4 = new CheckboxWidget(myTab, _font, HBORDER, ypos,
|
||||||
"Allow all 4 directions on joystick");
|
"Allow all 4 directions on joystick");
|
||||||
wid.push_back(myAllowAll4);
|
wid.push_back(myAllowAll4);
|
||||||
|
@ -197,7 +219,7 @@ void InputDialog::addDevicePortTab()
|
||||||
int fwidth;
|
int fwidth;
|
||||||
|
|
||||||
// Add EEPROM erase (part 1/2)
|
// Add EEPROM erase (part 1/2)
|
||||||
ypos += VGAP * 3;
|
ypos += VGAP * (3 - 1);
|
||||||
fwidth = _font.getStringWidth("AtariVox/SaveKey");
|
fwidth = _font.getStringWidth("AtariVox/SaveKey");
|
||||||
new StaticTextWidget(myTab, _font, _w - HBORDER - 2 - fwidth, ypos,
|
new StaticTextWidget(myTab, _font, _w - HBORDER - 2 - fwidth, ypos,
|
||||||
"AtariVox/SaveKey");
|
"AtariVox/SaveKey");
|
||||||
|
@ -338,10 +360,14 @@ void InputDialog::loadConfig()
|
||||||
handleCursorState();
|
handleCursorState();
|
||||||
|
|
||||||
// Joystick deadzone
|
// Joystick deadzone
|
||||||
myDeadzone->setValue(settings.getInt("joydeadzone"));
|
myJoystickDeadzone->setValue(settings.getInt("joydeadzone"));
|
||||||
|
|
||||||
|
// Paddle deadzone (analog)
|
||||||
|
myPaddleDeadzone->setValue(settings.getInt("pdeadzone"));
|
||||||
// Paddle speed (analog)
|
// Paddle speed (analog)
|
||||||
myPaddleSpeed->setValue(settings.getInt("psense"));
|
myPaddleSpeed->setValue(settings.getInt("psense"));
|
||||||
|
// Paddle acceleration (analog)
|
||||||
|
myPaddleAccel->setValue(settings.getInt("paccel"));
|
||||||
// Paddle dejitter (analog)
|
// Paddle dejitter (analog)
|
||||||
myDejitterBase->setValue(settings.getInt("dejitter.base"));
|
myDejitterBase->setValue(settings.getInt("dejitter.base"));
|
||||||
myDejitterDiff->setValue(settings.getInt("dejitter.diff"));
|
myDejitterDiff->setValue(settings.getInt("dejitter.diff"));
|
||||||
|
@ -404,16 +430,24 @@ void InputDialog::saveConfig()
|
||||||
|
|
||||||
// *** Device & Ports ***
|
// *** Device & Ports ***
|
||||||
// Joystick deadzone
|
// Joystick deadzone
|
||||||
int deadzone = myDeadzone->getValue();
|
int deadzone = myJoystickDeadzone->getValue();
|
||||||
settings.setValue("joydeadzone", deadzone);
|
settings.setValue("joydeadzone", deadzone);
|
||||||
Joystick::setDeadZone(deadzone);
|
Joystick::setDeadZone(deadzone);
|
||||||
|
|
||||||
|
// Paddle deadzone (analog)
|
||||||
|
deadzone = myPaddleDeadzone->getValue();
|
||||||
|
settings.setValue("pdeadzone", deadzone);
|
||||||
|
Paddles::setAnalogDeadzone(deadzone);
|
||||||
// Paddle speed (analog)
|
// Paddle speed (analog)
|
||||||
int sensitivity = myPaddleSpeed->getValue();
|
int sensitivity = myPaddleSpeed->getValue();
|
||||||
settings.setValue("psense", sensitivity);
|
settings.setValue("psense", sensitivity);
|
||||||
Paddles::setAnalogSensitivity(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();
|
int dejitter = myDejitterBase->getValue();
|
||||||
settings.setValue("dejitter.base", dejitter);
|
settings.setValue("dejitter.base", dejitter);
|
||||||
Paddles::setDejitterBase(dejitter);
|
Paddles::setDejitterBase(dejitter);
|
||||||
|
@ -491,10 +525,16 @@ void InputDialog::setDefaults()
|
||||||
|
|
||||||
case 1: // Devices & Ports
|
case 1: // Devices & Ports
|
||||||
// Joystick deadzone
|
// Joystick deadzone
|
||||||
myDeadzone->setValue(0);
|
myJoystickDeadzone->setValue(0);
|
||||||
|
|
||||||
|
// Paddle deadzone
|
||||||
|
myPaddleDeadzone->setValue(0);
|
||||||
|
|
||||||
// Paddle speed (analog)
|
// Paddle speed (analog)
|
||||||
myPaddleSpeed->setValue(20);
|
myPaddleSpeed->setValue(20);
|
||||||
|
|
||||||
|
// Paddle acceleration
|
||||||
|
myPaddleAccel->setValue(0);
|
||||||
#if defined(RETRON77)
|
#if defined(RETRON77)
|
||||||
myDejitterBase->setValue(2);
|
myDejitterBase->setValue(2);
|
||||||
myDejitterDiff->setValue(6);
|
myDejitterDiff->setValue(6);
|
||||||
|
@ -653,8 +693,8 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
setDefaults();
|
setDefaults();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kDeadzoneChanged:
|
case kJDeadzoneChanged:
|
||||||
myDeadzone->setValueLabel(Joystick::deadZoneValue(myDeadzone->getValue()));
|
myJoystickDeadzone->setValueLabel(Joystick::deadZoneValue(myJoystickDeadzone->getValue()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kPSpeedChanged:
|
case kPSpeedChanged:
|
||||||
|
@ -662,6 +702,10 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
myPaddleSpeed->getValue()) * 100.F));
|
myPaddleSpeed->getValue()) * 100.F));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case kPAccelChanged:
|
||||||
|
updatePaddleAccel();
|
||||||
|
break;
|
||||||
|
|
||||||
case kDejitterAvChanged:
|
case kDejitterAvChanged:
|
||||||
updateDejitterAveraging();
|
updateDejitterAveraging();
|
||||||
break;
|
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()
|
void InputDialog::updateDejitterAveraging()
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,6 +64,7 @@ class InputDialog : public Dialog
|
||||||
|
|
||||||
void handleMouseControlState();
|
void handleMouseControlState();
|
||||||
void handleCursorState();
|
void handleCursorState();
|
||||||
|
void updatePaddleAccel();
|
||||||
void updateDejitterAveraging();
|
void updateDejitterAveraging();
|
||||||
void updateDejitterReaction();
|
void updateDejitterReaction();
|
||||||
void updateAutoFireRate();
|
void updateAutoFireRate();
|
||||||
|
@ -71,8 +72,9 @@ class InputDialog : public Dialog
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
kDeadzoneChanged = 'DZch',
|
kJDeadzoneChanged = 'DZch',
|
||||||
kPSpeedChanged = 'Ppch',
|
kPSpeedChanged = 'Ppch',
|
||||||
|
kPAccelChanged = 'PAch',
|
||||||
kDejitterAvChanged = 'JAch',
|
kDejitterAvChanged = 'JAch',
|
||||||
kDejitterReChanged = 'JRch',
|
kDejitterReChanged = 'JRch',
|
||||||
kDPSpeedChanged = 'PDch',
|
kDPSpeedChanged = 'PDch',
|
||||||
|
@ -96,8 +98,10 @@ class InputDialog : public Dialog
|
||||||
|
|
||||||
PopUpWidget* myAVoxPort{nullptr};
|
PopUpWidget* myAVoxPort{nullptr};
|
||||||
|
|
||||||
SliderWidget* myDeadzone{nullptr};
|
SliderWidget* myJoystickDeadzone{nullptr};
|
||||||
SliderWidget* myPaddleSpeed{nullptr};
|
SliderWidget* myPaddleSpeed{nullptr};
|
||||||
|
SliderWidget* myPaddleDeadzone{nullptr};
|
||||||
|
SliderWidget* myPaddleAccel{nullptr};
|
||||||
SliderWidget* myDejitterBase{nullptr};
|
SliderWidget* myDejitterBase{nullptr};
|
||||||
SliderWidget* myDejitterDiff{nullptr};
|
SliderWidget* myDejitterDiff{nullptr};
|
||||||
SliderWidget* myDPaddleSpeed{nullptr};
|
SliderWidget* myDPaddleSpeed{nullptr};
|
||||||
|
|
|
@ -20,9 +20,7 @@
|
||||||
|
|
||||||
#include "PlusRomsSetupDialog.hxx"
|
#include "PlusRomsSetupDialog.hxx"
|
||||||
|
|
||||||
static const int MIN_NICK_LEN = 2;
|
|
||||||
static const int MAX_NICK_LEN = 16;
|
static const int MAX_NICK_LEN = 16;
|
||||||
static const char* MIN_NICK_LEN_STR = "Two";
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
PlusRomsSetupDialog::PlusRomsSetupDialog(OSystem& osystem, DialogContainer& parent,
|
PlusRomsSetupDialog::PlusRomsSetupDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
|
@ -33,7 +31,8 @@ PlusRomsSetupDialog::PlusRomsSetupDialog(OSystem& osystem, DialogContainer& pare
|
||||||
return isalnum(c) || (c == '_');
|
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()
|
void PlusRomsSetupDialog::saveConfig()
|
||||||
{
|
{
|
||||||
instance().settings().setValue("plusroms.nick", getResult(0));
|
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 GuiObject::kOKCmd:
|
||||||
case EditableWidget::kAcceptCmd:
|
case EditableWidget::kAcceptCmd:
|
||||||
if(getResult(0).length() >= MIN_NICK_LEN)
|
saveConfig();
|
||||||
{
|
instance().eventHandler().leaveMenuMode();
|
||||||
saveConfig();
|
|
||||||
instance().eventHandler().leaveMenuMode();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
setMessage(MIN_NICK_LEN_STR + string(" characters minimum"));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kCloseCmd:
|
case kCloseCmd:
|
||||||
|
|
Loading…
Reference in New Issue