diff --git a/src/common/AudioSettings.cxx b/src/common/AudioSettings.cxx index 640ba9527..6f67d3d0a 100644 --- a/src/common/AudioSettings.cxx +++ b/src/common/AudioSettings.cxx @@ -43,8 +43,7 @@ namespace { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AudioSettings::AudioSettings(Settings& settings) - : mySettings(settings), - myIsPersistent(true) + : mySettings(settings) { setPreset(normalizedPreset(mySettings.getInt(SETTING_PRESET))); } diff --git a/src/common/AudioSettings.hxx b/src/common/AudioSettings.hxx index d319671c3..1e9f0477f 100644 --- a/src/common/AudioSettings.hxx +++ b/src/common/AudioSettings.hxx @@ -131,13 +131,13 @@ class AudioSettings Preset myPreset; - uInt32 myPresetSampleRate; - uInt32 myPresetFragmentSize; - uInt32 myPresetBufferSize; - uInt32 myPresetHeadroom; + uInt32 myPresetSampleRate{0}; + uInt32 myPresetFragmentSize{0}; + uInt32 myPresetBufferSize{0}; + uInt32 myPresetHeadroom{0}; ResamplingQuality myPresetResamplingQuality; - bool myIsPersistent; + bool myIsPersistent{true}; }; #endif // AUDIO_PARAMTERS_HXX diff --git a/src/common/FpsMeter.cxx b/src/common/FpsMeter.cxx index be945e9e2..878a42ae0 100644 --- a/src/common/FpsMeter.cxx +++ b/src/common/FpsMeter.cxx @@ -19,12 +19,14 @@ using namespace std::chrono; +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FpsMeter::FpsMeter(uInt32 queueSize) : myQueue(queueSize) { reset(); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void FpsMeter::reset(uInt32 garbageFrameLimit) { myQueue.clear(); @@ -35,6 +37,7 @@ void FpsMeter::reset(uInt32 garbageFrameLimit) myGarbageFrameLimit = garbageFrameLimit; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void FpsMeter::render(uInt32 frameCount) { if (myGarbageFrameCounter < myGarbageFrameLimit) { @@ -67,6 +70,7 @@ void FpsMeter::render(uInt32 frameCount) if (myTimeInterval > 0) myFps = (myFrameCount - first.frames) / myTimeInterval; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - float FpsMeter::fps() const { return myFps; diff --git a/src/common/PJoystickHandler.cxx b/src/common/PJoystickHandler.cxx index 323caea1c..e38fbf813 100644 --- a/src/common/PJoystickHandler.cxx +++ b/src/common/PJoystickHandler.cxx @@ -217,7 +217,7 @@ void PhysicalJoystickHandler::mapStelladaptors(const string& saport) // We know there will be only two such devices (at most), since the logic // in setupJoysticks take care of that int saCount = 0; - int saOrder[NUM_PORTS] = { 1, 2 }; + int saOrder[] = { 1, 2 }; if(BSPF::equalsIgnoreCase(saport, "rl")) { saOrder[0] = 2; saOrder[1] = 1; diff --git a/src/common/PaletteHandler.cxx b/src/common/PaletteHandler.cxx index f13c18ab1..aa66f5985 100644 --- a/src/common/PaletteHandler.cxx +++ b/src/common/PaletteHandler.cxx @@ -22,6 +22,7 @@ #include "PaletteHandler.hxx" +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PaletteHandler::PaletteHandler(OSystem& system) : myOSystem(system) { diff --git a/src/common/PhosphorHandler.hxx b/src/common/PhosphorHandler.hxx index efc77cf58..89d0df3a9 100644 --- a/src/common/PhosphorHandler.hxx +++ b/src/common/PhosphorHandler.hxx @@ -38,7 +38,7 @@ class PhosphorHandler @return Averaged value of the two RGB colors */ - static inline uInt32 getPixel(const uInt32 c, const uInt32 p) + static constexpr uInt32 getPixel(const uInt32 c, const uInt32 p) { // Mix current calculated frame with previous displayed frame const uInt8 rc = static_cast(c >> 16), diff --git a/src/common/tv_filters/AtariNTSC.hxx b/src/common/tv_filters/AtariNTSC.hxx index eb75bce3d..087e7c579 100644 --- a/src/common/tv_filters/AtariNTSC.hxx +++ b/src/common/tv_filters/AtariNTSC.hxx @@ -232,7 +232,7 @@ class AtariNTSC } // Common ntsc macros - static inline constexpr void ATARI_NTSC_CLAMP( uInt32& io, uInt32 shift ) { + static constexpr void ATARI_NTSC_CLAMP( uInt32& io, uInt32 shift ) { uInt32 sub = io >> (9-(shift)) & atari_ntsc_clamp_mask; uInt32 clamp = atari_ntsc_clamp_add - sub; io |= clamp; @@ -240,31 +240,31 @@ class AtariNTSC io &= clamp; } - static inline constexpr void RGB_TO_YIQ(float r, float g, float b, + static constexpr void RGB_TO_YIQ(float r, float g, float b, float& y, float& i, float& q) { y = r * 0.299F + g * 0.587F + b * 0.114F; i = r * 0.595716F - g * 0.274453F - b * 0.321263F; q = r * 0.211456F - g * 0.522591F + b * 0.311135F; } - static inline constexpr void YIQ_TO_RGB(float y, float i, float q, + static constexpr void YIQ_TO_RGB(float y, float i, float q, const float* to_rgb, int& ir, int& ig, int& ib) { ir = static_cast(y + to_rgb[0] * i + to_rgb[1] * q); ig = static_cast(y + to_rgb[2] * i + to_rgb[3] * q); ib = static_cast(y + to_rgb[4] * i + to_rgb[5] * q); } - static inline constexpr uInt32 PACK_RGB( int r, int g, int b ) { + static constexpr uInt32 PACK_RGB( int r, int g, int b ) { return r << 21 | g << 11 | b << 1; } // Converted from C-style macros; I don't even pretend to understand the logic here :) - static inline constexpr int PIXEL_OFFSET1( int ntsc, int scaled ) { + static constexpr int PIXEL_OFFSET1( int ntsc, int scaled ) { return (kernel_size / 2 + ((ntsc) - (scaled) / rescale_out * rescale_in) + ((((scaled) + rescale_out * 10) % rescale_out) != 0) + (rescale_out - (((scaled) + rescale_out * 10) % rescale_out)) % rescale_out + (kernel_size * 2 * (((scaled) + rescale_out * 10) % rescale_out))); } - static inline constexpr int PIXEL_OFFSET2( int ntsc ) { + static constexpr int PIXEL_OFFSET2( int ntsc ) { return 1.0F - (((ntsc) + 100) & 2); } diff --git a/src/debugger/BreakpointMap.hxx b/src/debugger/BreakpointMap.hxx index 492f4ef10..9a77bf8c3 100644 --- a/src/debugger/BreakpointMap.hxx +++ b/src/debugger/BreakpointMap.hxx @@ -30,12 +30,12 @@ class BreakpointMap { private: - static const uInt16 ADDRESS_MASK = 0x1fff; // either 0x1fff or 0xffff (not needed then) + static constexpr uInt16 ADDRESS_MASK = 0x1fff; // either 0x1fff or 0xffff (not needed then) public: // breakpoint flags - static const uInt32 ONE_SHOT = 1 << 0; // used for 'trace' command - static const uInt8 ANY_BANK = 255; // breakpoint valid in any bank + static constexpr uInt32 ONE_SHOT = 1 << 0; // used for 'trace' command + static constexpr uInt8 ANY_BANK = 255; // breakpoint valid in any bank struct Breakpoint { diff --git a/src/debugger/Debugger.hxx b/src/debugger/Debugger.hxx index 6a53238bb..f937d2b52 100644 --- a/src/debugger/Debugger.hxx +++ b/src/debugger/Debugger.hxx @@ -76,9 +76,6 @@ class Debugger : public DialogContainer Debugger(OSystem& osystem, Console& console); ~Debugger() override; - private: - static const Int8 ANY_BANK = -1; - public: /** Initialize the debugger dialog container. @@ -284,8 +281,6 @@ class Debugger : public DialogContainer */ Dialog* baseDialog() override { return myDialog; } - static const Int32 NOT_FOUND = -1; - private: /** Save state of each debugger subsystem and, by default, mark all @@ -367,6 +362,8 @@ class Debugger : public DialogContainer static std::array ourBuiltinFunctions; static std::array ourPseudoRegisters; + static constexpr Int8 ANY_BANK = -1; + private: // rewind/unwind n states uInt16 windStates(uInt16 numStates, bool unwind, string& message); diff --git a/src/emucore/EventHandlerConstants.hxx b/src/emucore/EventHandlerConstants.hxx index b67df420f..a736d5f95 100644 --- a/src/emucore/EventHandlerConstants.hxx +++ b/src/emucore/EventHandlerConstants.hxx @@ -74,8 +74,6 @@ enum JoyHatMask { EVENT_HATCENTER_M = 1<<4 }; -static const int NUM_PORTS = 2; - enum class EventMode { kEmulationMode, // active mapping used for emulation kMenuMode, // mapping used for dialogs diff --git a/src/gui/DeveloperDialog.hxx b/src/gui/DeveloperDialog.hxx index e3d31ecfd..fc16e302e 100644 --- a/src/gui/DeveloperDialog.hxx +++ b/src/gui/DeveloperDialog.hxx @@ -81,10 +81,10 @@ class DeveloperDialog : public Dialog enum SettingsSet { player = 0, developer = 1 }; // MUST be aligned with RewindManager! - static const int NUM_INTERVALS = 7; - static const int NUM_HORIZONS = 8; + static constexpr int NUM_INTERVALS = 7; + static constexpr int NUM_HORIZONS = 8; - static const int DEBUG_COLORS = 6; + static constexpr int DEBUG_COLORS = 6; TabWidget* myTab{nullptr}; // Emulator widgets diff --git a/src/gui/TabWidget.hxx b/src/gui/TabWidget.hxx index 141b29497..9d6f0837d 100644 --- a/src/gui/TabWidget.hxx +++ b/src/gui/TabWidget.hxx @@ -26,8 +26,8 @@ class TabWidget : public Widget, public CommandSender { public: - static const int NO_WIDTH = 0; - static const int AUTO_WIDTH = -1; + static constexpr int NO_WIDTH = 0; + static constexpr int AUTO_WIDTH = -1; enum { kTabChangedCmd = 'TBCH'