mirror of https://github.com/stella-emu/stella.git
split X and Y center of paddles
add definition of paddles centers via game properties
This commit is contained in:
parent
48f87ffa54
commit
6741cb4ef9
|
@ -924,7 +924,8 @@ unique_ptr<Controller> Console::getControllerPort(const Controller::Type type,
|
|||
else if(type == Controller::Type::PaddlesIAxDr)
|
||||
swapAxis = swapDir = true;
|
||||
|
||||
Paddles::setAnalogCenter(myOSystem.settings().getInt("pcenter"));
|
||||
Paddles::setAnalogXCenter(BSPF::stringToInt(myProperties.get(PropType::Controller_PaddlesXCenter)));
|
||||
Paddles::setAnalogYCenter(BSPF::stringToInt(myProperties.get(PropType::Controller_PaddlesYCenter)));
|
||||
Paddles::setAnalogSensitivity(myOSystem.settings().getInt("psense"));
|
||||
|
||||
controller = make_unique<Paddles>(port, myEvent, *mySystem,
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -600,6 +600,8 @@ unique_ptr<Console> OSystem::openConsole(const FilesystemNode& romfile, string&
|
|||
CMDLINE_PROPS_UPDATE("vcenter", PropType::Display_VCenter);
|
||||
CMDLINE_PROPS_UPDATE("pp", PropType::Display_Phosphor);
|
||||
CMDLINE_PROPS_UPDATE("ppblend", PropType::Display_PPBlend);
|
||||
CMDLINE_PROPS_UPDATE("pxcenter", PropType::Controller_PaddlesXCenter);
|
||||
CMDLINE_PROPS_UPDATE("pycenter", PropType::Controller_PaddlesYCenter);
|
||||
|
||||
// Finally, create the cart with the correct properties
|
||||
if(cart)
|
||||
|
|
|
@ -238,7 +238,7 @@ void Paddles::update()
|
|||
sa_xaxis = new_val;
|
||||
|
||||
setPin(AnalogPin::Nine, Int32(MAX_RESISTANCE *
|
||||
(BSPF::clamp(32768 - Int32(Int32(sa_xaxis) * SENSITIVITY + CENTER), 0, 65536) / 65536.0)));
|
||||
(BSPF::clamp(32768 - Int32(Int32(sa_xaxis) * SENSITIVITY + XCENTER), 0, 65536) / 65536.0)));
|
||||
sa_changed = true;
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ void Paddles::update()
|
|||
sa_yaxis = new_val;
|
||||
|
||||
setPin(AnalogPin::Five, Int32(MAX_RESISTANCE *
|
||||
(BSPF::clamp(32768 - Int32(Int32(sa_yaxis) * SENSITIVITY + CENTER), 0, 65536) / 65536.0)));
|
||||
(BSPF::clamp(32768 - Int32(Int32(sa_yaxis) * SENSITIVITY + YCENTER), 0, 65536) / 65536.0)));
|
||||
sa_changed = true;
|
||||
}
|
||||
myLastAxisX = sa_xaxis;
|
||||
|
@ -383,10 +383,17 @@ bool Paddles::setMouseControl(
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Paddles::setAnalogCenter(int center)
|
||||
void Paddles::setAnalogXCenter(int xcenter)
|
||||
{
|
||||
// TODO: convert into ~5 pixel (also in Input Dialog!)
|
||||
CENTER = BSPF::clamp(center, MIN_ANALOG_CENTER, MAX_ANALOG_CENTER) * 860;
|
||||
// convert into ~5 pixel steps
|
||||
XCENTER = BSPF::clamp(xcenter, MIN_ANALOG_CENTER, MAX_ANALOG_CENTER) * 860;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Paddles::setAnalogYCenter(int ycenter)
|
||||
{
|
||||
// convert into ~5 pixel steps
|
||||
YCENTER = BSPF::clamp(ycenter, MIN_ANALOG_CENTER, MAX_ANALOG_CENTER) * 860;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -431,7 +438,8 @@ void Paddles::setDigitalPaddleRange(int range)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int Paddles::CENTER = 0;
|
||||
int Paddles::XCENTER = 0;
|
||||
int Paddles::YCENTER = 0;
|
||||
float Paddles::SENSITIVITY = 1.0;
|
||||
|
||||
int Paddles::TRIGRANGE = Paddles::TRIGMAX;
|
||||
|
|
|
@ -50,8 +50,8 @@ class Paddles : public Controller
|
|||
public:
|
||||
static constexpr float BASE_ANALOG_SENSE = 0.148643628f;
|
||||
static constexpr int MAX_ANALOG_SENSE = 30;
|
||||
static constexpr int MIN_ANALOG_CENTER = -20;
|
||||
static constexpr int MAX_ANALOG_CENTER = 20;
|
||||
static constexpr int MIN_ANALOG_CENTER = -10;
|
||||
static constexpr int MAX_ANALOG_CENTER = 30;
|
||||
static constexpr int MAX_DIGITAL_SENSE = 20;
|
||||
static constexpr int MAX_MOUSE_SENSE = 20;
|
||||
static constexpr int MIN_DEJITTER = 0;
|
||||
|
@ -93,11 +93,18 @@ class Paddles : public Controller
|
|||
Controller::Type ytype, int yid) override;
|
||||
|
||||
/**
|
||||
Sets the center for analog paddles.
|
||||
Sets the x-center for analog paddles.
|
||||
|
||||
@param center Value from -20 to 20, representing the center offset/860
|
||||
@param center Value from -10 to 30, representing the center offset/860
|
||||
*/
|
||||
static void setAnalogCenter(int center);
|
||||
static void setAnalogXCenter(int xcenter);
|
||||
|
||||
/**
|
||||
Sets the y-center for analog paddles.
|
||||
|
||||
@param center Value from -10 to 30, representing the center offset/860
|
||||
*/
|
||||
static void setAnalogYCenter(int ycenter);
|
||||
|
||||
/**
|
||||
Sets the sensitivity for analog paddles.
|
||||
|
@ -175,7 +182,8 @@ class Paddles : public Controller
|
|||
int myLastAxisX{0}, myLastAxisY{0};
|
||||
int myAxisDigitalZero{0}, myAxisDigitalOne{0};
|
||||
|
||||
static int CENTER;
|
||||
static int XCENTER;
|
||||
static int YCENTER;
|
||||
static float SENSITIVITY;
|
||||
|
||||
static int DIGITAL_SENSITIVITY, DIGITAL_DISTANCE;
|
||||
|
|
|
@ -251,6 +251,8 @@ void Properties::print() const
|
|||
<< get(PropType::Controller_Left) << "|"
|
||||
<< get(PropType::Controller_Right) << "|"
|
||||
<< get(PropType::Controller_SwapPaddles) << "|"
|
||||
<< get(PropType::Controller_PaddlesXCenter) << "|"
|
||||
<< get(PropType::Controller_PaddlesYCenter) << "|"
|
||||
<< get(PropType::Controller_MouseAxis) << "|"
|
||||
<< get(PropType::Display_Format) << "|"
|
||||
<< get(PropType::Display_VCenter) << "|"
|
||||
|
@ -296,6 +298,8 @@ void Properties::printHeader()
|
|||
<< "Controller_Left|"
|
||||
<< "Controller_Right|"
|
||||
<< "Controller_SwapPaddles|"
|
||||
<< "Controller_PaddlesXCenter|"
|
||||
<< "Controller_PaddlesYCenter|"
|
||||
<< "Controller_MouseAxis|"
|
||||
<< "Display_Format|"
|
||||
<< "Display_VCenter|"
|
||||
|
@ -323,6 +327,8 @@ std::array<string, Properties::NUM_PROPS> Properties::ourDefaultProperties =
|
|||
"AUTO", // Controller.Left
|
||||
"AUTO", // Controller.Right
|
||||
"NO", // Controller.SwapPaddles
|
||||
"0", // Controller.PaddlesXCenter
|
||||
"0", // Controller.PaddlesYCenter
|
||||
"AUTO", // Controller.MouseAxis
|
||||
"AUTO", // Display.Format
|
||||
"0", // Display.VCenter
|
||||
|
@ -349,6 +355,8 @@ std::array<string, Properties::NUM_PROPS> Properties::ourPropertyNames =
|
|||
"Controller.Left",
|
||||
"Controller.Right",
|
||||
"Controller.SwapPaddles",
|
||||
"Controller.PaddlesXCenter",
|
||||
"Controller.PaddlesYCenter",
|
||||
"Controller.MouseAxis",
|
||||
"Display.Format",
|
||||
"Display.VCenter",
|
||||
|
|
|
@ -37,6 +37,8 @@ enum class PropType : uInt8 {
|
|||
Controller_Left,
|
||||
Controller_Right,
|
||||
Controller_SwapPaddles,
|
||||
Controller_PaddlesXCenter,
|
||||
Controller_PaddlesYCenter,
|
||||
Controller_MouseAxis,
|
||||
Display_Format,
|
||||
Display_VCenter,
|
||||
|
|
|
@ -103,7 +103,6 @@ Settings::Settings()
|
|||
setPermanent("dejitter.base", "0");
|
||||
setPermanent("dejitter.diff", "0");
|
||||
setPermanent("dsense", "10");
|
||||
setPermanent("pcenter", "0");
|
||||
setPermanent("psense", "20");
|
||||
setPermanent("msense", "10");
|
||||
setPermanent("tsense", "10");
|
||||
|
@ -324,10 +323,6 @@ void Settings::validate()
|
|||
if(i < 0 || i > 3)
|
||||
setValue("cursor", "2");
|
||||
|
||||
i = getInt("pcenter");
|
||||
if(i < Paddles::MIN_ANALOG_CENTER || i > Paddles::MAX_ANALOG_CENTER)
|
||||
setValue("pcenter", "0");
|
||||
|
||||
i = getInt("psense");
|
||||
if(i < 0|| i > Paddles::MAX_ANALOG_SENSE)
|
||||
setValue("psense", "20");
|
||||
|
@ -458,7 +453,6 @@ void Settings::usage() const
|
|||
<< " -cursor <0,1,2,3> Set cursor state in UI/emulation modes\n"
|
||||
<< " -dejitter.base <0-10> Strength of analog paddle value averaging\n"
|
||||
<< " -dejitter.diff <0-10> Strength of analog paddle reaction to fast movements\n"
|
||||
<< " -pcenter <-20-20> Center of analog paddle\n"
|
||||
<< " -psense <0-30> Sensitivity of analog paddle movement\n"
|
||||
<< " -dsense <1-20> Sensitivity of digital emulated paddle movement\n"
|
||||
<< " -msense <1-20> Sensitivity of mouse emulated paddle movement\n"
|
||||
|
@ -568,6 +562,8 @@ void Settings::usage() const
|
|||
<< " -rc <arg> Sets the 'Controller.Right' property\n"
|
||||
<< " -bc <arg> Same as using both -lc and -rc\n"
|
||||
<< " -cp <arg> Sets the 'Controller.SwapPaddles' property\n"
|
||||
<< " -pxcenter <arg> Sets the 'Controller.PaddlesXCenter' property\n"
|
||||
<< " -pycenter <arg> Sets the 'Controller.PaddlesYCenter' property\n"
|
||||
<< " -format <arg> Sets the 'Display.Format' property\n"
|
||||
<< " -vcenter <arg> Sets the 'Display.vcenter' property\n"
|
||||
<< " -pp <arg> Sets the 'Display.Phosphor' property\n"
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "OSystem.hxx"
|
||||
#include "CartDetector.hxx"
|
||||
#include "ControllerDetector.hxx"
|
||||
#include "Paddles.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "Props.hxx"
|
||||
#include "PropsSet.hxx"
|
||||
|
@ -66,7 +67,7 @@ GameInfoDialog::GameInfoDialog(
|
|||
StaticTextWidget* t;
|
||||
|
||||
// Set real dimensions
|
||||
setSize(53 * fontWidth + 8,
|
||||
setSize(55 * fontWidth + 8,
|
||||
8 * (lineHeight + VGAP) + 1 * (infoLineHeight + VGAP) + VBORDER * 2 + _th +
|
||||
buttonHeight + fontHeight + ifont.getLineHeight() + 20,
|
||||
max_w, max_h);
|
||||
|
@ -118,12 +119,13 @@ GameInfoDialog::GameInfoDialog(
|
|||
pwidth, lineHeight, items, "", 0, 0);
|
||||
wid.push_back(myFormat);
|
||||
|
||||
myFormatDetected = new StaticTextWidget(myTab, ifont, myFormat->getRight() + 8, ypos + 4, "SECAM60 detected");
|
||||
|
||||
myFormatDetected = new StaticTextWidget(myTab, ifont, myFormat->getRight() + 8, ypos + 4,
|
||||
"SECAM60 detected");
|
||||
|
||||
// Phosphor
|
||||
ypos += lineHeight + VGAP;
|
||||
myPhosphor = new CheckboxWidget(myTab, font, HBORDER, ypos + 1, "Phosphor (enabled for all ROMs)", kPhosphorChanged);
|
||||
myPhosphor = new CheckboxWidget(myTab, font, HBORDER, ypos + 1,
|
||||
"Phosphor (enabled for all ROMs)", kPhosphorChanged);
|
||||
wid.push_back(myPhosphor);
|
||||
|
||||
ypos += lineHeight + VGAP * 0;
|
||||
|
@ -261,10 +263,35 @@ GameInfoDialog::GameInfoDialog(
|
|||
pwidth, buttonHeight, "Erase EEPROM", kEEButtonPressed);
|
||||
wid.push_back(myEraseEEPROMButton);
|
||||
myEraseEEPROMInfo = new StaticTextWidget(myTab, ifont, myEraseEEPROMButton->getRight() + 4,
|
||||
myEraseEEPROMLabel->getTop() + 3, "(for this game only)");
|
||||
|
||||
myEraseEEPROMLabel->getTop() + 3,
|
||||
"(for this game only)");
|
||||
ypos += lineHeight + VGAP * 4;
|
||||
myMouseControl = new CheckboxWidget(myTab, font, xpos, ypos + 1, "Specific mouse axes", kMCtrlChanged);
|
||||
|
||||
// Paddles
|
||||
myPaddlesCenter = new StaticTextWidget(myTab, font, xpos, ypos, "Paddles center:");
|
||||
ypos += lineHeight + VGAP;
|
||||
|
||||
xpos += 20;
|
||||
myPaddleXCenter = new SliderWidget(myTab, font, xpos, ypos - 1, "X ", 0, kPXCenterChanged,
|
||||
fontWidth * 6, "px", 0 ,true);
|
||||
myPaddleXCenter->setMinValue(Paddles::MIN_ANALOG_CENTER);
|
||||
myPaddleXCenter->setMaxValue(Paddles::MAX_ANALOG_CENTER);
|
||||
myPaddleXCenter->setTickmarkIntervals(4);
|
||||
wid.push_back(myPaddleXCenter);
|
||||
ypos += lineHeight + VGAP;
|
||||
|
||||
myPaddleYCenter = new SliderWidget(myTab, font, xpos, ypos - 1, "Y ", 0, kPYCenterChanged,
|
||||
fontWidth * 6, "px", 0 ,true);
|
||||
myPaddleYCenter->setMinValue(Paddles::MIN_ANALOG_CENTER);
|
||||
myPaddleYCenter->setMaxValue(Paddles::MAX_ANALOG_CENTER);
|
||||
myPaddleYCenter->setTickmarkIntervals(4);
|
||||
wid.push_back(myPaddleYCenter);
|
||||
|
||||
// Mouse
|
||||
xpos = HBORDER + fontWidth * 24 - 20;
|
||||
ypos = myPaddlesCenter->getTop();
|
||||
myMouseControl = new CheckboxWidget(myTab, font, xpos, ypos + 1, "Specific mouse axes",
|
||||
kMCtrlChanged);
|
||||
wid.push_back(myMouseControl);
|
||||
|
||||
// Mouse controller specific axis
|
||||
|
@ -291,8 +318,8 @@ GameInfoDialog::GameInfoDialog(
|
|||
"Y-Axis is ");
|
||||
wid.push_back(myMouseY);
|
||||
|
||||
xpos = HBORDER; ypos += lineHeight + VGAP;
|
||||
myMouseRange = new SliderWidget(myTab, font, HBORDER, ypos,
|
||||
xpos -= 20; ypos += lineHeight + VGAP;
|
||||
myMouseRange = new SliderWidget(myTab, font, xpos, ypos,
|
||||
"Mouse axes range ", 0, 0, fontWidth * 4, "%");
|
||||
myMouseRange->setMinValue(1); myMouseRange->setMaxValue(100);
|
||||
myMouseRange->setTickmarkIntervals(4);
|
||||
|
@ -492,6 +519,10 @@ void GameInfoDialog::loadControllerProperties(const Properties& props)
|
|||
mySwapPorts->setState(props.get(PropType::Console_SwapPorts) == "YES");
|
||||
mySwapPaddles->setState(props.get(PropType::Controller_SwapPaddles) == "YES");
|
||||
|
||||
// Paddle centers
|
||||
myPaddleXCenter->setValue(BSPF::stringToInt(props.get(PropType::Controller_PaddlesXCenter)));
|
||||
myPaddleYCenter->setValue(BSPF::stringToInt(props.get(PropType::Controller_PaddlesYCenter)));
|
||||
|
||||
// MouseAxis property (potentially contains 'range' information)
|
||||
istringstream m_axis(props.get(PropType::Controller_MouseAxis));
|
||||
string m_control, m_range;
|
||||
|
@ -557,7 +588,11 @@ void GameInfoDialog::saveConfig()
|
|||
myGameProperties.set(PropType::Controller_Left, myLeftPort->getSelectedTag().toString());
|
||||
myGameProperties.set(PropType::Controller_Right, myRightPort->getSelectedTag().toString());
|
||||
myGameProperties.set(PropType::Console_SwapPorts, (mySwapPorts->isEnabled() && mySwapPorts->getState()) ? "YES" : "NO");
|
||||
myGameProperties.set(PropType::Controller_SwapPaddles, (/*mySwapPaddles->isEnabled() &&*/ mySwapPaddles->getState()) ? "YES" : "NO");
|
||||
myGameProperties.set(PropType::Controller_SwapPaddles, mySwapPaddles->getState() ? "YES" : "NO");
|
||||
|
||||
// Paddle center
|
||||
myGameProperties.set(PropType::Controller_PaddlesXCenter, std::to_string(myPaddleXCenter->getValue()));
|
||||
myGameProperties.set(PropType::Controller_PaddlesYCenter, std::to_string(myPaddleYCenter->getValue()));
|
||||
|
||||
// MouseAxis property (potentially contains 'range' information)
|
||||
string mcontrol = "AUTO";
|
||||
|
@ -598,6 +633,9 @@ void GameInfoDialog::saveConfig()
|
|||
|
||||
// update 'Controllers' tab settings immediately
|
||||
instance().console().setControllers(myGameProperties.get(PropType::Cart_MD5));
|
||||
|
||||
Paddles::setAnalogXCenter(myPaddleXCenter->getValue());
|
||||
Paddles::setAnalogYCenter(myPaddleYCenter->getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -686,7 +724,7 @@ void GameInfoDialog::updateControllerStates()
|
|||
// Compumate bankswitching scheme doesn't allow to select controllers
|
||||
bool enableSelectControl = myBSType->getSelectedTag() != "CM";
|
||||
// Enable Swap Paddles checkbox only for paddle games
|
||||
bool enableSwapPaddles = BSPF::startsWithIgnoreCase(contrLeft, "PADDLES") ||
|
||||
bool enablePaddles = BSPF::startsWithIgnoreCase(contrLeft, "PADDLES") ||
|
||||
BSPF::startsWithIgnoreCase(contrRight, "PADDLES") ||
|
||||
BSPF::startsWithIgnoreCase(myLeftPortDetected->getLabel(), "Paddles") ||
|
||||
BSPF::startsWithIgnoreCase(myRightPortDetected->getLabel(), "Paddles");
|
||||
|
@ -712,11 +750,27 @@ void GameInfoDialog::updateControllerStates()
|
|||
myRightPort->setEnabled(enableSelectControl);
|
||||
|
||||
mySwapPorts->setEnabled(enableSelectControl);
|
||||
mySwapPaddles->setEnabled(enableSwapPaddles);
|
||||
mySwapPaddles->setEnabled(enablePaddles);
|
||||
|
||||
myEraseEEPROMLabel->setEnabled(enableEEEraseButton);
|
||||
myEraseEEPROMButton->setEnabled(enableEEEraseButton);
|
||||
myEraseEEPROMInfo->setEnabled(enableEEEraseButton);
|
||||
|
||||
myPaddlesCenter->setEnabled(enablePaddles);
|
||||
myPaddleXCenter->setEnabled(enablePaddles);
|
||||
myPaddleYCenter->setEnabled(enablePaddles);
|
||||
|
||||
|
||||
bool enableMouse = enablePaddles ||
|
||||
BSPF::startsWithIgnoreCase(contrLeft, "Driving") ||
|
||||
BSPF::startsWithIgnoreCase(contrRight, "Driving") ||
|
||||
BSPF::startsWithIgnoreCase(contrLeft, "MindLink") ||
|
||||
BSPF::startsWithIgnoreCase(contrRight, "MindLink");
|
||||
|
||||
myMouseControl->setEnabled(enableMouse);
|
||||
myMouseX->setEnabled(enableMouse);
|
||||
myMouseY->setEnabled(enableMouse);
|
||||
myMouseRange->setEnabled(enableMouse);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -797,6 +851,14 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
myVCenter->setValueUnit("px");
|
||||
break;
|
||||
|
||||
case kPXCenterChanged:
|
||||
myPaddleXCenter->setValueLabel(myPaddleXCenter->getValue() * 5);
|
||||
break;
|
||||
|
||||
case kPYCenterChanged:
|
||||
myPaddleYCenter->setValueLabel(myPaddleYCenter->getValue() * 5);
|
||||
break;
|
||||
|
||||
case kMCtrlChanged:
|
||||
{
|
||||
bool state = myMouseControl->getState();
|
||||
|
|
|
@ -89,6 +89,9 @@ class GameInfoDialog : public Dialog, public CommandSender
|
|||
StaticTextWidget* myEraseEEPROMLabel{nullptr};
|
||||
ButtonWidget* myEraseEEPROMButton{nullptr};
|
||||
StaticTextWidget* myEraseEEPROMInfo{nullptr};
|
||||
StaticTextWidget* myPaddlesCenter{nullptr};
|
||||
SliderWidget* myPaddleXCenter{nullptr};
|
||||
SliderWidget* myPaddleYCenter{nullptr};
|
||||
CheckboxWidget* myMouseControl{nullptr};
|
||||
PopUpWidget* myMouseX{nullptr};
|
||||
PopUpWidget* myMouseY{nullptr};
|
||||
|
@ -110,6 +113,8 @@ class GameInfoDialog : public Dialog, public CommandSender
|
|||
kRightCChanged = 'RCch',
|
||||
kMCtrlChanged = 'MCch',
|
||||
kEEButtonPressed = 'EEgb',
|
||||
kPXCenterChanged = 'Pxch',
|
||||
kPYCenterChanged = 'Pych',
|
||||
};
|
||||
|
||||
// Game properties for currently loaded ROM
|
||||
|
|
|
@ -123,20 +123,9 @@ void InputDialog::addDevicePortTab()
|
|||
|
||||
xpos = HBORDER; ypos += lineHeight + VGAP * 2;
|
||||
new StaticTextWidget(myTab, _font, xpos, ypos+1, "Analog paddle:");
|
||||
|
||||
// Add paddle center
|
||||
xpos += fontWidth * 2;
|
||||
ypos += lineHeight + VGAP;
|
||||
|
||||
myPaddleCenter = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
||||
"Center",
|
||||
lwidth - fontWidth * 2, kPCenterChanged, 6 * fontWidth, "px", 0, true);
|
||||
myPaddleCenter->setMinValue(Paddles::MIN_ANALOG_CENTER);
|
||||
myPaddleCenter->setMaxValue(Paddles::MAX_ANALOG_CENTER);
|
||||
myPaddleCenter->setTickmarkIntervals(4);
|
||||
wid.push_back(myPaddleCenter);
|
||||
|
||||
// Add paddle sensitivity
|
||||
// Add analog paddle sensitivity
|
||||
ypos += lineHeight + VGAP;
|
||||
myPaddleSpeed = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
||||
"Sensitivity",
|
||||
|
@ -146,26 +135,26 @@ void InputDialog::addDevicePortTab()
|
|||
wid.push_back(myPaddleSpeed);
|
||||
|
||||
|
||||
// Add dejitter (Stelladaptor emulation for now only)
|
||||
// Add dejitter (analog paddles)
|
||||
ypos += lineHeight + VGAP;
|
||||
myDejitterBase = new SliderWidget(myTab, _font, xpos, ypos - 1, 6 * fontWidth, lineHeight,
|
||||
"Dejitter strength", lwidth - fontWidth * 2, kDejitterChanged);
|
||||
myDejitterBase = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
||||
"Dejitter averaging", lwidth - fontWidth * 2,
|
||||
kDejitterAvChanged, 3 * fontWidth);
|
||||
myDejitterBase->setMinValue(Paddles::MIN_DEJITTER);
|
||||
myDejitterBase->setMaxValue(Paddles::MAX_DEJITTER);
|
||||
myDejitterBase->setTickmarkIntervals(2);
|
||||
xpos += myDejitterBase->getWidth() + fontWidth - 4;
|
||||
myDejitterBase->setTickmarkIntervals(5);
|
||||
//xpos += myDejitterBase->getWidth() + fontWidth - 4;
|
||||
wid.push_back(myDejitterBase);
|
||||
|
||||
myDejitterDiff = new SliderWidget(myTab, _font, xpos, ypos - 1, 6 * fontWidth, lineHeight,
|
||||
"", 0, kDejitterChanged);
|
||||
ypos += lineHeight + VGAP;
|
||||
myDejitterDiff = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
||||
"Dejitter reaction", lwidth - fontWidth * 2,
|
||||
kDejitterReChanged, 3 * fontWidth);
|
||||
myDejitterDiff->setMinValue(Paddles::MIN_DEJITTER);
|
||||
myDejitterDiff->setMaxValue(Paddles::MAX_DEJITTER);
|
||||
myDejitterDiff->setTickmarkIntervals(2);
|
||||
xpos += myDejitterDiff->getWidth();
|
||||
myDejitterDiff->setTickmarkIntervals(5);
|
||||
wid.push_back(myDejitterDiff);
|
||||
|
||||
myDejitterLabel = new StaticTextWidget(myTab, _font, xpos, ypos + 1, 7 * fontWidth, lineHeight, "");
|
||||
|
||||
// Add paddle speed (digital emulation)
|
||||
ypos += lineHeight + VGAP * 4;
|
||||
myDPaddleSpeed = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight,
|
||||
|
@ -319,14 +308,13 @@ void InputDialog::loadConfig()
|
|||
// Joystick deadzone
|
||||
myDeadzone->setValue(instance().settings().getInt("joydeadzone"));
|
||||
|
||||
// Paddle center & speed (analog)
|
||||
myPaddleCenter->setValue(instance().settings().getInt("pcenter"));
|
||||
// Paddle speed (analog)
|
||||
myPaddleSpeed->setValue(instance().settings().getInt("psense"));
|
||||
|
||||
// Paddle speed (digital and mouse)
|
||||
// Paddle dejitter (analog)
|
||||
myDejitterBase->setValue(instance().settings().getInt("dejitter.base"));
|
||||
myDejitterDiff->setValue(instance().settings().getInt("dejitter.diff"));
|
||||
updateDejitter();
|
||||
|
||||
// Paddle speed (digital and mouse)
|
||||
myDPaddleSpeed->setValue(instance().settings().getInt("dsense"));
|
||||
myMPaddleSpeed->setValue(instance().settings().getInt("msense"));
|
||||
|
||||
|
@ -376,11 +364,6 @@ void InputDialog::saveConfig()
|
|||
instance().settings().setValue("joydeadzone", deadzone);
|
||||
Joystick::setDeadZone(deadzone);
|
||||
|
||||
// Paddle center (analog)
|
||||
int center = myPaddleCenter->getValue();
|
||||
instance().settings().setValue("pcenter", center);
|
||||
Paddles::setAnalogCenter(center);
|
||||
|
||||
// Paddle speed (analog)
|
||||
int sensitivity = myPaddleSpeed->getValue();
|
||||
instance().settings().setValue("psense", sensitivity);
|
||||
|
@ -453,8 +436,7 @@ void InputDialog::setDefaults()
|
|||
// Joystick deadzone
|
||||
myDeadzone->setValue(0);
|
||||
|
||||
// Paddle center & speed (analog)
|
||||
myPaddleCenter->setValue(0);
|
||||
// Paddle speed (analog)
|
||||
myPaddleSpeed->setValue(20);
|
||||
|
||||
// Paddle speed (digital)
|
||||
|
@ -466,7 +448,6 @@ void InputDialog::setDefaults()
|
|||
myDejitterBase->setValue(0);
|
||||
myDejitterDiff->setValue(0);
|
||||
#endif
|
||||
updateDejitter();
|
||||
myTrackBallSpeed->setValue(10);
|
||||
|
||||
// AtariVox serial port
|
||||
|
@ -625,16 +606,16 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
myDeadzone->setValueLabel(3200 + 1000 * myDeadzone->getValue());
|
||||
break;
|
||||
|
||||
case kPCenterChanged:
|
||||
myPaddleCenter->setValueLabel(myPaddleCenter->getValue() * 5);
|
||||
break;
|
||||
|
||||
case kPSpeedChanged:
|
||||
myPaddleSpeed->setValueLabel(Paddles::setAnalogSensitivity(myPaddleSpeed->getValue()) * 100.0 + 0.5);
|
||||
break;
|
||||
|
||||
case kDejitterChanged:
|
||||
updateDejitter();
|
||||
case kDejitterAvChanged:
|
||||
updateDejitterAveraging();
|
||||
break;
|
||||
|
||||
case kDejitterReChanged:
|
||||
updateDejitterReaction();
|
||||
break;
|
||||
|
||||
case kDPSpeedChanged:
|
||||
|
@ -696,25 +677,19 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void InputDialog::updateDejitter()
|
||||
void InputDialog::updateDejitterAveraging()
|
||||
{
|
||||
int strength = myDejitterBase->getValue();
|
||||
stringstream label;
|
||||
|
||||
if (strength)
|
||||
label << myDejitterBase->getValue();
|
||||
else
|
||||
label << "Off";
|
||||
myDejitterBase->setValueLabel(strength ? std::to_string(strength) : "Off");
|
||||
}
|
||||
|
||||
label << " ";
|
||||
strength = myDejitterDiff->getValue();
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void InputDialog::updateDejitterReaction()
|
||||
{
|
||||
int strength = myDejitterDiff->getValue();
|
||||
|
||||
if (strength)
|
||||
label << myDejitterDiff->getValue();
|
||||
else
|
||||
label << "Off";
|
||||
|
||||
myDejitterLabel->setLabel(label.str());
|
||||
myDejitterDiff->setValueLabel(strength ? std::to_string(strength) : "Off");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -65,15 +65,16 @@ class InputDialog : public Dialog
|
|||
|
||||
void handleMouseControlState();
|
||||
void handleCursorState();
|
||||
void updateDejitter();
|
||||
void updateDejitterAveraging();
|
||||
void updateDejitterReaction();
|
||||
void eraseEEPROM();
|
||||
|
||||
private:
|
||||
enum {
|
||||
kDeadzoneChanged = 'DZch',
|
||||
kPCenterChanged = 'Pcch',
|
||||
kPSpeedChanged = 'Ppch',
|
||||
kDejitterChanged = 'Pjch',
|
||||
kDejitterAvChanged = 'JAch',
|
||||
kDejitterReChanged = 'JRch',
|
||||
kDPSpeedChanged = 'PDch',
|
||||
kTBSpeedChanged = 'TBch',
|
||||
kDBButtonPressed = 'DBbp',
|
||||
|
@ -96,14 +97,12 @@ class InputDialog : public Dialog
|
|||
EditTextWidget* myAVoxPort{nullptr};
|
||||
|
||||
SliderWidget* myDeadzone{nullptr};
|
||||
SliderWidget* myPaddleCenter{nullptr};
|
||||
SliderWidget* myPaddleSpeed{nullptr};
|
||||
SliderWidget* myDejitterBase{nullptr};
|
||||
SliderWidget* myDejitterDiff{nullptr};
|
||||
SliderWidget* myDPaddleSpeed{nullptr};
|
||||
SliderWidget* myMPaddleSpeed{nullptr};
|
||||
SliderWidget* myTrackBallSpeed{nullptr};
|
||||
StaticTextWidget* myDejitterLabel{nullptr};
|
||||
CheckboxWidget* myAllowAll4{nullptr};
|
||||
CheckboxWidget* myGrabMouse{nullptr};
|
||||
CheckboxWidget* myModCombo{nullptr};
|
||||
|
|
|
@ -19,11 +19,13 @@ my %prop_type = (
|
|||
"Controller.Left" => 13,
|
||||
"Controller.Right" => 14,
|
||||
"Controller.SwapPaddles" => 15,
|
||||
"Controller.MouseAxis" => 16,
|
||||
"Display.Format" => 17,
|
||||
"Display.VCenter" => 18,
|
||||
"Display.Phosphor" => 19,
|
||||
"Display.PPBlend" => 20
|
||||
"Controller.PaddlesXCenter" => 16,
|
||||
"Controller.PaddlesYCenter" => 17,
|
||||
"Controller.MouseAxis" => 18,
|
||||
"Display.Format" => 19,
|
||||
"Display.VCenter" => 20,
|
||||
"Display.Phosphor" => 21,
|
||||
"Display.PPBlend" => 22
|
||||
);
|
||||
my @prop_type_as_string = (
|
||||
"Cart.MD5",
|
||||
|
@ -42,6 +44,8 @@ my @prop_type_as_string = (
|
|||
"Controller.Left",
|
||||
"Controller.Right",
|
||||
"Controller.SwapPaddles",
|
||||
"Controller.PaddlesXCenter",
|
||||
"Controller.PaddlesYCenter",
|
||||
"Controller.MouseAxis",
|
||||
"Display.Format",
|
||||
"Display.VCenter",
|
||||
|
|
Loading…
Reference in New Issue