mirror of https://github.com/stella-emu/stella.git
added option for toggling autofire (resolves #843)
This commit is contained in:
parent
f619b4e5cb
commit
7052f15b56
10
Changes.txt
10
Changes.txt
|
@ -12,6 +12,13 @@
|
|||
Release History
|
||||
===========================================================================
|
||||
|
||||
6.6 to 6.?
|
||||
|
||||
* Added option to toggle autofire mode.
|
||||
|
||||
-Have fun!
|
||||
|
||||
|
||||
6.5.3 to 6.6 (November 16, 2021)
|
||||
|
||||
* Added preliminary PlusROM support for saving high scores.
|
||||
|
@ -43,9 +50,6 @@
|
|||
|
||||
* Debugger: added Thumb cycle counting.
|
||||
|
||||
-Have fun!
|
||||
|
||||
|
||||
6.5.2 to 6.5.3 (April 20, 2021)
|
||||
|
||||
* Added context-sensitive help.
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.9 KiB |
|
@ -1660,6 +1660,11 @@
|
|||
<td>Control + F5</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Toggle autofire</td>
|
||||
<td>Alt + A</td>
|
||||
<td>Cmd + A</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><i>Decrease</i> autofire rate</td>
|
||||
<td>Shift-Control + A</td>
|
||||
|
@ -3048,6 +3053,11 @@
|
|||
faster movement.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><pre>-autofire <1|0></pre></td>
|
||||
<td>Set auto fire mode on or off.</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><pre>-autofirerate <0 - 30></pre></td>
|
||||
<td>Automatic trigger rate of the fire buttons in Hz (0 = disabled)</td>
|
||||
|
@ -4079,7 +4089,8 @@
|
|||
</td><td>-dejitter.base</td></tr>
|
||||
<tr><td>(Analog paddle) Dejitter reaction</td><td>Strength of paddle reaction to fast paddle movements, suppresses paddle jitter</td><td>-dejitter.diff</td></tr>
|
||||
<tr><td>Digital paddle sensitivity</td><td>Sensitivity used when emulating a paddle using a digital device</td><td>-dsense</td></tr>
|
||||
<tr><td>Autofire rate</td><td>Automatic trigger rate of the fire buttons in Hz</td><td>-autofirerate</td></tr>
|
||||
<tr><td>Autofire</td><td>Set auto fire mode on or off</td><td>-autofire</td></tr>
|
||||
<tr><td>(Autofire) Rate</td><td>Automatic trigger rate of the fire buttons in Hz</td><td>-autofirerate</td></tr>
|
||||
<tr><td>Allow all 4 directions ...</td><td>Allow all 4 joystick directions to be pressed simultaneously</td><td>-joyallow4</td></tr>
|
||||
<tr><td>Use modifier key combos</td><td>Enable using modifier keys in keyboard actions</td><td>-modcombo</td></tr>
|
||||
<tr><td>Swap Stelladaptor ports</td><td>Swap the order of the detected Stelladaptors/2600-daptors (see <b>Advanced Configuration - <a href="#Adaptor">Stelladaptor/2600-daptor Support</a></b>)</td><td>-saport</td></tr>
|
||||
|
|
|
@ -700,6 +700,7 @@ PhysicalKeyboardHandler::DefaultCommonMapping = {
|
|||
{ Event::IncDejtterReaction, KBDK_F4, KBDM_CTRL },
|
||||
{ Event::DecDigitalSense, KBDK_F5, KBDM_CTRL | KBDM_SHIFT },
|
||||
{ Event::IncDigitalSense, KBDK_F5, KBDM_CTRL },
|
||||
{ Event::ToggleAutoFire, KBDK_A, MOD3 },
|
||||
{ Event::DecreaseAutoFire, KBDK_A, KBDM_CTRL | KBDM_SHIFT },
|
||||
{ Event::IncreaseAutoFire, KBDK_A, KBDM_CTRL },
|
||||
{ Event::ToggleFourDirections, KBDK_F6, KBDM_CTRL },
|
||||
|
|
|
@ -211,8 +211,6 @@ NLOHMANN_JSON_SERIALIZE_ENUM(Event::Type, {
|
|||
{Event::IncDejtterReaction, "IncDejtterReaction"},
|
||||
{Event::DecDigitalSense, "DecDigitalSense"},
|
||||
{Event::IncDigitalSense, "IncDigitalSense"},
|
||||
{Event::DecreaseAutoFire, "DecreaseAutoFire"},
|
||||
{Event::IncreaseAutoFire, "IncreaseAutoFire"},
|
||||
{Event::ToggleFourDirections, "ToggleFourDirections"},
|
||||
{Event::ToggleKeyCombos, "ToggleKeyCombos"},
|
||||
{Event::ToggleSAPortOrder, "ToggleSAPortOrder"},
|
||||
|
@ -386,6 +384,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM(Event::Type, {
|
|||
{Event::PreviousSettingGroup, "PreviousSettingGroup"},
|
||||
{Event::NextSettingGroup, "NextSettingGroup"},
|
||||
{Event::TogglePlayBackMode, "TogglePlayBackMode"},
|
||||
{Event::ToggleAutoFire, "ToggleAutoFire"},
|
||||
{Event::DecreaseAutoFire, "DecreaseAutoFire"},
|
||||
{Event::IncreaseAutoFire, "IncreaseAutoFire"},
|
||||
{Event::DecreaseSpeed, "DecreaseSpeed"},
|
||||
|
|
|
@ -1110,6 +1110,22 @@ void Console::changePaddleAxesRange(int direction)
|
|||
myOSystem.frameBuffer().showGaugeMessage("Mouse axes range", val.str(), range);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Console::toggleAutoFire(bool toggle)
|
||||
{
|
||||
bool enabled = myOSystem.settings().getBool("autofire");
|
||||
|
||||
if(toggle)
|
||||
{
|
||||
myOSystem.settings().setValue("autofire", !enabled);
|
||||
Controller::setAutoFire(!enabled);
|
||||
}
|
||||
|
||||
ostringstream ss;
|
||||
ss << "Autofire " << (!enabled ? "enabled" : "disabled");
|
||||
myOSystem.frameBuffer().showTextMessage(ss.str());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Console::changeAutoFireRate(int direction)
|
||||
{
|
||||
|
@ -1126,7 +1142,11 @@ void Console::changeAutoFireRate(int direction)
|
|||
ostringstream val;
|
||||
|
||||
if(rate)
|
||||
{
|
||||
myOSystem.settings().setValue("autofire", true);
|
||||
Controller::setAutoFire(true);
|
||||
val << rate << " Hz";
|
||||
}
|
||||
else
|
||||
val << "Off";
|
||||
|
||||
|
|
|
@ -187,11 +187,6 @@ class Console : public Serializable, public ConsoleIO
|
|||
*/
|
||||
EmulationTiming& emulationTiming() { return myEmulationTiming; }
|
||||
|
||||
/**
|
||||
Retrieve the current game's refresh rate, or 0 if no game.
|
||||
*/
|
||||
int refreshRate() const;
|
||||
|
||||
/**
|
||||
Toggle left and right controller ports swapping
|
||||
*/
|
||||
|
@ -378,6 +373,11 @@ class Console : public Serializable, public ConsoleIO
|
|||
*/
|
||||
void setTIAProperties();
|
||||
|
||||
/**
|
||||
Toggle autofire for all controllers
|
||||
*/
|
||||
void toggleAutoFire(bool toggle = true);
|
||||
|
||||
/**
|
||||
Change the autofire speed for all controllers
|
||||
*/
|
||||
|
|
|
@ -184,6 +184,12 @@ void Controller::setMouseSensitivity(int sensitivity)
|
|||
MOUSE_SENSITIVITY = BSPF::clamp(sensitivity, MIN_MOUSE_SENSE, MAX_MOUSE_SENSE);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Controller::setAutoFire(bool enable)
|
||||
{
|
||||
AUTO_FIRE = enable;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Controller::setAutoFireRate(int rate, bool isNTSC)
|
||||
{
|
||||
|
@ -195,4 +201,5 @@ void Controller::setAutoFireRate(int rate, bool isNTSC)
|
|||
int Controller::DIGITAL_DEAD_ZONE = 3200;
|
||||
int Controller::ANALOG_DEAD_ZONE = 0;
|
||||
int Controller::MOUSE_SENSITIVITY = -1;
|
||||
bool Controller::AUTO_FIRE = false;
|
||||
int Controller::AUTO_FIRE_RATE = 0;
|
||||
|
|
|
@ -317,6 +317,13 @@ class Controller : public Serializable
|
|||
*/
|
||||
static void setMouseSensitivity(int sensitivity);
|
||||
|
||||
/**
|
||||
Set auto fire state.
|
||||
|
||||
@param enable The new autofire state
|
||||
*/
|
||||
static void setAutoFire(bool enable);
|
||||
|
||||
/**
|
||||
Sets the auto fire rate. 0 disables auto fire.
|
||||
|
||||
|
@ -359,12 +366,12 @@ class Controller : public Serializable
|
|||
/**
|
||||
Checks for the next auto fire event.
|
||||
|
||||
@param pressed True if the fire button is current pressed
|
||||
@param pressed True if the fire button is currently pressed
|
||||
@return The result of the auto fire event check
|
||||
*/
|
||||
inline bool getAutoFireState(bool pressed)
|
||||
{
|
||||
if(AUTO_FIRE_RATE && pressed)
|
||||
if(AUTO_FIRE && AUTO_FIRE_RATE && pressed)
|
||||
{
|
||||
myFireDelay -= AUTO_FIRE_RATE;
|
||||
if(myFireDelay <= 0)
|
||||
|
@ -383,7 +390,7 @@ class Controller : public Serializable
|
|||
*/
|
||||
inline bool getAutoFireStateP1(bool pressed)
|
||||
{
|
||||
if(AUTO_FIRE_RATE && pressed)
|
||||
if(AUTO_FIRE && AUTO_FIRE_RATE && pressed)
|
||||
{
|
||||
myFireDelayP1 -= AUTO_FIRE_RATE;
|
||||
if(myFireDelayP1 <= 0)
|
||||
|
@ -418,7 +425,10 @@ class Controller : public Serializable
|
|||
|
||||
static int MOUSE_SENSITIVITY;
|
||||
|
||||
/// Defines the speed of the auto fire
|
||||
/// Defines the state of auto fire
|
||||
static bool AUTO_FIRE;
|
||||
|
||||
/// Defines the speed of auto fire
|
||||
static int AUTO_FIRE_RATE;
|
||||
|
||||
/// Delay[frames] until the next fire event
|
||||
|
|
|
@ -128,7 +128,7 @@ class Event
|
|||
// add new (after Version 4) events from here to avoid that user remapped events get overwritten
|
||||
PreviousSettingGroup, NextSettingGroup,
|
||||
TogglePlayBackMode,
|
||||
DecreaseAutoFire, IncreaseAutoFire,
|
||||
ToggleAutoFire, DecreaseAutoFire, IncreaseAutoFire,
|
||||
DecreaseSpeed, IncreaseSpeed,
|
||||
|
||||
QTJoystickThreeUp, QTJoystickThreeDown, QTJoystickThreeLeft, QTJoystickThreeRight,
|
||||
|
|
|
@ -113,6 +113,7 @@ void EventHandler::initialize()
|
|||
Controller::setMouseSensitivity(myOSystem.settings().getInt("msense"));
|
||||
PointingDevice::setSensitivity(myOSystem.settings().getInt("tsense"));
|
||||
Driving::setSensitivity(myOSystem.settings().getInt("dcsense"));
|
||||
Controller::setAutoFire(myOSystem.settings().getBool("autofire"));
|
||||
Controller::setAutoFireRate(myOSystem.settings().getInt("autofirerate"));
|
||||
|
||||
#ifdef GUI_SUPPORT
|
||||
|
@ -1100,6 +1101,14 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
|
|||
}
|
||||
return;
|
||||
|
||||
case Event::ToggleAutoFire:
|
||||
if(pressed && !repeated)
|
||||
{
|
||||
myOSystem.console().toggleAutoFire();
|
||||
myGlobalKeyHandler->setSetting(GlobalKeyHandler::Setting::AUTO_FIRE);
|
||||
}
|
||||
return;
|
||||
|
||||
case Event::DecreaseAutoFire:
|
||||
if(pressed)
|
||||
{
|
||||
|
@ -2929,6 +2938,7 @@ EventHandler::EmulActionList EventHandler::ourEmulActionList = { {
|
|||
{ Event::IncDejtterReaction, "Increase paddle dejitter reaction", "" },
|
||||
{ Event::DecDigitalSense, "Decrease digital paddle sensitivity", "" },
|
||||
{ Event::IncDigitalSense, "Increase digital paddle sensitivity", "" },
|
||||
{ Event::ToggleAutoFire, "Toggle auto fire", "" },
|
||||
{ Event::DecreaseAutoFire, "Decrease auto fire speed", "" },
|
||||
{ Event::IncreaseAutoFire, "Increase auto fire speed", "" },
|
||||
{ Event::ToggleFourDirections, "Toggle allow four joystick directions", "" },
|
||||
|
@ -3142,7 +3152,7 @@ const Event::EventSet EventHandler::DevicesEvents = {
|
|||
Event::DecDejtterAveraging, Event::IncDejtterAveraging,
|
||||
Event::DecDejtterReaction, Event::IncDejtterReaction,
|
||||
Event::DecDigitalSense, Event::IncDigitalSense,
|
||||
Event::DecreaseAutoFire, Event::IncreaseAutoFire,
|
||||
Event::ToggleAutoFire, Event::DecreaseAutoFire, Event::IncreaseAutoFire,
|
||||
Event::ToggleFourDirections, Event::ToggleKeyCombos, Event::ToggleSAPortOrder,
|
||||
Event::PrevMouseAsController, Event::NextMouseAsController,
|
||||
Event::DecMousePaddleSense, Event::IncMousePaddleSense,
|
||||
|
|
|
@ -522,7 +522,7 @@ class EventHandler
|
|||
#else
|
||||
REFRESH_SIZE = 0,
|
||||
#endif
|
||||
EMUL_ACTIONLIST_SIZE = 221 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE,
|
||||
EMUL_ACTIONLIST_SIZE = 222 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE,
|
||||
MENU_ACTIONLIST_SIZE = 19
|
||||
;
|
||||
|
||||
|
|
|
@ -113,6 +113,7 @@ Settings::Settings()
|
|||
setPermanent("combomap", "");
|
||||
setPermanent("joydeadzone", "13");
|
||||
setPermanent("joyallow4", "false");
|
||||
setPermanent("autofire", "0");
|
||||
setPermanent("autofirerate", "0");
|
||||
setPermanent("usemouse", "analog");
|
||||
setPermanent("grabmouse", "true");
|
||||
|
@ -549,6 +550,7 @@ void Settings::usage() const
|
|||
<< " -tsense <1-20> Sensitivity of mouse emulated trackball movement\n"
|
||||
<< " -dcsense <1-20> Sensitivity of digital emulated driving controller\n"
|
||||
<< " movement\n"
|
||||
<< " -autofire <1|0> Enable fire button autofire\n"
|
||||
<< " -autofirerate <0-30> Set fire button's autofire rate (0 means off)\n"
|
||||
<< " -saport <lr|rl> How to assign virtual ports to multiple\n"
|
||||
<< " Stelladaptor/2600-daptors\n"
|
||||
|
|
|
@ -106,6 +106,7 @@ void InputDialog::addDevicePortTab()
|
|||
VBORDER = Dialog::vBorder(),
|
||||
HBORDER = Dialog::hBorder(),
|
||||
VGAP = Dialog::vGap();
|
||||
const int swidth = 13 * fontWidth;
|
||||
int xpos, ypos, lwidth, tabID;
|
||||
WidgetArray wid;
|
||||
|
||||
|
@ -116,7 +117,7 @@ void InputDialog::addDevicePortTab()
|
|||
lwidth = _font.getStringWidth("Digital paddle sensitivity ");
|
||||
|
||||
// Add digital dead zone setting
|
||||
myDigitalDeadzone = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
||||
myDigitalDeadzone = new SliderWidget(myTab, _font, xpos, ypos - 1, swidth, lineHeight,
|
||||
"Digital dead zone size ",
|
||||
lwidth, kDDeadzoneChanged, 3 * fontWidth, "%");
|
||||
myDigitalDeadzone->setMinValue(Controller::MIN_DIGITAL_DEADZONE);
|
||||
|
@ -127,7 +128,7 @@ void InputDialog::addDevicePortTab()
|
|||
|
||||
// Add analog dead zone
|
||||
ypos += lineHeight + VGAP;
|
||||
myAnalogDeadzone = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
||||
myAnalogDeadzone = new SliderWidget(myTab, _font, xpos, ypos - 1, swidth, lineHeight,
|
||||
"Analog dead zone size",
|
||||
lwidth, kADeadzoneChanged, 3 * fontWidth, "%");
|
||||
myAnalogDeadzone->setMinValue(Controller::MIN_ANALOG_DEADZONE);
|
||||
|
@ -142,7 +143,7 @@ void InputDialog::addDevicePortTab()
|
|||
|
||||
// Add analog paddle sensitivity
|
||||
ypos += lineHeight;
|
||||
myPaddleSpeed = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
||||
myPaddleSpeed = new SliderWidget(myTab, _font, xpos, ypos - 1, swidth, lineHeight,
|
||||
"Sensitivity",
|
||||
lwidth - fontWidth * 2, kPSpeedChanged, 4 * fontWidth, "%");
|
||||
myPaddleSpeed->setMinValue(0);
|
||||
|
@ -152,7 +153,7 @@ void InputDialog::addDevicePortTab()
|
|||
|
||||
// Add analog paddle linearity
|
||||
ypos += lineHeight + VGAP;
|
||||
myPaddleLinearity = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
||||
myPaddleLinearity = new SliderWidget(myTab, _font, xpos, ypos - 1, swidth, lineHeight,
|
||||
"Linearity", lwidth - fontWidth * 2, 0, 4 * fontWidth, "%");
|
||||
myPaddleLinearity->setMinValue(Paddles::MIN_ANALOG_LINEARITY);
|
||||
myPaddleLinearity->setMaxValue(Paddles::MAX_ANALOG_LINEARITY);
|
||||
|
@ -163,7 +164,7 @@ void InputDialog::addDevicePortTab()
|
|||
|
||||
// Add dejitter (analog paddles)
|
||||
ypos += lineHeight + VGAP;
|
||||
myDejitterBase = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
||||
myDejitterBase = new SliderWidget(myTab, _font, xpos, ypos - 1, swidth, lineHeight,
|
||||
"Dejitter averaging", lwidth - fontWidth * 2,
|
||||
kDejitterAvChanged, 3 * fontWidth);
|
||||
myDejitterBase->setMinValue(Paddles::MIN_DEJITTER);
|
||||
|
@ -175,7 +176,7 @@ void InputDialog::addDevicePortTab()
|
|||
wid.push_back(myDejitterBase);
|
||||
|
||||
ypos += lineHeight + VGAP;
|
||||
myDejitterDiff = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
||||
myDejitterDiff = new SliderWidget(myTab, _font, xpos, ypos - 1, swidth, lineHeight,
|
||||
"Dejitter reaction", lwidth - fontWidth * 2,
|
||||
kDejitterReChanged, 3 * fontWidth);
|
||||
myDejitterDiff->setMinValue(Paddles::MIN_DEJITTER);
|
||||
|
@ -186,7 +187,7 @@ void InputDialog::addDevicePortTab()
|
|||
|
||||
// Add paddle speed (digital emulation)
|
||||
ypos += lineHeight + VGAP * (3 - 2);
|
||||
myDPaddleSpeed = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight,
|
||||
myDPaddleSpeed = new SliderWidget(myTab, _font, HBORDER, ypos - 1, swidth, lineHeight,
|
||||
"Digital paddle sensitivity",
|
||||
lwidth, kDPSpeedChanged, 4 * fontWidth, "%");
|
||||
myDPaddleSpeed->setMinValue(1); myDPaddleSpeed->setMaxValue(20);
|
||||
|
@ -194,9 +195,11 @@ void InputDialog::addDevicePortTab()
|
|||
wid.push_back(myDPaddleSpeed);
|
||||
|
||||
ypos += lineHeight + VGAP * (3 - 2);
|
||||
myAutoFireRate = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight,
|
||||
"Autofire rate",
|
||||
lwidth, kAutoFireChanged, 5 * fontWidth, "Hz");
|
||||
myAutoFire = new CheckboxWidget(myTab, _font, HBORDER, ypos + 1, "Autofire", kAutoFireChanged);
|
||||
wid.push_back(myAutoFire);
|
||||
|
||||
myAutoFireRate = new SliderWidget(myTab, _font, HBORDER + lwidth - fontWidth * 5,
|
||||
ypos - 1, swidth, lineHeight, "Rate ", 0, kAutoFireRate, 5 * fontWidth, "Hz");
|
||||
myAutoFireRate->setMinValue(0); myAutoFireRate->setMaxValue(30);
|
||||
myAutoFireRate->setTickmarkIntervals(6);
|
||||
wid.push_back(myAutoFireRate);
|
||||
|
@ -204,13 +207,13 @@ void InputDialog::addDevicePortTab()
|
|||
// Add 'allow all 4 directions' for joystick
|
||||
ypos += lineHeight + VGAP * (4 - 2);
|
||||
myAllowAll4 = new CheckboxWidget(myTab, _font, HBORDER, ypos,
|
||||
"Allow all 4 directions on joystick");
|
||||
"Allow all 4 directions on joystick");
|
||||
wid.push_back(myAllowAll4);
|
||||
|
||||
// Enable/disable modifier key-combos
|
||||
ypos += lineHeight + VGAP;
|
||||
myModCombo = new CheckboxWidget(myTab, _font, HBORDER, ypos,
|
||||
"Use modifier key combos");
|
||||
"Use modifier key combos");
|
||||
wid.push_back(myModCombo);
|
||||
ypos += lineHeight + VGAP;
|
||||
|
||||
|
@ -264,6 +267,7 @@ void InputDialog::addMouseTab()
|
|||
HBORDER = Dialog::hBorder(),
|
||||
VGAP = Dialog::vGap(),
|
||||
INDENT = Dialog::indent();
|
||||
const int swidth = 13 * fontWidth;
|
||||
int xpos = HBORDER, ypos, lwidth, pwidth, tabID;
|
||||
WidgetArray wid;
|
||||
VariantList items;
|
||||
|
@ -289,7 +293,7 @@ void InputDialog::addMouseTab()
|
|||
// Add paddle speed (mouse emulation)
|
||||
xpos += INDENT; ypos += lineHeight + VGAP;
|
||||
lwidth -= INDENT;
|
||||
myMPaddleSpeed = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
||||
myMPaddleSpeed = new SliderWidget(myTab, _font, xpos, ypos - 1, swidth, lineHeight,
|
||||
"Paddle",
|
||||
lwidth, kMPSpeedChanged, 4 * fontWidth, "%");
|
||||
myMPaddleSpeed->setMinValue(1); myMPaddleSpeed->setMaxValue(20);
|
||||
|
@ -298,7 +302,7 @@ void InputDialog::addMouseTab()
|
|||
|
||||
// Add trackball speed
|
||||
ypos += lineHeight + VGAP;
|
||||
myTrackBallSpeed = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
||||
myTrackBallSpeed = new SliderWidget(myTab, _font, xpos, ypos - 1, swidth, lineHeight,
|
||||
"Trackball",
|
||||
lwidth, kTBSpeedChanged, 4 * fontWidth, "%");
|
||||
myTrackBallSpeed->setMinValue(1); myTrackBallSpeed->setMaxValue(20);
|
||||
|
@ -307,7 +311,7 @@ void InputDialog::addMouseTab()
|
|||
|
||||
// Add driving controller speed
|
||||
ypos += lineHeight + VGAP;
|
||||
myDrivingSpeed = new SliderWidget(myTab, _font, xpos, ypos - 1, 13 * fontWidth, lineHeight,
|
||||
myDrivingSpeed = new SliderWidget(myTab, _font, xpos, ypos - 1, swidth, lineHeight,
|
||||
"Driving controller",
|
||||
lwidth, kDCSpeedChanged, 4 * fontWidth, "%");
|
||||
myDrivingSpeed->setMinValue(1); myDrivingSpeed->setMaxValue(20);
|
||||
|
@ -384,6 +388,9 @@ void InputDialog::loadConfig()
|
|||
// Driving controller speed
|
||||
myDrivingSpeed->setValue(settings.getInt("dcsense"));
|
||||
|
||||
// Autofire
|
||||
myAutoFire->setState(settings.getBool("autofire"));
|
||||
|
||||
// Autofire rate
|
||||
myAutoFireRate->setValue(settings.getInt("autofirerate"));
|
||||
|
||||
|
@ -462,7 +469,11 @@ void InputDialog::saveConfig()
|
|||
settings.setValue("dsense", sensitivity);
|
||||
Paddles::setDigitalSensitivity(sensitivity);
|
||||
|
||||
// Autofire rate
|
||||
// Autofire mode & rate
|
||||
bool enabled = myAutoFire->getState();
|
||||
settings.setValue("autofire", enabled);
|
||||
Controller::setAutoFire(enabled);
|
||||
|
||||
int rate = myAutoFireRate->getValue();
|
||||
settings.setValue("autofirerate", rate);
|
||||
Controller::setAutoFireRate(rate);
|
||||
|
@ -550,6 +561,9 @@ void InputDialog::setDefaults()
|
|||
// Paddle speed (digital)
|
||||
myDPaddleSpeed->setValue(10);
|
||||
|
||||
// Autofire
|
||||
myAutoFire->setState(false);
|
||||
|
||||
// Autofire rate
|
||||
myAutoFireRate->setValue(0);
|
||||
|
||||
|
@ -733,6 +747,7 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
break;
|
||||
|
||||
case kAutoFireChanged:
|
||||
case kAutoFireRate:
|
||||
updateAutoFireRate();
|
||||
break;
|
||||
|
||||
|
@ -806,8 +821,10 @@ void InputDialog::updateDejitterReaction()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void InputDialog::updateAutoFireRate()
|
||||
{
|
||||
bool enable = myAutoFire->getState();
|
||||
int rate = myAutoFireRate->getValue();
|
||||
|
||||
myAutoFireRate->setEnabled(enable);
|
||||
myAutoFireRate->setValueLabel(rate ? std::to_string(rate) : "Off");
|
||||
myAutoFireRate->setValueUnit(rate ? " Hz" : "");
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ class InputDialog : public Dialog
|
|||
kDejitterReChanged = 'JRch',
|
||||
kDPSpeedChanged = 'DSch',
|
||||
kAutoFireChanged = 'AFch',
|
||||
kAutoFireRate = 'AFra',
|
||||
kTBSpeedChanged = 'TBch',
|
||||
kDCSpeedChanged = 'DCch',
|
||||
kDBButtonPressed = 'DBbp',
|
||||
|
@ -104,6 +105,7 @@ class InputDialog : public Dialog
|
|||
SliderWidget* myDejitterBase{nullptr};
|
||||
SliderWidget* myDejitterDiff{nullptr};
|
||||
SliderWidget* myDPaddleSpeed{nullptr};
|
||||
CheckboxWidget* myAutoFire{nullptr};
|
||||
SliderWidget* myAutoFireRate{nullptr};
|
||||
CheckboxWidget* myAllowAll4{nullptr};
|
||||
CheckboxWidget* myModCombo{nullptr};
|
||||
|
|
Loading…
Reference in New Issue