diff --git a/.gitignore b/.gitignore
index e1dce7f74..5483b69cd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,11 +11,12 @@ out
out.pgo
out.pgen
stella
-stella-pgo
-stella-pgo-generate
+stella-pgo
+stella-pgo-generate
*.diff
project.xcworkspace/
xcuserdata/
+.DS_Store
build/
src/macosx/M6502.ins
*.dSYM
@@ -33,4 +34,7 @@ src/**/*.vspx
src/**/**.pdb
Stella.xcscheme
src/tools/fonts/*
-
+*.sym
+a.out
+*.json
+*.sqlite3
diff --git a/Changes.txt b/Changes.txt
index 171fa9160..013c1a57c 100644
--- a/Changes.txt
+++ b/Changes.txt
@@ -16,9 +16,11 @@
* Added high scores saving.
- * Enhanced cut/copy/paste for text editing. (TODO: PromptWidget)
+ * Enhanced cut/copy/paste for text editing (except PromptWidget).
- * Added undo and redo to text editing. (TODO: PromptWidget)
+ * Added undo and redo to text editing (except PromptWidget).
+
+ * Added mouse support for text editing (except PromptWidget).
* Added wildcard support to launcher dialog filter.
@@ -30,10 +32,15 @@
* Added sound to Time Machine playback.
+ * Extended global hotkeys for input devices & ports settings.
+
* Increased sample size for CDFJ+.
* Fixed autofire bug for trackball controllers.
+ * Fixed Stelladaptor/2600'daptor devices sometimes not being assigned
+ correct default mappings.
+
* Codebase now uses C++17 features.
-Have fun!
diff --git a/docs/index.html b/docs/index.html
index 6d2d31351..23ed6905a 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -1561,6 +1561,250 @@
+
+
+ Function |
+ Key (Standard) |
+ Key (macOS) |
+
+
+
+ Decrease joystick deadzone |
+ Shift-Control + F1 |
+ Shift-Control + F1 |
+
+
+ Increase joystick deadzone |
+ Control + F1 |
+ Control + F1 |
+
+
+
+ Decrease analog paddle sensitivity |
+ Shift-Control + F2 |
+ Shift-Control + F2 |
+
+
+ Increase analog paddle sensitivity |
+ Control + F2 |
+ Control + F2 |
+
+
+
+ Decrease analog paddle dejitter averaging |
+ Shift-Control + F3 |
+ Shift-Control + F3 |
+
+
+ Increase analog paddle dejitter averaging |
+ Control + F3 |
+ Control + F3 |
+
+
+
+ Decrease analog paddle dejitter reaction |
+ Shift-Control + F4 |
+ Shift-Control + F4 |
+
+
+ Increase analog paddle dejitter reaction |
+ Control + F4 |
+ Control + F4 |
+
+
+
+ Decrease digital paddle sensitivity |
+ Shift-Control + F5 |
+ Shift-Control + F5 |
+
+
+ Increase digital paddle sensitivity |
+ Control + F5 |
+ Control + F5 |
+
+
+
+ Decrease autofire rate |
+ Shift-Control + a |
+ Shift-Control + a |
+
+
+ Increase autofire rate |
+ Control + a |
+ Control + a |
+
+
+
+ Toggle allowing all four directions on joystick
+ to be pressed simultaneously |
+ Control + F6 |
+ Control + F6 |
+
+
+
+ Toggle use of modifier key combos |
+ Control + F7 |
+ Control + F7 |
+
+
+
+ Swap Stelladaptor/2600-daptor port ordering |
+ Control + 1 |
+ Control + 1 |
+
+
+
+ Select previous controllers emulated by the mouse
+ (all, analog, none) |
+ Shift-Control + F8 |
+ Shift-Control + F8 |
+
+
+ Select next controllers emulated by the mouse
+ (all, analog, none) |
+ Control + F8 |
+ Control + F8 |
+
+
+
+ Decrease mouse paddle sensitivity |
+ Shift-Control + F9 |
+ Shift-Control + F9 |
+
+
+ Increase mouse paddle sensitivity |
+ Control + F9 |
+ Control + F9 |
+
+
+
+ Decrease mouse trackball sensitivity |
+ Shift-Control + F10 |
+ Shift-Control + F10 |
+
+
+ Increase mouse trackball sensitivity |
+ Control + F10 |
+ Control + F10 |
+
+
+
+ Decrease digital and mouse driving controller sensitivity |
+ Shift-Control + F11 |
+ Shift-Control + F11 |
+
+
+ Increase digital and mouse driving controller sensitivity |
+ Control + F11 |
+ Control + F11 |
+
+
+
+ Select previous mouse cursor visiblity option
+ (-UI, -Emulation/-UI, +Emulation/+UI, -Emulation/+UI, +Emulation) |
+ Shift-Control + F12 |
+ Shift-Control + F12 |
+
+
+ Select next mouse cursor visiblity option
+ (-UI, -Emulation/-UI, +Emulation/+UI, -Emulation/+UI, +Emulation) |
+ Control + F12 |
+ Control + F12 |
+
+
+
+ Toggle grab mouse |
+ Control + g |
+ Control + g |
+
+
+
+ Select previous left port controller type |
+ Shift-Control + 2 |
+ Shift-Control + 2 |
+
+
+ Select next left port controller type |
+ Control + 2 |
+ Control + 2 |
+
+
+
+ Select previous right port controller type |
+ Shift-Control + 3 |
+ Shift-Control + 3 |
+
+
+ Select next right port controller type |
+ Control + 3 |
+ Control + 3 |
+
+
+
+ Toggle swap left and right controller ports |
+ Control + 4 |
+ Control + 4 |
+
+
+
+ Toggle swap paddles |
+ Control + 5 |
+ Control + 5 |
+
+
+
+ Decrease horizontal center of paddles |
+ Shift-Control + 6 |
+ Shift-Control + 6 |
+
+
+ Increase horizontal center of paddles |
+ Control + 6 |
+ Control + 6 |
+
+
+
+ Decrease vertical center of paddles |
+ Shift-Control + 7 |
+ Shift-Control + 7 |
+
+
+ Increase vertical center of paddles |
+ Control + 7 |
+ Control + 7 |
+
+
+
+ Switch mouse to previous controller emulation mode(see Controller Properties) |
+ Shift-Control + 0 |
+ Shift-Control + 0 |
+
+
+ Switch mouse to next controller emulation modes(see Controller Properties) |
+ Control + 0 |
+ Control + 0 |
+
+
+
+ Decrease mouse paddle axes range |
+ Shift-Control + 8 |
+ Shift-Control + 8 |
+
+
+ Increase mouse paddle axes range |
+ Control + 8 |
+ Control + 8 |
+
+
+
+
+ These settings can also be changed using Global Keys
+ |
+
+
+
These keys allow selecting and changing settings without having to remember the
- dedicated keys. They keys are grouped by Audio & Video and Debug settings.
+ dedicated keys. They keys are grouped by 'Audio & Video', 'Input Device & Ports' and 'Debug' settings.
Function |
@@ -1729,7 +1973,7 @@
- Only available if UI messages are enabled.
- Currently not available settings are automatically skipped.
- - If a setting was selected via dedicated key, its value can also be changed with the
+
- If a setting was previously selected via a dedicated key, its value can also be changed with the
global keys.
@@ -1743,23 +1987,18 @@
Key (macOS) |
- Load previous game in ROM (multicart ROM, TIA mode) |
+ Load previous game in ROM (multicart ROM) |
Shift-Control + r |
Shift-Control + r |
- Reload current ROM (singlecart ROM, TIA mode)
- Load next game in ROM (multicart ROM, TIA mode) |
+ Reload current ROM (singlecart ROM)
+ Load next game in ROM (multicart ROM) |
Control + r |
Control + r |
- Reload ROM listing (ROM launcher mode) |
- Control + r |
- Control + r |
-
-
- Emulate 'frying' effect (TIA mode) |
+ Emulate 'frying' effect |
Backspace |
Backspace |
@@ -1778,33 +2017,7 @@
Control + t |
Control + t |
-
- Decrease autofire rate |
- Shift-Control + a |
- Shift-Control + a |
-
-
- Increase autofire rate |
- Control + a |
- Control + a |
-
-
- Switch mouse between controller emulation modes(see Controller Properties) |
- Control + 0 |
- Control + 0 |
-
-
- Toggle grab mouse |
- Control + g |
- Control + g |
-
-
-
- Swap Stelladaptor/2600-daptor port ordering |
- Control + 1 |
- Control + 1 |
-
Save continuous PNG snapshots(per interval defined in Snapshot Settings) |
Control-Alt + s |
@@ -2691,7 +2904,7 @@
-psense <number> |
Sensitivity for emulation of paddles when using analog paddles.
- Valid range of values is from 1 to 30, with larger numbers causing
+ Valid range of values is from 0 to 30, with larger numbers causing
faster movement. |
@@ -2706,8 +2919,9 @@
- -dcsense <number> |
- Sensitivity for emulation of driving controllers when using a mouse.
+ | -dsense <number> |
+ Sensitivity for emulation of paddles when using a digital device
+ (i.e. joystick digital axis or button, keyboard key, etc.).
Valid range of values is from 1 to 20, with larger numbers causing
faster movement. |
@@ -2767,11 +2981,10 @@
- -dsense <number> |
- Sensitivity for emulation of paddles when using a digital device
- (ie, joystick digital axis or button, keyboard key, etc.).
- Valid range of values is from 1 to 20, with larger numbers causing
- faster movement. |
+ -dcsense <number> |
+ Sensitivity for emulation of driving controllers when using a mouse
+ or a digital device. Valid range of values is from 1 to 20, with larger
+ numbers causing faster movement. |
@@ -3684,8 +3897,10 @@
Item | Brief description | For more information, see Command Line |
Joystick deadzone size | Deadzone area for axes on joysticks/gamepads | -joydeadzone |
(Analog paddle) Sensitivity | Sensitivity of an analog paddle | -psense |
- Analog paddle) Dejitter averaging | Strength of paddle input averaging, suppresses mouse jitter | -dejitter.base |
- (Analog paddle) Dejitter reaction | Strength of paddle reaction to fast paddle movements, suppresses mouse jitter | -dejitter.diff |
+ (Analog paddle) Dejitter averaging | Strength of paddle input averaging, suppresses paddle jitter.
+ Note: The 2600-daptor has built-in dejitter, so there should be no need to use Stella's dejitter.
+ | -dejitter.base |
+ (Analog paddle) Dejitter reaction | Strength of paddle reaction to fast paddle movements, suppresses paddle jitter. | -dejitter.diff |
Digital paddle sensitivity | Sensitivity used when emulating a paddle using a digital device | -dsense |
Autofire rate | Automatic trigger rate of the fire buttons in Hz | -autofirerate |
Allow all 4 directions ... | Allow all 4 joystick directions to be pressed simultaneously | -joyallow4 |
@@ -3710,7 +3925,7 @@
Use mouse as ... | Allow the mouse to emulate various controllers | -usemouse |
(Sensitivity) Paddle | Sensitivity used when emulating a paddle using a mouse | -msense |
(Sensitivity) Trackball | Sensitivity used when emulating a trackball device using a mouse | -tsense |
- (Sensitivity) Driving controller | Sensitivity used when emulating a driving controller device using a mouse | -dcsense |
+ (Sensitivity) Driving controller | Sensitivity used when emulating a driving controller device using a mouse or a digital device | -dcsense |
Mouse cursor visibility | Show/hide cursor depending on current state | -cursor |
Grab mouse ... | Keep mouse in window in emulation mode (only when used as controller)
Note: The sensitivity may greatly vary when the mouse is not grabbed. | -grabmouse |
@@ -3787,7 +4002,7 @@
The ROM launcher also contains a context menu, selected by clicking the
- right mouse button anywhere in the current window. This context menu
+ right mouse button in the ROM list. This context menu
contains the following items:
@@ -3798,29 +4013,32 @@
its functionality, and use ROM properties as defined by the ROM itself. The dialog is as
follows (see Advanced Configuration - Game Properties
for more information concerning ROM properties):
-
-
-  |
- |
-
-
- Item | For more information, see Commandline |
- Bankswitch type | -bs |
- TV type | -tv |
- Left difficulty | -ld |
- Right difficulty | -rd |
- Startup mode | -debug |
- Left joy items | -holdjoy0 |
- Right joy items | -holdjoy1 |
- Console: Select | -holdselect |
- Console: Reset | -holdreset |
-
-
- |
-
-
+
+
+  |
+ |
+
+
+ Item | For more information, see Commandline |
+ Bankswitch type | -bs |
+ TV type | -tv |
+ Left difficulty | -ld |
+ Right difficulty | -rd |
+ Startup mode | -debug |
+ Left joy items | -holdjoy0 |
+ Right joy items | -holdjoy1 |
+ Console: Select | -holdselect |
+ Console: Reset | -holdreset |
+
+
+ |
+
+
+ This dialog can also be opened by pressing 'Control + p'.
-
- High scores: This option displays the High Scores dialog for the selected ROM.
+ - High scores: This option displays the
+ High Scores dialog for the selected ROM. Only available if high score
+ properties have been setup for the ROM. Also available via 'Control + h' keys combo.
- Reload listing: Selecting this performs a reload of the
current listing. It is an alternative to pressing the 'Control + r'
@@ -4133,7 +4351,7 @@
- Developer key-combo shortcuts, used to change TIA state dynamically
(ie, while the emulation is still running). See Keyboard Layout -
- Developer Keys in TIA mode for more information.
+ Developer Keys for more information.
- Commandline options influencing emulation state. See Using the Command Line -
Developer Commands for more information.
diff --git a/src/cheat/CheatManager.cxx b/src/cheat/CheatManager.cxx
index 62834abb2..2a2eeb7e1 100644
--- a/src/cheat/CheatManager.cxx
+++ b/src/cheat/CheatManager.cxx
@@ -28,7 +28,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CheatManager::CheatManager(OSystem& osystem)
- : myOSystem(osystem)
+ : myOSystem{osystem}
{
}
diff --git a/src/cheat/CheetahCheat.cxx b/src/cheat/CheetahCheat.cxx
index eb19e8843..88c1e1fa1 100644
--- a/src/cheat/CheetahCheat.cxx
+++ b/src/cheat/CheetahCheat.cxx
@@ -23,9 +23,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CheetahCheat::CheetahCheat(OSystem& os, const string& name, const string& code)
: Cheat(os, name, code),
- address(0xf000 + unhex(code.substr(0, 3))),
- value(uInt8(unhex(code.substr(3, 2)))),
- count(uInt8(unhex(code.substr(5, 1)) + 1))
+ address{uInt16(0xf000 + unhex(code.substr(0, 3)))},
+ value{uInt8(unhex(code.substr(3, 2)))},
+ count{uInt8(unhex(code.substr(5, 1)) + 1)}
{
// Back up original data; we need this if the cheat is ever disabled
for(int i = 0; i < count; ++i)
diff --git a/src/cheat/RamCheat.cxx b/src/cheat/RamCheat.cxx
index 81ff4b560..41297d798 100644
--- a/src/cheat/RamCheat.cxx
+++ b/src/cheat/RamCheat.cxx
@@ -25,8 +25,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RamCheat::RamCheat(OSystem& os, const string& name, const string& code)
: Cheat(os, name, code),
- address(uInt16(unhex(myCode.substr(0, 2)))),
- value(uInt8(unhex(myCode.substr(2, 2))))
+ address{uInt16(unhex(myCode.substr(0, 2)))},
+ value{uInt8(unhex(myCode.substr(2, 2)))}
{
}
diff --git a/src/common/AudioQueue.cxx b/src/common/AudioQueue.cxx
index b50bdd03e..9323fe4af 100644
--- a/src/common/AudioQueue.cxx
+++ b/src/common/AudioQueue.cxx
@@ -22,10 +22,10 @@ using std::lock_guard;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AudioQueue::AudioQueue(uInt32 fragmentSize, uInt32 capacity, bool isStereo)
- : myFragmentSize(fragmentSize),
- myIsStereo(isStereo),
- myFragmentQueue(capacity),
- myAllFragments(capacity + 2)
+ : myFragmentSize{fragmentSize},
+ myIsStereo{isStereo},
+ myFragmentQueue{capacity},
+ myAllFragments{capacity + 2}
{
const uInt8 sampleSize = myIsStereo ? 2 : 1;
@@ -48,7 +48,7 @@ uInt32 AudioQueue::capacity() const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-uInt32 AudioQueue::size()
+uInt32 AudioQueue::size() const
{
lock_guard guard(myMutex);
diff --git a/src/common/AudioQueue.hxx b/src/common/AudioQueue.hxx
index e07d09536..3ce4f031c 100644
--- a/src/common/AudioQueue.hxx
+++ b/src/common/AudioQueue.hxx
@@ -55,7 +55,7 @@ class AudioQueue
/**
Size getter.
*/
- uInt32 size();
+ uInt32 size() const;
/**
Stereo / mono getter.
@@ -120,7 +120,7 @@ class AudioQueue
uInt32 myNextFragment{0};
// We need a mutex for thread safety.
- std::mutex myMutex;
+ mutable std::mutex myMutex;
// The first (empty) enqueue call returns this fragment.
Int16* myFirstFragmentForEnqueue{nullptr};
diff --git a/src/common/AudioSettings.cxx b/src/common/AudioSettings.cxx
index 6f67d3d0a..04508a1a0 100644
--- a/src/common/AudioSettings.cxx
+++ b/src/common/AudioSettings.cxx
@@ -43,7 +43,7 @@ namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AudioSettings::AudioSettings(Settings& settings)
- : mySettings(settings)
+ : mySettings{settings}
{
setPreset(normalizedPreset(mySettings.getInt(SETTING_PRESET)));
}
diff --git a/src/common/AudioSettings.hxx b/src/common/AudioSettings.hxx
index 1e9f0477f..d946f204e 100644
--- a/src/common/AudioSettings.hxx
+++ b/src/common/AudioSettings.hxx
@@ -129,13 +129,13 @@ class AudioSettings
Settings& mySettings;
- Preset myPreset;
+ Preset myPreset{Preset::custom};
uInt32 myPresetSampleRate{0};
uInt32 myPresetFragmentSize{0};
uInt32 myPresetBufferSize{0};
uInt32 myPresetHeadroom{0};
- ResamplingQuality myPresetResamplingQuality;
+ ResamplingQuality myPresetResamplingQuality{ResamplingQuality::nearestNeightbour};
bool myIsPersistent{true};
};
diff --git a/src/common/EventHandlerSDL2.cxx b/src/common/EventHandlerSDL2.cxx
index 86d4dad89..f03fb1728 100644
--- a/src/common/EventHandlerSDL2.cxx
+++ b/src/common/EventHandlerSDL2.cxx
@@ -23,7 +23,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventHandlerSDL2::EventHandlerSDL2(OSystem& osystem)
- : EventHandler(osystem)
+ : EventHandler{osystem}
{
ASSERT_MAIN_THREAD;
diff --git a/src/common/FBBackendSDL2.cxx b/src/common/FBBackendSDL2.cxx
index 643c099e9..f2738be39 100644
--- a/src/common/FBBackendSDL2.cxx
+++ b/src/common/FBBackendSDL2.cxx
@@ -31,7 +31,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FBBackendSDL2::FBBackendSDL2(OSystem& osystem)
- : myOSystem(osystem)
+ : myOSystem{osystem}
{
ASSERT_MAIN_THREAD;
@@ -39,9 +39,8 @@ FBBackendSDL2::FBBackendSDL2(OSystem& osystem)
if(SDL_InitSubSystem(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0)
{
ostringstream buf;
- buf << "ERROR: Couldn't initialize SDL: " << SDL_GetError() << endl;
- Logger::error(buf.str());
- throw runtime_error("FATAL ERROR");
+ buf << "ERROR: Couldn't initialize SDL: " << SDL_GetError();
+ throw runtime_error(buf.str());
}
Logger::debug("FBBackendSDL2::FBBackendSDL2 SDL_Init()");
diff --git a/src/common/FBSurfaceSDL2.cxx b/src/common/FBSurfaceSDL2.cxx
index 7f0ddb7d7..4b3b674c8 100644
--- a/src/common/FBSurfaceSDL2.cxx
+++ b/src/common/FBSurfaceSDL2.cxx
@@ -45,8 +45,8 @@ FBSurfaceSDL2::FBSurfaceSDL2(FBBackendSDL2& backend,
uInt32 width, uInt32 height,
ScalingInterpolation inter,
const uInt32* staticData)
- : myBackend(backend),
- myInterpolationMode(inter)
+ : myBackend{backend},
+ myInterpolationMode{inter}
{
createSurface(width, height, staticData);
}
diff --git a/src/common/FSNodeZIP.cxx b/src/common/FSNodeZIP.cxx
index 7bd88efc0..9edc19beb 100644
--- a/src/common/FSNodeZIP.cxx
+++ b/src/common/FSNodeZIP.cxx
@@ -94,8 +94,8 @@ FilesystemNodeZIP::FilesystemNodeZIP(const string& p)
FilesystemNodeZIP::FilesystemNodeZIP(
const string& zipfile, const string& virtualpath,
const AbstractFSNodePtr& realnode, bool isdir)
- : _isDirectory(isdir),
- _isFile(!isdir)
+ : _isDirectory{isdir},
+ _isFile{!isdir}
{
setFlags(zipfile, virtualpath, realnode);
}
diff --git a/src/common/FpsMeter.cxx b/src/common/FpsMeter.cxx
index 878a42ae0..b9996a16e 100644
--- a/src/common/FpsMeter.cxx
+++ b/src/common/FpsMeter.cxx
@@ -21,7 +21,7 @@ using namespace std::chrono;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FpsMeter::FpsMeter(uInt32 queueSize)
- : myQueue(queueSize)
+ : myQueue{queueSize}
{
reset();
}
diff --git a/src/common/HighScoresManager.cxx b/src/common/HighScoresManager.cxx
index 492ada82b..4cb4add9f 100644
--- a/src/common/HighScoresManager.cxx
+++ b/src/common/HighScoresManager.cxx
@@ -60,7 +60,7 @@ using Common::Base;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HighScoresManager::HighScoresManager(OSystem& osystem)
- : myOSystem(osystem)
+ : myOSystem{osystem}
{
}
diff --git a/src/common/HighScoresManager.hxx b/src/common/HighScoresManager.hxx
index 6768840c4..3b293c172 100644
--- a/src/common/HighScoresManager.hxx
+++ b/src/common/HighScoresManager.hxx
@@ -92,7 +92,7 @@ namespace HSM {
class HighScoresManager
{
public:
- HighScoresManager(OSystem& osystem);
+ explicit HighScoresManager(OSystem& osystem);
virtual ~HighScoresManager() = default;
diff --git a/src/common/JoyMap.cxx b/src/common/JoyMap.cxx
index c2f20362e..8c8522e2f 100644
--- a/src/common/JoyMap.cxx
+++ b/src/common/JoyMap.cxx
@@ -196,9 +196,6 @@ json JoyMap::saveMapping(const EventMode mode) const
[](const MapType& a, const MapType& b)
{
// Event::Type first
- if(a.second != b.second)
- return a.second < b.second;
-
if(a.first.button != b.first.button)
return a.first.button < b.first.button;
@@ -211,7 +208,10 @@ json JoyMap::saveMapping(const EventMode mode) const
if(a.first.hat != b.first.hat)
return a.first.hat < b.first.hat;
+ if(a.first.hdir != b.first.hdir)
return a.first.hdir < b.first.hdir;
+
+ return a.second < b.second;
}
);
diff --git a/src/common/JoyMap.hxx b/src/common/JoyMap.hxx
index 9b77b09a1..d6fb76096 100644
--- a/src/common/JoyMap.hxx
+++ b/src/common/JoyMap.hxx
@@ -44,19 +44,19 @@ class JoyMap
explicit JoyMapping(EventMode c_mode, int c_button,
JoyAxis c_axis, JoyDir c_adir,
int c_hat, JoyHatDir c_hdir)
- : mode(c_mode), button(c_button),
- axis(c_axis), adir(c_adir),
- hat(c_hat), hdir(c_hdir) { }
+ : mode{c_mode}, button{c_button},
+ axis{c_axis}, adir{c_adir},
+ hat{c_hat}, hdir{c_hdir} { }
explicit JoyMapping(EventMode c_mode, int c_button,
JoyAxis c_axis, JoyDir c_adir)
- : mode(c_mode), button(c_button),
- axis(c_axis), adir(c_adir),
- hat(JOY_CTRL_NONE), hdir(JoyHatDir::CENTER) { }
+ : mode{c_mode}, button{c_button},
+ axis{c_axis}, adir{c_adir},
+ hat{JOY_CTRL_NONE}, hdir{JoyHatDir::CENTER} { }
explicit JoyMapping(EventMode c_mode, int c_button,
int c_hat, JoyHatDir c_hdir)
- : mode(c_mode), button(c_button),
- axis(JoyAxis::NONE), adir(JoyDir::NONE),
- hat(c_hat), hdir(c_hdir) { }
+ : mode{c_mode}, button{c_button},
+ axis{JoyAxis::NONE}, adir{JoyDir::NONE},
+ hat{c_hat}, hdir{c_hdir} { }
JoyMapping(const JoyMapping&) = default;
JoyMapping& operator=(const JoyMapping&) = default;
diff --git a/src/common/KeyMap.cxx b/src/common/KeyMap.cxx
index 6fdc28ffc..c61f3d5f2 100644
--- a/src/common/KeyMap.cxx
+++ b/src/common/KeyMap.cxx
@@ -228,13 +228,13 @@ json KeyMap::saveMapping(const EventMode mode) const
[](const MapType& a, const MapType& b)
{
// Event::Type first
- if(a.second != b.second)
- return a.second < b.second;
-
if(a.first.key != b.first.key)
return a.first.key < b.first.key;
- return a.first.mod < b.first.mod;
+ if(a.first.mod != b.first.mod)
+ return a.first.mod < b.first.mod;
+
+ return a.second < b.second;
}
);
@@ -300,7 +300,8 @@ json KeyMap::convertLegacyMapping(string list)
mapping["event"] = Event::Type(event);
mapping["key"] = StellaKey(key);
- if(StellaMod(mod) != StellaMod::KBDM_NONE) mapping["mod"] = StellaMod(mod);
+ if(StellaMod(mod) != StellaMod::KBDM_NONE)
+ mapping["mod"] = serializeModkeyMask(StellaMod(mod));
convertedMapping.push_back(mapping);
}
diff --git a/src/common/KeyMap.hxx b/src/common/KeyMap.hxx
index 0a067eead..6c9266c72 100644
--- a/src/common/KeyMap.hxx
+++ b/src/common/KeyMap.hxx
@@ -39,9 +39,9 @@ class KeyMap
StellaMod mod{StellaMod(0)};
explicit Mapping(EventMode c_mode, StellaKey c_key, StellaMod c_mod)
- : mode(c_mode), key(c_key), mod(c_mod) { }
+ : mode{c_mode}, key{c_key}, mod{c_mod} { }
explicit Mapping(EventMode c_mode, int c_key, int c_mod)
- : mode(c_mode), key(StellaKey(c_key)), mod(StellaMod(c_mod)) { }
+ : mode{c_mode}, key{StellaKey(c_key)}, mod{StellaMod(c_mod)} { }
Mapping(const Mapping&) = default;
Mapping& operator=(const Mapping&) = default;
Mapping(Mapping&&) = default;
diff --git a/src/common/MouseControl.cxx b/src/common/MouseControl.cxx
index ee960c6bb..3e19fe8ee 100644
--- a/src/common/MouseControl.cxx
+++ b/src/common/MouseControl.cxx
@@ -24,9 +24,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MouseControl::MouseControl(Console& console, const string& mode)
- : myProps(console.properties()),
- myLeftController(console.leftController()),
- myRightController(console.rightController())
+ : myProps{console.properties()},
+ myLeftController{console.leftController()},
+ myRightController{console.rightController()}
{
istringstream m_axis(mode);
string m_mode;
@@ -137,13 +137,17 @@ MouseControl::MouseControl(Console& console, const string& mode)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-const string& MouseControl::next()
+const string& MouseControl::change(int direction)
{
+ myCurrentModeNum = BSPF::clampw(myCurrentModeNum + direction, 0, int(myModeList.size() - 1));
const MouseMode& mode = myModeList[myCurrentModeNum];
- myCurrentModeNum = (myCurrentModeNum + 1) % myModeList.size();
- myLeftController.setMouseControl(mode.xtype, mode.xid, mode.ytype, mode.yid);
- myRightController.setMouseControl(mode.xtype, mode.xid, mode.ytype, mode.yid);
+ bool leftControl =
+ myLeftController.setMouseControl(mode.xtype, mode.xid, mode.ytype, mode.yid);
+ bool rightControl =
+ myRightController.setMouseControl(mode.xtype, mode.xid, mode.ytype, mode.yid);
+
+ myHasMouseControl = leftControl || rightControl;
return mode.message;
}
diff --git a/src/common/MouseControl.hxx b/src/common/MouseControl.hxx
index 946e2770c..e94be674a 100644
--- a/src/common/MouseControl.hxx
+++ b/src/common/MouseControl.hxx
@@ -62,7 +62,12 @@ class MouseControl
@return A message explaining the current mouse mode
*/
- const string& next();
+ const string& change(int direction = +1);
+
+ /**
+ Get whether any current controller supports mouse control
+ */
+ bool hasMouseControl() const { return myHasMouseControl; }
private:
void addLeftControllerModes(bool noswap);
@@ -101,6 +106,7 @@ class MouseControl
int myCurrentModeNum{0};
vector myModeList;
+ bool myHasMouseControl{false};
private:
// Following constructors and assignment operators not supported
diff --git a/src/common/PJoystickHandler.cxx b/src/common/PJoystickHandler.cxx
index e0ebb55f1..174bb405f 100644
--- a/src/common/PJoystickHandler.cxx
+++ b/src/common/PJoystickHandler.cxx
@@ -19,6 +19,9 @@
#include "OSystem.hxx"
#include "Console.hxx"
#include "Joystick.hxx"
+#include "Paddles.hxx"
+#include "PointingDevice.hxx"
+#include "Driving.hxx"
#include "Settings.hxx"
#include "EventHandler.hxx"
#include "PJoystickHandler.hxx"
@@ -33,8 +36,8 @@ using json = nlohmann::json;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PhysicalJoystickHandler::PhysicalJoystickHandler(
OSystem& system, EventHandler& handler)
- : myOSystem(system),
- myHandler(handler)
+ : myOSystem{system},
+ myHandler{handler}
{
if(myOSystem.settings().getInt("event_ver") != Event::VERSION) {
Logger::info("event version mismatch; dropping previous joystick mappings");
@@ -132,12 +135,13 @@ int PhysicalJoystickHandler::add(const PhysicalJoystickPtr& stick)
name << stick->name << " #" << count+1;
stick->name = name.str();
}
- stick->type = PhysicalJoystick::JT_REGULAR;
+ stick->type = PhysicalJoystick::Type::REGULAR;
}
// The stick *must* be inserted here, since it may be used below
mySticks[stick->ID] = stick;
// Map the stelladaptors we've found according to the specified ports
+ // The 'type' is also set there
if(specialAdaptor)
mapStelladaptors(myOSystem.settings().getString("saport"));
@@ -236,12 +240,12 @@ void PhysicalJoystickHandler::mapStelladaptors(const string& saport)
if(saOrder[saCount] == 1)
{
_joyptr->name += " (emulates left joystick port)";
- _joyptr->type = PhysicalJoystick::JT_STELLADAPTOR_LEFT;
+ _joyptr->type = PhysicalJoystick::Type::LEFT_STELLADAPTOR;
}
else if(saOrder[saCount] == 2)
{
_joyptr->name += " (emulates right joystick port)";
- _joyptr->type = PhysicalJoystick::JT_STELLADAPTOR_RIGHT;
+ _joyptr->type = PhysicalJoystick::Type::RIGHT_STELLADAPTOR;
}
saCount++;
}
@@ -250,12 +254,12 @@ void PhysicalJoystickHandler::mapStelladaptors(const string& saport)
if(saOrder[saCount] == 1)
{
_joyptr->name += " (emulates left joystick port)";
- _joyptr->type = PhysicalJoystick::JT_2600DAPTOR_LEFT;
+ _joyptr->type = PhysicalJoystick::Type::LEFT_2600DAPTOR;
}
else if(saOrder[saCount] == 2)
{
_joyptr->name += " (emulates right joystick port)";
- _joyptr->type = PhysicalJoystick::JT_2600DAPTOR_RIGHT;
+ _joyptr->type = PhysicalJoystick::Type::RIGHT_2600DAPTOR;
}
saCount++;
}
@@ -263,6 +267,24 @@ void PhysicalJoystickHandler::mapStelladaptors(const string& saport)
myOSystem.settings().setValue("saport", saport);
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool PhysicalJoystickHandler::hasStelladaptors() const
+{
+ for(auto& [_id, _joyptr] : mySticks)
+ {
+ // remove previously added emulated ports
+ size_t pos = _joyptr->name.find(" (emulates ");
+
+ if(pos != std::string::npos)
+ _joyptr->name.erase(pos);
+
+ if(BSPF::startsWithIgnoreCase(_joyptr->name, "Stelladaptor")
+ || BSPF::startsWithIgnoreCase(_joyptr->name, "2600-daptor"))
+ return true;
+ }
+ return false;
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Depending on parameters, this method does the following:
// 1. update all events with default (event == Event::NoType, updateDefault == true)
@@ -313,7 +335,15 @@ void PhysicalJoystickHandler::setStickDefaultMapping(int stick, Event::Type even
switch (mode)
{
case EventMode::kEmulationMode:
- if((stick % 2) == 0) // even sticks
+ {
+ // A regular joystick defaults to left or right based on the
+ // stick number being even or odd; 'daptor joysticks request a
+ // specific port
+ const bool useLeftMappings =
+ j->type == PhysicalJoystick::Type::REGULAR ? ((stick % 2) == 0) :
+ (j->type == PhysicalJoystick::Type::LEFT_STELLADAPTOR ||
+ j->type == PhysicalJoystick::Type::LEFT_2600DAPTOR);
+ if(useLeftMappings)
{
// put all controller events into their own mode's mappings
for (const auto& item : DefaultLeftJoystickMapping)
@@ -323,7 +353,7 @@ void PhysicalJoystickHandler::setStickDefaultMapping(int stick, Event::Type even
for (const auto& item : DefaultLeftKeypadMapping)
setDefaultAction(stick, item, event, EventMode::kKeypadMode, updateDefaults);
}
- else // odd sticks
+ else
{
// put all controller events into their own mode's mappings
for (const auto& item : DefaultRightJoystickMapping)
@@ -338,6 +368,7 @@ void PhysicalJoystickHandler::setStickDefaultMapping(int stick, Event::Type even
// update running emulation mapping too
enableEmulationMappings();
break;
+ }
case EventMode::kMenuMode:
for (const auto& item : DefaultMenuMapping)
@@ -840,6 +871,147 @@ ostream& operator<<(ostream& os, const PhysicalJoystickHandler& jh)
return os;
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void PhysicalJoystickHandler::changeDeadzone(int direction)
+{
+ int deadzone = BSPF::clamp(myOSystem.settings().getInt("joydeadzone") + direction,
+ Joystick::DEAD_ZONE_MIN, Joystick::DEAD_ZONE_MAX);
+ myOSystem.settings().setValue("joydeadzone", deadzone);
+
+ Joystick::setDeadZone(deadzone);
+
+ int value = Joystick::deadZoneValue(deadzone);
+
+ myOSystem.frameBuffer().showGaugeMessage("Joystick deadzone", std::to_string(value),
+ value, 3200, 32200);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void PhysicalJoystickHandler::changeAnalogPaddleSensitivity(int direction)
+{
+ int sense = BSPF::clamp(myOSystem.settings().getInt("psense") + direction,
+ Paddles::MIN_ANALOG_SENSE, Paddles::MAX_ANALOG_SENSE);
+ myOSystem.settings().setValue("psense", sense);
+
+ Paddles::setAnalogSensitivity(sense);
+
+ ostringstream ss;
+ ss << std::round(Paddles::analogSensitivityValue(sense) * 100.F) << "%";
+ myOSystem.frameBuffer().showGaugeMessage("Analog paddle sensitivity", ss.str(), sense,
+ Paddles::MIN_ANALOG_SENSE, Paddles::MAX_ANALOG_SENSE);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void PhysicalJoystickHandler::changePaddleDejitterAveraging(int direction)
+{
+ int dejitter = BSPF::clamp(myOSystem.settings().getInt("dejitter.base") + direction,
+ Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER);
+ myOSystem.settings().setValue("dejitter.base", dejitter);
+
+ Paddles::setDejitterBase(dejitter);
+
+ ostringstream ss;
+ if(dejitter)
+ ss << dejitter;
+ else
+ ss << "Off";
+
+ myOSystem.frameBuffer().showGaugeMessage("Analog paddle dejitter averaging",
+ ss.str(), dejitter,
+ Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void PhysicalJoystickHandler::changePaddleDejitterReaction(int direction)
+{
+ int dejitter = BSPF::clamp(myOSystem.settings().getInt("dejitter.diff") + direction,
+ Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER);
+ myOSystem.settings().setValue("dejitter.diff", dejitter);
+
+ Paddles::setDejitterDiff(dejitter);
+
+ ostringstream ss;
+ if(dejitter)
+ ss << dejitter;
+ else
+ ss << "Off";
+
+ myOSystem.frameBuffer().showGaugeMessage("Analog paddle dejitter reaction",
+ ss.str(), dejitter,
+ Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void PhysicalJoystickHandler::changeDigitalPaddleSensitivity(int direction)
+{
+ int sense = BSPF::clamp(myOSystem.settings().getInt("dsense") + direction,
+ Paddles::MIN_DIGITAL_SENSE, Paddles::MAX_DIGITAL_SENSE);
+ myOSystem.settings().setValue("dsense", sense);
+
+ Paddles::setDigitalSensitivity(sense);
+
+ ostringstream ss;
+ if(sense)
+ ss << sense * 10 << "%";
+ else
+ ss << "Off";
+
+ myOSystem.frameBuffer().showGaugeMessage("Digital sensitivity",
+ ss.str(), sense,
+ Paddles::MIN_DIGITAL_SENSE, Paddles::MAX_DIGITAL_SENSE);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void PhysicalJoystickHandler::changeMousePaddleSensitivity(int direction)
+{
+ int sense = BSPF::clamp(myOSystem.settings().getInt("msense") + direction,
+ Paddles::MIN_MOUSE_SENSE, Paddles::MAX_MOUSE_SENSE);
+ myOSystem.settings().setValue("msense", sense);
+
+ Paddles::setMouseSensitivity(sense);
+
+ ostringstream ss;
+ ss << sense * 10 << "%";
+
+ myOSystem.frameBuffer().showGaugeMessage("Mouse paddle sensitivity",
+ ss.str(), sense,
+ Paddles::MIN_MOUSE_SENSE, Paddles::MAX_MOUSE_SENSE);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void PhysicalJoystickHandler::changeMouseTrackballSensitivity(int direction)
+{
+ int sense = BSPF::clamp(myOSystem.settings().getInt("tsense") + direction,
+ PointingDevice::MIN_SENSE, PointingDevice::MAX_SENSE);
+ myOSystem.settings().setValue("tsense", sense);
+
+ PointingDevice::setSensitivity(sense);
+
+ ostringstream ss;
+ ss << sense * 10 << "%";
+
+ myOSystem.frameBuffer().showGaugeMessage("Mouse trackball sensitivity",
+ ss.str(), sense,
+ PointingDevice::MIN_SENSE, PointingDevice::MAX_SENSE);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void PhysicalJoystickHandler::changeDrivingSensitivity(int direction)
+{
+ int sense = BSPF::clamp(myOSystem.settings().getInt("dcsense") + direction,
+ Driving::MIN_SENSE, Driving::MAX_SENSE);
+ myOSystem.settings().setValue("dcsense", sense);
+
+ Driving::setSensitivity(sense);
+
+ ostringstream ss;
+ ss << sense * 10 << "%";
+
+ myOSystem.frameBuffer().showGaugeMessage("Driving controller sensitivity",
+ ss.str(), sense,
+ Driving::MIN_SENSE, Driving::MAX_SENSE);
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PhysicalJoystickHandler::EventMappingArray PhysicalJoystickHandler::DefaultLeftJoystickMapping = {
// Left joystick (assume buttons zero..two)
@@ -953,7 +1125,8 @@ PhysicalJoystickHandler::EventMappingArray PhysicalJoystickHandler::DefaultRight
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-PhysicalJoystickHandler::EventMappingArray PhysicalJoystickHandler::DefaultCommonMapping = {
+PhysicalJoystickHandler::EventMappingArray
+PhysicalJoystickHandler::DefaultCommonMapping = {
// valid for all joysticks
//#if defined(RETRON77)
{Event::CmdMenuMode, 3}, // Note: buttons 0..2 are used by controllers!
@@ -966,7 +1139,8 @@ PhysicalJoystickHandler::EventMappingArray PhysicalJoystickHandler::DefaultCommo
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-PhysicalJoystickHandler::EventMappingArray PhysicalJoystickHandler::DefaultMenuMapping = {
+PhysicalJoystickHandler::EventMappingArray
+PhysicalJoystickHandler::DefaultMenuMapping = {
// valid for all joysticks
{Event::UISelect, 0},
{Event::UIOK, 1},
diff --git a/src/common/PJoystickHandler.hxx b/src/common/PJoystickHandler.hxx
index ebdec580e..017479ceb 100644
--- a/src/common/PJoystickHandler.hxx
+++ b/src/common/PJoystickHandler.hxx
@@ -50,7 +50,7 @@ class PhysicalJoystickHandler
struct StickInfo
{
StickInfo(const nlohmann::json& map = nullptr, PhysicalJoystickPtr stick = nullptr)
- : mapping(map), joy(std::move(stick)) {}
+ : mapping{map}, joy{std::move(stick)} { }
nlohmann::json mapping;
PhysicalJoystickPtr joy;
@@ -71,6 +71,7 @@ class PhysicalJoystickHandler
bool remove(int id);
bool remove(const string& name);
void mapStelladaptors(const string& saport);
+ bool hasStelladaptors() const;
void setDefaultMapping(Event::Type type, EventMode mode);
/** define mappings for current controllers */
@@ -109,6 +110,15 @@ class PhysicalJoystickHandler
/** Returns a list of pairs consisting of joystick name and associated ID. */
VariantList database() const;
+ void changeDeadzone(int direction = +1);
+ void changeAnalogPaddleSensitivity(int direction = +1);
+ void changePaddleDejitterAveraging(int direction = +1);
+ void changePaddleDejitterReaction(int direction = +1);
+ void changeDigitalPaddleSensitivity(int direction = +1);
+ void changeMousePaddleSensitivity(int direction = +1);
+ void changeMouseTrackballSensitivity(int direction = +1);
+ void changeDrivingSensitivity(int direction = +1);
+
private:
using StickDatabase = std::map;
using StickList = std::map;
diff --git a/src/common/PKeyboardHandler.cxx b/src/common/PKeyboardHandler.cxx
index bf3284099..5032afd66 100644
--- a/src/common/PKeyboardHandler.cxx
+++ b/src/common/PKeyboardHandler.cxx
@@ -40,8 +40,8 @@ static constexpr int MOD3 = KBDM_ALT;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PhysicalKeyboardHandler::PhysicalKeyboardHandler(OSystem& system, EventHandler& handler)
- : myOSystem(system),
- myHandler(handler)
+ : myOSystem{system},
+ myHandler{handler}
{
Int32 version = myOSystem.settings().getInt("event_ver");
bool updateDefaults = false;
@@ -480,161 +480,215 @@ void PhysicalKeyboardHandler::handleEvent(StellaKey key, StellaMod mod,
}
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void PhysicalKeyboardHandler::toggleModKeys(bool toggle)
+{
+ bool modCombo = myOSystem.settings().getBool("modcombo");
+
+ if(toggle)
+ {
+ modCombo = !modCombo;
+ myKeyMap.enableMod() = modCombo;
+ myOSystem.settings().setValue("modcombo", modCombo);
+ }
+
+ ostringstream ss;
+ ss << "Modifier key combos ";
+ ss << (modCombo ? "enabled" : "disabled");
+ myOSystem.frameBuffer().showTextMessage(ss.str());
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PhysicalKeyboardHandler::EventMappingArray
PhysicalKeyboardHandler::DefaultCommonMapping = {
- {Event::ConsoleSelect, KBDK_F1},
- {Event::ConsoleReset, KBDK_F2},
- {Event::ConsoleColor, KBDK_F3},
- {Event::Console7800Pause, KBDK_F3, MOD3},
- {Event::ConsoleLeftDiffA, KBDK_F5},
- {Event::ConsoleRightDiffA, KBDK_F7},
- {Event::SaveState, KBDK_F9},
- {Event::SaveAllStates, KBDK_F9, MOD3},
- {Event::PreviousState, KBDK_F10, KBDM_SHIFT},
- {Event::NextState, KBDK_F10},
- {Event::ToggleAutoSlot, KBDK_F10, MOD3},
- {Event::LoadState, KBDK_F11},
- {Event::LoadAllStates, KBDK_F11, MOD3},
- {Event::TakeSnapshot, KBDK_F12},
-#ifdef BSPF_MACOS
- {Event::TogglePauseMode, KBDK_P, KBDM_SHIFT | MOD3},
-#else
- {Event::TogglePauseMode, KBDK_PAUSE},
-#endif
- {Event::OptionsMenuMode, KBDK_TAB},
- {Event::CmdMenuMode, KBDK_BACKSLASH},
- {Event::TimeMachineMode, KBDK_T, KBDM_SHIFT},
- {Event::DebuggerMode, KBDK_GRAVE},
- {Event::ExitMode, KBDK_ESCAPE},
-#ifdef BSPF_MACOS
- {Event::Quit, KBDK_Q, MOD3},
-#else
- {Event::Quit, KBDK_Q, KBDM_CTRL},
-#endif
- {Event::ReloadConsole, KBDK_R, KBDM_CTRL},
- {Event::PreviousMultiCartRom, KBDK_R, KBDM_SHIFT | KBDM_CTRL},
+ { Event::ConsoleSelect, KBDK_F1 },
+ { Event::ConsoleReset, KBDK_F2 },
+ { Event::ConsoleColor, KBDK_F3 },
+ { Event::Console7800Pause, KBDK_F3, MOD3 },
+ { Event::ConsoleLeftDiffA, KBDK_F5 },
+ { Event::ConsoleRightDiffA, KBDK_F7 },
+ { Event::SaveState, KBDK_F9 },
+ { Event::SaveAllStates, KBDK_F9, MOD3 },
+ { Event::PreviousState, KBDK_F10, KBDM_SHIFT },
+ { Event::NextState, KBDK_F10 },
+ { Event::ToggleAutoSlot, KBDK_F10, MOD3 },
+ { Event::LoadState, KBDK_F11 },
+ { Event::LoadAllStates, KBDK_F11, MOD3 },
+ { Event::TakeSnapshot, KBDK_F12 },
+ #ifdef BSPF_MACOS
+ { Event::TogglePauseMode, KBDK_P, KBDM_SHIFT | MOD3 },
+ #else
+ { Event::TogglePauseMode, KBDK_PAUSE },
+ #endif
+ { Event::OptionsMenuMode, KBDK_TAB },
+ { Event::CmdMenuMode, KBDK_BACKSLASH },
+ { Event::TimeMachineMode, KBDK_T, KBDM_SHIFT },
+ { Event::DebuggerMode, KBDK_GRAVE },
+ { Event::ExitMode, KBDK_ESCAPE },
+ #ifdef BSPF_MACOS
+ { Event::Quit, KBDK_Q, MOD3 },
+ #else
+ { Event::Quit, KBDK_Q, KBDM_CTRL },
+ #endif
+ { Event::ReloadConsole, KBDK_R, KBDM_CTRL },
+ { Event::PreviousMultiCartRom, KBDK_R, KBDM_SHIFT | KBDM_CTRL },
- {Event::VidmodeDecrease, KBDK_MINUS, MOD3},
- {Event::VidmodeIncrease, KBDK_EQUALS, MOD3},
- {Event::VCenterDecrease, KBDK_PAGEUP, MOD3},
- {Event::VCenterIncrease, KBDK_PAGEDOWN, MOD3},
- {Event::VSizeAdjustDecrease, KBDK_PAGEDOWN, KBDM_SHIFT | MOD3},
- {Event::VSizeAdjustIncrease, KBDK_PAGEUP, KBDM_SHIFT | MOD3},
- {Event::ToggleCorrectAspectRatio, KBDK_C, KBDM_CTRL},
- {Event::VolumeDecrease, KBDK_LEFTBRACKET, MOD3},
- {Event::VolumeIncrease, KBDK_RIGHTBRACKET, MOD3},
- {Event::SoundToggle, KBDK_RIGHTBRACKET, KBDM_CTRL},
+ { Event::VidmodeDecrease, KBDK_MINUS, MOD3 },
+ { Event::VidmodeIncrease, KBDK_EQUALS, MOD3 },
+ { Event::VCenterDecrease, KBDK_PAGEUP, MOD3 },
+ { Event::VCenterIncrease, KBDK_PAGEDOWN, MOD3 },
+ { Event::VSizeAdjustDecrease, KBDK_PAGEDOWN, KBDM_SHIFT | MOD3 },
+ { Event::VSizeAdjustIncrease, KBDK_PAGEUP, KBDM_SHIFT | MOD3 },
+ { Event::ToggleCorrectAspectRatio, KBDK_C, KBDM_CTRL },
+ { Event::VolumeDecrease, KBDK_LEFTBRACKET, MOD3 },
+ { Event::VolumeIncrease, KBDK_RIGHTBRACKET, MOD3 },
+ { Event::SoundToggle, KBDK_RIGHTBRACKET, KBDM_CTRL },
- {Event::ToggleFullScreen, KBDK_RETURN, MOD3},
- {Event::ToggleAdaptRefresh, KBDK_R, MOD3},
- {Event::OverscanDecrease, KBDK_PAGEDOWN, KBDM_SHIFT},
- {Event::OverscanIncrease, KBDK_PAGEUP, KBDM_SHIFT},
- //{Event::VidmodeStd, KBDK_1, MOD3},
- //{Event::VidmodeRGB, KBDK_2, MOD3},
- //{Event::VidmodeSVideo, KBDK_3, MOD3},
- //{Event::VidModeComposite, KBDK_4, MOD3},
- //{Event::VidModeBad, KBDK_5, MOD3},
- //{Event::VidModeCustom, KBDK_6, MOD3},
- {Event::PreviousVideoMode, KBDK_1, KBDM_SHIFT | MOD3},
- {Event::NextVideoMode, KBDK_1, MOD3},
- {Event::PreviousAttribute, KBDK_2, KBDM_SHIFT | MOD3},
- {Event::NextAttribute, KBDK_2, MOD3},
- {Event::DecreaseAttribute, KBDK_3, KBDM_SHIFT | MOD3},
- {Event::IncreaseAttribute, KBDK_3, MOD3},
- {Event::PhosphorDecrease, KBDK_4, KBDM_SHIFT | MOD3},
- {Event::PhosphorIncrease, KBDK_4, MOD3},
- {Event::TogglePhosphor, KBDK_P, MOD3},
- {Event::ScanlinesDecrease, KBDK_5, KBDM_SHIFT | MOD3},
- {Event::ScanlinesIncrease, KBDK_5, MOD3},
- {Event::PreviousPaletteAttribute, KBDK_9, KBDM_SHIFT | MOD3},
- {Event::NextPaletteAttribute, KBDK_9, MOD3},
- {Event::PaletteAttributeDecrease, KBDK_0, KBDM_SHIFT | MOD3},
- {Event::PaletteAttributeIncrease, KBDK_0, MOD3},
- {Event::ToggleColorLoss, KBDK_L, KBDM_CTRL},
- {Event::PaletteDecrease, KBDK_P, KBDM_SHIFT | KBDM_CTRL},
- {Event::PaletteIncrease, KBDK_P, KBDM_CTRL},
+ { Event::ToggleFullScreen, KBDK_RETURN, MOD3 },
+ { Event::ToggleAdaptRefresh, KBDK_R, MOD3 },
+ { Event::OverscanDecrease, KBDK_PAGEDOWN, KBDM_SHIFT },
+ { Event::OverscanIncrease, KBDK_PAGEUP, KBDM_SHIFT },
+ //{Event::VidmodeStd, KBDK_1, MOD3},
+ //{Event::VidmodeRGB, KBDK_2, MOD3},
+ //{Event::VidmodeSVideo, KBDK_3, MOD3},
+ //{Event::VidModeComposite, KBDK_4, MOD3},
+ //{Event::VidModeBad, KBDK_5, MOD3},
+ //{Event::VidModeCustom, KBDK_6, MOD3},
+ { Event::PreviousVideoMode, KBDK_1, KBDM_SHIFT | MOD3 },
+ { Event::NextVideoMode, KBDK_1, MOD3 },
+ { Event::PreviousAttribute, KBDK_2, KBDM_SHIFT | MOD3 },
+ { Event::NextAttribute, KBDK_2, MOD3 },
+ { Event::DecreaseAttribute, KBDK_3, KBDM_SHIFT | MOD3 },
+ { Event::IncreaseAttribute, KBDK_3, MOD3 },
+ { Event::PhosphorDecrease, KBDK_4, KBDM_SHIFT | MOD3 },
+ { Event::PhosphorIncrease, KBDK_4, MOD3 },
+ { Event::TogglePhosphor, KBDK_P, MOD3 },
+ { Event::ScanlinesDecrease, KBDK_5, KBDM_SHIFT | MOD3 },
+ { Event::ScanlinesIncrease, KBDK_5, MOD3 },
+ { Event::PreviousPaletteAttribute, KBDK_9, KBDM_SHIFT | MOD3 },
+ { Event::NextPaletteAttribute, KBDK_9, MOD3 },
+ { Event::PaletteAttributeDecrease, KBDK_0, KBDM_SHIFT | MOD3 },
+ { Event::PaletteAttributeIncrease, KBDK_0, MOD3 },
+ { Event::ToggleColorLoss, KBDK_L, KBDM_CTRL },
+ { Event::PaletteDecrease, KBDK_P, KBDM_SHIFT | KBDM_CTRL },
+ { Event::PaletteIncrease, KBDK_P, KBDM_CTRL },
+ { Event::FormatDecrease, KBDK_F, KBDM_SHIFT | KBDM_CTRL },
+ { Event::FormatIncrease, KBDK_F, KBDM_CTRL },
+ #ifndef BSPF_MACOS
+ { Event::PreviousSetting, KBDK_END },
+ { Event::NextSetting, KBDK_HOME },
+ { Event::PreviousSettingGroup, KBDK_END, KBDM_CTRL },
+ { Event::NextSettingGroup, KBDK_HOME, KBDM_CTRL },
+ #else
+ // HOME & END keys are swapped on Mac keyboards
+ { Event::PreviousSetting, KBDK_HOME },
+ { Event::NextSetting, KBDK_END },
+ { Event::PreviousSettingGroup, KBDK_HOME, KBDM_CTRL },
+ { Event::NextSettingGroup, KBDK_END, KBDM_CTRL },
+ #endif
+ { Event::PreviousSetting, KBDK_KP_1 },
+ { Event::NextSetting, KBDK_KP_7 },
+ { Event::PreviousSettingGroup, KBDK_KP_1, KBDM_CTRL },
+ { Event::NextSettingGroup, KBDK_KP_7, KBDM_CTRL },
+ { Event::SettingDecrease, KBDK_PAGEDOWN },
+ { Event::SettingDecrease, KBDK_KP_3, KBDM_CTRL },
+ { Event::SettingIncrease, KBDK_PAGEUP },
+ { Event::SettingIncrease, KBDK_KP_9, KBDM_CTRL },
-#ifndef BSPF_MACOS
- {Event::PreviousSetting, KBDK_END},
- {Event::NextSetting, KBDK_HOME},
- {Event::PreviousSettingGroup, KBDK_END, KBDM_CTRL},
- {Event::NextSettingGroup, KBDK_HOME, KBDM_CTRL},
-#else
- // HOME & END keys are swapped on Mac keyboards
- {Event::PreviousSetting, KBDK_HOME},
- {Event::NextSetting, KBDK_END},
- {Event::PreviousSettingGroup, KBDK_HOME, KBDM_CTRL},
- {Event::NextSettingGroup, KBDK_END, KBDM_CTRL},
-#endif
- {Event::PreviousSetting, KBDK_KP_1},
- {Event::NextSetting, KBDK_KP_7},
- {Event::PreviousSettingGroup, KBDK_KP_1, KBDM_CTRL},
- {Event::NextSettingGroup, KBDK_KP_7, KBDM_CTRL},
- {Event::SettingDecrease, KBDK_PAGEDOWN},
- {Event::SettingDecrease, KBDK_KP_3, KBDM_CTRL},
- {Event::SettingIncrease, KBDK_PAGEUP},
- {Event::SettingIncrease, KBDK_KP_9, KBDM_CTRL},
+ { Event::ToggleInter, KBDK_I, KBDM_CTRL },
+ { Event::DecreaseSpeed, KBDK_S, KBDM_SHIFT | KBDM_CTRL },
+ { Event::IncreaseSpeed, KBDK_S, KBDM_CTRL },
+ { Event::ToggleTurbo, KBDK_T, KBDM_CTRL },
+ { Event::ToggleJitter, KBDK_J, MOD3 },
+ { Event::ToggleFrameStats, KBDK_L, MOD3 },
+ { Event::ToggleTimeMachine, KBDK_T, MOD3 },
- {Event::ToggleInter, KBDK_I, KBDM_CTRL},
- {Event::DecreaseSpeed, KBDK_S, KBDM_SHIFT | KBDM_CTRL},
- {Event::IncreaseSpeed, KBDK_S, KBDM_CTRL },
- {Event::ToggleTurbo, KBDK_T, KBDM_CTRL},
- {Event::ToggleJitter, KBDK_J, MOD3},
- {Event::ToggleFrameStats, KBDK_L, MOD3},
- {Event::ToggleTimeMachine, KBDK_T, MOD3},
+ #ifdef PNG_SUPPORT
+ { Event::ToggleContSnapshots, KBDK_S, MOD3 | KBDM_CTRL },
+ { Event::ToggleContSnapshotsFrame, KBDK_S, KBDM_SHIFT | MOD3 | KBDM_CTRL },
+ #endif
-#ifdef PNG_SUPPORT
- {Event::ToggleContSnapshots, KBDK_S, MOD3 | KBDM_CTRL},
- {Event::ToggleContSnapshotsFrame, KBDK_S, KBDM_SHIFT | MOD3 | KBDM_CTRL},
-#endif
+ { Event::DecreaseDeadzone, KBDK_F1, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncreaseDeadzone, KBDK_F1, KBDM_CTRL },
+ { Event::DecAnalogSense, KBDK_F2, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncAnalogSense, KBDK_F2, KBDM_CTRL },
+ { Event::DecDejtterAveraging, KBDK_F3, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncDejtterAveraging, KBDK_F3, KBDM_CTRL },
+ { Event::DecDejtterReaction, KBDK_F4, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncDejtterReaction, KBDK_F4, KBDM_CTRL },
+ { Event::DecDigitalSense, KBDK_F5, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncDigitalSense, KBDK_F5, KBDM_CTRL },
+ { Event::DecreaseAutoFire, KBDK_A, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncreaseAutoFire, KBDK_A, KBDM_CTRL },
+ { Event::ToggleFourDirections, KBDK_F6, KBDM_CTRL },
+ { Event::ToggleKeyCombos, KBDK_F7, KBDM_CTRL },
+ { Event::ToggleSAPortOrder, KBDK_1, KBDM_CTRL },
- {Event::DecreaseAutoFire, KBDK_A, KBDM_SHIFT | KBDM_CTRL},
- {Event::IncreaseAutoFire, KBDK_A, KBDM_CTRL },
- {Event::HandleMouseControl, KBDK_0, KBDM_CTRL},
- {Event::ToggleGrabMouse, KBDK_G, KBDM_CTRL},
- {Event::ToggleSAPortOrder, KBDK_1, KBDM_CTRL},
- {Event::FormatDecrease, KBDK_F, KBDM_SHIFT | KBDM_CTRL},
- {Event::FormatIncrease, KBDK_F, KBDM_CTRL},
+ { Event::PrevMouseAsController, KBDK_F8, KBDM_CTRL | KBDM_SHIFT },
+ { Event::NextMouseAsController, KBDK_F8, KBDM_CTRL },
+ { Event::DecMousePaddleSense, KBDK_F9, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncMousePaddleSense, KBDK_F9, KBDM_CTRL },
+ { Event::DecMouseTrackballSense, KBDK_F10, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncMouseTrackballSense, KBDK_F10, KBDM_CTRL },
+ { Event::DecreaseDrivingSense, KBDK_F11, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncreaseDrivingSense, KBDK_F11, KBDM_CTRL },
+ { Event::PreviousCursorVisbility, KBDK_F12, KBDM_CTRL | KBDM_SHIFT },
+ { Event::NextCursorVisbility, KBDK_F12, KBDM_CTRL },
+ { Event::ToggleGrabMouse, KBDK_G, KBDM_CTRL },
- {Event::ToggleP0Collision, KBDK_Z, KBDM_SHIFT | MOD3},
- {Event::ToggleP0Bit, KBDK_Z, MOD3},
- {Event::ToggleP1Collision, KBDK_X, KBDM_SHIFT | MOD3},
- {Event::ToggleP1Bit, KBDK_X, MOD3},
- {Event::ToggleM0Collision, KBDK_C, KBDM_SHIFT | MOD3},
- {Event::ToggleM0Bit, KBDK_C, MOD3},
- {Event::ToggleM1Collision, KBDK_V, KBDM_SHIFT | MOD3},
- {Event::ToggleM1Bit, KBDK_V, MOD3},
- {Event::ToggleBLCollision, KBDK_B, KBDM_SHIFT | MOD3},
- {Event::ToggleBLBit, KBDK_B, MOD3},
- {Event::TogglePFCollision, KBDK_N, KBDM_SHIFT | MOD3},
- {Event::TogglePFBit, KBDK_N, MOD3},
- {Event::ToggleCollisions, KBDK_COMMA, KBDM_SHIFT | MOD3},
- {Event::ToggleBits, KBDK_COMMA, MOD3},
- {Event::ToggleFixedColors, KBDK_PERIOD, MOD3},
+ { Event::PreviousLeftPort, KBDK_2, KBDM_CTRL | KBDM_SHIFT },
+ { Event::NextLeftPort, KBDK_2, KBDM_CTRL },
+ { Event::PreviousRightPort, KBDK_3, KBDM_CTRL | KBDM_SHIFT },
+ { Event::NextRightPort, KBDK_3, KBDM_CTRL },
+ { Event::ToggleSwapPorts, KBDK_4, KBDM_CTRL },
+ { Event::ToggleSwapPaddles, KBDK_5, KBDM_CTRL },
+ { Event::DecreasePaddleCenterX, KBDK_6, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncreasePaddleCenterX, KBDK_6, KBDM_CTRL },
+ { Event::DecreasePaddleCenterY, KBDK_7, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncreasePaddleCenterY, KBDK_7, KBDM_CTRL },
+ { Event::PreviousMouseControl, KBDK_0, KBDM_CTRL | KBDM_SHIFT },
+ { Event::NextMouseControl, KBDK_0, KBDM_CTRL },
+ { Event::DecreaseMouseAxesRange, KBDK_8, KBDM_CTRL | KBDM_SHIFT },
+ { Event::IncreaseMouseAxesRange, KBDK_8, KBDM_CTRL },
- {Event::RewindPause, KBDK_LEFT, KBDM_SHIFT},
- {Event::Rewind1Menu, KBDK_LEFT, MOD3},
- {Event::Rewind10Menu, KBDK_LEFT, KBDM_SHIFT | MOD3},
- {Event::RewindAllMenu, KBDK_DOWN, MOD3},
- {Event::UnwindPause, KBDK_LEFT, KBDM_SHIFT},
- {Event::Unwind1Menu, KBDK_RIGHT, MOD3},
- {Event::Unwind10Menu, KBDK_RIGHT, KBDM_SHIFT | MOD3},
- {Event::UnwindAllMenu, KBDK_UP, MOD3},
- {Event::HighScoresMenuMode, KBDK_INSERT},
- {Event::TogglePlayBackMode, KBDK_SPACE, KBDM_SHIFT},
+ { Event::ToggleP0Collision, KBDK_Z, KBDM_SHIFT | MOD3 },
+ { Event::ToggleP0Bit, KBDK_Z, MOD3 },
+ { Event::ToggleP1Collision, KBDK_X, KBDM_SHIFT | MOD3 },
+ { Event::ToggleP1Bit, KBDK_X, MOD3 },
+ { Event::ToggleM0Collision, KBDK_C, KBDM_SHIFT | MOD3 },
+ { Event::ToggleM0Bit, KBDK_C, MOD3 },
+ { Event::ToggleM1Collision, KBDK_V, KBDM_SHIFT | MOD3 },
+ { Event::ToggleM1Bit, KBDK_V, MOD3 },
+ { Event::ToggleBLCollision, KBDK_B, KBDM_SHIFT | MOD3 },
+ { Event::ToggleBLBit, KBDK_B, MOD3 },
+ { Event::TogglePFCollision, KBDK_N, KBDM_SHIFT | MOD3 },
+ { Event::TogglePFBit, KBDK_N, MOD3 },
+ { Event::ToggleCollisions, KBDK_COMMA, KBDM_SHIFT | MOD3 },
+ { Event::ToggleBits, KBDK_COMMA, MOD3 },
+ { Event::ToggleFixedColors, KBDK_PERIOD, MOD3 },
-#if defined(RETRON77)
- {Event::ConsoleColorToggle, KBDK_F4}, // back ("COLOR","B/W")
- {Event::ConsoleLeftDiffToggle, KBDK_F6}, // front ("SKILL P1")
- {Event::ConsoleRightDiffToggle, KBDK_F8}, // front ("SKILL P2")
- {Event::CmdMenuMode, KBDK_F13}, // back ("4:3","16:9")
- {Event::ExitMode, KBDK_BACKSPACE}, // back ("FRY")
-#else // defining duplicate keys must be avoided!
- {Event::ConsoleBlackWhite, KBDK_F4},
- {Event::ConsoleLeftDiffB, KBDK_F6},
- {Event::ConsoleRightDiffB, KBDK_F8},
- {Event::Fry, KBDK_BACKSPACE},
+ { Event::RewindPause, KBDK_LEFT, KBDM_SHIFT },
+ { Event::Rewind1Menu, KBDK_LEFT, MOD3 },
+ { Event::Rewind10Menu, KBDK_LEFT, KBDM_SHIFT | MOD3 },
+ { Event::RewindAllMenu, KBDK_DOWN, MOD3 },
+ { Event::UnwindPause, KBDK_LEFT, KBDM_SHIFT },
+ { Event::Unwind1Menu, KBDK_RIGHT, MOD3 },
+ { Event::Unwind10Menu, KBDK_RIGHT, KBDM_SHIFT | MOD3 },
+ { Event::UnwindAllMenu, KBDK_UP, MOD3 },
+ { Event::HighScoresMenuMode, KBDK_INSERT },
+ { Event::TogglePlayBackMode, KBDK_SPACE, KBDM_SHIFT },
+
+ #if defined(RETRON77)
+ { Event::ConsoleColorToggle, KBDK_F4 }, // back ("COLOR","B/W")
+ { Event::ConsoleLeftDiffToggle, KBDK_F6 }, // front ("SKILL P1")
+ { Event::ConsoleRightDiffToggle, KBDK_F8 }, // front ("SKILL P2")
+ { Event::CmdMenuMode, KBDK_F13 }, // back ("4:3","16:9")
+ { Event::ExitMode, KBDK_BACKSPACE }, // back ("FRY")
+ #else // defining duplicate keys must be avoided!
+ { Event::ConsoleBlackWhite, KBDK_F4 },
+ { Event::ConsoleLeftDiffB, KBDK_F6 },
+ { Event::ConsoleRightDiffB, KBDK_F8 },
+ { Event::Fry, KBDK_BACKSPACE },
#endif
};
diff --git a/src/common/PKeyboardHandler.hxx b/src/common/PKeyboardHandler.hxx
index b285f619b..2766f83c7 100644
--- a/src/common/PKeyboardHandler.hxx
+++ b/src/common/PKeyboardHandler.hxx
@@ -79,6 +79,8 @@ class PhysicalKeyboardHandler
/** See comments on KeyMap.myModEnabled for more information. */
bool& useModKeys() { return myKeyMap.enableMod(); }
+ void toggleModKeys(bool toggle = true);
+
private:
// Structure used for action menu items
diff --git a/src/common/PNGLibrary.cxx b/src/common/PNGLibrary.cxx
index 2a6f84d6a..f8aff5220 100644
--- a/src/common/PNGLibrary.cxx
+++ b/src/common/PNGLibrary.cxx
@@ -33,7 +33,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PNGLibrary::PNGLibrary(OSystem& osystem)
- : myOSystem(osystem)
+ : myOSystem{osystem}
{
}
diff --git a/src/common/PaletteHandler.cxx b/src/common/PaletteHandler.cxx
index aa66f5985..ae7dfcba1 100644
--- a/src/common/PaletteHandler.cxx
+++ b/src/common/PaletteHandler.cxx
@@ -24,7 +24,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PaletteHandler::PaletteHandler(OSystem& system)
- : myOSystem(system)
+ : myOSystem{system}
{
// Load user-defined palette for this ROM
loadUserPalette();
@@ -442,7 +442,7 @@ void PaletteHandler::generateCustomPalette(ConsoleTiming timing)
if(timing == ConsoleTiming::ntsc)
{
vector2d IQ[NUM_CHROMA];
- // YIQ is YUV shifted by 33°
+ // YIQ is YUV shifted by 33 degrees
constexpr float offset = 33 * BSPF::PI_f / 180;
const float shift = myPhaseNTSC * BSPF::PI_f / 180;
@@ -542,7 +542,7 @@ void PaletteHandler::generateCustomPalette(ConsoleTiming timing)
void PaletteHandler::adjustHueSaturation(int& R, int& G, int& B, float H, float S)
{
// Adapted from http://beesbuzz.biz/code/16-hsv-color-transforms
- // (C) J. “Fluffy” Shagam
+ // (C) J. Fluffy Shagam
// License: CC BY-SA 4.0
const float su = S * cosf(-H * BSPF::PI_f);
const float sw = S * sinf(-H * BSPF::PI_f);
diff --git a/src/common/PaletteHandler.hxx b/src/common/PaletteHandler.hxx
index 42ba37cfc..82bfe70e8 100644
--- a/src/common/PaletteHandler.hxx
+++ b/src/common/PaletteHandler.hxx
@@ -65,7 +65,7 @@ class PaletteHandler
};
public:
- PaletteHandler(OSystem& system);
+ explicit PaletteHandler(OSystem& system);
/**
Cycle through available palettes.
@@ -139,7 +139,7 @@ class PaletteHandler
float y{0.F};
explicit vector2d(float _x = 0.F, float _y = 0.F)
- : x(_x), y(_y) { }
+ : x{_x}, y{_y} { }
};
/**
diff --git a/src/common/PhysicalJoystick.hxx b/src/common/PhysicalJoystick.hxx
index cf0456c0e..82b7106a1 100644
--- a/src/common/PhysicalJoystick.hxx
+++ b/src/common/PhysicalJoystick.hxx
@@ -59,17 +59,13 @@ class PhysicalJoystick
int axes, int buttons, int hats, int balls);
private:
- // TODO: these are not required anymore, delete or keep for future usage?
- enum JoyType {
- JT_NONE = 0,
- JT_REGULAR = 1,
- JT_STELLADAPTOR_LEFT = 2,
- JT_STELLADAPTOR_RIGHT = 3,
- JT_2600DAPTOR_LEFT = 4,
- JT_2600DAPTOR_RIGHT = 5
+ enum class Type {
+ REGULAR,
+ LEFT_STELLADAPTOR, RIGHT_STELLADAPTOR,
+ LEFT_2600DAPTOR, RIGHT_2600DAPTOR
};
- JoyType type{JT_NONE};
+ Type type{Type::REGULAR};
int ID{-1};
string name{"None"};
int numAxes{0}, numButtons{0}, numHats{0};
diff --git a/src/common/Rect.hxx b/src/common/Rect.hxx
index 708de9d86..869cc5e75 100644
--- a/src/common/Rect.hxx
+++ b/src/common/Rect.hxx
@@ -32,6 +32,7 @@ namespace Common {
*/
struct Point
{
+ // FIXME : make this uInt32
Int32 x{0}; //!< The horizontal part of the point
Int32 y{0}; //!< The vertical part of the point
diff --git a/src/common/RewindManager.cxx b/src/common/RewindManager.cxx
index d6d277995..a170d418b 100644
--- a/src/common/RewindManager.cxx
+++ b/src/common/RewindManager.cxx
@@ -28,8 +28,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RewindManager::RewindManager(OSystem& system, StateManager& statemgr)
- : myOSystem(system),
- myStateManager(statemgr)
+ : myOSystem{system},
+ myStateManager{statemgr}
{
setup();
}
diff --git a/src/common/SoundSDL2.cxx b/src/common/SoundSDL2.cxx
index 40b95b0f0..01f19fdc1 100644
--- a/src/common/SoundSDL2.cxx
+++ b/src/common/SoundSDL2.cxx
@@ -40,8 +40,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SoundSDL2::SoundSDL2(OSystem& osystem, AudioSettings& audioSettings)
- : Sound(osystem),
- myAudioSettings(audioSettings)
+ : Sound{osystem},
+ myAudioSettings{audioSettings}
{
ASSERT_MAIN_THREAD;
@@ -273,7 +273,7 @@ void SoundSDL2::adjustVolume(int direction)
if(percent > 0 && !enabled)
{
- setEnabled(!enabled);
+ setEnabled(true);
myOSystem.console().initializeAudio();
}
diff --git a/src/common/StaggeredLogger.cxx b/src/common/StaggeredLogger.cxx
index 522d81c71..38d2c50fd 100644
--- a/src/common/StaggeredLogger.cxx
+++ b/src/common/StaggeredLogger.cxx
@@ -37,8 +37,8 @@ namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StaggeredLogger::StaggeredLogger(const string& message, Logger::Level level)
- : myMessage(message),
- myLevel(level)
+ : myMessage{message},
+ myLevel{level}
{
}
diff --git a/src/common/StateManager.cxx b/src/common/StateManager.cxx
index 956f62409..690a00ad4 100644
--- a/src/common/StateManager.cxx
+++ b/src/common/StateManager.cxx
@@ -31,7 +31,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StateManager::StateManager(OSystem& osystem)
- : myOSystem(osystem)
+ : myOSystem{osystem}
{
myRewindManager = make_unique(myOSystem, *this);
reset();
diff --git a/src/common/TimerManager.cxx b/src/common/TimerManager.cxx
index 9b90dc3e1..24d31ceb9 100644
--- a/src/common/TimerManager.cxx
+++ b/src/common/TimerManager.cxx
@@ -20,7 +20,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TimerManager::TimerManager()
- : nextId(no_timer + 1),
+ : nextId{no_timer + 1},
queue()
{
}
diff --git a/src/common/Variant.hxx b/src/common/Variant.hxx
index 6eaa44117..578eee7cb 100644
--- a/src/common/Variant.hxx
+++ b/src/common/Variant.hxx
@@ -44,8 +44,8 @@ class Variant
public:
Variant() { } // NOLINT
- Variant(const string& s) : data(s) { }
- Variant(const char* s) : data(s) { }
+ Variant(const string& s) : data{s} { }
+ Variant(const char* s) : data{s} { }
Variant(Int32 i) { buf().str(""); buf() << i; data = buf().str(); }
Variant(uInt32 i) { buf().str(""); buf() << i; data = buf().str(); }
diff --git a/src/common/VideoModeHandler.cxx b/src/common/VideoModeHandler.cxx
index e15b12b1c..185ce0d61 100644
--- a/src/common/VideoModeHandler.cxx
+++ b/src/common/VideoModeHandler.cxx
@@ -105,14 +105,12 @@ VideoModeHandler::Mode::Mode(uInt32 iw, uInt32 ih, Stretch smode,
VideoModeHandler::Mode::Mode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh,
Stretch smode, Int32 fsindex, const string& desc,
float zoomLevel, float overscan)
- : stretch(smode),
+ : screenS(sw, sh),
+ stretch(smode),
description(desc),
zoom(zoomLevel),
fsIndex(fsindex)
{
- // First set default size and positioning
- screenS = Common::Size(sw, sh);
-
// Now resize based on windowed/fullscreen mode and stretch factor
if(fsIndex != -1) // fullscreen mode
{
diff --git a/src/common/audio/ConvolutionBuffer.cxx b/src/common/audio/ConvolutionBuffer.cxx
index 508e1886a..629b474da 100644
--- a/src/common/audio/ConvolutionBuffer.cxx
+++ b/src/common/audio/ConvolutionBuffer.cxx
@@ -19,9 +19,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ConvolutionBuffer::ConvolutionBuffer(uInt32 size)
- : mySize(size)
+ : myData{make_unique(size)},
+ mySize{size}
{
- myData = make_unique(mySize);
std::fill_n(myData.get(), mySize, 0.F);
}
diff --git a/src/common/audio/HighPass.cxx b/src/common/audio/HighPass.cxx
index 48a0107fe..f51c921ed 100644
--- a/src/common/audio/HighPass.cxx
+++ b/src/common/audio/HighPass.cxx
@@ -20,7 +20,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HighPass::HighPass(float cutOffFrequency, float frequency)
- : myAlpha(1.F / (1.F + 2.F*BSPF::PI_f*cutOffFrequency/frequency))
+ : myAlpha{1.F / (1.F + 2.F*BSPF::PI_f*cutOffFrequency/frequency)}
{
}
diff --git a/src/common/audio/LanczosResampler.cxx b/src/common/audio/LanczosResampler.cxx
index 27a115198..d14bac8e8 100644
--- a/src/common/audio/LanczosResampler.cxx
+++ b/src/common/audio/LanczosResampler.cxx
@@ -69,12 +69,12 @@ LanczosResampler::LanczosResampler(
// formatFrom.sampleRate / formatTo.sampleRate = M / N
//
// -> we find N from fully reducing the fraction.
- myPrecomputedKernelCount(reducedDenominator(formatFrom.sampleRate, formatTo.sampleRate)),
- myKernelSize(2 * kernelParameter),
- myKernelParameter(kernelParameter),
- myHighPassL(HIGH_PASS_CUT_OFF, float(formatFrom.sampleRate)),
- myHighPassR(HIGH_PASS_CUT_OFF, float(formatFrom.sampleRate)),
- myHighPass(HIGH_PASS_CUT_OFF, float(formatFrom.sampleRate))
+ myPrecomputedKernelCount{reducedDenominator(formatFrom.sampleRate, formatTo.sampleRate)},
+ myKernelSize{2 * kernelParameter},
+ myKernelParameter{kernelParameter},
+ myHighPassL{HIGH_PASS_CUT_OFF, float(formatFrom.sampleRate)},
+ myHighPassR{HIGH_PASS_CUT_OFF, float(formatFrom.sampleRate)},
+ myHighPass{HIGH_PASS_CUT_OFF, float(formatFrom.sampleRate)}
{
myPrecomputedKernels = make_unique(myPrecomputedKernelCount * myKernelSize);
diff --git a/src/common/audio/Resampler.hxx b/src/common/audio/Resampler.hxx
index 1fda17aa6..aa6de4ba0 100644
--- a/src/common/audio/Resampler.hxx
+++ b/src/common/audio/Resampler.hxx
@@ -51,12 +51,11 @@ class Resampler {
public:
Resampler(Format formatFrom, Format formatTo,
- const NextFragmentCallback& nextFragmentCallback) :
- myFormatFrom(formatFrom),
- myFormatTo(formatTo),
- myNextFragmentCallback(nextFragmentCallback),
- myUnderrunLogger("audio buffer underrun", Logger::Level::INFO)
- {}
+ const NextFragmentCallback& nextFragmentCallback)
+ : myFormatFrom{formatFrom},
+ myFormatTo{formatTo},
+ myNextFragmentCallback{nextFragmentCallback},
+ myUnderrunLogger{"audio buffer underrun", Logger::Level::INFO} { }
virtual void fillFragment(float* fragment, uInt32 length) = 0;
diff --git a/src/common/audio/SimpleResampler.hxx b/src/common/audio/SimpleResampler.hxx
index 7098b8260..6dfdcc1b3 100644
--- a/src/common/audio/SimpleResampler.hxx
+++ b/src/common/audio/SimpleResampler.hxx
@@ -39,13 +39,11 @@ class SimpleResampler : public Resampler
bool myIsUnderrun{true};
private:
-
SimpleResampler() = delete;
SimpleResampler(const SimpleResampler&) = delete;
SimpleResampler(SimpleResampler&&) = delete;
SimpleResampler& operator=(const SimpleResampler&) = delete;
SimpleResampler& operator=(const SimpleResampler&&) = delete;
-
};
#endif // SIMPLE_RESAMPLER_HXX
diff --git a/src/common/jsonDefinitions.hxx b/src/common/jsonDefinitions.hxx
index 9074a3746..5d8d53c7d 100644
--- a/src/common/jsonDefinitions.hxx
+++ b/src/common/jsonDefinitions.hxx
@@ -1,3 +1,20 @@
+//============================================================================
+//
+// SSSS tt lll lll
+// SS SS tt ll ll
+// SS tttttt eeee ll ll aaaa
+// SSSS tt ee ee ll ll aa
+// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
+// SS SS tt ee ll ll aa aa
+// SSSS ttt eeeee llll llll aaaaa
+//
+// Copyright (c) 1995-2020 by Bradford W. Mott, Stephen Anthony
+// and the Stella Team
+//
+// See the file "License.txt" for information on usage and redistribution of
+// this file, and for a DISCLAIMER OF ALL WARRANTIES.
+//============================================================================
+
#ifndef JSON_DEFINITIONS_HXX
#define JSON_DEFINITIONS_HXX
@@ -69,6 +86,16 @@ NLOHMANN_JSON_SERIALIZE_ENUM(Event::Type, {
{Event::JoystickOneFire, "JoystickOneFire"},
{Event::JoystickOneFire5, "JoystickOneFire5"},
{Event::JoystickOneFire9, "JoystickOneFire9"},
+ {Event::JoystickTwoUp, "JoystickTwoUp"},
+ {Event::JoystickTwoDown, "JoystickTwoDown"},
+ {Event::JoystickTwoLeft, "JoystickTwoLeft"},
+ {Event::JoystickTwoRight, "JoystickTwoRight"},
+ {Event::JoystickTwoFire, "JoystickTwoFire"},
+ {Event::JoystickThreeUp, "JoystickThreeUp"},
+ {Event::JoystickThreeDown, "JoystickThreeDown"},
+ {Event::JoystickThreeLeft, "JoystickThreeLeft"},
+ {Event::JoystickThreeRight, "JoystickThreeRight"},
+ {Event::JoystickThreeFire, "JoystickThreeFire"},
{Event::PaddleZeroDecrease, "PaddleZeroDecrease"},
{Event::PaddleZeroIncrease, "PaddleZeroIncrease"},
{Event::PaddleZeroAnalog, "PaddleZeroAnalog"},
@@ -160,6 +187,50 @@ NLOHMANN_JSON_SERIALIZE_ENUM(Event::Type, {
{Event::CompuMateEquals, "CompuMateEquals"},
{Event::CompuMatePlus, "CompuMatePlus"},
{Event::CompuMateSlash, "CompuMateSlash"},
+
+ {Event::DecreaseDeadzone, "DecreaseDeadzone"},
+ {Event::IncreaseDeadzone, "IncreaseDeadzone"},
+ {Event::DecAnalogSense, "DecAnalogSense"},
+ {Event::IncAnalogSense, "IncAnalogSense"},
+ {Event::DecDejtterAveraging, "DecDejtterAveraging"},
+ {Event::IncDejtterAveraging, "IncDejtterAveraging"},
+ {Event::DecDejtterReaction, "DecDejtterReaction"},
+ {Event::IncDejtterReaction, "IncDejtterReaction"},
+ {Event::DecDigitalSense, "DecDigitalSense"},
+ {Event::IncDigitalSense, "IncDigitalSense"},
+ {Event::DecreaseAutoFire, "DecreaseAutoFire"},
+ {Event::IncreaseAutoFire, "IncreaseAutoFire"},
+ {Event::ToggleFourDirections, "ToggleFourDirections"},
+ {Event::ToggleKeyCombos, "ToggleKeyCombos"},
+ {Event::ToggleSAPortOrder, "ToggleSAPortOrder"},
+
+ {Event::PrevMouseAsController, "PrevMouseAsController"},
+ {Event::NextMouseAsController, "NextMouseAsController"},
+ {Event::DecMousePaddleSense, "DecMousePaddleSense"},
+ {Event::IncMousePaddleSense, "IncMousePaddleSense"},
+ {Event::DecMouseTrackballSense, "DecMouseTrackballSense"},
+ {Event::IncMouseTrackballSense, "IncMouseTrackballSense"},
+ {Event::DecreaseDrivingSense, "DecreaseDrivingSense"},
+ {Event::IncreaseDrivingSense, "IncreaseDrivingSense"},
+ {Event::PreviousCursorVisbility, "PreviousCursorVisbility"},
+ {Event::NextCursorVisbility, "NextCursorVisbility"},
+ {Event::ToggleGrabMouse, "ToggleGrabMouse"},
+
+ {Event::PreviousLeftPort, "PreviousLeftPort"},
+ {Event::NextLeftPort, "NextLeftPort"},
+ {Event::PreviousRightPort, "PreviousRightPort"},
+ {Event::NextRightPort, "NextRightPort"},
+ {Event::ToggleSwapPorts, "ToggleSwapPorts"},
+ {Event::ToggleSwapPaddles,"ToggleSwapPaddles"},
+ {Event::DecreasePaddleCenterX, "DecreasePaddleCenterX"},
+ {Event::IncreasePaddleCenterX, "IncreasePaddleCenterX"},
+ {Event::DecreasePaddleCenterY, "DecreasePaddleCenterY"},
+ {Event::IncreasePaddleCenterY, "IncreasePaddleCenterY"},
+ {Event::PreviousMouseControl, "PreviousMouseControl"},
+ {Event::NextMouseControl, "NextMouseControl"},
+ {Event::DecreaseMouseAxesRange, "DecreaseMouseAxesRange"},
+ {Event::IncreaseMouseAxesRange, "IncreaseMouseAxesRange"},
+
{Event::Combo1, "Combo1"},
{Event::Combo2, "Combo2"},
{Event::Combo3, "Combo3"},
@@ -192,8 +263,6 @@ NLOHMANN_JSON_SERIALIZE_ENUM(Event::Type, {
{Event::UIPrevDir, "UIPrevDir"},
{Event::UITabPrev, "UITabPrev"},
{Event::UITabNext, "UITabNext"},
- {Event::HandleMouseControl, "HandleMouseControl"},
- {Event::ToggleGrabMouse, "ToggleGrabMouse"},
{Event::MouseAxisXMove, "MouseAxisXMove"},
{Event::MouseAxisYMove, "MouseAxisYMove"},
{Event::MouseAxisXValue, "MouseAxisXValue"},
@@ -287,7 +356,6 @@ NLOHMANN_JSON_SERIALIZE_ENUM(Event::Type, {
{Event::ToggleBits, "ToggleBits"},
{Event::ToggleFixedColors, "ToggleFixedColors"},
{Event::ToggleFrameStats, "ToggleFrameStats"},
- {Event::ToggleSAPortOrder, "ToggleSAPortOrder"},
{Event::ExitGame, "ExitGame"},
{Event::SettingDecrease, "SettingDecrease"},
{Event::SettingIncrease, "SettingIncrease"},
@@ -302,16 +370,6 @@ NLOHMANN_JSON_SERIALIZE_ENUM(Event::Type, {
{Event::IncreaseAutoFire, "IncreaseAutoFire"},
{Event::DecreaseSpeed, "DecreaseSpeed"},
{Event::IncreaseSpeed, "IncreaseSpeed"},
- {Event::JoystickTwoUp, "JoystickTwoUp"},
- {Event::JoystickTwoDown, "JoystickTwoDown"},
- {Event::JoystickTwoLeft, "JoystickTwoLeft"},
- {Event::JoystickTwoRight, "JoystickTwoRight"},
- {Event::JoystickTwoFire, "JoystickTwoFire"},
- {Event::JoystickThreeUp, "JoystickThreeUp"},
- {Event::JoystickThreeDown, "JoystickThreeDown"},
- {Event::JoystickThreeLeft, "JoystickThreeLeft"},
- {Event::JoystickThreeRight, "JoystickThreeRight"},
- {Event::JoystickThreeFire, "JoystickThreeFire"},
{Event::ToggleCorrectAspectRatio, "ToggleCorrectAspectRatio"},
{Event::MoveLeftChar, "MoveLeftChar"},
{Event::MoveRightChar, "MoveRightChar"},
diff --git a/src/common/repository/KeyValueRepositoryConfigfile.cxx b/src/common/repository/KeyValueRepositoryConfigfile.cxx
index ca9f6b3a4..b0e6ae725 100644
--- a/src/common/repository/KeyValueRepositoryConfigfile.cxx
+++ b/src/common/repository/KeyValueRepositoryConfigfile.cxx
@@ -29,7 +29,7 @@ namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyValueRepositoryConfigfile::KeyValueRepositoryConfigfile(const FilesystemNode& file)
- : myFile(file)
+ : myFile{file}
{
}
diff --git a/src/common/repository/sqlite/KeyValueRepositorySqlite.cxx b/src/common/repository/sqlite/KeyValueRepositorySqlite.cxx
index 7264c4cb6..c871521b3 100644
--- a/src/common/repository/sqlite/KeyValueRepositorySqlite.cxx
+++ b/src/common/repository/sqlite/KeyValueRepositorySqlite.cxx
@@ -22,10 +22,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyValueRepositorySqlite::KeyValueRepositorySqlite(
- SqliteDatabase& db,
- const string& tableName
-) : myTableName(tableName),
- myDb(db)
+ SqliteDatabase& db, const string& tableName)
+ : myTableName{tableName},
+ myDb{db}
{
}
diff --git a/src/common/repository/sqlite/SettingsDb.cxx b/src/common/repository/sqlite/SettingsDb.cxx
index 15116aa4e..2d276c188 100644
--- a/src/common/repository/sqlite/SettingsDb.cxx
+++ b/src/common/repository/sqlite/SettingsDb.cxx
@@ -20,11 +20,9 @@
#include "SqliteError.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-SettingsDb::SettingsDb(
- const string& databaseDirectory,
- const string& databaseName
-) : myDatabaseDirectory(databaseDirectory),
- myDatabaseName(databaseName)
+SettingsDb::SettingsDb(const string& databaseDirectory, const string& databaseName)
+ : myDatabaseDirectory{databaseDirectory},
+ myDatabaseName{databaseName}
{
}
diff --git a/src/common/repository/sqlite/SqliteDatabase.cxx b/src/common/repository/sqlite/SqliteDatabase.cxx
index 4b1edc09e..9d8e239d8 100644
--- a/src/common/repository/sqlite/SqliteDatabase.cxx
+++ b/src/common/repository/sqlite/SqliteDatabase.cxx
@@ -24,7 +24,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SqliteDatabase::SqliteDatabase(const string& databaseDirectory,
const string& databaseName)
- : myDatabaseFile(databaseDirectory + databaseName + ".sqlite3")
+ : myDatabaseFile{databaseDirectory + databaseName + ".sqlite3"}
{
}
diff --git a/src/common/repository/sqlite/SqliteStatement.cxx b/src/common/repository/sqlite/SqliteStatement.cxx
index 5043e2fc8..87dc25d34 100644
--- a/src/common/repository/sqlite/SqliteStatement.cxx
+++ b/src/common/repository/sqlite/SqliteStatement.cxx
@@ -19,7 +19,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SqliteStatement::SqliteStatement(sqlite3* handle, const string& sql)
- : myHandle(handle)
+ : myHandle{handle}
{
if (sqlite3_prepare_v2(handle, sql.c_str(), -1, &myStmt, nullptr) != SQLITE_OK)
throw SqliteError(handle);
diff --git a/src/common/repository/sqlite/SqliteTransaction.cxx b/src/common/repository/sqlite/SqliteTransaction.cxx
index 45c022d5c..2bda587a0 100644
--- a/src/common/repository/sqlite/SqliteTransaction.cxx
+++ b/src/common/repository/sqlite/SqliteTransaction.cxx
@@ -20,7 +20,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SqliteTransaction::SqliteTransaction(SqliteDatabase& db)
- : myDb(db)
+ : myDb{db}
{
myDb.exec("BEGIN TRANSACTION");
}
diff --git a/src/common/sdl_blitter/BilinearBlitter.cxx b/src/common/sdl_blitter/BilinearBlitter.cxx
index d8f25d133..ff792eb57 100644
--- a/src/common/sdl_blitter/BilinearBlitter.cxx
+++ b/src/common/sdl_blitter/BilinearBlitter.cxx
@@ -21,8 +21,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BilinearBlitter::BilinearBlitter(FBBackendSDL2& fb, bool interpolate)
- : myFB(fb),
- myInterpolate(interpolate)
+ : myFB{fb},
+ myInterpolate{interpolate}
{
}
diff --git a/src/common/sdl_blitter/BlitterFactory.cxx b/src/common/sdl_blitter/BlitterFactory.cxx
index 3c969b71b..018f10400 100644
--- a/src/common/sdl_blitter/BlitterFactory.cxx
+++ b/src/common/sdl_blitter/BlitterFactory.cxx
@@ -21,7 +21,8 @@
#include "BilinearBlitter.hxx"
#include "QisBlitter.hxx"
-unique_ptr BlitterFactory::createBlitter(FBBackendSDL2& fb, ScalingAlgorithm scaling)
+unique_ptr
+BlitterFactory::createBlitter(FBBackendSDL2& fb, ScalingAlgorithm scaling)
{
if (!fb.isInitialized()) {
throw runtime_error("BlitterFactory requires an initialized framebuffer!");
diff --git a/src/common/sdl_blitter/QisBlitter.cxx b/src/common/sdl_blitter/QisBlitter.cxx
index c0b7f7dbd..cafc4040a 100644
--- a/src/common/sdl_blitter/QisBlitter.cxx
+++ b/src/common/sdl_blitter/QisBlitter.cxx
@@ -21,7 +21,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
QisBlitter::QisBlitter(FBBackendSDL2& fb)
- : myFB(fb)
+ : myFB{fb}
{
}
diff --git a/src/common/tv_filters/NTSCFilter.cxx b/src/common/tv_filters/NTSCFilter.cxx
index 5a61dd140..14c38697e 100644
--- a/src/common/tv_filters/NTSCFilter.cxx
+++ b/src/common/tv_filters/NTSCFilter.cxx
@@ -192,7 +192,7 @@ void NTSCFilter::getAdjustables(Adjustable& adjustable, Preset preset) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void NTSCFilter::setCustomAdjustables(Adjustable& adjustable)
+void NTSCFilter::setCustomAdjustables(const Adjustable& adjustable)
{
#ifdef BLARGG_PALETTE
//myCustomSetup.hue = scaleFrom100(adjustable.hue);
diff --git a/src/common/tv_filters/NTSCFilter.hxx b/src/common/tv_filters/NTSCFilter.hxx
index b4b3aa713..fd5335806 100644
--- a/src/common/tv_filters/NTSCFilter.hxx
+++ b/src/common/tv_filters/NTSCFilter.hxx
@@ -90,7 +90,7 @@ class NTSCFilter
// Set custom adjustables to given values
// Values will be scaled to 0 - 100 range, independent of how
// they're actually stored internally
- void setCustomAdjustables(Adjustable& adjustable);
+ void setCustomAdjustables(const Adjustable& adjustable);
// The following methods cycle through each custom adjustable
// They are used in conjunction with the increase/decrease
diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx
index ab988e000..2eeb749d0 100644
--- a/src/debugger/CartDebug.cxx
+++ b/src/debugger/CartDebug.cxx
@@ -48,7 +48,7 @@ using std::right;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem)
: DebuggerSystem(dbg, console),
- myOSystem(osystem)
+ myOSystem{osystem}
{
// Add case sensitive compare for user labels
// TODO - should user labels be case insensitive too?
@@ -1516,7 +1516,7 @@ CartDebug::AddrType CartDebug::addressType(uInt16 addr) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void CartDebug::getBankDirectives(ostream& buf, BankInfo& info) const
+void CartDebug::getBankDirectives(ostream& buf, const BankInfo& info) const
{
// Start with the offset for this bank
buf << "ORG " << Base::HEX4 << info.offset << endl;
diff --git a/src/debugger/CartDebug.hxx b/src/debugger/CartDebug.hxx
index 25dd59e63..21b01d0e2 100644
--- a/src/debugger/CartDebug.hxx
+++ b/src/debugger/CartDebug.hxx
@@ -324,7 +324,7 @@ class CartDebug : public DebuggerSystem
// Analyze of bank of ROM, generating a list of Distella directives
// based on its disassembly
- void getBankDirectives(ostream& buf, BankInfo& info) const;
+ void getBankDirectives(ostream& buf, const BankInfo& info) const;
// Get access enum type from 'flags', taking precendence into account
Device::AccessType accessTypeAbsolute(Device::AccessFlags flags) const;
diff --git a/src/debugger/CpuDebug.cxx b/src/debugger/CpuDebug.cxx
index f0bf9be12..e564a1fa2 100644
--- a/src/debugger/CpuDebug.cxx
+++ b/src/debugger/CpuDebug.cxx
@@ -27,7 +27,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CpuDebug::CpuDebug(Debugger& dbg, Console& console)
: DebuggerSystem(dbg, console),
- my6502(mySystem.m6502())
+ my6502{mySystem.m6502()}
{
}
diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx
index abfc63ac1..fc128bbf5 100644
--- a/src/debugger/Debugger.cxx
+++ b/src/debugger/Debugger.cxx
@@ -62,8 +62,8 @@ Debugger* Debugger::myStaticDebugger = nullptr;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Debugger::Debugger(OSystem& osystem, Console& console)
: DialogContainer(osystem),
- myConsole(console),
- mySystem(console.system())
+ myConsole{console},
+ mySystem{console.system()}
{
// Init parser
myParser = make_unique(*this, osystem.settings());
@@ -716,10 +716,8 @@ bool Debugger::addFunction(const string& name, const string& definition,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Debugger::isBuiltinFunction(const string& name)
{
- for(const auto& func: ourBuiltinFunctions)
- if(name == func.name)
- return true;
- return false;
+ return std::any_of(ourBuiltinFunctions.cbegin(), ourBuiltinFunctions.cend(),
+ [&](const auto& func) { return name == func.name; });
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/debugger/DebuggerExpressions.hxx b/src/debugger/DebuggerExpressions.hxx
index 060411c09..616bb2d43 100644
--- a/src/debugger/DebuggerExpressions.hxx
+++ b/src/debugger/DebuggerExpressions.hxx
@@ -91,7 +91,7 @@ class ByteDerefOffsetExpression : public Expression
class ConstExpression : public Expression
{
public:
- ConstExpression(const int value) : Expression(), myValue(value) { }
+ ConstExpression(const int value) : Expression(), myValue{value} { }
Int32 evaluate() const override
{ return myValue; }
@@ -103,7 +103,7 @@ class ConstExpression : public Expression
class CpuMethodExpression : public Expression
{
public:
- CpuMethodExpression(CpuMethod method) : Expression(), myMethod(std::mem_fn(method)) { }
+ CpuMethodExpression(CpuMethod method) : Expression(), myMethod{std::mem_fn(method)} { }
Int32 evaluate() const override
{ return myMethod(Debugger::debugger().cpuDebug()); }
@@ -134,7 +134,7 @@ class EqualsExpression : public Expression
class EquateExpression : public Expression
{
public:
- EquateExpression(const string& label) : Expression(), myLabel(label) { }
+ EquateExpression(const string& label) : Expression(), myLabel{label} { }
Int32 evaluate() const override
{ return Debugger::debugger().cartDebug().getAddress(myLabel); }
@@ -146,7 +146,7 @@ class EquateExpression : public Expression
class FunctionExpression : public Expression
{
public:
- FunctionExpression(const string& label) : Expression(), myLabel(label) { }
+ FunctionExpression(const string& label) : Expression(), myLabel{label} { }
Int32 evaluate() const override
{ return Debugger::debugger().getFunction(myLabel).evaluate(); }
@@ -285,7 +285,7 @@ class PlusExpression : public Expression
class CartMethodExpression : public Expression
{
public:
- CartMethodExpression(CartMethod method) : Expression(), myMethod(std::mem_fn(method)) { }
+ CartMethodExpression(CartMethod method) : Expression(), myMethod{std::mem_fn(method)} { }
Int32 evaluate() const override
{ return myMethod(Debugger::debugger().cartDebug()); }
@@ -315,7 +315,7 @@ class ShiftRightExpression : public Expression
class RiotMethodExpression : public Expression
{
public:
- RiotMethodExpression(RiotMethod method) : Expression(), myMethod(std::mem_fn(method)) { }
+ RiotMethodExpression(RiotMethod method) : Expression(), myMethod{std::mem_fn(method)} { }
Int32 evaluate() const override
{ return myMethod(Debugger::debugger().riotDebug()); }
@@ -327,7 +327,7 @@ class RiotMethodExpression : public Expression
class TiaMethodExpression : public Expression
{
public:
- TiaMethodExpression(TiaMethod method) : Expression(), myMethod(std::mem_fn(method)) { }
+ TiaMethodExpression(TiaMethod method) : Expression(), myMethod{std::mem_fn(method)} { }
Int32 evaluate() const override
{ return myMethod(Debugger::debugger().tiaDebug()); }
diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx
index d6f87b15d..599c6eb31 100644
--- a/src/debugger/DebuggerParser.cxx
+++ b/src/debugger/DebuggerParser.cxx
@@ -57,8 +57,8 @@ using std::right;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DebuggerParser::DebuggerParser(Debugger& d, Settings& s)
- : debugger(d),
- settings(s)
+ : debugger{d},
+ settings{s}
{
}
diff --git a/src/debugger/DiStella.cxx b/src/debugger/DiStella.cxx
index c77d1eabf..10c277c8f 100644
--- a/src/debugger/DiStella.cxx
+++ b/src/debugger/DiStella.cxx
@@ -27,12 +27,12 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
CartDebug::AddrTypeArray& labels,
CartDebug::AddrTypeArray& directives,
CartDebug::ReservedEquates& reserved)
- : myDbg(dbg),
- myList(list),
- mySettings(s),
- myReserved(reserved),
- myLabels(labels),
- myDirectives(directives)
+ : myDbg{dbg},
+ myList{list},
+ mySettings{s},
+ myReserved{reserved},
+ myLabels{labels},
+ myDirectives{directives}
{
bool resolve_code = mySettings.resolveCode;
CartDebug::AddressList& debuggerAddresses = info.addressList;
diff --git a/src/debugger/Expression.hxx b/src/debugger/Expression.hxx
index 04eddec49..3865181ce 100644
--- a/src/debugger/Expression.hxx
+++ b/src/debugger/Expression.hxx
@@ -32,7 +32,7 @@ class Expression
{
public:
Expression(Expression* lhs = nullptr, Expression* rhs = nullptr)
- : myLHS(lhs), myRHS(rhs) { }
+ : myLHS{lhs}, myRHS{rhs} { }
virtual ~Expression() = default;
virtual Int32 evaluate() const { return 0; }
diff --git a/src/debugger/TIADebug.cxx b/src/debugger/TIADebug.cxx
index 01b870d68..87e91fcfb 100644
--- a/src/debugger/TIADebug.cxx
+++ b/src/debugger/TIADebug.cxx
@@ -26,7 +26,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TIADebug::TIADebug(Debugger& dbg, Console& console)
: DebuggerSystem(dbg, console),
- myTIA(console.tia())
+ myTIA{console.tia()}
{
}
diff --git a/src/debugger/gui/Cart3EPlusWidget.cxx b/src/debugger/gui/Cart3EPlusWidget.cxx
index cd0fda251..bf62f3384 100644
--- a/src/debugger/gui/Cart3EPlusWidget.cxx
+++ b/src/debugger/gui/Cart3EPlusWidget.cxx
@@ -25,7 +25,7 @@ Cartridge3EPlusWidget::Cartridge3EPlusWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, Cartridge3EPlus& cart)
: CartridgeEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart),
- myCart3EP(cart)
+ myCart3EP{cart}
{
initialize();
}
diff --git a/src/debugger/gui/Cart4A50Widget.cxx b/src/debugger/gui/Cart4A50Widget.cxx
index 1fed0eecb..c4801f5cf 100644
--- a/src/debugger/gui/Cart4A50Widget.cxx
+++ b/src/debugger/gui/Cart4A50Widget.cxx
@@ -24,7 +24,7 @@ Cartridge4A50Widget::Cartridge4A50Widget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, Cartridge4A50& cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
- myCart(cart)
+ myCart{cart}
{
string info =
"4A50 cartridge - 128K ROM and 32K RAM, split in various bank configurations\n"
diff --git a/src/debugger/gui/CartARWidget.cxx b/src/debugger/gui/CartARWidget.cxx
index ec4c4037a..6d9af58c7 100644
--- a/src/debugger/gui/CartARWidget.cxx
+++ b/src/debugger/gui/CartARWidget.cxx
@@ -27,7 +27,7 @@ CartridgeARWidget::CartridgeARWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, CartridgeAR& cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
- myCart(cart)
+ myCart{cart}
{
size_t size = myCart.mySize;
diff --git a/src/debugger/gui/CartBUSWidget.cxx b/src/debugger/gui/CartBUSWidget.cxx
index 8f6a9b22b..6699143ec 100644
--- a/src/debugger/gui/CartBUSWidget.cxx
+++ b/src/debugger/gui/CartBUSWidget.cxx
@@ -25,7 +25,7 @@ CartridgeBUSWidget::CartridgeBUSWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, CartridgeBUS& cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
- myCart(cart)
+ myCart{cart}
{
uInt16 size = 8 * 4096;
@@ -75,7 +75,6 @@ CartridgeBUSWidget::CartridgeBUSWidget(
ypos += myLineHeight + 4;
new StaticTextWidget(boss, _font, xpos, ypos, lwidth,
myFontHeight, "Datastream Pointers", TextAlign::Left);
- xpos += lwidth;
myDatastreamPointers = new DataGridWidget(boss, _nfont, DS_X, ypos+myLineHeight-2, 4, 4, 6, 32, Common::Base::Fmt::_16_3_2);
myDatastreamPointers->setTarget(this);
diff --git a/src/debugger/gui/CartCDFWidget.cxx b/src/debugger/gui/CartCDFWidget.cxx
index 8b43d0fc8..f6541cc93 100644
--- a/src/debugger/gui/CartCDFWidget.cxx
+++ b/src/debugger/gui/CartCDFWidget.cxx
@@ -24,7 +24,7 @@ CartridgeCDFWidget::CartridgeCDFWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, CartridgeCDF& cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
- myCart(cart)
+ myCart{cart}
{
const int VBORDER = 8;
const int HBORDER = 2;
diff --git a/src/debugger/gui/CartCMWidget.cxx b/src/debugger/gui/CartCMWidget.cxx
index e4d11ba55..7616ea61b 100644
--- a/src/debugger/gui/CartCMWidget.cxx
+++ b/src/debugger/gui/CartCMWidget.cxx
@@ -31,7 +31,7 @@ CartridgeCMWidget::CartridgeCMWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, CartridgeCM& cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
- myCart(cart)
+ myCart{cart}
{
uInt16 size = 4 * 4096;
diff --git a/src/debugger/gui/CartCTYWidget.cxx b/src/debugger/gui/CartCTYWidget.cxx
index 659fb9bea..8c15b1e9f 100644
--- a/src/debugger/gui/CartCTYWidget.cxx
+++ b/src/debugger/gui/CartCTYWidget.cxx
@@ -27,7 +27,7 @@ CartridgeCTYWidget::CartridgeCTYWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, CartridgeCTY& cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
- myCart(cart)
+ myCart{cart}
{
uInt16 size = 8 * 4096;
diff --git a/src/debugger/gui/CartDPCPlusWidget.cxx b/src/debugger/gui/CartDPCPlusWidget.cxx
index 18166c6af..1bdfef379 100644
--- a/src/debugger/gui/CartDPCPlusWidget.cxx
+++ b/src/debugger/gui/CartDPCPlusWidget.cxx
@@ -25,7 +25,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, CartridgeDPCPlus& cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
- myCart(cart)
+ myCart{cart}
{
size_t size = cart.mySize;
diff --git a/src/debugger/gui/CartDPCWidget.cxx b/src/debugger/gui/CartDPCWidget.cxx
index 681b3692d..c6fb55d49 100644
--- a/src/debugger/gui/CartDPCWidget.cxx
+++ b/src/debugger/gui/CartDPCWidget.cxx
@@ -25,7 +25,7 @@ CartridgeDPCWidget::CartridgeDPCWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, CartridgeDPC& cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
- myCart(cart)
+ myCart{cart}
{
const int V_GAP = 4;
size_t size = cart.mySize;
@@ -68,11 +68,10 @@ CartridgeDPCWidget::CartridgeDPCWidget(
ypos += myLineHeight + V_GAP * 3;
// Data fetchers
- int lwidth = _font.getStringWidth("Data fetchers ");
new StaticTextWidget(boss, _font, xpos, ypos, "Data fetchers ");
// Top registers
- lwidth = _font.getStringWidth("Counter registers ");
+ int lwidth = _font.getStringWidth("Counter registers ");
xpos = 2 + _font.getMaxCharWidth() * 2; ypos += myLineHeight + 4;
new StaticTextWidget(boss, _font, xpos, ypos, "Top registers ");
xpos += lwidth;
diff --git a/src/debugger/gui/CartDebugWidget.cxx b/src/debugger/gui/CartDebugWidget.cxx
index 778a70c50..0fa29bb96 100644
--- a/src/debugger/gui/CartDebugWidget.cxx
+++ b/src/debugger/gui/CartDebugWidget.cxx
@@ -29,11 +29,11 @@ CartDebugWidget::CartDebugWidget(GuiObject* boss, const GUI::Font& lfont,
int x, int y, int w, int h)
: Widget(boss, lfont, x, y, w, h),
CommandSender(boss),
- _nfont(nfont),
- myFontWidth(lfont.getMaxCharWidth()),
- myFontHeight(lfont.getFontHeight()),
- myLineHeight(lfont.getLineHeight()),
- myButtonHeight(myLineHeight + 4)
+ _nfont{nfont},
+ myFontWidth{lfont.getMaxCharWidth()},
+ myFontHeight{lfont.getFontHeight()},
+ myLineHeight{lfont.getLineHeight()},
+ myButtonHeight{myLineHeight + 4}
{
}
diff --git a/src/debugger/gui/CartE78KWidget.cxx b/src/debugger/gui/CartE78KWidget.cxx
index 2ad1c012e..24c39e8f1 100644
--- a/src/debugger/gui/CartE78KWidget.cxx
+++ b/src/debugger/gui/CartE78KWidget.cxx
@@ -21,9 +21,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeE78KWidget::CartridgeE78KWidget(
- GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
- int x, int y, int w, int h,
- CartridgeMNetwork& cart)
+ GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
+ int x, int y, int w, int h,
+ CartridgeMNetwork& cart)
: CartridgeMNetworkWidget(boss, lfont, nfont, x, y, w, h, cart)
{
ostringstream info;
diff --git a/src/debugger/gui/CartEnhancedWidget.cxx b/src/debugger/gui/CartEnhancedWidget.cxx
index 80da02ffd..486dddaca 100644
--- a/src/debugger/gui/CartEnhancedWidget.cxx
+++ b/src/debugger/gui/CartEnhancedWidget.cxx
@@ -28,7 +28,7 @@ CartridgeEnhancedWidget::CartridgeEnhancedWidget(GuiObject* boss, const GUI::Fon
int x, int y, int w, int h,
CartridgeEnhanced& cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
- myCart(cart)
+ myCart{cart}
{
}
diff --git a/src/debugger/gui/CartFA2Widget.cxx b/src/debugger/gui/CartFA2Widget.cxx
index e7dcba933..22020ad69 100644
--- a/src/debugger/gui/CartFA2Widget.cxx
+++ b/src/debugger/gui/CartFA2Widget.cxx
@@ -23,7 +23,7 @@ CartridgeFA2Widget::CartridgeFA2Widget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, CartridgeFA2& cart)
: CartridgeEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart),
- myCartFA2(cart)
+ myCartFA2{cart}
{
int xpos = 2,
ypos = initialize();
diff --git a/src/debugger/gui/CartFCWidget.cxx b/src/debugger/gui/CartFCWidget.cxx
index d206ec694..2d7d29efe 100644
--- a/src/debugger/gui/CartFCWidget.cxx
+++ b/src/debugger/gui/CartFCWidget.cxx
@@ -20,8 +20,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeFCWidget::CartridgeFCWidget(
- GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
- int x, int y, int w, int h, CartridgeFC& cart)
+ GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
+ int x, int y, int w, int h, CartridgeFC& cart)
: CartridgeEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart)
{
initialize();
diff --git a/src/debugger/gui/CartMDMWidget.cxx b/src/debugger/gui/CartMDMWidget.cxx
index 3b1084aee..7e476734c 100644
--- a/src/debugger/gui/CartMDMWidget.cxx
+++ b/src/debugger/gui/CartMDMWidget.cxx
@@ -24,7 +24,7 @@ CartridgeMDMWidget::CartridgeMDMWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, CartridgeMDM& cart)
: CartridgeEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart),
- myCartMDM(cart)
+ myCartMDM{cart}
{
initialize();
}
diff --git a/src/debugger/gui/CartMNetworkWidget.cxx b/src/debugger/gui/CartMNetworkWidget.cxx
index e56a1ecb7..b251faebf 100644
--- a/src/debugger/gui/CartMNetworkWidget.cxx
+++ b/src/debugger/gui/CartMNetworkWidget.cxx
@@ -26,7 +26,7 @@ CartridgeMNetworkWidget::CartridgeMNetworkWidget(
int x, int y, int w, int h,
CartridgeMNetwork& cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
- myCart(cart)
+ myCart{cart}
{
}
diff --git a/src/debugger/gui/CartRamWidget.cxx b/src/debugger/gui/CartRamWidget.cxx
index 0ab421df3..5cdb5e261 100644
--- a/src/debugger/gui/CartRamWidget.cxx
+++ b/src/debugger/gui/CartRamWidget.cxx
@@ -33,11 +33,11 @@ CartRamWidget::CartRamWidget(
int x, int y, int w, int h, CartDebugWidget& cartDebug)
: Widget(boss, lfont, x, y, w, h),
CommandSender(boss),
- _nfont(nfont),
- myFontWidth(lfont.getMaxCharWidth()),
- myFontHeight(lfont.getFontHeight()),
- myLineHeight(lfont.getLineHeight()),
- myButtonHeight(myLineHeight + 4)
+ _nfont{nfont},
+ myFontWidth{lfont.getMaxCharWidth()},
+ myFontHeight{lfont.getFontHeight()},
+ myLineHeight{lfont.getLineHeight()},
+ myButtonHeight{myLineHeight + 4}
{
int lwidth = lfont.getStringWidth("Description "),
fwidth = w - lwidth - 20;
diff --git a/src/debugger/gui/CartTVBoyWidget.cxx b/src/debugger/gui/CartTVBoyWidget.cxx
index 891a39b38..306cc1f75 100644
--- a/src/debugger/gui/CartTVBoyWidget.cxx
+++ b/src/debugger/gui/CartTVBoyWidget.cxx
@@ -24,7 +24,7 @@ CartridgeTVBoyWidget::CartridgeTVBoyWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, CartridgeTVBoy& cart)
: CartridgeEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart),
- myCartTVBoy(cart)
+ myCartTVBoy{cart}
{
initialize();
}
diff --git a/src/debugger/gui/CartUAWidget.cxx b/src/debugger/gui/CartUAWidget.cxx
index 02728b52d..5b65db7fc 100644
--- a/src/debugger/gui/CartUAWidget.cxx
+++ b/src/debugger/gui/CartUAWidget.cxx
@@ -23,7 +23,7 @@ CartridgeUAWidget::CartridgeUAWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, CartridgeUA& cart, bool swapHotspots)
: CartridgeEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart),
- mySwappedHotspots(swapHotspots)
+ mySwappedHotspots{swapHotspots}
{
myHotspotDelta = 0x20;
initialize();
diff --git a/src/debugger/gui/CartWDWidget.cxx b/src/debugger/gui/CartWDWidget.cxx
index 268e81bf1..6d2219e25 100644
--- a/src/debugger/gui/CartWDWidget.cxx
+++ b/src/debugger/gui/CartWDWidget.cxx
@@ -23,7 +23,7 @@ CartridgeWDWidget::CartridgeWDWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, CartridgeWD& cart)
: CartridgeEnhancedWidget(boss, lfont, nfont, x, y, w, h, cart),
- myCartWD(cart)
+ myCartWD{cart}
{
initialize();
}
diff --git a/src/debugger/gui/DataGridRamWidget.cxx b/src/debugger/gui/DataGridRamWidget.cxx
index 96e11a004..6c663e313 100644
--- a/src/debugger/gui/DataGridRamWidget.cxx
+++ b/src/debugger/gui/DataGridRamWidget.cxx
@@ -27,7 +27,7 @@ DataGridRamWidget::DataGridRamWidget(GuiObject* boss, const RamWidget& ram,
bool useScrollbar)
: DataGridWidget(boss, font, x, y, cols, rows, colchars,
bits, base, useScrollbar),
- _ram(ram)
+ _ram{ram}
{
}
diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx
index 2e7214379..dfa514826 100644
--- a/src/debugger/gui/DataGridWidget.cxx
+++ b/src/debugger/gui/DataGridWidget.cxx
@@ -38,12 +38,12 @@ DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
: EditableWidget(boss, font, x, y,
cols*(colchars * font.getMaxCharWidth() + 8) + 1,
font.getLineHeight()*rows + 1),
- _rows(rows),
- _cols(cols),
- _rowHeight(font.getLineHeight()),
- _colWidth(colchars * font.getMaxCharWidth() + 8),
- _bits(bits),
- _base(base)
+ _rows{rows},
+ _cols{cols},
+ _rowHeight{font.getLineHeight()},
+ _colWidth{colchars * font.getMaxCharWidth() + 8},
+ _bits{bits},
+ _base{base}
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_RETAIN_FOCUS | Widget::FLAG_WANTS_RAWDATA;
_editMode = false;
diff --git a/src/debugger/gui/PromptWidget.cxx b/src/debugger/gui/PromptWidget.cxx
index 116080bf7..1ed5b2350 100644
--- a/src/debugger/gui/PromptWidget.cxx
+++ b/src/debugger/gui/PromptWidget.cxx
@@ -41,12 +41,12 @@ PromptWidget::PromptWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h)
: Widget(boss, font, x, y, w - ScrollBarWidget::scrollBarWidth(font), h),
CommandSender(boss),
- _historySize(0),
- _historyIndex(0),
- _historyLine(0),
- _makeDirty(false),
- _firstTime(true),
- _exitedEarly(false)
+ _historySize{0},
+ _historyIndex{0},
+ _historyLine{0},
+ _makeDirty{false},
+ _firstTime{true},
+ _exitedEarly{false}
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS |
Widget::FLAG_WANTS_TAB | Widget::FLAG_WANTS_RAWDATA;
diff --git a/src/debugger/gui/RamWidget.cxx b/src/debugger/gui/RamWidget.cxx
index 4e097d9be..468784081 100644
--- a/src/debugger/gui/RamWidget.cxx
+++ b/src/debugger/gui/RamWidget.cxx
@@ -33,14 +33,14 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
uInt32 ramsize, uInt32 numrows, uInt32 pagesize)
: Widget(boss, lfont, x, y, w, h),
CommandSender(boss),
- _nfont(nfont),
- myFontWidth(lfont.getMaxCharWidth()),
- myFontHeight(lfont.getFontHeight()),
- myLineHeight(lfont.getLineHeight()),
- myButtonHeight(myLineHeight * 1.25),
- myRamSize(ramsize),
- myNumRows(numrows),
- myPageSize(pagesize)
+ _nfont{nfont},
+ myFontWidth{lfont.getMaxCharWidth()},
+ myFontHeight{lfont.getFontHeight()},
+ myLineHeight{lfont.getLineHeight()},
+ myButtonHeight{static_cast(myLineHeight * 1.25)},
+ myRamSize{ramsize},
+ myNumRows{numrows},
+ myPageSize{pagesize}
{
const int bwidth = lfont.getStringWidth("Compare " + ELLIPSIS),
bheight = myLineHeight + 2;
diff --git a/src/debugger/gui/RiotRamWidget.cxx b/src/debugger/gui/RiotRamWidget.cxx
index 5f3d5c0ab..501ccadce 100644
--- a/src/debugger/gui/RiotRamWidget.cxx
+++ b/src/debugger/gui/RiotRamWidget.cxx
@@ -25,7 +25,7 @@
RiotRamWidget::RiotRamWidget(GuiObject* boss, const GUI::Font& lfont,
const GUI::Font& nfont, int x, int y, int w)
: RamWidget(boss, lfont, nfont, x, y, w, 0, 128, 8, 128),
- myDbg(instance().debugger().cartDebug())
+ myDbg{instance().debugger().cartDebug()}
{
}
diff --git a/src/debugger/gui/RomListSettings.hxx b/src/debugger/gui/RomListSettings.hxx
index a589b0334..d22a63d2b 100644
--- a/src/debugger/gui/RomListSettings.hxx
+++ b/src/debugger/gui/RomListSettings.hxx
@@ -34,6 +34,8 @@ class RomListSettings : public Dialog, public CommandSender
RomListSettings(GuiObject* boss, const GUI::Font& font);
~RomListSettings() override = default;
+ bool isShading() const override { return false; }
+
/** Show dialog onscreen at the specified coordinates
('data' will be the currently selected line number in RomListWidget) */
void show(uInt32 x, uInt32 y, const Common::Rect& bossRect, int data = -1);
diff --git a/src/debugger/gui/TiaInfoWidget.cxx b/src/debugger/gui/TiaInfoWidget.cxx
index fe2ce6d9b..9886da9b6 100644
--- a/src/debugger/gui/TiaInfoWidget.cxx
+++ b/src/debugger/gui/TiaInfoWidget.cxx
@@ -42,7 +42,6 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
+ COLUMN_GAP + lfont.getStringWidth("Scanline262262")
+ EditTextWidget::calcWidth(lfont) * 3 <= max_w;
const int lineHeight = lfont.getLineHeight();
- int xpos = x, ypos = y + VBORDER;
int lwidth = lfont.getStringWidth(longstr ? "Frame Cycls" : "F. Cycls");
int lwidth8 = lwidth - lfont.getMaxCharWidth() * 3;
int lwidthR = lfont.getStringWidth(longstr ? "Frame Cnt." : "Frame ");
@@ -57,7 +56,7 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
// Left column
// Left: Frame Cycle
- xpos = x;
+ int xpos = x, ypos = y + VBORDER;
new StaticTextWidget(boss, lfont, xpos, ypos + 1, longstr ? "Frame Cycls" : "F. Cycls");
myFrameCycles = new EditTextWidget(boss, nfont, xpos + lwidth, ypos - 1, fwidth, lineHeight);
myFrameCycles->setToolTip("CPU cycles executed this frame.");
diff --git a/src/debugger/gui/ToggleBitWidget.cxx b/src/debugger/gui/ToggleBitWidget.cxx
index 66868ac43..b1ac7cdf0 100644
--- a/src/debugger/gui/ToggleBitWidget.cxx
+++ b/src/debugger/gui/ToggleBitWidget.cxx
@@ -28,7 +28,7 @@ ToggleBitWidget::ToggleBitWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int cols, int rows, int colchars,
const StringList& labels)
: ToggleWidget(boss, font, x, y, cols, rows),
- _labelList(labels)
+ _labelList{labels}
{
_rowHeight = font.getLineHeight();
_colWidth = colchars * font.getMaxCharWidth() + 8;
diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx
index adb33e118..bebee597d 100644
--- a/src/debugger/gui/ToggleWidget.cxx
+++ b/src/debugger/gui/ToggleWidget.cxx
@@ -28,9 +28,9 @@ ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int cols, int rows, int shiftBits)
: Widget(boss, font, x, y, 16, 16),
CommandSender(boss),
- _rows(rows),
- _cols(cols),
- _shiftBits(shiftBits)
+ _rows{rows},
+ _cols{cols},
+ _shiftBits{shiftBits}
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS |
Widget::FLAG_WANTS_RAWDATA;
diff --git a/src/emucore/AtariVox.cxx b/src/emucore/AtariVox.cxx
index 6040b3f6d..fb13408b4 100644
--- a/src/emucore/AtariVox.cxx
+++ b/src/emucore/AtariVox.cxx
@@ -24,9 +24,9 @@
AtariVox::AtariVox(Jack jack, const Event& event, const System& system,
const string& portname, const FilesystemNode& eepromfile,
const onMessageCallback& callback)
- : SaveKey(jack, event, system, eepromfile, callback, Controller::Type::AtariVox)
+ : SaveKey(jack, event, system, eepromfile, callback, Controller::Type::AtariVox),
+ mySerialPort{MediaFactory::createSerialPort()}
{
- mySerialPort = MediaFactory::createSerialPort();
if(mySerialPort->openPort(portname))
{
myCTSFlip = !mySerialPort->isCTS();
diff --git a/src/emucore/Cart.cxx b/src/emucore/Cart.cxx
index d4b5c5c22..b834c7cf8 100644
--- a/src/emucore/Cart.cxx
+++ b/src/emucore/Cart.cxx
@@ -28,7 +28,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge::Cartridge(const Settings& settings, const string& md5)
- : mySettings(settings)
+ : mySettings{settings}
{
auto to_uInt32 = [](const string& s, uInt32 pos) {
return uInt32(std::stoul(s.substr(pos, 8), nullptr, 16));
diff --git a/src/emucore/Cart3F.hxx b/src/emucore/Cart3F.hxx
index fee14e97e..8ea72cc4d 100644
--- a/src/emucore/Cart3F.hxx
+++ b/src/emucore/Cart3F.hxx
@@ -66,7 +66,6 @@ class Cartridge3F : public CartridgeEnhanced
*/
void install(System& system) override;
-
/**
Get a descriptor for the device name (used in error checking).
diff --git a/src/emucore/Cart4A50.cxx b/src/emucore/Cart4A50.cxx
index 6939bc0ef..b060c0d20 100644
--- a/src/emucore/Cart4A50.cxx
+++ b/src/emucore/Cart4A50.cxx
@@ -24,8 +24,8 @@
Cartridge4A50::Cartridge4A50(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
- myImage(make_unique(128_KB)),
- mySize(size)
+ myImage{make_unique(128_KB)},
+ mySize{size}
{
// Copy the ROM image into my buffer
// Supported file sizes are 32/64/128K, which are duplicated if necessary
diff --git a/src/emucore/CartAR.cxx b/src/emucore/CartAR.cxx
index cc58d60be..2cd39c863 100644
--- a/src/emucore/CartAR.cxx
+++ b/src/emucore/CartAR.cxx
@@ -24,7 +24,7 @@
CartridgeAR::CartridgeAR(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
- mySize(std::max(size, 8448))
+ mySize{std::max(size, 8448)}
{
// Create a load image buffer and copy the given image
myLoadImages = make_unique(mySize);
diff --git a/src/emucore/CartBUS.cxx b/src/emucore/CartBUS.cxx
index 688c4b974..28645d270 100644
--- a/src/emucore/CartBUS.cxx
+++ b/src/emucore/CartBUS.cxx
@@ -44,7 +44,7 @@
CartridgeBUS::CartridgeBUS(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
- myImage(make_unique(32_KB))
+ myImage{make_unique(32_KB)}
{
// Copy the ROM image into my buffer
std::copy_n(image.get(), std::min(32_KB, size), myImage.get());
@@ -71,8 +71,8 @@ CartridgeBUS::CartridgeBUS(const ByteBuffer& image, size_t size,
0x00000800,
0x00000808,
0x40001FDC,
- devSettings ? settings.getBool("dev.thumb.trapfatal") : false,
- Thumbulator::ConfigureFor::BUS,
+ devSettings ? settings.getBool("dev.thumb.trapfatal") : false,
+ Thumbulator::ConfigureFor::BUS,
this);
setInitialState();
diff --git a/src/emucore/CartCDF.cxx b/src/emucore/CartCDF.cxx
index b09b50c66..9876485e6 100644
--- a/src/emucore/CartCDF.cxx
+++ b/src/emucore/CartCDF.cxx
@@ -66,7 +66,7 @@ namespace {
CartridgeCDF::CartridgeCDF(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
- myImage(make_unique(512_KB))
+ myImage{make_unique(512_KB)}
{
// Copy the ROM image into my buffer
std::fill_n(myImage.get(), 512_KB, 0);
@@ -107,8 +107,8 @@ CartridgeCDF::CartridgeCDF(const ByteBuffer& image, size_t size,
reinterpret_cast(myRAM.data()),
static_cast(512_KB),
cBase, cStart, cStack,
- devSettings ? settings.getBool("dev.thumb.trapfatal") : false,
- thumulatorConfiguration(myCDFSubtype),
+ devSettings ? settings.getBool("dev.thumb.trapfatal") : false,
+ thumulatorConfiguration(myCDFSubtype),
this);
setInitialState();
@@ -277,7 +277,7 @@ uInt8 CartridgeCDF::peek(uInt16 address)
if DIGITAL_AUDIO_ON
{
// retrieve packed sample (max size is 2K, or 4K of unpacked data)
-
+
uInt32 sampleaddress = getSample() + (myMusicCounters[0] >> (isCDFJplus() ? 13 : 21));
// get sample value from ROM or RAM
@@ -365,7 +365,7 @@ bool CartridgeCDF::poke(uInt16 address, uInt8 value)
pointer = getDatastreamPointer(COMMSTREAM);
if (isCDFJplus()) {
myDisplayImage[ pointer >> 16 ] = value;
- pointer += 0x00010000; // always increment by 1 when writing
+ pointer += 0x00010000; // always increment by 1 when writing
} else {
myDisplayImage[ pointer >> 20 ] = value;
pointer += 0x00100000; // always increment by 1 when writing
@@ -707,7 +707,7 @@ uInt8 CartridgeCDF::readFromDatastream(uInt8 index)
pointer += (increment << 8);
} else {
value = myDisplayImage[ pointer >> 20 ];
- pointer += (increment << 12);
+ pointer += (increment << 12);
}
setDatastreamPointer(index, pointer);
diff --git a/src/emucore/CartCM.cxx b/src/emucore/CartCM.cxx
index dbaac7a54..da429a876 100644
--- a/src/emucore/CartCM.cxx
+++ b/src/emucore/CartCM.cxx
@@ -24,7 +24,7 @@
CartridgeCM::CartridgeCM(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
- myImage(make_unique(16_KB))
+ myImage{make_unique(16_KB)}
{
// Copy the ROM image into my buffer
std::copy_n(image.get(), std::min(16_KB, size), myImage.get());
diff --git a/src/emucore/CartCTY.cxx b/src/emucore/CartCTY.cxx
index 67647f89c..1056306aa 100644
--- a/src/emucore/CartCTY.cxx
+++ b/src/emucore/CartCTY.cxx
@@ -25,7 +25,7 @@
CartridgeCTY::CartridgeCTY(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
- myImage(make_unique(32_KB))
+ myImage{make_unique(32_KB)}
{
// Copy the ROM image into my buffer
std::copy_n(image.get(), std::min(32_KB, size), myImage.get());
diff --git a/src/emucore/CartDPCPlus.cxx b/src/emucore/CartDPCPlus.cxx
index 0b750fdde..d7a700241 100644
--- a/src/emucore/CartDPCPlus.cxx
+++ b/src/emucore/CartDPCPlus.cxx
@@ -29,8 +29,8 @@
CartridgeDPCPlus::CartridgeDPCPlus(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
- myImage(make_unique(32_KB)),
- mySize(std::min(size, 32_KB))
+ myImage{make_unique(32_KB)},
+ mySize{std::min(size, 32_KB)}
{
// Image is always 32K, but in the case of ROM < 32K, the image is
// copied to the end of the buffer
diff --git a/src/emucore/CartEnhanced.cxx b/src/emucore/CartEnhanced.cxx
index 487a22741..2f21a589e 100644
--- a/src/emucore/CartEnhanced.cxx
+++ b/src/emucore/CartEnhanced.cxx
@@ -17,6 +17,7 @@
#include "Logger.hxx"
#include "System.hxx"
+#include "PlusROM.hxx"
#include "CartEnhanced.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -54,6 +55,13 @@ CartridgeEnhanced::CartridgeEnhanced(const ByteBuffer& image, size_t size,
// Only copy up to the amount of data the ROM provides; extra unused
// space will be filled with 0's from above
std::copy_n(image.get(), std::min(mySize, size), myImage.get());
+
+#if 0
+ // Determine whether we have a PlusROM cart
+ // PlusROM needs to call peek() method, so disable direct peeks
+ if(myPlusROM.initialize(myImage, mySize))
+ myDirectPeek = false;
+#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -91,7 +99,7 @@ void CartridgeEnhanced::install(System& system)
System::PageAccess access(this, System::PageAccessType::READ);
// Set the page accessing method for the RAM writing pages
- // Note: Writes are mapped to poke() (NOT using direcPokeBase) to check for read from write port (RWP)
+ // Note: Writes are mapped to poke() (NOT using directPokeBase) to check for read from write port (RWP)
access.type = System::PageAccessType::WRITE;
for(uInt16 addr = ROM_OFFSET + myWriteOffset; addr < ROM_OFFSET + myWriteOffset + myRamSize; addr += System::PAGE_SIZE)
{
@@ -141,6 +149,16 @@ uInt8 CartridgeEnhanced::peek(uInt16 address)
{
const uInt16 peekAddress = address;
+#if 0
+ // Is this a PlusROM?
+ if(myPlusROM.isValid())
+ {
+ uInt8 value = 0;
+ if(myPlusROM.peekHotspot(address, value))
+ return value;
+ }
+#endif
+
// hotspots in TIA range are reacting to pokes only
if (hotspot() >= 0x80)
checkSwitchBank(address & ADDR_MASK);
@@ -170,6 +188,12 @@ uInt8 CartridgeEnhanced::peek(uInt16 address)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeEnhanced::poke(uInt16 address, uInt8 value)
{
+#if 0
+ // Is this a PlusROM?
+ if(myPlusROM.isValid() && myPlusROM.pokeHotspot(address, value))
+ return true;
+#endif
+
// Switch banks if necessary
if (checkSwitchBank(address & ADDR_MASK, value))
return false;
@@ -260,7 +284,7 @@ bool CartridgeEnhanced::bank(uInt16 bank, uInt16 segment)
myCurrentSegOffset[segment] = uInt32(mySize) + (ramBank << myBankShift);
// Set the page accessing method for the RAM writing pages
- // Note: Writes are mapped to poke() (NOT using direcPokeBase) to check for read from write port (RWP)
+ // Note: Writes are mapped to poke() (NOT using directPokeBase) to check for read from write port (RWP)
uInt16 fromAddr = (ROM_OFFSET + segmentOffset + myWriteOffset) & ~System::PAGE_MASK;
uInt16 toAddr = (ROM_OFFSET + segmentOffset + myWriteOffset + (myBankSize >> 1)) & ~System::PAGE_MASK;
System::PageAccess access(this, System::PageAccessType::WRITE);
@@ -362,6 +386,10 @@ bool CartridgeEnhanced::save(Serializer& out) const
out.putIntArray(myCurrentSegOffset.get(), myBankSegs);
if(myRamSize > 0)
out.putByteArray(myRAM.get(), myRamSize);
+#if 0
+ if(myPlusROM.isValid() && !myPlusROM.save(out))
+ return false;
+#endif
}
catch(...)
{
@@ -380,6 +408,10 @@ bool CartridgeEnhanced::load(Serializer& in)
in.getIntArray(myCurrentSegOffset.get(), myBankSegs);
if(myRamSize > 0)
in.getByteArray(myRAM.get(), myRamSize);
+#if 0
+ if(myPlusROM.isValid() && !myPlusROM.load(in))
+ return false;
+#endif
}
catch(...)
{
diff --git a/src/emucore/CartEnhanced.hxx b/src/emucore/CartEnhanced.hxx
index fb5b35509..6800938a8 100644
--- a/src/emucore/CartEnhanced.hxx
+++ b/src/emucore/CartEnhanced.hxx
@@ -22,6 +22,7 @@ class System;
#include "bspf.hxx"
#include "Cart.hxx"
+#include "PlusROM.hxx"
#ifdef DEBUGGER_SUPPORT
#include "CartEnhancedWidget.hxx"
#endif
@@ -159,7 +160,7 @@ class CartridgeEnhanced : public Cartridge
/**
Get the hotspot in ROM address space.
- @return The first hotspot address (ususally in ROM) space or 0
+ @return The first hotspot address (usually in ROM) space or 0
*/
virtual uInt16 hotspot() const { return 0; }
// TODO: handle cases where there the hotspots cover multiple pages
@@ -224,6 +225,9 @@ class CartridgeEnhanced : public Cartridge
// The size of the ROM image
size_t mySize{0};
+ // Handle PlusROM functionality, if available
+ PlusROM myPlusROM;
+
protected:
// The mask for 6507 address space
static constexpr uInt16 ADDR_MASK = 0x1FFF;
diff --git a/src/emucore/CartMNetwork.cxx b/src/emucore/CartMNetwork.cxx
index 78c68e6a0..e4eada8c8 100644
--- a/src/emucore/CartMNetwork.cxx
+++ b/src/emucore/CartMNetwork.cxx
@@ -22,7 +22,7 @@
CartridgeMNetwork::CartridgeMNetwork(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
- mySize(size)
+ mySize{size}
{
}
diff --git a/src/emucore/CartUA.cxx b/src/emucore/CartUA.cxx
index 83afca20e..5f93a16e5 100644
--- a/src/emucore/CartUA.cxx
+++ b/src/emucore/CartUA.cxx
@@ -23,7 +23,7 @@ CartridgeUA::CartridgeUA(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings,
bool swapHotspots)
: CartridgeEnhanced(image, size, md5, settings, 8_KB),
- mySwappedHotspots(swapHotspots)
+ mySwappedHotspots{swapHotspots}
{
}
diff --git a/src/emucore/CartWD.hxx b/src/emucore/CartWD.hxx
index de4cbd68d..af233a92c 100644
--- a/src/emucore/CartWD.hxx
+++ b/src/emucore/CartWD.hxx
@@ -168,7 +168,7 @@ class CartridgeWD : public CartridgeEnhanced
// The arrangement of banks to use on each hotspot read
struct BankOrg {
- uInt8 zero, one, two, three;
+ uInt8 zero{0}, one{0}, two{0}, three{0};
};
static const std::array ourBankOrg;
diff --git a/src/emucore/CompuMate.cxx b/src/emucore/CompuMate.cxx
index a3a0367cc..9aeb688fe 100644
--- a/src/emucore/CompuMate.cxx
+++ b/src/emucore/CompuMate.cxx
@@ -23,8 +23,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CompuMate::CompuMate(const Console& console, const Event& event,
const System& system)
- : myConsole(console),
- myEvent(event)
+ : myConsole{console},
+ myEvent{event}
{
// These controller pointers will be retrieved by the Console, which will
// also take ownership of them
diff --git a/src/emucore/CompuMate.hxx b/src/emucore/CompuMate.hxx
index e9a9a047e..d1460e59d 100644
--- a/src/emucore/CompuMate.hxx
+++ b/src/emucore/CompuMate.hxx
@@ -86,7 +86,7 @@ class CompuMate
CMControl(class CompuMate& handler, Controller::Jack jack, const Event& event,
const System& system)
: Controller(jack, event, system, Controller::Type::CompuMate),
- myHandler(handler) { }
+ myHandler{handler} { }
~CMControl() override = default;
public:
diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx
index bb292859e..52620243e 100644
--- a/src/emucore/Console.cxx
+++ b/src/emucore/Console.cxx
@@ -116,11 +116,11 @@ namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Console::Console(OSystem& osystem, unique_ptr& cart,
const Properties& props, AudioSettings& audioSettings)
- : myOSystem(osystem),
- myEvent(osystem.eventHandler().event()),
- myProperties(props),
- myCart(std::move(cart)),
- myAudioSettings(audioSettings)
+ : myOSystem{osystem},
+ myEvent{osystem.eventHandler().event()},
+ myProperties{props},
+ myCart{std::move(cart)},
+ myAudioSettings{audioSettings}
{
// Create subsystems for the console
my6502 = make_unique(myOSystem.settings());
@@ -858,6 +858,40 @@ void Console::setControllers(const string& romMd5)
myOSystem.eventHandler().setMouseControllerMode(myOSystem.settings().getString("usemouse"));
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void Console::changeLeftController(int direction)
+{
+ int type = int(Controller::getType(myProperties.get(PropType::Controller_Left)));
+ if(!type)
+ type = int(Controller::getType(leftController().name()));
+ type = BSPF::clampw(type + direction,
+ 1, int(Controller::Type::LastType) - 1);
+
+ myProperties.set(PropType::Controller_Left, Controller::getPropName(Controller::Type(type)));
+ setControllers(myProperties.get(PropType::Cart_MD5));
+
+ ostringstream msg;
+ msg << "Left controller " << Controller::getName(Controller::Type(type));
+ myOSystem.frameBuffer().showTextMessage(msg.str());
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void Console::changeRightController(int direction)
+{
+ int type = int(Controller::getType(myProperties.get(PropType::Controller_Right)));
+ if(!type)
+ type = int(Controller::getType(rightController().name()));
+ type = BSPF::clampw(type + direction,
+ 1, int(Controller::Type::LastType) - 1);
+
+ myProperties.set(PropType::Controller_Right, Controller::getPropName(Controller::Type(type)));
+ setControllers(myProperties.get(PropType::Cart_MD5));
+
+ ostringstream msg;
+ msg << "Right controller " << Controller::getName(Controller::Type(type));
+ myOSystem.frameBuffer().showTextMessage(msg.str());
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unique_ptr Console::getControllerPort(const Controller::Type type,
const Controller::Jack port, const string& romMd5)
@@ -967,6 +1001,99 @@ unique_ptr Console::getControllerPort(const Controller::Type type,
return controller;
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void Console::toggleSwapPorts(bool toggle)
+{
+ bool swapped = myProperties.get(PropType::Console_SwapPorts) == "YES";
+
+ if(toggle)
+ {
+ swapped = !swapped;
+ myProperties.set(PropType::Console_SwapPorts, (swapped ? "YES" : "NO"));
+ //myOSystem.propSet().insert(myProperties);
+ setControllers(myProperties.get(PropType::Cart_MD5));
+ }
+
+ ostringstream msg;
+ msg << "Swap ports " << (swapped ? "enabled" : "disabled");
+ myOSystem.frameBuffer().showTextMessage(msg.str());
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void Console::toggleSwapPaddles(bool toggle)
+{
+ bool swapped = myProperties.get(PropType::Controller_SwapPaddles) == "YES";
+
+ if(toggle)
+ {
+ swapped = !swapped;
+ myProperties.set(PropType::Controller_SwapPaddles, (swapped ? "YES" : "NO"));
+ //myOSystem.propSet().insert(myProperties);
+ setControllers(myProperties.get(PropType::Cart_MD5));
+ }
+
+ ostringstream msg;
+ msg << "Swap paddles " << (swapped ? "enabled" : "disabled");
+ myOSystem.frameBuffer().showTextMessage(msg.str());
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void Console::changePaddleCenterX(int direction)
+{
+ int center =
+ BSPF::clamp(BSPF::stringToInt(myProperties.get(PropType::Controller_PaddlesXCenter)) + direction,
+ Paddles::MIN_ANALOG_CENTER, Paddles::MAX_ANALOG_CENTER);
+ myProperties.set(PropType::Controller_PaddlesXCenter, std::to_string(center));
+ Paddles::setAnalogXCenter(center);
+
+ ostringstream val;
+ val << (center ? center > 0 ? "+" : "" : " ") << center * 5 << "px";
+ myOSystem.frameBuffer().showGaugeMessage("Paddles x-center ", val.str(), center,
+ Paddles::MIN_ANALOG_CENTER, Paddles::MAX_ANALOG_CENTER);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void Console::changePaddleCenterY(int direction)
+{
+ int center =
+ BSPF::clamp(BSPF::stringToInt(myProperties.get(PropType::Controller_PaddlesYCenter)) + direction,
+ Paddles::MIN_ANALOG_CENTER, Paddles::MAX_ANALOG_CENTER);
+ myProperties.set(PropType::Controller_PaddlesYCenter, std::to_string(center));
+ Paddles::setAnalogYCenter(center);
+
+ ostringstream val;
+ val << (center ? center > 0 ? "+" : "" : " ") << center * 5 << "px";
+ myOSystem.frameBuffer().showGaugeMessage("Paddles y-center ", val.str(), center,
+ Paddles::MIN_ANALOG_CENTER, Paddles::MAX_ANALOG_CENTER);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void Console::changePaddleAxesRange(int direction)
+{
+ istringstream m_axis(myProperties.get(PropType::Controller_MouseAxis));
+ string mode = "AUTO";
+ int range;
+
+ m_axis >> mode;
+ if(!(m_axis >> range))
+ range = Paddles::MAX_MOUSE_RANGE;
+
+ range = BSPF::clamp(range + direction,
+ Paddles::MIN_MOUSE_RANGE, Paddles::MAX_MOUSE_RANGE);
+
+ ostringstream control;
+ control << mode;
+ if(range != 100)
+ control << " " << std::to_string(range);
+ myProperties.set(PropType::Controller_MouseAxis, control.str());
+
+ Paddles::setDigitalPaddleRange(range);
+
+ ostringstream val;
+ val << range << "%";
+ myOSystem.frameBuffer().showGaugeMessage("Mouse axes range", val.str(), range);
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changeAutoFireRate(int direction)
{
diff --git a/src/emucore/Console.hxx b/src/emucore/Console.hxx
index 59048239f..e30ef9d37 100644
--- a/src/emucore/Console.hxx
+++ b/src/emucore/Console.hxx
@@ -74,18 +74,13 @@ class Console : public Serializable, public ConsoleIO
*/
Console(OSystem& osystem, unique_ptr& cart,
const Properties& props, AudioSettings& audioSettings);
-
- /**
- Destructor
- */
~Console() override;
public:
-
/**
Sets the left and right controllers for the console.
*/
- void setControllers(const string& roMd5);
+ void setControllers(const string& romMd5);
/**
Get the controller plugged into the specified jack
@@ -95,6 +90,12 @@ class Console : public Serializable, public ConsoleIO
Controller& leftController() const override { return *myLeftControl; }
Controller& rightController() const override { return *myRightControl; }
+ /**
+ Change to next or previous controller type
+ */
+ void changeLeftController(int direction = +1);
+ void changeRightController(int direction = +1);
+
/**
Get the TIA for this console
@@ -185,6 +186,36 @@ 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
+ */
+ void toggleSwapPorts(bool toggle = true);
+
+ /**
+ Toggle paddle controllers swapping
+ */
+ void toggleSwapPaddles(bool toggle = true);
+
+ /**
+ Change x-center of paddles
+ */
+ void changePaddleCenterX(int direction = +1);
+
+ /**
+ Change y-center of paddles
+ */
+ void changePaddleCenterY(int direction = +1);
+
+ /**
+ Change paddle range for digital/mouse emulation
+ */
+ void changePaddleAxesRange(int direction = +1);
+
public:
/**
Toggle between NTSC/PAL/SECAM (and variants) display format.
diff --git a/src/emucore/Control.cxx b/src/emucore/Control.cxx
index fb57b6278..b5ef97e6d 100644
--- a/src/emucore/Control.cxx
+++ b/src/emucore/Control.cxx
@@ -23,10 +23,10 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Controller::Controller(Jack jack, const Event& event, const System& system,
Type type)
- : myJack(jack),
- myEvent(event),
- mySystem(system),
- myType(type)
+ : myJack{jack},
+ myEvent{event},
+ mySystem{system},
+ myType{type}
{
}
diff --git a/src/emucore/DefProps.hxx b/src/emucore/DefProps.hxx
index 7718347ef..618f63c87 100644
--- a/src/emucore/DefProps.hxx
+++ b/src/emucore/DefProps.hxx
@@ -565,7 +565,7 @@ static const BSPF::array2D DefProps = {{
{ "278155fc9956e9b6ef2359eb238f7c7f", "", "", "Donkey Kong Junior (Unknown) (Hack)", "Hack of Donkey Kong Junior", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "2783006ee6519f15cbc96adae031c9a9", "Telegames", "", "Night Stalker (1989) (Telegames) (PAL) [a]", "AKA Dark Cavern", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "278531cc31915747018d22145823d2c9", "", "", "Defender MegaDrive (PAL) (Genesis)", "Genesis controller (C is smartbomb)", "Hack of Defender", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
- { "278f14887d601b5e5b620f1870bc09f6", "Thomas Jentzsch", "", "SWOOPS! (v0.96) (TJ)", "Uses the Joystick (L) and Paddle (R) Controllers", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "{\"score_addresses\":[\"0xfd\",\"0xfe\",\"0xff\"],\"score_digits\":6,\"variations_address\":\"0xfc\",\"variations_count\":4,\"variations_zero_based\":true}" },
+ { "278f14887d601b5e5b620f1870bc09f6", "Thomas Jentzsch", "", "SWOOPS! (v0.96) (TJ)", "Uses the Joystick (L) and Paddle (R) Controllers", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "28", "", "", "", "", "{\"score_addresses\":[\"0xfd\",\"0xfe\",\"0xff\"],\"score_digits\":6,\"variations_address\":\"0xfc\",\"variations_count\":4,\"variations_zero_based\":true}" },
{ "27a5d2d0c74c8e4b2c05b94c9f098eea", "Atari, Omegamatrix", "", "Video Olympics Menu (2020) (PAL60) (Hack)", "Hack of Video Olympics", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "YES", "", "", "AUTO 60", "", "", "", "", "" },
{ "27baecd618e7e53dc11f2a9c559f529d", "Omegamatrix", "", "Star Wars Arcade (Atari Trak-Ball) v4 (Omegamatrix)", "Uses Atari Trak-Ball Controller", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "27c4c2af4b46394bb98638af8e0f6e9d", "Atari, Jerome Domurat, Peter C. Niday, Robert Vieira", "CX26109", "Sorcerer's Apprentice (1983) (Atari) (Prototype)", "", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
@@ -1136,7 +1136,7 @@ static const BSPF::array2D DefProps = {{
{ "50200f697aeef38a3ce31c4f49739551", "Mystique - American Multiple Industries, Joel H. Martin", "", "Custer's Revenge (1982) (Mystique) (PAL60)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "502044b1ac111b394e6fbb0d821fca41", "", "", "Hangman Invader 4letter (Hack)", "Hack of Hangman", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "502168660bfd9c1d2649d415dc89c69d", "Activision, Bob Whitehead - Ariola", "EAG-019, EAG-019-04I - 711 019-715", "Sky Jinks (1982) (Activision) (PAL) (4K)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "{\"score_addresses\":[\"0x9e\",\"0xa6\",\"0xa2\"],\"score_digits\":6,\"score_inverted\":true,\"variations_address\":\"0x99\",\"variations_count\":4,\"variations_zero_based\":true}" },
- { "504688d49a41bf03d8a955512609f3f2", "Thomas Jentzsch", "", "SWOOPS! (v0.94) (TJ)", "Uses the Joystick (L) and Paddle (R) Controllers", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "{\"score_addresses\":[\"0xfd\",\"0xfe\",\"0xff\"],\"score_digits\":6,\"variations_address\":\"0xfc\",\"variations_count\":4,\"variations_zero_based\":true}" },
+ { "504688d49a41bf03d8a955512609f3f2", "Thomas Jentzsch", "", "SWOOPS! (v0.94) (TJ)", "Uses the Joystick (L) and Paddle (R) Controllers", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "28", "", "", "", "", "{\"score_addresses\":[\"0xfd\",\"0xfe\",\"0xff\"],\"score_digits\":6,\"variations_address\":\"0xfc\",\"variations_count\":4,\"variations_zero_based\":true}" },
{ "50568c80ac61cab789d9923c9b05b68e", "Ebivision", "", "Merlin's Walls - Standard Edition (1999) (Ebivision)", "Image rotated 90 degrees CW", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "5069fecbe4706371f17737b0357cfa68", "Apollo - Games by Apollo, Steve Stringfellow", "AP-2005", "Shark Attack (1982) (Apollo) (PAL)", "AKA Lochjaw", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "5079bfbc7b8f5770f84215ed2e3bdd1b", "Omegamatrix (2012)", "", "Genesis Button Tester", "", "Homebrew", "", "", "", "", "", "", "", "GENESIS", "", "", "GENESIS", "", "", "", "", "", "", "", "", "", "", "" },
@@ -1307,7 +1307,7 @@ static const BSPF::array2D DefProps = {{
{ "5d2cc33ca798783dee435eb29debf6d6", "Activision - Imagineering, Mike Reidel", "AK-043-04", "Commando (1988) (Activision)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "5d7293f1892b66c014e8d222e06f6165", "Atari - Axlon, Tod Frye - Heuristica, Agustin Ortiz", "CX26169", "Shooting Arcade (03-07-1989) (Atari) (Prototype) [a1]", "Uses the Light Gun Controller (left only)", "Prototype", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "5d799bfa9e1e7b6224877162accada0d", "Spectravision - Spectravideo - Sirius Software, David Lubar", "SA-206", "Challenge of.... Nexar, The (1982) (Spectravision)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
- { "5d8f1ab95362acdf3426d572a6301bf2", "Thomas Jentzsch", "", "SWOOPS! (v0.96) (TJ) (PAL)", "Uses the Joystick (L) and Paddle (R) Controllers", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "{\"score_addresses\":[\"0xfd\",\"0xfe\",\"0xff\"],\"score_digits\":6,\"variations_address\":\"0xfc\",\"variations_count\":4,\"variations_zero_based\":true}" },
+ { "5d8f1ab95362acdf3426d572a6301bf2", "Thomas Jentzsch", "", "SWOOPS! (v0.96) (TJ) (PAL)", "Uses the Joystick (L) and Paddle (R) Controllers", "Homebrew", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "28", "", "", "", "", "{\"score_addresses\":[\"0xfd\",\"0xfe\",\"0xff\"],\"score_digits\":6,\"variations_address\":\"0xfc\",\"variations_count\":4,\"variations_zero_based\":true}" },
{ "5d8fb14860c2f198472b233874f6b0c9", "", "", "Boing! (PD) [a2]", "", "New Release", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "5d9592756425192ec621d2613d0e683d", "CCE", "C-839", "Misterious Thief, A (1983) (CCE) [a]", "AKA A Mysterious Thief", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "5da8fd0b5ed33a360bff37f8b5d0cd58", "Tron", "", "Pole Position (Tron)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
diff --git a/src/emucore/Driving.cxx b/src/emucore/Driving.cxx
index 490759e63..765700c2a 100644
--- a/src/emucore/Driving.cxx
+++ b/src/emucore/Driving.cxx
@@ -177,7 +177,7 @@ bool Driving::setMouseControl(
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Driving::setSensitivity(int sensitivity)
{
- BSPF::clamp(sensitivity, 1, 20, 10);
+ BSPF::clamp(sensitivity, MIN_SENSE, MAX_SENSE, (MIN_SENSE + MAX_SENSE) / 2);
SENSITIVITY = sensitivity / 10.0F;
}
diff --git a/src/emucore/Driving.hxx b/src/emucore/Driving.hxx
index 863132890..78f181bfd 100644
--- a/src/emucore/Driving.hxx
+++ b/src/emucore/Driving.hxx
@@ -41,6 +41,10 @@ class Driving : public Controller
Driving(Jack jack, const Event& event, const System& system, bool altmap = false);
~Driving() override = default;
+ public:
+ static constexpr int MIN_SENSE = 1;
+ static constexpr int MAX_SENSE = 20;
+
public:
/**
Update the entire digital and analog pin state according to the
diff --git a/src/emucore/EmulationTiming.cxx b/src/emucore/EmulationTiming.cxx
index 98ad0c88f..cfa81c3a7 100644
--- a/src/emucore/EmulationTiming.cxx
+++ b/src/emucore/EmulationTiming.cxx
@@ -29,9 +29,9 @@ namespace {
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-EmulationTiming::EmulationTiming(FrameLayout frameLayout, ConsoleTiming consoleTiming) :
- myFrameLayout(frameLayout),
- myConsoleTiming(consoleTiming)
+EmulationTiming::EmulationTiming(FrameLayout frameLayout, ConsoleTiming consoleTiming)
+ : myFrameLayout{frameLayout},
+ myConsoleTiming{consoleTiming}
{
recalculate();
}
diff --git a/src/emucore/Event.hxx b/src/emucore/Event.hxx
index 7b7a6a706..3e7848e7c 100644
--- a/src/emucore/Event.hxx
+++ b/src/emucore/Event.hxx
@@ -43,9 +43,9 @@ class Event
ConsoleSelect, ConsoleReset,
JoystickZeroUp, JoystickZeroDown, JoystickZeroLeft, JoystickZeroRight,
- JoystickZeroFire, JoystickZeroFire5, JoystickZeroFire9,
+ JoystickZeroFire, JoystickZeroFire5, JoystickZeroFire9,
JoystickOneUp, JoystickOneDown, JoystickOneLeft, JoystickOneRight,
- JoystickOneFire, JoystickOneFire5, JoystickOneFire9,
+ JoystickOneFire, JoystickOneFire5, JoystickOneFire9,
PaddleZeroDecrease, PaddleZeroIncrease, PaddleZeroAnalog, PaddleZeroFire,
PaddleOneDecrease, PaddleOneIncrease, PaddleOneAnalog, PaddleOneFire,
@@ -83,7 +83,7 @@ class Event
UISelect, UINavPrev, UINavNext, UIOK, UICancel, UIPrevDir,
UITabPrev, UITabNext,
- HandleMouseControl, ToggleGrabMouse,
+ NextMouseControl, ToggleGrabMouse,
MouseAxisXMove, MouseAxisYMove, MouseAxisXValue, MouseAxisYValue,
MouseButtonLeftValue, MouseButtonRightValue,
@@ -145,6 +145,26 @@ class Event
AbortEdit, EndEdit,
HighScoresMenuMode,
+ // Input settings
+ DecreaseDeadzone, IncreaseDeadzone,
+ DecAnalogSense, IncAnalogSense,
+ DecDejtterAveraging, IncDejtterAveraging,
+ DecDejtterReaction, IncDejtterReaction,
+ DecDigitalSense, IncDigitalSense,
+ ToggleFourDirections, ToggleKeyCombos,
+ PrevMouseAsController, NextMouseAsController,
+ DecMousePaddleSense, IncMousePaddleSense,
+ DecMouseTrackballSense, IncMouseTrackballSense,
+ DecreaseDrivingSense, IncreaseDrivingSense,
+ PreviousCursorVisbility, NextCursorVisbility,
+ // GameInfoDialog/Controllers
+ PreviousLeftPort, NextLeftPort,
+ PreviousRightPort, NextRightPort,
+ ToggleSwapPorts, ToggleSwapPaddles,
+ DecreasePaddleCenterX, IncreasePaddleCenterX,
+ DecreasePaddleCenterY, IncreasePaddleCenterY,
+ PreviousMouseControl,
+ DecreaseMouseAxesRange, IncreaseMouseAxesRange,
LastType
};
@@ -153,6 +173,7 @@ class Event
{
Menu, Emulation,
Misc, AudioVideo, States, Console, Joystick, Paddles, Keyboard,
+ Devices,
Debug, Combo,
LastGroup
};
diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx
index 94ae7c82c..2b0dada20 100644
--- a/src/emucore/EventHandler.cxx
+++ b/src/emucore/EventHandler.cxx
@@ -71,7 +71,7 @@ using namespace std::placeholders;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventHandler::EventHandler(OSystem& osystem)
- : myOSystem(osystem)
+ : myOSystem{osystem}
{
}
@@ -188,20 +188,42 @@ void EventHandler::mapStelladaptors(const string& saport)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void EventHandler::toggleSAPortOrder()
+void EventHandler::toggleAllow4JoyDirections(bool toggle)
+{
+ bool joyAllow4 = myOSystem.settings().getBool("joyallow4");
+
+ if(toggle)
+ {
+ joyAllow4 = !joyAllow4;
+ allowAllDirections(joyAllow4);
+ myOSystem.settings().setValue("joyallow4", joyAllow4);
+ }
+
+ ostringstream ss;
+ ss << "Allow all 4 joystick directions ";
+ ss << (joyAllow4 ? "enabled" : "disabled");
+ myOSystem.frameBuffer().showTextMessage(ss.str());
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void EventHandler::toggleSAPortOrder(bool toggle)
{
#ifdef JOYSTICK_SUPPORT
- const string& saport = myOSystem.settings().getString("saport");
+ string saport = myOSystem.settings().getString("saport");
+
+ if(toggle)
+ {
+ if(saport == "lr")
+ saport = "rl";
+ else
+ saport = "lr";
+ mapStelladaptors(saport);
+ }
+
if(saport == "lr")
- {
- mapStelladaptors("rl");
- myOSystem.frameBuffer().showTextMessage("Stelladaptor ports right/left");
- }
- else
- {
- mapStelladaptors("lr");
myOSystem.frameBuffer().showTextMessage("Stelladaptor ports left/right");
- }
+ else
+ myOSystem.frameBuffer().showTextMessage("Stelladaptor ports right/left");
#endif
}
@@ -215,10 +237,18 @@ void EventHandler::set7800Mode()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void EventHandler::handleMouseControl()
+void EventHandler::changeMouseControl(int direction)
{
if(myMouseControl)
- myOSystem.frameBuffer().showTextMessage(myMouseControl->next());
+ myOSystem.frameBuffer().showTextMessage(myMouseControl->change(direction));
+ else
+ myOSystem.frameBuffer().showTextMessage("Mouse input is disabled");
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool EventHandler::hasMouseControl() const
+{
+ return myMouseControl && myMouseControl->hasMouseControl();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -355,21 +385,116 @@ EventHandler::AdjustGroup EventHandler::getAdjustGroup()
{
if (myAdjustSetting >= AdjustSetting::START_DEBUG_ADJ && myAdjustSetting <= AdjustSetting::END_DEBUG_ADJ)
return AdjustGroup::DEBUG;
+ if(myAdjustSetting >= AdjustSetting::START_INPUT_ADJ && myAdjustSetting <= AdjustSetting::END_INPUT_ADJ)
+ return AdjustGroup::INPUT;
return AdjustGroup::AV;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-AdjustFunction EventHandler::cycleAdjustSetting(int direction)
+bool EventHandler::isJoystick(const Controller& controller) const
+{
+ return controller.type() == Controller::Type::Joystick
+ || controller.type() == Controller::Type::BoosterGrip
+ || controller.type() == Controller::Type::Genesis;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool EventHandler::isPaddle(const Controller& controller) const
+{
+ return controller.type() == Controller::Type::Paddles
+ || controller.type() == Controller::Type::PaddlesIAxDr
+ || controller.type() == Controller::Type::PaddlesIAxis;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool EventHandler::isTrackball(const Controller& controller) const
+{
+ return controller.type() == Controller::Type::AmigaMouse
+ || controller.type() == Controller::Type::AtariMouse
+ || controller.type() == Controller::Type::TrakBall;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool EventHandler::skipAVSetting() const
{
const bool isFullScreen = myOSystem.frameBuffer().fullScreen();
const bool isCustomPalette =
myOSystem.settings().getString("palette") == PaletteHandler::SETTING_CUSTOM;
const bool isCustomFilter =
myOSystem.settings().getInt("tv.filter") == int(NTSCFilter::Preset::CUSTOM);
- const bool isPAL = myOSystem.console().timing() == ConsoleTiming::pal;
- bool repeat = false;
+ return (myAdjustSetting == AdjustSetting::OVERSCAN && !isFullScreen)
+ #ifdef ADAPTABLE_REFRESH_SUPPORT
+ || (myAdjustSetting == AdjustSetting::ADAPT_REFRESH && !isFullScreen)
+ #endif
+ || (myAdjustSetting >= AdjustSetting::PALETTE_PHASE
+ && myAdjustSetting <= AdjustSetting::PALETTE_BLUE_SHIFT
+ && !isCustomPalette)
+ || (myAdjustSetting >= AdjustSetting::NTSC_SHARPNESS
+ && myAdjustSetting <= AdjustSetting::NTSC_BLEEDING
+ && !isCustomFilter);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool EventHandler::skipInputSetting() const
+{
+ const bool grabMouseAllowed = myOSystem.frameBuffer().grabMouseAllowed();
+ const bool analog = myOSystem.console().leftController().isAnalog()
+ || myOSystem.console().rightController().isAnalog();
+ const bool joystick = isJoystick(myOSystem.console().leftController())
+ || isJoystick(myOSystem.console().rightController());
+ const bool paddle = isPaddle(myOSystem.console().leftController())
+ || isPaddle(myOSystem.console().rightController());
+ const bool trackball = isTrackball(myOSystem.console().leftController())
+ || isTrackball(myOSystem.console().rightController());
+ const bool driving =
+ myOSystem.console().leftController().type() == Controller::Type::Driving
+ || myOSystem.console().rightController().type() == Controller::Type::Driving;
+ const bool useMouse =
+ BSPF::equalsIgnoreCase("always", myOSystem.settings().getString("usemouse"))
+ || (BSPF::equalsIgnoreCase("analog", myOSystem.settings().getString("usemouse"))
+ && analog);
+ const bool stelladapter = myPJoyHandler->hasStelladaptors();
+
+ return (!grabMouseAllowed && myAdjustSetting == AdjustSetting::GRAB_MOUSE)
+ || (!joystick
+ && (myAdjustSetting == AdjustSetting::DEADZONE
+ || myAdjustSetting == AdjustSetting::FOUR_DIRECTIONS))
+ || (!paddle
+ && (myAdjustSetting == AdjustSetting::ANALOG_SENSITIVITY
+ || myAdjustSetting == AdjustSetting::DEJITTER_AVERAGING
+ || myAdjustSetting == AdjustSetting::DEJITTER_REACTION
+ || myAdjustSetting == AdjustSetting::DIGITAL_SENSITIVITY
+ || myAdjustSetting == AdjustSetting::SWAP_PADDLES
+ || myAdjustSetting == AdjustSetting::PADDLE_CENTER_X
+ || myAdjustSetting == AdjustSetting::PADDLE_CENTER_Y))
+ || ((!paddle || !useMouse)
+ && myAdjustSetting == AdjustSetting::PADDLE_SENSITIVITY)
+ || ((!trackball || !useMouse)
+ && myAdjustSetting == AdjustSetting::TRACKBALL_SENSITIVITY)
+ || (!driving
+ && myAdjustSetting == AdjustSetting::DRIVING_SENSITIVITY) // also affects digital device input sensitivity
+ || ((!hasMouseControl() || !useMouse)
+ && myAdjustSetting == AdjustSetting::MOUSE_CONTROL)
+ || ((!paddle || !useMouse)
+ && myAdjustSetting == AdjustSetting::MOUSE_RANGE)
+ || (!stelladapter
+ && myAdjustSetting == AdjustSetting::SA_PORT_ORDER);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool EventHandler::skipDebugSetting() const
+{
+ const bool isPAL = myOSystem.console().timing() == ConsoleTiming::pal;
+
+ return (myAdjustSetting == AdjustSetting::COLOR_LOSS && !isPAL);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+AdjustFunction EventHandler::cycleAdjustSetting(int direction)
+{
+ bool skip = false;
do
{
switch (getAdjustGroup())
@@ -379,32 +504,32 @@ AdjustFunction EventHandler::cycleAdjustSetting(int direction)
AdjustSetting(BSPF::clampw(int(myAdjustSetting) + direction,
int(AdjustSetting::START_AV_ADJ), int(AdjustSetting::END_AV_ADJ)));
// skip currently non-relevant adjustments
- repeat = (myAdjustSetting == AdjustSetting::OVERSCAN && !isFullScreen)
- #ifdef ADAPTABLE_REFRESH_SUPPORT
- || (myAdjustSetting == AdjustSetting::ADAPT_REFRESH && !isFullScreen)
- #endif
- || (myAdjustSetting >= AdjustSetting::PALETTE_PHASE
- && myAdjustSetting <= AdjustSetting::PALETTE_BLUE_SHIFT
- && !isCustomPalette)
- || (myAdjustSetting >= AdjustSetting::NTSC_SHARPNESS
- && myAdjustSetting <= AdjustSetting::NTSC_BLEEDING
- && !isCustomFilter);
+ skip = skipAVSetting();
+ break;
+
+ case AdjustGroup::INPUT:
+ myAdjustSetting =
+ AdjustSetting(BSPF::clampw(int(myAdjustSetting) + direction,
+ int(AdjustSetting::START_INPUT_ADJ), int(AdjustSetting::END_INPUT_ADJ)));
+ // skip currently non-relevant adjustments
+ skip = skipInputSetting();
break;
case AdjustGroup::DEBUG:
myAdjustSetting =
AdjustSetting(BSPF::clampw(int(myAdjustSetting) + direction,
int(AdjustSetting::START_DEBUG_ADJ), int(AdjustSetting::END_DEBUG_ADJ)));
- repeat = (myAdjustSetting == AdjustSetting::COLOR_LOSS && !isPAL);
+ // skip currently non-relevant adjustments
+ skip = skipDebugSetting();
break;
default:
break;
}
// avoid endless loop
- if(repeat && !direction)
+ if(skip && !direction)
direction = 1;
- } while(repeat);
+ } while(skip);
return getAdjustSetting(myAdjustSetting);
}
@@ -417,7 +542,7 @@ AdjustFunction EventHandler::getAdjustSetting(AdjustSetting setting)
// - This array MUST have the same order as AdjustSetting
const AdjustFunction ADJUST_FUNCTIONS[int(AdjustSetting::NUM_ADJ)] =
{
- // Audio & Video settings
+ // *** Audio & Video settings ***
std::bind(&Sound::adjustVolume, &myOSystem.sound(), _1),
std::bind(&FrameBuffer::switchVideoMode, &myOSystem.frameBuffer(), _1),
std::bind(&FrameBuffer::toggleFullscreen, &myOSystem.frameBuffer(), _1),
@@ -470,7 +595,34 @@ AdjustFunction EventHandler::getAdjustSetting(AdjustSetting setting)
std::bind(&Console::changePhosphor, &myOSystem.console(), _1),
std::bind(&TIASurface::setScanlineIntensity, &myOSystem.frameBuffer().tiaSurface(), _1),
std::bind(&Console::toggleInter, &myOSystem.console(), _1),
- // Debug settings
+
+ // *** Input settings ***
+ std::bind(&PhysicalJoystickHandler::changeDeadzone, &joyHandler(), _1),
+ std::bind(&PhysicalJoystickHandler::changeAnalogPaddleSensitivity, &joyHandler(), _1),
+ std::bind(&PhysicalJoystickHandler::changePaddleDejitterAveraging, &joyHandler(), _1),
+ std::bind(&PhysicalJoystickHandler::changePaddleDejitterReaction, &joyHandler(), _1),
+ std::bind(&PhysicalJoystickHandler::changeDigitalPaddleSensitivity, &joyHandler(), _1),
+ std::bind(&Console::changeAutoFireRate, &myOSystem.console(), _1),
+ std::bind(&EventHandler::toggleAllow4JoyDirections, this, _1),
+ std::bind(&PhysicalKeyboardHandler::toggleModKeys, &keyHandler(), _1),
+ std::bind(&EventHandler::toggleSAPortOrder, this, _1),
+ std::bind(&EventHandler::changeMouseControllerMode, this, _1),
+ std::bind(&PhysicalJoystickHandler::changeMousePaddleSensitivity, &joyHandler(), _1),
+ std::bind(&PhysicalJoystickHandler::changeMouseTrackballSensitivity, &joyHandler(), _1),
+ std::bind(&PhysicalJoystickHandler::changeDrivingSensitivity, &joyHandler(), _1),
+ std::bind(&EventHandler::changeMouseCursor, this, _1),
+ std::bind(&FrameBuffer::toggleGrabMouse, &myOSystem.frameBuffer(), _1),
+ // Game properties/Controllers
+ std::bind(&Console::changeLeftController, &myOSystem.console(), _1),
+ std::bind(&Console::changeRightController, &myOSystem.console(), _1),
+ std::bind(&Console::toggleSwapPorts, &myOSystem.console(), _1),
+ std::bind(&Console::toggleSwapPaddles, &myOSystem.console(), _1),
+ std::bind(&Console::changePaddleCenterX, &myOSystem.console(), _1),
+ std::bind(&Console::changePaddleCenterY, &myOSystem.console(), _1),
+ std::bind(&EventHandler::changeMouseControl, this, _1),
+ std::bind(&Console::changePaddleAxesRange, &myOSystem.console(), _1),
+
+ // *** Debug settings ***
std::bind(&FrameBuffer::toggleFrameStats, &myOSystem.frameBuffer(), _1),
std::bind(&Console::toggleP0Bit, &myOSystem.console(), _1),
std::bind(&Console::toggleP1Bit, &myOSystem.console(), _1),
@@ -489,7 +641,8 @@ AdjustFunction EventHandler::getAdjustSetting(AdjustSetting setting)
std::bind(&Console::toggleFixedColors, &myOSystem.console(), _1),
std::bind(&Console::toggleColorLoss, &myOSystem.console(), _1),
std::bind(&Console::toggleJitter, &myOSystem.console(), _1),
- // Following functions are not used when cycling settings but for "direct only" hotkeys
+
+ // *** Following functions are not used when cycling settings but for "direct only" hotkeys ***
std::bind(&StateManager::changeState, &myOSystem.state(), _1),
std::bind(&PaletteHandler::changeCurrentAdjustable, &myOSystem.frameBuffer().tiaSurface().paletteHandler(), _1),
std::bind(&TIASurface::changeCurrentNTSCAdjustable, &myOSystem.frameBuffer().tiaSurface(), _1),
@@ -530,23 +683,27 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
{
////////////////////////////////////////////////////////////////////////
// Allow adjusting several (mostly repeated) settings using the same six hotkeys
-
case Event::PreviousSettingGroup:
case Event::NextSettingGroup:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
const int direction = event == Event::PreviousSettingGroup ? -1 : +1;
AdjustGroup adjustGroup = AdjustGroup(BSPF::clampw(int(getAdjustGroup()) + direction,
0, int(AdjustGroup::NUM_GROUPS) - 1));
string msg;
- switch (adjustGroup)
+ switch(adjustGroup)
{
case AdjustGroup::AV:
msg = "Audio & Video";
myAdjustSetting = AdjustSetting::START_AV_ADJ;
break;
+ case AdjustGroup::INPUT:
+ msg = "Input Devices & Ports";
+ myAdjustSetting = AdjustSetting::START_INPUT_ADJ;
+ break;
+
case AdjustGroup::DEBUG:
msg = "Debug";
myAdjustSetting = AdjustSetting::START_DEBUG_ADJ;
@@ -560,7 +717,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
}
break;
- // Allow adjusting several (mostly repeated) settings using the same four hotkeys
+ // Allow adjusting several (mostly repeated) settings using the same four hotkeys
case Event::PreviousSetting:
case Event::NextSetting:
if(pressed && !repeated)
@@ -729,7 +886,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ToggleFullScreen:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.frameBuffer().toggleFullscreen();
myAdjustSetting = AdjustSetting::FULLSCREEN;
@@ -739,7 +896,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
#ifdef ADAPTABLE_REFRESH_SUPPORT
case Event::ToggleAdaptRefresh:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.frameBuffer().toggleAdaptRefresh();
myAdjustSetting = AdjustSetting::ADAPT_REFRESH;
@@ -749,7 +906,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
#endif
case Event::OverscanDecrease:
- if (pressed)
+ if(pressed)
{
myOSystem.frameBuffer().changeOverscan(-1);
myAdjustSetting = AdjustSetting::OVERSCAN;
@@ -758,7 +915,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::OverscanIncrease:
- if (pressed)
+ if(pressed)
{
myOSystem.frameBuffer().changeOverscan(+1);
myAdjustSetting = AdjustSetting::OVERSCAN;
@@ -767,7 +924,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::FormatDecrease:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.console().selectFormat(-1);
myAdjustSetting = AdjustSetting::TVFORMAT;
@@ -776,7 +933,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::FormatIncrease:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.console().selectFormat(+1);
myAdjustSetting = AdjustSetting::TVFORMAT;
@@ -829,7 +986,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
break;
case Event::PaletteDecrease:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.frameBuffer().tiaSurface().paletteHandler().cyclePalette(-1);
myAdjustSetting = AdjustSetting::PALETTE;
@@ -838,7 +995,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::PaletteIncrease:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.frameBuffer().tiaSurface().paletteHandler().cyclePalette(+1);
myAdjustSetting = AdjustSetting::PALETTE;
@@ -945,7 +1102,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ScanlinesDecrease:
- if (pressed)
+ if(pressed)
{
myOSystem.frameBuffer().tiaSurface().setScanlineIntensity(-1);
myAdjustSetting = AdjustSetting::SCANLINES;
@@ -954,7 +1111,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ScanlinesIncrease:
- if (pressed)
+ if(pressed)
{
myOSystem.frameBuffer().tiaSurface().setScanlineIntensity(+1);
myAdjustSetting = AdjustSetting::SCANLINES;
@@ -971,10 +1128,10 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
}
return;
- ///////////////////////////////////////////////////////////////////////////
- // Direct key Audio & Video events
+ ///////////////////////////////////////////////////////////////////////////
+ // Direct key Audio & Video events
case Event::PreviousPaletteAttribute:
- if (pressed)
+ if(pressed)
{
myOSystem.frameBuffer().tiaSurface().paletteHandler().cycleAdjustable(-1);
myAdjustDirect = AdjustSetting::PALETTE_CHANGE_ATTRIBUTE;
@@ -982,7 +1139,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::NextPaletteAttribute:
- if (pressed)
+ if(pressed)
{
myOSystem.frameBuffer().tiaSurface().paletteHandler().cycleAdjustable(+1);
myAdjustDirect = AdjustSetting::PALETTE_CHANGE_ATTRIBUTE;
@@ -990,7 +1147,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::PaletteAttributeDecrease:
- if (pressed)
+ if(pressed)
{
myOSystem.frameBuffer().tiaSurface().paletteHandler().changeCurrentAdjustable(-1);
myAdjustDirect = AdjustSetting::PALETTE_CHANGE_ATTRIBUTE;
@@ -998,7 +1155,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::PaletteAttributeIncrease:
- if (pressed)
+ if(pressed)
{
myOSystem.frameBuffer().tiaSurface().paletteHandler().changeCurrentAdjustable(+1);
myAdjustDirect = AdjustSetting::PALETTE_CHANGE_ATTRIBUTE;
@@ -1006,7 +1163,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::PreviousAttribute:
- if (pressed)
+ if(pressed)
{
myOSystem.frameBuffer().tiaSurface().setNTSCAdjustable(-1);
myAdjustDirect = AdjustSetting::NTSC_CHANGE_ATTRIBUTE;
@@ -1014,7 +1171,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::NextAttribute:
- if (pressed)
+ if(pressed)
{
myOSystem.frameBuffer().tiaSurface().setNTSCAdjustable(+1);
myAdjustDirect = AdjustSetting::NTSC_CHANGE_ATTRIBUTE;
@@ -1022,7 +1179,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::DecreaseAttribute:
- if (pressed)
+ if(pressed)
{
myOSystem.frameBuffer().tiaSurface().changeCurrentNTSCAdjustable(-1);
myAdjustDirect = AdjustSetting::NTSC_CHANGE_ATTRIBUTE;
@@ -1030,7 +1187,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::IncreaseAttribute:
- if (pressed)
+ if(pressed)
{
myOSystem.frameBuffer().tiaSurface().changeCurrentNTSCAdjustable(+1);
myAdjustDirect = AdjustSetting::NTSC_CHANGE_ATTRIBUTE;
@@ -1039,9 +1196,8 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
///////////////////////////////////////////////////////////////////////////
// Debug events (with global hotkeys)
-
case Event::ToggleFrameStats:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.frameBuffer().toggleFrameStats();
myAdjustSetting = AdjustSetting::STATS;
@@ -1050,7 +1206,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ToggleP0Collision:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.console().toggleP0Collision();
myAdjustSetting = AdjustSetting::P0_CX;
@@ -1059,7 +1215,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ToggleP0Bit:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.console().toggleP0Bit();
myAdjustSetting = AdjustSetting::P0_ENAM;
@@ -1068,7 +1224,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ToggleP1Collision:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.console().toggleP1Collision();
myAdjustSetting = AdjustSetting::P1_CX;
@@ -1077,7 +1233,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ToggleP1Bit:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.console().toggleP1Bit();
myAdjustSetting = AdjustSetting::P1_ENAM;
@@ -1086,7 +1242,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ToggleM0Collision:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.console().toggleM0Collision();
myAdjustSetting = AdjustSetting::M0_CX;
@@ -1095,7 +1251,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ToggleM0Bit:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.console().toggleM0Bit();
myAdjustSetting = AdjustSetting::M0_ENAM;
@@ -1104,7 +1260,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ToggleM1Collision:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.console().toggleM1Collision();
myAdjustSetting = AdjustSetting::M1_CX;
@@ -1113,7 +1269,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ToggleM1Bit:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.console().toggleM1Bit();
myAdjustSetting = AdjustSetting::M1_ENAM;
@@ -1122,7 +1278,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ToggleBLCollision:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.console().toggleBLCollision();
myAdjustSetting = AdjustSetting::BL_CX;
@@ -1131,7 +1287,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ToggleBLBit:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.console().toggleBLBit();
myAdjustSetting = AdjustSetting::BL_ENAM;
@@ -1140,7 +1296,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::TogglePFCollision:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.console().togglePFCollision();
myAdjustSetting = AdjustSetting::PF_CX;
@@ -1149,7 +1305,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::TogglePFBit:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.console().togglePFBit();
myAdjustSetting = AdjustSetting::PF_ENAM;
@@ -1158,7 +1314,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ToggleCollisions:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.console().toggleCollisions();
myAdjustSetting = AdjustSetting::ALL_CX;
@@ -1167,7 +1323,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ToggleBits:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.console().toggleBits();
myAdjustSetting = AdjustSetting::ALL_ENAM;
@@ -1176,7 +1332,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ToggleFixedColors:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.console().toggleFixedColors();
myAdjustSetting = AdjustSetting::FIXED_COL;
@@ -1185,7 +1341,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ToggleColorLoss:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.console().toggleColorLoss();
myAdjustSetting = AdjustSetting::COLOR_LOSS;
@@ -1194,7 +1350,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::ToggleJitter:
- if (pressed && !repeated)
+ if(pressed && !repeated)
{
myOSystem.console().toggleJitter();
myAdjustSetting = AdjustSetting::JITTER;
@@ -1203,8 +1359,344 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
///////////////////////////////////////////////////////////////////////////
- // State events
+ // Input events
+ case Event::DecreaseDeadzone:
+ if(pressed)
+ {
+ myPJoyHandler->changeDeadzone(-1);
+ myAdjustSetting = AdjustSetting::DEADZONE;
+ myAdjustActive = true;
+ }
+ return;
+ case Event::IncreaseDeadzone:
+ if(pressed)
+ {
+ myPJoyHandler->changeDeadzone(+1);
+ myAdjustSetting = AdjustSetting::DEADZONE;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::DecAnalogSense:
+ if(pressed)
+ {
+ myPJoyHandler->changeAnalogPaddleSensitivity(-1);
+ myAdjustSetting = AdjustSetting::PADDLE_SENSITIVITY;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::IncAnalogSense:
+ if(pressed)
+ {
+ myPJoyHandler->changeAnalogPaddleSensitivity(+1);
+ myAdjustSetting = AdjustSetting::PADDLE_SENSITIVITY;
+ myAdjustActive = true;
+ }
+
+ return;
+
+ case Event::DecDejtterAveraging:
+ if(pressed)
+ {
+ myPJoyHandler->changePaddleDejitterAveraging(-1);
+ myAdjustSetting = AdjustSetting::DEJITTER_AVERAGING;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::IncDejtterAveraging:
+ if(pressed)
+ {
+ myPJoyHandler->changePaddleDejitterAveraging(+1);
+ myAdjustSetting = AdjustSetting::DEJITTER_AVERAGING;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::DecDejtterReaction:
+ if(pressed)
+ {
+ myPJoyHandler->changePaddleDejitterReaction(-1);
+ myAdjustSetting = AdjustSetting::DEJITTER_REACTION;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::IncDejtterReaction:
+ if(pressed)
+ {
+ myPJoyHandler->changePaddleDejitterReaction(+1);
+ myAdjustSetting = AdjustSetting::DEJITTER_REACTION;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::DecDigitalSense:
+ if(pressed)
+ {
+ myPJoyHandler->changeDigitalPaddleSensitivity(-1);
+ myAdjustSetting = AdjustSetting::DIGITAL_SENSITIVITY;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::IncDigitalSense:
+ if(pressed)
+ {
+ myPJoyHandler->changeDigitalPaddleSensitivity(+1);
+ myAdjustSetting = AdjustSetting::DIGITAL_SENSITIVITY;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::DecreaseAutoFire:
+ if(pressed)
+ {
+ myOSystem.console().changeAutoFireRate(-1);
+ myAdjustSetting = AdjustSetting::AUTO_FIRE;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::IncreaseAutoFire:
+ if(pressed)
+ {
+ myOSystem.console().changeAutoFireRate(+1);
+ myAdjustSetting = AdjustSetting::AUTO_FIRE;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::ToggleFourDirections:
+ if(pressed && !repeated)
+ {
+ toggleAllow4JoyDirections();
+ myAdjustSetting = AdjustSetting::FOUR_DIRECTIONS;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::ToggleKeyCombos:
+ if(pressed && !repeated)
+ {
+ myPKeyHandler->toggleModKeys();
+ myAdjustSetting = AdjustSetting::MOD_KEY_COMBOS;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::ToggleSAPortOrder:
+ if(pressed && !repeated)
+ {
+ toggleSAPortOrder();
+ myAdjustSetting = AdjustSetting::SA_PORT_ORDER;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::PrevMouseAsController:
+ if(pressed && !repeated)
+ {
+ changeMouseControllerMode(-1);
+ myAdjustSetting = AdjustSetting::USE_MOUSE;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::NextMouseAsController:
+ if(pressed && !repeated)
+ {
+ changeMouseControllerMode(+1);
+ myAdjustSetting = AdjustSetting::USE_MOUSE;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::DecMousePaddleSense:
+ if(pressed)
+ {
+ myPJoyHandler->changeMousePaddleSensitivity(-1);
+ myAdjustSetting = AdjustSetting::PADDLE_SENSITIVITY;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::IncMousePaddleSense:
+ if(pressed)
+ {
+ myPJoyHandler->changeMousePaddleSensitivity(+1);
+ myAdjustSetting = AdjustSetting::PADDLE_SENSITIVITY;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::DecMouseTrackballSense:
+ if(pressed)
+ {
+ myPJoyHandler->changeMouseTrackballSensitivity(-1);
+ myAdjustSetting = AdjustSetting::TRACKBALL_SENSITIVITY;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::IncMouseTrackballSense:
+ if(pressed)
+ {
+ myPJoyHandler->changeMouseTrackballSensitivity(+1);
+ myAdjustSetting = AdjustSetting::TRACKBALL_SENSITIVITY;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::DecreaseDrivingSense:
+ if(pressed)
+ {
+ myPJoyHandler->changeDrivingSensitivity(-1);
+ myAdjustSetting = AdjustSetting::DRIVING_SENSITIVITY;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::IncreaseDrivingSense:
+ if(pressed)
+ {
+ myPJoyHandler->changeDrivingSensitivity(+1);
+ myAdjustSetting = AdjustSetting::DRIVING_SENSITIVITY;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::PreviousCursorVisbility:
+ if(pressed && !repeated)
+ {
+ changeMouseCursor(-1);
+ myAdjustSetting = AdjustSetting::MOUSE_CURSOR;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::NextCursorVisbility:
+ if(pressed && !repeated)
+ {
+ changeMouseCursor(+1);
+ myAdjustSetting = AdjustSetting::MOUSE_CURSOR;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::ToggleGrabMouse:
+ if(pressed && !repeated && !myOSystem.frameBuffer().fullScreen())
+ {
+ myOSystem.frameBuffer().toggleGrabMouse();
+ myAdjustSetting = AdjustSetting::GRAB_MOUSE;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::PreviousLeftPort:
+ if(pressed && !repeated)
+ {
+ myOSystem.console().changeLeftController(-1);
+ myAdjustSetting = AdjustSetting::LEFT_PORT;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::NextLeftPort:
+ if(pressed && !repeated)
+ {
+ myOSystem.console().changeLeftController(+1);
+ myAdjustSetting = AdjustSetting::LEFT_PORT;
+ myAdjustActive = true;
+ }
+
+ return;
+
+ case Event::PreviousRightPort:
+ if(pressed && !repeated)
+ {
+ myOSystem.console().changeRightController(-1);
+ myAdjustSetting = AdjustSetting::RIGHT_PORT;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::NextRightPort:
+ if(pressed && !repeated)
+ {
+ myOSystem.console().changeRightController(+1);
+ myAdjustSetting = AdjustSetting::RIGHT_PORT;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::ToggleSwapPorts:
+ if(pressed && !repeated)
+ {
+ myOSystem.console().toggleSwapPorts();
+ myAdjustSetting = AdjustSetting::SWAP_PORTS;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::ToggleSwapPaddles:
+ if(pressed && !repeated)
+ {
+ myOSystem.console().toggleSwapPaddles();
+ myAdjustSetting = AdjustSetting::SWAP_PADDLES;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::DecreasePaddleCenterX:
+ if(pressed)
+ {
+ myOSystem.console().changePaddleCenterX(-1);
+ myAdjustSetting = AdjustSetting::PADDLE_CENTER_X;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::IncreasePaddleCenterX:
+ if(pressed)
+ {
+ myOSystem.console().changePaddleCenterX(+1);
+ myAdjustSetting = AdjustSetting::PADDLE_CENTER_X;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::DecreasePaddleCenterY:
+ if(pressed)
+ {
+ myOSystem.console().changePaddleCenterY(-1);
+ myAdjustSetting = AdjustSetting::PADDLE_CENTER_Y;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::IncreasePaddleCenterY:
+ if(pressed)
+ {
+ myOSystem.console().changePaddleCenterY(+1);
+ myAdjustSetting = AdjustSetting::PADDLE_CENTER_Y;
+ myAdjustActive = true;
+ }
+ return;
+
+ case Event::PreviousMouseControl:
+ if(pressed && !repeated) changeMouseControl(-1);
+ return;
+
+ case Event::NextMouseControl:
+ if(pressed && !repeated) changeMouseControl(+1);
+ return;
+
+
+ ///////////////////////////////////////////////////////////////////////////
+ // State events
case Event::SaveState:
if (pressed && !repeated)
{
@@ -1289,7 +1781,6 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
///////////////////////////////////////////////////////////////////////////
// Misc events
-
case Event::DecreaseSpeed:
if(pressed)
{
@@ -1336,27 +1827,6 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
#endif
- case Event::DecreaseAutoFire:
- if(pressed) myOSystem.console().changeAutoFireRate(-1);
- return;
-
- case Event::IncreaseAutoFire:
- if(pressed) myOSystem.console().changeAutoFireRate(+1);
- return;
-
- case Event::HandleMouseControl:
- if (pressed && !repeated) handleMouseControl();
- return;
-
- case Event::ToggleSAPortOrder:
- if (pressed && !repeated) toggleSAPortOrder();
- return;
-
- case Event::ToggleGrabMouse:
- if (pressed && !repeated && !myOSystem.frameBuffer().fullScreen())
- myOSystem.frameBuffer().toggleGrabMouse();
- return;
-
case Event::TakeSnapshot:
if(pressed && !repeated) myOSystem.frameBuffer().tiaSurface().saveSnapShot();
return;
@@ -1599,7 +2069,6 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
////////////////////////////////////////////////////////////////////////
-
case Event::NoType: // Ignore unmapped events
return;
@@ -2028,6 +2497,9 @@ StringList EventHandler::getActionList(Event::Group group) const
case Event::Group::Keyboard:
return getActionList(KeyboardEvents);
+ case Event::Group::Devices:
+ return getActionList(DevicesEvents);
+
case Event::Group::Debug:
return getActionList(DebugEvents);
@@ -2197,6 +2669,9 @@ int EventHandler::getActionListIndex(int idx, Event::Group group) const
case Event::Group::Keyboard:
return getEmulActionListIndex(idx, KeyboardEvents);
+ case Event::Group::Devices:
+ return getEmulActionListIndex(idx, DevicesEvents);
+
case Event::Group::Debug:
return getEmulActionListIndex(idx, DebugEvents);
@@ -2291,10 +2766,53 @@ void EventHandler::setMouseControllerMode(const string& enable)
myOSystem.console().properties().get(PropType::Controller_MouseAxis) : "none";
myMouseControl = make_unique(myOSystem.console(), control);
- myMouseControl->next(); // set first available mode
+ myMouseControl->change(0); // set first available mode
}
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void EventHandler::changeMouseControllerMode(int direction)
+{
+ const int NUM_MODES = 3;
+ const string MODES[NUM_MODES] = {"always", "analog", "never"};
+ const string MSG[NUM_MODES] = {"all", "analog", "no"};
+ string usemouse = myOSystem.settings().getString("usemouse");
+
+ int i = 0;
+ for(auto& mode : MODES)
+ {
+ if(mode == usemouse)
+ {
+ i = BSPF::clampw(i + direction, 0, NUM_MODES - 1);
+ usemouse = MODES[i];
+ break;
+ }
+ ++i;
+ }
+ myOSystem.settings().setValue("usemouse", usemouse);
+ setMouseControllerMode(usemouse);
+ myOSystem.frameBuffer().setCursorState(); // if necessary change grab mouse
+
+ ostringstream ss;
+ ss << "Mouse controls " << MSG[i] << " devices";
+ myOSystem.frameBuffer().showTextMessage(ss.str());
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void EventHandler::changeMouseCursor(int direction)
+{
+ int cursor = BSPF::clampw(myOSystem.settings().getInt("cursor") + direction, 0, 3);
+
+ myOSystem.settings().setValue("cursor", cursor);
+ myOSystem.frameBuffer().setCursorState();
+
+ ostringstream ss;
+ ss << "Mouse cursor visibilility: "
+ << ((cursor & 2) ? "+" : "-") << "UI, "
+ << ((cursor & 1) ? "+" : "-") << "Emulation";
+ myOSystem.frameBuffer().showTextMessage(ss.str());
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::enterMenuMode(EventHandlerState state)
{
@@ -2692,11 +3210,43 @@ EventHandler::EmulActionList EventHandler::ourEmulActionList = { {
{ Event::VolumeDecrease, "Decrease volume", "" },
{ Event::VolumeIncrease, "Increase volume", "" },
+
+ { Event::DecreaseDeadzone, "Decrease joystick deadzone", "" },
+ { Event::IncreaseDeadzone, "Increase joystick deadzone", "" },
+ { Event::DecAnalogSense, "Decrease analog paddle sensitivity", "" },
+ { Event::IncAnalogSense, "Increase analog paddle sensitivity", "" },
+ { Event::DecDejtterAveraging, "Decrease paddle dejitter averaging", "" },
+ { Event::IncDejtterAveraging, "Increase paddle dejitter averaging", "" },
+ { Event::DecDejtterReaction, "Decrease paddle dejitter reaction", "" },
+ { Event::IncDejtterReaction, "Increase paddle dejitter reaction", "" },
+ { Event::DecDigitalSense, "Decrease digital paddle sensitivity", "" },
+ { Event::IncDigitalSense, "Increase digital paddle sensitivity", "" },
{ Event::DecreaseAutoFire, "Decrease auto fire speed", "" },
{ Event::IncreaseAutoFire, "Increase auto fire speed", "" },
- { Event::HandleMouseControl, "Switch mouse emulation modes", "" },
- { Event::ToggleGrabMouse, "Toggle grab mouse", "" },
+ { Event::ToggleFourDirections, "Toggle allow four joystick directions", "" },
+ { Event::ToggleKeyCombos, "Toggle use of modifier key combos", "" },
{ Event::ToggleSAPortOrder, "Swap Stelladaptor port ordering", "" },
+ { Event::PrevMouseAsController, "Select previous mouse controls", "" },
+ { Event::NextMouseAsController, "Select next mouse controls", "" },
+ { Event::DecMousePaddleSense, "Decrease mouse paddle sensitivity", "" },
+ { Event::IncMousePaddleSense, "Increase mouse paddle sensitivity", "" },
+ { Event::DecMouseTrackballSense, "Decrease mouse trackball sensitivity", "" },
+ { Event::IncMouseTrackballSense, "Increase mouse trackball sensitivity", "" },
+ { Event::DecreaseDrivingSense, "Decrease driving sensitivity", "" },
+ { Event::IncreaseDrivingSense, "Increase driving sensitivity", "" },
+ { Event::PreviousCursorVisbility, "Select prev. cursor visibility mode", "" },
+ { Event::NextCursorVisbility, "Select next cursor visibility mode" ,"" },
+ { Event::ToggleGrabMouse, "Toggle grab mouse", "" },
+ { Event::PreviousLeftPort, "Select previous left controller", "" },
+ { Event::NextLeftPort, "Select next left controller", "" },
+ { Event::PreviousRightPort, "Select previous right controller", "" },
+ { Event::NextRightPort, "Select next right controller", "" },
+ { Event::ToggleSwapPorts, "Toggle swap ports", "" },
+ { Event::ToggleSwapPaddles, "Toggle swap paddles", "" },
+ { Event::PreviousMouseControl, "Select previous mouse emulation mode", "" },
+ { Event::NextMouseControl, "Select next mouse emulation mode", "" },
+ { Event::DecreaseMouseAxesRange, "Decrease mouse axes range", "" },
+ { Event::IncreaseMouseAxesRange, "Increase mouse axes range", "" },
{ Event::ToggleTimeMachine, "Toggle 'Time Machine' mode", "" },
{ Event::TimeMachineMode, "Toggle 'Time Machine' UI", "" },
@@ -2763,10 +3313,8 @@ const Event::EventSet EventHandler::MiscEvents = {
Event::TakeSnapshot, Event::ToggleContSnapshots, Event::ToggleContSnapshotsFrame,
// Event::MouseAxisXMove, Event::MouseAxisYMove,
// Event::MouseButtonLeftValue, Event::MouseButtonRightValue,
- Event::DecreaseAutoFire, Event::IncreaseAutoFire,
- Event::HandleMouseControl, Event::ToggleGrabMouse,
Event::HighScoresMenuMode,
- Event::ToggleSAPortOrder, Event::PreviousMultiCartRom,
+ Event::PreviousMultiCartRom,
Event::PreviousSettingGroup, Event::NextSettingGroup,
Event::PreviousSetting, Event::NextSetting,
Event::SettingDecrease, Event::SettingIncrease,
@@ -2844,10 +3392,35 @@ const Event::EventSet EventHandler::KeyboardEvents = {
Event::KeyboardOneStar, Event::KeyboardOne0, Event::KeyboardOnePound,
};
+const Event::EventSet EventHandler::DevicesEvents = {
+ Event::DecreaseDeadzone, Event::IncreaseDeadzone,
+ Event::DecAnalogSense, Event::IncAnalogSense,
+ Event::DecDejtterAveraging, Event::IncDejtterAveraging,
+ Event::DecDejtterReaction, Event::IncDejtterReaction,
+ Event::DecDigitalSense, Event::IncDigitalSense,
+ Event::DecreaseAutoFire, Event::IncreaseAutoFire,
+ Event::ToggleFourDirections, Event::ToggleKeyCombos, Event::ToggleSAPortOrder,
+ Event::PrevMouseAsController, Event::NextMouseAsController,
+ Event::DecMousePaddleSense, Event::IncMousePaddleSense,
+ Event::DecMouseTrackballSense, Event::IncMouseTrackballSense,
+ Event::DecreaseDrivingSense, Event::IncreaseDrivingSense,
+ Event::PreviousCursorVisbility, Event::NextCursorVisbility,
+ Event::ToggleGrabMouse,
+ Event::PreviousLeftPort, Event::NextLeftPort,
+ Event::PreviousRightPort, Event::NextRightPort,
+ Event::ToggleSwapPorts, Event::ToggleSwapPaddles,
+ Event::DecreasePaddleCenterX, Event::IncreasePaddleCenterX,
+ Event::DecreasePaddleCenterY, Event::IncreasePaddleCenterY,
+ Event::PreviousMouseControl, Event::NextMouseControl,
+ Event::DecreaseMouseAxesRange, Event::IncreaseMouseAxesRange,
+};
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const Event::EventSet EventHandler::ComboEvents = {
- Event::Combo1, Event::Combo2, Event::Combo3, Event::Combo4, Event::Combo5, Event::Combo6, Event::Combo7, Event::Combo8,
- Event::Combo9, Event::Combo10, Event::Combo11, Event::Combo12, Event::Combo13, Event::Combo14, Event::Combo15, Event::Combo16,
+ Event::Combo1, Event::Combo2, Event::Combo3, Event::Combo4,
+ Event::Combo5, Event::Combo6, Event::Combo7, Event::Combo8,
+ Event::Combo9, Event::Combo10, Event::Combo11, Event::Combo12,
+ Event::Combo13, Event::Combo14, Event::Combo15, Event::Combo16,
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx
index 3d85ef86e..a6c477923 100644
--- a/src/emucore/EventHandler.hxx
+++ b/src/emucore/EventHandler.hxx
@@ -81,10 +81,15 @@ class EventHandler
*/
void mapStelladaptors(const string& saport);
+ /**
+ Toggles if all four joystick directions are allowed at once
+ */
+ void toggleAllow4JoyDirections(bool toggle = true);
+
/**
Swaps the ordering of Stelladaptor/2600-daptor(s) devices.
*/
- void toggleSAPortOrder();
+ void toggleSAPortOrder(bool toggle = true);
/**
Toggle whether the console is in 2600 or 7800 mode.
@@ -141,6 +146,8 @@ class EventHandler
'always', 'analog', 'never'
*/
void setMouseControllerMode(const string& enable);
+ void changeMouseControllerMode(int direction = +1);
+ void changeMouseCursor(int direction = +1);
void enterMenuMode(EventHandlerState state);
void leaveMenuMode();
@@ -353,7 +360,8 @@ class EventHandler
/**
Handle changing mouse modes.
*/
- void handleMouseControl();
+ void changeMouseControl(int direction = +1);
+ bool hasMouseControl() const;
void saveKeyMapping();
void saveJoyMapping();
@@ -462,6 +470,30 @@ class EventHandler
PHOSPHOR,
SCANLINES,
INTERPOLATION,
+ // *** Input group ***
+ DEADZONE,
+ ANALOG_SENSITIVITY,
+ DEJITTER_AVERAGING,
+ DEJITTER_REACTION,
+ DIGITAL_SENSITIVITY,
+ AUTO_FIRE,
+ FOUR_DIRECTIONS,
+ MOD_KEY_COMBOS,
+ SA_PORT_ORDER,
+ USE_MOUSE,
+ PADDLE_SENSITIVITY,
+ TRACKBALL_SENSITIVITY,
+ DRIVING_SENSITIVITY,
+ MOUSE_CURSOR,
+ GRAB_MOUSE,
+ LEFT_PORT,
+ RIGHT_PORT,
+ SWAP_PORTS,
+ SWAP_PADDLES,
+ PADDLE_CENTER_X,
+ PADDLE_CENTER_Y,
+ MOUSE_CONTROL,
+ MOUSE_RANGE,
// *** Debug group ***
STATS,
P0_ENAM,
@@ -490,12 +522,15 @@ class EventHandler
NUM_ADJ,
START_AV_ADJ = VOLUME,
END_AV_ADJ = INTERPOLATION,
+ START_INPUT_ADJ = DEADZONE,
+ END_INPUT_ADJ = MOUSE_RANGE,
START_DEBUG_ADJ = STATS,
END_DEBUG_ADJ = JITTER,
};
enum class AdjustGroup
{
AV,
+ INPUT,
DEBUG,
NUM_GROUPS
};
@@ -509,6 +544,7 @@ class EventHandler
static const Event::EventSet JoystickEvents;
static const Event::EventSet PaddlesEvents;
static const Event::EventSet KeyboardEvents;
+ static const Event::EventSet DevicesEvents;
static const Event::EventSet ComboEvents;
static const Event::EventSet DebugEvents;
static const Event::EventSet EditEvents;
@@ -533,6 +569,18 @@ class EventHandler
AdjustFunction cycleAdjustSetting(int direction);
AdjustFunction getAdjustSetting(AdjustSetting setting);
+ PhysicalJoystickHandler& joyHandler() { return *myPJoyHandler; }
+ PhysicalKeyboardHandler& keyHandler() { return *myPKeyHandler; }
+
+ bool isJoystick(const Controller& controller) const;
+ bool isPaddle(const Controller& controller) const;
+ bool isTrackball(const Controller& controller) const;
+
+ // Check if a currently non-relevant adjustment can be skipped
+ bool skipAVSetting() const;
+ bool skipInputSetting() const;
+ bool skipDebugSetting() const;
+
private:
// Structure used for action menu items
struct ActionList {
@@ -596,7 +644,7 @@ class EventHandler
#else
REFRESH_SIZE = 0,
#endif
- EMUL_ACTIONLIST_SIZE = 176 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE,
+ EMUL_ACTIONLIST_SIZE = 207 + PNG_SIZE + COMBO_SIZE + REFRESH_SIZE,
MENU_ACTIONLIST_SIZE = 18
;
diff --git a/src/emucore/FSNode.cxx b/src/emucore/FSNode.cxx
index 6ff0b6482..c228c916c 100644
--- a/src/emucore/FSNode.cxx
+++ b/src/emucore/FSNode.cxx
@@ -20,7 +20,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNode::FilesystemNode(const AbstractFSNodePtr& realNode)
- : _realNode(realNode)
+ : _realNode{realNode}
{
}
diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx
index 6b8e9ef01..eb82844cb 100644
--- a/src/emucore/FrameBuffer.cxx
+++ b/src/emucore/FrameBuffer.cxx
@@ -31,6 +31,7 @@
#include "FBSurface.hxx"
#include "TIASurface.hxx"
#include "FrameBuffer.hxx"
+#include "PaletteHandler.hxx"
#include "StateManager.hxx"
#include "RewindManager.hxx"
@@ -59,7 +60,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBuffer::FrameBuffer(OSystem& osystem)
- : myOSystem(osystem)
+ : myOSystem{osystem}
{
}
@@ -78,8 +79,7 @@ void FrameBuffer::initialize()
{
// First create the platform-specific backend; it is needed before anything
// else can be used
- try { myBackend = MediaFactory::createVideoBackend(myOSystem); }
- catch(const runtime_error& e) { throw e; }
+ myBackend = MediaFactory::createVideoBackend(myOSystem);
// Get desktop resolution and supported renderers
vector windowedDisplays;
@@ -952,7 +952,7 @@ void FrameBuffer::stateChanged(EventHandlerState state)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-string FrameBuffer::getDisplayKey()
+string FrameBuffer::getDisplayKey() const
{
// save current window's display and position
switch(myBufferType)
@@ -974,7 +974,7 @@ string FrameBuffer::getDisplayKey()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-string FrameBuffer::getPositionKey()
+string FrameBuffer::getPositionKey() const
{
// save current window's display and position
switch(myBufferType)
@@ -996,13 +996,31 @@ string FrameBuffer::getPositionKey()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void FrameBuffer::saveCurrentWindowPosition()
+void FrameBuffer::saveCurrentWindowPosition() const
{
- myOSystem.settings().setValue(
- getDisplayKey(), myBackend->getCurrentDisplayIndex());
- if(myBackend->isCurrentWindowPositioned())
+ if(myBackend)
+ {
myOSystem.settings().setValue(
- getPositionKey(), myBackend->getCurrentWindowPos());
+ getDisplayKey(), myBackend->getCurrentDisplayIndex());
+ if(myBackend->isCurrentWindowPositioned())
+ myOSystem.settings().setValue(
+ getPositionKey(), myBackend->getCurrentWindowPos());
+ }
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void FrameBuffer::saveConfig(Settings& settings) const
+{
+ // Save the last windowed position and display on system shutdown
+ saveCurrentWindowPosition();
+
+ if(myTIASurface)
+ {
+ Logger::debug("Saving TV effects options ...");
+ tiaSurface().ntsc().saveConfig(settings);
+ Logger::debug("Saving palette settings...");
+ tiaSurface().paletteHandler().saveConfig(settings);
+ }
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -1254,21 +1272,18 @@ float FrameBuffer::maxWindowZoom(uInt32 baseWidth, uInt32 baseHeight) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::setCursorState()
{
+ myGrabMouse = myOSystem.settings().getBool("grabmouse");
// Always grab mouse in emulation (if enabled) and emulating a controller
// that always uses the mouse
- bool emulation =
+ const bool emulation =
myOSystem.eventHandler().state() == EventHandlerState::EMULATION;
- bool analog = myOSystem.hasConsole() ?
- (myOSystem.console().leftController().isAnalog() ||
- myOSystem.console().rightController().isAnalog()) : false;
- bool usesLightgun = emulation && myOSystem.hasConsole() ?
+ const bool usesLightgun = emulation && myOSystem.hasConsole() ?
myOSystem.console().leftController().type() == Controller::Type::Lightgun ||
myOSystem.console().rightController().type() == Controller::Type::Lightgun : false;
- bool alwaysUseMouse = BSPF::equalsIgnoreCase("always", myOSystem.settings().getString("usemouse"));
-
// Show/hide cursor in UI/emulation mode based on 'cursor' setting
int cursor = myOSystem.settings().getInt("cursor");
- // always enable cursor in lightgun games
+
+ // Always enable cursor in lightgun games
if (usesLightgun && !myGrabMouse)
cursor |= 1; // +Emulation
@@ -1278,21 +1293,41 @@ void FrameBuffer::setCursorState()
showCursor(false);
break;
case 1:
- showCursor(emulation); //-UI, +Emulation
- myGrabMouse = false; // disable grab while cursor is shown in emulation
+ showCursor(emulation); // -UI, +Emulation
break;
case 2: // +UI, -Emulation
showCursor(!emulation);
break;
case 3:
showCursor(true); // +UI, +Emulation
- myGrabMouse = false; // disable grab while cursor is shown in emulation
break;
default:
break;
}
- myBackend->grabMouse(emulation && (analog || alwaysUseMouse) && myGrabMouse);
+ myGrabMouse &= grabMouseAllowed();
+ myBackend->grabMouse(myGrabMouse);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool FrameBuffer::grabMouseAllowed()
+{
+ // Allow grabbing mouse in emulation (if enabled) and emulating a controller
+ // that always uses the mouse
+ bool emulation =
+ myOSystem.eventHandler().state() == EventHandlerState::EMULATION;
+ bool analog = myOSystem.hasConsole() ?
+ (myOSystem.console().leftController().isAnalog() ||
+ myOSystem.console().rightController().isAnalog()) : false;
+ bool usesLightgun = emulation && myOSystem.hasConsole() ?
+ myOSystem.console().leftController().type() == Controller::Type::Lightgun ||
+ myOSystem.console().rightController().type() == Controller::Type::Lightgun : false;
+ bool alwaysUseMouse = BSPF::equalsIgnoreCase("always", myOSystem.settings().getString("usemouse"));
+
+ // Disable grab while cursor is shown in emulation
+ bool cursorHidden = !(myOSystem.settings().getInt("cursor") & 1);
+
+ return emulation && (analog || usesLightgun || alwaysUseMouse) && cursorHidden;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -1303,16 +1338,25 @@ void FrameBuffer::enableGrabMouse(bool enable)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void FrameBuffer::toggleGrabMouse()
+void FrameBuffer::toggleGrabMouse(bool toggle)
{
- const bool oldState = myGrabMouse;
+ bool oldState = myGrabMouse = myOSystem.settings().getBool("grabmouse");
+
+ if(toggle)
+ {
+ if(grabMouseAllowed())
+ {
+ myGrabMouse = !myGrabMouse;
+ myOSystem.settings().setValue("grabmouse", myGrabMouse);
+ setCursorState();
+ }
+ }
+ else
+ oldState = !myGrabMouse; // display current state
- myGrabMouse = !myGrabMouse;
- setCursorState();
- myOSystem.settings().setValue("grabmouse", myGrabMouse);
myOSystem.frameBuffer().showTextMessage(oldState != myGrabMouse ? myGrabMouse
? "Grab mouse enabled" : "Grab mouse disabled"
- : "Grab mouse not allowed while cursor shown");
+ : "Grab mouse not allowed");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/emucore/FrameBuffer.hxx b/src/emucore/FrameBuffer.hxx
index 0971873f2..4cd658c19 100644
--- a/src/emucore/FrameBuffer.hxx
+++ b/src/emucore/FrameBuffer.hxx
@@ -62,7 +62,7 @@ class FrameBuffer
};
public:
- FrameBuffer(OSystem& osystem);
+ explicit FrameBuffer(OSystem& osystem);
~FrameBuffer();
/**
@@ -252,6 +252,11 @@ class FrameBuffer
*/
void setCursorState();
+ /**
+ Checks if mouse grabbing is allowed.
+ */
+ bool grabMouseAllowed();
+
/**
Sets the use of grabmouse.
*/
@@ -260,7 +265,7 @@ class FrameBuffer
/**
Toggles the use of grabmouse (only has effect in emulation mode).
*/
- void toggleGrabMouse();
+ void toggleGrabMouse(bool toggle = true);
/**
Query whether grabmouse is enabled.
@@ -286,12 +291,12 @@ class FrameBuffer
uInt32 hidpiScaleFactor() const { return myHiDPIEnabled ? 2 : 1; }
/**
- These methods are used to load/save position and display of the
- current window.
+ This method should be called to save the current settings of all
+ its subsystems. Note that the this may be called when the class
+ hasn't been fully initialized, so we first need to check if the
+ subsytems actually exist.
*/
- string getPositionKey();
- string getDisplayKey();
- void saveCurrentWindowPosition();
+ void saveConfig(Settings& settings) const;
#ifdef GUI_SUPPORT
/**
@@ -371,6 +376,14 @@ class FrameBuffer
int scaleY(int y) const { return myBackend->scaleY(y); }
private:
+ /**
+ These methods are used to load/save position and display of the
+ current window.
+ */
+ string getPositionKey() const;
+ string getDisplayKey() const;
+ void saveCurrentWindowPosition() const;
+
/**
Calls 'free()' on all surfaces that the framebuffer knows about.
*/
diff --git a/src/emucore/Joystick.cxx b/src/emucore/Joystick.cxx
index 7f62335f9..14247760c 100644
--- a/src/emucore/Joystick.cxx
+++ b/src/emucore/Joystick.cxx
@@ -153,9 +153,15 @@ bool Joystick::setMouseControl(
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Joystick::setDeadZone(int deadzone)
{
- deadzone = BSPF::clamp(deadzone, 0, 29);
+ _DEAD_ZONE = deadZoneValue(deadzone);
+}
- _DEAD_ZONE = 3200 + deadzone * 1000;
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+int Joystick::deadZoneValue(int deadzone)
+{
+ deadzone = BSPF::clamp(deadzone, DEAD_ZONE_MIN, DEAD_ZONE_MAX);
+
+ return 3200 + deadzone * 1000;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/emucore/Joystick.hxx b/src/emucore/Joystick.hxx
index ec652e98b..44a02630a 100644
--- a/src/emucore/Joystick.hxx
+++ b/src/emucore/Joystick.hxx
@@ -30,6 +30,9 @@
class Joystick : public Controller
{
public:
+ static constexpr int DEAD_ZONE_MIN = 0;
+ static constexpr int DEAD_ZONE_MAX = 29;
+
/**
Create a new joystick controller plugged into the specified jack
@@ -78,6 +81,11 @@ class Joystick : public Controller
but it seemed like the best place to put it.
*/
static void setDeadZone(int deadzone);
+
+ /**
+ Retrieves the effective deadzone value
+ */
+ static int deadZoneValue(int deadzone);
inline static int deadzone() { return _DEAD_ZONE; }
private:
diff --git a/src/emucore/KidVid.cxx b/src/emucore/KidVid.cxx
index f9ade13e1..088eab854 100644
--- a/src/emucore/KidVid.cxx
+++ b/src/emucore/KidVid.cxx
@@ -24,7 +24,7 @@
KidVid::KidVid(Jack jack, const Event& event, const System& system,
const string& romMd5)
: Controller(jack, event, system, Controller::Type::KidVid),
- myEnabled(myJack == Jack::Right)
+ myEnabled{myJack == Jack::Right}
{
// Right now, there are only two games that use the KidVid
if(romMd5 == "ee6665683ebdb539e89ba620981cb0f6")
diff --git a/src/emucore/Lightgun.cxx b/src/emucore/Lightgun.cxx
index 3ae39d8e5..7a7c25a88 100644
--- a/src/emucore/Lightgun.cxx
+++ b/src/emucore/Lightgun.cxx
@@ -29,7 +29,7 @@
Lightgun::Lightgun(Jack jack, const Event& event, const System& system,
const string& romMd5, const FrameBuffer& frameBuffer)
: Controller(jack, event, system, Controller::Type::Lightgun),
- myFrameBuffer(frameBuffer)
+ myFrameBuffer{frameBuffer}
{
// Right now, there are only three games and a test ROM that use the light gun
if (romMd5 == "8da51e0c4b6b46f7619425119c7d018e" ||
diff --git a/src/emucore/M6502.cxx b/src/emucore/M6502.cxx
index 295697af2..c3eb93b85 100644
--- a/src/emucore/M6502.cxx
+++ b/src/emucore/M6502.cxx
@@ -47,7 +47,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
M6502::M6502(const Settings& settings)
- : mySettings(settings)
+ : mySettings{settings}
{
}
diff --git a/src/emucore/M6532.cxx b/src/emucore/M6532.cxx
index eaa43c61f..ee3e38a36 100644
--- a/src/emucore/M6532.cxx
+++ b/src/emucore/M6532.cxx
@@ -27,8 +27,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
M6532::M6532(const ConsoleIO& console, const Settings& settings)
- : myConsole(console),
- mySettings(settings)
+ : myConsole{console},
+ mySettings{settings}
{
}
diff --git a/src/emucore/MT24LC256.cxx b/src/emucore/MT24LC256.cxx
index 53004b804..0dd9a7b6c 100644
--- a/src/emucore/MT24LC256.cxx
+++ b/src/emucore/MT24LC256.cxx
@@ -45,9 +45,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MT24LC256::MT24LC256(const FilesystemNode& eepromfile, const System& system,
const Controller::onMessageCallback& callback)
- : mySystem(system),
- myCallback(callback),
- myDataFile(eepromfile)
+ : mySystem{system},
+ myCallback{callback},
+ myDataFile{eepromfile}
{
// Load the data from an external file (if it exists)
bool fileValid = false;
diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx
index ca0a1d1c4..bedec476a 100644
--- a/src/emucore/OSystem.cxx
+++ b/src/emucore/OSystem.cxx
@@ -48,7 +48,6 @@
#include "CartCreator.hxx"
#include "FrameBuffer.hxx"
#include "TIASurface.hxx"
-#include "PaletteHandler.hxx"
#include "TIAConstants.hxx"
#include "Settings.hxx"
#include "PropsSet.hxx"
@@ -149,8 +148,9 @@ bool OSystem::create()
myFrameBuffer = make_unique(*this);
myFrameBuffer->initialize();
}
- catch(...)
+ catch(const runtime_error& e)
{
+ Logger::error(e.what());
return false;
}
@@ -249,20 +249,15 @@ void OSystem::loadConfig(const Settings::Options& options)
void OSystem::saveConfig()
{
// Ask all subsystems to save their settings
- if(myFrameBuffer)
+ if(myFrameBuffer && mySettings)
+ myFrameBuffer->saveConfig(settings());
+
+ if(mySettings)
{
- // Save the last windowed position and display on system shutdown
- myFrameBuffer->saveCurrentWindowPosition();
-
- Logger::debug("Saving TV effects options ...");
- myFrameBuffer->tiaSurface().ntsc().saveConfig(settings());
- Logger::debug("Saving palette settings...");
- myFrameBuffer->tiaSurface().paletteHandler().saveConfig(settings());
+ Logger::debug("Saving config options ...");
+ mySettings->save();
}
- Logger::debug("Saving config options ...");
- mySettings->save();
-
if(myPropSet && myPropSet->save(myPropertiesFile))
Logger::debug("Saving properties set ...");
}
@@ -737,7 +732,7 @@ double OSystem::dispatchEmulation(EmulationWorker& emulationWorker)
if (!myConsole) return 0.;
TIA& tia(myConsole->tia());
- EmulationTiming& timing(myConsole->emulationTiming());
+ const EmulationTiming& timing = myConsole->emulationTiming();
DispatchResult dispatchResult;
// Check whether we have a frame pending for rendering...
@@ -749,8 +744,8 @@ double OSystem::dispatchEmulation(EmulationWorker& emulationWorker)
tia.renderToFrameBuffer();
}
- // Start emulation on a dedicated thread. It will do its own scheduling to sync 6507 and real time
- // and will run until we stop the worker.
+ // Start emulation on a dedicated thread. It will do its own scheduling to
+ // sync 6507 and real time and will run until we stop the worker.
emulationWorker.start(
timing.cyclesPerSecond(),
timing.maxCyclesPerTimeslice(),
@@ -759,8 +754,8 @@ double OSystem::dispatchEmulation(EmulationWorker& emulationWorker)
&tia
);
- // Render the frame. This may block, but emulation will continue to run on the worker, so the
- // audio pipeline is kept fed :)
+ // Render the frame. This may block, but emulation will continue to run on
+ // the worker, so the audio pipeline is kept fed :)
if (framePending) myFrameBuffer->updateInEmulationMode(myFpsMeter.fps());
// Stop the worker and wait until it has finished
@@ -796,11 +791,13 @@ double OSystem::dispatchEmulation(EmulationWorker& emulationWorker)
}
// Handle frying
- if (dispatchResult.getStatus() == DispatchResult::Status::ok && myEventHandler->frying())
+ if (dispatchResult.getStatus() == DispatchResult::Status::ok &&
+ myEventHandler->frying())
myConsole->fry();
// Return the 6507 time used in seconds
- return static_cast(totalCycles) / static_cast(timing.cyclesPerSecond());
+ return static_cast(totalCycles) /
+ static_cast(timing.cyclesPerSecond());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/emucore/Paddles.cxx b/src/emucore/Paddles.cxx
index a7f72ce1d..6e79109fa 100644
--- a/src/emucore/Paddles.cxx
+++ b/src/emucore/Paddles.cxx
@@ -384,14 +384,18 @@ bool Paddles::setMouseControl(
// The following is somewhat complex, but we need to pre-process as much
// as possible, so that ::update() can run quickly
myMPaddleID = -1;
- if(myJack == Jack::Left && xtype == Controller::Type::Paddles)
+ if(myJack == Jack::Left)
{
- myMPaddleIDX = (xid == 0 || xid == 1) ? xid & 0x01 : -1;
- myMPaddleIDY = (yid == 0 || yid == 1) ? yid & 0x01 : -1;
+ if(xtype == Controller::Type::Paddles)
+ myMPaddleIDX = (xid == 0 || xid == 1) ? xid & 0x01 : -1;
+ if(ytype == Controller::Type::Paddles)
+ myMPaddleIDY = (yid == 0 || yid == 1) ? yid & 0x01 : -1;
}
- else if(myJack == Jack::Right && ytype == Controller::Type::Paddles)
+ else if(myJack == Jack::Right)
{
- myMPaddleIDX = (xid == 2 || xid == 3) ? xid & 0x01 : -1;
+ if(xtype == Controller::Type::Paddles)
+ myMPaddleIDX = (xid == 2 || xid == 3) ? xid & 0x01 : -1;
+ if(ytype == Controller::Type::Paddles)
myMPaddleIDY = (yid == 2 || yid == 3) ? yid & 0x01 : -1;
}
}
@@ -416,11 +420,15 @@ void Paddles::setAnalogYCenter(int ycenter)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
float Paddles::setAnalogSensitivity(int sensitivity)
{
- // BASE_ANALOG_SENSE * (1.1 ^ 20) = 1.0
- SENSITIVITY = BASE_ANALOG_SENSE * std::pow(1.1F,
- static_cast(BSPF::clamp(sensitivity, 0, MAX_ANALOG_SENSE)));
+ return SENSITIVITY = analogSensitivityValue(sensitivity);
+}
- return SENSITIVITY;
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+float Paddles::analogSensitivityValue(int sensitivity)
+{
+ // BASE_ANALOG_SENSE * (1.1 ^ 20) = 1.0
+ return BASE_ANALOG_SENSE * std::pow(1.1F,
+ static_cast(BSPF::clamp(sensitivity, MIN_ANALOG_SENSE, MAX_ANALOG_SENSE)));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -438,20 +446,20 @@ void Paddles::setDejitterDiff(int strength)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Paddles::setDigitalSensitivity(int sensitivity)
{
- DIGITAL_SENSITIVITY = BSPF::clamp(sensitivity, 1, MAX_DIGITAL_SENSE);
+ DIGITAL_SENSITIVITY = BSPF::clamp(sensitivity, MIN_DIGITAL_SENSE, MAX_DIGITAL_SENSE);
DIGITAL_DISTANCE = 20 + (DIGITAL_SENSITIVITY << 3);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Paddles::setMouseSensitivity(int sensitivity)
{
- MOUSE_SENSITIVITY = BSPF::clamp(sensitivity, 1, MAX_MOUSE_SENSE);
+ MOUSE_SENSITIVITY = BSPF::clamp(sensitivity, MIN_MOUSE_SENSE, MAX_MOUSE_SENSE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Paddles::setDigitalPaddleRange(int range)
{
- range = BSPF::clamp(range, 1, 100);
+ range = BSPF::clamp(range, MIN_MOUSE_RANGE, MAX_MOUSE_RANGE);
TRIGRANGE = int(TRIGMAX * (range / 100.0));
}
diff --git a/src/emucore/Paddles.hxx b/src/emucore/Paddles.hxx
index a84bf813c..7d810c27b 100644
--- a/src/emucore/Paddles.hxx
+++ b/src/emucore/Paddles.hxx
@@ -49,13 +49,18 @@ class Paddles : public Controller
public:
static constexpr float BASE_ANALOG_SENSE = 0.148643628F;
+ static constexpr int MIN_ANALOG_SENSE = 0;
static constexpr int MAX_ANALOG_SENSE = 30;
static constexpr int MIN_ANALOG_CENTER = -10;
static constexpr int MAX_ANALOG_CENTER = 30;
+ static constexpr int MIN_DIGITAL_SENSE = 1;
static constexpr int MAX_DIGITAL_SENSE = 20;
+ static constexpr int MIN_MOUSE_SENSE = 1;
static constexpr int MAX_MOUSE_SENSE = 20;
static constexpr int MIN_DEJITTER = 0;
static constexpr int MAX_DEJITTER = 10;
+ static constexpr int MIN_MOUSE_RANGE = 1;
+ static constexpr int MAX_MOUSE_RANGE = 100;
/**
Update the entire digital and analog pin state according to the
@@ -114,6 +119,8 @@ class Paddles : public Controller
*/
static float setAnalogSensitivity(int sensitivity);
+ static float analogSensitivityValue(int sensitivity);
+
/**
@param strength Value from 0 to 10
*/
diff --git a/src/emucore/PlusROM.cxx b/src/emucore/PlusROM.cxx
new file mode 100644
index 000000000..20832734a
--- /dev/null
+++ b/src/emucore/PlusROM.cxx
@@ -0,0 +1,142 @@
+//============================================================================
+//
+// SSSS tt lll lll
+// SS SS tt ll ll
+// SS tttttt eeee ll ll aaaa
+// SSSS tt ee ee ll ll aa
+// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
+// SS SS tt ee ll ll aa aa
+// SSSS ttt eeeee llll llll aaaaa
+//
+// Copyright (c) 1995-2020 by Bradford W. Mott, Stephen Anthony
+// and the Stella Team
+//
+// See the file "License.txt" for information on usage and redistribution of
+// this file, and for a DISCLAIMER OF ALL WARRANTIES.
+//============================================================================
+
+#include
+
+#include "bspf.hxx"
+#include "PlusROM.hxx"
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool PlusROM::initialize(const ByteBuffer& image, size_t size)
+{
+ // Host and path are stored at the NMI vector
+ size_t i = ((image[size - 5] - 16) << 8) | image[size - 6]; // NMI @ $FFFA
+ if(i >= size)
+ return myIsPlusROM = false; // Invalid NMI
+
+ // Path stored first, 0-terminated
+ string path;
+ while(i < size && image[i] != 0)
+ path += static_cast(image[i++]);
+
+ // Did we get a valid, 0-terminated path?
+ if(i >= size || image[i] != 0 || !isValidPath(path))
+ return myIsPlusROM = false; // Invalid path
+
+ i++; // advance past 0 terminator
+
+ // Host stored next, 0-terminated
+ string host;
+ while(i < size && image[i] != 0)
+ host += static_cast(image[i++]);
+
+ // Did we get a valid, 0-terminated host?
+ if(i >= size || image[i] != 0 || !isValidHost(host))
+ return myIsPlusROM = false; // Invalid host
+
+ myURL = "http://" + host + "/" + path;
+ cerr << "URL: " << myURL << endl;
+ return myIsPlusROM = true;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool PlusROM::peekHotspot(uInt16 address, uInt8& value)
+{
+ switch(address & 0x0FFF)
+ {
+ case 0x0FF2: // Read next byte from Rx buffer
+ return false;
+
+ case 0x0FF3: // Get number of unread bytes in Rx buffer
+ return false;
+ }
+ return false;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool PlusROM::pokeHotspot(uInt16 address, uInt8 value)
+{
+ switch(address & 0x0FFF)
+ {
+ case 0x0FF0: // Write byte to Tx buffer
+ return false;
+
+ case 0x0FF1: // Write byte to Tx buffer and send to backend
+ // (and receive into Rx buffer)
+ return false;
+ }
+ return false;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool PlusROM::save(Serializer& out) const
+{
+ try
+ {
+ out.putByteArray(myRxBuffer.data(), myRxBuffer.size());
+ out.putByteArray(myTxBuffer.data(), myTxBuffer.size());
+ }
+ catch(...)
+ {
+ cerr << "ERROR: PlusROM::save" << endl;
+ return false;
+ }
+
+ return true;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool PlusROM::load(Serializer& in)
+{
+ try
+ {
+ in.getByteArray(myRxBuffer.data(), myRxBuffer.size());
+ in.getByteArray(myTxBuffer.data(), myTxBuffer.size());
+ }
+ catch(...)
+ {
+ cerr << "ERROR: PlusROM::load" << endl;
+ return false;
+ }
+
+ return true;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool PlusROM::isValidHost(const string& host) const
+{
+ // TODO: This isn't 100% either, as we're supposed to check for the length
+ // of each part between '.' in the range 1 .. 63
+ // Perhaps a better function will be included with whatever network
+ // library we decide to use
+ static std::regex rgx(R"(^(([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)*([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])$)", std::regex_constants::icase);
+
+ return std::regex_match(host, rgx);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool PlusROM::isValidPath(const string& path) const
+{
+ // TODO: This isn't 100%
+ // Perhaps a better function will be included with whatever network
+ // library we decide to use
+ for(auto c: path)
+ if(!((c > 44 && c < 58) || (c > 64 && c < 91) || (c > 96 && c < 122)))
+ return false;
+
+ return true;
+}
diff --git a/src/emucore/PlusROM.hxx b/src/emucore/PlusROM.hxx
new file mode 100644
index 000000000..b3e116380
--- /dev/null
+++ b/src/emucore/PlusROM.hxx
@@ -0,0 +1,132 @@
+//============================================================================
+//
+// SSSS tt lll lll
+// SS SS tt ll ll
+// SS tttttt eeee ll ll aaaa
+// SSSS tt ee ee ll ll aa
+// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
+// SS SS tt ee ll ll aa aa
+// SSSS ttt eeeee llll llll aaaaa
+//
+// Copyright (c) 1995-2020 by Bradford W. Mott, Stephen Anthony
+// and the Stella Team
+//
+// See the file "License.txt" for information on usage and redistribution of
+// this file, and for a DISCLAIMER OF ALL WARRANTIES.
+//============================================================================
+
+#ifndef PLUSROM_HXX
+#define PLUSROM_HXX
+
+#include "bspf.hxx"
+#include "Serializable.hxx"
+
+/**
+ Class used to emulate the 'PlusROM' meta-scheme, documented at
+ http://pluscart.firmaplus.de/pico/?PlusROM
+
+ This scheme basically wraps a normal bankswitching scheme, but includes
+ network functionality.
+
+ Host and path names are stored as 0-terminated strings, located at the
+ NMI vector, stored path first and then host next.
+
+ PlusROMs functions use 4 hotspot addresses (before the bankswitching area):
+ $1FF0 is for writing a byte to the send buffer (max 256 bytes)
+ $1FF1 is for writing a byte to the send buffer and submit the buffer
+ to the back end API
+ $1FF2 contains the next byte of the response from the host, every read will
+ increment the receive buffer pointer (receive buffer is max 256 bytes also!)
+ $1FF3 contains the number of (unread) bytes left in the receive buffer
+ (these bytes can be from multiple responses)
+
+ @author Stephen Anthony
+*/
+class PlusROM : public Serializable
+{
+ public:
+ PlusROM() = default;
+ ~PlusROM() override = default;
+
+ public:
+ /**
+ Determine whether this is actually a PlusROM cart, and if so create
+ and initialize all state variables it will use. This includes
+ whether there is a valid hostname and path embedded in the ROM.
+
+ @param image Pointer to the ROM image
+ @param size The size of the ROM image
+
+ @return Whether this is actually a valid PlusROM cart
+ */
+ bool initialize(const ByteBuffer& image, size_t size);
+
+ /**
+ Answer whether this is a PlusROM cart. Note that until the
+ initialize method has been called, this will always return false.
+
+ @return Whether this is actually a PlusROM cart
+ */
+ bool isValid() const { return myIsPlusROM; }
+
+ /**
+ Read from hotspot addresses ($1FF2 and $1FF3).
+
+ @param address The hotspot where the value should be read
+ @param value The value read from the hotspot
+
+ @return Indicates whether the peek succeeded or failed
+ (ie, whether it hit a hotspot)
+ On failure, 'value' is not considered valid
+ */
+ bool peekHotspot(uInt16 address, uInt8& value);
+
+ /**
+ Write to hotspot addresses ($1FF0 and $1FF1).
+
+ @param address The hotspot where the value should be written
+ @param value The value to be stored at the hotspot
+
+ @return Indicates whether the poke succeeded or failed
+ (ie, whether it hit a hotspot)
+ */
+ bool pokeHotspot(uInt16 address, uInt8 value);
+
+ /**
+ Save the current state of this device to the given Serializer.
+
+ @param out The Serializer object to use
+ @return False on any errors, else true
+ */
+ bool save(Serializer& out) const override;
+
+ /**
+ Load the current state of this device from the given Serializer.
+
+ @param in The Serializer object to use
+ @return False on any errors, else true
+ */
+ bool load(Serializer& in) override;
+
+ private:
+ //////////////////////////////////////////////////////
+ // These probably belong in the networking library
+ bool isValidHost(const string& host) const;
+ bool isValidPath(const string& path) const;
+ //////////////////////////////////////////////////////
+
+ private:
+ bool myIsPlusROM{false};
+ string myURL;
+
+ std::array myRxBuffer, myTxBuffer;
+
+ private:
+ // Following constructors and assignment operators not supported
+ PlusROM(const PlusROM&) = delete;
+ PlusROM(PlusROM&&) = delete;
+ PlusROM& operator=(const PlusROM&) = delete;
+ PlusROM& operator=(PlusROM&&) = delete;
+};
+
+#endif
diff --git a/src/emucore/PointingDevice.cxx b/src/emucore/PointingDevice.cxx
index b48c372a3..1ff1e68bc 100644
--- a/src/emucore/PointingDevice.cxx
+++ b/src/emucore/PointingDevice.cxx
@@ -29,7 +29,7 @@ PointingDevice::PointingDevice(Jack jack, const Event& event,
const System& system, Controller::Type type,
float sensitivity)
: Controller(jack, event, system, type),
- mySensitivity(sensitivity)
+ mySensitivity{sensitivity}
{
// The code in ::read() is set up to always return IOPortA values in
// the lower 4 bits data value
@@ -110,7 +110,7 @@ bool PointingDevice::setMouseControl(
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PointingDevice::setSensitivity(int sensitivity)
{
- BSPF::clamp(sensitivity, 1, 20, 10);
+ BSPF::clamp(sensitivity, MIN_SENSE, MAX_SENSE, (MIN_SENSE + MAX_SENSE) / 2);
TB_SENSITIVITY = sensitivity / 10.0F;
}
diff --git a/src/emucore/PointingDevice.hxx b/src/emucore/PointingDevice.hxx
index 105d07f43..dcdd2fcfd 100644
--- a/src/emucore/PointingDevice.hxx
+++ b/src/emucore/PointingDevice.hxx
@@ -39,6 +39,10 @@ class PointingDevice : public Controller
float sensitivity);
~PointingDevice() override = default;
+ public:
+ static constexpr int MIN_SENSE = 1;
+ static constexpr int MAX_SENSE = 20;
+
public:
using Controller::read;
diff --git a/src/emucore/ProfilingRunner.cxx b/src/emucore/ProfilingRunner.cxx
index 877d35934..810c4bbe5 100644
--- a/src/emucore/ProfilingRunner.cxx
+++ b/src/emucore/ProfilingRunner.cxx
@@ -56,7 +56,7 @@ namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ProfilingRunner::ProfilingRunner(int argc, char* argv[])
- : profilingRuns(std::max(argc - 2, 0))
+ : profilingRuns{std::max(argc - 2, 0)}
{
for (int i = 2; i < argc; i++) {
ProfilingRun& run(profilingRuns[i-2]);
diff --git a/src/emucore/QuadTari.cxx b/src/emucore/QuadTari.cxx
index f3fb00cdf..174304e7c 100644
--- a/src/emucore/QuadTari.cxx
+++ b/src/emucore/QuadTari.cxx
@@ -30,11 +30,12 @@
#include "QuadTari.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-QuadTari::QuadTari(Jack jack, const OSystem& osystem, const System& system, const Properties& properties)
+QuadTari::QuadTari(Jack jack, const OSystem& osystem, const System& system,
+ const Properties& properties)
: Controller(jack, osystem.eventHandler().event(), system,
Controller::Type::QuadTari),
- myOSystem(osystem),
- myProperties(properties)
+ myOSystem{osystem},
+ myProperties{properties}
{
Controller::Type firstType = Controller::Type::Joystick,
secondType = Controller::Type::Joystick;
diff --git a/src/emucore/SaveKey.cxx b/src/emucore/SaveKey.cxx
index dcab2b8b3..11a7a5682 100644
--- a/src/emucore/SaveKey.cxx
+++ b/src/emucore/SaveKey.cxx
@@ -25,7 +25,7 @@ SaveKey::SaveKey(Jack jack, const Event& event, const System& system,
const FilesystemNode& eepromfile, const onMessageCallback& callback,
Type type)
: Controller(jack, event, system, type),
- myEEPROM(make_unique(eepromfile, system, callback))
+ myEEPROM{make_unique(eepromfile, system, callback)}
{
setPin(DigitalPin::One, true);
setPin(DigitalPin::Two, true);
diff --git a/src/emucore/Serializer.cxx b/src/emucore/Serializer.cxx
index 7f94dced2..5b5640677 100644
--- a/src/emucore/Serializer.cxx
+++ b/src/emucore/Serializer.cxx
@@ -23,7 +23,6 @@ using std::ios_base;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serializer::Serializer(const string& filename, Mode m)
- : myStream(nullptr)
{
if(m == Mode::ReadOnly)
{
@@ -66,10 +65,8 @@ Serializer::Serializer(const string& filename, Mode m)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serializer::Serializer()
- : myStream(nullptr)
+ : myStream{make_unique(ios::in | ios::out | ios::binary)}
{
- myStream = make_unique(ios::in | ios::out | ios::binary);
-
// For some reason, Windows and possibly macOS needs to store something in
// the stream before it is used for the first time
if(myStream)
diff --git a/src/emucore/Serializer.hxx b/src/emucore/Serializer.hxx
index 10164f2a1..9a967a8e0 100644
--- a/src/emucore/Serializer.hxx
+++ b/src/emucore/Serializer.hxx
@@ -49,7 +49,7 @@ class Serializer
The valid() method must immediately be called to verify the stream
was correctly initialized.
*/
- Serializer(const string& filename, Mode m = Mode::ReadWrite);
+ explicit Serializer(const string& filename, Mode m = Mode::ReadWrite);
Serializer();
public:
diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx
index b21c709fc..185b72c5c 100644
--- a/src/emucore/Settings.cxx
+++ b/src/emucore/Settings.cxx
@@ -33,9 +33,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Settings::Settings()
+ : myRespository{make_shared()}
{
- myRespository = make_shared();
-
// If no version is recorded with the persisted settings, we set it to zero
setPermanent(SETTINGS_VERSION_KEY, 0);
setPermanent("stella.version", "6.2.1");
@@ -351,11 +350,11 @@ void Settings::validate()
setValue("cursor", "2");
i = getInt("psense");
- if(i < 0|| i > Paddles::MAX_ANALOG_SENSE)
+ if(i < Paddles::MIN_ANALOG_SENSE || i > Paddles::MAX_ANALOG_SENSE)
setValue("psense", "20");
i = getInt("dsense");
- if(i < 1 || i > 20)
+ if(i < Paddles::MIN_DIGITAL_SENSE || i > Paddles::MAX_DIGITAL_SENSE)
setValue("dsense", "10");
i = getInt("msense");
diff --git a/src/emucore/Switches.cxx b/src/emucore/Switches.cxx
index 2708a2b98..1a9be545a 100644
--- a/src/emucore/Switches.cxx
+++ b/src/emucore/Switches.cxx
@@ -23,7 +23,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Switches::Switches(const Event& event, const Properties& properties,
const Settings& settings)
- : myEvent(event)
+ : myEvent{event}
{
if(properties.get(PropType::Console_RightDiff) == "B")
{
diff --git a/src/emucore/System.cxx b/src/emucore/System.cxx
index 28587d0ee..42e8ae437 100644
--- a/src/emucore/System.cxx
+++ b/src/emucore/System.cxx
@@ -29,11 +29,11 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
System::System(Random& random, M6502& m6502, M6532& m6532,
TIA& mTIA, Cartridge& mCart)
- : myRandom(random),
- myM6502(m6502),
- myM6532(m6532),
- myTIA(mTIA),
- myCart(mCart)
+ : myRandom{random},
+ myM6502{m6502},
+ myM6532{m6532},
+ myTIA{mTIA},
+ myCart{mCart}
{
// Initialize page access table
PageAccess access(&myNullDevice, System::PageAccessType::READ);
diff --git a/src/emucore/System.hxx b/src/emucore/System.hxx
index cf483c342..de1bba21c 100644
--- a/src/emucore/System.hxx
+++ b/src/emucore/System.hxx
@@ -293,7 +293,7 @@ class System : public Serializable
// Constructors
PageAccess() = default;
- PageAccess(Device* dev, PageAccessType access) : device(dev), type(access) { }
+ PageAccess(Device* dev, PageAccessType access) : device{dev}, type{access} { }
};
/**
diff --git a/src/emucore/TIASurface.cxx b/src/emucore/TIASurface.cxx
index ec9be3ab9..f824ae26e 100644
--- a/src/emucore/TIASurface.cxx
+++ b/src/emucore/TIASurface.cxx
@@ -46,8 +46,8 @@ namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TIASurface::TIASurface(OSystem& system)
- : myOSystem(system),
- myFB(system.frameBuffer())
+ : myOSystem{system},
+ myFB{system.frameBuffer()}
{
// Load NTSC filter settings
myNTSCFilter.loadConfig(myOSystem.settings());
diff --git a/src/emucore/Thumbulator.cxx b/src/emucore/Thumbulator.cxx
index bfb835fd5..7ae4ea4d0 100644
--- a/src/emucore/Thumbulator.cxx
+++ b/src/emucore/Thumbulator.cxx
@@ -57,15 +57,15 @@ Thumbulator::Thumbulator(const uInt16* rom_ptr, uInt16* ram_ptr, uInt32 rom_size
const uInt32 c_base, const uInt32 c_start, const uInt32 c_stack,
bool traponfatal, Thumbulator::ConfigureFor configurefor,
Cartridge* cartridge)
- : rom(rom_ptr),
- romSize(rom_size),
- cBase(c_base),
- cStart(c_start),
- cStack(c_stack),
- decodedRom(make_unique(romSize / 2)), // NOLINT
- ram(ram_ptr),
- configuration(configurefor),
- myCartridge(cartridge)
+ : rom{rom_ptr},
+ romSize{rom_size},
+ cBase{c_base},
+ cStart{c_start},
+ cStack{c_stack},
+ decodedRom{make_unique(romSize / 2)}, // NOLINT
+ ram{ram_ptr},
+ configuration{configurefor},
+ myCartridge{cartridge}
{
for(uInt32 i = 0; i < romSize / 2; ++i)
decodedRom[i] = decodeInstructionWord(CONV_RAMROM(rom[i]));
diff --git a/src/emucore/module.mk b/src/emucore/module.mk
index b7d88d331..93a577be9 100644
--- a/src/emucore/module.mk
+++ b/src/emucore/module.mk
@@ -76,6 +76,7 @@ MODULE_OBJS := \
src/emucore/MD5.o \
src/emucore/OSystem.o \
src/emucore/Paddles.o \
+ src/emucore/PlusROM.o \
src/emucore/PointingDevice.o \
src/emucore/ProfilingRunner.o \
src/emucore/Props.o \
diff --git a/src/emucore/stella.pro b/src/emucore/stella.pro
index 7926cafff..b3c27afae 100644
--- a/src/emucore/stella.pro
+++ b/src/emucore/stella.pro
@@ -3371,6 +3371,7 @@
"Cart.Name" "SWOOPS! (v0.96) (TJ)"
"Cart.Note" "Uses the Joystick (L) and Paddle (R) Controllers"
"Cart.Rarity" "Homebrew"
+"Controller.MouseAxis" "28"
"Cart.Highscore" "{\"score_addresses\":[\"0xfd\",\"0xfe\",\"0xff\"],\"score_digits\":6,\"variations_address\":\"0xfc\",\"variations_count\":4,\"variations_zero_based\":true}"
""
@@ -6922,6 +6923,7 @@
"Cart.Name" "SWOOPS! (v0.94) (TJ)"
"Cart.Note" "Uses the Joystick (L) and Paddle (R) Controllers"
"Cart.Rarity" "Homebrew"
+"Controller.MouseAxis" "28"
"Cart.Highscore" "{\"score_addresses\":[\"0xfd\",\"0xfe\",\"0xff\"],\"score_digits\":6,\"variations_address\":\"0xfc\",\"variations_count\":4,\"variations_zero_based\":true}"
""
@@ -8011,6 +8013,7 @@
"Cart.Name" "SWOOPS! (v0.96) (TJ) (PAL)"
"Cart.Note" "Uses the Joystick (L) and Paddle (R) Controllers"
"Cart.Rarity" "Homebrew"
+"Controller.MouseAxis" "28"
"Cart.Highscore" "{\"score_addresses\":[\"0xfd\",\"0xfe\",\"0xff\"],\"score_digits\":6,\"variations_address\":\"0xfc\",\"variations_count\":4,\"variations_zero_based\":true}"
""
diff --git a/src/emucore/tia/Ball.cxx b/src/emucore/tia/Ball.cxx
index 0d2b6be84..4e43cb61c 100644
--- a/src/emucore/tia/Ball.cxx
+++ b/src/emucore/tia/Ball.cxx
@@ -20,7 +20,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ball::Ball(uInt32 collisionMask)
- : myCollisionMaskDisabled(collisionMask)
+ : myCollisionMaskDisabled{collisionMask}
{
}
diff --git a/src/emucore/tia/Missile.cxx b/src/emucore/tia/Missile.cxx
index 59c1fb493..bde1555db 100644
--- a/src/emucore/tia/Missile.cxx
+++ b/src/emucore/tia/Missile.cxx
@@ -21,7 +21,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Missile::Missile(uInt32 collisionMask)
- : myCollisionMaskDisabled(collisionMask)
+ : myCollisionMaskDisabled{collisionMask}
{
}
@@ -43,7 +43,6 @@ void Missile::reset()
myColor = myObjectColor = myDebugColor = 0;
myDebugEnabled = false;
collision = myCollisionMaskDisabled;
- myIsEnabled = false;
myInvertedPhaseClock = false;
myUseInvertedPhaseClock = false;
}
diff --git a/src/emucore/tia/Player.cxx b/src/emucore/tia/Player.cxx
index 246c0ff7a..137ca385c 100644
--- a/src/emucore/tia/Player.cxx
+++ b/src/emucore/tia/Player.cxx
@@ -21,7 +21,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Player::Player(uInt32 collisionMask)
- : myCollisionMaskDisabled(collisionMask)
+ : myCollisionMaskDisabled{collisionMask}
{
}
diff --git a/src/emucore/tia/Playfield.cxx b/src/emucore/tia/Playfield.cxx
index 0c1456c88..e6b420a5c 100644
--- a/src/emucore/tia/Playfield.cxx
+++ b/src/emucore/tia/Playfield.cxx
@@ -20,7 +20,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Playfield::Playfield(uInt32 collisionMask)
- : myCollisionMaskDisabled(collisionMask)
+ : myCollisionMaskDisabled{collisionMask}
{
}
diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx
index 3ae0713c3..3b157f5ed 100644
--- a/src/emucore/tia/TIA.cxx
+++ b/src/emucore/tia/TIA.cxx
@@ -66,15 +66,15 @@ static constexpr uInt8 resxLateHblankThreshold = TIAConstants::H_CYCLES - 3;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TIA::TIA(ConsoleIO& console, const ConsoleTimingProvider& timingProvider,
Settings& settings)
- : myConsole(console),
- myTimingProvider(timingProvider),
- mySettings(settings),
- myPlayfield(~CollisionMask::playfield & 0x7FFF),
- myMissile0(~CollisionMask::missile0 & 0x7FFF),
- myMissile1(~CollisionMask::missile1 & 0x7FFF),
- myPlayer0(~CollisionMask::player0 & 0x7FFF),
- myPlayer1(~CollisionMask::player1 & 0x7FFF),
- myBall(~CollisionMask::ball & 0x7FFF)
+ : myConsole{console},
+ myTimingProvider{timingProvider},
+ mySettings{settings},
+ myPlayfield{~CollisionMask::playfield & 0x7FFF},
+ myMissile0{~CollisionMask::missile0 & 0x7FFF},
+ myMissile1{~CollisionMask::missile1 & 0x7FFF},
+ myPlayer0{~CollisionMask::player0 & 0x7FFF},
+ myPlayer1{~CollisionMask::player1 & 0x7FFF},
+ myBall{~CollisionMask::ball & 0x7FFF}
{
myBackground.setTIA(this);
myPlayfield.setTIA(this);
diff --git a/src/gui/ContextMenu.cxx b/src/gui/ContextMenu.cxx
index 11ccbb082..2ecf50302 100644
--- a/src/gui/ContextMenu.cxx
+++ b/src/gui/ContextMenu.cxx
@@ -35,8 +35,8 @@ ContextMenu::ContextMenu(GuiObject* boss, const GUI::Font& font,
_cmd(cmd),
_maxWidth(width)
{
- addItems(items);
setArrows();
+ addItems(items);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -48,10 +48,10 @@ void ContextMenu::addItems(const VariantList& items)
// Resize to largest string
int maxwidth = _maxWidth;
for(const auto& e: _entries)
- maxwidth = std::max(maxwidth, _font.getStringWidth(e.first));
+ maxwidth = std::max(maxwidth, _font.getStringWidth(e.first) + _textOfs * 2 + 2);
_x = _y = 0;
- _w = maxwidth + PopUpWidget::dropDownWidth(_font); // 23;
+ _w = maxwidth;
_h = 1; // recalculate this in ::recalc()
_scrollUpColor = _firstEntry > 0 ? kScrollColor : kColor;
diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx
index 50fcbd295..8b052b032 100644
--- a/src/gui/Dialog.cxx
+++ b/src/gui/Dialog.cxx
@@ -300,7 +300,7 @@ void Dialog::addFocusWidget(Widget* w)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void Dialog::addToFocusList(WidgetArray& list)
+void Dialog::addToFocusList(const WidgetArray& list)
{
// All focusable widgets should retain focus
for(const auto& w: list)
@@ -314,7 +314,7 @@ void Dialog::addToFocusList(WidgetArray& list)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-void Dialog::addToFocusList(WidgetArray& list, TabWidget* w, int tabId)
+void Dialog::addToFocusList(const WidgetArray& list, TabWidget* w, int tabId)
{
// Only add the list if the tab actually exists
if(!w || w->getID() >= _myTabList.size())
diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx
index a159a8107..0cc145d55 100644
--- a/src/gui/Dialog.hxx
+++ b/src/gui/Dialog.hxx
@@ -71,9 +71,9 @@ class Dialog : public GuiObject
void tick() override;
void addFocusWidget(Widget* w) override;
- void addToFocusList(WidgetArray& list) override;
- void addToFocusList(WidgetArray& list, TabWidget* w, int tabId);
- void addBGroupToFocusList(WidgetArray& list) { _buttonGroup = list; }
+ void addToFocusList(const WidgetArray& list) override;
+ void addToFocusList(const WidgetArray& list, TabWidget* w, int tabId);
+ void addBGroupToFocusList(const WidgetArray& list) { _buttonGroup = list; }
void addTabWidget(TabWidget* w);
void addDefaultWidget(Widget* w) { _defaultWidget = w; }
void addOKWidget(Widget* w) { _okWidget = w; }
diff --git a/src/gui/EditTextWidget.cxx b/src/gui/EditTextWidget.cxx
index dde104002..b6d65e84e 100644
--- a/src/gui/EditTextWidget.cxx
+++ b/src/gui/EditTextWidget.cxx
@@ -27,7 +27,8 @@ EditTextWidget::EditTextWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, const string& text)
: EditableWidget(boss, font, x, y, w, h + 2, text)
{
- _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS;
+ _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG
+ | Widget::FLAG_RETAIN_FOCUS | Widget::FLAG_TRACK_MOUSE;
EditableWidget::startEditMode(); // We're always in edit mode
@@ -56,24 +57,16 @@ void EditTextWidget::setText(const string& str, bool changed)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EditTextWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
{
- if(!isEditable())
- return;
-
- resetSelection();
- x += _editScrollOffset;
-
- int width = 0;
- uInt32 i;
-
- for (i = 0; i < editString().size(); ++i)
+ if(b == MouseButton::LEFT)
{
- width += _font.getCharWidth(editString()[i]);
- if (width >= x)
- break;
- }
+ if(!isEditable())
+ return;
- if (setCaretPos(i))
- setDirty();
+ resetSelection();
+ if(setCaretPos(toCaretPos(x)))
+ setDirty();
+ }
+ EditableWidget::handleMouseDown(x, y, b, clickCount);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx
index 4addb4b10..0a76bd7d1 100644
--- a/src/gui/EditableWidget.cxx
+++ b/src/gui/EditableWidget.cxx
@@ -19,6 +19,7 @@
#include "StellaKeys.hxx"
#include "FBSurface.hxx"
#include "Font.hxx"
+#include "ContextMenu.hxx"
#include "OSystem.hxx"
#include "EventHandler.hxx"
#include "UndoHandler.hxx"
@@ -30,8 +31,9 @@ EditableWidget::EditableWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, const string& str)
: Widget(boss, font, x, y, w, h),
CommandSender(boss),
- _editString(str),
- _filter([](char c) { return isprint(c) && c != '\"'; })
+ _editString{str},
+ myUndoHandler{make_unique()},
+ _filter{[](char c) { return isprint(c) && c != '\"'; }}
{
_bgcolor = kWidColor;
_bgcolorhi = kWidColor;
@@ -39,7 +41,8 @@ EditableWidget::EditableWidget(GuiObject* boss, const GUI::Font& font,
_textcolor = kTextColor;
_textcolorhi = kTextColor;
- myUndoHandler = make_unique();
+ // add mouse context menu
+ myMouseMenu = make_unique(this, font, EmptyVarList);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -121,6 +124,115 @@ void EditableWidget::lostFocusWidget()
_selectSize = 0;
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+int EditableWidget::toCaretPos(int x) const
+{
+ int i;
+
+ x += caretOfs();
+ for(i = 0; i < static_cast(_editString.size()); ++i)
+ {
+ x -= _font.getCharWidth(_editString[i]);
+ if(x <= 0)
+ break;
+ }
+ return i;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void EditableWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
+{
+ // Grab right mouse button for context menu, send left to base class
+ if(b == MouseButton::RIGHT && isEnabled() && !myMouseMenu->isVisible())
+ {
+ VariantList items;
+ #ifndef BSPF_MACOS
+ if(isEditable())
+ VarList::push_back(items, " Cut Ctrl+X ", "cut");
+ VarList::push_back(items, " Copy Ctrl+C ", "copy");
+ if(isEditable())
+ VarList::push_back(items, " Paste Ctrl+V ", "paste");
+ #else
+ if(isEditable())
+ VarList::push_back(items, " Cut Cmd+X ", "cut");
+ VarList::push_back(items, " Copy Cmd+C ", "copy");
+ if(isEditable())
+ VarList::push_back(items, " Paste Cmd+V ", "paste");
+ #endif
+ myMouseMenu->addItems(items);
+
+ // Add menu at current x,y mouse location
+ myMouseMenu->show(x + getAbsX(), y + getAbsY(), dialog().surface().dstRect());
+ return;
+ }
+ else if(b == MouseButton::LEFT && isEnabled())
+ {
+ _isDragging = true;
+
+ if(clickCount == 2)
+ {
+ // If left mouse button is double clicked, mark word under cursor
+ markWord();
+ return;
+ }
+ }
+ Widget::handleMouseDown(x, y, b, clickCount);
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void EditableWidget::handleMouseUp(int x, int y, MouseButton b, int clickCount)
+{
+ _isDragging = false;
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void EditableWidget::handleMouseMoved(int x, int y)
+{
+ if(isEditable() && _isDragging)
+ {
+ int deltaPos = toCaretPos(x) - _caretPos;
+
+ if(deltaPos)
+ {
+ moveCaretPos(deltaPos);
+ setDirty();
+ }
+ }
+}
+
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+void EditableWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
+{
+ if(cmd == ContextMenu::kItemSelectedCmd)
+ {
+ const string& rmb = myMouseMenu->getSelectedTag().toString();
+
+ if(rmb == "cut")
+ {
+ if(cutSelectedText())
+ sendCommand(EditableWidget::kChangedCmd, 0, _id);
+ }
+ else if(rmb == "copy")
+ {
+ if(!isEditable())
+ {
+ // Copy everything if widget is not editable
+ _caretPos = 0;
+ _selectSize = int(_editString.length());
+ }
+ copySelectedText();
+ }
+ else if(rmb == "paste")
+ {
+ if(pasteSelectedText())
+ sendCommand(EditableWidget::kChangedCmd, 0, _id);
+ }
+ setDirty();
+ }
+ else
+ Widget::handleCommand(sender, cmd, data, id);
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool EditableWidget::tryInsertChar(char c, int pos)
{
@@ -359,13 +471,10 @@ void EditableWidget::drawCaretSelection()
{
FBSurface& s = _boss->dialog().surface();
const Common::Rect& editRect = getEditRect();
- int x = editRect.x();
- int y = editRect.y();
-
string text = selectString();
- x = editRect.x();
- y = editRect.y();
+ int x = editRect.x();
+ int y = editRect.y();
int w = editRect.w();
int h = editRect.h();
int wt = int(text.length()) * _font.getMaxCharWidth() + 1;
@@ -638,6 +747,28 @@ bool EditableWidget::moveWord(int direction, bool select)
return handled;
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+bool EditableWidget::markWord()
+{
+ _selectSize = 0;
+
+ while(_caretPos + _selectSize < int(_editString.size()))
+ {
+ if(_editString[_caretPos + _selectSize] == ' ')
+ break;
+ _selectSize++;
+ }
+
+ while(_caretPos > 0)
+ {
+ if(_editString[_caretPos - 1] == ' ')
+ break;
+ _caretPos--;
+ _selectSize++;
+ }
+ return _selectSize > 0;
+}
+
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string EditableWidget::selectString() const
{
diff --git a/src/gui/EditableWidget.hxx b/src/gui/EditableWidget.hxx
index 553d35522..0254b0ded 100644
--- a/src/gui/EditableWidget.hxx
+++ b/src/gui/EditableWidget.hxx
@@ -22,6 +22,7 @@
#include "Widget.hxx"
#include "Rect.hxx"
+#include "ContextMenu.hxx"
#include "UndoHandler.hxx"
/**
@@ -66,6 +67,13 @@ class EditableWidget : public Widget, public CommandSender
void setTextFilter(const TextFilter& filter) { _filter = filter; }
protected:
+ void handleMouseDown(int x, int y, MouseButton b, int clickCount) override;
+ void handleMouseUp(int x, int y, MouseButton b, int clickCount) override;
+ void handleMouseMoved(int x, int y) override;
+ void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
+ virtual int caretOfs() const { return _editScrollOffset; }
+ int toCaretPos(int x) const;
+
void receivedFocusWidget() override;
void lostFocusWidget() override;
void tick() override;
@@ -95,6 +103,7 @@ class EditableWidget : public Widget, public CommandSender
bool killLine(int direction);
bool killWord(int direction);
bool moveWord(int direction, bool select);
+ bool markWord();
bool killSelectedText(bool addEdit = true);
int selectStartPos();
@@ -109,9 +118,12 @@ class EditableWidget : public Widget, public CommandSender
bool tryInsertChar(char c, int pos);
private:
+ unique_ptr myMouseMenu;
+ bool _isDragging{false};
+
bool _editable{true};
string _editString;
- int _maxLen{0};
+ int _maxLen{0};
unique_ptr myUndoHandler;
int _caretPos{0};
diff --git a/src/gui/EventMappingWidget.cxx b/src/gui/EventMappingWidget.cxx
index 7b3ae540b..0336e4c51 100644
--- a/src/gui/EventMappingWidget.cxx
+++ b/src/gui/EventMappingWidget.cxx
@@ -68,6 +68,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
VarList::push_back(items, "Joystick", Event::Group::Joystick);
VarList::push_back(items, "Paddles", Event::Group::Paddles);
VarList::push_back(items, "Keyboard", Event::Group::Keyboard);
+ VarList::push_back(items, "Input Devices & Ports", Event::Group::Devices);
VarList::push_back(items, "Combo", Event::Group::Combo);
VarList::push_back(items, "Debug", Event::Group::Debug);
diff --git a/src/gui/Font.cxx b/src/gui/Font.cxx
index 7c2b374e8..e327fa8af 100644
--- a/src/gui/Font.cxx
+++ b/src/gui/Font.cxx
@@ -18,6 +18,8 @@
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================
+#include
+
#include "Font.hxx"
namespace GUI {
@@ -53,13 +55,8 @@ int Font::getStringWidth(const string& str) const
if(!myFontDesc.width)
return myFontDesc.maxwidth * int(str.size());
else
- {
- int space = 0;
- for(auto c: str)
- space += getCharWidth(c);
-
- return space;
- }
+ return std::accumulate(str.cbegin(), str.cend(), 0,
+ [&](int x, char c) { return x + getCharWidth(c); });
}
} // namespace GUI
diff --git a/src/gui/GameInfoDialog.cxx b/src/gui/GameInfoDialog.cxx
index ffbd5544d..992c9a09b 100644
--- a/src/gui/GameInfoDialog.cxx
+++ b/src/gui/GameInfoDialog.cxx
@@ -394,6 +394,7 @@ void GameInfoDialog::addControllersTab()
"Mouse axes range ", 0, 0, fontWidth * 4, "%");
myMouseRange->setMinValue(1); myMouseRange->setMaxValue(100);
myMouseRange->setTickmarkIntervals(4);
+ myMouseRange->setToolTip("Adjust paddle range emulated by the mouse.");
wid.push_back(myMouseRange);
// Add items for tab 2
@@ -989,6 +990,7 @@ void GameInfoDialog::saveConfig()
Paddles::setAnalogXCenter(myPaddleXCenter->getValue());
Paddles::setAnalogYCenter(myPaddleYCenter->getValue());
+ Paddles::setDigitalPaddleRange(myMouseRange->getValue());
}
}
@@ -1194,9 +1196,10 @@ void GameInfoDialog::updateControllerStates()
BSPF::startsWithIgnoreCase(contrRight, "MindLink");
myMouseControl->setEnabled(enableMouse);
- myMouseX->setEnabled(enableMouse);
- myMouseY->setEnabled(enableMouse);
- myMouseRange->setEnabled(enableMouse);
+ myMouseX->setEnabled(enableMouse && myMouseControl->getState());
+ myMouseY->setEnabled(enableMouse && myMouseControl->getState());
+
+ myMouseRange->setEnabled(enablePaddles);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/GuiObject.hxx b/src/gui/GuiObject.hxx
index 85424a670..dd95d62cc 100644
--- a/src/gui/GuiObject.hxx
+++ b/src/gui/GuiObject.hxx
@@ -130,7 +130,7 @@ class GuiObject : public CommandReceiver
/** Add given widget(s) to the focus list */
virtual void addFocusWidget(Widget* w) = 0;
- virtual void addToFocusList(WidgetArray& list) = 0;
+ virtual void addToFocusList(const WidgetArray& list) = 0;
/** Return focus list for this object */
WidgetArray& getFocusList() { return _focusList; }
diff --git a/src/gui/HelpDialog.cxx b/src/gui/HelpDialog.cxx
index cf0854a73..d6d3e74ed 100644
--- a/src/gui/HelpDialog.cxx
+++ b/src/gui/HelpDialog.cxx
@@ -125,7 +125,7 @@ void HelpDialog::updateStrings(uInt8 page, uInt8 lines, string& title)
ADD_EVENT(Event::TogglePhosphor, "Toggle 'phosphor' effect");
ADD_LINE();
ADD_EVENT(Event::ToggleGrabMouse, "Grab mouse (keep in window)");
- ADD_EVENT(Event::HandleMouseControl, "Toggle controller for mouse");
+ ADD_EVENT(Event::NextMouseControl, "Toggle controller for mouse");
ADD_EVENT(Event::ToggleSAPortOrder, "Toggle Stelladaptor left/right");
ADD_LINE();
ADD_EVENT(Event::VolumeIncrease, "Increase volume by 2%");
diff --git a/src/gui/HighScoresDialog.cxx b/src/gui/HighScoresDialog.cxx
index f689ecd4e..af39c125a 100644
--- a/src/gui/HighScoresDialog.cxx
+++ b/src/gui/HighScoresDialog.cxx
@@ -100,12 +100,9 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent,
int max_w, int max_h,
Menu::AppMode mode)
: Dialog(osystem, parent, osystem.frameBuffer().font(), "High Scores"),
- myDirty(false),
- myHighScoreSaved(false),
- _max_w(max_w),
- _max_h(max_h),
- myInitials(""),
- myMode(mode)
+ _max_w{max_w},
+ _max_h{max_h},
+ myMode{mode}
{
myScores.variation = HSM::DEFAULT_VARIATION;
diff --git a/src/gui/HighScoresDialog.hxx b/src/gui/HighScoresDialog.hxx
index e81b3e255..90ca8fc82 100644
--- a/src/gui/HighScoresDialog.hxx
+++ b/src/gui/HighScoresDialog.hxx
@@ -76,16 +76,17 @@ class HighScoresDialog : public Dialog
};
private:
- bool myUserDefVar; // allow the user to define the variation
- bool myDirty;
- bool myHighScoreSaved; // remember if current high score was already saved (avoids double HS)
+ bool myUserDefVar{false}; // allow the user to define the variation
+ bool myDirty{false};
+ bool myHighScoreSaved{false}; // remember if current high score was already saved
+ // (avoids double HS)
unique_ptr myConfirmMsg;
- int _max_w;
- int _max_h;
+ int _max_w{0};
+ int _max_h{0};
string myInitials;
- Int32 myEditRank;
- Int32 myHighScoreRank;
+ Int32 myEditRank{-1};
+ Int32 myHighScoreRank{-1};
string myNow;
HSM::ScoresData myScores;
@@ -120,4 +121,5 @@ class HighScoresDialog : public Dialog
HighScoresDialog& operator=(const HighScoresDialog&) = delete;
HighScoresDialog& operator=(HighScoresDialog&&) = delete;
};
+
#endif
diff --git a/src/gui/InputDialog.cxx b/src/gui/InputDialog.cxx
index 82dae982a..e9bb315c3 100644
--- a/src/gui/InputDialog.cxx
+++ b/src/gui/InputDialog.cxx
@@ -126,7 +126,8 @@ void InputDialog::addDevicePortTab()
// Add joystick deadzone setting
myDeadzone = new SliderWidget(myTab, _font, HBORDER, ypos - 1, 13 * fontWidth, lineHeight,
"Joystick deadzone size", lwidth, kDeadzoneChanged, 5 * fontWidth);
- myDeadzone->setMinValue(0); myDeadzone->setMaxValue(29);
+ myDeadzone->setMinValue(Joystick::DEAD_ZONE_MIN);
+ myDeadzone->setMaxValue(Joystick::DEAD_ZONE_MAX);
myDeadzone->setTickmarkIntervals(4);
wid.push_back(myDeadzone);
@@ -152,6 +153,8 @@ void InputDialog::addDevicePortTab()
myDejitterBase->setMinValue(Paddles::MIN_DEJITTER);
myDejitterBase->setMaxValue(Paddles::MAX_DEJITTER);
myDejitterBase->setTickmarkIntervals(5);
+ myDejitterBase->setToolTip("Adjust paddle input averaging.\n"
+ "Note: Already implemented in 2600-daptor");
//xpos += myDejitterBase->getWidth() + fontWidth - 4;
wid.push_back(myDejitterBase);
@@ -162,6 +165,7 @@ void InputDialog::addDevicePortTab()
myDejitterDiff->setMinValue(Paddles::MIN_DEJITTER);
myDejitterDiff->setMaxValue(Paddles::MAX_DEJITTER);
myDejitterDiff->setTickmarkIntervals(5);
+ myDejitterDiff->setToolTip("Adjust paddle reaction to fast movements.");
wid.push_back(myDejitterDiff);
// Add paddle speed (digital emulation)
@@ -291,6 +295,7 @@ void InputDialog::addMouseTab()
lwidth, kDCSpeedChanged, 4 * fontWidth, "%");
myDrivingSpeed->setMinValue(1); myDrivingSpeed->setMaxValue(20);
myDrivingSpeed->setTickmarkIntervals(4);
+ myDrivingSpeed->setToolTip("Adjust driving controller sensitivity for digital and mouse input.");
wid.push_back(myDrivingSpeed);
// Mouse cursor state
@@ -403,14 +408,7 @@ void InputDialog::saveConfig()
{
Settings& settings = instance().settings();
- // Left & right ports
- instance().eventHandler().mapStelladaptors(mySAPort->getState() ? "rl": "lr");
-
- // Use mouse as a controller
- const string& usemouse = myMouseControl->getSelectedTag().toString();
- settings.setValue("usemouse", usemouse);
- instance().eventHandler().setMouseControllerMode(usemouse);
-
+ // *** Device & Ports ***
// Joystick deadzone
int deadzone = myDeadzone->getValue();
settings.setValue("joydeadzone", deadzone);
@@ -433,6 +431,31 @@ void InputDialog::saveConfig()
settings.setValue("dsense", sensitivity);
Paddles::setDigitalSensitivity(sensitivity);
+ // Autofire rate
+ int rate = myAutoFireRate->getValue();
+ settings.setValue("autofirerate", rate);
+ Controller::setAutoFireRate(rate);
+
+ // Allow all 4 joystick directions
+ bool allowall4 = myAllowAll4->getState();
+ settings.setValue("joyallow4", allowall4);
+ instance().eventHandler().allowAllDirections(allowall4);
+
+ // Enable/disable modifier key-combos
+ settings.setValue("modcombo", myModCombo->getState());
+
+ // Left & right ports
+ instance().eventHandler().mapStelladaptors(mySAPort->getState() ? "rl" : "lr");
+
+ // AtariVox serial port
+ settings.setValue("avoxport", myAVoxPort->getText());
+
+ // *** Mouse ***
+ // Use mouse as a controller
+ const string& usemouse = myMouseControl->getSelectedTag().toString();
+ settings.setValue("usemouse", usemouse);
+ instance().eventHandler().setMouseControllerMode(usemouse);
+
sensitivity = myMPaddleSpeed->getValue();
settings.setValue("msense", sensitivity);
Paddles::setMouseSensitivity(sensitivity);
@@ -447,22 +470,10 @@ void InputDialog::saveConfig()
settings.setValue("dcsense", sensitivity);
Driving::setSensitivity(sensitivity);
- // Autofire rate
- int rate = myAutoFireRate->getValue();
- settings.setValue("autofirerate", rate);
- Controller::setAutoFireRate(rate);
-
- // AtariVox serial port
- settings.setValue("avoxport", myAVoxPort->getText());
-
- // Allow all 4 joystick directions
- bool allowall4 = myAllowAll4->getState();
- settings.setValue("joyallow4", allowall4);
- instance().eventHandler().allowAllDirections(allowall4);
-
// Grab mouse and hide cursor
const string& cursor = myCursorState->getSelectedTag().toString();
settings.setValue("cursor", cursor);
+
// only allow grab mouse if cursor is hidden in emulation
int state = myCursorState->getSelected();
bool enableGrab = state != 1 && state != 3;
@@ -470,9 +481,6 @@ void InputDialog::saveConfig()
settings.setValue("grabmouse", grab);
instance().frameBuffer().enableGrabMouse(grab);
- // Enable/disable modifier key-combos
- settings.setValue("modcombo", myModCombo->getState());
-
instance().eventHandler().saveKeyMapping();
instance().eventHandler().saveJoyMapping();
// instance().saveConfig();
@@ -668,7 +676,7 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd,
break;
case kDeadzoneChanged:
- myDeadzone->setValueLabel(3200 + 1000 * myDeadzone->getValue());
+ myDeadzone->setValueLabel(Joystick::deadZoneValue(myDeadzone->getValue()));
break;
case kPSpeedChanged:
@@ -781,10 +789,8 @@ void InputDialog::handleMouseControlState()
{
bool enable = myMouseControl->getSelected() != 2;
- myMouseSensitivity->setEnabled(enable);
myMPaddleSpeed->setEnabled(enable);
myTrackBallSpeed->setEnabled(enable);
- myDrivingSpeed->setEnabled(enable);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/Launcher.cxx b/src/gui/Launcher.cxx
index 694395cfa..91868282c 100644
--- a/src/gui/Launcher.cxx
+++ b/src/gui/Launcher.cxx
@@ -27,9 +27,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Launcher::Launcher(OSystem& osystem)
- : DialogContainer(osystem)
+ : DialogContainer(osystem),
+ mySize(myOSystem.settings().getSize("launcherres"))
{
- mySize = myOSystem.settings().getSize("launcherres");
const Common::Size& d = myOSystem.frameBuffer().desktopSize();
double overscan = 1 - myOSystem.settings().getInt("tia.fs_overscan") / 100.0;
diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx
index 0643bd599..cec05172d 100644
--- a/src/gui/LauncherDialog.cxx
+++ b/src/gui/LauncherDialog.cxx
@@ -139,7 +139,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
lblSelect = "";
int lwSelectShort = font.getStringWidth(lblSelect);
- wTotal -= lwSelect - lwSelectShort;
+ // wTotal -= lwSelect - lwSelectShort; // dead code
lwSelect = lwSelectShort;
noSelect = true;
}
@@ -435,6 +435,7 @@ void LauncherDialog::updateUI()
loadRomInfo();
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
size_t LauncherDialog::matchWithJoker(const string& str, const string& pattern)
{
if(str.length() >= pattern.length())
@@ -460,6 +461,7 @@ size_t LauncherDialog::matchWithJoker(const string& str, const string& pattern)
return string::npos;
}
+// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool LauncherDialog::matchWithWildcards(const string& str, const string& pattern)
{
string pat = pattern;
@@ -634,9 +636,28 @@ void LauncherDialog::showOnlyROMs(bool state)
void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
{
// Grab the key before passing it to the actual dialog and check for
- // Control-R (reload ROM listing)
- if(StellaModTest::isControl(mod) && key == KBDK_R)
- reload();
+ // context menu keys
+ if(StellaModTest::isControl(mod))
+ {
+ switch(key)
+ {
+ case KBDK_P:
+ myGlobalProps->open();
+ break;
+
+ case KBDK_H:
+ if(instance().highScores().enabled())
+ openHighScores();
+ break;
+
+ case KBDK_R:
+ reload();
+ break;
+
+ default:
+ break;
+ }
+ }
else
#if defined(RETRON77)
// handle keys used by R77
@@ -725,21 +746,22 @@ Event::Type LauncherDialog::getJoyAxisEvent(int stick, JoyAxis axis, JoyDir adir
void LauncherDialog::handleMouseDown(int x, int y, MouseButton b, int clickCount)
{
// Grab right mouse button for context menu, send left to base class
- if(b == MouseButton::RIGHT)
+ if(b == MouseButton::RIGHT
+ && x + getAbsX() >= myList->getLeft() && x + getAbsX() <= myList->getRight()
+ && y + getAbsY() >= myList->getTop() && y + getAbsY() <= myList->getBottom())
{
// Dynamically create context menu for ROM list options
VariantList items;
if(!currentNode().isDirectory() && Bankswitch::isValidRomName(currentNode()))
- VarList::push_back(items, "Power-on options" + ELLIPSIS, "override");
+ VarList::push_back(items, " Power-on options" + ELLIPSIS + " Ctrl+P", "override");
if(instance().highScores().enabled())
- VarList::push_back(items, "High scores" + ELLIPSIS, "highscores");
- VarList::push_back(items, "Reload listing", "reload");
+ VarList::push_back(items, " High scores" + ELLIPSIS + " Ctrl+H", "highscores");
+ VarList::push_back(items, " Reload listing Ctrl+R ", "reload");
myMenu->addItems(items);
// Add menu at current x,y mouse location
myMenu->show(x + getAbsX(), y + getAbsY(), surface().dstRect());
-
}
else
Dialog::handleMouseDown(x, y, b, clickCount);
diff --git a/src/gui/PopUpWidget.cxx b/src/gui/PopUpWidget.cxx
index b4dd27b84..ab9560ed8 100644
--- a/src/gui/PopUpWidget.cxx
+++ b/src/gui/PopUpWidget.cxx
@@ -32,7 +32,8 @@ PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font,
_label(label),
_labelWidth(labelWidth)
{
- _flags = Widget::FLAG_ENABLED | Widget::FLAG_RETAIN_FOCUS;
+ _flags = Widget::FLAG_ENABLED | Widget::FLAG_RETAIN_FOCUS
+ | Widget::FLAG_TRACK_MOUSE;
_bgcolor = kDlgColor;
_bgcolorhi = kDlgColor; // do not highlight the background
_textcolor = kTextColor;
@@ -51,7 +52,7 @@ PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font,
myTextY = (_h - _font.getFontHeight()) / 2;
myArrowsY = (_h - _arrowHeight) / 2;
- myMenu = make_unique(this, font, list, cmd, w);
+ myMenu = make_unique(this, font, list, cmd, w + dropDownWidth(font));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -127,33 +128,25 @@ const Variant& PopUpWidget::getSelectedTag() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PopUpWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
{
- resetSelection();
- if(!isEditable() || x > _w - dropDownWidth(_font))
+ if(b == MouseButton::LEFT)
{
- if(isEnabled() && !myMenu->isVisible())
+ resetSelection();
+ if(!isEditable() || x > _w - dropDownWidth(_font))
{
- // Add menu just underneath parent widget
- myMenu->show(getAbsX() + _labelWidth, getAbsY() + getHeight(),
- dialog().surface().dstRect(), myMenu->getSelected());
+ if(isEnabled() && !myMenu->isVisible())
+ {
+ // Add menu just underneath parent widget
+ myMenu->show(getAbsX() + _labelWidth, getAbsY() + getHeight(),
+ dialog().surface().dstRect(), myMenu->getSelected());
+ }
+ }
+ else
+ {
+ if(setCaretPos(toCaretPos(x)))
+ setDirty();
}
}
- else
- {
- x += _editScrollOffset - _labelWidth;
-
- int width = 0;
- uInt32 i;
-
- for(i = 0; i < editString().size(); ++i)
- {
- width += _font.getCharWidth(editString()[i]);
- if(width >= x)
- break;
- }
-
- if(setCaretPos(i))
- setDirty();
- }
+ EditableWidget::handleMouseDown(x, y, b, clickCount);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/PopUpWidget.hxx b/src/gui/PopUpWidget.hxx
index babe28686..0128cf1d9 100644
--- a/src/gui/PopUpWidget.hxx
+++ b/src/gui/PopUpWidget.hxx
@@ -72,6 +72,7 @@ class PopUpWidget : public EditableWidget
void handleMouseWheel(int x, int y, int direction) override;
bool handleEvent(Event::Type e) override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
+ int caretOfs() const override { return _editScrollOffset - _labelWidth; }
void setArrow();
void drawWidget(bool hilite) override;
diff --git a/src/gui/R77HelpDialog.cxx b/src/gui/R77HelpDialog.cxx
index b72efb0b2..17428943c 100644
--- a/src/gui/R77HelpDialog.cxx
+++ b/src/gui/R77HelpDialog.cxx
@@ -65,8 +65,7 @@ R77HelpDialog::R77HelpDialog(OSystem& osystem, DialogContainer& parent,
myTitle = new StaticTextWidget(this, font, xpos, ypos, _w - HBORDER * 2, fontHeight,
"", TextAlign::Center);
- int jwidth = 11 * fontWidth;
- int bwidth = 11 * fontWidth;
+ const int jwidth = 11 * fontWidth, bwidth = jwidth;
xpos = HBORDER; ypos += lineHeight + 4;
for (uInt8 i = 0; i < LINES_PER_PAGE; ++i)
{
diff --git a/src/gui/RadioButtonWidget.cxx b/src/gui/RadioButtonWidget.cxx
index e2b5e34df..658859b97 100644
--- a/src/gui/RadioButtonWidget.cxx
+++ b/src/gui/RadioButtonWidget.cxx
@@ -221,13 +221,13 @@ RadioButtonWidget::RadioButtonWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, const string& label,
RadioButtonGroup* group, int cmd)
: CheckboxWidget(boss, font, x, y, label, cmd),
- myGroup(group)
+ myGroup(group),
+ _buttonSize(buttonSize(font)) // 14 | 22
{
_flags = Widget::FLAG_ENABLED;
_bgcolor = _bgcolorhi = kWidColor;
_editable = true;
- _buttonSize = buttonSize(font); // 14 | 22
if(_buttonSize == 14)
{
diff --git a/src/gui/TabWidget.hxx b/src/gui/TabWidget.hxx
index 9d6f0837d..d2ca4305c 100644
--- a/src/gui/TabWidget.hxx
+++ b/src/gui/TabWidget.hxx
@@ -81,7 +81,7 @@ class TabWidget : public Widget, public CommandSender
bool enabled{true};
int tabWidth{0};
- Tab(const string& t, int tw = NO_WIDTH,
+ explicit Tab(const string& t, int tw = NO_WIDTH,
Widget* first = nullptr, Widget* parent = nullptr, bool e = true)
: title(t), firstWidget(first), parentWidget(parent), enabled(e), tabWidth(tw) { }
};
diff --git a/src/gui/UIDialog.cxx b/src/gui/UIDialog.cxx
index 2d773b888..11a9e0308 100644
--- a/src/gui/UIDialog.cxx
+++ b/src/gui/UIDialog.cxx
@@ -219,6 +219,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
xpos = _w - HBORDER - font.getStringWidth("Follow Launcher path") - CheckboxWidget::prefixSize(font) - 1;
ypos += lineHeight + VGAP * 2;
myFollowLauncherWidget = new CheckboxWidget(myTab, font, xpos, ypos, "Follow Launcher path");
+ myFollowLauncherWidget->setToolTip("The ROM path is updated during Launcher navigation.");
wid.push_back(myFollowLauncherWidget);
xpos = HBORDER;
@@ -272,6 +273,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
bwidth = font.getStringWidth("Image path" + ELLIPSIS) + fontWidth * 2 + 1;
myOpenBrowserButton = new ButtonWidget(myTab, font, xpos, ypos, bwidth, buttonHeight,
"Image path" + ELLIPSIS, kChooseSnapLoadDirCmd);
+ myOpenBrowserButton->setToolTip("Select path for snapshot images used in Launcher.");
wid.push_back(myOpenBrowserButton);
mySnapLoadPath = new EditTextWidget(myTab, font, HBORDER + lwidth,
diff --git a/src/gui/VideoAudioDialog.hxx b/src/gui/VideoAudioDialog.hxx
index 550617d2d..f0d376140 100644
--- a/src/gui/VideoAudioDialog.hxx
+++ b/src/gui/VideoAudioDialog.hxx
@@ -59,7 +59,7 @@ class VideoAudioDialog : public Dialog
void handleOverscanChange();
void handlePhosphorChange();
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
- void addPalette(int x, int y, int h, int w);
+ void addPalette(int x, int y, int w, int h);
void colorPalette();
void updatePreset();
void updateEnabledState();
diff --git a/src/gui/WhatsNewDialog.cxx b/src/gui/WhatsNewDialog.cxx
index aac4171f2..45c110bca 100644
--- a/src/gui/WhatsNewDialog.cxx
+++ b/src/gui/WhatsNewDialog.cxx
@@ -48,8 +48,8 @@ WhatsNewDialog::WhatsNewDialog(OSystem& osystem, DialogContainer& parent, const
add(ypos, "fixed autofire bug for trackball controllers");
#else
add(ypos, "added high scores saving");
- add(ypos, "enhanced cut/copy/paste for text editing");
- add(ypos, "added undo and redo to text editing");
+ add(ypos, "enhanced cut/copy/paste and undo/redo for text editing");
+ add(ypos, "added mouse support for text editing");
add(ypos, "added wildcard support to launcher dialog filter");
add(ypos, "added option to search subdirectories in launcher");
add(ypos, "added tooltips to many UI items");
diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx
index 38c46bdbe..7f605a6ea 100644
--- a/src/gui/Widget.cxx
+++ b/src/gui/Widget.cxx
@@ -138,11 +138,9 @@ void Widget::draw()
// Now perform the actual widget draw
drawWidget((_flags & Widget::FLAG_HILITED) ? true : false);
- // Restore x/y
+ // Restore w/hy
if(hasBorder())
{
- _x -= 4;
- _y -= 4;
_w += 8;
_h += 8;
}
@@ -284,13 +282,10 @@ bool Widget::isWidgetInChain(Widget* w, Widget* find)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-bool Widget::isWidgetInChain(WidgetArray& list, Widget* find)
+bool Widget::isWidgetInChain(const WidgetArray& list, Widget* find)
{
- for(const auto& w: list)
- if(w == find)
- return true;
-
- return false;
+ return std::any_of(list.cbegin(), list.cend(),
+ [&](Widget* w) { return w == find; });
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx
index cf4637ea1..f31c2fce0 100644
--- a/src/gui/Widget.hxx
+++ b/src/gui/Widget.hxx
@@ -83,7 +83,7 @@ class Widget : public GuiObject
void receivedFocus();
void lostFocus();
void addFocusWidget(Widget* w) override { _focusList.push_back(w); }
- void addToFocusList(WidgetArray& list) override {
+ void addToFocusList(const WidgetArray& list) override {
Vec::append(_focusList, list);
}
@@ -157,7 +157,7 @@ class Widget : public GuiObject
static bool isWidgetInChain(Widget* start, Widget* find);
/** Determine if 'find' is in the widget array */
- static bool isWidgetInChain(WidgetArray& list, Widget* find);
+ static bool isWidgetInChain(const WidgetArray& list, Widget* find);
/** Select either previous, current, or next widget in chain to have
focus, and deselects all others */
diff --git a/src/libretro/EventHandlerLIBRETRO.cxx b/src/libretro/EventHandlerLIBRETRO.cxx
index 046839032..d74ee3679 100644
--- a/src/libretro/EventHandlerLIBRETRO.cxx
+++ b/src/libretro/EventHandlerLIBRETRO.cxx
@@ -15,7 +15,6 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
-#include "OSystem.hxx"
#include "EventHandlerLIBRETRO.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/libretro/FBSurfaceLIBRETRO.cxx b/src/libretro/FBSurfaceLIBRETRO.cxx
index 1f3d7e549..9041cc127 100644
--- a/src/libretro/FBSurfaceLIBRETRO.cxx
+++ b/src/libretro/FBSurfaceLIBRETRO.cxx
@@ -19,15 +19,13 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FBSurfaceLIBRETRO::FBSurfaceLIBRETRO(uInt32 width, uInt32 height)
+ : myWidth{width},
+ myHeight{height},
+ myPixelData{make_unique(myWidth * myHeight)}
{
- myWidth = width;
- myHeight = height;
-
- myPixelData = make_unique(width * height);
-
////////////////////////////////////////////////////
// These *must* be set for the parent class
myPixels = myPixelData.get();
- myPitch = width;
+ myPitch = myWidth;
////////////////////////////////////////////////////
}
diff --git a/src/libretro/FBSurfaceLIBRETRO.hxx b/src/libretro/FBSurfaceLIBRETRO.hxx
index f6bf3320b..7578ca658 100644
--- a/src/libretro/FBSurfaceLIBRETRO.hxx
+++ b/src/libretro/FBSurfaceLIBRETRO.hxx
@@ -64,8 +64,8 @@ class FBSurfaceLIBRETRO : public FBSurface
void applyAttributes() override { }
private:
- unique_ptr myPixelData;
uInt32 myWidth, myHeight;
+ unique_ptr myPixelData;
Common::Rect mySrcGUIR, myDstGUIR;
private:
diff --git a/src/libretro/FSNodeLIBRETRO.cxx b/src/libretro/FSNodeLIBRETRO.cxx
index f3670f0a2..43fee3d9b 100644
--- a/src/libretro/FSNodeLIBRETRO.cxx
+++ b/src/libretro/FSNodeLIBRETRO.cxx
@@ -27,15 +27,15 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeLIBRETRO::FilesystemNodeLIBRETRO()
- : _name("rom"),
- _path("." + slash)
+ : _name{"rom"},
+ _path{"." + slash}
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeLIBRETRO::FilesystemNodeLIBRETRO(const string& p)
- : _name(p),
- _path(p)
+ : _name{p},
+ _path{p}
{
// TODO: use retro_vfs_mkdir_t (file) or RETRO_MEMORY_SAVE_RAM (stream) or libretro save path
if(p == "." + slash + "nvram")
diff --git a/src/libretro/Makefile.common b/src/libretro/Makefile.common
index ab99739fa..ecd0c73e4 100644
--- a/src/libretro/Makefile.common
+++ b/src/libretro/Makefile.common
@@ -115,6 +115,7 @@ SOURCES_CXX := \
$(CORE_DIR)/emucore/MT24LC256.cxx \
$(CORE_DIR)/emucore/OSystem.cxx \
$(CORE_DIR)/emucore/Paddles.cxx \
+ $(CORE_DIR)/emucore/PlusROM.cxx \
$(CORE_DIR)/emucore/PointingDevice.cxx \
$(CORE_DIR)/emucore/Props.cxx \
$(CORE_DIR)/emucore/PropsSet.cxx \
diff --git a/src/libretro/SoundLIBRETRO.cxx b/src/libretro/SoundLIBRETRO.cxx
index 2c15ce04d..6cee38c1f 100644
--- a/src/libretro/SoundLIBRETRO.cxx
+++ b/src/libretro/SoundLIBRETRO.cxx
@@ -35,7 +35,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SoundLIBRETRO::SoundLIBRETRO(OSystem& osystem, AudioSettings& audioSettings)
: Sound(osystem),
- myAudioSettings(audioSettings)
+ myAudioSettings{audioSettings}
{
Logger::debug("SoundLIBRETRO::SoundLIBRETRO started ...");
Logger::debug("SoundLIBRETRO::SoundLIBRETRO initialized");
diff --git a/src/libretro/StellaLIBRETRO.cxx b/src/libretro/StellaLIBRETRO.cxx
index b80d517d9..8b3541332 100644
--- a/src/libretro/StellaLIBRETRO.cxx
+++ b/src/libretro/StellaLIBRETRO.cxx
@@ -31,9 +31,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StellaLIBRETRO::StellaLIBRETRO()
+ : rom_image{make_unique(getROMMax())},
+ audio_buffer{make_unique(audio_buffer_max)}
{
- audio_buffer = make_unique(audio_buffer_max);
- rom_image = make_unique(getROMMax());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/libretro/libretro.cxx b/src/libretro/libretro.cxx
index 42408bd97..34383b73e 100644
--- a/src/libretro/libretro.cxx
+++ b/src/libretro/libretro.cxx
@@ -423,7 +423,7 @@ void retro_set_input_state(retro_input_state_t cb) { input_state_cb = cb; }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void retro_get_system_info(struct retro_system_info *info)
{
- memset(info,0,sizeof(retro_system_info));
+ *info = retro_system_info{}; // reset to defaults
info->library_name = stella.getCoreName();
#ifndef GIT_VERSION
@@ -438,18 +438,20 @@ void retro_get_system_info(struct retro_system_info *info)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void retro_get_system_av_info(struct retro_system_av_info *info)
{
- memset(info,0,sizeof(retro_system_av_info));
+ *info = retro_system_av_info{}; // reset to defaults
info->timing.fps = stella.getVideoRate();
info->timing.sample_rate = stella.getAudioRate();
- info->geometry.base_width = stella.getRenderWidth() - crop_left * (stella.getVideoZoom() == 1 ? 2 : 1);
+ info->geometry.base_width = stella.getRenderWidth() - crop_left *
+ (stella.getVideoZoom() == 1 ? 2 : 1);
info->geometry.base_height = stella.getRenderHeight();
info->geometry.max_width = stella.getVideoWidthMax();
info->geometry.max_height = stella.getVideoHeightMax();
- info->geometry.aspect_ratio = stella.getVideoAspectPar() * (float) info->geometry.base_width / (float) info->geometry.base_height;
+ info->geometry.aspect_ratio = stella.getVideoAspectPar() *
+ (float) info->geometry.base_width / (float) info->geometry.base_height;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/libretro/libretro.h b/src/libretro/libretro.h
index 534d57ca6..1901465ae 100644
--- a/src/libretro/libretro.h
+++ b/src/libretro/libretro.h
@@ -2100,16 +2100,16 @@ struct retro_system_info
/* All pointers are owned by libretro implementation, and pointers must
* remain valid until retro_deinit() is called. */
- const char *library_name; /* Descriptive name of library. Should not
- * contain any version numbers, etc. */
- const char *library_version; /* Descriptive version of core. */
+ const char *library_name{nullptr}; /* Descriptive name of library. Should not
+ * contain any version numbers, etc. */
+ const char *library_version{nullptr}; /* Descriptive version of core. */
- const char *valid_extensions; /* A string listing probably content
- * extensions the core will be able to
- * load, separated with pipe.
- * I.e. "bin|rom|iso".
- * Typically used for a GUI to filter
- * out extensions. */
+ const char *valid_extensions{nullptr}; /* A string listing probably content
+ * extensions the core will be able to
+ * load, separated with pipe.
+ * I.e. "bin|rom|iso".
+ * Typically used for a GUI to filter
+ * out extensions. */
/* If true, retro_load_game() is guaranteed to provide a valid pathname
* in retro_game_info::path.
@@ -2122,33 +2122,33 @@ struct retro_system_info
* load from file.
* Implementations should strive for setting this to false, as it allows
* the frontend to perform patching, etc. */
- bool need_fullpath;
+ bool need_fullpath{false};
/* If true, the frontend is not allowed to extract any archives before
* loading the real content.
* Necessary for certain libretro implementations that load games
* from zipped archives. */
- bool block_extract;
+ bool block_extract{false};
};
struct retro_game_geometry
{
- unsigned base_width; /* Nominal video width of game. */
- unsigned base_height; /* Nominal video height of game. */
- unsigned max_width; /* Maximum possible width of game. */
- unsigned max_height; /* Maximum possible height of game. */
+ unsigned base_width{0}; /* Nominal video width of game. */
+ unsigned base_height{0}; /* Nominal video height of game. */
+ unsigned max_width{0}; /* Maximum possible width of game. */
+ unsigned max_height{0}; /* Maximum possible height of game. */
- float aspect_ratio; /* Nominal aspect ratio of game. If
- * aspect_ratio is <= 0.0, an aspect ratio
- * of base_width / base_height is assumed.
- * A frontend could override this setting,
- * if desired. */
+ float aspect_ratio{0.F}; /* Nominal aspect ratio of game. If
+ * aspect_ratio is <= 0.0, an aspect ratio
+ * of base_width / base_height is assumed.
+ * A frontend could override this setting,
+ * if desired. */
};
struct retro_system_timing
{
- double fps; /* FPS of video content. */
- double sample_rate; /* Sampling rate of audio. */
+ double fps{0.F}; /* FPS of video content. */
+ double sample_rate{0.F}; /* Sampling rate of audio. */
};
struct retro_system_av_info
diff --git a/src/macos/stella.xcodeproj/project.pbxproj b/src/macos/stella.xcodeproj/project.pbxproj
index b3c9938d3..febcc5772 100644
--- a/src/macos/stella.xcodeproj/project.pbxproj
+++ b/src/macos/stella.xcodeproj/project.pbxproj
@@ -304,6 +304,8 @@
DC47455D09C34BFA00EDDA3A /* CheetahCheat.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC47455209C34BFA00EDDA3A /* CheetahCheat.hxx */; };
DC47455E09C34BFA00EDDA3A /* RamCheat.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC47455309C34BFA00EDDA3A /* RamCheat.cxx */; };
DC47455F09C34BFA00EDDA3A /* RamCheat.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC47455409C34BFA00EDDA3A /* RamCheat.hxx */; };
+ DC479403258C56B800F52462 /* PlusROM.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC479401258C56B800F52462 /* PlusROM.cxx */; };
+ DC479404258C56B800F52462 /* PlusROM.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC479402258C56B800F52462 /* PlusROM.hxx */; };
DC487FB60DA5350900E12499 /* AtariVox.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC487FB40DA5350900E12499 /* AtariVox.cxx */; };
DC487FB70DA5350900E12499 /* AtariVox.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC487FB50DA5350900E12499 /* AtariVox.hxx */; };
DC4AC6EF0DC8DACB00CD3AD2 /* RiotWidget.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC4AC6ED0DC8DACB00CD3AD2 /* RiotWidget.cxx */; };
@@ -1091,6 +1093,8 @@
DC47455209C34BFA00EDDA3A /* CheetahCheat.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = CheetahCheat.hxx; sourceTree = ""; };
DC47455309C34BFA00EDDA3A /* RamCheat.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RamCheat.cxx; sourceTree = ""; };
DC47455409C34BFA00EDDA3A /* RamCheat.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = RamCheat.hxx; sourceTree = ""; };
+ DC479401258C56B800F52462 /* PlusROM.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlusROM.cxx; sourceTree = ""; };
+ DC479402258C56B800F52462 /* PlusROM.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = PlusROM.hxx; sourceTree = ""; };
DC487FB40DA5350900E12499 /* AtariVox.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AtariVox.cxx; sourceTree = ""; };
DC487FB50DA5350900E12499 /* AtariVox.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = AtariVox.hxx; sourceTree = ""; };
DC4AC6ED0DC8DACB00CD3AD2 /* RiotWidget.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RiotWidget.cxx; sourceTree = ""; };
@@ -2071,6 +2075,8 @@
2DDBEB7508457B7D00812C11 /* OSystem.hxx */,
2DE2DF820627AE34006BEC99 /* Paddles.cxx */,
2DE2DF830627AE34006BEC99 /* Paddles.hxx */,
+ DC479401258C56B800F52462 /* PlusROM.cxx */,
+ DC479402258C56B800F52462 /* PlusROM.hxx */,
DC53B6AD1F3622DA00AA6BFB /* PointingDevice.cxx */,
DC3DAFAB1F2E233B00A64410 /* PointingDevice.hxx */,
DCF7F124223D795F00701A47 /* ProfilingRunner.cxx */,
@@ -2731,6 +2737,7 @@
DC932D440F278A5200FEFEFC /* DefProps.hxx in Headers */,
DC932D450F278A5200FEFEFC /* Serializable.hxx in Headers */,
DC932D460F278A5200FEFEFC /* SerialPort.hxx in Headers */,
+ DC479404258C56B800F52462 /* PlusROM.hxx in Headers */,
DC9EA8880F729A36000452B5 /* KidVid.hxx in Headers */,
DCF7F128223D796000701A47 /* ConsoleIO.hxx in Headers */,
DCF467B80F93993B00B25D7A /* SoundNull.hxx in Headers */,
@@ -3282,6 +3289,7 @@
DCAAE5EE1715887B0080BB82 /* CartF8Widget.cxx in Sources */,
DCAAE5F01715887B0080BB82 /* CartFAWidget.cxx in Sources */,
DCAAE5F21715887B0080BB82 /* CartUAWidget.cxx in Sources */,
+ DC479403258C56B800F52462 /* PlusROM.cxx in Sources */,
DC676A411729A0B000E4E73D /* Cart3EWidget.cxx in Sources */,
DCBA539A25557E2800087DD7 /* UndoHandler.cxx in Sources */,
DC676A431729A0B000E4E73D /* Cart4A50Widget.cxx in Sources */,
diff --git a/src/unix/FSNodePOSIX.cxx b/src/unix/FSNodePOSIX.cxx
index f483dc899..c49d7d1ce 100644
--- a/src/unix/FSNodePOSIX.cxx
+++ b/src/unix/FSNodePOSIX.cxx
@@ -32,10 +32,8 @@ FilesystemNodePOSIX::FilesystemNodePOSIX()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodePOSIX::FilesystemNodePOSIX(const string& path, bool verify)
+ : _path{path.length() > 0 ? path : "~"} // Default to home directory
{
- // Default to home directory
- _path = path.length() > 0 ? path : "~";
-
// Expand '~' to the HOME environment variable
if(_path[0] == '~')
{
diff --git a/src/unix/FSNodePOSIX.hxx b/src/unix/FSNodePOSIX.hxx
index 5bf9e0277..5aba86afa 100644
--- a/src/unix/FSNodePOSIX.hxx
+++ b/src/unix/FSNodePOSIX.hxx
@@ -58,7 +58,7 @@ class FilesystemNodePOSIX : public AbstractFSNode
* @param verify true if the isValid and isDirectory/isFile flags should
* be verified during the construction.
*/
- FilesystemNodePOSIX(const string& path, bool verify = true);
+ explicit FilesystemNodePOSIX(const string& path, bool verify = true);
bool exists() const override { return access(_path.c_str(), F_OK) == 0; }
const string& getName() const override { return _displayName; }
diff --git a/src/windows/FSNodeWINDOWS.cxx b/src/windows/FSNodeWINDOWS.cxx
index c8676e542..82182fe83 100644
--- a/src/windows/FSNodeWINDOWS.cxx
+++ b/src/windows/FSNodeWINDOWS.cxx
@@ -175,10 +175,8 @@ FilesystemNodeWINDOWS::FilesystemNodeWINDOWS()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeWINDOWS::FilesystemNodeWINDOWS(const string& p)
+ : _path(p.length() > 0 ? p : "~") // Default to home directory
{
- // Default to home directory
- _path = p.length() > 0 ? p : "~";
-
// Expand '~' to the users 'home' directory
if(_path[0] == '~')
_path.replace(0, 1, myHomeFinder.getHomePath());
diff --git a/src/windows/Stella.vcxproj b/src/windows/Stella.vcxproj
index 85835c4a8..f26373772 100644
--- a/src/windows/Stella.vcxproj
+++ b/src/windows/Stella.vcxproj
@@ -756,6 +756,7 @@
+
@@ -1535,6 +1536,7 @@
+
@@ -1814,6 +1816,7 @@
+
diff --git a/src/windows/Stella.vcxproj.filters b/src/windows/Stella.vcxproj.filters
index f840baa24..86cc44f3f 100644
--- a/src/windows/Stella.vcxproj.filters
+++ b/src/windows/Stella.vcxproj.filters
@@ -1,3 +1,4 @@
+
@@ -965,6 +966,9 @@
Source Files\gui
+
+ Source Files\repository
+
Source Files
@@ -1064,6 +1068,9 @@
Source Files\debugger
+
+ Source Files\emucore
+
Source Files\repository\sqlite
@@ -2056,6 +2063,9 @@
Header Files\repository
+
+ Header Files\repository
+
Header Files\repository
@@ -2191,6 +2201,12 @@
Header Files\json
+
+ Header Files
+
+
+ Header Files\emucore
+
Header Files\repository\sqlite
@@ -2227,4 +2243,4 @@
Resource Files
-
\ No newline at end of file
+