mirror of https://github.com/stella-emu/stella.git
split paddle dejitter settings
This commit is contained in:
parent
f619fe33d2
commit
41b990109a
|
@ -98,7 +98,8 @@ void EventHandler::initialize()
|
||||||
setActionMappings(kMenuMode);
|
setActionMappings(kMenuMode);
|
||||||
|
|
||||||
Joystick::setDeadZone(myOSystem.settings().getInt("joydeadzone"));
|
Joystick::setDeadZone(myOSystem.settings().getInt("joydeadzone"));
|
||||||
Paddles::setDejitter(myOSystem.settings().getInt("dejitter"));
|
Paddles::setDejitterBase(myOSystem.settings().getInt("dejitterBase"));
|
||||||
|
Paddles::setDejitterDiff(myOSystem.settings().getInt("dejitterDiff"));
|
||||||
Paddles::setDigitalSensitivity(myOSystem.settings().getInt("dsense"));
|
Paddles::setDigitalSensitivity(myOSystem.settings().getInt("dsense"));
|
||||||
Paddles::setMouseSensitivity(myOSystem.settings().getInt("msense"));
|
Paddles::setMouseSensitivity(myOSystem.settings().getInt("msense"));
|
||||||
PointingDevice::setSensitivity(myOSystem.settings().getInt("tsense"));
|
PointingDevice::setSensitivity(myOSystem.settings().getInt("tsense"));
|
||||||
|
|
|
@ -272,11 +272,11 @@ void Paddles::update()
|
||||||
const double dFac[MAX_DEJITTER - MIN_DEJITTER + 1] = {
|
const double dFac[MAX_DEJITTER - MIN_DEJITTER + 1] = {
|
||||||
// lower values mean more dejitter strength
|
// lower values mean more dejitter strength
|
||||||
1, // off
|
1, // off
|
||||||
1.0 / 45 , 1.0 / 64 , 1.0 / 90 , 1.0 / 128, 1.0 / 181,
|
1.0 / 181, 1.0 / 256, 1.0 / 362, 1.0 / 512, 1.0 / 724,
|
||||||
1.0 / 256, 1.0 / 362, 1.0 / 512, 1.0 / 724, 1.0 / 1024
|
1.0 / 1024, 1.0 / 1448, 1.0 / 2048, 1.0 / 2896, 1.0 / 4096
|
||||||
};
|
};
|
||||||
const double baseFactor = bFac[DEJITTER];
|
const double baseFactor = bFac[DEJITTER_BASE];
|
||||||
const double diffFactor = dFac[DEJITTER];
|
const double diffFactor = dFac[DEJITTER_DIFF];
|
||||||
|
|
||||||
if(abs(myLastAxisX - sa_xaxis) > 10)
|
if(abs(myLastAxisX - sa_xaxis) > 10)
|
||||||
{
|
{
|
||||||
|
@ -423,9 +423,15 @@ bool Paddles::setMouseControl(
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Paddles::setDejitter(int strength)
|
void Paddles::setDejitterBase(int strength)
|
||||||
{
|
{
|
||||||
DEJITTER = BSPF::clamp(strength, MIN_DEJITTER, MAX_DEJITTER);
|
DEJITTER_BASE = BSPF::clamp(strength, MIN_DEJITTER, MAX_DEJITTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Paddles::setDejitterDiff(int strength)
|
||||||
|
{
|
||||||
|
DEJITTER_DIFF = BSPF::clamp(strength, MIN_DEJITTER, MAX_DEJITTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -453,7 +459,8 @@ int Paddles::TRIGRANGE = Paddles::TRIGMAX;
|
||||||
int Paddles::DIGITAL_SENSITIVITY = -1;
|
int Paddles::DIGITAL_SENSITIVITY = -1;
|
||||||
int Paddles::DIGITAL_DISTANCE = -1;
|
int Paddles::DIGITAL_DISTANCE = -1;
|
||||||
int Paddles::MOUSE_SENSITIVITY = -1;
|
int Paddles::MOUSE_SENSITIVITY = -1;
|
||||||
int Paddles::DEJITTER = 0;
|
int Paddles::DEJITTER_BASE = 0;
|
||||||
|
int Paddles::DEJITTER_DIFF = 0;
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
const Controller::DigitalPin Paddles::ourButtonPin[2] = {
|
const Controller::DigitalPin Paddles::ourButtonPin[2] = {
|
||||||
|
|
|
@ -90,9 +90,14 @@ class Paddles : public Controller
|
||||||
Controller::Type ytype, int yid) override;
|
Controller::Type ytype, int yid) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@param strength Value from 0 to 20
|
@param strength Value from 0 to 10
|
||||||
*/
|
*/
|
||||||
static void setDejitter(int strength);
|
static void setDejitterBase(int strength);
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param strength Value from 0 to 10
|
||||||
|
*/
|
||||||
|
static void setDejitterDiff(int strength);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Sets the sensitivity for digital emulation of paddle movement.
|
Sets the sensitivity for digital emulation of paddle movement.
|
||||||
|
@ -153,7 +158,7 @@ class Paddles : public Controller
|
||||||
static int TRIGRANGE; // This one is variable for the upper range
|
static int TRIGRANGE; // This one is variable for the upper range
|
||||||
|
|
||||||
static int DIGITAL_SENSITIVITY, DIGITAL_DISTANCE;
|
static int DIGITAL_SENSITIVITY, DIGITAL_DISTANCE;
|
||||||
static int DEJITTER;
|
static int DEJITTER_BASE, DEJITTER_DIFF;
|
||||||
static int MOUSE_SENSITIVITY;
|
static int MOUSE_SENSITIVITY;
|
||||||
|
|
||||||
// Lookup table for associating paddle buttons with controller pins
|
// Lookup table for associating paddle buttons with controller pins
|
||||||
|
|
|
@ -87,7 +87,8 @@ Settings::Settings()
|
||||||
setPermanent("usemouse", "analog");
|
setPermanent("usemouse", "analog");
|
||||||
setPermanent("grabmouse", "true");
|
setPermanent("grabmouse", "true");
|
||||||
setPermanent("cursor", "2");
|
setPermanent("cursor", "2");
|
||||||
setPermanent("dejitter", "0");
|
setPermanent("dejitterBase", "0");
|
||||||
|
setPermanent("dejitterDiff", "0");
|
||||||
setPermanent("dsense", "10");
|
setPermanent("dsense", "10");
|
||||||
setPermanent("msense", "10");
|
setPermanent("msense", "10");
|
||||||
setPermanent("tsense", "10");
|
setPermanent("tsense", "10");
|
||||||
|
|
|
@ -143,7 +143,7 @@ void InputDialog::addDevicePortTab(const GUI::Font& font)
|
||||||
|
|
||||||
// Add joystick deadzone setting
|
// Add joystick deadzone setting
|
||||||
ypos += lineHeight + VGAP*3;
|
ypos += lineHeight + VGAP*3;
|
||||||
myDeadzone = new SliderWidget(myTab, font, HBORDER, ypos,
|
myDeadzone = new SliderWidget(myTab, font, HBORDER, ypos, 13 * fontWidth, lineHeight,
|
||||||
"Joystick deadzone size ", lwidth, kDeadzoneChanged);
|
"Joystick deadzone size ", lwidth, kDeadzoneChanged);
|
||||||
myDeadzone->setMinValue(0); myDeadzone->setMaxValue(29);
|
myDeadzone->setMinValue(0); myDeadzone->setMaxValue(29);
|
||||||
myDeadzone->setTickmarkInterval(4);
|
myDeadzone->setTickmarkInterval(4);
|
||||||
|
@ -153,18 +153,25 @@ void InputDialog::addDevicePortTab(const GUI::Font& font)
|
||||||
|
|
||||||
// Add dejitter (Stelladaptor emulation for now only)
|
// Add dejitter (Stelladaptor emulation for now only)
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
myDejitter = new SliderWidget(myTab, font, HBORDER, ypos,
|
myDejitterBase = new SliderWidget(myTab, font, HBORDER, ypos, 6 * fontWidth, lineHeight,
|
||||||
"Paddle dejitter strength",
|
"Paddle dejitter strength", lwidth, kDejitterChanged);
|
||||||
lwidth, kDejitterChanged);
|
myDejitterBase->setMinValue(Paddles::MIN_DEJITTER); myDejitterBase->setMaxValue(Paddles::MAX_DEJITTER);
|
||||||
myDejitter->setMinValue(Paddles::MIN_DEJITTER); myDejitter->setMaxValue(Paddles::MAX_DEJITTER);
|
myDejitterBase->setTickmarkInterval(2);
|
||||||
myDejitter->setTickmarkInterval(4);
|
xpos = HBORDER + myDejitterBase->getWidth() + fontWidth;
|
||||||
xpos = HBORDER + myDejitter->getWidth() + 5;
|
wid.push_back(myDejitterBase);
|
||||||
myDejitterLabel = new StaticTextWidget(myTab, font, xpos, ypos + 1, 24, lineHeight, "");
|
|
||||||
wid.push_back(myDejitter);
|
myDejitterDiff = new SliderWidget(myTab, font, xpos, ypos, 6 * fontWidth, lineHeight,
|
||||||
|
"", 0, kDejitterChanged);
|
||||||
|
myDejitterDiff->setMinValue(Paddles::MIN_DEJITTER); myDejitterDiff->setMaxValue(Paddles::MAX_DEJITTER);
|
||||||
|
myDejitterDiff->setTickmarkInterval(2);
|
||||||
|
xpos += myDejitterDiff->getWidth() + 5;
|
||||||
|
wid.push_back(myDejitterDiff);
|
||||||
|
|
||||||
|
myDejitterLabel = new StaticTextWidget(myTab, font, xpos, ypos + 1, 7 * fontWidth, lineHeight, "");
|
||||||
|
|
||||||
// Add paddle speed (digital emulation)
|
// Add paddle speed (digital emulation)
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
myDPaddleSpeed = new SliderWidget(myTab, font, HBORDER, ypos,
|
myDPaddleSpeed = new SliderWidget(myTab, font, HBORDER, ypos, 13 * fontWidth, lineHeight,
|
||||||
"Digital paddle sensitivity ",
|
"Digital paddle sensitivity ",
|
||||||
lwidth, kDPSpeedChanged);
|
lwidth, kDPSpeedChanged);
|
||||||
myDPaddleSpeed->setMinValue(1); myDPaddleSpeed->setMaxValue(20);
|
myDPaddleSpeed->setMinValue(1); myDPaddleSpeed->setMaxValue(20);
|
||||||
|
@ -175,7 +182,7 @@ void InputDialog::addDevicePortTab(const GUI::Font& font)
|
||||||
|
|
||||||
// Add paddle speed (mouse emulation)
|
// Add paddle speed (mouse emulation)
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
myMPaddleSpeed = new SliderWidget(myTab, font, HBORDER, ypos,
|
myMPaddleSpeed = new SliderWidget(myTab, font, HBORDER, ypos, 13 * fontWidth, lineHeight,
|
||||||
"Mouse paddle sensitivity ",
|
"Mouse paddle sensitivity ",
|
||||||
lwidth, kMPSpeedChanged);
|
lwidth, kMPSpeedChanged);
|
||||||
myMPaddleSpeed->setMinValue(1); myMPaddleSpeed->setMaxValue(20);
|
myMPaddleSpeed->setMinValue(1); myMPaddleSpeed->setMaxValue(20);
|
||||||
|
@ -186,7 +193,7 @@ void InputDialog::addDevicePortTab(const GUI::Font& font)
|
||||||
|
|
||||||
// Add trackball speed
|
// Add trackball speed
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
myTrackBallSpeed = new SliderWidget(myTab, font, HBORDER, ypos,
|
myTrackBallSpeed = new SliderWidget(myTab, font, HBORDER, ypos, 13 * fontWidth, lineHeight,
|
||||||
"Trackball sensitivity ",
|
"Trackball sensitivity ",
|
||||||
lwidth, kTBSpeedChanged);
|
lwidth, kTBSpeedChanged);
|
||||||
myTrackBallSpeed->setMinValue(1); myTrackBallSpeed->setMaxValue(20);
|
myTrackBallSpeed->setMinValue(1); myTrackBallSpeed->setMaxValue(20);
|
||||||
|
@ -275,8 +282,9 @@ void InputDialog::loadConfig()
|
||||||
myDeadzoneLabel->setValue(Joystick::deadzone());
|
myDeadzoneLabel->setValue(Joystick::deadzone());
|
||||||
|
|
||||||
// Paddle speed (digital and mouse)
|
// Paddle speed (digital and mouse)
|
||||||
myDejitter->setValue(instance().settings().getInt("dejitter"));
|
myDejitterBase->setValue(instance().settings().getInt("dejitterBase"));
|
||||||
myDejitterLabel->setLabel(instance().settings().getString("dejitter"));
|
myDejitterDiff->setValue(instance().settings().getInt("dejitterDiff"));
|
||||||
|
UpdateDejitter();
|
||||||
myDPaddleSpeed->setValue(instance().settings().getInt("dsense"));
|
myDPaddleSpeed->setValue(instance().settings().getInt("dsense"));
|
||||||
myDPaddleLabel->setLabel(instance().settings().getString("dsense"));
|
myDPaddleLabel->setLabel(instance().settings().getString("dsense"));
|
||||||
myMPaddleSpeed->setValue(instance().settings().getInt("msense"));
|
myMPaddleSpeed->setValue(instance().settings().getInt("msense"));
|
||||||
|
@ -330,9 +338,12 @@ void InputDialog::saveConfig()
|
||||||
Joystick::setDeadZone(deadzone);
|
Joystick::setDeadZone(deadzone);
|
||||||
|
|
||||||
// Paddle speed (digital and mouse)
|
// Paddle speed (digital and mouse)
|
||||||
int dejitter = myDejitter->getValue();
|
int dejitter = myDejitterBase->getValue();
|
||||||
instance().settings().setValue("dejitter", dejitter);
|
instance().settings().setValue("dejitterBase", dejitter);
|
||||||
Paddles::setDejitter(dejitter);
|
Paddles::setDejitterBase(dejitter);
|
||||||
|
dejitter = myDejitterDiff->getValue();
|
||||||
|
instance().settings().setValue("dejitterDiff", dejitter);
|
||||||
|
Paddles::setDejitterDiff(dejitter);
|
||||||
|
|
||||||
int sensitivity = myDPaddleSpeed->getValue();
|
int sensitivity = myDPaddleSpeed->getValue();
|
||||||
instance().settings().setValue("dsense", sensitivity);
|
instance().settings().setValue("dsense", sensitivity);
|
||||||
|
@ -402,8 +413,9 @@ void InputDialog::setDefaults()
|
||||||
myDPaddleLabel->setLabel("10");
|
myDPaddleLabel->setLabel("10");
|
||||||
myMPaddleSpeed->setValue(10);
|
myMPaddleSpeed->setValue(10);
|
||||||
myMPaddleLabel->setLabel("10");
|
myMPaddleLabel->setLabel("10");
|
||||||
myDejitter->setValue(0);
|
myDejitterBase->setValue(0);
|
||||||
myDejitterLabel->setLabel("0");
|
myDejitterDiff->setValue(0);
|
||||||
|
UpdateDejitter();
|
||||||
myTrackBallSpeed->setValue(10);
|
myTrackBallSpeed->setValue(10);
|
||||||
myTrackBallLabel->setLabel("10");
|
myTrackBallLabel->setLabel("10");
|
||||||
|
|
||||||
|
@ -529,7 +541,7 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kDejitterChanged:
|
case kDejitterChanged:
|
||||||
myDejitterLabel->setValue(myDejitter->getValue());
|
UpdateDejitter();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kTBSpeedChanged:
|
case kTBSpeedChanged:
|
||||||
|
@ -573,3 +585,25 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
Dialog::handleCommand(sender, cmd, data, 0);
|
Dialog::handleCommand(sender, cmd, data, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void InputDialog::UpdateDejitter()
|
||||||
|
{
|
||||||
|
int strength = myDejitterBase->getValue();
|
||||||
|
stringstream label;
|
||||||
|
|
||||||
|
if (strength)
|
||||||
|
label << myDejitterBase->getValue();
|
||||||
|
else
|
||||||
|
label << "Off";
|
||||||
|
|
||||||
|
label << " ";
|
||||||
|
strength = myDejitterDiff->getValue();
|
||||||
|
|
||||||
|
if (strength)
|
||||||
|
label << myDejitterDiff->getValue();
|
||||||
|
else
|
||||||
|
label << "Off";
|
||||||
|
|
||||||
|
myDejitterLabel->setLabel(label.str());
|
||||||
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ class InputDialog : public Dialog
|
||||||
void addDevicePortTab(const GUI::Font& font);
|
void addDevicePortTab(const GUI::Font& font);
|
||||||
|
|
||||||
void eraseEEPROM();
|
void eraseEEPROM();
|
||||||
|
void UpdateDejitter();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
|
@ -82,7 +83,8 @@ class InputDialog : public Dialog
|
||||||
|
|
||||||
SliderWidget* myDeadzone;
|
SliderWidget* myDeadzone;
|
||||||
StaticTextWidget* myDeadzoneLabel;
|
StaticTextWidget* myDeadzoneLabel;
|
||||||
SliderWidget* myDejitter;
|
SliderWidget* myDejitterBase;
|
||||||
|
SliderWidget* myDejitterDiff;
|
||||||
SliderWidget* myDPaddleSpeed;
|
SliderWidget* myDPaddleSpeed;
|
||||||
SliderWidget* myMPaddleSpeed;
|
SliderWidget* myMPaddleSpeed;
|
||||||
SliderWidget* myTrackBallSpeed;
|
SliderWidget* myTrackBallSpeed;
|
||||||
|
|
Loading…
Reference in New Issue