Merge branch 'master' into feature/full-on-sqlite

This commit is contained in:
Stephen Anthony 2020-12-21 22:45:44 -03:30
commit 5332758281
60 changed files with 345 additions and 335 deletions

View File

@ -16,15 +16,15 @@
* Added high scores saving.
* Enhanced cut/copy/paste for text editing (except PromptWidget).
* Improved text editing functionality (except PromptWidget):
- Enhanced selection and cut/copy/paste from keyboard.
- Added undo and redo support.
- Added mouse support (selection, cut/copy/paste).
- All actions have keyboard shortcuts.
* Added undo and redo to text editing (except PromptWidget).
* Added mouse support for text editing (except PromptWidget).
* Added wildcard support to launcher dialog filter.
* Added option to search subdirectories in launcher.
* Various improvements to the ROM launcher:
- Added wildcard support to the dialog filter
- Added option to search subdirectories
* Added static tooltips to some UI items.
@ -41,7 +41,8 @@
* Fixed Stelladaptor/2600'daptor devices sometimes not being assigned
correct default mappings.
* Codebase now uses C++17 features.
* Codebase now uses C++17 features, which means a minimum of gcc7
or clang5 for Linux/Mac, and Visual Studio 2019 for Windows.
-Have fun!

View File

@ -223,7 +223,7 @@ present in the debugger):</p>
<p>For space reasons, the Prompt, TIA, I/O and Audio displays are split into
4 tabs, only one of which is visible at a time. You can use the mouse or
keyboard to select which tab you want to view. Control/Cmd + Tab cycles between
tabs from left-to-right, Shift + Control/Cmd + Tab cycles right-to-left.
tabs from left-to-right, Shift-Control/Cmd + Tab cycles right-to-left.
Pressing Tab (or Shift + Tab) cycles between widgets in the current tab (except
for in the Prompt Tab, where 'tab' is used for something else).</p>
@ -339,7 +339,7 @@ previous rewind operation. The rewind buffer is 100 levels deep by default, the
size can be configured e.g. in the
<b><a href="index.html#Debugger">Developer Settings</a> - Time Machine</b> dialog.<p>
<p>The other operations are Step, Trace, Scan+1, Frame+1 and Run.</p>
<p>The other operations are Step, Trace, Scan +1, Frame +1 and Run.</p>
<p>You can also use the buttons from anywhere in the GUI via hotkeys.</p>
<p>
@ -349,48 +349,48 @@ size can be configured e.g. in the
<th>Function</th>
</tr>
<tr>
<td>Control-s</td>
<td>Control + S</td>
<td>Step</td>
</tr>
<tr>
<td>Control-t</td>
<td>Control + T</td>
<td>Trace</td>
</tr>
<tr>
<td>Control-L</td>
<td>Scan+1</td>
<td>Control + L</td>
<td>Scan +1</td>
</tr>
<tr>
<td>Control-f</td>
<td>Frame+1</td>
<td>Control + F</td>
<td>Frame +1</td>
</tr>
<tr>
<td>Alt-Left arrow</td>
<td>Alt + Left arrow</td>
<td>Rewind 1</td>
</tr>
<tr>
<td>Shift-Alt-Left arrow</td>
<td>Shift-Alt + Left arrow</td>
<td>Rewind 10</td>
</tr>
<tr>
<td>Alt-Down arrow</td>
<td>Alt + Down arrow</td>
<td>Rewind all</td>
</tr>
<tr>
<td>Alt-Right arrow</td>
<td>Alt + Right arrow</td>
<td>Unwind 1</td>
</tr>
<tr>
<td>Shift-Alt-Right arrow</td>
<td>Shift-Alt + Right arrow</td>
<td>Unwind 10</td>
</tr>
<tr>
<td>Alt-Up arrow</td>
<td>Alt + Up arrow</td>
<td>Unwind all</td>
</tr>
<tr>
<td>Backquote (`)</td>
<td>Run</td>
<td>Run, exits debugger</td>
</tr>
</table>
</p>
@ -433,18 +433,18 @@ Bash-style commands are also supported:</p>
<tr><td>End</td><td>Move cursor to end of line</td></tr>
<tr><td>Delete</td><td>Remove character to right of cursor</td></tr>
<tr><td>Backspace</td><td>Remove character to left of cursor</td></tr>
<tr><td>Control-a</td><td>Same function as 'Home'</td></tr>
<tr><td>Control-e</td><td>Same function as 'End'</td></tr>
<tr><td>Control-d</td><td>Same function as 'Delete'</td></tr>
<tr><td>Control-k</td><td>Remove all characters from cursor to end of line</td></tr>
<tr><td>Control-u</td><td>Remove all characters from cursor to beginning of line</td></tr>
<tr><td>Control-w</td><td>Remove entire word to left of cursor</td></tr>
<tr><td>Shift-PgUp</td><td>Scroll up through previous commands one screen/page</td></tr>
<tr><td>Shift-PgDown</td><td>Scroll down through previous commands one screen/page</td></tr>
<tr><td>Shift-Up</td><td>Scroll up through previous commands one line</td></tr>
<tr><td>Shift-Down</td><td>Scroll down through previous commands one line</td></tr>
<tr><td>Shift-Home</td><td>Scroll to beginning of commands</td></tr>
<tr><td>Shift-End</td><td>Scroll to end of commands</td></tr>
<tr><td>Control + A</td><td>Same function as 'Home'</td></tr>
<tr><td>Control + E</td><td>Same function as 'End'</td></tr>
<tr><td>Control + D</td><td>Same function as 'Delete'</td></tr>
<tr><td>Control + K</td><td>Remove all characters from cursor to end of line</td></tr>
<tr><td>Control + U</td><td>Remove all characters from cursor to beginning of line</td></tr>
<tr><td>Control + W</td><td>Remove entire word to left of cursor</td></tr>
<tr><td>Shift + PgUp</td><td>Scroll up through previous commands one screen/page</td></tr>
<tr><td>Shift + PgDown</td><td>Scroll down through previous commands one screen/page</td></tr>
<tr><td>Shift + Up</td><td>Scroll up through previous commands one line</td></tr>
<tr><td>Shift + Down</td><td>Scroll down through previous commands one line</td></tr>
<tr><td>Shift + Home</td><td>Scroll to beginning of commands</td></tr>
<tr><td>Shift + End</td><td>Scroll to end of commands</td></tr>
</table>
<p>You can also scroll with the mouse. Copy and paste is not yet supported.</p>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -644,8 +644,8 @@
<tr>
<td>Exit emulator</td>
<td>Control + q</td>
<td>Cmd + q</td>
<td>Control + Q</td>
<td>Cmd + Q</td>
</tr>
<tr>
@ -771,7 +771,7 @@
<tr>
<td>Pause/resume emulation</td>
<td>Pause</td>
<td>Shift-Cmd + p</td>
<td>Shift-Cmd + P</td>
</tr>
</table>
@ -1377,8 +1377,8 @@
<td>Toggle adapting display refresh rate to game frame rate
</br>
Note: Not available for macOS.</td>
<td>Alt + r</td>
<td>Cmd + r</td>
<td>Alt + R</td>
<td>Cmd + R</td>
</tr>
<tr>
<td><i>Decrease</i> overscan in fullscreen mode</td>
@ -1402,8 +1402,8 @@
</tr>
<tr>
<td>Toggle aspect ratio correct scaling</td>
<td>Control + c</td>
<td>Control + c</td>
<td>Control + C</td>
<td>Control + C</td>
</tr>
<tr>
<td><i>Decrease</i> vertical display size</td>
@ -1417,18 +1417,18 @@
</tr>
<tr>
<td>Switch to <i>previous</i> display format (NTSC/PAL/SECAM etc.)</td>
<td>Shift-Control + f</td>
<td>Shift-Control + f</td>
<td>Shift-Control + F</td>
<td>Shift-Control + F</td>
</tr>
<tr>
<td>Switch to <i>next</i> display format (NTSC/PAL/SECAM etc.)</td>
<td>Control + f</td>
<td>Control + f</td>
<td>Control + F</td>
<td>Control + F</td>
</tr>
<tr>
<td>Toggle display interpolation</td>
<td>Control + i</td>
<td>Control + i</td>
<td>Control + I</td>
<td>Control + I</td>
</tr>
<tr>
<td colspan="3"><center><font size="-1">
@ -1447,14 +1447,14 @@
<tr>
<td>Select <i>previous</i> palette (Standard/z26/User/Custom)</td>
<td>Shift-Control + p</td>
<td>Shift-Control + p</td>
<td>Shift-Control + P</td>
<td>Shift-Control + P</td>
</tr>
<tr>
<td>Select <i>next</i> palette (Standard/z26/User/Custom)</td>
<td>Control + p</td>
<td>Control + p</td>
<td>Control + P</td>
<td>Control + P</td>
</tr>
<tr>
@ -1527,8 +1527,8 @@
</tr>
<tr>
<td>Toggle 'phosphor' mode</td>
<td>Alt + p</td>
<td>Cmd + p</td>
<td>Alt + P</td>
<td>Cmd + P</td>
</tr>
<tr>
<td><i>Decrease</i> 'phosphor' blend</td>
@ -1627,13 +1627,13 @@
<tr>
<td><i>Decrease</i> autofire rate</td>
<td>Shift-Control + a</td>
<td>Shift-Control + a</td>
<td>Shift-Control + A</td>
<td>Shift-Control + A</td>
</tr>
<tr>
<td><i>Increase</i> autofire rate</td>
<td>Control + a</td>
<td>Control + a</td>
<td>Control + A</td>
<td>Control + A</td>
</tr>
<tr>
@ -1716,8 +1716,8 @@
<tr>
<td>Toggle grab mouse</td>
<td>Control + g</td>
<td>Control + g</td>
<td>Control + G</td>
<td>Control + G</td>
</tr>
<tr>
@ -1823,38 +1823,38 @@
<tr>
<td>Toggle TIA Player0 object</td>
<td>Alt + z</td>
<td>Cmd + z</td>
<td>Alt + Z</td>
<td>Cmd + Z</td>
</tr>
<tr>
<td>Toggle TIA Player1 object</td>
<td>Alt + x</td>
<td>Cmd + x</td>
<td>Alt + X</td>
<td>Cmd + X</td>
</tr>
<tr>
<td>Toggle TIA Missile0 object</td>
<td>Alt + c</td>
<td>Cmd + c</td>
<td>Alt + C</td>
<td>Cmd + C</td>
</tr>
<tr>
<td>Toggle TIA Missile1 object</td>
<td>Alt + v</td>
<td>Cmd + v</td>
<td>Alt + V</td>
<td>Cmd + V</td>
</tr>
<tr>
<td>Toggle TIA Ball object</td>
<td>Alt + b</td>
<td>Cmd + b</td>
<td>Alt + B</td>
<td>Cmd + B</td>
</tr>
<tr>
<td>Toggle TIA Playfield object</td>
<td>Alt + n</td>
<td>Cmd + n</td>
<td>Alt + N</td>
<td>Cmd + N</td>
</tr>
<tr>
@ -1865,38 +1865,38 @@
<tr>
<td>Toggle TIA Player0 collisions</td>
<td>Shift-Alt + z</td>
<td>Shift-Cmd + z</td>
<td>Shift-Alt + Z</td>
<td>Shift-Cmd + Z</td>
</tr>
<tr>
<td>Toggle TIA Player1 collisions</td>
<td>Shift-Alt + x</td>
<td>Shift-Cmd + x</td>
<td>Shift-Alt + X</td>
<td>Shift-Cmd + X</td>
</tr>
<tr>
<td>Toggle TIA Missile0 collisions</td>
<td>Shift-Alt + c</td>
<td>Shift-Cmd + c</td>
<td>Shift-Alt + C</td>
<td>Shift-Cmd + C</td>
</tr>
<tr>
<td>Toggle TIA Missile1 collisions</td>
<td>Shift-Alt + v</td>
<td>Shift-Cmd + v</td>
<td>Shift-Alt + V</td>
<td>Shift-Cmd + V</td>
</tr>
<tr>
<td>Toggle TIA Ball collisions</td>
<td>Shift-Alt + b</td>
<td>Shift-Cmd + b</td>
<td>Shift-Alt + B</td>
<td>Shift-Cmd + B</td>
</tr>
<tr>
<td>Toggle TIA Playfield collisions</td>
<td>Shift-Alt + n</td>
<td>Shift-Cmd + n</td>
<td>Shift-Alt + N</td>
<td>Shift-Cmd + N</td>
</tr>
<tr>
@ -1919,8 +1919,8 @@
<tr>
<td>Toggle TV 'Jitter' effect</td>
<td>Alt + j</td>
<td>Cmd + j</td>
<td>Alt + J</td>
<td>Cmd + J</td>
</tr>
<tr>
<td colspan="3"><center><font size="-1">
@ -1988,14 +1988,14 @@
</tr>
<tr>
<td>Load <i>previous</i> game in ROM (multicart ROM)</td>
<td>Shift-Control + r</td>
<td>Shift-Control + r</td>
<td>Shift-Control + R</td>
<td>Shift-Control + R</td>
</tr>
<tr>
<td>Reload current ROM (singlecart ROM)<br>
Load <i>next</i> game in ROM (multicart ROM)</td>
<td>Control + r</td>
<td>Control + r</td>
<td>Control + R</td>
<td>Control + R</td>
</tr>
<tr>
<td>Emulate 'frying' effect</td>
@ -2004,29 +2004,29 @@
</tr>
<tr>
<td><i>Decrease</i> emulation speed (disables 'Turbo' mode)</td>
<td>Shift-Control + s</td>
<td>Shift-Control + s</td>
<td>Shift-Control + S</td>
<td>Shift-Control + S</td>
</tr>
<tr>
<td><i>Increase</i> emulation speed (disables 'Turbo' mode)</td>
<td>Control + s</td>
<td>Control + s</td>
<td>Control + S</td>
<td>Control + S</td>
</tr>
<tr>
<td>Toggle 'Turbo' mode (maximum emulation speed)</td>
<td>Control + t</td>
<td>Control + t</td>
<td>Control + T</td>
<td>Control + T</td>
</tr>
<tr>
<td>Save continuous PNG snapshots</br>(per interval defined in <a href="#Snapshots"><b>Snapshot Settings</b></a>)</td>
<td>Control-Alt + s</td>
<td>Control-Cmd + s</td>
<td>Control-Alt + S</td>
<td>Control-Cmd + S</td>
</tr>
<tr>
<td>Save continuous PNG snapshots (every frame)</td>
<td>Shift-Control-Alt + s</td>
<td>Shift-Control-Cmd + s</td>
<td>Shift-Control-Alt + S</td>
<td>Shift-Control-Cmd + S</td>
</tr>
<tr>
<td>Open the <a href="#HighScores"><b>High Scores</b></a> dialog.</td>
@ -2035,13 +2035,13 @@
</tr>
<tr>
<td>Toggle 'Time Machine' mode</td>
<td>Alt + t</td>
<td>Cmd + t</td>
<td>Alt + T</td>
<td>Cmd + T</td>
</tr>
<tr>
<td>Enter/Exit the <a href="#TimeMachine"><b>Time Machine</b></a> dialog</td>
<td>Shift + t to enter, Shift + t/Escape to exit and continue with emulation</td>
<td>Shift + t to enter, Shift + t/Escape to exit and continue with emulation</td>
<td>Shift + T to enter, Shift + T/Escape to exit and continue with emulation</td>
<td>Shift + T to enter, Shift + T/Escape to exit and continue with emulation</td>
</tr>
<tr>
<td>Playback the <a href="#TimeMachine"><b>Time Machine</b></a> from current state (without sound, from the TM dialog only)</td>
@ -2168,11 +2168,6 @@
<td>Control + Tab</td>
<td>Control + Tab</td>
</tr>
<tr>
<td>Go to parent directory</td>
<td>Backspace</td>
<td>Backspace</td>
</tr>
<tr>
<td>Toggle windowed/fullscreen mode</td>
<td>Alt + Return</td>
@ -2180,8 +2175,37 @@
</tr>
<tr>
<td>Exit emulator</td>
<td>Control + q</td>
<td>Cmd + q</td>
<td>Control + Q</td>
<td>Cmd + Q</td>
</tr>
</table>
<p><b>Additional Launcher Keys (cannot be remapped)</b></p>
<table BORDER=2 cellpadding=4>
<tr>
<th>Function</th>
<th>Key (Standard)</th>
<th>Key (macOS)</th>
</tr>
<tr>
<td>Go to parent directory (also in other file dialogs)</td>
<td>Backspace</td>
<td>Backspace</td>
</tr>
<tr>
<td>Open Power-On options dialog</td>
<td>Control + P</td>
<td>Control + P</td>
</tr>
<tr>
<td>Open High Scores dialog (if available for selected ROM)</td>
<td>Control + H</td>
<td>Control + H</td>
</tr>
<tr>
<td>Reload ROM listing</td>
<td>Control + R</td>
<td>Control + R</td>
</tr>
</table>
@ -2216,12 +2240,12 @@
<tr>
<td>Move cursor to beginning of line</td>
<td>Home</td>
<td>Home, Control + a, Command + Left arrow</td>
<td>Home, Control + A, Command + Left arrow</td>
</tr>
<tr>
<td>Move cursor to end of line</td>
<td>End</td>
<td>End, Control + e, Command + Right arrow</td>
<td>End, Control + E, Command + Right arrow</td>
</tr>
<tr>
<td>Delete character to left of cursor</td>
@ -2230,28 +2254,28 @@
</tr>
<tr>
<td>Delete character to right of cursor</td>
<td>Delete, Control + d</td>
<td>Delete, Control + d</td>
<td>Delete, Control + D</td>
<td>Delete, Control + D</td>
</tr>
<tr>
<td>Delete word to left of cursor</td>
<td>Control + Backspace, Control + w</td>
<td>Option + Backspace, Control + w</td>
<td>Control + Backspace, Control + W</td>
<td>Option + Backspace, Control + W</td>
</tr>
<tr>
<td>Delete word to right of cursor</td>
<td>Control + Delete, Alt + d</td>
<td>Control + Delete, Alt + D</td>
<td>Option + Delete</td>
</tr>
<tr>
<td>Delete all text to beginning of line</td>
<td>Control + Home, Control + u</td>
<td>Command + Backspace, Control + u</td>
<td>Control + Home, Control + U</td>
<td>Command + Backspace, Control + U</td>
</tr>
<tr>
<td>Delete all text to end of line</td>
<td>Control + End, Control + k</td>
<td>Control + k</td>
<td>Control + End, Control + K</td>
<td>Control + K</td>
</tr>
<tr>
<td>Select character to left of cursor</td>
@ -2276,42 +2300,42 @@
<tr>
<td>Select all text to beginning of line</td>
<td>Shift + Home</td>
<td>Shift + Home, Shift-Control + a, Shift-Command + Left arrow</td>
<td>Shift + Home, Shift-Control + A, Shift-Command + Left arrow</td>
</tr>
<tr>
<td>Select all text to end of line</td>
<td>Shift + End</td>
<td>Shift + End, Shift-Control + e, Shift-Command + Right arrow</td>
<td>Shift + End, Shift-Control + E, Shift-Command + Right arrow</td>
</tr>
<tr>
<td>Select all text</td>
<td>Control + a</td>
<td>Command + a</td>
<td>Control + A</td>
<td>Command + A</td>
</tr>
<tr>
<td>Cut selected text</td>
<td>Control + x, Shift + Delete</td>
<td>Command + x</td>
<td>Control + X, Shift + Delete</td>
<td>Command + X</td>
</tr>
<tr>
<td>Copy selected text</td>
<td>Control + c, Control + Insert</td>
<td>Command + c</td>
<td>Control + C, Control + Insert</td>
<td>Command + C</td>
</tr>
<tr>
<td>Paste at cursor and replace selection</td>
<td>Control + v, Shift + Insert</td>
<td>Command + v</td>
<td>Control + V, Shift + Insert</td>
<td>Command + V</td>
</tr>
<tr>
<td>Undo last operation</td>
<td>Control + z</td>
<td>Command + z</td>
<td>Control + Z</td>
<td>Command + Z</td>
</tr>
<tr>
<td>Redo last operation</td>
<td>Control + y, Shift-Control + z</td>
<td>Command + y, Shift-Command + z</td>
<td>Control + Y, Shift-Control + Z</td>
<td>Command + Y, Shift-Command + Z</td>
</tr>
</table>
</br>
@ -2939,12 +2963,12 @@
<tr>
<td><pre>-modcombo &lt;1|0&gt;</pre></td>
<td>Use modifier(Shift/Alt/Control) + x key combos. This is normally enabled,
since the 'Quit' command is tied to 'Control + q'. However, there are times
<td>Use modifier (Shift/Alt/Control/Cmd) + x key combos. This is normally enabled,
since the 'Quit' command is tied to 'Control + Q'. However, there are times
when you want to disable them.</br>
E.g. a 2-player game is using either the 'f' or 'r' keys for movement,
E.g. a 2-player game is using either the 'F' or 'R' keys for movement,
and pressing Control (for Fire) will perform an unwanted action
associated with 'Control + r' or 'Control + f' default keys.</td>
associated with 'Control + R' or 'Control + F' default keys.</td>
</tr>
<tr>
@ -3881,7 +3905,7 @@
Clicking 'Combo' will show a dialog similar to the following:</p>
<img src="graphics/eventmapping_combo.png">
<p>In this dialog, you can assign various events to the selected combo event.
Note that this simply assigns multiple events to the combo; you still need
Note that this only assigns multiple events to the combo; you still need
to map the combo event itself to some action, as described in the 'remap an
event' section above.</p>
@ -4034,14 +4058,14 @@
</td>
</tr>
</table>
<p>This dialog can also be opened by pressing 'Control + p'.</p>
<p>This dialog can also be opened by pressing 'Control + P'.</p>
</li>
<li><b>High scores</b>: This option displays the <a href="#HighScores">
High Scores</a> dialog for the selected ROM. Only available if high score
properties have been setup for the ROM. Also available via 'Control + h' keys combo.</li>
properties have been setup for the ROM. Also available via 'Control + H' keys combo.</li>
</li>
<br><li><b>Reload listing</b>: Selecting this performs a reload of the
current listing. It is an alternative to pressing the 'Control + r'
current listing. It is an alternative to pressing the 'Control + R'
key combo.</li>
</ol></p>
</blockquote></br>

View File

@ -49,8 +49,8 @@ class PhysicalJoystickHandler
private:
struct StickInfo
{
StickInfo(const nlohmann::json& map = nullptr, PhysicalJoystickPtr stick = nullptr)
: mapping{map}, joy{std::move(stick)} { }
StickInfo(nlohmann::json map, PhysicalJoystickPtr stick = nullptr)
: mapping(map), joy{std::move(stick)} {}
nlohmann::json mapping;
PhysicalJoystickPtr joy;

View File

@ -47,6 +47,7 @@ using uInt64 = uint64_t;
#include <iomanip>
#include <memory>
#include <string>
#include <string_view>
#include <sstream>
#include <cstring>
#include <cctype>
@ -60,6 +61,7 @@ using std::cout;
using std::cerr;
using std::endl;
using std::string;
using std::string_view;
using std::istream;
using std::ostream;
using std::fstream;
@ -200,51 +202,47 @@ namespace BSPF
catch(...) { return defaultValue; }
}
// Compare two strings, ignoring case
inline int compareIgnoreCase(const string& s1, const string& s2)
// Compare two strings (case insensitive)
// Return negative, zero, positive result for <,==,> respectively
static constexpr int compareIgnoreCase(string_view s1, string_view s2)
{
#if (defined BSPF_WINDOWS || defined __WIN32__) && !defined __GNUG__
return _stricmp(s1.c_str(), s2.c_str());
#else
return strcasecmp(s1.c_str(), s2.c_str());
#endif
}
inline int compareIgnoreCase(const char* s1, const char* s2)
{
#if (defined BSPF_WINDOWS || defined __WIN32__) && !defined __GNUG__
return _stricmp(s1, s2);
#else
return strcasecmp(s1, s2);
#endif
}
// Only compare up to the length of the shorter string
const auto maxsize = std::min(s1.size(), s2.size());
for(size_t i = 0; i < maxsize; ++i)
if(toupper(s1[i]) != toupper(s2[i]))
return toupper(s1[i]) - toupper(s2[i]);
// Test whether the first string starts with the second one (case insensitive)
inline bool startsWithIgnoreCase(const string& s1, const string& s2)
{
#if (defined BSPF_WINDOWS || defined __WIN32__) && !defined __GNUG__
return _strnicmp(s1.c_str(), s2.c_str(), s2.length()) == 0;
#else
return strncasecmp(s1.c_str(), s2.c_str(), s2.length()) == 0;
#endif
}
inline bool startsWithIgnoreCase(const char* s1, const char* s2)
{
#if (defined BSPF_WINDOWS || defined __WIN32__) && !defined __GNUG__
return _strnicmp(s1, s2, strlen(s2)) == 0;
#else
return strncasecmp(s1, s2, strlen(s2)) == 0;
#endif
// Otherwise the length of the string takes priority
return static_cast<int>(s1.size() - s2.size());
}
// Test whether two strings are equal (case insensitive)
inline bool equalsIgnoreCase(const string& s1, const string& s2)
inline constexpr bool equalsIgnoreCase(string_view s1, string_view s2)
{
return compareIgnoreCase(s1, s2) == 0;
return s1.size() == s2.size() ? (compareIgnoreCase(s1, s2) == 0) : false;
}
// Test whether the first string starts with the second one (case insensitive)
inline constexpr bool startsWithIgnoreCase(string_view s1, string_view s2)
{
if(s1.size() >= s2.size())
return compareIgnoreCase(s1.substr(0, s2.size()), s2) == 0;
return false;
}
// Test whether the first string ends with the second one (case insensitive)
inline constexpr bool endsWithIgnoreCase(string_view s1, string_view s2)
{
if(s1.size() >= s2.size())
return compareIgnoreCase(s1.substr(s1.size() - s2.size()), s2) == 0;
return false;
}
// Find location (if any) of the second string within the first,
// starting from 'startpos' in the first string
inline size_t findIgnoreCase(const string& s1, const string& s2, size_t startpos = 0)
static size_t findIgnoreCase(const string& s1, const string& s2, size_t startpos = 0)
{
auto pos = std::search(s1.cbegin()+startpos, s1.cend(),
s2.cbegin(), s2.cend(), [](char ch1, char ch2) {
@ -253,17 +251,6 @@ namespace BSPF
return pos == s1.cend() ? string::npos : pos - (s1.cbegin()+startpos);
}
// Test whether the first string ends with the second one (case insensitive)
inline bool endsWithIgnoreCase(const string& s1, const string& s2)
{
if(s1.length() >= s2.length())
{
const char* end = s1.c_str() + s1.length() - s2.length();
return compareIgnoreCase(end, s2.c_str()) == 0;
}
return false;
}
// Test whether the first string contains the second one (case insensitive)
inline bool containsIgnoreCase(const string& s1, const string& s2)
{
@ -275,12 +262,12 @@ namespace BSPF
// - the following characters must appear in the order of the first string
inline bool matches(const string& s1, const string& s2)
{
if(BSPF::startsWithIgnoreCase(s1, s2.substr(0, 1)))
if(startsWithIgnoreCase(s1, s2.substr(0, 1)))
{
size_t pos = 1;
for(uInt32 j = 1; j < s2.size(); ++j)
{
size_t found = BSPF::findIgnoreCase(s1, s2.substr(j, 1), pos);
size_t found = findIgnoreCase(s1, s2.substr(j, 1), pos);
if(found == string::npos)
return false;
pos += found + 1;
@ -303,6 +290,14 @@ namespace BSPF
}
}
// Trim leading and trailing whitespace from a string
inline string trim(const string& str)
{
string::size_type first = str.find_first_not_of(' ');
return (first == string::npos) ? EmptyString :
str.substr(first, str.find_last_not_of(' ')-first+1);
}
// C++11 way to get local time
// Equivalent to the C-style localtime() function, but is thread-safe
inline std::tm localTime()

View File

@ -18,15 +18,6 @@
#include "KeyValueRepositoryConfigfile.hxx"
#include "Logger.hxx"
namespace {
string trim(const string& str)
{
string::size_type first = str.find_first_not_of(' ');
return (first == string::npos) ? EmptyString :
str.substr(first, str.find_last_not_of(' ')-first+1);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyValueRepositoryConfigfile::KeyValueRepositoryConfigfile(const FilesystemNode& file)
: myFile{file}
@ -67,8 +58,8 @@ std::map<string, Variant> KeyValueRepositoryConfigfile::load()
continue;
// Split the line into key/value pairs and trim any whitespace
key = trim(line.substr(0, equalPos));
value = trim(line.substr(equalPos + 1, line.length() - key.length() - 1));
key = BSPF::trim(line.substr(0, equalPos));
value = BSPF::trim(line.substr(equalPos + 1, line.length() - key.length() - 1));
// Skip absent key
if(key.length() == 0)

View File

@ -739,8 +739,10 @@ inline bool FrameBuffer::drawMessage()
if(myMsg.dirty)
{
#ifdef DEBUG_BUILD
cerr << "m";
//cerr << "--- draw message ---" << endl;
#endif
// Draw the bounded box and text
const Common::Rect& dst = myMsg.surface->dstRect();

View File

@ -116,20 +116,6 @@ class Settings
void setPermanent(const string& key, const Variant& value);
void setTemporary(const string& key, const Variant& value);
// Trim leading and following whitespace from a string
static string trim(const string& str)
{
string::size_type first = str.find_first_not_of(' ');
return (first == string::npos) ? EmptyString :
str.substr(first, str.find_last_not_of(' ')-first+1);
}
// FIXME - Rework so that these aren't needed; hence no commenting added
const Options& getPermanentSettings() const
{ return myPermanentSettings; }
const Options& getTemporarySettings() const
{ return myTemporarySettings; }
private:
/**
This method must be called *after* settings have been fully loaded

View File

@ -143,7 +143,7 @@ Common::Rect CheckListWidget::getEditRect() const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CheckListWidget::getState(int line)
bool CheckListWidget::getState(int line) const
{
if(line >= 0 && line < int(_stateList.size()))
return _stateList[line];

View File

@ -39,8 +39,8 @@ class CheckListWidget : public ListWidget
void setList(const StringList& list, const BoolArray& state);
void setLine(int line, const string& str, const bool& state);
bool getState(int line);
bool getSelectedState() { return getState(_selectedItem); }
bool getState(int line) const;
bool getSelectedState() const { return getState(_selectedItem); }
private:
bool handleEvent(Event::Type e) override;

View File

@ -28,8 +28,8 @@ ColorWidget::ColorWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, int cmd, bool framed)
: Widget(boss, font, x, y, w, h),
CommandSender(boss),
_framed(framed),
_cmd(cmd)
_framed{framed},
_cmd{cmd}
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS;
}

View File

@ -48,7 +48,7 @@ class CommandSender
// and add methods addTarget/removeTarget.
public:
explicit CommandSender(CommandReceiver* target)
: _target(target) { }
: _target{target} { }
virtual ~CommandSender() = default;

View File

@ -31,9 +31,9 @@ ContextMenu::ContextMenu(GuiObject* boss, const GUI::Font& font,
const VariantList& items, int cmd, int width)
: Dialog(boss->instance(), boss->parent(), font),
CommandSender(boss),
_rowHeight(font.getLineHeight()),
_cmd(cmd),
_maxWidth(width)
_rowHeight{font.getLineHeight()},
_cmd{cmd},
_maxWidth{width}
{
setArrows();
addItems(items);

View File

@ -130,7 +130,7 @@ class ContextMenu : public Dialog, public CommandSender
int _id{-1};
uInt32 _xorig{0}, _yorig{0};
uInt32 _maxWidth{0};
int _maxWidth{0};
int _textOfs{0};
int _arrowSize{0};

View File

@ -148,7 +148,7 @@ class DeveloperDialog : public Dialog
CheckboxWidget* myGhostReadsTrapWidget{nullptr};
#endif
bool mySettings;
bool mySettings{false};
// Emulator sets
std::array<bool, 2> myFrameStats;
std::array<bool, 2> myDetectedInfo;

View File

@ -49,8 +49,8 @@
Dialog::Dialog(OSystem& instance, DialogContainer& parent, const GUI::Font& font,
const string& title, int x, int y, int w, int h)
: GuiObject(instance, parent, *this, x, y, w, h),
_font(font),
_title(title)
_font{font},
_title{title}
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_BORDER | Widget::FLAG_CLEARBG;
setTitle(title);
@ -244,7 +244,9 @@ void Dialog::redraw(bool force)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::render()
{
#ifdef DEBUG_BUILD
//cerr << " render " << typeid(*this).name() << endl;
#endif
// Update dialog surface; also render any extra surfaces
// Extra surfaces must be rendered afterwards, so they are drawn on top
@ -263,8 +265,6 @@ void Dialog::render()
if(!onTop)
{
//cerr << " shade " << typeid(*this).name() << endl;
_shadeSurface->setDstRect(_surface->dstRect());
_shadeSurface->render();
}
@ -433,8 +433,10 @@ void Dialog::drawDialog()
if(isDirty())
{
cerr << endl << "d";
#ifdef DEBUG_BUILD
//cerr << "*** draw dialog " << typeid(*this).name() << " ***" << endl;
cerr << endl << "d";
#endif
if(clearsBackground())
{
@ -453,7 +455,9 @@ void Dialog::drawDialog()
}
else {
s.invalidate();
#ifdef DEBUG_BUILD
//cerr << "invalidate " << typeid(*this).name() << endl;
#endif
}
if(hasBorder()) // currently only used by Dialog itself
s.frameRect(_x, _y, _w, _h, kColor);
@ -463,8 +467,10 @@ void Dialog::drawDialog()
clearDirty();
}
#ifdef DEBUG_BUILD
else
cerr << endl;
#endif
// Draw all children
drawChain();

View File

@ -213,7 +213,7 @@ class Dialog : public GuiObject
Widget* widget{nullptr};
WidgetArray list;
explicit Focus(Widget* w = nullptr) : widget(w) { }
explicit Focus(Widget* w = nullptr) : widget{w} { }
};
using FocusList = vector<Focus>;
@ -222,7 +222,7 @@ class Dialog : public GuiObject
FocusList focus;
uInt32 currentTab{0};
explicit TabFocus(TabWidget* w = nullptr) : widget(w) { }
explicit TabFocus(TabWidget* w = nullptr) : widget{w} { }
void appendFocusList(WidgetArray& list);
void saveCurrentFocus(Widget* w);

View File

@ -28,7 +28,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DialogContainer::DialogContainer(OSystem& osystem)
: myOSystem(osystem)
: myOSystem{osystem}
{
_DOUBLE_CLICK_DELAY = osystem.settings().getInt("mdouble");
_REPEAT_INITIAL_DELAY = osystem.settings().getInt("ctrldelay");
@ -94,8 +94,9 @@ void DialogContainer::draw(bool full)
{
if(myDialogStack.empty())
return;
#ifdef DEBUG_BUILD
//cerr << "draw " << full << " " << typeid(*this).name() << endl;
#endif
// Draw and render all dirty dialogs
myDialogStack.applyAll([&](Dialog*& d) {
@ -118,8 +119,9 @@ void DialogContainer::render()
{
if(myDialogStack.empty())
return;
#ifdef DEBUG_BUILD
//cerr << "full re-render " << typeid(*this).name() << endl;
#endif
// Make sure we start in a clean state (with zero'ed buffers)
if(!myOSystem.eventHandler().inTIAMode())
@ -171,7 +173,9 @@ void DialogContainer::removeDialog()
{
if(!myDialogStack.empty())
{
#ifdef DEBUG_BUILD
//cerr << "remove dialog " << typeid(*myDialogStack.top()).name() << endl;
#endif
myDialogStack.pop();
// Inform the frame buffer that it has to render all surfaces

View File

@ -40,7 +40,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
EventMode mode)
: Widget(boss, font, x, y, w, h),
CommandSender(boss),
myEventMode(mode)
myEventMode{mode}
{
const int fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(),

View File

@ -28,7 +28,7 @@
FileListWidget::FileListWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h)
: StringListWidget(boss, font, x, y, w, h),
_filter([](const FilesystemNode& node) { return true; })
_filter{[](const FilesystemNode& node) { return true; }}
{
// This widget is special, in that it catches signals and redirects them
setTarget(this);

View File

@ -89,7 +89,7 @@ class FileListWidget : public StringListWidget
const FilesystemNode& currentDir() const { return _node; }
static void setQuickSelectDelay(uInt64 time) { _QUICK_SELECT_DELAY = time; }
uInt64 getQuickSelectDelay() { return _QUICK_SELECT_DELAY; }
uInt64 getQuickSelectDelay() const { return _QUICK_SELECT_DELAY; }
ProgressDialog& progress();
void incProgress();

View File

@ -26,7 +26,7 @@ namespace GUI {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Font::Font(const FontDesc& desc)
: myFontDesc(desc)
: myFontDesc{desc}
{
}

View File

@ -92,7 +92,7 @@ GameInfoDialog::GameInfoDialog(
myTab->setActiveTab(0);
// Add Defaults, OK and Cancel buttons
addDefaultsOKCancelBGroup(wid, font);
addDefaultsExtraOKCancelBGroup(wid, font, "Save", kSavePressed);
addBGroupToFocusList(wid);
}

View File

@ -70,10 +70,10 @@ class GuiObject : public CommandReceiver
public:
GuiObject(OSystem& osystem, DialogContainer& parent, Dialog& dialog,
int x, int y, int w, int h)
: myOSystem(osystem),
myParent(parent),
myDialog(dialog),
_x(x), _y(y), _w(w), _h(h) { }
: myOSystem{osystem},
myParent{parent},
myDialog{dialog},
_x{x}, _y{y}, _w{w}, _h{h} { }
~GuiObject() override = default;

View File

@ -35,7 +35,6 @@ class Serializer;
using json = nlohmann::json;
/**
The dialog for displaying high scores in Stella.

View File

@ -41,8 +41,8 @@
InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, font, "Input settings"),
myMaxWidth(max_w),
myMaxHeight(max_h)
myMaxWidth{max_w},
myMaxHeight{max_h}
{
const int lineHeight = _font.getLineHeight(),
fontWidth = _font.getMaxCharWidth(),

View File

@ -28,7 +28,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Launcher::Launcher(OSystem& 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;

View File

@ -28,7 +28,7 @@
ListWidget::ListWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, bool useScrollbar)
: EditableWidget(boss, font, x, y, 16, 16),
_useScrollbar(useScrollbar)
_useScrollbar{useScrollbar}
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS;
_bgcolor = kWidColor;

View File

@ -33,8 +33,8 @@ MessageBox::MessageBox(GuiObject* boss, const GUI::Font& font,
bool focusOKButton)
: Dialog(boss->instance(), boss->parent(), font, title, 0, 0, max_w, max_h),
CommandSender(boss),
myOkCmd(okCmd),
myCancelCmd(cancelCmd)
myOkCmd{okCmd},
myCancelCmd{cancelCmd}
{
addText(font, text);

View File

@ -82,6 +82,7 @@ void MessageDialog::setMessage(const string& title, const string& text, bool yes
setMessage(title, StringParser(text).stringList(), yesNo);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string MessageDialog::myTitle = "";
StringList MessageDialog::myText;
bool MessageDialog::myYesNo = false;

View File

@ -26,36 +26,36 @@ class OSystem;
class MessageDialog : public Dialog
{
public:
MessageDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h);
~MessageDialog() override;
public:
MessageDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h);
~MessageDialog() override;
// Define the message displayed
void setMessage(const string& title, const string& text, bool yesNo = false);
void setMessage(const string& title, const StringList& text, bool yesNo = false);
bool confirmed() { return myConfirmed; }
// Define the message displayed
void setMessage(const string& title, const string& text, bool yesNo = false);
void setMessage(const string& title, const StringList& text, bool yesNo = false);
bool confirmed() { return myConfirmed; }
protected:
void loadConfig() override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
protected:
void loadConfig() override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
private:
static string myTitle;
static StringList myText;
static bool myYesNo;
static bool myConfirmed;
private:
static string myTitle;
static StringList myText;
static bool myYesNo;
static bool myConfirmed;
// Show a message
GUI::MessageBox* myMsg{nullptr};
// Show a message
GUI::MessageBox* myMsg{nullptr};
private:
// Following constructors and assignment operators not supported
MessageDialog() = delete;
MessageDialog(const MessageDialog&) = delete;
MessageDialog(MessageDialog&&) = delete;
MessageDialog& operator=(const MessageDialog&) = delete;
MessageDialog& operator=(MessageDialog&&) = delete;
private:
// Following constructors and assignment operators not supported
MessageDialog() = delete;
MessageDialog(const MessageDialog&) = delete;
MessageDialog(MessageDialog&&) = delete;
MessageDialog& operator=(const MessageDialog&) = delete;
MessageDialog& operator=(MessageDialog&&) = delete;
};
#endif

View File

@ -49,8 +49,8 @@
OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
GuiObject* boss, int max_w, int max_h, Menu::AppMode mode)
: Dialog(osystem, parent, osystem.frameBuffer().font(), "Options"),
myBoss(boss),
myMode(mode)
myBoss{boss},
myMode{mode}
{
// do not show basic settings options in debugger
bool minSettings = osystem.settings().getBool("minimal_ui") && mode != Menu::AppMode::debugger;

View File

@ -71,7 +71,7 @@ class OptionsDialog : public Dialog
ButtonWidget* myGameInfoButton{nullptr};
ButtonWidget* myCheatCodeButton{nullptr};
GuiObject* myBoss;
GuiObject* myBoss{nullptr};
// Indicates if this dialog is used for global (vs. in-game) settings
Menu::AppMode myMode{Menu::AppMode::emulator};

View File

@ -29,8 +29,8 @@ PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, const VariantList& list,
const string& label, int labelWidth, int cmd)
: EditableWidget(boss, font, x, y - 1, w, h + 2),
_label(label),
_labelWidth(labelWidth)
_label{label},
_labelWidth{labelWidth}
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_RETAIN_FOCUS
| Widget::FLAG_TRACK_MOUSE;
@ -247,7 +247,6 @@ void PopUpWidget::setArrow()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PopUpWidget::drawWidget(bool hilite)
{
//cerr << "PopUpWidget::drawWidget\n";
FBSurface& s = dialog().surface();
int x = _x + _labelWidth;

View File

@ -30,7 +30,7 @@
ProgressDialog::ProgressDialog(GuiObject* boss, const GUI::Font& font,
const string& message)
: Dialog(boss->instance(), boss->parent()),
myFont(font)
myFont{font}
{
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),

View File

@ -29,7 +29,7 @@
QuadTariDialog::QuadTariDialog(GuiObject* boss, const GUI::Font& font, int max_w, int max_h,
Properties& properties)
: Dialog(boss->instance(), boss->parent(), font, "QuadTari controllers", 0, 0, max_w, max_h),
myGameProperties(properties)
myGameProperties{properties}
{
const int lineHeight = font.getLineHeight(),
fontHeight = font.getFontHeight(),

View File

@ -221,8 +221,8 @@ 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),
_buttonSize(buttonSize(font)) // 14 | 22
myGroup{group},
_buttonSize{buttonSize(font)} // 14 | 22
{
_flags = Widget::FLAG_ENABLED;
_bgcolor = _bgcolorhi = kWidColor;

View File

@ -40,7 +40,7 @@ class RadioButtonWidget : public CheckboxWidget
protected:
void setFill(FillType type);
void drawWidget(bool hilite) override;
static int buttonSize(const GUI::Font& font)
static uInt32 buttonSize(const GUI::Font& font)
{
return font.getFontHeight() < 24 ? 14 : 22; // box is square
}

View File

@ -37,9 +37,9 @@
RomAuditDialog::RomAuditDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, font, "Audit ROMs"),
myFont(font),
myMaxWidth(max_w),
myMaxHeight(max_h)
myFont{font},
myMaxWidth{max_w},
myMaxHeight{max_h}
{
const int lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth(),

View File

@ -37,7 +37,7 @@ RomInfoWidget::RomInfoWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h,
const Common::Size& imgSize)
: Widget(boss, font, x, y, w, h),
myAvail(imgSize)
myAvail{imgSize}
{
_flags = Widget::FLAG_ENABLED;
_bgcolor = kDlgColor;

View File

@ -29,7 +29,7 @@
SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, font, "Snapshot settings"),
myFont(font)
myFont{font}
{
const int lineHeight = font.getLineHeight(),
fontHeight = _font.getFontHeight(),

View File

@ -32,7 +32,7 @@
StellaSettingsDialog::StellaSettingsDialog(OSystem& osystem, DialogContainer& parent,
int max_w, int max_h, Menu::AppMode mode)
: Dialog(osystem, parent, osystem.frameBuffer().font(), "Basic settings"),
myMode(mode)
myMode{mode}
{
const int buttonHeight = _font.getLineHeight() + _font.getLineHeight() / 5,
lineHeight = _font.getLineHeight(),

View File

@ -27,7 +27,7 @@ StringListWidget::StringListWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, bool hilite,
bool useScrollbar)
: ListWidget(boss, font, x, y, w, h, useScrollbar),
_hilite(hilite)
_hilite{hilite}
{
_bgcolorlo = kDlgColor;

View File

@ -83,7 +83,7 @@ class TabWidget : public Widget, public CommandSender
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) { }
: title{t}, firstWidget{first}, parentWidget{parent}, enabled{e}, tabWidth{tw} { }
};
using TabList = vector<Tab>;

View File

@ -33,7 +33,7 @@ TimeLineWidget::TimeLineWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h,
const string& label, uInt32 labelWidth, int cmd)
: ButtonWidget(boss, font, x, y, w, h, label, cmd),
_labelWidth(labelWidth)
_labelWidth{labelWidth}
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_TRACK_MOUSE
| Widget::FLAG_CLEARBG | Widget::FLAG_NOBG;
@ -143,8 +143,6 @@ void TimeLineWidget::drawWidget(bool hilite)
{
FBSurface& s = _boss->dialog().surface();
//cerr << "TimeLineWidget::drawWidget " << typeid(s).name() << endl;
// Draw the label, if any
if(_labelWidth > 0)
s.drawString(_font, _label, _x, _y + 2, _labelWidth,
@ -205,13 +203,13 @@ void TimeLineWidget::drawWidget(bool hilite)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 TimeLineWidget::valueToPos(uInt32 value)
uInt32 TimeLineWidget::valueToPos(uInt32 value) const
{
return _stepValue[BSPF::clamp(value, _valueMin, _valueMax)];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 TimeLineWidget::posToValue(uInt32 pos)
uInt32 TimeLineWidget::posToValue(uInt32 pos) const
{
// Find the interval in which 'pos' falls, and then the endpoint which
// it is closest to

View File

@ -49,8 +49,8 @@ class TimeLineWidget : public ButtonWidget
void drawWidget(bool hilite) override;
uInt32 valueToPos(uInt32 value);
uInt32 posToValue(uInt32 pos);
uInt32 valueToPos(uInt32 value) const;
uInt32 posToValue(uInt32 pos) const;
protected:
uInt32 _value{0};

View File

@ -23,7 +23,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TimeMachine::TimeMachine(OSystem& osystem)
: DialogContainer(osystem),
myWidth(FBMinimum::Width)
myWidth{FBMinimum::Width}
{
myBaseDialog = new TimeMachineDialog(myOSystem, *this, myWidth);
}

View File

@ -487,7 +487,7 @@ void TimeMachineDialog::initBar()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string TimeMachineDialog::getTimeString(uInt64 cycles)
string TimeMachineDialog::getTimeString(uInt64 cycles) const
{
const Int32 scanlines = std::max<Int32>(instance().console().tia().scanlinesLastFrame(), 240);
const bool isNTSC = scanlines <= 287;

View File

@ -33,7 +33,7 @@ class TimeMachineDialog : public Dialog
/** set/get number of winds when entering the dialog */
void setEnterWinds(Int32 numWinds) { _enterWinds = numWinds; }
Int32 getEnterWinds() { return _enterWinds; }
Int32 getEnterWinds() const { return _enterWinds; }
private:
void loadConfig() override;
@ -48,7 +48,7 @@ class TimeMachineDialog : public Dialog
void setPosition() override;
/** convert cycles into time */
string getTimeString(uInt64 cycles);
string getTimeString(uInt64 cycles) const;
/** re/unwind and update display */
void handleWinds(Int32 numWinds = 0);
/** toggle Time Machine mode */

View File

@ -27,7 +27,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ToolTip::ToolTip(Dialog& dialog, const GUI::Font& font)
: myDialog(dialog)
: myDialog{dialog}
{
myScale = myDialog.instance().frameBuffer().hidpiScaleFactor();
@ -179,5 +179,5 @@ void ToolTip::show(const string& tip)
void ToolTip::render()
{
if(myTipShown)
mySurface->render();
mySurface->render();
}

View File

@ -42,8 +42,8 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, GuiObject* boss, int max_w, int max_h)
: Dialog(osystem, parent, font, "User interface settings"),
CommandSender(boss),
myFont(font),
myIsGlobal(boss != nullptr)
myFont{font},
myIsGlobal{boss != nullptr}
{
const GUI::Font& ifont = instance().frameBuffer().infoFont();
const int lineHeight = font.getLineHeight(),

View File

@ -19,7 +19,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
UndoHandler::UndoHandler(size_t size)
: mySize(size)
: mySize{size}
{
reset();
}

View File

@ -66,7 +66,7 @@ class VideoAudioDialog : public Dialog
void updateSettingsWithPreset(AudioSettings&);
private:
TabWidget* myTab;
TabWidget* myTab{nullptr};
// General options
PopUpWidget* myRenderer{nullptr};

View File

@ -32,8 +32,8 @@
Widget::Widget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h)
: GuiObject(boss->instance(), boss->parent(), boss->dialog(), x, y, w, h),
_boss(boss),
_font(font)
_boss{boss},
_font{font}
{
// Insert into the widget list of the boss
_next = _boss->_firstWidget;
@ -99,8 +99,10 @@ void Widget::draw()
if(isDirty())
{
#ifdef DEBUG_BUILD
//cerr << " *** draw widget " << typeid(*this).name() << " ***" << endl;
cerr << "w";
#endif
FBSurface& s = _boss->dialog().surface();
int oldX = _x, oldY = _y;
@ -383,7 +385,9 @@ void Widget::setDirtyInChain(Widget* start)
{
while(start)
{
#ifdef DEBUG_BUILD
//cerr << "setDirtyInChain " << typeid(*start).name() << endl;
#endif
start->setDirty();
start = start->_next;
}
@ -395,8 +399,8 @@ StaticTextWidget::StaticTextWidget(GuiObject* boss, const GUI::Font& font,
const string& text, TextAlign align,
ColorId shadowColor)
: Widget(boss, font, x, y, w, h),
_label(text),
_align(align)
_label{text},
_align{align}
{
_flags = Widget::FLAG_ENABLED | FLAG_CLEARBG;
@ -464,8 +468,8 @@ ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font,
const string& label, int cmd, bool repeat)
: StaticTextWidget(boss, font, x, y, w, h, label, TextAlign::Center),
CommandSender(boss),
_cmd(cmd),
_repeat(repeat)
_cmd{cmd},
_repeat{repeat}
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG;
_bgcolor = kBtnColor;
@ -739,11 +743,11 @@ SliderWidget::SliderWidget(GuiObject* boss, const GUI::Font& font,
int valueLabelWidth, const string& valueUnit, int valueLabelGap,
bool forceLabelSign)
: ButtonWidget(boss, font, x, y, w, h, label, cmd),
_labelWidth(labelWidth),
_valueUnit(valueUnit),
_valueLabelGap(valueLabelGap),
_valueLabelWidth(valueLabelWidth),
_forceLabelSign(forceLabelSign)
_labelWidth{labelWidth},
_valueUnit{valueUnit},
_valueLabelGap{valueLabelGap},
_valueLabelWidth{valueLabelWidth},
_forceLabelSign{forceLabelSign}
{
_flags = Widget::FLAG_ENABLED | Widget::FLAG_TRACK_MOUSE | Widget::FLAG_CLEARBG;
_bgcolor = kDlgColor;

View File

@ -64,7 +64,7 @@ class FBSurfaceLIBRETRO : public FBSurface
void applyAttributes() override { }
private:
uInt32 myWidth, myHeight;
uInt32 myWidth{0}, myHeight{0};
unique_ptr<uInt32[]> myPixelData;
Common::Rect mySrcGUIR, myDstGUIR;

View File

@ -101,7 +101,7 @@ else ifeq ($(platform), libnx)
include $(DEVKITPRO)/libnx/switch_rules
TARGET := $(TARGET_NAME)_libretro_$(platform).a
DEFINES := -DSWITCH=1 -D__SWITCH__ -DARM
CXXFLAGS := $(DEFINES) -fPIE -I$(LIBNX)/include/ -ffunction-sections -fdata-sections -ftls-model=local-exec -specs=$(LIBNX)/switch.specs
CXXFLAGS += $(DEFINES) -fPIE -I$(LIBNX)/include/ -ffunction-sections -fdata-sections -ftls-model=local-exec -specs=$(LIBNX)/switch.specs
CXXFLAGS += -march=armv8-a -mtune=cortex-a57 -mtp=soft -mcpu=cortex-a57+crc+fp+simd -ffast-math $(ASFLAGS)
STATIC_LINKING = 1

View File

@ -43,7 +43,7 @@ class StellaLIBRETRO
StellaLIBRETRO();
public:
OSystemLIBRETRO& osystem() { return *myOSystem; }
OSystemLIBRETRO& osystem() const { return *myOSystem; }
bool create(bool logging);
void destroy();

View File

@ -25,8 +25,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodePOSIX::FilesystemNodePOSIX()
: _path(ROOT_DIR),
_displayName(_path)
: _path{ROOT_DIR},
_displayName{_path}
{
}

View File

@ -175,7 +175,7 @@ FilesystemNodeWINDOWS::FilesystemNodeWINDOWS()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeWINDOWS::FilesystemNodeWINDOWS(const string& p)
: _path(p.length() > 0 ? p : "~") // Default to home directory
: _path{p.length() > 0 ? p : "~"} // Default to home directory
{
// Expand '~' to the users 'home' directory
if(_path[0] == '~')