Merge branch 'master' into refactor/cart

This commit is contained in:
thrust26 2020-04-05 22:30:20 +02:00
commit b52251da6e
11 changed files with 127 additions and 30 deletions

View File

@ -14,11 +14,15 @@
6.1 to 6.2: (??? ??, 2020)
* Added that paddle centering and sensitivity can be adjusted now (TOOD: Doc)
* Added that paddle centering and sensitivity can be adjusted (TODO: Doc)
* Added that Driving controller sensitivity can be adjusted (TODO: Doc)
* Added high scores: Score addresses, game variation etc. can be defined for
a game. This allows the user to save high scores for these games. For each
game and variation, the top 10 scores can be saved. (TOOD: Doc)
game and variation, the top 10 scores can be saved. (TODO: Doc)
* Add option which lets default ROM path follow launcher navigation (TODO: Doc)
* Added displaying last write address in the debugger.

View File

@ -49,10 +49,6 @@ Driving::Driving(Jack jack, const Event& event, const System& system)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Driving::update()
{
// Make sure direct gray codes from Stelladaptor stay in sync with
// simulated gray codes generated by PC keyboard or PC joystick
myCounter = (myGrayIndex << 2) | (myCounter & 3);
// Digital events (from keyboard or joystick hats & buttons)
setPin(DigitalPin::Six, myEvent.get(myFireEvent) == 0);
int d_axis = myEvent.get(myXAxisValue);
@ -92,8 +88,7 @@ void Driving::update()
}
// Only consider the lower-most bits (corresponding to pins 1 & 2)
myCounter &= 0x0f;
myGrayIndex = myCounter >> 2;
myGrayIndex = Int32(myCounter * SENSITIVITY / 4.0F) & 0b11;
// Stelladaptor is the only controller that should set this
int yaxis = myEvent.get(myYAxisValue);
@ -111,6 +106,10 @@ void Driving::update()
myGrayIndex = 2; // up + down
else /* if(yaxis < 16384-4096) */
myGrayIndex = 0; // no movement
// Make sure direct gray codes from Stelladaptor stay in sync with
// simulated gray codes generated by PC keyboard or PC joystick
myCounter = myGrayIndex / SENSITIVITY * 4.0F;
}
// Gray codes for rotation
@ -154,3 +153,13 @@ bool Driving::setMouseControl(
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Driving::setSensitivity(int sensitivity)
{
BSPF::clamp(sensitivity, 1, 20, 10);
SENSITIVITY = sensitivity / 10.0F;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
float Driving::SENSITIVITY = 1.0;

View File

@ -76,9 +76,18 @@ class Driving : public Controller
bool setMouseControl(
Controller::Type xtype, int xid, Controller::Type ytype, int yid) override;
/**
Sets the sensitivity for digital emulation of driving controlle movement
using a keyboard.
@param sensitivity Value from 1 to 20, with larger values causing
more movement (10 represents the baseline)
*/
static void setSensitivity(int sensitivity);
private:
// Counter to iterate through the gray codes
uInt32 myCounter{0};
Int32 myCounter{0};
// Index into the gray code table
uInt32 myGrayIndex{0};
@ -98,6 +107,10 @@ class Driving : public Controller
// Controllers to emulate in 'specific' mouse axis mode
int myControlIDX{-1}, myControlIDY{-1};
// User-defined sensitivity; adjustable since end-users may prefer different
// speeds
static float SENSITIVITY;
private:
// Following constructors and assignment operators not supported
Driving() = delete;

View File

@ -29,6 +29,7 @@
#include "Paddles.hxx"
#include "Lightgun.hxx"
#include "PointingDevice.hxx"
#include "Driving.hxx"
#include "PropsSet.hxx"
#include "Settings.hxx"
#include "Sound.hxx"
@ -97,6 +98,7 @@ void EventHandler::initialize()
Paddles::setDigitalSensitivity(myOSystem.settings().getInt("dsense"));
Paddles::setMouseSensitivity(myOSystem.settings().getInt("msense"));
PointingDevice::setSensitivity(myOSystem.settings().getInt("tsense"));
Driving::setSensitivity(myOSystem.settings().getInt("dcsense"));
#ifdef GUI_SUPPORT
// Set quick select delay when typing characters in listwidgets

View File

@ -106,6 +106,7 @@ Settings::Settings()
setPermanent("psense", "20");
setPermanent("msense", "10");
setPermanent("tsense", "10");
setPermanent("dcsense", "10");
setPermanent("saport", "lr");
setPermanent("modcombo", "true");
@ -124,6 +125,7 @@ Settings::Settings()
// ROM browser options
setPermanent("exitlauncher", "false");
setPermanent("followlauncher", "false");
setPermanent("launcherres", Common::Size(900, 600));
setPermanent("launcherfont", "medium");
setPermanent("launcherroms", "true");
@ -339,6 +341,10 @@ void Settings::validate()
if(i < 1 || i > 20)
setValue("tsense", "10");
i = getInt("dcsense");
if(i < 1 || i > 20)
setValue("dcsense", "10");
i = getInt("ssinterval");
if(i < 1) setValue("ssinterval", "2");
else if(i > 10) setValue("ssinterval", "10");
@ -457,6 +463,8 @@ void Settings::usage() const
<< " -dsense <1-20> Sensitivity of digital emulated paddle movement\n"
<< " -msense <1-20> Sensitivity of mouse emulated paddle movement\n"
<< " -tsense <1-20> Sensitivity of mouse emulated trackball movement\n"
<< " -dcsense <1-20> Sensitivity of digital emulated driving controller\n"
<< " movement\n"
<< " -saport <lr|rl> How to assign virtual ports to multiple\n"
<< " Stelladaptor/2600-daptors\n"
<< " -modcombo <1|0> Enable modifer key combos\n"
@ -493,6 +501,7 @@ void Settings::usage() const
<< " -launcherroms <1|0> Show only ROMs in the launcher (vs. all files)\n"
<< " -romviewer <float> Show ROM info viewer at given zoom level in ROM\n"
<< " launcher (use 0 for off)\n"
<< " -followlauncher <0|1> Default ROM path follows launcher navigation\n"
<< " -lastrom <name> Last played ROM, automatically selected in\n"
<< " launcher\n"
<< " -romloadcount <number> Number of ROM to load next from multicard\n"

View File

@ -22,6 +22,7 @@
#include "Joystick.hxx"
#include "Paddles.hxx"
#include "PointingDevice.hxx"
#include "Driving.hxx"
#include "SaveKey.hxx"
#include "AtariVox.hxx"
#include "Settings.hxx"
@ -156,7 +157,7 @@ void InputDialog::addDevicePortTab()
wid.push_back(myDejitterDiff);
// Add paddle speed (digital emulation)
ypos += lineHeight + VGAP * 4;
ypos += lineHeight + VGAP * 3;
myDPaddleSpeed = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight,
"Digital paddle sensitivity",
lwidth, kDPSpeedChanged, 4 * fontWidth, "%");
@ -165,7 +166,7 @@ void InputDialog::addDevicePortTab()
wid.push_back(myDPaddleSpeed);
// Add trackball speed
ypos += lineHeight + VGAP * 2;
ypos += lineHeight + VGAP;
myTrackBallSpeed = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight,
"Trackball sensitivity",
lwidth, kTBSpeedChanged, 4 * fontWidth, "%");
@ -173,8 +174,17 @@ void InputDialog::addDevicePortTab()
myTrackBallSpeed->setTickmarkIntervals(4);
wid.push_back(myTrackBallSpeed);
// Add driving controller speed
ypos += lineHeight + VGAP;
myDrivingSpeed = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight,
"Driving contr. sensitivity",
lwidth, kDCSpeedChanged, 4 * fontWidth, "%");
myDrivingSpeed->setMinValue(1); myDrivingSpeed->setMaxValue(20);
myDrivingSpeed->setTickmarkIntervals(4);
wid.push_back(myDrivingSpeed);
// Add 'allow all 4 directions' for joystick
ypos += lineHeight + VGAP * 4;
ypos += lineHeight + VGAP * 3;
myAllowAll4 = new CheckboxWidget(myTab, _font, HBORDER, ypos,
"Allow all 4 directions on joystick");
wid.push_back(myAllowAll4);
@ -194,7 +204,7 @@ void InputDialog::addDevicePortTab()
int fwidth;
// Add EEPROM erase (part 1/2)
ypos += VGAP*4;
ypos += VGAP * 3;
fwidth = _font.getStringWidth("AtariVox/SaveKey");
lwidth = _font.getStringWidth("AtariVox/SaveKey");
new StaticTextWidget(myTab, _font, _w - HBORDER - 4 - (fwidth + lwidth) / 2, ypos,
@ -203,7 +213,7 @@ void InputDialog::addDevicePortTab()
// Show joystick database
ypos += lineHeight;
myJoyDlgButton = new ButtonWidget(myTab, _font, HBORDER, ypos, 20,
"Joystick Database" + ELLIPSIS, kDBButtonPressed);
"Joystick Database" + ELLIPSIS, kDBButtonPressed);
wid.push_back(myJoyDlgButton);
// Add EEPROM erase (part 1/2)
@ -319,6 +329,8 @@ void InputDialog::loadConfig()
// Trackball speed
myTrackBallSpeed->setValue(instance().settings().getInt("tsense"));
// Driving controller speed
myDrivingSpeed->setValue(instance().settings().getInt("dcsense"));
// AtariVox serial port
myAVoxPort->setText(instance().settings().getString("avoxport"));
@ -389,6 +401,11 @@ void InputDialog::saveConfig()
instance().settings().setValue("tsense", sensitivity);
PointingDevice::setSensitivity(sensitivity);
// Driving controller speed
sensitivity = myDrivingSpeed->getValue();
instance().settings().setValue("dcsense", sensitivity);
Driving::setSensitivity(sensitivity);
// AtariVox serial port
instance().settings().setValue("avoxport", myAVoxPort->getText());
@ -447,6 +464,7 @@ void InputDialog::setDefaults()
myDejitterBase->setValue(0);
myDejitterDiff->setValue(0);
#endif
myDrivingSpeed->setValue(10);
myTrackBallSpeed->setValue(10);
// AtariVox serial port
@ -621,6 +639,10 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
myDPaddleSpeed->setValueLabel(myDPaddleSpeed->getValue() * 10);
break;
case kDCSpeedChanged:
myDrivingSpeed->setValueLabel(myDrivingSpeed->getValue() * 10);
break;
case kTBSpeedChanged:
myTrackBallSpeed->setValueLabel(myTrackBallSpeed->getValue() * 10);
break;

View File

@ -77,6 +77,7 @@ class InputDialog : public Dialog
kDejitterReChanged = 'JRch',
kDPSpeedChanged = 'PDch',
kTBSpeedChanged = 'TBch',
kDCSpeedChanged = 'DCch',
kDBButtonPressed = 'DBbp',
kEEButtonPressed = 'EEbp',
kConfirmEEEraseCmd = 'EEcf',
@ -103,6 +104,7 @@ class InputDialog : public Dialog
SliderWidget* myDPaddleSpeed{nullptr};
SliderWidget* myMPaddleSpeed{nullptr};
SliderWidget* myTrackBallSpeed{nullptr};
SliderWidget* myDrivingSpeed{nullptr};
CheckboxWidget* myAllowAll4{nullptr};
CheckboxWidget* myGrabMouse{nullptr};
CheckboxWidget* myModCombo{nullptr};

View File

@ -179,31 +179,37 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
myStartButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 0) / 4, bheight,
"Select", kLoadROMCmd);
wid.push_back(myStartButton);
xpos += (bwidth + 0) / 4 + BUTTON_GAP;
xpos += (bwidth + 0) / 4 + BUTTON_GAP;
myPrevDirButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 1) / 4, bheight,
"Go Up", kPrevDirCmd);
wid.push_back(myPrevDirButton);
xpos += (bwidth + 1) / 4 + BUTTON_GAP;
myOptionsButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 2) / 4, bheight,
"Options" + ELLIPSIS, kOptionsCmd);
xpos += (bwidth + 1) / 4 + BUTTON_GAP;
myOptionsButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 3) / 4, bheight,
"Options" + ELLIPSIS, kOptionsCmd);
wid.push_back(myOptionsButton);
xpos += (bwidth + 2) / 4 + BUTTON_GAP;
myQuitButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 3) / 4, bheight,
"Quit", kQuitCmd);
xpos += (bwidth + 2) / 4 + BUTTON_GAP;
myQuitButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 4) / 4, bheight,
"Quit", kQuitCmd);
wid.push_back(myQuitButton);
#else
myQuitButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 0) / 4, bheight,
"Quit", kQuitCmd);
wid.push_back(myQuitButton);
xpos += (bwidth + 0) / 4 + BUTTON_GAP;
xpos += (bwidth + 0) / 4 + BUTTON_GAP;
myOptionsButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 1) / 4, bheight,
"Options" + ELLIPSIS, kOptionsCmd);
wid.push_back(myOptionsButton);
xpos += (bwidth + 1) / 4 + BUTTON_GAP;
xpos += (bwidth + 1) / 4 + BUTTON_GAP;
myPrevDirButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 2) / 4, bheight,
"Go Up", kPrevDirCmd);
wid.push_back(myPrevDirButton);
xpos += (bwidth + 2) / 4 + BUTTON_GAP;
xpos += (bwidth + 2) / 4 + BUTTON_GAP;
myStartButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 3) / 4, bheight,
"Select", kLoadROMCmd);
wid.push_back(myStartButton);
@ -302,6 +308,13 @@ void LauncherDialog::loadConfig()
myList->clearFlags(Widget::FLAG_WANTS_RAWDATA); // always reset this
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::saveConfig()
{
if(instance().settings().getBool("followlauncher"))
instance().settings().setValue("romdir", myList->currentDir().getShortPath());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::updateUI()
{
@ -571,6 +584,7 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
case kLoadROMCmd:
case FileListWidget::ItemActivated:
saveConfig();
loadRom();
break;
@ -598,6 +612,7 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
break;
case kQuitCmd:
saveConfig();
close();
instance().eventHandler().quit();
break;
@ -637,6 +652,12 @@ void LauncherDialog::loadRom()
instance().frameBuffer().showMessage(result, MessagePosition::MiddleCenter, true);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::setDefaultDir()
{
instance().settings().setValue("romdir", myList->currentDir().getShortPath());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::openSettings()
{

View File

@ -107,6 +107,7 @@ class LauncherDialog : public Dialog
Event::Type getJoyAxisEvent(int stick, JoyAxis axis, JoyDir adir, int button) override;
void loadConfig() override;
void saveConfig() override;
void updateUI();
void applyFiltering();
@ -117,6 +118,7 @@ class LauncherDialog : public Dialog
void loadRomInfo();
void handleContextMenu();
void showOnlyROMs(bool state);
void setDefaultDir();
void openSettings();
private:
@ -130,7 +132,7 @@ class LauncherDialog : public Dialog
unique_ptr<GUI::Font> myROMInfoFont;
ButtonWidget* myStartButton{nullptr};
ButtonWidget* myPrevDirButton{nullptr};
ButtonWidget* myPrevDirButton{nullptr};
ButtonWidget* myOptionsButton{nullptr};
ButtonWidget* myQuitButton{nullptr};
@ -151,10 +153,10 @@ class LauncherDialog : public Dialog
bool myEventHandled{false};
enum {
kAllfilesCmd = 'lalf', // show all files (or ROMs only)
kPrevDirCmd = 'PRVD',
kOptionsCmd = 'OPTI',
kQuitCmd = 'QUIT'
kAllfilesCmd = 'lalf', // show all files (or ROMs only)
kPrevDirCmd = 'PRVD',
kOptionsCmd = 'OPTI',
kQuitCmd = 'QUIT'
};
private:

View File

@ -189,8 +189,14 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
myRomPath = new EditTextWidget(myTab, font, xpos, ypos + 1,
_w - xpos - HBORDER - 2, lineHeight, "");
wid.push_back(myRomPath);
xpos = _w - HBORDER - font.getStringWidth("Follow Launcher path") - 24;
ypos += lineHeight + V_GAP * 2;
myFollowLauncherWidget = new CheckboxWidget(myTab, font, xpos, ypos, "Follow Launcher path");
wid.push_back(myFollowLauncherWidget);
xpos = HBORDER;
ypos += lineHeight + V_GAP * 4;
ypos += V_GAP * 2;
// Launcher width and height
myLauncherWidthSlider = new SliderWidget(myTab, font, xpos, ypos, "Launcher width ",
@ -309,6 +315,9 @@ void UIDialog::loadConfig()
myLauncherWidthSlider->setValue(w);
myLauncherHeightSlider->setValue(h);
// Follow Launcher path
myFollowLauncherWidget->setState(settings.getBool("followlauncher"));
// Launcher font
const string& font = settings.getString("launcherfont");
myLauncherFontPopup->setSelected(font, "medium");
@ -379,6 +388,9 @@ void UIDialog::saveConfig()
// ROM path
settings.setValue("romdir", myRomPath->getText());
// Follow Launcher path
settings.setValue("followlauncher", myFollowLauncherWidget->getState());
// Launcher size
settings.setValue("launcherres",
Common::Size(myLauncherWidthSlider->getValue(),

View File

@ -54,6 +54,7 @@ class UIDialog : public Dialog, public CommandSender
// Launcher options
EditTextWidget* myRomPath{nullptr};
CheckboxWidget* myFollowLauncherWidget{nullptr};
SliderWidget* myLauncherWidthSlider{nullptr};
SliderWidget* myLauncherHeightSlider{nullptr};
PopUpWidget* myLauncherFontPopup{nullptr};