From 54de3415ea8f30ab59be171f81170722d87ed8a0 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sun, 29 Dec 2019 18:36:56 -0330 Subject: [PATCH 1/5] More default initialization updates, in the process making c'tors smaller/non-existent. I've already found a few potential bugs where instance variables weren't being initialized at all. --- src/common/tv_filters/AtariNTSC.hxx | 8 +- src/debugger/gui/AudioWidget.hxx | 8 +- src/debugger/gui/BoosterWidget.hxx | 2 +- src/debugger/gui/Cart0840Widget.hxx | 2 +- src/debugger/gui/Cart3EPlusWidget.hxx | 8 +- src/debugger/gui/Cart3EWidget.hxx | 6 +- src/debugger/gui/Cart3FWidget.hxx | 2 +- src/debugger/gui/Cart4A50Widget.hxx | 6 +- src/debugger/gui/CartARWidget.hxx | 2 +- src/debugger/gui/CartBFSCWidget.hxx | 4 +- src/debugger/gui/CartBFWidget.hxx | 2 +- src/debugger/gui/CartBUSWidget.hxx | 30 ++++---- src/debugger/gui/CartCDFWidget.hxx | 32 ++++---- src/debugger/gui/CartCMWidget.hxx | 21 ++--- src/debugger/gui/CartCTYWidget.hxx | 4 +- src/debugger/gui/CartCVPlusWidget.hxx | 4 +- src/debugger/gui/CartDASHWidget.hxx | 8 +- src/debugger/gui/CartDFSCWidget.hxx | 4 +- src/debugger/gui/CartDFWidget.hxx | 2 +- src/debugger/gui/CartDPCPlusWidget.hxx | 30 ++++---- src/debugger/gui/CartDPCWidget.hxx | 18 ++--- src/debugger/gui/CartDebugWidget.cxx | 5 +- src/debugger/gui/CartDebugWidget.hxx | 4 +- src/debugger/gui/CartE0Widget.hxx | 2 +- src/debugger/gui/CartEFSCWidget.hxx | 4 +- src/debugger/gui/CartEFWidget.hxx | 2 +- src/debugger/gui/CartF0Widget.hxx | 2 +- src/debugger/gui/CartF4SCWidget.hxx | 4 +- src/debugger/gui/CartF4Widget.hxx | 2 +- src/debugger/gui/CartF6SCWidget.hxx | 4 +- src/debugger/gui/CartF6Widget.hxx | 2 +- src/debugger/gui/CartF8SCWidget.hxx | 4 +- src/debugger/gui/CartF8Widget.hxx | 2 +- src/debugger/gui/CartFA2Widget.hxx | 6 +- src/debugger/gui/CartFAWidget.hxx | 4 +- src/debugger/gui/CartFCWidget.cxx | 5 +- src/debugger/gui/CartFCWidget.hxx | 40 +++++----- src/debugger/gui/CartFEWidget.hxx | 2 +- src/debugger/gui/CartMDMWidget.hxx | 4 +- src/debugger/gui/CartMNetworkWidget.hxx | 6 +- src/debugger/gui/CartRamWidget.hxx | 6 +- src/debugger/gui/CartSBWidget.hxx | 2 +- src/debugger/gui/CartUAWidget.hxx | 2 +- src/debugger/gui/CartWDWidget.hxx | 4 +- src/debugger/gui/CartX07Widget.hxx | 2 +- src/debugger/gui/CpuWidget.hxx | 14 ++-- src/debugger/gui/DataGridOpsWidget.cxx | 9 +-- src/debugger/gui/DataGridOpsWidget.hxx | 14 ++-- src/debugger/gui/DataGridWidget.cxx | 10 +-- src/debugger/gui/DataGridWidget.hxx | 30 ++++---- src/debugger/gui/DebuggerDialog.cxx | 6 +- src/debugger/gui/DebuggerDialog.hxx | 30 ++++---- src/debugger/gui/DrivingWidget.cxx | 3 +- src/debugger/gui/DrivingWidget.hxx | 8 +- src/debugger/gui/FlashWidget.cxx | 3 +- src/debugger/gui/FlashWidget.hxx | 4 +- src/debugger/gui/GenesisWidget.hxx | 2 +- src/debugger/gui/JoystickWidget.hxx | 2 +- src/debugger/gui/KeyboardWidget.hxx | 4 +- src/debugger/gui/PaddleWidget.hxx | 4 +- src/debugger/gui/PointingDeviceWidget.hxx | 10 +-- src/debugger/gui/PromptWidget.cxx | 1 + src/debugger/gui/RamWidget.cxx | 1 - src/debugger/gui/RamWidget.hxx | 34 ++++---- src/debugger/gui/RiotWidget.hxx | 40 +++++----- src/debugger/gui/RomListSettings.cxx | 5 +- src/debugger/gui/RomListSettings.hxx | 12 +-- src/debugger/gui/RomListWidget.cxx | 11 +-- src/debugger/gui/RomListWidget.hxx | 26 +++---- src/debugger/gui/RomWidget.cxx | 3 +- src/debugger/gui/RomWidget.hxx | 6 +- src/debugger/gui/TiaInfoWidget.hxx | 18 ++--- src/debugger/gui/TiaOutputWidget.cxx | 5 +- src/debugger/gui/TiaOutputWidget.hxx | 4 +- src/debugger/gui/TiaWidget.hxx | 90 +++++++++++----------- src/debugger/gui/TiaZoomWidget.hxx | 12 +-- src/debugger/gui/ToggleBitWidget.hxx | 4 +- src/debugger/gui/TogglePixelWidget.cxx | 6 +- src/debugger/gui/TogglePixelWidget.hxx | 6 +- src/emucore/AtariVox.cxx | 5 +- src/emucore/AtariVox.hxx | 6 +- src/emucore/Booster.cxx | 3 +- src/emucore/Booster.hxx | 2 +- src/emucore/Cart.cxx | 7 +- src/emucore/Cart.hxx | 8 +- src/emucore/Cart0840.cxx | 3 +- src/emucore/Cart0840.hxx | 2 +- src/emucore/Cart2K.hxx | 4 +- src/emucore/Cart3E.cxx | 3 +- src/emucore/Cart3E.hxx | 4 +- src/emucore/Cart3EPlus.hxx | 2 +- src/emucore/Cart3F.cxx | 3 +- src/emucore/Cart3F.hxx | 4 +- src/emucore/Cart4A50.cxx | 10 +-- src/emucore/Cart4A50.hxx | 18 ++--- src/emucore/CartAR.cxx | 11 +-- src/emucore/CartAR.hxx | 16 ++-- src/emucore/CartBF.cxx | 3 +- src/emucore/CartBF.hxx | 2 +- src/emucore/CartBFSC.cxx | 3 +- src/emucore/CartBFSC.hxx | 2 +- src/emucore/CartBUS.cxx | 5 +- src/emucore/CartBUS.hxx | 30 ++++---- src/emucore/CartCDF.cxx | 5 +- src/emucore/CartCDF.hxx | 42 +++++----- src/emucore/CartCM.cxx | 4 +- src/emucore/CartCM.hxx | 4 +- src/emucore/CartCTY.cxx | 10 +-- src/emucore/CartCTY.hxx | 22 +++--- src/emucore/CartCV.hxx | 2 +- src/emucore/CartCVPlus.cxx | 3 +- src/emucore/CartCVPlus.hxx | 4 +- src/emucore/CartDASH.hxx | 4 +- src/emucore/CartDF.cxx | 3 +- src/emucore/CartDF.hxx | 2 +- src/emucore/CartDFSC.cxx | 3 +- src/emucore/CartDFSC.hxx | 2 +- src/emucore/CartDPC.cxx | 18 +---- src/emucore/CartDPC.hxx | 26 +++---- src/emucore/CartDPCPlus.cxx | 10 +-- src/emucore/CartDPCPlus.hxx | 26 +++---- src/emucore/CartDetector.hxx | 1 - src/emucore/CartEF.cxx | 3 +- src/emucore/CartEF.hxx | 2 +- src/emucore/CartEFSC.cxx | 3 +- src/emucore/CartEFSC.hxx | 2 +- src/emucore/CartF0.cxx | 3 +- src/emucore/CartF0.hxx | 2 +- src/emucore/CartF4.cxx | 3 +- src/emucore/CartF4.hxx | 2 +- src/emucore/CartF4SC.cxx | 3 +- src/emucore/CartF4SC.hxx | 2 +- src/emucore/CartF6.cxx | 3 +- src/emucore/CartF6.hxx | 2 +- src/emucore/CartF6SC.cxx | 3 +- src/emucore/CartF6SC.hxx | 2 +- src/emucore/CartF8.cxx | 3 +- src/emucore/CartF8.hxx | 2 +- src/emucore/CartF8SC.cxx | 3 +- src/emucore/CartF8SC.hxx | 2 +- src/emucore/CartFA.cxx | 3 +- src/emucore/CartFA.hxx | 2 +- src/emucore/CartFA2.cxx | 5 +- src/emucore/CartFA2.hxx | 6 +- src/emucore/CartFC.cxx | 5 +- src/emucore/CartFC.hxx | 8 +- src/emucore/CartFE.cxx | 4 +- src/emucore/CartFE.hxx | 4 +- src/emucore/CartMDM.cxx | 5 +- src/emucore/CartMDM.hxx | 6 +- src/emucore/CartMNetwork.cxx | 4 +- src/emucore/CartMNetwork.hxx | 6 +- src/emucore/CartSB.cxx | 4 +- src/emucore/CartSB.hxx | 4 +- src/emucore/CartUA.cxx | 1 - src/emucore/CartUA.hxx | 4 +- src/emucore/CartWD.cxx | 5 +- src/emucore/CartWD.hxx | 8 +- src/emucore/CartX07.cxx | 3 +- src/emucore/CartX07.hxx | 2 +- src/emucore/CompuMate.cxx | 1 - src/emucore/CompuMate.hxx | 6 +- src/emucore/Console.cxx | 5 -- src/emucore/Console.hxx | 8 +- src/emucore/Control.cxx | 5 +- src/emucore/Control.hxx | 8 +- src/emucore/Driving.cxx | 8 +- src/emucore/Driving.hxx | 10 +-- src/emucore/EmulationTiming.hxx | 7 +- src/emucore/EventHandler.cxx | 8 +- src/emucore/EventHandler.hxx | 14 ++-- src/emucore/Genesis.cxx | 3 +- src/emucore/Genesis.hxx | 2 +- src/emucore/Joystick.cxx | 3 +- src/emucore/Joystick.hxx | 2 +- src/emucore/KidVid.cxx | 16 +--- src/emucore/KidVid.hxx | 16 ++-- src/emucore/M6532.cxx | 8 +- src/emucore/M6532.hxx | 28 +++---- src/emucore/MT24LC256.cxx | 22 +----- src/emucore/MT24LC256.hxx | 20 ++--- src/emucore/MindLink.cxx | 5 +- src/emucore/MindLink.hxx | 6 +- src/emucore/Paddles.cxx | 12 +-- src/emucore/Paddles.hxx | 26 +++---- src/emucore/PointingDevice.cxx | 9 +-- src/emucore/PointingDevice.hxx | 18 ++--- src/emucore/Random.hxx | 2 +- src/emucore/SaveKey.cxx | 5 +- src/emucore/Switches.cxx | 4 +- src/emucore/Switches.hxx | 4 +- src/emucore/TIASurface.cxx | 6 +- src/emucore/TIASurface.hxx | 8 +- src/emucore/Thumbulator.cxx | 2 - src/emucore/Thumbulator.hxx | 22 +++--- src/emucore/tia/AudioChannel.cxx | 6 -- src/emucore/tia/AudioChannel.hxx | 22 +++--- src/emucore/tia/Ball.cxx | 7 +- src/emucore/tia/Ball.hxx | 48 ++++++------ src/emucore/tia/DelayQueueIteratorImpl.hxx | 8 +- src/emucore/tia/DrawCounterDecodes.hxx | 4 +- src/emucore/tia/LatchedInput.cxx | 6 -- src/emucore/tia/LatchedInput.hxx | 6 +- src/emucore/tia/Missile.cxx | 7 +- src/emucore/tia/Missile.hxx | 46 +++++------ src/emucore/tia/PaddleReader.cxx | 2 +- src/emucore/tia/PaddleReader.hxx | 12 +-- src/emucore/tia/Player.cxx | 7 +- src/emucore/tia/Player.hxx | 54 ++++++------- src/emucore/tia/Playfield.cxx | 6 +- src/emucore/tia/Playfield.hxx | 40 +++++----- src/emucore/tia/TIA.cxx | 5 +- src/emucore/tia/TIA.hxx | 62 +++++++-------- 213 files changed, 823 insertions(+), 1095 deletions(-) diff --git a/src/common/tv_filters/AtariNTSC.hxx b/src/common/tv_filters/AtariNTSC.hxx index 6cd24407f..e11c649ff 100644 --- a/src/common/tv_filters/AtariNTSC.hxx +++ b/src/common/tv_filters/AtariNTSC.hxx @@ -161,13 +161,13 @@ class AtariNTSC struct init_t { - std::array to_rgb; - std::array to_float; + std::array to_rgb{0.F}; + std::array to_float{0.F}; float contrast{0.F}; float brightness{0.F}; float artifacts{0.F}; float fringing{0.F}; - std::array kernel; + std::array kernel{0.F}; init_t() { to_rgb.fill(0.0); @@ -181,7 +181,7 @@ class AtariNTSC { int offset{0}; float negate{0.F}; - std::array kernel; + std::array kernel{0.F}; }; static const std::array atari_ntsc_pixels; diff --git a/src/debugger/gui/AudioWidget.hxx b/src/debugger/gui/AudioWidget.hxx index 8f8cd2bf4..072811463 100644 --- a/src/debugger/gui/AudioWidget.hxx +++ b/src/debugger/gui/AudioWidget.hxx @@ -40,10 +40,10 @@ class AudioWidget : public Widget, public CommandSender kAUDVID }; - DataGridWidget* myAudF; - DataGridWidget* myAudC; - DataGridWidget* myAudV; - StaticTextWidget* myAudEffV; + DataGridWidget* myAudF{nullptr}; + DataGridWidget* myAudC{nullptr}; + DataGridWidget* myAudV{nullptr}; + StaticTextWidget* myAudEffV{nullptr}; // Audio channels enum diff --git a/src/debugger/gui/BoosterWidget.hxx b/src/debugger/gui/BoosterWidget.hxx index 36aa2e0b0..5e66baa6f 100644 --- a/src/debugger/gui/BoosterWidget.hxx +++ b/src/debugger/gui/BoosterWidget.hxx @@ -31,7 +31,7 @@ class BoosterWidget : public ControllerWidget private: enum { kJUp = 0, kJDown, kJLeft, kJRight, kJFire, kJBooster, kJTrigger }; - std::array myPins; + std::array myPins{nullptr}; static constexpr std::array ourPinNo = {{ Controller::DigitalPin::One, Controller::DigitalPin::Two, Controller::DigitalPin::Three, Controller::DigitalPin::Four, diff --git a/src/debugger/gui/Cart0840Widget.hxx b/src/debugger/gui/Cart0840Widget.hxx index 6e3e95127..6e47cb353 100644 --- a/src/debugger/gui/Cart0840Widget.hxx +++ b/src/debugger/gui/Cart0840Widget.hxx @@ -34,7 +34,7 @@ class Cartridge0840Widget : public CartDebugWidget private: Cartridge0840& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; enum { kBankChanged = 'bkCH' }; diff --git a/src/debugger/gui/Cart3EPlusWidget.hxx b/src/debugger/gui/Cart3EPlusWidget.hxx index 9d3b57908..111461b10 100644 --- a/src/debugger/gui/Cart3EPlusWidget.hxx +++ b/src/debugger/gui/Cart3EPlusWidget.hxx @@ -40,10 +40,10 @@ class Cartridge3EPlusWidget : public CartDebugWidget private: Cartridge3EPlus& myCart; - std::array myBankNumber; - std::array myBankType; - std::array myBankCommit; - std::array myBankState; + std::array myBankNumber{nullptr}; + std::array myBankType{nullptr}; + std::array myBankCommit{nullptr}; + std::array myBankState{nullptr}; struct CartState { ByteArray internalram; diff --git a/src/debugger/gui/Cart3EWidget.hxx b/src/debugger/gui/Cart3EWidget.hxx index ee7c96189..f18d39475 100644 --- a/src/debugger/gui/Cart3EWidget.hxx +++ b/src/debugger/gui/Cart3EWidget.hxx @@ -34,9 +34,9 @@ class Cartridge3EWidget : public CartDebugWidget private: Cartridge3E& myCart; - const uInt32 myNumRomBanks; - const uInt32 myNumRamBanks; - PopUpWidget *myROMBank, *myRAMBank; + const uInt32 myNumRomBanks{0}; + const uInt32 myNumRamBanks{0}; + PopUpWidget *myROMBank{nullptr}, *myRAMBank{nullptr}; struct CartState { ByteArray internalram; diff --git a/src/debugger/gui/Cart3FWidget.hxx b/src/debugger/gui/Cart3FWidget.hxx index 413b15fed..9cb8958f9 100644 --- a/src/debugger/gui/Cart3FWidget.hxx +++ b/src/debugger/gui/Cart3FWidget.hxx @@ -34,7 +34,7 @@ class Cartridge3FWidget : public CartDebugWidget private: Cartridge3F& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; enum { kBankChanged = 'bkCH' }; diff --git a/src/debugger/gui/Cart4A50Widget.hxx b/src/debugger/gui/Cart4A50Widget.hxx index 7eda17ca1..b32b53970 100644 --- a/src/debugger/gui/Cart4A50Widget.hxx +++ b/src/debugger/gui/Cart4A50Widget.hxx @@ -34,9 +34,9 @@ class Cartridge4A50Widget : public CartDebugWidget private: Cartridge4A50& myCart; - PopUpWidget *myROMLower, *myRAMLower; - PopUpWidget *myROMMiddle, *myRAMMiddle; - PopUpWidget *myROMHigh, *myRAMHigh; + PopUpWidget *myROMLower{nullptr}, *myRAMLower{nullptr}; + PopUpWidget *myROMMiddle{nullptr}, *myRAMMiddle{nullptr}; + PopUpWidget *myROMHigh{nullptr}, *myRAMHigh{nullptr}; enum { kROMLowerChanged = 'rmLW', diff --git a/src/debugger/gui/CartARWidget.hxx b/src/debugger/gui/CartARWidget.hxx index 1ca38c3a4..ab05ca9ed 100644 --- a/src/debugger/gui/CartARWidget.hxx +++ b/src/debugger/gui/CartARWidget.hxx @@ -34,7 +34,7 @@ class CartridgeARWidget : public CartDebugWidget private: CartridgeAR& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; enum { kBankChanged = 'bkCH' }; diff --git a/src/debugger/gui/CartBFSCWidget.hxx b/src/debugger/gui/CartBFSCWidget.hxx index 47f51ca02..bec00c33b 100644 --- a/src/debugger/gui/CartBFSCWidget.hxx +++ b/src/debugger/gui/CartBFSCWidget.hxx @@ -34,11 +34,11 @@ class CartridgeBFSCWidget : public CartDebugWidget private: CartridgeBFSC& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; struct CartState { ByteArray internalram; - uInt16 bank; + uInt16 bank{0}; }; CartState myOldState; diff --git a/src/debugger/gui/CartBFWidget.hxx b/src/debugger/gui/CartBFWidget.hxx index bbf011a4a..903bcf6e2 100644 --- a/src/debugger/gui/CartBFWidget.hxx +++ b/src/debugger/gui/CartBFWidget.hxx @@ -34,7 +34,7 @@ class CartridgeBFWidget : public CartDebugWidget private: CartridgeBF& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; enum { kBankChanged = 'bkCH' }; diff --git a/src/debugger/gui/CartBUSWidget.hxx b/src/debugger/gui/CartBUSWidget.hxx index db9900472..e55723d0c 100644 --- a/src/debugger/gui/CartBUSWidget.hxx +++ b/src/debugger/gui/CartBUSWidget.hxx @@ -46,26 +46,26 @@ class CartridgeBUSWidget : public CartDebugWidget IntArray mwaves; IntArray mwavesizes; IntArray samplepointer; - uInt32 random; + uInt32 random{0}; ByteArray internalram; }; CartridgeBUS& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; - DataGridWidget* myDatastreamPointers; - DataGridWidget* myDatastreamIncrements; - DataGridWidget* myDatastreamPointers2; - DataGridWidget* myDatastreamIncrements2; - DataGridWidget* myAddressMaps; - DataGridWidget* myMusicCounters; - DataGridWidget* myMusicFrequencies; - DataGridWidget* myMusicWaveforms; - DataGridWidget* myMusicWaveformSizes; - DataGridWidget* mySamplePointer; - CheckboxWidget* myBusOverdrive; - CheckboxWidget* myDigitalSample; - std::array myDatastreamLabels; + DataGridWidget* myDatastreamPointers{nullptr}; + DataGridWidget* myDatastreamIncrements{nullptr}; + DataGridWidget* myDatastreamPointers2{nullptr}; + DataGridWidget* myDatastreamIncrements2{nullptr}; + DataGridWidget* myAddressMaps{nullptr}; + DataGridWidget* myMusicCounters{nullptr}; + DataGridWidget* myMusicFrequencies{nullptr}; + DataGridWidget* myMusicWaveforms{nullptr}; + DataGridWidget* myMusicWaveformSizes{nullptr}; + DataGridWidget* mySamplePointer{nullptr}; + CheckboxWidget* myBusOverdrive{nullptr}; + CheckboxWidget* myDigitalSample{nullptr}; + std::array myDatastreamLabels{nullptr}; CartState myOldState; enum { kBankChanged = 'bkCH' }; diff --git a/src/debugger/gui/CartCDFWidget.hxx b/src/debugger/gui/CartCDFWidget.hxx index 5d7e76429..4e1cdfeff 100644 --- a/src/debugger/gui/CartCDFWidget.hxx +++ b/src/debugger/gui/CartCDFWidget.hxx @@ -47,28 +47,28 @@ class CartridgeCDFWidget : public CartDebugWidget IntArray mwaves; IntArray mwavesizes; IntArray samplepointer; - uInt32 random; + uInt32 random{0}; ByteArray internalram; }; CartridgeCDF& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; - DataGridWidget* myDatastreamPointers; - DataGridWidget* myDatastreamIncrements; - DataGridWidget* myCommandStreamPointer; - DataGridWidget* myCommandStreamIncrement; - DataGridWidget* myJumpStreamPointers; - DataGridWidget* myJumpStreamIncrements; - DataGridWidget* myMusicCounters; - DataGridWidget* myMusicFrequencies; - DataGridWidget* myMusicWaveforms; - DataGridWidget* myMusicWaveformSizes; - DataGridWidget* mySamplePointer; - std::array myDatastreamLabels; + DataGridWidget* myDatastreamPointers{nullptr}; + DataGridWidget* myDatastreamIncrements{nullptr}; + DataGridWidget* myCommandStreamPointer{nullptr}; + DataGridWidget* myCommandStreamIncrement{nullptr}; + DataGridWidget* myJumpStreamPointers{nullptr}; + DataGridWidget* myJumpStreamIncrements{nullptr}; + DataGridWidget* myMusicCounters{nullptr}; + DataGridWidget* myMusicFrequencies{nullptr}; + DataGridWidget* myMusicWaveforms{nullptr}; + DataGridWidget* myMusicWaveformSizes{nullptr}; + DataGridWidget* mySamplePointer{nullptr}; + std::array myDatastreamLabels{nullptr}; - CheckboxWidget* myFastFetch; - CheckboxWidget* myDigitalSample; + CheckboxWidget* myFastFetch{nullptr}; + CheckboxWidget* myDigitalSample{nullptr}; CartState myOldState; enum { kBankChanged = 'bkCH' }; diff --git a/src/debugger/gui/CartCMWidget.hxx b/src/debugger/gui/CartCMWidget.hxx index b3bd4840f..30543fb65 100644 --- a/src/debugger/gui/CartCMWidget.hxx +++ b/src/debugger/gui/CartCMWidget.hxx @@ -38,21 +38,22 @@ class CartridgeCMWidget : public CartDebugWidget private: struct CartState { - uInt8 swcha; - uInt8 column; + uInt8 swcha{0}; + uInt8 column{0}; ByteArray internalram; - uInt16 bank; + uInt16 bank{0}; }; CartridgeCM& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; - ToggleBitWidget* mySWCHA; - DataGridWidget* myColumn; - CheckboxWidget *myAudIn, *myAudOut, *myIncrease, *myReset; - CheckboxWidget *myFunc, *myShift; - EditTextWidget* myRAM; - std::array myRow; + ToggleBitWidget* mySWCHA{nullptr}; + DataGridWidget* myColumn{nullptr}; + CheckboxWidget *myAudIn{nullptr}, *myAudOut{nullptr}, + *myIncrease{nullptr}, *myReset{nullptr}; + CheckboxWidget *myFunc{nullptr}, *myShift{nullptr}; + EditTextWidget* myRAM{nullptr}; + std::array myRow{nullptr}; CartState myOldState; diff --git a/src/debugger/gui/CartCTYWidget.hxx b/src/debugger/gui/CartCTYWidget.hxx index 5661f8fdc..4926f3a98 100644 --- a/src/debugger/gui/CartCTYWidget.hxx +++ b/src/debugger/gui/CartCTYWidget.hxx @@ -34,11 +34,11 @@ class CartridgeCTYWidget : public CartDebugWidget private: CartridgeCTY& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; struct CartState { ByteArray internalram; - uInt16 bank; + uInt16 bank{0}; }; CartState myOldState; diff --git a/src/debugger/gui/CartCVPlusWidget.hxx b/src/debugger/gui/CartCVPlusWidget.hxx index e4e0610dd..2fa390138 100644 --- a/src/debugger/gui/CartCVPlusWidget.hxx +++ b/src/debugger/gui/CartCVPlusWidget.hxx @@ -34,10 +34,10 @@ class CartridgeCVPlusWidget : public CartDebugWidget private: CartridgeCVPlus& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; struct CartState { ByteArray internalram; - uInt16 bank; + uInt16 bank{0}; }; CartState myOldState; diff --git a/src/debugger/gui/CartDASHWidget.hxx b/src/debugger/gui/CartDASHWidget.hxx index 04360d1c5..2a569fe0f 100644 --- a/src/debugger/gui/CartDASHWidget.hxx +++ b/src/debugger/gui/CartDASHWidget.hxx @@ -40,10 +40,10 @@ class CartridgeDASHWidget : public CartDebugWidget private: CartridgeDASH& myCart; - std::array myBankNumber; - std::array myBankType; - std::array myBankCommit; - std::array myBankState; + std::array myBankNumber{nullptr}; + std::array myBankType{nullptr}; + std::array myBankCommit{nullptr}; + std::array myBankState{nullptr}; struct CartState { ByteArray internalram; diff --git a/src/debugger/gui/CartDFSCWidget.hxx b/src/debugger/gui/CartDFSCWidget.hxx index 772c2e879..abd916306 100644 --- a/src/debugger/gui/CartDFSCWidget.hxx +++ b/src/debugger/gui/CartDFSCWidget.hxx @@ -34,11 +34,11 @@ class CartridgeDFSCWidget : public CartDebugWidget private: CartridgeDFSC& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; struct CartState { ByteArray internalram; - uInt16 bank; + uInt16 bank{0}; }; CartState myOldState; diff --git a/src/debugger/gui/CartDFWidget.hxx b/src/debugger/gui/CartDFWidget.hxx index 613f62ef7..4f813194c 100644 --- a/src/debugger/gui/CartDFWidget.hxx +++ b/src/debugger/gui/CartDFWidget.hxx @@ -34,7 +34,7 @@ class CartridgeDFWidget : public CartDebugWidget private: CartridgeDF& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; enum { kBankChanged = 'bkCH' }; diff --git a/src/debugger/gui/CartDPCPlusWidget.hxx b/src/debugger/gui/CartDPCPlusWidget.hxx index 314b236a9..6de671b79 100644 --- a/src/debugger/gui/CartDPCPlusWidget.hxx +++ b/src/debugger/gui/CartDPCPlusWidget.hxx @@ -45,26 +45,26 @@ class CartridgeDPCPlusWidget : public CartDebugWidget IntArray mcounters; IntArray mfreqs; IntArray mwaves; - uInt32 random; + uInt32 random{0}; ByteArray internalram; - uInt16 bank; + uInt16 bank{0}; }; CartridgeDPCPlus& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; - DataGridWidget* myTops; - DataGridWidget* myBottoms; - DataGridWidget* myCounters; - DataGridWidget* myFracCounters; - DataGridWidget* myFracIncrements; - DataGridWidget* myParameter; - DataGridWidget* myMusicCounters; - DataGridWidget* myMusicFrequencies; - DataGridWidget* myMusicWaveforms; - CheckboxWidget* myFastFetch; - CheckboxWidget* myIMLDA; - DataGridWidget* myRandom; + DataGridWidget* myTops{nullptr}; + DataGridWidget* myBottoms{nullptr}; + DataGridWidget* myCounters{nullptr}; + DataGridWidget* myFracCounters{nullptr}; + DataGridWidget* myFracIncrements{nullptr}; + DataGridWidget* myParameter{nullptr}; + DataGridWidget* myMusicCounters{nullptr}; + DataGridWidget* myMusicFrequencies{nullptr}; + DataGridWidget* myMusicWaveforms{nullptr}; + CheckboxWidget* myFastFetch{nullptr}; + CheckboxWidget* myIMLDA{nullptr}; + DataGridWidget* myRandom{nullptr}; CartState myOldState; diff --git a/src/debugger/gui/CartDPCWidget.hxx b/src/debugger/gui/CartDPCWidget.hxx index 6e05677e7..6ebce2e47 100644 --- a/src/debugger/gui/CartDPCWidget.hxx +++ b/src/debugger/gui/CartDPCWidget.hxx @@ -40,20 +40,20 @@ class CartridgeDPCWidget : public CartDebugWidget IntArray counters; ByteArray flags; BoolArray music; - uInt8 random; + uInt8 random{0}; ByteArray internalram; - uInt16 bank; + uInt16 bank{0}; }; CartridgeDPC& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; - DataGridWidget* myTops; - DataGridWidget* myBottoms; - DataGridWidget* myCounters; - DataGridWidget* myFlags; - DataGridWidget* myMusicMode; - DataGridWidget* myRandom; + DataGridWidget* myTops{nullptr}; + DataGridWidget* myBottoms{nullptr}; + DataGridWidget* myCounters{nullptr}; + DataGridWidget* myFlags{nullptr}; + DataGridWidget* myMusicMode{nullptr}; + DataGridWidget* myRandom{nullptr}; CartState myOldState; diff --git a/src/debugger/gui/CartDebugWidget.cxx b/src/debugger/gui/CartDebugWidget.cxx index 8f542e010..96f07e7f2 100644 --- a/src/debugger/gui/CartDebugWidget.cxx +++ b/src/debugger/gui/CartDebugWidget.cxx @@ -33,8 +33,9 @@ CartDebugWidget::CartDebugWidget(GuiObject* boss, const GUI::Font& lfont, myFontWidth(lfont.getMaxCharWidth()), myFontHeight(lfont.getFontHeight()), myLineHeight(lfont.getLineHeight()), - myButtonHeight(myLineHeight + 4), - myDesc(nullptr) { } + myButtonHeight(myLineHeight + 4) +{ +} // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int CartDebugWidget::addBaseInformation(size_t bytes, const string& manufacturer, diff --git a/src/debugger/gui/CartDebugWidget.hxx b/src/debugger/gui/CartDebugWidget.hxx index 0b2d1af44..20775f202 100644 --- a/src/debugger/gui/CartDebugWidget.hxx +++ b/src/debugger/gui/CartDebugWidget.hxx @@ -77,12 +77,12 @@ class CartDebugWidget : public Widget, public CommandSender // These will be needed by most of the child classes; // we may as well make them protected variables - int myFontWidth, myFontHeight, myLineHeight, myButtonHeight; + int myFontWidth{0}, myFontHeight{0}, myLineHeight{0}, myButtonHeight{0}; ostringstream& buffer() { myBuffer.str(""); return myBuffer; } private: - StringListWidget* myDesc; + StringListWidget* myDesc{nullptr}; ostringstream myBuffer; private: diff --git a/src/debugger/gui/CartE0Widget.hxx b/src/debugger/gui/CartE0Widget.hxx index 94abe00b4..889642c7d 100644 --- a/src/debugger/gui/CartE0Widget.hxx +++ b/src/debugger/gui/CartE0Widget.hxx @@ -34,7 +34,7 @@ class CartridgeE0Widget : public CartDebugWidget private: CartridgeE0& myCart; - PopUpWidget *mySlice0, *mySlice1, *mySlice2; + PopUpWidget *mySlice0{nullptr}, *mySlice1{nullptr}, *mySlice2{nullptr}; enum { kSlice0Changed = 's0CH', diff --git a/src/debugger/gui/CartEFSCWidget.hxx b/src/debugger/gui/CartEFSCWidget.hxx index ede81f2e6..4fbe08683 100644 --- a/src/debugger/gui/CartEFSCWidget.hxx +++ b/src/debugger/gui/CartEFSCWidget.hxx @@ -34,11 +34,11 @@ class CartridgeEFSCWidget : public CartDebugWidget private: CartridgeEFSC& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; struct CartState { ByteArray internalram; - uInt16 bank; + uInt16 bank{0}; }; CartState myOldState; diff --git a/src/debugger/gui/CartEFWidget.hxx b/src/debugger/gui/CartEFWidget.hxx index 40b0b4d46..078e60bb5 100644 --- a/src/debugger/gui/CartEFWidget.hxx +++ b/src/debugger/gui/CartEFWidget.hxx @@ -34,7 +34,7 @@ class CartridgeEFWidget : public CartDebugWidget private: CartridgeEF& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; enum { kBankChanged = 'bkCH' }; diff --git a/src/debugger/gui/CartF0Widget.hxx b/src/debugger/gui/CartF0Widget.hxx index 136b066e8..2c2b98da8 100644 --- a/src/debugger/gui/CartF0Widget.hxx +++ b/src/debugger/gui/CartF0Widget.hxx @@ -34,7 +34,7 @@ class CartridgeF0Widget : public CartDebugWidget private: CartridgeF0& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; enum { kBankChanged = 'bkCH' }; diff --git a/src/debugger/gui/CartF4SCWidget.hxx b/src/debugger/gui/CartF4SCWidget.hxx index 58e8ea1d1..32b1b7733 100644 --- a/src/debugger/gui/CartF4SCWidget.hxx +++ b/src/debugger/gui/CartF4SCWidget.hxx @@ -34,11 +34,11 @@ class CartridgeF4SCWidget : public CartDebugWidget private: CartridgeF4SC& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; struct CartState { ByteArray internalram; - uInt16 bank; + uInt16 bank{0}; }; CartState myOldState; diff --git a/src/debugger/gui/CartF4Widget.hxx b/src/debugger/gui/CartF4Widget.hxx index 191c6a1c5..204e6c758 100644 --- a/src/debugger/gui/CartF4Widget.hxx +++ b/src/debugger/gui/CartF4Widget.hxx @@ -34,7 +34,7 @@ class CartridgeF4Widget : public CartDebugWidget private: CartridgeF4& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; enum { kBankChanged = 'bkCH' }; diff --git a/src/debugger/gui/CartF6SCWidget.hxx b/src/debugger/gui/CartF6SCWidget.hxx index 0c5188000..a5f572edd 100644 --- a/src/debugger/gui/CartF6SCWidget.hxx +++ b/src/debugger/gui/CartF6SCWidget.hxx @@ -35,10 +35,10 @@ class CartridgeF6SCWidget : public CartDebugWidget private: struct CartState { ByteArray internalram; - uInt16 bank; + uInt16 bank{0}; }; CartridgeF6SC& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; CartState myOldState; enum { kBankChanged = 'bkCH' }; diff --git a/src/debugger/gui/CartF6Widget.hxx b/src/debugger/gui/CartF6Widget.hxx index 5bf6e4551..13005e86e 100644 --- a/src/debugger/gui/CartF6Widget.hxx +++ b/src/debugger/gui/CartF6Widget.hxx @@ -34,7 +34,7 @@ class CartridgeF6Widget : public CartDebugWidget private: CartridgeF6& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; enum { kBankChanged = 'bkCH' }; diff --git a/src/debugger/gui/CartF8SCWidget.hxx b/src/debugger/gui/CartF8SCWidget.hxx index 821efb637..ed0912f16 100644 --- a/src/debugger/gui/CartF8SCWidget.hxx +++ b/src/debugger/gui/CartF8SCWidget.hxx @@ -34,11 +34,11 @@ class CartridgeF8SCWidget : public CartDebugWidget private: CartridgeF8SC& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; struct CartState { ByteArray internalram; - uInt16 bank; + uInt16 bank{0}; }; CartState myOldState; diff --git a/src/debugger/gui/CartF8Widget.hxx b/src/debugger/gui/CartF8Widget.hxx index 93ec94256..6accab62c 100644 --- a/src/debugger/gui/CartF8Widget.hxx +++ b/src/debugger/gui/CartF8Widget.hxx @@ -34,7 +34,7 @@ class CartridgeF8Widget : public CartDebugWidget private: CartridgeF8& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; enum { kBankChanged = 'bkCH' }; diff --git a/src/debugger/gui/CartFA2Widget.hxx b/src/debugger/gui/CartFA2Widget.hxx index db5045bd6..ebed7f883 100644 --- a/src/debugger/gui/CartFA2Widget.hxx +++ b/src/debugger/gui/CartFA2Widget.hxx @@ -35,12 +35,12 @@ class CartridgeFA2Widget : public CartDebugWidget private: CartridgeFA2& myCart; - PopUpWidget* myBank; - ButtonWidget *myFlashErase, *myFlashLoad, *myFlashSave; + PopUpWidget* myBank{nullptr}; + ButtonWidget *myFlashErase{nullptr}, *myFlashLoad{nullptr}, *myFlashSave{nullptr}; struct CartState { ByteArray internalram; - uInt16 bank; + uInt16 bank{0}; }; CartState myOldState; diff --git a/src/debugger/gui/CartFAWidget.hxx b/src/debugger/gui/CartFAWidget.hxx index 773683053..f148c37db 100644 --- a/src/debugger/gui/CartFAWidget.hxx +++ b/src/debugger/gui/CartFAWidget.hxx @@ -34,11 +34,11 @@ class CartridgeFAWidget : public CartDebugWidget private: CartridgeFA& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; struct CartState { ByteArray internalram; - uInt16 bank; + uInt16 bank{0}; }; CartState myOldState; diff --git a/src/debugger/gui/CartFCWidget.cxx b/src/debugger/gui/CartFCWidget.cxx index 22e8662c9..b356c846b 100644 --- a/src/debugger/gui/CartFCWidget.cxx +++ b/src/debugger/gui/CartFCWidget.cxx @@ -47,9 +47,8 @@ CartridgeFCWidget::CartridgeFCWidget( " ($FFF8 = " + Variant(i & 0b11).toString() + "/$FFF9 = " + Variant(i >> 2).toString() +")"); - - myBank = - new PopUpWidget(boss, _font, xpos, ypos - 2, _font.getStringWidth("7 ($FFF8 = 3/$FFF9 = 1)"), + myBank = new PopUpWidget(boss, _font, xpos, ypos - 2, + _font.getStringWidth("7 ($FFF8 = 3/$FFF9 = 1)"), myLineHeight, items, "Set bank ", 0, kBankChanged); myBank->setTarget(this); diff --git a/src/debugger/gui/CartFCWidget.hxx b/src/debugger/gui/CartFCWidget.hxx index b91f6327b..62583b442 100644 --- a/src/debugger/gui/CartFCWidget.hxx +++ b/src/debugger/gui/CartFCWidget.hxx @@ -25,31 +25,31 @@ class PopUpWidget; class CartridgeFCWidget : public CartDebugWidget { -public: - CartridgeFCWidget(GuiObject* boss, const GUI::Font& lfont, - const GUI::Font& nfont, - int x, int y, int w, int h, - CartridgeFC& cart); - virtual ~CartridgeFCWidget() = default; + public: + CartridgeFCWidget(GuiObject* boss, const GUI::Font& lfont, + const GUI::Font& nfont, + int x, int y, int w, int h, + CartridgeFC& cart); + virtual ~CartridgeFCWidget() = default; -private: - CartridgeFC& myCart; - PopUpWidget* myBank; + private: + CartridgeFC& myCart; + PopUpWidget* myBank{nullptr}; - enum { kBankChanged = 'bkCH' }; + enum { kBankChanged = 'bkCH' }; -private: - void loadConfig() override; - void handleCommand(CommandSender* sender, int cmd, int data, int id) override; + private: + void loadConfig() override; + void handleCommand(CommandSender* sender, int cmd, int data, int id) override; - string bankState() override; + string bankState() override; - // Following constructors and assignment operators not supported - CartridgeFCWidget() = delete; - CartridgeFCWidget(const CartridgeFCWidget&) = delete; - CartridgeFCWidget(CartridgeFCWidget&&) = delete; - CartridgeFCWidget& operator=(const CartridgeFCWidget&) = delete; - CartridgeFCWidget& operator=(CartridgeFCWidget&&) = delete; + // Following constructors and assignment operators not supported + CartridgeFCWidget() = delete; + CartridgeFCWidget(const CartridgeFCWidget&) = delete; + CartridgeFCWidget(CartridgeFCWidget&&) = delete; + CartridgeFCWidget& operator=(const CartridgeFCWidget&) = delete; + CartridgeFCWidget& operator=(CartridgeFCWidget&&) = delete; }; #endif diff --git a/src/debugger/gui/CartFEWidget.hxx b/src/debugger/gui/CartFEWidget.hxx index b6ff60ef8..a0d586c0e 100644 --- a/src/debugger/gui/CartFEWidget.hxx +++ b/src/debugger/gui/CartFEWidget.hxx @@ -34,7 +34,7 @@ class CartridgeFEWidget : public CartDebugWidget private: CartridgeFE& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; enum { kBankChanged = 'bkCH' }; diff --git a/src/debugger/gui/CartMDMWidget.hxx b/src/debugger/gui/CartMDMWidget.hxx index e82065836..e4beaf5b4 100644 --- a/src/debugger/gui/CartMDMWidget.hxx +++ b/src/debugger/gui/CartMDMWidget.hxx @@ -35,8 +35,8 @@ class CartridgeMDMWidget : public CartDebugWidget private: CartridgeMDM& myCart; - PopUpWidget* myBank; - CheckboxWidget* myBankDisabled; + PopUpWidget* myBank{nullptr}; + CheckboxWidget* myBankDisabled{nullptr}; enum { kBankChanged = 'bkCH', kBankDisabled = 'bkDI' }; diff --git a/src/debugger/gui/CartMNetworkWidget.hxx b/src/debugger/gui/CartMNetworkWidget.hxx index a1fff146e..ee04347c9 100644 --- a/src/debugger/gui/CartMNetworkWidget.hxx +++ b/src/debugger/gui/CartMNetworkWidget.hxx @@ -37,13 +37,13 @@ class CartridgeMNetworkWidget : public CartDebugWidget //CartridgeE7& myCart; CartridgeMNetwork& myCart; - PopUpWidget *myLower2K, *myUpper256B; + PopUpWidget *myLower2K{nullptr}, *myUpper256B{nullptr}; struct CartState { ByteArray internalram; - uInt16 lowerBank; - uInt16 upperBank; + uInt16 lowerBank{0}; + uInt16 upperBank{0}; }; CartState myOldState; diff --git a/src/debugger/gui/CartRamWidget.hxx b/src/debugger/gui/CartRamWidget.hxx index 286069820..09ca53d59 100644 --- a/src/debugger/gui/CartRamWidget.hxx +++ b/src/debugger/gui/CartRamWidget.hxx @@ -48,7 +48,7 @@ class CartRamWidget : public Widget, public CommandSender // These will be needed by most of the child classes; // we may as well make them protected variables - int myFontWidth, myFontHeight, myLineHeight, myButtonHeight; + int myFontWidth{0}, myFontHeight{0}, myLineHeight{0}, myButtonHeight{0}; private: // Following constructors and assignment operators not supported @@ -91,8 +91,8 @@ class CartRamWidget : public Widget, public CommandSender }; private: - StringListWidget* myDesc; - InternalRamWidget* myRam; + StringListWidget* myDesc{nullptr}; + InternalRamWidget* myRam{nullptr}; }; #endif diff --git a/src/debugger/gui/CartSBWidget.hxx b/src/debugger/gui/CartSBWidget.hxx index 7bf1a9356..dabd5bc31 100644 --- a/src/debugger/gui/CartSBWidget.hxx +++ b/src/debugger/gui/CartSBWidget.hxx @@ -34,7 +34,7 @@ class CartridgeSBWidget : public CartDebugWidget private: CartridgeSB& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; enum { kBankChanged = 'bkCH' }; diff --git a/src/debugger/gui/CartUAWidget.hxx b/src/debugger/gui/CartUAWidget.hxx index 33aa39324..379a9ac2b 100644 --- a/src/debugger/gui/CartUAWidget.hxx +++ b/src/debugger/gui/CartUAWidget.hxx @@ -34,7 +34,7 @@ class CartridgeUAWidget : public CartDebugWidget private: CartridgeUA& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; bool mySwappedHotspots; diff --git a/src/debugger/gui/CartWDWidget.hxx b/src/debugger/gui/CartWDWidget.hxx index 9fbd1fa7a..1da13f92c 100644 --- a/src/debugger/gui/CartWDWidget.hxx +++ b/src/debugger/gui/CartWDWidget.hxx @@ -34,11 +34,11 @@ class CartridgeWDWidget : public CartDebugWidget private: CartridgeWD& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; struct CartState { ByteArray internalram; - uInt16 bank; // Current banking layout + uInt16 bank{0}; // Current banking layout }; CartState myOldState; diff --git a/src/debugger/gui/CartX07Widget.hxx b/src/debugger/gui/CartX07Widget.hxx index 11c7990b2..677296e93 100644 --- a/src/debugger/gui/CartX07Widget.hxx +++ b/src/debugger/gui/CartX07Widget.hxx @@ -34,7 +34,7 @@ class CartridgeX07Widget : public CartDebugWidget private: CartridgeX07& myCart; - PopUpWidget* myBank; + PopUpWidget* myBank{nullptr}; enum { kBankChanged = 'bkCH' }; diff --git a/src/debugger/gui/CpuWidget.hxx b/src/debugger/gui/CpuWidget.hxx index 2a06cf3a0..4bdef9e8f 100644 --- a/src/debugger/gui/CpuWidget.hxx +++ b/src/debugger/gui/CpuWidget.hxx @@ -69,13 +69,13 @@ class CpuWidget : public Widget, public CommandSender kPSRegC = 7 }; - DataGridWidget* myPCGrid; - DataGridWidget* myCpuGrid; - DataGridWidget* myCpuGridDecValue; - DataGridWidget* myCpuGridBinValue; - ToggleBitWidget* myPSRegister; - EditTextWidget* myPCLabel; - std::array myCpuDataSrc; + DataGridWidget* myPCGrid{nullptr}; + DataGridWidget* myCpuGrid{nullptr}; + DataGridWidget* myCpuGridDecValue{nullptr}; + DataGridWidget* myCpuGridBinValue{nullptr}; + ToggleBitWidget* myPSRegister{nullptr}; + EditTextWidget* myPCLabel{nullptr}; + std::array myCpuDataSrc{nullptr}; private: // Following constructors and assignment operators not supported diff --git a/src/debugger/gui/DataGridOpsWidget.cxx b/src/debugger/gui/DataGridOpsWidget.cxx index e9fd01889..6bfebe186 100644 --- a/src/debugger/gui/DataGridOpsWidget.cxx +++ b/src/debugger/gui/DataGridOpsWidget.cxx @@ -22,14 +22,7 @@ DataGridOpsWidget::DataGridOpsWidget(GuiObject* boss, const GUI::Font& font, int x, int y) : Widget(boss, font, x, y, 16, 16), - CommandSender(boss), - _zeroButton(nullptr), - _invButton(nullptr), - _negButton(nullptr), - _incButton(nullptr), - _decButton(nullptr), - _shiftLeftButton(nullptr), - _shiftRightButton(nullptr) + CommandSender(boss) { const int bwidth = _font.getMaxCharWidth() * 4+2, bheight = _font.getFontHeight() + 3, diff --git a/src/debugger/gui/DataGridOpsWidget.hxx b/src/debugger/gui/DataGridOpsWidget.hxx index e68f6de3a..528ca7f95 100644 --- a/src/debugger/gui/DataGridOpsWidget.hxx +++ b/src/debugger/gui/DataGridOpsWidget.hxx @@ -42,13 +42,13 @@ class DataGridOpsWidget : public Widget, public CommandSender void setEnabled(bool e); private: - ButtonWidget* _zeroButton; - ButtonWidget* _invButton; - ButtonWidget* _negButton; - ButtonWidget* _incButton; - ButtonWidget* _decButton; - ButtonWidget* _shiftLeftButton; - ButtonWidget* _shiftRightButton; + ButtonWidget* _zeroButton{nullptr}; + ButtonWidget* _invButton{nullptr}; + ButtonWidget* _negButton{nullptr}; + ButtonWidget* _incButton{nullptr}; + ButtonWidget* _decButton{nullptr}; + ButtonWidget* _shiftLeftButton{nullptr}; + ButtonWidget* _shiftRightButton{nullptr}; private: // Following constructors and assignment operators not supported diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx index 9b735708a..8627b865b 100644 --- a/src/debugger/gui/DataGridWidget.cxx +++ b/src/debugger/gui/DataGridWidget.cxx @@ -38,20 +38,12 @@ DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font, font.getLineHeight()*rows + 1), _rows(rows), _cols(cols), - _currentRow(0), - _currentCol(0), _rowHeight(font.getLineHeight()), _colWidth(colchars * font.getMaxCharWidth() + 8), _bits(bits), - _crossGrid(false), - _base(base), - _selectedItem(0), - _currentKeyDown(KBDK_UNKNOWN), - _opsWidget(nullptr), - _scrollBar(nullptr) + _base(base) { _flags = Widget::FLAG_ENABLED | Widget::FLAG_RETAIN_FOCUS | Widget::FLAG_WANTS_RAWDATA; - _editMode = false; // The item is selected, thus _bgcolor is used to draw the caret and // _textcolorhi to erase it diff --git a/src/debugger/gui/DataGridWidget.hxx b/src/debugger/gui/DataGridWidget.hxx index 640b35959..1fe807f35 100644 --- a/src/debugger/gui/DataGridWidget.hxx +++ b/src/debugger/gui/DataGridWidget.hxx @@ -108,16 +108,16 @@ class DataGridWidget : public EditableWidget void handleCommand(CommandSender* sender, int cmd, int data, int id) override; protected: - int _rows; - int _cols; - int _currentRow; - int _currentCol; - int _rowHeight; - int _colWidth; - int _bits; - int _lowerBound; - int _upperBound; - bool _crossGrid; + int _rows{0}; + int _cols{0}; + int _currentRow{0}; + int _currentCol{0}; + int _rowHeight{0}; + int _colWidth{0}; + int _bits{0}; + int _lowerBound{0}; + int _upperBound{0}; + bool _crossGrid{false}; Common::Base::Fmt _base; @@ -127,13 +127,13 @@ class DataGridWidget : public EditableWidget BoolArray _changedList; BoolArray _hiliteList; - bool _editMode; - int _selectedItem; - StellaKey _currentKeyDown; + bool _editMode{false}; + int _selectedItem{0}; + StellaKey _currentKeyDown{KBDK_UNKNOWN}; string _backupString; - DataGridOpsWidget* _opsWidget; - ScrollBarWidget* _scrollBar; + DataGridOpsWidget* _opsWidget{nullptr}; + ScrollBarWidget* _scrollBar{nullptr}; private: /** Common operations on the currently selected cell */ diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx index 5a9c27731..270806ff9 100644 --- a/src/debugger/gui/DebuggerDialog.cxx +++ b/src/debugger/gui/DebuggerDialog.cxx @@ -51,11 +51,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DebuggerDialog::DebuggerDialog(OSystem& osystem, DialogContainer& parent, int x, int y, int w, int h) - : Dialog(osystem, parent, x, y, w, h), - myTab(nullptr), - myRomTab(nullptr), - myFatalError(nullptr), - myFirstLoad(true) + : Dialog(osystem, parent, x, y, w, h) { createFont(); // Font is sized according to available space diff --git a/src/debugger/gui/DebuggerDialog.hxx b/src/debugger/gui/DebuggerDialog.hxx index 4a38930e8..559d1b5bb 100644 --- a/src/debugger/gui/DebuggerDialog.hxx +++ b/src/debugger/gui/DebuggerDialog.hxx @@ -115,28 +115,28 @@ class DebuggerDialog : public Dialog kDDOptionsCmd = 'DDop' }; - TabWidget *myTab, *myRomTab; + TabWidget *myTab{nullptr}, *myRomTab{nullptr}; - PromptWidget* myPrompt; - TiaInfoWidget* myTiaInfo; - TiaOutputWidget* myTiaOutput; - TiaZoomWidget* myTiaZoom; - CpuWidget* myCpu; - RamWidget* myRam; - RomWidget* myRom; - CartDebugWidget* myCartInfo; - CartDebugWidget* myCartDebug; - CartRamWidget* myCartRam; - EditTextWidget* myMessageBox; - ButtonWidget* myRewindButton; - ButtonWidget* myUnwindButton; + PromptWidget* myPrompt{nullptr}; + TiaInfoWidget* myTiaInfo{nullptr}; + TiaOutputWidget* myTiaOutput{nullptr}; + TiaZoomWidget* myTiaZoom{nullptr}; + CpuWidget* myCpu{nullptr}; + RamWidget* myRam{nullptr}; + RomWidget* myRom{nullptr}; + CartDebugWidget* myCartInfo{nullptr}; + CartDebugWidget* myCartDebug{nullptr}; + CartRamWidget* myCartRam{nullptr}; + EditTextWidget* myMessageBox{nullptr}; + ButtonWidget* myRewindButton{nullptr}; + ButtonWidget* myUnwindButton{nullptr}; unique_ptr myFatalError; unique_ptr myOptions; unique_ptr myLFont; // used for labels unique_ptr myNFont; // used for normal text - bool myFirstLoad; + bool myFirstLoad{true}; private: // Following constructors and assignment operators not supported diff --git a/src/debugger/gui/DrivingWidget.cxx b/src/debugger/gui/DrivingWidget.cxx index 572966d02..e7ee1c5ee 100644 --- a/src/debugger/gui/DrivingWidget.cxx +++ b/src/debugger/gui/DrivingWidget.cxx @@ -21,8 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DrivingWidget::DrivingWidget(GuiObject* boss, const GUI::Font& font, int x, int y, Controller& controller) - : ControllerWidget(boss, font, x, y, controller), - myGrayIndex(0) + : ControllerWidget(boss, font, x, y, controller) { const string& label = getHeader(); diff --git a/src/debugger/gui/DrivingWidget.hxx b/src/debugger/gui/DrivingWidget.hxx index 1f4176af9..a701a6610 100644 --- a/src/debugger/gui/DrivingWidget.hxx +++ b/src/debugger/gui/DrivingWidget.hxx @@ -38,11 +38,11 @@ class DrivingWidget : public ControllerWidget kGrayDownCmd = 'DWdn', kFireCmd = 'DWfr' }; - ButtonWidget *myGrayUp, *myGrayDown; - DataGridWidget* myGrayValue; - CheckboxWidget* myFire; + ButtonWidget *myGrayUp{nullptr}, *myGrayDown{nullptr}; + DataGridWidget* myGrayValue{nullptr}; + CheckboxWidget* myFire{nullptr}; - int myGrayIndex; + int myGrayIndex{0}; static const std::array ourGrayTable; diff --git a/src/debugger/gui/FlashWidget.cxx b/src/debugger/gui/FlashWidget.cxx index da8b3815f..768c51440 100644 --- a/src/debugger/gui/FlashWidget.cxx +++ b/src/debugger/gui/FlashWidget.cxx @@ -22,8 +22,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FlashWidget::FlashWidget(GuiObject* boss, const GUI::Font& font, int x, int y, Controller& controller) - : ControllerWidget(boss, font, x, y, controller), - myEEPROMEraseCurrent(nullptr) + : ControllerWidget(boss, font, x, y, controller) { myPage.fill(nullptr); } diff --git a/src/debugger/gui/FlashWidget.hxx b/src/debugger/gui/FlashWidget.hxx index 963d7c842..9183dedcd 100644 --- a/src/debugger/gui/FlashWidget.hxx +++ b/src/debugger/gui/FlashWidget.hxx @@ -34,11 +34,11 @@ class FlashWidget : public ControllerWidget void init(GuiObject* boss, const GUI::Font& font, int x, int y); private: - ButtonWidget* myEEPROMEraseCurrent; + ButtonWidget* myEEPROMEraseCurrent{nullptr}; enum { kEEPROMEraseCurrent = 'eeEC' }; static constexpr uInt32 MAX_PAGES = 5; - std::array myPage; + std::array myPage{nullptr}; private: void loadConfig() override; diff --git a/src/debugger/gui/GenesisWidget.hxx b/src/debugger/gui/GenesisWidget.hxx index ca3be94fd..a21c8d40a 100644 --- a/src/debugger/gui/GenesisWidget.hxx +++ b/src/debugger/gui/GenesisWidget.hxx @@ -31,7 +31,7 @@ class GenesisWidget : public ControllerWidget private: enum { kJUp = 0, kJDown, kJLeft, kJRight, kJBbtn, kJCbtn }; - std::array myPins; + std::array myPins{nullptr}; static constexpr std::array ourPinNo = {{ Controller::DigitalPin::One, Controller::DigitalPin::Two, Controller::DigitalPin::Three, Controller::DigitalPin::Four, diff --git a/src/debugger/gui/JoystickWidget.hxx b/src/debugger/gui/JoystickWidget.hxx index c2d47535f..6bad9b63f 100644 --- a/src/debugger/gui/JoystickWidget.hxx +++ b/src/debugger/gui/JoystickWidget.hxx @@ -31,7 +31,7 @@ class JoystickWidget : public ControllerWidget private: enum { kJUp = 0, kJDown, kJLeft, kJRight, kJFire }; - std::array myPins; + std::array myPins{nullptr}; static constexpr std::array ourPinNo = {{ Controller::DigitalPin::One, Controller::DigitalPin::Two, Controller::DigitalPin::Three, Controller::DigitalPin::Four, diff --git a/src/debugger/gui/KeyboardWidget.hxx b/src/debugger/gui/KeyboardWidget.hxx index fcd7ce0e3..b91771057 100644 --- a/src/debugger/gui/KeyboardWidget.hxx +++ b/src/debugger/gui/KeyboardWidget.hxx @@ -29,8 +29,8 @@ class KeyboardWidget : public ControllerWidget virtual ~KeyboardWidget() = default; private: - std::array myBox; - const Event::Type* myEvent; + std::array myBox{nullptr}; + const Event::Type* myEvent{nullptr}; static constexpr std::array ourLeftEvents = {{ Event::KeyboardZero1, Event::KeyboardZero2, Event::KeyboardZero3, diff --git a/src/debugger/gui/PaddleWidget.hxx b/src/debugger/gui/PaddleWidget.hxx index e5cd356e8..1c868cc57 100644 --- a/src/debugger/gui/PaddleWidget.hxx +++ b/src/debugger/gui/PaddleWidget.hxx @@ -33,8 +33,8 @@ class PaddleWidget : public ControllerWidget enum { kP0Changed = 'P0ch', kP1Changed = 'P1ch', kP0Fire = 'P0fr', kP1Fire = 'P1fr' }; - SliderWidget *myP0Resistance, *myP1Resistance; - CheckboxWidget *myP0Fire, *myP1Fire; + SliderWidget *myP0Resistance{nullptr}, *myP1Resistance{nullptr}; + CheckboxWidget *myP0Fire{nullptr}, *myP1Fire{nullptr}; private: void loadConfig() override; diff --git a/src/debugger/gui/PointingDeviceWidget.hxx b/src/debugger/gui/PointingDeviceWidget.hxx index d03f88fa2..17997e913 100644 --- a/src/debugger/gui/PointingDeviceWidget.hxx +++ b/src/debugger/gui/PointingDeviceWidget.hxx @@ -39,11 +39,11 @@ class PointingDeviceWidget : public ControllerWidget kTBDown = 'TWdn', kTBFire = 'TWfr' }; - ButtonWidget *myGrayLeft, *myGrayRight; - DataGridWidget* myGrayValueH; - ButtonWidget *myGrayUp, *myGrayDown; - DataGridWidget* myGrayValueV; - CheckboxWidget* myFire; + ButtonWidget *myGrayLeft{nullptr}, *myGrayRight{nullptr}; + DataGridWidget* myGrayValueH{nullptr}; + ButtonWidget *myGrayUp{nullptr}, *myGrayDown{nullptr}; + DataGridWidget* myGrayValueV{nullptr}; + CheckboxWidget* myFire{nullptr}; private: virtual uInt8 getGrayCodeTable(const int index, const int direction) const = 0; diff --git a/src/debugger/gui/PromptWidget.cxx b/src/debugger/gui/PromptWidget.cxx index eca544869..77bef9b2b 100644 --- a/src/debugger/gui/PromptWidget.cxx +++ b/src/debugger/gui/PromptWidget.cxx @@ -29,6 +29,7 @@ #define PROMPT "> " +// TODO: Github issue #361 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PromptWidget::PromptWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h) diff --git a/src/debugger/gui/RamWidget.cxx b/src/debugger/gui/RamWidget.cxx index 0d77a4981..4f258e7ab 100644 --- a/src/debugger/gui/RamWidget.cxx +++ b/src/debugger/gui/RamWidget.cxx @@ -38,7 +38,6 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n myFontHeight(lfont.getFontHeight()), myLineHeight(lfont.getLineHeight()), myButtonHeight(myLineHeight + 4), - myCurrentRamBank(0), myRamSize(ramsize), myNumRows(numrows), myPageSize(pagesize) diff --git a/src/debugger/gui/RamWidget.hxx b/src/debugger/gui/RamWidget.hxx index 0b1af4c13..9b2776a2c 100644 --- a/src/debugger/gui/RamWidget.hxx +++ b/src/debugger/gui/RamWidget.hxx @@ -68,7 +68,7 @@ class RamWidget : public Widget, public CommandSender // These will be needed by most of the child classes; // we may as well make them protected variables - int myFontWidth, myFontHeight, myLineHeight, myButtonHeight; + int myFontWidth{0}, myFontHeight{0}, myLineHeight{0}, myButtonHeight{0}; private: enum { @@ -84,27 +84,27 @@ class RamWidget : public Widget, public CommandSender kRamBinID }; - uInt32 myUndoAddress, myUndoValue; - uInt32 myCurrentRamBank; - uInt32 myRamSize; - uInt32 myNumRows; - uInt32 myPageSize; + uInt32 myUndoAddress{0}, myUndoValue{0}; + uInt32 myCurrentRamBank{0}; + uInt32 myRamSize{0}; + uInt32 myNumRows{0}; + uInt32 myPageSize{0}; unique_ptr myInputBox; - StaticTextWidget* myRamStart; - std::array myRamLabels; + StaticTextWidget* myRamStart{nullptr}; + std::array myRamLabels{nullptr}; - DataGridWidget* myRamGrid; - DataGridWidget* myDecValue; - DataGridWidget* myBinValue; - EditTextWidget* myLabel; + DataGridWidget* myRamGrid{nullptr}; + DataGridWidget* myDecValue{nullptr}; + DataGridWidget* myBinValue{nullptr}; + EditTextWidget* myLabel{nullptr}; - ButtonWidget* myRevertButton; - ButtonWidget* myUndoButton; - ButtonWidget* mySearchButton; - ButtonWidget* myCompareButton; - ButtonWidget* myRestartButton; + ButtonWidget* myRevertButton{nullptr}; + ButtonWidget* myUndoButton{nullptr}; + ButtonWidget* mySearchButton{nullptr}; + ButtonWidget* myCompareButton{nullptr}; + ButtonWidget* myRestartButton{nullptr}; ByteArray myOldValueList; IntArray mySearchAddr; diff --git a/src/debugger/gui/RiotWidget.hxx b/src/debugger/gui/RiotWidget.hxx index 1c7d88e24..7ec9909a3 100644 --- a/src/debugger/gui/RiotWidget.hxx +++ b/src/debugger/gui/RiotWidget.hxx @@ -45,30 +45,30 @@ class RiotWidget : public Widget, public CommandSender void loadConfig() override; private: - ToggleBitWidget* mySWCHAReadBits; - ToggleBitWidget* mySWCHAWriteBits; - ToggleBitWidget* mySWACNTBits; - ToggleBitWidget* mySWCHBReadBits; - ToggleBitWidget* mySWCHBWriteBits; - ToggleBitWidget* mySWBCNTBits; + ToggleBitWidget* mySWCHAReadBits{nullptr}; + ToggleBitWidget* mySWCHAWriteBits{nullptr}; + ToggleBitWidget* mySWACNTBits{nullptr}; + ToggleBitWidget* mySWCHBReadBits{nullptr}; + ToggleBitWidget* mySWCHBWriteBits{nullptr}; + ToggleBitWidget* mySWBCNTBits{nullptr}; - DataGridWidget* myLeftINPT; - DataGridWidget* myRightINPT; - CheckboxWidget* myINPTLatch; - CheckboxWidget* myINPTDump; + DataGridWidget* myLeftINPT{nullptr}; + DataGridWidget* myRightINPT{nullptr}; + CheckboxWidget* myINPTLatch{nullptr}; + CheckboxWidget* myINPTDump{nullptr}; - DataGridWidget* myTimWrite; - DataGridWidget* myTimRead; - DataGridWidget* myTimDivider; + DataGridWidget* myTimWrite{nullptr}; + DataGridWidget* myTimRead{nullptr}; + DataGridWidget* myTimDivider{nullptr}; - ControllerWidget *myLeftControl, *myRightControl; - PopUpWidget *myP0Diff, *myP1Diff; - PopUpWidget *myTVType; - CheckboxWidget* mySelect; - CheckboxWidget* myReset; - CheckboxWidget* myPause; + ControllerWidget *myLeftControl{nullptr}, *myRightControl{nullptr}; + PopUpWidget *myP0Diff{nullptr}, *myP1Diff{nullptr}; + PopUpWidget *myTVType{nullptr}; + CheckboxWidget* mySelect{nullptr}; + CheckboxWidget* myReset{nullptr}; + CheckboxWidget* myPause{nullptr}; - EditTextWidget* myConsole; + EditTextWidget* myConsole{nullptr}; // ID's for the various widgets // We need ID's, since there are more than one of several types of widgets diff --git a/src/debugger/gui/RomListSettings.cxx b/src/debugger/gui/RomListSettings.cxx index dce8e86b2..d18b26572 100644 --- a/src/debugger/gui/RomListSettings.cxx +++ b/src/debugger/gui/RomListSettings.cxx @@ -28,10 +28,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RomListSettings::RomListSettings(GuiObject* boss, const GUI::Font& font) : Dialog(boss->instance(), boss->parent()), - CommandSender(boss), - _xorig(0), - _yorig(0), - _item(0) + CommandSender(boss) { const int buttonWidth = font.getStringWidth("RunTo PC @ current line") + 20, buttonHeight = font.getLineHeight() + 4; diff --git a/src/debugger/gui/RomListSettings.hxx b/src/debugger/gui/RomListSettings.hxx index c603b7400..3aaeb460c 100644 --- a/src/debugger/gui/RomListSettings.hxx +++ b/src/debugger/gui/RomListSettings.hxx @@ -42,13 +42,13 @@ class RomListSettings : public Dialog, public CommandSender void center() override; private: - uInt32 _xorig, _yorig; - int _item; // currently selected line number in the disassembly list + uInt32 _xorig{0}, _yorig{0}; + int _item{0}; // currently selected line number in the disassembly list - CheckboxWidget* myShowTentative; - CheckboxWidget* myShowAddresses; - CheckboxWidget* myShowGFXBinary; - CheckboxWidget* myUseRelocation; + CheckboxWidget* myShowTentative{nullptr}; + CheckboxWidget* myShowAddresses{nullptr}; + CheckboxWidget* myShowGFXBinary{nullptr}; + CheckboxWidget* myUseRelocation{nullptr}; private: void loadConfig() override; diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx index 5e6128c2d..6b6624cff 100644 --- a/src/debugger/gui/RomListWidget.cxx +++ b/src/debugger/gui/RomListWidget.cxx @@ -30,16 +30,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont, int x, int y, int w, int h) - : EditableWidget(boss, nfont, x, y, 16, 16), - _rows(0), - _cols(0), - _currentPos(0), - _selectedItem(-1), - _highlightedItem(-1), - _editMode(false), - _currentKeyDown(KBDK_UNKNOWN), - _base(Common::Base::Fmt::_DEFAULT), - myDisasm(nullptr)//, + : EditableWidget(boss, nfont, x, y, 16, 16) { _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS; _bgcolor = kWidColor; diff --git a/src/debugger/gui/RomListWidget.hxx b/src/debugger/gui/RomListWidget.hxx index a0455cbc4..19afa7753 100644 --- a/src/debugger/gui/RomListWidget.hxx +++ b/src/debugger/gui/RomListWidget.hxx @@ -87,21 +87,21 @@ class RomListWidget : public EditableWidget private: unique_ptr myMenu; - ScrollBarWidget* myScrollBar; + ScrollBarWidget* myScrollBar{nullptr}; - int _labelWidth; - int _bytesWidth; - int _rows; - int _cols; - int _currentPos; // position of first line in visible window - int _selectedItem; - int _highlightedItem; - bool _editMode; - StellaKey _currentKeyDown; - Common::Base::Fmt _base; // base used during editing + int _labelWidth{0}; + int _bytesWidth{0}; + int _rows{0}; + int _cols{0}; + int _currentPos{0}; // position of first line in visible window + int _selectedItem{-1}; + int _highlightedItem{-1}; + bool _editMode{false}; + StellaKey _currentKeyDown{KBDK_UNKNOWN}; + Common::Base::Fmt _base{Common::Base::Fmt::_DEFAULT}; // base used during editing - const CartDebug::Disassembly* myDisasm; - vector myCheckList; + const CartDebug::Disassembly* myDisasm{nullptr}; + vector myCheckList{nullptr}; private: // Following constructors and assignment operators not supported diff --git a/src/debugger/gui/RomWidget.cxx b/src/debugger/gui/RomWidget.cxx index adeded043..e13d25b9d 100644 --- a/src/debugger/gui/RomWidget.cxx +++ b/src/debugger/gui/RomWidget.cxx @@ -33,8 +33,7 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont, int x, int y, int w, int h) : Widget(boss, lfont, x, y, w, h), - CommandSender(boss), - myListIsDirty(true) + CommandSender(boss) { int xpos, ypos; StaticTextWidget* t; diff --git a/src/debugger/gui/RomWidget.hxx b/src/debugger/gui/RomWidget.hxx index f439dff12..0212457ef 100644 --- a/src/debugger/gui/RomWidget.hxx +++ b/src/debugger/gui/RomWidget.hxx @@ -55,10 +55,10 @@ class RomWidget : public Widget, public CommandSender Common::Base::Fmt base); private: - RomListWidget* myRomList; - EditTextWidget* myBank; + RomListWidget* myRomList{nullptr}; + EditTextWidget* myBank{nullptr}; - bool myListIsDirty; + bool myListIsDirty{true}; private: // Following constructors and assignment operators not supported diff --git a/src/debugger/gui/TiaInfoWidget.hxx b/src/debugger/gui/TiaInfoWidget.hxx index 8b06907d3..3f3531de5 100644 --- a/src/debugger/gui/TiaInfoWidget.hxx +++ b/src/debugger/gui/TiaInfoWidget.hxx @@ -36,17 +36,17 @@ class TiaInfoWidget : public Widget, public CommandSender void loadConfig() override; private: - EditTextWidget* myFrameCount; - EditTextWidget* myFrameCycles; + EditTextWidget* myFrameCount{nullptr}; + EditTextWidget* myFrameCycles{nullptr}; - EditTextWidget* myScanlineCount; - EditTextWidget* myScanlineCountLast; - EditTextWidget* myScanlineCycles; - EditTextWidget* myPixelPosition; - EditTextWidget* myColorClocks; + EditTextWidget* myScanlineCount{nullptr}; + EditTextWidget* myScanlineCountLast{nullptr}; + EditTextWidget* myScanlineCycles{nullptr}; + EditTextWidget* myPixelPosition{nullptr}; + EditTextWidget* myColorClocks{nullptr}; - CheckboxWidget* myVSync; - CheckboxWidget* myVBlank; + CheckboxWidget* myVSync{nullptr}; + CheckboxWidget* myVBlank{nullptr}; private: void handleMouseDown(int x, int y, MouseButton b, int clickCount) override; diff --git a/src/debugger/gui/TiaOutputWidget.cxx b/src/debugger/gui/TiaOutputWidget.cxx index f697f04c8..db614f0ec 100644 --- a/src/debugger/gui/TiaOutputWidget.cxx +++ b/src/debugger/gui/TiaOutputWidget.cxx @@ -38,10 +38,7 @@ TiaOutputWidget::TiaOutputWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h) : Widget(boss, font, x, y, w, h), - CommandSender(boss), - myZoom(nullptr), - myClickX(0), - myClickY(0) + CommandSender(boss) { // Create context menu for commands VariantList l; diff --git a/src/debugger/gui/TiaOutputWidget.hxx b/src/debugger/gui/TiaOutputWidget.hxx index 3b2177372..0b6f63bd2 100644 --- a/src/debugger/gui/TiaOutputWidget.hxx +++ b/src/debugger/gui/TiaOutputWidget.hxx @@ -49,9 +49,9 @@ class TiaOutputWidget : public Widget, public CommandSender */ private: unique_ptr myMenu; - TiaZoomWidget* myZoom; + TiaZoomWidget* myZoom{nullptr}; - int myClickX, myClickY; + int myClickX{0}, myClickY{0}; // Create this buffer once, instead of allocating it each time the // TIA image is redrawn diff --git a/src/debugger/gui/TiaWidget.hxx b/src/debugger/gui/TiaWidget.hxx index ba4100e5b..d1faa9ae2 100644 --- a/src/debugger/gui/TiaWidget.hxx +++ b/src/debugger/gui/TiaWidget.hxx @@ -39,64 +39,64 @@ class TiaWidget : public Widget, public CommandSender virtual ~TiaWidget() = default; private: - DataGridWidget* myColorRegs; + DataGridWidget* myColorRegs{nullptr}; - ColorWidget* myCOLUP0Color; - ColorWidget* myCOLUP1Color; - ColorWidget* myCOLUPFColor; - ColorWidget* myCOLUBKColor; + ColorWidget* myCOLUP0Color{nullptr}; + ColorWidget* myCOLUP1Color{nullptr}; + ColorWidget* myCOLUPFColor{nullptr}; + ColorWidget* myCOLUBKColor{nullptr}; - CheckboxWidget* myFixedEnabled; - std::array myFixedColors; + CheckboxWidget* myFixedEnabled{nullptr}; + std::array myFixedColors{nullptr}; - TogglePixelWidget* myGRP0; - TogglePixelWidget* myGRP0Old; - TogglePixelWidget* myGRP1; - TogglePixelWidget* myGRP1Old; + TogglePixelWidget* myGRP0{nullptr}; + TogglePixelWidget* myGRP0Old{nullptr}; + TogglePixelWidget* myGRP1{nullptr}; + TogglePixelWidget* myGRP1Old{nullptr}; - DataGridWidget* myPosP0; - DataGridWidget* myPosP1; - DataGridWidget* myPosM0; - DataGridWidget* myPosM1; - DataGridWidget* myPosBL; + DataGridWidget* myPosP0{nullptr}; + DataGridWidget* myPosP1{nullptr}; + DataGridWidget* myPosM0{nullptr}; + DataGridWidget* myPosM1{nullptr}; + DataGridWidget* myPosBL{nullptr}; - DataGridWidget* myHMP0; - DataGridWidget* myHMP1; - DataGridWidget* myHMM0; - DataGridWidget* myHMM1; - DataGridWidget* myHMBL; + DataGridWidget* myHMP0{nullptr}; + DataGridWidget* myHMP1{nullptr}; + DataGridWidget* myHMM0{nullptr}; + DataGridWidget* myHMM1{nullptr}; + DataGridWidget* myHMBL{nullptr}; - DataGridWidget* myNusizP0; - DataGridWidget* myNusizP1; - DataGridWidget* myNusizM0; - DataGridWidget* myNusizM1; - DataGridWidget* mySizeBL; - EditTextWidget* myNusizP0Text; - EditTextWidget* myNusizP1Text; + DataGridWidget* myNusizP0{nullptr}; + DataGridWidget* myNusizP1{nullptr}; + DataGridWidget* myNusizM0{nullptr}; + DataGridWidget* myNusizM1{nullptr}; + DataGridWidget* mySizeBL{nullptr}; + EditTextWidget* myNusizP0Text{nullptr}; + EditTextWidget* myNusizP1Text{nullptr}; - CheckboxWidget* myRefP0; - CheckboxWidget* myRefP1; - CheckboxWidget* myDelP0; - CheckboxWidget* myDelP1; - CheckboxWidget* myDelBL; + CheckboxWidget* myRefP0{nullptr}; + CheckboxWidget* myRefP1{nullptr}; + CheckboxWidget* myDelP0{nullptr}; + CheckboxWidget* myDelP1{nullptr}; + CheckboxWidget* myDelBL{nullptr}; - TogglePixelWidget* myEnaM0; - TogglePixelWidget* myEnaM1; - TogglePixelWidget* myEnaBL; - TogglePixelWidget* myEnaBLOld; + TogglePixelWidget* myEnaM0{nullptr}; + TogglePixelWidget* myEnaM1{nullptr}; + TogglePixelWidget* myEnaBL{nullptr}; + TogglePixelWidget* myEnaBLOld{nullptr}; - CheckboxWidget* myResMP0; - CheckboxWidget* myResMP1; + CheckboxWidget* myResMP0{nullptr}; + CheckboxWidget* myResMP1{nullptr}; /** Collision register bits */ - std::array myCollision; + std::array myCollision{nullptr}; - std::array myPF; - CheckboxWidget* myRefPF; - CheckboxWidget* myScorePF; - CheckboxWidget* myPriorityPF; + std::array myPF{nullptr}; + CheckboxWidget* myRefPF{nullptr}; + CheckboxWidget* myScorePF{nullptr}; + CheckboxWidget* myPriorityPF{nullptr}; - DelayQueueWidget* myDelayQueueWidget; + DelayQueueWidget* myDelayQueueWidget{nullptr}; // ID's for the various widgets // We need ID's, since there are more than one of several types of widgets diff --git a/src/debugger/gui/TiaZoomWidget.hxx b/src/debugger/gui/TiaZoomWidget.hxx index 6e1d04515..90f435528 100644 --- a/src/debugger/gui/TiaZoomWidget.hxx +++ b/src/debugger/gui/TiaZoomWidget.hxx @@ -55,13 +55,13 @@ class TiaZoomWidget : public Widget, public CommandSender private: unique_ptr myMenu; - int myZoomLevel; - int myNumCols, myNumRows; - int myOffX, myOffY; - int myOffXLo, myOffYLo; + int myZoomLevel{0}; + int myNumCols{0}, myNumRows{0}; + int myOffX{0}, myOffY{0}; + int myOffXLo{0}, myOffYLo{0}; - bool myMouseMoving; - int myClickX, myClickY; + bool myMouseMoving{false}; + int myClickX{0}, myClickY{0}; private: // Following constructors and assignment operators not supported diff --git a/src/debugger/gui/ToggleBitWidget.hxx b/src/debugger/gui/ToggleBitWidget.hxx index b7ef81181..c1fa1af45 100644 --- a/src/debugger/gui/ToggleBitWidget.hxx +++ b/src/debugger/gui/ToggleBitWidget.hxx @@ -35,8 +35,8 @@ class ToggleBitWidget : public ToggleWidget void drawWidget(bool hilite) override; protected: - StringList _offList; - StringList _onList; + StringList _offList; + StringList _onList; private: // Following constructors and assignment operators not supported diff --git a/src/debugger/gui/TogglePixelWidget.cxx b/src/debugger/gui/TogglePixelWidget.cxx index f917cc419..f4fe61468 100644 --- a/src/debugger/gui/TogglePixelWidget.cxx +++ b/src/debugger/gui/TogglePixelWidget.cxx @@ -25,11 +25,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TogglePixelWidget::TogglePixelWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int cols, int rows) - : ToggleWidget(boss, font, x, y, cols, rows, 1), - _pixelColor(kNone), - _backgroundColor(kDlgColor), - _swapBits(false), - _crossBits(false) + : ToggleWidget(boss, font, x, y, cols, rows, 1) { _rowHeight = _colWidth = font.getLineHeight(); diff --git a/src/debugger/gui/TogglePixelWidget.hxx b/src/debugger/gui/TogglePixelWidget.hxx index 7ee35847f..41766913e 100644 --- a/src/debugger/gui/TogglePixelWidget.hxx +++ b/src/debugger/gui/TogglePixelWidget.hxx @@ -41,9 +41,9 @@ class TogglePixelWidget : public ToggleWidget void setCrossed(bool enable) { _crossBits = enable; } private: - ColorId _pixelColor, _backgroundColor; - bool _swapBits; - bool _crossBits; + ColorId _pixelColor{kNone}, _backgroundColor{kDlgColor}; + bool _swapBits{false}; + bool _crossBits{false}; private: void drawWidget(bool hilite) override; diff --git a/src/emucore/AtariVox.cxx b/src/emucore/AtariVox.cxx index e877817bf..bc0dd1a4a 100644 --- a/src/emucore/AtariVox.cxx +++ b/src/emucore/AtariVox.cxx @@ -24,10 +24,7 @@ AtariVox::AtariVox(Jack jack, const Event& event, const System& system, const string& portname, const string& eepromfile, const onMessageCallback& callback) - : SaveKey(jack, event, system, eepromfile, callback, Controller::Type::AtariVox), - myShiftCount(0), - myShiftRegister(0), - myLastDataWriteCycle(0) + : SaveKey(jack, event, system, eepromfile, callback, Controller::Type::AtariVox) { mySerialPort = MediaFactory::createSerialPort(); if(mySerialPort->openPort(portname)) diff --git a/src/emucore/AtariVox.hxx b/src/emucore/AtariVox.hxx index 1dc4a840c..358e8655b 100644 --- a/src/emucore/AtariVox.hxx +++ b/src/emucore/AtariVox.hxx @@ -97,19 +97,19 @@ class AtariVox : public SaveKey unique_ptr mySerialPort; // How many bits have been shifted into the shift register? - uInt8 myShiftCount; + uInt8 myShiftCount{0}; // Shift register. Data comes in serially: // 1 start bit, always 0 // 8 data bits, LSB first // 1 stop bit, always 1 - uInt16 myShiftRegister; + uInt16 myShiftRegister{0}; // When did the last data write start, in CPU cycles? // The real SpeakJet chip reads data at 19200 bits/sec. Alex's // driver code sends data at 62 CPU cycles per bit, which is // "close enough". - uInt64 myLastDataWriteCycle; + uInt64 myLastDataWriteCycle{0}; // Holds information concerning serial port usage string myAboutString; diff --git a/src/emucore/Booster.cxx b/src/emucore/Booster.cxx index 29f90e924..3e931547c 100644 --- a/src/emucore/Booster.cxx +++ b/src/emucore/Booster.cxx @@ -20,8 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BoosterGrip::BoosterGrip(Jack jack, const Event& event, const System& system) - : Controller(jack, event, system, Controller::Type::BoosterGrip), - myControlID(-1) + : Controller(jack, event, system, Controller::Type::BoosterGrip) { if(myJack == Jack::Left) { diff --git a/src/emucore/Booster.hxx b/src/emucore/Booster.hxx index 79a5d932d..8aa1fb33d 100644 --- a/src/emucore/Booster.hxx +++ b/src/emucore/Booster.hxx @@ -80,7 +80,7 @@ class BoosterGrip : public Controller myXAxisValue, myYAxisValue; // Controller to emulate in normal mouse axis mode - int myControlID; + int myControlID{-1}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/Cart.cxx b/src/emucore/Cart.cxx index 319b9dcca..24af8697a 100644 --- a/src/emucore/Cart.cxx +++ b/src/emucore/Cart.cxx @@ -27,12 +27,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cartridge::Cartridge(const Settings& settings, const string& md5) - : mySettings(settings), - myBankChanged(true), - myCodeAccessBase(nullptr), - myRamWriteAccess(0), - myStartBank(0), - myBankLocked(false) + : 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/Cart.hxx b/src/emucore/Cart.hxx index 220a9022f..69ed19a20 100644 --- a/src/emucore/Cart.hxx +++ b/src/emucore/Cart.hxx @@ -318,22 +318,22 @@ class Cartridge : public Device const Settings& mySettings; // Indicates if the bank has changed somehow (a bankswitch has occurred) - bool myBankChanged; + bool myBankChanged{true}; // The array containing information about every byte of ROM indicating // whether it is used as code. ByteBuffer myCodeAccessBase; // Contains address of illegal RAM write access or 0 - uInt16 myRamWriteAccess; + uInt16 myRamWriteAccess{0}; private: // The startup bank to use (where to look for the reset vector address) - uInt16 myStartBank; + uInt16 myStartBank{0}; // If myBankLocked is true, ignore attempts at bankswitching. This is used // by the debugger, when disassembling/dumping ROM. - bool myBankLocked; + bool myBankLocked{false}; // Semi-random values to use when a read from write port occurs std::array myRWPRandomValues; diff --git a/src/emucore/Cart0840.cxx b/src/emucore/Cart0840.cxx index bdce3222c..bc70f10d0 100644 --- a/src/emucore/Cart0840.cxx +++ b/src/emucore/Cart0840.cxx @@ -21,8 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cartridge0840::Cartridge0840(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myBankOffset(0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/Cart0840.hxx b/src/emucore/Cart0840.hxx index 7da7c052c..c75c9c3e6 100644 --- a/src/emucore/Cart0840.hxx +++ b/src/emucore/Cart0840.hxx @@ -156,7 +156,7 @@ class Cartridge0840 : public Cartridge std::array myImage; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; // Previous Device's page access std::array myHotSpotPageAccess; diff --git a/src/emucore/Cart2K.hxx b/src/emucore/Cart2K.hxx index e3fc8834a..fe54bfb38 100644 --- a/src/emucore/Cart2K.hxx +++ b/src/emucore/Cart2K.hxx @@ -130,10 +130,10 @@ class Cartridge2K : public Cartridge ByteBuffer myImage; // Size of the ROM image - size_t mySize; + size_t mySize{0}; // Mask to use for mirroring - uInt16 myMask; + uInt16 myMask{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/Cart3E.cxx b/src/emucore/Cart3E.cxx index 8e86d7491..715d87358 100644 --- a/src/emucore/Cart3E.cxx +++ b/src/emucore/Cart3E.cxx @@ -23,8 +23,7 @@ Cartridge3E::Cartridge3E(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), - mySize(size), - myCurrentBank(0) + mySize(size) { // Allocate array for the ROM image myImage = make_unique(mySize); diff --git a/src/emucore/Cart3E.hxx b/src/emucore/Cart3E.hxx index 5b755cc81..30620b452 100644 --- a/src/emucore/Cart3E.hxx +++ b/src/emucore/Cart3E.hxx @@ -188,10 +188,10 @@ class Cartridge3E : public Cartridge std::array myRAM; // Size of the ROM image - size_t mySize; + size_t mySize{0}; // Indicates which bank is currently active for the first segment - uInt16 myCurrentBank; + uInt16 myCurrentBank{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/Cart3EPlus.hxx b/src/emucore/Cart3EPlus.hxx index 5cecbf5c4..f61b5dc0d 100644 --- a/src/emucore/Cart3EPlus.hxx +++ b/src/emucore/Cart3EPlus.hxx @@ -191,7 +191,7 @@ class Cartridge3EPlus: public Cartridge static constexpr uInt16 RAM_WRITE_OFFSET = 0x200; ByteBuffer myImage; // Pointer to a dynamically allocated ROM image of the cartridge - size_t mySize; // Size of the ROM image + size_t mySize{0}; // Size of the ROM image std::array myRAM; private: diff --git a/src/emucore/Cart3F.cxx b/src/emucore/Cart3F.cxx index 85a36ee13..435a12057 100644 --- a/src/emucore/Cart3F.cxx +++ b/src/emucore/Cart3F.cxx @@ -23,8 +23,7 @@ Cartridge3F::Cartridge3F(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), - mySize(size), - myCurrentBank(0) + mySize(size) { // Allocate array for the ROM image myImage = make_unique(mySize); diff --git a/src/emucore/Cart3F.hxx b/src/emucore/Cart3F.hxx index d26b396ea..b7ec2a4b4 100644 --- a/src/emucore/Cart3F.hxx +++ b/src/emucore/Cart3F.hxx @@ -162,10 +162,10 @@ class Cartridge3F : public Cartridge ByteBuffer myImage; // Size of the ROM image - size_t mySize; + size_t mySize{0}; // Indicates which bank is currently active for the first segment - uInt16 myCurrentBank; + uInt16 myCurrentBank{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/Cart4A50.cxx b/src/emucore/Cart4A50.cxx index 2e550e108..aaf376d62 100644 --- a/src/emucore/Cart4A50.cxx +++ b/src/emucore/Cart4A50.cxx @@ -24,15 +24,7 @@ Cartridge4A50::Cartridge4A50(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), - mySize(size), - mySliceLow(0), - mySliceMiddle(0), - mySliceHigh(0), - myIsRomLow(true), - myIsRomMiddle(true), - myIsRomHigh(true), - myLastAddress(0), - myLastData(0) + 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/Cart4A50.hxx b/src/emucore/Cart4A50.hxx index 90239aaee..40e1e9cee 100644 --- a/src/emucore/Cart4A50.hxx +++ b/src/emucore/Cart4A50.hxx @@ -225,21 +225,21 @@ class Cartridge4A50 : public Cartridge std::array myRAM; // (Actual) Size of the ROM image - size_t mySize; + size_t mySize{0}; // Indicates the slice mapped into each of the three segments - uInt16 mySliceLow; /* index pointer for $1000-$17ff slice */ - uInt16 mySliceMiddle; /* index pointer for $1800-$1dff slice */ - uInt16 mySliceHigh; /* index pointer for $1e00-$1eff slice */ + uInt16 mySliceLow{0}; // index pointer for $1000-$17ff slice + uInt16 mySliceMiddle{0}; // index pointer for $1800-$1dff slice + uInt16 mySliceHigh{0}; // index pointer for $1e00-$1eff slice // Indicates whether the given slice is mapped to ROM or RAM - bool myIsRomLow; /* true = ROM -- false = RAM at $1000-$17ff */ - bool myIsRomMiddle; /* true = ROM -- false = RAM at $1800-$1dff */ - bool myIsRomHigh; /* true = ROM -- false = RAM at $1e00-$1eFF */ + bool myIsRomLow{true}; // true = ROM -- false = RAM at $1000-$17ff + bool myIsRomMiddle{true}; // true = ROM -- false = RAM at $1800-$1dff + bool myIsRomHigh{true}; // true = ROM -- false = RAM at $1e00-$1eFF // The previous address and data values (from peek and poke) - uInt16 myLastAddress; - uInt8 myLastData; + uInt16 myLastAddress{0}; + uInt8 myLastData{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartAR.cxx b/src/emucore/CartAR.cxx index 094b2420f..642aa7213 100644 --- a/src/emucore/CartAR.cxx +++ b/src/emucore/CartAR.cxx @@ -23,13 +23,7 @@ CartridgeAR::CartridgeAR(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), - mySize(std::max(size, 8448)), - myWriteEnabled(false), - myPower(true), - myDataHoldRegister(0), - myNumberOfDistinctAccesses(0), - myWritePending(false), - myCurrentBank(0) + mySize(std::max(size, 8448)) { // Create a load image buffer and copy the given image myLoadImages = make_unique(mySize); @@ -38,7 +32,8 @@ CartridgeAR::CartridgeAR(const ByteBuffer& image, size_t size, // Add header if image doesn't include it if(size < 8448) - std::copy_n(ourDefaultHeader.data(), ourDefaultHeader.size(), myLoadImages.get()+myImage.size()); + std::copy_n(ourDefaultHeader.data(), ourDefaultHeader.size(), + myLoadImages.get()+myImage.size()); // We use System::PageAccess.codeAccessBase, but don't allow its use // through a pointer, since the AR scheme doesn't support bankswitching diff --git a/src/emucore/CartAR.hxx b/src/emucore/CartAR.hxx index 2529c3e4a..3ad5495b8 100644 --- a/src/emucore/CartAR.hxx +++ b/src/emucore/CartAR.hxx @@ -196,31 +196,31 @@ class CartridgeAR : public Cartridge std::array myHeader; // Size of the ROM image - size_t mySize; + size_t mySize{0}; // All of the 8448 byte loads associated with the game ByteBuffer myLoadImages; // Indicates how many 8448 loads there are - uInt8 myNumberOfLoadImages; + uInt8 myNumberOfLoadImages{0}; // Indicates if the RAM is write enabled - bool myWriteEnabled; + bool myWriteEnabled{false}; // Indicates if the ROM's power is on or off - bool myPower; + bool myPower{true}; // Data hold register used for writing - uInt8 myDataHoldRegister; + uInt8 myDataHoldRegister{0}; // Indicates number of distinct accesses when data hold register was set - uInt32 myNumberOfDistinctAccesses; + uInt32 myNumberOfDistinctAccesses{0}; // Indicates if a write is pending or not - bool myWritePending; + bool myWritePending{false}; // Indicates which bank is currently active - uInt16 myCurrentBank; + uInt16 myCurrentBank{0}; // Fake SC-BIOS code to simulate the Supercharger load bars static std::array ourDummyROMCode; diff --git a/src/emucore/CartBF.cxx b/src/emucore/CartBF.cxx index 7ac9df7fc..4a0c4a567 100644 --- a/src/emucore/CartBF.cxx +++ b/src/emucore/CartBF.cxx @@ -21,8 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeBF::CartridgeBF(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myBankOffset(0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartBF.hxx b/src/emucore/CartBF.hxx index a5ede3780..183d797ed 100644 --- a/src/emucore/CartBF.hxx +++ b/src/emucore/CartBF.hxx @@ -157,7 +157,7 @@ class CartridgeBF : public Cartridge std::array myImage; // Indicates the offset into the ROM image (aligns to current bank) - uInt32 myBankOffset; + uInt32 myBankOffset{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartBFSC.cxx b/src/emucore/CartBFSC.cxx index 010e9fcf0..a756db956 100644 --- a/src/emucore/CartBFSC.cxx +++ b/src/emucore/CartBFSC.cxx @@ -21,8 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeBFSC::CartridgeBFSC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myBankOffset(0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartBFSC.hxx b/src/emucore/CartBFSC.hxx index 6af2424ca..ec834a4b6 100644 --- a/src/emucore/CartBFSC.hxx +++ b/src/emucore/CartBFSC.hxx @@ -160,7 +160,7 @@ class CartridgeBFSC : public Cartridge std::array myRAM; // Indicates the offset into the ROM image (aligns to current bank) - uInt32 myBankOffset; + uInt32 myBankOffset{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartBUS.cxx b/src/emucore/CartBUS.cxx index 4f87e5b47..8560188be 100644 --- a/src/emucore/CartBUS.cxx +++ b/src/emucore/CartBUS.cxx @@ -43,10 +43,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeBUS::CartridgeBUS(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myAudioCycles(0), - myARMCycles(0), - myFractionalClocks(0.0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartBUS.hxx b/src/emucore/CartBUS.hxx index 25a63194e..201b56ff8 100644 --- a/src/emucore/CartBUS.hxx +++ b/src/emucore/CartBUS.hxx @@ -214,13 +214,13 @@ class CartridgeBUS : public Cartridge std::array myImage; // Pointer to the 28K program ROM image of the cartridge - uInt8* myProgramImage; + uInt8* myProgramImage{nullptr}; // Pointer to the 4K display ROM image of the cartridge - uInt8* myDisplayImage; + uInt8* myDisplayImage{nullptr}; // Pointer to the 2K BUS driver image in RAM - uInt8* myBusDriverImage; + uInt8* myBusDriverImage{nullptr}; // The BUS 8k RAM image, used as: // $0000 - 2K BUS driver @@ -232,44 +232,44 @@ class CartridgeBUS : public Cartridge unique_ptr myThumbEmulator; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; // Address to override the bus for - uInt16 myBusOverdriveAddress; + uInt16 myBusOverdriveAddress{0}; // set to address of ZP if last byte peeked was $84 (STY ZP) - uInt16 mySTYZeroPageAddress; + uInt16 mySTYZeroPageAddress{0}; // set to address of the JMP operand if last byte peeked was 4C // *and* the next two bytes in ROM are 00 00 - uInt16 myJMPoperandAddress; + uInt16 myJMPoperandAddress{0}; // System cycle count from when the last update to music data fetchers occurred - uInt64 myAudioCycles; + uInt64 myAudioCycles{0}; // ARM cycle count from when the last callFunction() occurred - uInt64 myARMCycles; + uInt64 myARMCycles{0}; // The music mode counters - std::array myMusicCounters; + std::array myMusicCounters{0}; // The music frequency - std::array myMusicFrequencies; + std::array myMusicFrequencies{0}; // The music waveform sizes - std::array myMusicWaveformSize; + std::array myMusicWaveformSize{0}; // Fractional DPC music OSC clocks unused during the last update - double myFractionalClocks; + double myFractionalClocks{0.0}; // Controls mode, lower nybble sets Fast Fetch, upper nybble sets audio // -0 = Bus Stuffing ON // -F = Bus Stuffing OFF // 0- = Packed Digital Sample // F- = 3 Voice Music - uInt8 myMode; + uInt8 myMode{0}; - uInt8 myFastJumpActive; + uInt8 myFastJumpActive{false}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartCDF.cxx b/src/emucore/CartCDF.cxx index d14d3483c..144db7392 100644 --- a/src/emucore/CartCDF.cxx +++ b/src/emucore/CartCDF.cxx @@ -59,10 +59,7 @@ namespace { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeCDF::CartridgeCDF(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myAudioCycles(0), - myARMCycles(0), - myFractionalClocks(0.0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartCDF.hxx b/src/emucore/CartCDF.hxx index 7c1e6aad4..002c31160 100644 --- a/src/emucore/CartCDF.hxx +++ b/src/emucore/CartCDF.hxx @@ -214,13 +214,13 @@ class CartridgeCDF : public Cartridge std::array myImage; // Pointer to the 28K program ROM image of the cartridge - uInt8* myProgramImage; + uInt8* myProgramImage{nullptr}; // Pointer to the 4K display ROM image of the cartridge - uInt8* myDisplayImage; + uInt8* myDisplayImage{nullptr}; // Pointer to the 2K CDF driver image in RAM - uInt8* myBusDriverImage; + uInt8* myBusDriverImage{nullptr}; // The CDF 8k RAM image, used as: // $0000 - 2K CDF driver @@ -232,13 +232,13 @@ class CartridgeCDF : public Cartridge unique_ptr myThumbEmulator; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; // System cycle count from when the last update to music data fetchers occurred - uInt64 myAudioCycles; + uInt64 myAudioCycles{0}; // ARM cycle count from when the last callFunction() occurred - uInt64 myARMCycles; + uInt64 myARMCycles{0}; // The audio routines in the driver run in 32-bit mode and take advantage // of the FIQ Shadow Registers which are not accessible to 16-bit thumb @@ -257,53 +257,53 @@ class CartridgeCDF : public Cartridge r14 = timer base */ // The music counters, ARM FIQ shadow registers r8, r9, r10 - std::array myMusicCounters; + std::array myMusicCounters{0}; // The music frequency, ARM FIQ shadow registers r11, r12, r13 - std::array myMusicFrequencies; + std::array myMusicFrequencies{0}; // The music waveform sizes - std::array myMusicWaveformSize; + std::array myMusicWaveformSize{0}; // Fractional CDF music, OSC clocks unused during the last update - double myFractionalClocks; + double myFractionalClocks{0.0}; // Controls mode, lower nybble sets Fast Fetch, upper nybble sets audio // -0 = Fast Fetch ON // -F = Fast Fetch OFF // 0- = Packed Digital Sample // F- = 3 Voice Music - uInt8 myMode; + uInt8 myMode{0xFF}; // set to address of #value if last byte peeked was A9 (LDA #) - uInt16 myLDAimmediateOperandAddress; + uInt16 myLDAimmediateOperandAddress{0}; // set to address of the JMP operand if last byte peeked was 4C // *and* the next two bytes in ROM are 00 00 - uInt16 myJMPoperandAddress; + uInt16 myJMPoperandAddress{0}; - uInt8 myFastJumpActive; + uInt8 myFastJumpActive{0}; // Pointer to the array of datastream pointers - uInt16 myDatastreamBase; + uInt16 myDatastreamBase{0}; // Pointer to the array of datastream increments - uInt16 myDatastreamIncrementBase; + uInt16 myDatastreamIncrementBase{0}; // Pointer to the beginning of the waveform data block - uInt16 myWaveformBase; + uInt16 myWaveformBase{0}; // Amplitude stream index - uInt8 myAmplitudeStream; + uInt8 myAmplitudeStream{0}; // Mask for determining the index of the datastream during fastjump - uInt8 myFastjumpStreamIndexMask; + uInt8 myFastjumpStreamIndexMask{0}; // The currently selected fastjump stream - uInt8 myFastJumpStream; + uInt8 myFastJumpStream{0}; // CDF subtype - CDFSubtype myCDFSubtype; + CDFSubtype myCDFSubtype{CDFSubtype::CDF0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartCM.cxx b/src/emucore/CartCM.cxx index 37e889dd0..3bc41daba 100644 --- a/src/emucore/CartCM.cxx +++ b/src/emucore/CartCM.cxx @@ -23,9 +23,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeCM::CartridgeCM(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - mySWCHA(0xFF), // portA is all 1's - myBankOffset(0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartCM.hxx b/src/emucore/CartCM.hxx index 8b55be14a..8d5eeaac0 100644 --- a/src/emucore/CartCM.hxx +++ b/src/emucore/CartCM.hxx @@ -249,10 +249,10 @@ class CartridgeCM : public Cartridge std::array myRAM; // Current copy of SWCHA (controls ROM/RAM accesses) - uInt8 mySWCHA; + uInt8 mySWCHA{0xFF}; // Port A all 1's // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartCTY.cxx b/src/emucore/CartCTY.cxx index 2e9fd8390..966ade434 100644 --- a/src/emucore/CartCTY.cxx +++ b/src/emucore/CartCTY.cxx @@ -24,15 +24,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeCTY::CartridgeCTY(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myOperationType(0), - myTunePosition(0), - myLDAimmediate(false), - myRandomNumber(0x2B435044), - myRamAccessTimeout(0), - myAudioCycles(0), - myFractionalClocks(0.0), - myBankOffset(0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartCTY.hxx b/src/emucore/CartCTY.hxx index 2766abad8..1ae33f0f8 100644 --- a/src/emucore/CartCTY.hxx +++ b/src/emucore/CartCTY.hxx @@ -269,45 +269,45 @@ class CartridgeCTY : public Cartridge std::array myRAM; // Operation type (written to $1000, used by hotspot $1FF4) - uInt8 myOperationType; + uInt8 myOperationType{0}; // Pointer to the 28K frequency table (points to the start of one // of seven 4K tunes in myTuneData) - const uInt8* myFrequencyImage; + const uInt8* myFrequencyImage{nullptr}; // The counter register for the data fetcher - uInt16 myTunePosition; + uInt16 myTunePosition{0}; // The music mode counters - std::array myMusicCounters; + std::array myMusicCounters{0}; // The music frequency - std::array myMusicFrequencies; + std::array myMusicFrequencies{0}; // Flags that last byte peeked was A9 (LDA #) - bool myLDAimmediate; + bool myLDAimmediate{false}; // The random number generator register - uInt32 myRandomNumber; + uInt32 myRandomNumber{0x2B435044}; // The time after which the first request of a load/save operation // will actually be completed // Due to Harmony EEPROM constraints, a read/write isn't instantaneous, // so we need to emulate the delay as well - uInt64 myRamAccessTimeout; + uInt64 myRamAccessTimeout{0}; // Full pathname of the file to use when emulating load/save // of internal RAM to Harmony cart EEPROM string myEEPROMFile; // System cycle count from when the last update to music data fetchers occurred - uInt64 myAudioCycles; + uInt64 myAudioCycles{0}; // Fractional DPC music OSC clocks unused during the last update - double myFractionalClocks; + double myFractionalClocks{0.0}; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; static const std::array ourFrequencyTable; diff --git a/src/emucore/CartCV.hxx b/src/emucore/CartCV.hxx index d0df0115f..746e2d86b 100644 --- a/src/emucore/CartCV.hxx +++ b/src/emucore/CartCV.hxx @@ -140,7 +140,7 @@ class CartridgeCV : public Cartridge std::array myImage; // Initial size of the cart data - size_t mySize; + size_t mySize{0}; // The 1024 bytes of RAM std::array myRAM; diff --git a/src/emucore/CartCVPlus.cxx b/src/emucore/CartCVPlus.cxx index 1f68e85f1..8cf305527 100644 --- a/src/emucore/CartCVPlus.cxx +++ b/src/emucore/CartCVPlus.cxx @@ -23,8 +23,7 @@ CartridgeCVPlus::CartridgeCVPlus(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), - mySize(size), - myCurrentBank(0) + mySize(size) { // Allocate array for the ROM image myImage = make_unique(mySize); diff --git a/src/emucore/CartCVPlus.hxx b/src/emucore/CartCVPlus.hxx index 101018b51..c5da221d1 100644 --- a/src/emucore/CartCVPlus.hxx +++ b/src/emucore/CartCVPlus.hxx @@ -171,10 +171,10 @@ class CartridgeCVPlus : public Cartridge std::array myRAM; // Size of the ROM image - size_t mySize; + size_t mySize{0}; // Indicates which bank is currently active for the first segment - uInt16 myCurrentBank; + uInt16 myCurrentBank{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartDASH.hxx b/src/emucore/CartDASH.hxx index 8f2568e97..9f12e76db 100644 --- a/src/emucore/CartDASH.hxx +++ b/src/emucore/CartDASH.hxx @@ -121,7 +121,7 @@ class CartridgeDASHWidget; consecutive RAM (don't forget to copy your reset vectors!) @author Andrew Davie - */ +*/ class CartridgeDASH: public Cartridge { @@ -262,7 +262,7 @@ class CartridgeDASH: public Cartridge static constexpr uInt16 RAM_WRITE_OFFSET = 0x800; ByteBuffer myImage; // Pointer to a dynamically allocated ROM image of the cartridge - size_t mySize; // Size of the ROM image + size_t mySize{0}; // Size of the ROM image std::array myRAM; private: diff --git a/src/emucore/CartDF.cxx b/src/emucore/CartDF.cxx index 5114cda5f..83dc72fd1 100644 --- a/src/emucore/CartDF.cxx +++ b/src/emucore/CartDF.cxx @@ -21,8 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeDF::CartridgeDF(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myBankOffset(0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartDF.hxx b/src/emucore/CartDF.hxx index 55226a2b5..dbb42911b 100644 --- a/src/emucore/CartDF.hxx +++ b/src/emucore/CartDF.hxx @@ -157,7 +157,7 @@ class CartridgeDF : public Cartridge std::array myImage; // Indicates the offset into the ROM image (aligns to current bank) - uInt32 myBankOffset; + uInt32 myBankOffset{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartDFSC.cxx b/src/emucore/CartDFSC.cxx index 8978aa6a7..a6578bd1b 100644 --- a/src/emucore/CartDFSC.cxx +++ b/src/emucore/CartDFSC.cxx @@ -21,8 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeDFSC::CartridgeDFSC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myBankOffset(0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartDFSC.hxx b/src/emucore/CartDFSC.hxx index 45635db46..5d02f69ec 100644 --- a/src/emucore/CartDFSC.hxx +++ b/src/emucore/CartDFSC.hxx @@ -160,7 +160,7 @@ class CartridgeDFSC : public Cartridge std::array myRAM; // Indicates the offset into the ROM image (aligns to current bank) - uInt32 myBankOffset; + uInt32 myBankOffset{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartDPC.cxx b/src/emucore/CartDPC.cxx index c3faaf0e4..02aa69060 100644 --- a/src/emucore/CartDPC.cxx +++ b/src/emucore/CartDPC.cxx @@ -23,11 +23,7 @@ CartridgeDPC::CartridgeDPC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), - mySize(size), - myAudioCycles(0), - myFractionalClocks(0.0), - myBankOffset(0), - myDpcPitch(0.0) + mySize(size) { // Make a copy of the entire image std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); @@ -38,18 +34,6 @@ CartridgeDPC::CartridgeDPC(const ByteBuffer& image, size_t size, // Pointer to the display ROM (2K @ 8K offset) myDisplayImage = myProgramImage + 8_KB; - - // Initialize the DPC data fetcher registers - myTops.fill(0); - myBottoms.fill(0); - myFlags.fill(0); - myCounters.fill(0); - - // None of the data fetchers are in music mode - myMusicMode.fill(false); - - // Initialize the DPC's random number generator register (must be non-zero) - myRandomNumber = 1; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/CartDPC.hxx b/src/emucore/CartDPC.hxx index 8a4018c35..87eaadfc9 100644 --- a/src/emucore/CartDPC.hxx +++ b/src/emucore/CartDPC.hxx @@ -175,43 +175,43 @@ class CartridgeDPC : public Cartridge std::array myImage; // (Actual) Size of the ROM image - size_t mySize; + size_t mySize{0}; // Pointer to the 8K program ROM image of the cartridge - uInt8* myProgramImage; + uInt8* myProgramImage{nullptr}; // Pointer to the 2K display ROM image of the cartridge - uInt8* myDisplayImage; + uInt8* myDisplayImage{nullptr}; // The top registers for the data fetchers - std::array myTops; + std::array myTops{0}; // The bottom registers for the data fetchers - std::array myBottoms; + std::array myBottoms{0}; // The counter registers for the data fetchers - std::array myCounters; + std::array myCounters{0}; // The flag registers for the data fetchers - std::array myFlags; + std::array myFlags{0}; // The music mode DF5, DF6, & DF7 enabled flags - std::array myMusicMode; + std::array myMusicMode{false}; // The random number generator register - uInt8 myRandomNumber; + uInt8 myRandomNumber{1}; // DPC's RNG register (must be non-zero) // System cycle count from when the last update to music data fetchers occurred - uInt64 myAudioCycles; + uInt64 myAudioCycles{0}; // Fractional DPC music OSC clocks unused during the last update - double myFractionalClocks; + double myFractionalClocks{0.0}; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; // DPC pitch - double myDpcPitch; + double myDpcPitch{0.0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartDPCPlus.cxx b/src/emucore/CartDPCPlus.cxx index 7d0b884ef..0febf9bad 100644 --- a/src/emucore/CartDPCPlus.cxx +++ b/src/emucore/CartDPCPlus.cxx @@ -29,15 +29,7 @@ CartridgeDPCPlus::CartridgeDPCPlus(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), - mySize(std::min(size, myImage.size())), - myFastFetch(false), - myLDAimmediate(false), - myParameterPointer(0), - myAudioCycles(0), - myARMCycles(0), - myFractionalClocks(0.0), - myBankOffset(0), - myFractionalLowMask(0x0F00FF) + mySize(std::min(size, myImage.size())) { // Image is always 32K, but in the case of ROM > 29K, the image is // copied to the end of the buffer diff --git a/src/emucore/CartDPCPlus.hxx b/src/emucore/CartDPCPlus.hxx index be833f922..6c77cb083 100644 --- a/src/emucore/CartDPCPlus.hxx +++ b/src/emucore/CartDPCPlus.hxx @@ -201,13 +201,13 @@ class CartridgeDPCPlus : public Cartridge private: // The ROM image and size std::array myImage; - size_t mySize; + size_t mySize{0}; // Pointer to the 24K program ROM image of the cartridge - uInt8* myProgramImage; + uInt8* myProgramImage{nullptr}; // Pointer to the 4K display ROM image of the cartridge - uInt8* myDisplayImage; + uInt8* myDisplayImage{nullptr}; // The DPC 8k RAM image, used as: // 3K DPC+ driver @@ -219,7 +219,7 @@ class CartridgeDPCPlus : public Cartridge unique_ptr myThumbEmulator; // Pointer to the 1K frequency table - uInt8* myFrequencyImage; + uInt8* myFrequencyImage{nullptr}; // The top registers for the data fetchers std::array myTops; @@ -237,16 +237,16 @@ class CartridgeDPCPlus : public Cartridge std::array myFractionalIncrements; // The Fast Fetcher Enabled flag - bool myFastFetch; + bool myFastFetch{false}; // Flags that last byte peeked was A9 (LDA #) - bool myLDAimmediate; + bool myLDAimmediate{false}; // Parameter for special functions std::array myParameter; // Parameter pointer for special functions - uInt8 myParameterPointer; + uInt8 myParameterPointer{0}; // The music mode counters std::array myMusicCounters; @@ -258,26 +258,26 @@ class CartridgeDPCPlus : public Cartridge std::array myMusicWaveforms; // The random number generator register - uInt32 myRandomNumber; + uInt32 myRandomNumber{1}; // System cycle count from when the last update to music data fetchers occurred - uInt64 myAudioCycles; + uInt64 myAudioCycles{0}; // System cycle count when the last Thumbulator::run() occurred - uInt64 myARMCycles; + uInt64 myARMCycles{0}; // Fractional DPC music OSC clocks unused during the last update - double myFractionalClocks; + double myFractionalClocks{0.0}; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; // Older DPC+ driver code had different behaviour wrt the mask used // to retrieve 'DFxFRACLOW' (fractional data pointer low byte) // ROMs built with an old DPC+ driver and using the newer mask can // result in 'jittering' in the playfield display // For current versions, this is 0x0F00FF; older versions need 0x0F0000 - uInt32 myFractionalLowMask; + uInt32 myFractionalLowMask{0x0F00FF}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartDetector.hxx b/src/emucore/CartDetector.hxx index f077e3ef4..7db39eeb4 100644 --- a/src/emucore/CartDetector.hxx +++ b/src/emucore/CartDetector.hxx @@ -260,7 +260,6 @@ class CartDetector */ static bool isProbablyX07(const ByteBuffer& image, size_t size); - private: // Following constructors and assignment operators not supported CartDetector() = delete; diff --git a/src/emucore/CartEF.cxx b/src/emucore/CartEF.cxx index 521e754c1..381d32eaa 100644 --- a/src/emucore/CartEF.cxx +++ b/src/emucore/CartEF.cxx @@ -21,8 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeEF::CartridgeEF(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myBankOffset(0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartEF.hxx b/src/emucore/CartEF.hxx index 558bf87f0..697746b78 100644 --- a/src/emucore/CartEF.hxx +++ b/src/emucore/CartEF.hxx @@ -157,7 +157,7 @@ class CartridgeEF : public Cartridge std::array myImage; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartEFSC.cxx b/src/emucore/CartEFSC.cxx index 370beed68..376343b73 100644 --- a/src/emucore/CartEFSC.cxx +++ b/src/emucore/CartEFSC.cxx @@ -21,8 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeEFSC::CartridgeEFSC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myBankOffset(0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartEFSC.hxx b/src/emucore/CartEFSC.hxx index 33bcd1857..a2c93b6dc 100644 --- a/src/emucore/CartEFSC.hxx +++ b/src/emucore/CartEFSC.hxx @@ -161,7 +161,7 @@ class CartridgeEFSC : public Cartridge std::array myRAM; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartF0.cxx b/src/emucore/CartF0.cxx index 3677fa131..99fdea598 100644 --- a/src/emucore/CartF0.cxx +++ b/src/emucore/CartF0.cxx @@ -21,8 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeF0::CartridgeF0(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myBankOffset(0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartF0.hxx b/src/emucore/CartF0.hxx index 0ad75808b..a34459c96 100644 --- a/src/emucore/CartF0.hxx +++ b/src/emucore/CartF0.hxx @@ -163,7 +163,7 @@ class CartridgeF0 : public Cartridge std::array myImage; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartF4.cxx b/src/emucore/CartF4.cxx index f24b19b91..01ede0ee1 100644 --- a/src/emucore/CartF4.cxx +++ b/src/emucore/CartF4.cxx @@ -22,8 +22,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeF4::CartridgeF4(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myBankOffset(0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartF4.hxx b/src/emucore/CartF4.hxx index 2c03fcabd..a2b6af33c 100644 --- a/src/emucore/CartF4.hxx +++ b/src/emucore/CartF4.hxx @@ -156,7 +156,7 @@ class CartridgeF4 : public Cartridge std::array myImage; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartF4SC.cxx b/src/emucore/CartF4SC.cxx index 42265636c..ef33a413b 100644 --- a/src/emucore/CartF4SC.cxx +++ b/src/emucore/CartF4SC.cxx @@ -21,8 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeF4SC::CartridgeF4SC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myBankOffset(0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartF4SC.hxx b/src/emucore/CartF4SC.hxx index 155122d9e..18b85a289 100644 --- a/src/emucore/CartF4SC.hxx +++ b/src/emucore/CartF4SC.hxx @@ -160,7 +160,7 @@ class CartridgeF4SC : public Cartridge std::array myRAM; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartF6.cxx b/src/emucore/CartF6.cxx index 133f58a1d..f0789a09f 100644 --- a/src/emucore/CartF6.cxx +++ b/src/emucore/CartF6.cxx @@ -21,8 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeF6::CartridgeF6(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myBankOffset(0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartF6.hxx b/src/emucore/CartF6.hxx index 275d0c57f..32d202168 100644 --- a/src/emucore/CartF6.hxx +++ b/src/emucore/CartF6.hxx @@ -156,7 +156,7 @@ class CartridgeF6 : public Cartridge std::array myImage; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartF6SC.cxx b/src/emucore/CartF6SC.cxx index 05832809c..3e526bd6f 100644 --- a/src/emucore/CartF6SC.cxx +++ b/src/emucore/CartF6SC.cxx @@ -21,8 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeF6SC::CartridgeF6SC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myBankOffset(0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartF6SC.hxx b/src/emucore/CartF6SC.hxx index d9a9d9493..641d1a108 100644 --- a/src/emucore/CartF6SC.hxx +++ b/src/emucore/CartF6SC.hxx @@ -160,7 +160,7 @@ class CartridgeF6SC : public Cartridge std::array myRAM; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartF8.cxx b/src/emucore/CartF8.cxx index bfe4253c1..879eaccdc 100644 --- a/src/emucore/CartF8.cxx +++ b/src/emucore/CartF8.cxx @@ -21,8 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeF8::CartridgeF8(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myBankOffset(0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartF8.hxx b/src/emucore/CartF8.hxx index c72fd4db9..db57c0b25 100644 --- a/src/emucore/CartF8.hxx +++ b/src/emucore/CartF8.hxx @@ -156,7 +156,7 @@ class CartridgeF8 : public Cartridge std::array myImage; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartF8SC.cxx b/src/emucore/CartF8SC.cxx index 0d148ed65..6c3738060 100644 --- a/src/emucore/CartF8SC.cxx +++ b/src/emucore/CartF8SC.cxx @@ -21,8 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeF8SC::CartridgeF8SC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myBankOffset(0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartF8SC.hxx b/src/emucore/CartF8SC.hxx index 714c1ef44..9b8f5026f 100644 --- a/src/emucore/CartF8SC.hxx +++ b/src/emucore/CartF8SC.hxx @@ -160,7 +160,7 @@ class CartridgeF8SC : public Cartridge std::array myRAM; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartFA.cxx b/src/emucore/CartFA.cxx index e62fea198..70219f518 100644 --- a/src/emucore/CartFA.cxx +++ b/src/emucore/CartFA.cxx @@ -21,8 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeFA::CartridgeFA(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myBankOffset(0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartFA.hxx b/src/emucore/CartFA.hxx index c5005fbf4..767f2e311 100644 --- a/src/emucore/CartFA.hxx +++ b/src/emucore/CartFA.hxx @@ -160,7 +160,7 @@ class CartridgeFA : public Cartridge std::array myRAM; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartFA2.cxx b/src/emucore/CartFA2.cxx index c901f7e75..4af8c4360 100644 --- a/src/emucore/CartFA2.cxx +++ b/src/emucore/CartFA2.cxx @@ -24,10 +24,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeFA2::CartridgeFA2(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - mySize(28_KB), - myRamAccessTimeout(0), - myBankOffset(0) + : Cartridge(settings, md5) { // 29/32K version of FA2 has valid data @ 1K - 29K const uInt8* img_ptr = image.get(); diff --git a/src/emucore/CartFA2.hxx b/src/emucore/CartFA2.hxx index 5f10b9651..86434688e 100644 --- a/src/emucore/CartFA2.hxx +++ b/src/emucore/CartFA2.hxx @@ -196,7 +196,7 @@ class CartridgeFA2 : public Cartridge std::array myImage; // Actual usable size of the ROM image - size_t mySize; + size_t mySize{28_KB}; // The 256 bytes of RAM on the cartridge std::array myRAM; @@ -205,14 +205,14 @@ class CartridgeFA2 : public Cartridge // will actually be completed // Due to flash RAM constraints, a read/write isn't instantaneous, // so we need to emulate the delay as well - uInt64 myRamAccessTimeout; + uInt64 myRamAccessTimeout{0}; // Full pathname of the file to use when emulating load/save // of internal RAM to Harmony cart flash string myFlashFile; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartFC.cxx b/src/emucore/CartFC.cxx index f1d74f30d..c06320bff 100644 --- a/src/emucore/CartFC.cxx +++ b/src/emucore/CartFC.cxx @@ -22,10 +22,7 @@ CartridgeFC::CartridgeFC(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), - mySize(size), - myBankOffset(0), - myCurrentBank(0), - myTargetBank(0) + mySize(size) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartFC.hxx b/src/emucore/CartFC.hxx index db9cb58e2..938aa40e9 100644 --- a/src/emucore/CartFC.hxx +++ b/src/emucore/CartFC.hxx @@ -159,16 +159,16 @@ class CartridgeFC : public Cartridge std::array myImage; // Size of the ROM image - size_t mySize; + size_t mySize{0}; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; // Indicates which bank is currently active for the first segment - uInt16 myCurrentBank; + uInt16 myCurrentBank{0}; // Target bank defined by writing to $1FF8/9 - uInt16 myTargetBank; + uInt16 myTargetBank{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartFE.cxx b/src/emucore/CartFE.cxx index a8458aea6..dec120238 100644 --- a/src/emucore/CartFE.cxx +++ b/src/emucore/CartFE.cxx @@ -22,9 +22,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeFE::CartridgeFE(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myBankOffset(0), - myLastAccessWasFE(false) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartFE.hxx b/src/emucore/CartFE.hxx index fc7e09af1..359b7497d 100644 --- a/src/emucore/CartFE.hxx +++ b/src/emucore/CartFE.hxx @@ -206,10 +206,10 @@ class CartridgeFE : public Cartridge std::array myImage; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; // Whether previous address by peek/poke equals $01FE (hotspot) - bool myLastAccessWasFE; + bool myLastAccessWasFE{false}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartMDM.cxx b/src/emucore/CartMDM.cxx index 3539a0167..7a67f67ef 100644 --- a/src/emucore/CartMDM.cxx +++ b/src/emucore/CartMDM.cxx @@ -21,10 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeMDM::CartridgeMDM(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - mySize(size), - myBankOffset(0), - myBankingDisabled(false) + : Cartridge(settings, md5) { // Allocate array for the ROM image myImage = make_unique(mySize); diff --git a/src/emucore/CartMDM.hxx b/src/emucore/CartMDM.hxx index 8006a24cb..7f60eec02 100644 --- a/src/emucore/CartMDM.hxx +++ b/src/emucore/CartMDM.hxx @@ -168,17 +168,17 @@ class CartridgeMDM : public Cartridge ByteBuffer myImage; // Size of the ROM image - size_t mySize; + size_t mySize{0}; // Previous Device's page access std::array myHotSpotPageAccess; // Indicates the offset into the ROM image (aligns to current bank) - uInt32 myBankOffset; + uInt32 myBankOffset{0}; // Indicates whether banking has been disabled due to a bankswitch // above bank 127 - bool myBankingDisabled; + bool myBankingDisabled{false}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartMNetwork.cxx b/src/emucore/CartMNetwork.cxx index 020f11e29..88a52ac95 100644 --- a/src/emucore/CartMNetwork.cxx +++ b/src/emucore/CartMNetwork.cxx @@ -22,9 +22,7 @@ CartridgeMNetwork::CartridgeMNetwork(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), - mySize(size), - myCurrentRAM(0), - myRAMSlice(0) + mySize(size) { } diff --git a/src/emucore/CartMNetwork.hxx b/src/emucore/CartMNetwork.hxx index 6202c33ab..ec8c419b6 100644 --- a/src/emucore/CartMNetwork.hxx +++ b/src/emucore/CartMNetwork.hxx @@ -202,7 +202,7 @@ class CartridgeMNetwork : public Cartridge //uInt8 myImage[BANK_SIZE * 8]; // Size of the ROM image - size_t mySize; + size_t mySize{0}; // The 2K of RAM std::array myRAM; @@ -211,10 +211,10 @@ class CartridgeMNetwork : public Cartridge std::array myCurrentSlice; // Indicates which 256 byte bank of RAM is being used - uInt16 myCurrentRAM; + uInt16 myCurrentRAM{0}; // The number of the RAM slice (== bankCount() - 1) - uInt32 myRAMSlice; + uInt32 myRAMSlice{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartSB.cxx b/src/emucore/CartSB.cxx index c0464abec..a6c8eb9ab 100644 --- a/src/emucore/CartSB.cxx +++ b/src/emucore/CartSB.cxx @@ -21,9 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeSB::CartridgeSB(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - mySize(size), - myBankOffset(0) + : Cartridge(settings, md5) { // Allocate array for the ROM image myImage = make_unique(mySize); diff --git a/src/emucore/CartSB.hxx b/src/emucore/CartSB.hxx index b44f03db8..1a3841fb7 100644 --- a/src/emucore/CartSB.hxx +++ b/src/emucore/CartSB.hxx @@ -155,10 +155,10 @@ class CartridgeSB : public Cartridge private: // The 128-256K ROM image and size of the cartridge ByteBuffer myImage; - size_t mySize; + size_t mySize{0}; // Indicates the offset into the ROM image (aligns to current bank) - uInt32 myBankOffset; + uInt32 myBankOffset{0}; // Previous Device's page access std::array myHotSpotPageAccess; diff --git a/src/emucore/CartUA.cxx b/src/emucore/CartUA.cxx index 079ae8cc8..494b8fd76 100644 --- a/src/emucore/CartUA.cxx +++ b/src/emucore/CartUA.cxx @@ -23,7 +23,6 @@ CartridgeUA::CartridgeUA(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings, bool swapHotspots) : Cartridge(settings, md5), - myBankOffset(0), mySwappedHotspots(swapHotspots) { // Copy the ROM image into my buffer diff --git a/src/emucore/CartUA.hxx b/src/emucore/CartUA.hxx index 5b55d2e9c..a5277bc95 100644 --- a/src/emucore/CartUA.hxx +++ b/src/emucore/CartUA.hxx @@ -160,10 +160,10 @@ class CartridgeUA : public Cartridge std::array myHotSpotPageAccess; // Indicates the offset into the ROM image (aligns to current bank) - uInt16 myBankOffset; + uInt16 myBankOffset{0}; // Indicates if banks are swapped ("Mickey" cart) - bool mySwappedHotspots; + bool mySwappedHotspots{false}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CartWD.cxx b/src/emucore/CartWD.cxx index 3bbf2ef6f..0baed893f 100644 --- a/src/emucore/CartWD.cxx +++ b/src/emucore/CartWD.cxx @@ -24,10 +24,7 @@ CartridgeWD::CartridgeWD(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) : Cartridge(settings, md5), - mySize(std::min(8_KB + 3, size)), - myCyclesAtBankswitchInit(0), - myPendingBank(0), - myCurrentBank(0) + mySize(std::min(8_KB + 3, size)) { // Copy the ROM image into my buffer if (mySize == 8_KB + 3) diff --git a/src/emucore/CartWD.hxx b/src/emucore/CartWD.hxx index 112e4bdfe..7b9e04742 100644 --- a/src/emucore/CartWD.hxx +++ b/src/emucore/CartWD.hxx @@ -207,7 +207,7 @@ class CartridgeWD : public Cartridge std::array myImage; // Indicates the actual size of the ROM image (either 8K or 8K + 3) - size_t mySize; + size_t mySize{0}; // The 64 bytes RAM of the cartridge std::array myRAM; @@ -219,13 +219,13 @@ class CartridgeWD : public Cartridge std::array myOffset; // Indicates the cycle at which a bankswitch was initiated - uInt64 myCyclesAtBankswitchInit; + uInt64 myCyclesAtBankswitchInit{0}; // Indicates the bank we wish to switch to in the future - uInt16 myPendingBank; + uInt16 myPendingBank{0}; // Indicates which bank is currently active - uInt16 myCurrentBank; + uInt16 myCurrentBank{0}; // The arrangement of banks to use on each hotspot read struct BankOrg { diff --git a/src/emucore/CartX07.cxx b/src/emucore/CartX07.cxx index 57b617e7d..02d394813 100644 --- a/src/emucore/CartX07.cxx +++ b/src/emucore/CartX07.cxx @@ -23,8 +23,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartridgeX07::CartridgeX07(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge(settings, md5), - myCurrentBank(0) + : Cartridge(settings, md5) { // Copy the ROM image into my buffer std::copy_n(image.get(), std::min(myImage.size(), size), myImage.begin()); diff --git a/src/emucore/CartX07.hxx b/src/emucore/CartX07.hxx index 04a995aba..2eaf7c751 100644 --- a/src/emucore/CartX07.hxx +++ b/src/emucore/CartX07.hxx @@ -166,7 +166,7 @@ class CartridgeX07 : public Cartridge std::array myImage; // Indicates which bank is currently active - uInt16 myCurrentBank; + uInt16 myCurrentBank{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/CompuMate.cxx b/src/emucore/CompuMate.cxx index 0620062c3..9f8fb6fb6 100644 --- a/src/emucore/CompuMate.cxx +++ b/src/emucore/CompuMate.cxx @@ -21,7 +21,6 @@ CompuMate::CompuMate(const Console& console, const Event& event, const System& system) : myConsole(console), - myColumn(0), myEvent(event) { // These controller pointers will be retrieved by the Console, which will diff --git a/src/emucore/CompuMate.hxx b/src/emucore/CompuMate.hxx index 3ba539593..f1dfe97ec 100644 --- a/src/emucore/CompuMate.hxx +++ b/src/emucore/CompuMate.hxx @@ -124,15 +124,13 @@ class CompuMate private: // Console and Event objects const Console& myConsole; + const Event& myEvent; // Left and right controllers unique_ptr myLeftController, myRightController; // Column currently active - uInt8 myColumn; - - /// Reference to the event object this controller uses - const Event& myEvent; + uInt8 myColumn{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 9387509be..5ac2a1479 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -77,11 +77,6 @@ Console::Console(OSystem& osystem, unique_ptr& cart, myEvent(osystem.eventHandler().event()), myProperties(props), myCart(std::move(cart)), - myDisplayFormat(""), // Unknown TV format @ start - myCurrentFormat(0), // Unknown format @ start, - myFormatAutodetected(false), - myUserPaletteDefined(false), - myConsoleTiming(ConsoleTiming::ntsc), myAudioSettings(audioSettings) { // Load user-defined palette for this ROM diff --git a/src/emucore/Console.hxx b/src/emucore/Console.hxx index 5a4eaeb67..55432a1ac 100644 --- a/src/emucore/Console.hxx +++ b/src/emucore/Console.hxx @@ -400,20 +400,20 @@ class Console : public Serializable, public ConsoleIO string myDisplayFormat; // Display format currently in use - uInt32 myCurrentFormat; + uInt32 myCurrentFormat{0}; // Is the TV format autodetected? - bool myFormatAutodetected; + bool myFormatAutodetected{false}; // Indicates whether an external palette was found and // successfully loaded - bool myUserPaletteDefined; + bool myUserPaletteDefined{false}; // Contains detailed info about this console ConsoleInfo myConsoleInfo; // Contains timing information for this console - ConsoleTiming myConsoleTiming; + ConsoleTiming myConsoleTiming{ConsoleTiming::ntsc}; // Emulation timing provider. This ties together the timing of the core emulation loop // and the parameters that govern audio synthesis diff --git a/src/emucore/Control.cxx b/src/emucore/Control.cxx index 569177f1f..09b291471 100644 --- a/src/emucore/Control.cxx +++ b/src/emucore/Control.cxx @@ -26,11 +26,8 @@ Controller::Controller(Jack jack, const Event& event, const System& system, : myJack(jack), myEvent(event), mySystem(system), - myType(type), - myOnAnalogPinUpdateCallback(nullptr) + myType(type) { - resetDigitalPins(); - resetAnalogPins(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/Control.hxx b/src/emucore/Control.hxx index 8b26f8588..aa85b9552 100644 --- a/src/emucore/Control.hxx +++ b/src/emucore/Control.hxx @@ -320,17 +320,17 @@ class Controller : public Serializable const System& mySystem; /// Specifies which type of controller this is (defined by child classes) - const Type myType; + const Type myType{Type::Unknown}; /// The callback that is dispatched whenver an analog pin has changed - onAnalogPinUpdateCallback myOnAnalogPinUpdateCallback; + onAnalogPinUpdateCallback myOnAnalogPinUpdateCallback{nullptr}; private: /// The boolean value on each digital pin - std::array myDigitalPinState; + std::array myDigitalPinState{true}; /// The analog value on each analog pin - std::array myAnalogPinValue; + std::array myAnalogPinValue{MAX_RESISTANCE}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/Driving.cxx b/src/emucore/Driving.cxx index 6332bdea6..5b634b15d 100644 --- a/src/emucore/Driving.cxx +++ b/src/emucore/Driving.cxx @@ -22,13 +22,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Driving::Driving(Jack jack, const Event& event, const System& system) - : Controller(jack, event, system, Controller::Type::Driving), - myCounter(0), - myGrayIndex(0), - myLastYaxis(0), - myControlID(-1), - myControlIDX(-1), - myControlIDY(-1) + : Controller(jack, event, system, Controller::Type::Driving) { if(myJack == Jack::Left) { diff --git a/src/emucore/Driving.hxx b/src/emucore/Driving.hxx index 911a6e170..8f64509a1 100644 --- a/src/emucore/Driving.hxx +++ b/src/emucore/Driving.hxx @@ -78,14 +78,14 @@ class Driving : public Controller private: // Counter to iterate through the gray codes - uInt32 myCounter; + uInt32 myCounter{0}; // Index into the gray code table - uInt32 myGrayIndex; + uInt32 myGrayIndex{0}; // Y axis value from last yaxis event that was used to generate a new // gray code - int myLastYaxis; + int myLastYaxis{0}; // Pre-compute the events we care about based on given port // This will eliminate test for left or right port in update() @@ -93,10 +93,10 @@ class Driving : public Controller myXAxisValue, myYAxisValue; // Controller to emulate in normal mouse axis mode - int myControlID; + int myControlID{-1}; // Controllers to emulate in 'specific' mouse axis mode - int myControlIDX, myControlIDY; + int myControlIDX{-1}, myControlIDY{-1}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/EmulationTiming.hxx b/src/emucore/EmulationTiming.hxx index 6f19db7c9..87d656539 100644 --- a/src/emucore/EmulationTiming.hxx +++ b/src/emucore/EmulationTiming.hxx @@ -25,7 +25,8 @@ class EmulationTiming { public: - EmulationTiming(FrameLayout frameLayout = FrameLayout::ntsc, ConsoleTiming consoleTiming = ConsoleTiming::ntsc); + EmulationTiming(FrameLayout frameLayout = FrameLayout::ntsc, + ConsoleTiming consoleTiming = ConsoleTiming::ntsc); EmulationTiming& updateFrameLayout(FrameLayout frameLayout); @@ -65,8 +66,8 @@ class EmulationTiming { private: - FrameLayout myFrameLayout; - ConsoleTiming myConsoleTiming; + FrameLayout myFrameLayout{FrameLayout::ntsc}; + ConsoleTiming myConsoleTiming{ConsoleTiming::ntsc}; uInt32 myPlaybackRate{44100}; uInt32 myPlaybackPeriod{512}; diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index dcb2cf696..88e9cc345 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -61,13 +61,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EventHandler::EventHandler(OSystem& osystem) - : myOSystem(osystem), - myOverlay(nullptr), - myState(EventHandlerState::NONE), - myAllowAllDirectionsFlag(false), - myFryingFlag(false), - mySkipMouseMotion(true), - myIs7800(false) + : myOSystem(osystem) { // Create keyboard handler (to handle all physical keyboard functionality) myPKeyHandler = make_unique(osystem, *this); diff --git a/src/emucore/EventHandler.hxx b/src/emucore/EventHandler.hxx index f3eb0da56..c1cf384fe 100644 --- a/src/emucore/EventHandler.hxx +++ b/src/emucore/EventHandler.hxx @@ -416,7 +416,7 @@ class EventHandler private: // Structure used for action menu items struct ActionList { - Event::Type event; + Event::Type event{Event::NoType}; string action; string key; }; @@ -425,7 +425,7 @@ class EventHandler Event myEvent; // Indicates current overlay object - DialogContainer* myOverlay; + DialogContainer* myOverlay{nullptr}; // Handler for all keyboard-related events unique_ptr myPKeyHandler; @@ -438,21 +438,21 @@ class EventHandler unique_ptr myMouseControl; // Indicates the current state of the system (ie, which mode is current) - EventHandlerState myState; + EventHandlerState myState{EventHandlerState::NONE}; // Indicates whether the virtual joystick emulates 'impossible' directions - bool myAllowAllDirectionsFlag; + bool myAllowAllDirectionsFlag{false}; // Indicates whether or not we're in frying mode - bool myFryingFlag; + bool myFryingFlag{false}; // Sometimes an extraneous mouse motion event occurs after a video // state change; we detect when this happens and discard the event - bool mySkipMouseMotion; + bool mySkipMouseMotion{true}; // Whether the currently enabled console is emulating certain aspects // of the 7800 (for now, only the switches are notified) - bool myIs7800; + bool myIs7800{false}; // These constants are not meant to be used elsewhere; they are only used // here to make it easier for the reader to correctly size the list(s) diff --git a/src/emucore/Genesis.cxx b/src/emucore/Genesis.cxx index c26811a09..30e4055db 100644 --- a/src/emucore/Genesis.cxx +++ b/src/emucore/Genesis.cxx @@ -20,8 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Genesis::Genesis(Jack jack, const Event& event, const System& system) - : Controller(jack, event, system, Controller::Type::Genesis), - myControlID(-1) + : Controller(jack, event, system, Controller::Type::Genesis) { if(myJack == Jack::Left) { diff --git a/src/emucore/Genesis.hxx b/src/emucore/Genesis.hxx index cb9b3dad1..fbf136660 100644 --- a/src/emucore/Genesis.hxx +++ b/src/emucore/Genesis.hxx @@ -81,7 +81,7 @@ class Genesis : public Controller myFire1Event, myFire2Event; // Controller to emulate in normal mouse axis mode - int myControlID; + int myControlID{-1}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/Joystick.cxx b/src/emucore/Joystick.cxx index 91af453b8..0a988eb73 100644 --- a/src/emucore/Joystick.cxx +++ b/src/emucore/Joystick.cxx @@ -20,8 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Joystick::Joystick(Jack jack, const Event& event, const System& system) - : Controller(jack, event, system, Controller::Type::Joystick), - myControlID(-1) + : Controller(jack, event, system, Controller::Type::Joystick) { if(myJack == Jack::Left) { diff --git a/src/emucore/Joystick.hxx b/src/emucore/Joystick.hxx index 5af471000..eee7f0482 100644 --- a/src/emucore/Joystick.hxx +++ b/src/emucore/Joystick.hxx @@ -86,7 +86,7 @@ class Joystick : public Controller myXAxisValue, myYAxisValue, myFireEvent; // Controller to emulate in normal mouse axis mode - int myControlID; + int myControlID{-1}; static int _DEAD_ZONE; diff --git a/src/emucore/KidVid.cxx b/src/emucore/KidVid.cxx index 3c74b77d9..2181e73ca 100644 --- a/src/emucore/KidVid.cxx +++ b/src/emucore/KidVid.cxx @@ -24,21 +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), -// mySampleFile(nullptr), -// mySharedSampleFile(nullptr), - myFileOpened(false), - myTapeBusy(false), - myFilePointer(0), - mySongCounter(0), - myBeep(false), - mySharedData(false), - mySampleByte(0), - myGame(0), - myTape(0), - myIdx(0), - myBlock(0), - myBlockIdx(0) + myEnabled(myJack == Jack::Right) { // Right now, there are only two games that use the KidVid if(romMd5 == "ee6665683ebdb539e89ba620981cb0f6") diff --git a/src/emucore/KidVid.hxx b/src/emucore/KidVid.hxx index 30927c942..9c1812fe3 100644 --- a/src/emucore/KidVid.hxx +++ b/src/emucore/KidVid.hxx @@ -87,22 +87,22 @@ class KidVid : public Controller // Whether the KidVid device is enabled (only for games that it // supports, and if it's plugged into the right port - bool myEnabled; + bool myEnabled{false}; // The file handles for the WAV files // FILE *mySampleFile, *mySharedSampleFile; // Indicates if sample files have been successfully opened - bool myFileOpened; + bool myFileOpened{false}; // Is the tape currently 'busy' / in use? - bool myTapeBusy; + bool myTapeBusy{false}; - uInt32 myFilePointer, mySongCounter; - bool myBeep, mySharedData; - uInt8 mySampleByte; - uInt32 myGame, myTape; - uInt32 myIdx, myBlock, myBlockIdx; + uInt32 myFilePointer{0}, mySongCounter{0}; + bool myBeep{false}, mySharedData{false}; + uInt8 mySampleByte{0}; + uInt32 myGame{0}, myTape{0}; + uInt32 myIdx{0}, myBlock{0}, myBlockIdx{0}; // Number of blocks and data on tape static const std::array ourKVBlocks; diff --git a/src/emucore/M6532.cxx b/src/emucore/M6532.cxx index e0eb7ac11..7d80cbb34 100644 --- a/src/emucore/M6532.cxx +++ b/src/emucore/M6532.cxx @@ -30,13 +30,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - M6532::M6532(const ConsoleIO& console, const Settings& settings) : myConsole(console), - mySettings(settings), - myTimer(0), mySubTimer(0), myDivider(1), - myTimerWrapped(false), myWrappedThisCycle(false), - mySetTimerCycle(0), myLastCycle(0), - myDDRA(0), myDDRB(0), myOutA(0), myOutB(0), - myInterruptFlag(false), - myEdgeDetectPositive(false) + mySettings(settings) { } diff --git a/src/emucore/M6532.hxx b/src/emucore/M6532.hxx index 569dfda77..ed4937052 100644 --- a/src/emucore/M6532.hxx +++ b/src/emucore/M6532.hxx @@ -172,45 +172,45 @@ class M6532 : public Device std::array myRAM; // Current value of the timer - uInt8 myTimer; + uInt8 myTimer{0}; // Current number of clocks "queued" for the divider - uInt32 mySubTimer; + uInt32 mySubTimer{0}; // The divider - uInt32 myDivider; + uInt32 myDivider{1}; // Has the timer wrapped? - bool myTimerWrapped; - bool myWrappedThisCycle; + bool myTimerWrapped{false}; + bool myWrappedThisCycle{false}; // Cycle when the timer set. Debugging only. - uInt64 mySetTimerCycle; + uInt64 mySetTimerCycle{0}; // Last cycle considered in emu updates - uInt64 myLastCycle; + uInt64 myLastCycle{0}; // Data Direction Register for Port A - uInt8 myDDRA; + uInt8 myDDRA{0}; // Data Direction Register for Port B - uInt8 myDDRB; + uInt8 myDDRB{0}; // Last value written to Port A - uInt8 myOutA; + uInt8 myOutA{0}; // Last value written to Port B - uInt8 myOutB; + uInt8 myOutB{0}; // Interrupt Flag Register - uInt8 myInterruptFlag; + uInt8 myInterruptFlag{0}; // Used to determine whether an active transition on PA7 has occurred // True is positive edge-detect, false is negative edge-detect - bool myEdgeDetectPositive; + bool myEdgeDetectPositive{false}; // Last value written to the timer registers - std::array myOutTimer; + std::array myOutTimer{0}; // Accessible bits in the interrupt flag register // All other bits are always zeroed diff --git a/src/emucore/MT24LC256.cxx b/src/emucore/MT24LC256.cxx index 4c9cef8b9..349c3cb7b 100644 --- a/src/emucore/MT24LC256.cxx +++ b/src/emucore/MT24LC256.cxx @@ -47,27 +47,7 @@ MT24LC256::MT24LC256(const string& filename, const System& system, const Controller::onMessageCallback& callback) : mySystem(system), myCallback(callback), - mySDA(false), - mySCL(false), - myTimerActive(false), - myCyclesWhenTimerSet(0), - myCyclesWhenSDASet(0), - myCyclesWhenSCLSet(0), - myDataFile(filename), - myDataFileExists(false), - myDataChanged(false), - jpee_mdat(0), - jpee_sdat(0), - jpee_mclk(0), - jpee_sizemask(0), - jpee_pagemask(0), - jpee_smallmode(0), - jpee_logmode(0), - jpee_pptr(0), - jpee_state(0), - jpee_nb(0), - jpee_address(0), - jpee_ad_known(0) + myDataFile(filename) { // Load the data from an external file (if it exists) ifstream in(myDataFile, std::ios_base::binary); diff --git a/src/emucore/MT24LC256.hxx b/src/emucore/MT24LC256.hxx index feab2f36a..ff58dc777 100644 --- a/src/emucore/MT24LC256.hxx +++ b/src/emucore/MT24LC256.hxx @@ -98,31 +98,31 @@ class MT24LC256 std::array myPageHit; // Cached state of the SDA and SCL pins on the last write - bool mySDA, mySCL; + bool mySDA{false}, mySCL{false}; // Indicates that a timer has been set and hasn't expired yet - bool myTimerActive; + bool myTimerActive{false}; // Indicates when the timer was set - uInt64 myCyclesWhenTimerSet; + uInt64 myCyclesWhenTimerSet{0}; // Indicates when the SDA and SCL pins were set/written - uInt64 myCyclesWhenSDASet, myCyclesWhenSCLSet; + uInt64 myCyclesWhenSDASet{0}, myCyclesWhenSCLSet{0}; // The file containing the EEPROM data string myDataFile; // Indicates if a valid EEPROM data file exists/was successfully loaded - bool myDataFileExists; + bool myDataFileExists{false}; // Indicates if the EEPROM has changed since class invocation - bool myDataChanged; + bool myDataChanged{false}; // Required for I2C functionality - Int32 jpee_mdat, jpee_sdat, jpee_mclk; - Int32 jpee_sizemask, jpee_pagemask, jpee_smallmode, jpee_logmode; - Int32 jpee_pptr, jpee_state, jpee_nb; - uInt32 jpee_address, jpee_ad_known; + Int32 jpee_mdat{0}, jpee_sdat{0}, jpee_mclk{0}; + Int32 jpee_sizemask{0}, jpee_pagemask{0}, jpee_smallmode{0}, jpee_logmode{0}; + Int32 jpee_pptr{0}, jpee_state{0}, jpee_nb{0}; + uInt32 jpee_address{0}, jpee_ad_known{0}; std::array jpee_packet; private: diff --git a/src/emucore/MindLink.cxx b/src/emucore/MindLink.cxx index 481d13e65..bca8c92f1 100644 --- a/src/emucore/MindLink.cxx +++ b/src/emucore/MindLink.cxx @@ -20,10 +20,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MindLink::MindLink(Jack jack, const Event& event, const System& system) - : Controller(jack, event, system, Controller::Type::MindLink), - myMindlinkPos(0x2800), - myMindlinkShift(1), - myMouseEnabled(false) + : Controller(jack, event, system, Controller::Type::MindLink) { setPin(DigitalPin::One, true); setPin(DigitalPin::Two, true); diff --git a/src/emucore/MindLink.hxx b/src/emucore/MindLink.hxx index 074f83eab..687b5daa5 100644 --- a/src/emucore/MindLink.hxx +++ b/src/emucore/MindLink.hxx @@ -107,13 +107,13 @@ class MindLink : public Controller private: // Position value in Mindlink controller // Gets transferred bitwise (16 bits) - int myMindlinkPos; + int myMindlinkPos{0x2800}; // Which bit to transfer next - int myMindlinkShift; + int myMindlinkShift{1}; // Whether to use the mouse to emulate this controller - int myMouseEnabled; + int myMouseEnabled{false}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/Paddles.cxx b/src/emucore/Paddles.cxx index df53a524c..601850018 100644 --- a/src/emucore/Paddles.cxx +++ b/src/emucore/Paddles.cxx @@ -23,10 +23,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Paddles::Paddles(Jack jack, const Event& event, const System& system, bool swappaddle, bool swapaxis, bool swapdir) - : Controller(jack, event, system, Controller::Type::Paddles), - myMPaddleID(-1), - myMPaddleIDX(-1), - myMPaddleIDY(-1) + : Controller(jack, event, system, Controller::Type::Paddles) { // We must start with minimum resistance; see commit // 38b452e1a047a0dca38c5bcce7c271d40f76736e for more information @@ -180,13 +177,6 @@ Paddles::Paddles(Jack jack, const Event& event, const System& system, setPin(DigitalPin::One, true); setPin(DigitalPin::Two, true); setPin(DigitalPin::Six, true); - - // Digital emulation of analog paddle movement - myKeyRepeat0 = myKeyRepeat1 = false; - myPaddleRepeat0 = myPaddleRepeat1 = myLastAxisX = myLastAxisY = 0; - - myCharge[0] = myCharge[1] = TRIGRANGE / 2; - myLastCharge[0] = myLastCharge[1] = 0; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/Paddles.hxx b/src/emucore/Paddles.hxx index 8eb510e17..e748b0509 100644 --- a/src/emucore/Paddles.hxx +++ b/src/emucore/Paddles.hxx @@ -132,6 +132,12 @@ class Paddles : public Controller static constexpr double MAX_RESISTANCE = 1400000.0; private: + // Range of values over which digital and mouse movement is scaled + // to paddle resistance + static constexpr int TRIGMIN = 1; + static constexpr int TRIGMAX = 4096; + static int TRIGRANGE; // This one is variable for the upper range + // Pre-compute the events we care about based on given port // This will eliminate test for left or right port in update() Event::Type myP0AxisValue, myP1AxisValue, @@ -141,20 +147,14 @@ class Paddles : public Controller myAxisMouseMotion; // The following are used for the various mouse-axis modes - int myMPaddleID; // paddle to emulate in 'automatic' mode - int myMPaddleIDX, myMPaddleIDY; // paddles to emulate in 'specific axis' mode + int myMPaddleID{-1}; // paddle to emulate in 'automatic' mode + int myMPaddleIDX{-1}, myMPaddleIDY{-1}; // paddles to emulate in 'specific axis' mode - bool myKeyRepeat0, myKeyRepeat1; - int myPaddleRepeat0, myPaddleRepeat1; - std::array myCharge, myLastCharge; - int myLastAxisX, myLastAxisY; - int myAxisDigitalZero, myAxisDigitalOne; - - // Range of values over which digital and mouse movement is scaled - // to paddle resistance - static constexpr int TRIGMIN = 1; - static constexpr int TRIGMAX = 4096; - static int TRIGRANGE; // This one is variable for the upper range + bool myKeyRepeat0{false}, myKeyRepeat1{false}; + int myPaddleRepeat0{0}, myPaddleRepeat1{0}; + std::array myCharge{TRIGRANGE / 2}, myLastCharge{0}; + int myLastAxisX{0}, myLastAxisY{0}; + int myAxisDigitalZero{0}, myAxisDigitalOne{0}; static int DIGITAL_SENSITIVITY, DIGITAL_DISTANCE; static int DEJITTER_BASE, DEJITTER_DIFF; diff --git a/src/emucore/PointingDevice.cxx b/src/emucore/PointingDevice.cxx index dfe357f48..507998730 100644 --- a/src/emucore/PointingDevice.cxx +++ b/src/emucore/PointingDevice.cxx @@ -27,14 +27,7 @@ PointingDevice::PointingDevice(Jack jack, const Event& event, const System& system, Controller::Type type, float sensitivity) : Controller(jack, event, system, type), - mySensitivity(sensitivity), - myHCounterRemainder(0.0), myVCounterRemainder(0.0), - myTrackBallLinesH(1), myTrackBallLinesV(1), - myTrackBallLeft(false), myTrackBallDown(false), - myCountH(0), myCountV(0), - myScanCountH(0), myScanCountV(0), - myFirstScanOffsetH(0), myFirstScanOffsetV(0), - myMouseEnabled(false) + mySensitivity(sensitivity) { // The code in ::read() is set up to always return IOPortA values in // the lower 4 bits data value diff --git a/src/emucore/PointingDevice.hxx b/src/emucore/PointingDevice.hxx index ffd27f6a4..820b4f1f7 100644 --- a/src/emucore/PointingDevice.hxx +++ b/src/emucore/PointingDevice.hxx @@ -95,8 +95,6 @@ class PointingDevice : public Controller // IOPortA values are calculated virtual uInt8 ioPortA(uInt8 countH, uInt8 countV, uInt8 left, uInt8 down) = 0; -// virtual string pointingDeviceName() const = 0; - private: void updateDirection(int counter, float& counterRemainder, bool& trackBallDir, int& trackBallLines, @@ -104,28 +102,28 @@ class PointingDevice : public Controller private: // Mouse input to sensitivity emulation - float mySensitivity, myHCounterRemainder, myVCounterRemainder; + float mySensitivity{0.F}, myHCounterRemainder{0.F}, myVCounterRemainder{0.F}; // How many lines to wait between sending new horz and vert values - int myTrackBallLinesH, myTrackBallLinesV; + int myTrackBallLinesH{1}, myTrackBallLinesV{1}; // Was TrackBall moved left or moved right instead - bool myTrackBallLeft; + bool myTrackBallLeft{false}; // Was TrackBall moved down or moved up instead - bool myTrackBallDown; + bool myTrackBallDown{false}; // Counter to iterate through the gray codes - uInt8 myCountH, myCountV; + uInt8 myCountH{0}, myCountV{0}; // Next scanline for change - int myScanCountH, myScanCountV; + int myScanCountH{0}, myScanCountV{0}; // Offset factor for first scanline, 0..(1 << 12 - 1) - int myFirstScanOffsetH, myFirstScanOffsetV; + int myFirstScanOffsetH{0}, myFirstScanOffsetV{0}; // Whether to use the mouse to emulate this controller - bool myMouseEnabled; + bool myMouseEnabled{false}; // User-defined sensitivity; adjustable since end-users may have different // mouse speeds diff --git a/src/emucore/Random.hxx b/src/emucore/Random.hxx index 5368cfb1e..3e8c18ad3 100644 --- a/src/emucore/Random.hxx +++ b/src/emucore/Random.hxx @@ -103,7 +103,7 @@ class Random : public Serializable // calling next() should change internal state (ie, the *logical* // state of the object shouldn't change just by asking for another // random number) - mutable uInt32 myValue; + mutable uInt32 myValue{0}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/SaveKey.cxx b/src/emucore/SaveKey.cxx index b9546b5cc..a73b4ac19 100644 --- a/src/emucore/SaveKey.cxx +++ b/src/emucore/SaveKey.cxx @@ -24,10 +24,9 @@ SaveKey::SaveKey(Jack jack, const Event& event, const System& system, const string& eepromfile, const onMessageCallback& callback, Type type) - : Controller(jack, event, system, 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/Switches.cxx b/src/emucore/Switches.cxx index 2018d2806..802c31085 100644 --- a/src/emucore/Switches.cxx +++ b/src/emucore/Switches.cxx @@ -23,9 +23,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Switches::Switches(const Event& event, const Properties& properties, const Settings& settings) - : myEvent(event), - mySwitches(0xFF), - myIs7800(false) + : myEvent(event) { if(properties.get(PropType::Console_RightDiff) == "B") { diff --git a/src/emucore/Switches.hxx b/src/emucore/Switches.hxx index d5f6c5b5b..7ff5273cd 100644 --- a/src/emucore/Switches.hxx +++ b/src/emucore/Switches.hxx @@ -127,10 +127,10 @@ class Switches : public Serializable const Event& myEvent; // State of the console switches - uInt8 mySwitches; + uInt8 mySwitches{0xFF}; // Are we in 7800 or 2600 mode? - bool myIs7800; + bool myIs7800{false}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/TIASurface.cxx b/src/emucore/TIASurface.cxx index fede32436..2698a6cc9 100644 --- a/src/emucore/TIASurface.cxx +++ b/src/emucore/TIASurface.cxx @@ -37,11 +37,7 @@ namespace { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TIASurface::TIASurface(OSystem& system) : myOSystem(system), - myFB(system.frameBuffer()), - myTIA(nullptr), - myFilter(Filter::Normal), - myScanlinesEnabled(false), - mySaveSnapFlag(false) + myFB(system.frameBuffer()) { // Load NTSC filter settings myNTSCFilter.loadConfig(myOSystem.settings()); diff --git a/src/emucore/TIASurface.hxx b/src/emucore/TIASurface.hxx index 61635c61e..469c687dd 100644 --- a/src/emucore/TIASurface.hxx +++ b/src/emucore/TIASurface.hxx @@ -146,7 +146,7 @@ class TIASurface private: OSystem& myOSystem; FrameBuffer& myFB; - TIA* myTIA; + TIA* myTIA{nullptr}; shared_ptr myTiaSurface, mySLineSurface, myBaseTiaSurface; @@ -158,7 +158,7 @@ class TIASurface BlarggNormal = 0x10, BlarggPhosphor = 0x11 }; - Filter myFilter; + Filter myFilter{Filter::Normal}; // NTSC object to use in TIA rendering mode NTSCFilter myNTSCFilter; @@ -175,13 +175,13 @@ class TIASurface ///////////////////////////////////////////////////////////// // Use scanlines in TIA rendering mode - bool myScanlinesEnabled; + bool myScanlinesEnabled{false}; // Palette for normal TIA rendering mode PaletteArray myPalette; // Flag for saving a snapshot - bool mySaveSnapFlag; + bool mySaveSnapFlag{false}; private: // Following constructors and assignment operators not supported diff --git a/src/emucore/Thumbulator.cxx b/src/emucore/Thumbulator.cxx index d03193b3d..2c65bb7d0 100644 --- a/src/emucore/Thumbulator.cxx +++ b/src/emucore/Thumbulator.cxx @@ -60,8 +60,6 @@ Thumbulator::Thumbulator(const uInt16* rom_ptr, uInt16* ram_ptr, uInt16 rom_size romSize(rom_size), decodedRom(make_unique(romSize / 2)), // NOLINT ram(ram_ptr), - T1TCR(0), - T1TC(0), configuration(configurefor), myCartridge(cartridge) { diff --git a/src/emucore/Thumbulator.hxx b/src/emucore/Thumbulator.hxx index 6e7168099..5085fb8fe 100644 --- a/src/emucore/Thumbulator.hxx +++ b/src/emucore/Thumbulator.hxx @@ -185,28 +185,28 @@ class Thumbulator int reset(); private: - const uInt16* rom; - uInt16 romSize; + const uInt16* rom{nullptr}; + uInt16 romSize{0}; const unique_ptr decodedRom; // NOLINT - uInt16* ram; + uInt16* ram{nullptr}; std::array reg_norm; // normal execution mode, do not have a thread mode - uInt32 cpsr, mamcr; - bool handler_mode; - uInt32 systick_ctrl, systick_reload, systick_count, systick_calibrate; + uInt32 cpsr{0}, mamcr{0}; + bool handler_mode{false}; + uInt32 systick_ctrl{0}, systick_reload{0}, systick_count{0}, systick_calibrate{0}; #ifndef UNSAFE_OPTIMIZATIONS - uInt64 instructions; + uInt64 instructions{0}; #endif #ifndef NO_THUMB_STATS - uInt64 fetches, reads, writes; + uInt64 fetches{0}, reads{0}, writes{0}; #endif // For emulation of LPC2103's timer 1, used for NTSC/PAL/SECAM detection. // Register names from documentation: // http://www.nxp.com/documents/user_manual/UM10161.pdf - uInt32 T1TCR; // Timer 1 Timer Control Register - uInt32 T1TC; // Timer 1 Timer Counter - double timing_factor; + uInt32 T1TCR{0}; // Timer 1 Timer Control Register + uInt32 T1TC{0}; // Timer 1 Timer Counter + double timing_factor{0.0}; #ifndef UNSAFE_OPTIMIZATIONS ostringstream statusMsg; diff --git a/src/emucore/tia/AudioChannel.cxx b/src/emucore/tia/AudioChannel.cxx index e5599df95..cdb68ccfe 100644 --- a/src/emucore/tia/AudioChannel.cxx +++ b/src/emucore/tia/AudioChannel.cxx @@ -17,12 +17,6 @@ #include "AudioChannel.hxx" -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -AudioChannel::AudioChannel() -{ - reset(); -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void AudioChannel::reset() { diff --git a/src/emucore/tia/AudioChannel.hxx b/src/emucore/tia/AudioChannel.hxx index 716fb2d30..793a4ebef 100644 --- a/src/emucore/tia/AudioChannel.hxx +++ b/src/emucore/tia/AudioChannel.hxx @@ -24,7 +24,7 @@ class AudioChannel : public Serializable { public: - AudioChannel(); + AudioChannel() = default; void reset(); @@ -45,18 +45,18 @@ class AudioChannel : public Serializable bool load(Serializer& in) override; private: - uInt8 myAudc; - uInt8 myAudv; - uInt8 myAudf; + uInt8 myAudc{0}; + uInt8 myAudv{0}; + uInt8 myAudf{0}; - bool myClockEnable; - bool myNoiseFeedback; - bool myNoiseCounterBit4; - bool myPulseCounterHold; + bool myClockEnable{false}; + bool myNoiseFeedback{false}; + bool myNoiseCounterBit4{false}; + bool myPulseCounterHold{false}; - uInt8 myDivCounter; - uInt8 myPulseCounter; - uInt8 myNoiseCounter; + uInt8 myDivCounter{0}; + uInt8 myPulseCounter{0}; + uInt8 myNoiseCounter{0}; private: AudioChannel(const AudioChannel&) = delete; diff --git a/src/emucore/tia/Ball.cxx b/src/emucore/tia/Ball.cxx index 631bc8a6a..620b88611 100644 --- a/src/emucore/tia/Ball.cxx +++ b/src/emucore/tia/Ball.cxx @@ -20,12 +20,8 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ball::Ball(uInt32 collisionMask) - : myCollisionMaskDisabled(collisionMask), - myCollisionMaskEnabled(0xFFFF), - myIsSuppressed(false), - myTIA(nullptr) + : myCollisionMaskDisabled(collisionMask) { - reset(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -47,7 +43,6 @@ void Ball::reset() myIsRendering = false; myDebugEnabled = false; myRenderCounter = 0; - myIsEnabled = false; myInvertedPhaseClock = false; myUseInvertedPhaseClock = false; } diff --git a/src/emucore/tia/Ball.hxx b/src/emucore/tia/Ball.hxx index 3d7ff67b5..e0297ebb9 100644 --- a/src/emucore/tia/Ball.hxx +++ b/src/emucore/tia/Ball.hxx @@ -182,14 +182,14 @@ class Ball : public Serializable abused to store visibility (as the actual collision bit will always be zero if collisions are disabled). */ - uInt32 collision; + uInt32 collision{0}; /** The movement flag. This corresponds to the state of the movement latch for this sprite --- true while movement is active and ticks are still propagated to the counters, false otherwise. */ - bool isMoving; + bool isMoving{false}; private: @@ -220,113 +220,113 @@ class Ball : public Serializable Collision mask values for active / inactive states. Disabling collisions will change those. */ - uInt32 myCollisionMaskDisabled; - uInt32 myCollisionMaskEnabled; + uInt32 myCollisionMaskDisabled{0}; + uInt32 myCollisionMaskEnabled{0xFFFF}; /** Color value calculated by applyColors(). */ - uInt8 myColor; + uInt8 myColor{0}; /** Color configured by COLUPF */ - uInt8 myObjectColor; + uInt8 myObjectColor{0}; /** Color for debug mode. */ - uInt8 myDebugColor; + uInt8 myDebugColor{0}; /** Debug mode enabled? */ - bool myDebugEnabled; + bool myDebugEnabled{false}; /** "old" and "new" values of the enabled flag. */ - bool myIsEnabledOld; - bool myIsEnabledNew; + bool myIsEnabledOld{false}; + bool myIsEnabledNew{false}; /** Actual value of the enabled flag. Determined from the "old" and "new" values VDEL, debug settings etc. */ - bool myIsEnabled; + bool myIsEnabled{false}; /** Is the sprite turned off in the debugger? */ - bool myIsSuppressed; + bool myIsSuppressed{false}; /** Is VDEL active? */ - bool myIsDelaying; + bool myIsDelaying{false}; /** Is the ball sprite signal currently active? */ - bool mySignalActive; + bool mySignalActive{false}; /** HMM clocks before movement stops. Changed by writing to HMBL. */ - uInt8 myHmmClocks; + uInt8 myHmmClocks{0}; /** The sprite counter */ - uInt8 myCounter; + uInt8 myCounter{0}; /** Ball width, as configured by CTRLPF. */ - uInt8 myWidth; + uInt8 myWidth{1}; /** Effective width used for drawing. This is usually the same as myWidth, but my differ in starfield mode. */ - uInt8 myEffectiveWidth; + uInt8 myEffectiveWidth{1}; /** The value of the counter value at which the last movement tick occurred. This is used for simulating the starfield pattern. */ - uInt8 myLastMovementTick; + uInt8 myLastMovementTick{0}; /** Are we currently rendering? This is latched when the counter hits it decode value, or when RESBL is strobed. It is turned off once the render counter reaches its maximum (i.e. when the sprite has been fully displayed). */ - bool myIsRendering; + bool myIsRendering{false}; /** Rendering counter. It starts counting (below zero) when the counter hits the decode value, and the actual signal becomes active once it reaches 0. */ - Int8 myRenderCounter; + Int8 myRenderCounter{0}; /** This memorizes a movement tick outside HBLANK in inverted clock mode. It is latched durin ::movementTick() and processed during ::tick() where it inhibits the clock pulse. */ - bool myInvertedPhaseClock; + bool myInvertedPhaseClock{false}; /** Use "inverted movement clock phase" mode? This emulates an idiosyncracy of several newer TIA revisions (see the setter above for a deeper explanation). */ - bool myUseInvertedPhaseClock; + bool myUseInvertedPhaseClock{false}; /** TIA instance. Required for flushing the line cache and requesting collision updates. */ - TIA* myTIA; + TIA* myTIA{nullptr}; private: Ball() = delete; diff --git a/src/emucore/tia/DelayQueueIteratorImpl.hxx b/src/emucore/tia/DelayQueueIteratorImpl.hxx index 00e14a0ec..ac5bd5027 100644 --- a/src/emucore/tia/DelayQueueIteratorImpl.hxx +++ b/src/emucore/tia/DelayQueueIteratorImpl.hxx @@ -46,8 +46,8 @@ class DelayQueueIteratorImpl : public DelayQueueIterator private: const DelayQueue& myDelayQueue; - uInt8 myDelayCycle; - uInt8 myIndex; + uInt8 myDelayCycle{0}; + uInt8 myIndex{0}; }; // ############################################################################ @@ -59,9 +59,7 @@ template DelayQueueIteratorImpl::DelayQueueIteratorImpl( const DelayQueue& delayQueue ) - : myDelayQueue(delayQueue), - myDelayCycle(0), - myIndex(0) + : myDelayQueue(delayQueue) { while (myDelayQueue.myMembers[currentIndex()].mySize == 0 && isValid()) myDelayCycle++; diff --git a/src/emucore/tia/DrawCounterDecodes.hxx b/src/emucore/tia/DrawCounterDecodes.hxx index 834a15edd..2ff8135c3 100644 --- a/src/emucore/tia/DrawCounterDecodes.hxx +++ b/src/emucore/tia/DrawCounterDecodes.hxx @@ -36,9 +36,9 @@ class DrawCounterDecodes private: - uInt8* myPlayerDecodes[8]; + uInt8* myPlayerDecodes[8]{nullptr}; - uInt8* myMissileDecodes[8]; + uInt8* myMissileDecodes[8]{nullptr}; uInt8 myDecodes0[160], myDecodes1[160], myDecodes2[160], myDecodes3[160], myDecodes4[160], myDecodes6[160]; diff --git a/src/emucore/tia/LatchedInput.cxx b/src/emucore/tia/LatchedInput.cxx index 2c6dcf90d..9a2982296 100644 --- a/src/emucore/tia/LatchedInput.cxx +++ b/src/emucore/tia/LatchedInput.cxx @@ -17,12 +17,6 @@ #include "LatchedInput.hxx" -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -LatchedInput::LatchedInput() -{ - reset(); -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void LatchedInput::reset() { diff --git a/src/emucore/tia/LatchedInput.hxx b/src/emucore/tia/LatchedInput.hxx index 5cb066ad3..672dce625 100644 --- a/src/emucore/tia/LatchedInput.hxx +++ b/src/emucore/tia/LatchedInput.hxx @@ -24,7 +24,7 @@ class LatchedInput : public Serializable { public: - LatchedInput(); + LatchedInput() = default; public: @@ -42,8 +42,8 @@ class LatchedInput : public Serializable bool load(Serializer& in) override; private: - bool myModeLatched; - uInt8 myLatchedValue; + bool myModeLatched{false}; + uInt8 myLatchedValue{0}; private: LatchedInput(const LatchedInput&) = delete; diff --git a/src/emucore/tia/Missile.cxx b/src/emucore/tia/Missile.cxx index 89fdc607d..ceef11013 100644 --- a/src/emucore/tia/Missile.cxx +++ b/src/emucore/tia/Missile.cxx @@ -21,13 +21,8 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Missile::Missile(uInt32 collisionMask) - : myCollisionMaskDisabled(collisionMask), - myCollisionMaskEnabled(0xFFFF), - myIsSuppressed(false), - myDecodesOffset(0), - myTIA(nullptr) + : myCollisionMaskDisabled(collisionMask) { - reset(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/tia/Missile.hxx b/src/emucore/tia/Missile.hxx index 0edf68e2a..202c6c7cd 100644 --- a/src/emucore/tia/Missile.hxx +++ b/src/emucore/tia/Missile.hxx @@ -82,8 +82,8 @@ class Missile : public Serializable public: - uInt32 collision; - bool isMoving; + uInt32 collision{0}; + bool isMoving{false}; private: @@ -98,35 +98,35 @@ class Missile : public Serializable private: - uInt32 myCollisionMaskDisabled; - uInt32 myCollisionMaskEnabled; + uInt32 myCollisionMaskDisabled{0}; + uInt32 myCollisionMaskEnabled{0xFFFF}; - bool myIsEnabled; - bool myIsSuppressed; - bool myEnam; - uInt8 myResmp; + bool myIsEnabled{false}; + bool myIsSuppressed{false}; + bool myEnam{false}; + uInt8 myResmp{0}; - uInt8 myHmmClocks; - uInt8 myCounter; + uInt8 myHmmClocks{0}; + uInt8 myCounter{0}; - uInt8 myWidth; - uInt8 myEffectiveWidth; + uInt8 myWidth{1}; + uInt8 myEffectiveWidth{1}; - bool myIsRendering; - bool myIsVisible; - Int8 myRenderCounter; + bool myIsRendering{false}; + bool myIsVisible{false}; + Int8 myRenderCounter{0}; - const uInt8* myDecodes; - uInt8 myDecodesOffset; // needed for state saving + const uInt8* myDecodes{nullptr}; + uInt8 myDecodesOffset{0}; // needed for state saving - uInt8 myColor; - uInt8 myObjectColor, myDebugColor; - bool myDebugEnabled; + uInt8 myColor{0}; + uInt8 myObjectColor{0}, myDebugColor{0}; + bool myDebugEnabled{false}; - bool myInvertedPhaseClock; - bool myUseInvertedPhaseClock; + bool myInvertedPhaseClock{false}; + bool myUseInvertedPhaseClock{false}; - TIA *myTIA; + TIA *myTIA{nullptr}; private: Missile(const Missile&) = delete; diff --git a/src/emucore/tia/PaddleReader.cxx b/src/emucore/tia/PaddleReader.cxx index b03bc487d..63fcb9967 100644 --- a/src/emucore/tia/PaddleReader.cxx +++ b/src/emucore/tia/PaddleReader.cxx @@ -22,7 +22,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PaddleReader::PaddleReader() { - reset(0); + setConsoleTiming(ConsoleTiming::ntsc); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/tia/PaddleReader.hxx b/src/emucore/tia/PaddleReader.hxx index c169ed849..e76deb8d0 100644 --- a/src/emucore/tia/PaddleReader.hxx +++ b/src/emucore/tia/PaddleReader.hxx @@ -53,16 +53,16 @@ class PaddleReader : public Serializable private: - double myUThresh; - double myU; + double myUThresh{0.0}; + double myU{0.0}; - double myValue; - uInt64 myTimestamp; + double myValue{0.0}; + uInt64 myTimestamp{0}; ConsoleTiming myConsoleTiming; - double myClockFreq; + double myClockFreq{0.0}; - bool myIsDumped; + bool myIsDumped{false}; static constexpr double R0 = 1.5e3, diff --git a/src/emucore/tia/Player.cxx b/src/emucore/tia/Player.cxx index 2deb6ebac..9b763a842 100644 --- a/src/emucore/tia/Player.cxx +++ b/src/emucore/tia/Player.cxx @@ -21,13 +21,8 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Player::Player(uInt32 collisionMask) - : myCollisionMaskDisabled(collisionMask), - myCollisionMaskEnabled(0xFFFF), - myIsSuppressed(false), - myDecodesOffset(0), - myTIA(nullptr) + : myCollisionMaskDisabled(collisionMask) { - reset(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/tia/Player.hxx b/src/emucore/tia/Player.hxx index d44432f64..f50f05e22 100644 --- a/src/emucore/tia/Player.hxx +++ b/src/emucore/tia/Player.hxx @@ -93,8 +93,8 @@ class Player : public Serializable public: - uInt32 collision; - bool isMoving; + uInt32 collision{0}; + bool isMoving{false}; private: @@ -110,39 +110,39 @@ class Player : public Serializable private: - uInt32 myCollisionMaskDisabled; - uInt32 myCollisionMaskEnabled; + uInt32 myCollisionMaskDisabled{0}; + uInt32 myCollisionMaskEnabled{0xFFFF}; - uInt8 myColor; - uInt8 myObjectColor, myDebugColor; - bool myDebugEnabled; + uInt8 myColor{0}; + uInt8 myObjectColor{0}, myDebugColor{0}; + bool myDebugEnabled{0}; - bool myIsSuppressed; + bool myIsSuppressed{false}; - uInt8 myHmmClocks; - uInt8 myCounter; + uInt8 myHmmClocks{0}; + uInt8 myCounter{0}; - bool myIsRendering; - Int8 myRenderCounter; - Int8 myRenderCounterTripPoint; - uInt8 myDivider; - uInt8 myDividerPending; - uInt8 mySampleCounter; - Int8 myDividerChangeCounter; + bool myIsRendering{false}; + Int8 myRenderCounter{0}; + Int8 myRenderCounterTripPoint{0}; + uInt8 myDivider{0}; + uInt8 myDividerPending{0}; + uInt8 mySampleCounter{0}; + Int8 myDividerChangeCounter{-1}; - const uInt8* myDecodes; - uInt8 myDecodesOffset; // needed for state saving + const uInt8* myDecodes{nullptr}; + uInt8 myDecodesOffset{0}; // needed for state saving - uInt8 myPatternOld; - uInt8 myPatternNew; - uInt8 myPattern; + uInt8 myPatternOld{0}; + uInt8 myPatternNew{0}; + uInt8 myPattern{0}; - bool myIsReflected; - bool myIsDelaying; - bool myInvertedPhaseClock; - bool myUseInvertedPhaseClock; + bool myIsReflected{false}; + bool myIsDelaying{false}; + bool myInvertedPhaseClock{false}; + bool myUseInvertedPhaseClock{false}; - TIA* myTIA; + TIA* myTIA{nullptr}; private: Player(const Player&) = delete; diff --git a/src/emucore/tia/Playfield.cxx b/src/emucore/tia/Playfield.cxx index e600ccdfe..899462244 100644 --- a/src/emucore/tia/Playfield.cxx +++ b/src/emucore/tia/Playfield.cxx @@ -20,12 +20,8 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Playfield::Playfield(uInt32 collisionMask) - : myCollisionMaskDisabled(collisionMask), - myCollisionMaskEnabled(0xFFFF), - myIsSuppressed(false), - myTIA(nullptr) + : myCollisionMaskDisabled(collisionMask) { - reset(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emucore/tia/Playfield.hxx b/src/emucore/tia/Playfield.hxx index c8389b90b..0e432e64f 100644 --- a/src/emucore/tia/Playfield.hxx +++ b/src/emucore/tia/Playfield.hxx @@ -139,7 +139,7 @@ class Playfield : public Serializable abused to store visibility (as the actual collision bit will always be zero if collisions are disabled). */ - uInt32 collision; + uInt32 collision{0}; private: @@ -166,77 +166,77 @@ class Playfield : public Serializable Collision mask values for active / inactive states. Disabling collisions will change those. */ - uInt32 myCollisionMaskDisabled; - uInt32 myCollisionMaskEnabled; + uInt32 myCollisionMaskDisabled{0}; + uInt32 myCollisionMaskEnabled{0xFFFF}; /** Enable / disable PF (debugging). */ - bool myIsSuppressed; + bool myIsSuppressed{false}; /** Left / right PF colors. Derifed from P0 / P1 color, COLUPF and playfield mode. */ - uInt8 myColorLeft; - uInt8 myColorRight; + uInt8 myColorLeft{0}; + uInt8 myColorRight{0}; /** P0 / P1 colors */ - uInt8 myColorP0; - uInt8 myColorP1; + uInt8 myColorP0{0}; + uInt8 myColorP1{0}; /** COLUPF and debug colors */ - uInt8 myObjectColor, myDebugColor; + uInt8 myObjectColor{0}, myDebugColor{0}; /** Debug colors enabled? */ - bool myDebugEnabled; + bool myDebugEnabled{false}; /** * Plafield mode. */ - ColorMode myColorMode; + ColorMode myColorMode{ColorMode::normal}; /** Pattern derifed from PF0, PF1, PF2 */ - uInt32 myPattern; + uInt32 myPattern{0}; /** "Effective pattern". Will be 0 if playfield is disabled (debug), otherwise the same as myPattern. */ - uInt32 myEffectivePattern; + uInt32 myEffectivePattern{0}; /** Reflected mode on / off. */ - bool myReflected; + bool myReflected{false}; /** * Are we currently drawing the reflected PF? */ - bool myRefp; + bool myRefp{false}; /** PF registers. */ - uInt8 myPf0; - uInt8 myPf1; - uInt8 myPf2; + uInt8 myPf0{0}; + uInt8 myPf1{0}; + uInt8 myPf2{0}; /** The current scanline position (0 .. 159). */ - uInt32 myX; + uInt32 myX{0}; /** TIA instance. Required for flushing the line cache. */ - TIA* myTIA; + TIA* myTIA{nullptr}; private: Playfield() = delete; diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index e3d8d9399..fa21a38c7 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -71,15 +71,12 @@ TIA::TIA(ConsoleIO& console, const ConsoleTimingProvider& timingProvider, : myConsole(console), myTimingProvider(timingProvider), mySettings(settings), - myFrameManager(nullptr), myPlayfield(~CollisionMask::playfield & 0x7FFF), myMissile0(~CollisionMask::missile0 & 0x7FFF), myMissile1(~CollisionMask::missile1 & 0x7FFF), myPlayer0(~CollisionMask::player0 & 0x7FFF), myPlayer1(~CollisionMask::player1 & 0x7FFF), - myBall(~CollisionMask::ball & 0x7FFF), - mySpriteEnabledBits(0xFF), - myCollisionsEnabledBits(0xFF) + myBall(~CollisionMask::ball & 0x7FFF) { myBackground.setTIA(this); myPlayfield.setTIA(this); diff --git a/src/emucore/tia/TIA.hxx b/src/emucore/tia/TIA.hxx index cd38905d1..4aaeb174e 100644 --- a/src/emucore/tia/TIA.hxx +++ b/src/emucore/tia/TIA.hxx @@ -713,16 +713,16 @@ class TIA : public Device /** Variable delay values for TIA writes. */ - uInt8 myPFBitsDelay; - uInt8 myPFColorDelay; - uInt8 myPlSwapDelay; - uInt8 myBlSwapDelay; + uInt8 myPFBitsDelay{0}; + uInt8 myPFColorDelay{0}; + uInt8 myPlSwapDelay{0}; + uInt8 myBlSwapDelay{0}; /** * The frame manager is responsible for detecting frame boundaries and the visible * region of each frame. */ - AbstractFrameManager* myFrameManager; + AbstractFrameManager* myFrameManager{nullptr}; /** * The various TIA objects. @@ -758,108 +758,108 @@ class TIA : public Device // We snapshot frame statistics when the back buffer is copied to the front buffer // and when the front buffer is copied to the frame buffer - uInt32 myFrontBufferScanlines, myFrameBufferScanlines; + uInt32 myFrontBufferScanlines{0}, myFrameBufferScanlines{0}; // Frames since the last time a frame was rendered to the render buffer - uInt32 myFramesSinceLastRender; + uInt32 myFramesSinceLastRender{0}; /** * Setting this to true injects random values into undefined reads. */ - bool myTIAPinsDriven; + bool myTIAPinsDriven{false}; /** * The current "line state" --- either hblank or frame. */ - HState myHstate; + HState myHstate{HState::blank}; /** * Master line counter */ - uInt8 myHctr; + uInt8 myHctr{0}; /** * Delta between master line counter and actual color clock. Nonzero after * RSYNC (before the scanline terminates) */ - Int32 myHctrDelta; + Int32 myHctrDelta{0}; /** * Electron beam x at rendering start (used for blanking out any pixels from * the last frame that are not overwritten) */ - uInt8 myXAtRenderingStart; + uInt8 myXAtRenderingStart{0}; /** * Do we need to update the collision mask this clock? */ - bool myCollisionUpdateRequired; + bool myCollisionUpdateRequired{false}; /** * Force schedule a collision update */ - bool myCollisionUpdateScheduled; + bool myCollisionUpdateScheduled{false}; /** * The collision latches are represented by 15 bits in a bitfield. */ - uInt32 myCollisionMask; + uInt32 myCollisionMask{0}; /** * The movement clock counts the extra ticks sent to the objects during * movement. */ - uInt32 myMovementClock; + uInt32 myMovementClock{0}; /** * Movement mode --- are we sending movement clocks? */ - bool myMovementInProgress; + bool myMovementInProgress{false}; /** * Do we have an extended hblank this line? Get set by strobing HMOVE and * cleared when the line wraps. */ - bool myExtendedHblank; + bool myExtendedHblank{false}; /** * Counts the number of line wraps since the last external TIA state change. * If at least two line breaks have passed, the TIA will suspend simulation * and just reuse the last line instead. */ - uInt32 myLinesSinceChange; + uInt32 myLinesSinceChange{0}; /** * The current mode of the priority encoder. */ - Priority myPriority; + Priority myPriority{Priority::normal}; /** * The index of the last CPU cycle that was included in the simulation. */ - uInt64 myLastCycle; + uInt64 myLastCycle{0}; /** * Keeps track of a possible fractional number of clocks that still need * to be simulated. */ - uInt8 mySubClock; + uInt8 mySubClock{0}; /** * Bitmasks that track which sprites / collisions are enabled / disabled. */ - uInt8 mySpriteEnabledBits; - uInt8 myCollisionsEnabledBits; + uInt8 mySpriteEnabledBits{0xFF}; + uInt8 myCollisionsEnabledBits{0xFF}; /** * The color used to highlight HMOVE blanks (if enabled). */ - uInt8 myColorHBlank; + uInt8 myColorHBlank{0}; /** * The total number of color clocks since emulation started. */ - uInt64 myTimestamp; + uInt64 myTimestamp{0}; /** * The "shadow registers" track the last written register value for the @@ -872,21 +872,21 @@ class TIA : public Device * occurs on PAL-like systems when the previous frame contains an odd * number of scanlines. */ - bool myColorLossEnabled; - bool myColorLossActive; + bool myColorLossEnabled{false}; + bool myColorLossActive{false}; std::array myColorCounts; /** * System cycles at the end of the previous frame / beginning of next frame. */ - uInt64 myCyclesAtFrameStart; + uInt64 myCyclesAtFrameStart{0}; /** * The frame manager can change during our lifetime, so we buffer those two. */ - bool myEnableJitter; - uInt8 myJitterFactor; + bool myEnableJitter{false}; + uInt8 myJitterFactor{0}; static constexpr uInt16 TIA_SIZE = 0x40, TIA_MASK = TIA_SIZE - 1, TIA_READ_MASK = 0x0f, TIA_BIT = 0x080, TIA_DELAY = 2; From 3e3b9b3d50e3675711a34d706dc131a40ac872e7 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sun, 29 Dec 2019 20:12:37 -0330 Subject: [PATCH 2/5] Final updates for default initialization. The debugger is crashing, so now the debugging begins :) --- src/gui/AboutDialog.cxx | 5 +- src/gui/AboutDialog.hxx | 14 ++-- src/gui/AudioDialog.hxx | 20 +++--- src/gui/BrowserDialog.cxx | 4 +- src/gui/BrowserDialog.hxx | 16 ++--- src/gui/ColorWidget.cxx | 4 +- src/gui/ColorWidget.hxx | 6 +- src/gui/ComboDialog.cxx | 3 +- src/gui/ComboDialog.hxx | 4 +- src/gui/Command.hxx | 2 +- src/gui/CommandDialog.hxx | 22 +++---- src/gui/CommandMenu.cxx | 3 +- src/gui/CommandMenu.hxx | 2 +- src/gui/ContextMenu.cxx | 10 --- src/gui/ContextMenu.hxx | 18 +++--- src/gui/DeveloperDialog.hxx | 92 +++++++++++++-------------- src/gui/DialogContainer.cxx | 21 ++---- src/gui/DialogContainer.hxx | 40 ++++++------ src/gui/EditTextWidget.cxx | 3 +- src/gui/EditTextWidget.hxx | 2 +- src/gui/EditableWidget.cxx | 27 ++++---- src/gui/EditableWidget.hxx | 12 ++-- src/gui/EventMappingWidget.cxx | 18 +----- src/gui/EventMappingWidget.hxx | 42 ++++++------ src/gui/FileListWidget.cxx | 7 +- src/gui/FileListWidget.hxx | 6 +- src/gui/GameInfoDialog.hxx | 70 ++++++++++---------- src/gui/GlobalPropsDialog.hxx | 16 ++--- src/gui/GuiObject.hxx | 7 +- src/gui/HelpDialog.cxx | 4 +- src/gui/HelpDialog.hxx | 12 ++-- src/gui/InputDialog.cxx | 1 - src/gui/InputDialog.hxx | 48 +++++++------- src/gui/InputTextDialog.cxx | 6 +- src/gui/InputTextDialog.hxx | 10 +-- src/gui/JoystickDialog.hxx | 8 +-- src/gui/Launcher.cxx | 3 +- src/gui/Launcher.hxx | 6 +- src/gui/LauncherDialog.cxx | 12 +--- src/gui/LauncherDialog.hxx | 30 ++++----- src/gui/ListWidget.cxx | 8 +-- src/gui/ListWidget.hxx | 14 ++-- src/gui/LoggerDialog.cxx | 3 +- src/gui/LoggerDialog.hxx | 6 +- src/gui/Menu.cxx | 4 +- src/gui/Menu.hxx | 4 +- src/gui/MessageBox.hxx | 2 +- src/gui/MinUICommandDialog.cxx | 4 +- src/gui/MinUICommandDialog.hxx | 22 +++---- src/gui/OptionsDialog.hxx | 8 +-- src/gui/PopUpWidget.cxx | 3 +- src/gui/PopUpWidget.hxx | 8 +-- src/gui/ProgressDialog.cxx | 7 +- src/gui/ProgressDialog.hxx | 6 +- src/gui/R77HelpDialog.cxx | 6 +- src/gui/R77HelpDialog.hxx | 16 ++--- src/gui/RadioButtonWidget.cxx | 4 +- src/gui/RadioButtonWidget.hxx | 2 +- src/gui/RomAuditDialog.hxx | 8 +-- src/gui/RomInfoWidget.cxx | 2 - src/gui/RomInfoWidget.hxx | 4 +- src/gui/ScrollBarWidget.cxx | 49 ++++++-------- src/gui/ScrollBarWidget.hxx | 27 +++----- src/gui/SnapshotDialog.hxx | 10 +-- src/gui/StellaSettingsDialog.hxx | 28 ++++---- src/gui/StringListWidget.hxx | 2 +- src/gui/TabWidget.cxx | 5 +- src/gui/TabWidget.hxx | 16 ++--- src/gui/TimeLineWidget.cxx | 4 -- src/gui/TimeLineWidget.hxx | 8 +-- src/gui/TimeMachine.cxx | 1 - src/gui/TimeMachine.hxx | 4 +- src/gui/TimeMachineDialog.cxx | 3 +- src/gui/TimeMachineDialog.hxx | 30 ++++----- src/gui/UIDialog.hxx | 36 +++++------ src/gui/VideoDialog.hxx | 70 ++++++++++---------- src/gui/Widget.cxx | 46 ++------------ src/gui/Widget.hxx | 74 ++++++++++----------- src/macos/OSystemMACOS.hxx | 5 +- src/macos/SerialPortMACOS.cxx | 3 +- src/macos/SerialPortMACOS.hxx | 2 +- src/macos/SettingsRepositoryMACOS.hxx | 8 +-- src/windows/FSNodeWINDOWS.cxx | 6 -- src/windows/FSNodeWINDOWS.hxx | 8 +-- src/windows/SerialPortWINDOWS.cxx | 3 +- src/windows/SerialPortWINDOWS.hxx | 2 +- 86 files changed, 534 insertions(+), 693 deletions(-) diff --git a/src/gui/AboutDialog.cxx b/src/gui/AboutDialog.cxx index 47154b4ee..ba4a38081 100644 --- a/src/gui/AboutDialog.cxx +++ b/src/gui/AboutDialog.cxx @@ -25,10 +25,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AboutDialog::AboutDialog(OSystem& osystem, DialogContainer& parent, const GUI::Font& font) - : Dialog(osystem, parent, font, "About Stella"), - myPage(1), - myNumPages(4), - myLinesPerPage(13) + : Dialog(osystem, parent, font, "About Stella") { const int lineHeight = font.getLineHeight(), fontWidth = font.getMaxCharWidth(), diff --git a/src/gui/AboutDialog.hxx b/src/gui/AboutDialog.hxx index a369d72f7..b2c063bbb 100644 --- a/src/gui/AboutDialog.hxx +++ b/src/gui/AboutDialog.hxx @@ -41,16 +41,16 @@ class AboutDialog : public Dialog void loadConfig() override { displayInfo(); } private: - ButtonWidget* myNextButton; - ButtonWidget* myPrevButton; + ButtonWidget* myNextButton{nullptr}; + ButtonWidget* myPrevButton{nullptr}; - StaticTextWidget* myTitle; - vector myDesc; + StaticTextWidget* myTitle{nullptr}; + vector myDesc{nullptr}; vector myDescStr; - int myPage; - int myNumPages; - int myLinesPerPage; + int myPage{1}; + int myNumPages{4}; + int myLinesPerPage{13}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/AudioDialog.hxx b/src/gui/AudioDialog.hxx index 1fff515d1..19a3c9cec 100644 --- a/src/gui/AudioDialog.hxx +++ b/src/gui/AudioDialog.hxx @@ -54,16 +54,16 @@ class AudioDialog : public Dialog kBufferSizeChanged = 'ADbc' }; - CheckboxWidget* mySoundEnableCheckbox; - SliderWidget* myVolumeSlider; - CheckboxWidget* myStereoSoundCheckbox; - PopUpWidget* myModePopup; - PopUpWidget* myFragsizePopup; - PopUpWidget* myFreqPopup; - PopUpWidget* myResamplingPopup; - SliderWidget* myHeadroomSlider; - SliderWidget* myBufferSizeSlider; - SliderWidget* myDpcPitch; + CheckboxWidget* mySoundEnableCheckbox{nullptr}; + SliderWidget* myVolumeSlider{nullptr}; + CheckboxWidget* myStereoSoundCheckbox{nullptr}; + PopUpWidget* myModePopup{nullptr}; + PopUpWidget* myFragsizePopup{nullptr}; + PopUpWidget* myFreqPopup{nullptr}; + PopUpWidget* myResamplingPopup{nullptr}; + SliderWidget* myHeadroomSlider{nullptr}; + SliderWidget* myBufferSizeSlider{nullptr}; + SliderWidget* myDpcPitch{nullptr}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/BrowserDialog.cxx b/src/gui/BrowserDialog.cxx index 040e7197f..89ae2b2b3 100644 --- a/src/gui/BrowserDialog.cxx +++ b/src/gui/BrowserDialog.cxx @@ -35,9 +35,7 @@ BrowserDialog::BrowserDialog(GuiObject* boss, const GUI::Font& font, int max_w, int max_h, const string& title) : Dialog(boss->instance(), boss->parent(), font, title), - CommandSender(boss), - _cmd(0), - _mode(FileSave) + CommandSender(boss) { // Set real dimensions _w = max_w; diff --git a/src/gui/BrowserDialog.hxx b/src/gui/BrowserDialog.hxx index 5a14ad834..906d81145 100644 --- a/src/gui/BrowserDialog.hxx +++ b/src/gui/BrowserDialog.hxx @@ -61,16 +61,16 @@ class BrowserDialog : public Dialog, public CommandSender kBaseDirCmd = 'BADR' }; - int _cmd; + int _cmd{0}; - FileListWidget* _fileList; - EditTextWidget* _currentPath; - StaticTextWidget* _type; - EditTextWidget* _selected; - ButtonWidget* _goUpButton; - ButtonWidget* _basedirButton; + FileListWidget* _fileList{nullptr}; + EditTextWidget* _currentPath{nullptr}; + StaticTextWidget* _type{nullptr}; + EditTextWidget* _selected{nullptr}; + ButtonWidget* _goUpButton{nullptr}; + ButtonWidget* _basedirButton{nullptr}; - BrowserDialog::ListMode _mode; + BrowserDialog::ListMode _mode{Directories}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/ColorWidget.cxx b/src/gui/ColorWidget.cxx index 86ee01260..7f3a98cb2 100644 --- a/src/gui/ColorWidget.cxx +++ b/src/gui/ColorWidget.cxx @@ -28,9 +28,7 @@ ColorWidget::ColorWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h, int cmd) : Widget(boss, font, x, y, w, h), CommandSender(boss), - _color(kNone), - _cmd(cmd), - _crossGrid(false) + _cmd(cmd) { _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS; } diff --git a/src/gui/ColorWidget.hxx b/src/gui/ColorWidget.hxx index 19a6ebf4f..9de566dee 100644 --- a/src/gui/ColorWidget.hxx +++ b/src/gui/ColorWidget.hxx @@ -48,10 +48,10 @@ class ColorWidget : public Widget, public CommandSender void drawWidget(bool hilite) override; protected: - ColorId _color; - int _cmd; + ColorId _color{kNone}; + int _cmd{0}; - bool _crossGrid; + bool _crossGrid{false}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/ComboDialog.cxx b/src/gui/ComboDialog.cxx index 7f083f736..c6bce587e 100644 --- a/src/gui/ComboDialog.cxx +++ b/src/gui/ComboDialog.cxx @@ -29,8 +29,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ComboDialog::ComboDialog(GuiObject* boss, const GUI::Font& font, const VariantList& combolist) - : Dialog(boss->instance(), boss->parent(), font, "Add..."), - myComboEvent(Event::NoType) + : Dialog(boss->instance(), boss->parent(), font, "Add...") { const int lineHeight = font.getLineHeight(), fontWidth = font.getMaxCharWidth(); diff --git a/src/gui/ComboDialog.hxx b/src/gui/ComboDialog.hxx index 7787a4682..94ee4d4ba 100644 --- a/src/gui/ComboDialog.hxx +++ b/src/gui/ComboDialog.hxx @@ -43,8 +43,8 @@ class ComboDialog : public Dialog void handleCommand(CommandSender* sender, int cmd, int data, int id) override; private: - Event::Type myComboEvent; - std::array myEvents; + Event::Type myComboEvent{Event::NoType}; + std::array myEvents{nullptr}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/Command.hxx b/src/gui/Command.hxx index 51766e239..339284c15 100644 --- a/src/gui/Command.hxx +++ b/src/gui/Command.hxx @@ -62,7 +62,7 @@ class CommandSender } protected: - CommandReceiver* _target; + CommandReceiver* _target{nullptr}; }; #endif diff --git a/src/gui/CommandDialog.hxx b/src/gui/CommandDialog.hxx index fc084fe2e..a7710d8a3 100644 --- a/src/gui/CommandDialog.hxx +++ b/src/gui/CommandDialog.hxx @@ -40,19 +40,19 @@ class CommandDialog : public Dialog void processCancel() override; // column 0 - ButtonWidget* myColorButton; - ButtonWidget* myLeftDiffButton; - ButtonWidget* myRightDiffButton; + ButtonWidget* myColorButton{nullptr}; + ButtonWidget* myLeftDiffButton{nullptr}; + ButtonWidget* myRightDiffButton{nullptr}; // column 1 - ButtonWidget* mySaveStateButton; - ButtonWidget* myStateSlotButton; - ButtonWidget* myLoadStateButton; - ButtonWidget* myTimeMachineButton; + ButtonWidget* mySaveStateButton{nullptr}; + ButtonWidget* myStateSlotButton{nullptr}; + ButtonWidget* myLoadStateButton{nullptr}; + ButtonWidget* myTimeMachineButton{nullptr}; // column 2 - ButtonWidget* myTVFormatButton; - ButtonWidget* myPaletteButton; - ButtonWidget* myPhosphorButton; - ButtonWidget* mySoundButton; + ButtonWidget* myTVFormatButton{nullptr}; + ButtonWidget* myPaletteButton{nullptr}; + ButtonWidget* myPhosphorButton{nullptr}; + ButtonWidget* mySoundButton{nullptr}; enum { kSelectCmd = 'Csel', diff --git a/src/gui/CommandMenu.cxx b/src/gui/CommandMenu.cxx index 664aefc18..75d8f0cb3 100644 --- a/src/gui/CommandMenu.cxx +++ b/src/gui/CommandMenu.cxx @@ -22,8 +22,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CommandMenu::CommandMenu(OSystem& osystem) - : DialogContainer(osystem), - myBaseDialog(nullptr) + : DialogContainer(osystem) { if (osystem.settings().getBool("minimal_ui")) myBaseDialog = new MinUICommandDialog(myOSystem, *this); diff --git a/src/gui/CommandMenu.hxx b/src/gui/CommandMenu.hxx index f8d431942..b3740d94f 100644 --- a/src/gui/CommandMenu.hxx +++ b/src/gui/CommandMenu.hxx @@ -43,7 +43,7 @@ class CommandMenu : public DialogContainer Dialog* baseDialog() override; private: - Dialog* myBaseDialog; + Dialog* myBaseDialog{nullptr}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/ContextMenu.cxx b/src/gui/ContextMenu.cxx index 8c88f85b2..b20498f2d 100644 --- a/src/gui/ContextMenu.cxx +++ b/src/gui/ContextMenu.cxx @@ -31,17 +31,7 @@ ContextMenu::ContextMenu(GuiObject* boss, const GUI::Font& font, : Dialog(boss->instance(), boss->parent(), font), CommandSender(boss), _rowHeight(font.getLineHeight()), - _firstEntry(0), - _numEntries(0), - _selectedOffset(0), - _selectedItem(-1), - _showScroll(false), - _isScrolling(false), - _scrollUpColor(kColor), - _scrollDnColor(kColor), _cmd(cmd), - _xorig(0), - _yorig(0), _maxWidth(width) { addItems(items); diff --git a/src/gui/ContextMenu.hxx b/src/gui/ContextMenu.hxx index 88bd6fe33..8827e8b03 100644 --- a/src/gui/ContextMenu.hxx +++ b/src/gui/ContextMenu.hxx @@ -113,17 +113,17 @@ class ContextMenu : public Dialog, public CommandSender private: VariantList _entries; - int _rowHeight; - int _firstEntry, _numEntries; - int _selectedOffset, _selectedItem; - bool _showScroll; - bool _isScrolling; - ColorId _scrollUpColor, _scrollDnColor; + int _rowHeight{0}; + int _firstEntry{0}, _numEntries{0}; + int _selectedOffset{0}, _selectedItem{-1}; + bool _showScroll{false}; + bool _isScrolling{false}; + ColorId _scrollUpColor{kColor}, _scrollDnColor{kColor}; - int _cmd; + int _cmd{0}; - uInt32 _xorig, _yorig; - uInt32 _maxWidth; + uInt32 _xorig{0}, _yorig{0}; + uInt32 _maxWidth{0}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/DeveloperDialog.hxx b/src/gui/DeveloperDialog.hxx index 854235cec..d69286f61 100644 --- a/src/gui/DeveloperDialog.hxx +++ b/src/gui/DeveloperDialog.hxx @@ -86,64 +86,64 @@ class DeveloperDialog : public Dialog static const int DEBUG_COLORS = 6; - TabWidget* myTab; + TabWidget* myTab{nullptr}; // Emulator widgets - RadioButtonGroup* mySettingsGroupEmulation; - CheckboxWidget* myFrameStatsWidget; - PopUpWidget* myConsoleWidget; - StaticTextWidget* myLoadingROMLabel; - CheckboxWidget* myRandomBankWidget; - CheckboxWidget* myRandomizeRAMWidget; - StaticTextWidget* myRandomizeCPULabel; - CheckboxWidget* myUndrivenPinsWidget; - std::array myRandomizeCPUWidget; + RadioButtonGroup* mySettingsGroupEmulation{nullptr}; + CheckboxWidget* myFrameStatsWidget{nullptr}; + PopUpWidget* myConsoleWidget{nullptr}; + StaticTextWidget* myLoadingROMLabel{nullptr}; + CheckboxWidget* myRandomBankWidget{nullptr}; + CheckboxWidget* myRandomizeRAMWidget{nullptr}; + StaticTextWidget* myRandomizeCPULabel{nullptr}; + CheckboxWidget* myUndrivenPinsWidget{nullptr}; + std::array myRandomizeCPUWidget{nullptr}; #ifdef DEBUGGER_SUPPORT - CheckboxWidget* myRWPortBreakWidget; - CheckboxWidget* myWRPortBreakWidget; + CheckboxWidget* myRWPortBreakWidget{nullptr}; + CheckboxWidget* myWRPortBreakWidget{nullptr}; #endif - CheckboxWidget* myThumbExceptionWidget; - CheckboxWidget* myEEPROMAccessWidget; + CheckboxWidget* myThumbExceptionWidget{nullptr}; + CheckboxWidget* myEEPROMAccessWidget{nullptr}; // TIA widgets - RadioButtonGroup* mySettingsGroupTia; - PopUpWidget* myTIATypeWidget; - StaticTextWidget* myInvPhaseLabel; - CheckboxWidget* myPlInvPhaseWidget; - CheckboxWidget* myMsInvPhaseWidget; - CheckboxWidget* myBlInvPhaseWidget; - StaticTextWidget* myPlayfieldLabel; - CheckboxWidget* myPFBitsWidget; - CheckboxWidget* myPFColorWidget; - StaticTextWidget* mySwapLabel; - CheckboxWidget* myPlSwapWidget; - CheckboxWidget* myBlSwapWidget; + RadioButtonGroup* mySettingsGroupTia{nullptr}; + PopUpWidget* myTIATypeWidget{nullptr}; + StaticTextWidget* myInvPhaseLabel{nullptr}; + CheckboxWidget* myPlInvPhaseWidget{nullptr}; + CheckboxWidget* myMsInvPhaseWidget{nullptr}; + CheckboxWidget* myBlInvPhaseWidget{nullptr}; + StaticTextWidget* myPlayfieldLabel{nullptr}; + CheckboxWidget* myPFBitsWidget{nullptr}; + CheckboxWidget* myPFColorWidget{nullptr}; + StaticTextWidget* mySwapLabel{nullptr}; + CheckboxWidget* myPlSwapWidget{nullptr}; + CheckboxWidget* myBlSwapWidget{nullptr}; // Video widgets - RadioButtonGroup* mySettingsGroupVideo; - CheckboxWidget* myTVJitterWidget; - SliderWidget* myTVJitterRecWidget; - StaticTextWidget* myTVJitterRecLabelWidget; - CheckboxWidget* myColorLossWidget; - CheckboxWidget* myDebugColorsWidget; - std::array myDbgColour; - std::array myDbgColourSwatch; + RadioButtonGroup* mySettingsGroupVideo{nullptr}; + CheckboxWidget* myTVJitterWidget{nullptr}; + SliderWidget* myTVJitterRecWidget{nullptr}; + StaticTextWidget* myTVJitterRecLabelWidget{nullptr}; + CheckboxWidget* myColorLossWidget{nullptr}; + CheckboxWidget* myDebugColorsWidget{nullptr}; + std::array myDbgColour{nullptr}; + std::array myDbgColourSwatch{nullptr}; // States widgets - RadioButtonGroup* mySettingsGroupTM; - CheckboxWidget* myTimeMachineWidget; - SliderWidget* myStateSizeWidget; - SliderWidget* myUncompressedWidget; - PopUpWidget* myStateIntervalWidget; - PopUpWidget* myStateHorizonWidget; - RadioButtonGroup* mySaveOnExitGroup; + RadioButtonGroup* mySettingsGroupTM{nullptr}; + CheckboxWidget* myTimeMachineWidget{nullptr}; + SliderWidget* myStateSizeWidget{nullptr}; + SliderWidget* myUncompressedWidget{nullptr}; + PopUpWidget* myStateIntervalWidget{nullptr}; + PopUpWidget* myStateHorizonWidget{nullptr}; + RadioButtonGroup* mySaveOnExitGroup{nullptr}; #ifdef DEBUGGER_SUPPORT // Debugger UI widgets - SliderWidget* myDebuggerWidthSlider; - SliderWidget* myDebuggerHeightSlider; - PopUpWidget* myDebuggerFontSize; - PopUpWidget* myDebuggerFontStyle; - CheckboxWidget* myGhostReadsTrapWidget; + SliderWidget* myDebuggerWidthSlider{nullptr}; + SliderWidget* myDebuggerHeightSlider{nullptr}; + PopUpWidget* myDebuggerFontSize{nullptr}; + PopUpWidget* myDebuggerFontStyle{nullptr}; + CheckboxWidget* myGhostReadsTrapWidget{nullptr}; #endif bool mySettings; diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx index a5c505e6c..f9228df3a 100644 --- a/src/gui/DialogContainer.cxx +++ b/src/gui/DialogContainer.cxx @@ -27,13 +27,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DialogContainer::DialogContainer(OSystem& osystem) - : myOSystem(osystem), - myTime(0), - myClickRepeatTime(0), - myButtonRepeatTime(0), - myButtonLongPressTime(0), - myAxisRepeatTime(0), - myHatRepeatTime(0) + : myOSystem(osystem) { _DOUBLE_CLICK_DELAY = osystem.settings().getInt("mdouble"); _REPEAT_INITIAL_DELAY = osystem.settings().getInt("ctrldelay"); @@ -374,15 +368,12 @@ void DialogContainer::handleJoyHatEvent(int stick, int hat, JoyHatDir hdir, int // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DialogContainer::reset() { - myCurrentMouseDown.b = MouseButton::NONE; - myLastClick.x = myLastClick.y = 0; - myLastClick.time = 0; - myLastClick.count = 0; + myCurrentMouseDown = { 0, 0, MouseButton::NONE }; + myCurrentButtonDown = { -1, -1 }; + myCurrentAxisDown = { -1, JoyAxis::NONE, JoyDir::NONE }; + myCurrentHatDown = { -1, -1, JoyHatDir::CENTER }; - myCurrentButtonDown.stick = myCurrentButtonDown.button = -1; - myCurrentAxisDown.stick = -1; - myCurrentAxisDown.axis = JoyAxis::NONE; - myCurrentHatDown.stick = myCurrentHatDown.hat = -1; + myLastClick = { 0, 0, 0, 0 }; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/DialogContainer.hxx b/src/gui/DialogContainer.hxx index 3cc175edd..8ed4ced42 100644 --- a/src/gui/DialogContainer.hxx +++ b/src/gui/DialogContainer.hxx @@ -183,7 +183,7 @@ class DialogContainer private: // Indicates the most current time (in milliseconds) as set by updateTime() - uInt64 myTime; + uInt64 myTime{0}; static uInt64 _DOUBLE_CLICK_DELAY; static uInt64 _REPEAT_INITIAL_DELAY; @@ -193,41 +193,41 @@ class DialogContainer // For continuous 'mouse down' events struct { - int x; - int y; - MouseButton b; + int x{0}; + int y{0}; + MouseButton b{MouseButton::NONE}; } myCurrentMouseDown; - uInt64 myClickRepeatTime; + uInt64 myClickRepeatTime{0}; // For continuous 'joy button down' events struct { - int stick; - int button; + int stick{-1}; + int button{-1}; } myCurrentButtonDown; - uInt64 myButtonRepeatTime; - uInt64 myButtonLongPressTime; + uInt64 myButtonRepeatTime{0}; + uInt64 myButtonLongPressTime{0}; // For continuous 'joy axis down' events struct { - int stick; - JoyAxis axis; - JoyDir adir; + int stick{-1}; + JoyAxis axis{JoyAxis::NONE}; + JoyDir adir{JoyDir::NONE}; } myCurrentAxisDown; - uInt64 myAxisRepeatTime; + uInt64 myAxisRepeatTime{0}; // For continuous 'joy hat' events struct { - int stick; - int hat; - JoyHatDir hdir; + int stick{-1}; + int hat{-1}; + JoyHatDir hdir{JoyHatDir::CENTER}; } myCurrentHatDown; - uInt64 myHatRepeatTime; + uInt64 myHatRepeatTime{0}; // Position and time of last mouse click (used to detect double clicks) struct { - int x, y; // Position of mouse when the click occurred - int count; // How often was it already pressed? - uInt64 time; // Time + int x{0}, y{0}; // Position of mouse when the click occurred + int count{0}; // How often was it already pressed? + uInt64 time{0}; // Time } myLastClick; private: diff --git a/src/gui/EditTextWidget.cxx b/src/gui/EditTextWidget.cxx index acd9aecc5..f4a1ff165 100644 --- a/src/gui/EditTextWidget.cxx +++ b/src/gui/EditTextWidget.cxx @@ -24,8 +24,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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), - _changed(false) + : EditableWidget(boss, font, x, y, w, h + 2, text) { _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS; diff --git a/src/gui/EditTextWidget.hxx b/src/gui/EditTextWidget.hxx index 417e53a2c..e6d6b05fa 100644 --- a/src/gui/EditTextWidget.hxx +++ b/src/gui/EditTextWidget.hxx @@ -48,7 +48,7 @@ class EditTextWidget : public EditableWidget protected: string _backupString; - bool _changed; + bool _changed{false}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx index 6c4ce7e95..e3b4e6d3b 100644 --- a/src/gui/EditableWidget.cxx +++ b/src/gui/EditableWidget.cxx @@ -21,30 +21,23 @@ #include "Font.hxx" #include "EditableWidget.hxx" +// Uncomment the following to give full-line copy/paste +// Note that this will be removed eventually, when we implement proper copy/paste +//#define PSEUDO_COPY_PASTE + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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), - _editable(true), - _editString(str) + _editString(str), + _filter([](char c) { return isprint(c) && c != '\"'; }) { - _caretVisible = false; - _caretTime = 0; - _caretPos = 0; - - _caretInverse = false; - - _editScrollOffset = 0; - _bgcolor = kWidColor; _bgcolorhi = kWidColor; _bgcolorlo = kDlgColor; _textcolor = kTextColor; _textcolorhi = kTextColor; - - // By default, include all printable chars except quotes - _filter = [](char c) { return isprint(c) && c != '\"'; }; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -455,13 +448,17 @@ bool EditableWidget::moveWord(int direction) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EditableWidget::copySelectedText() { -// _clippedText = _editString; +#if defined(PSEUDO_COPY_PASTE) + _clippedText = _editString; +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void EditableWidget::pasteSelectedText() { -// _editString = _clippedText; +#if defined(PSEUDO_COPY_PASTE) + _editString = _clippedText; +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/EditableWidget.hxx b/src/gui/EditableWidget.hxx index cdebcb647..d616ddf6d 100644 --- a/src/gui/EditableWidget.hxx +++ b/src/gui/EditableWidget.hxx @@ -95,17 +95,17 @@ class EditableWidget : public Widget, public CommandSender bool tryInsertChar(char c, int pos); private: - bool _editable; + bool _editable{true}; string _editString; - bool _caretVisible; - int _caretTime; - int _caretPos; +// bool _caretVisible{false}; +// int _caretTime{0}; + int _caretPos{0}; protected: - bool _caretInverse; + bool _caretInverse{false}; - int _editScrollOffset; + int _editScrollOffset{0}; static string _clippedText; diff --git a/src/gui/EventMappingWidget.cxx b/src/gui/EventMappingWidget.cxx index c21f48f5b..fcb7e3321 100644 --- a/src/gui/EventMappingWidget.cxx +++ b/src/gui/EventMappingWidget.cxx @@ -40,21 +40,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font, EventMode mode) : Widget(boss, font, x, y, w, h), CommandSender(boss), - myFilterPopup(nullptr), - myComboDialog(nullptr), - myEventMode(mode), - myEventGroup(Event::Group::Emulation), - myActionSelected(-1), - myRemapStatus(false), - myLastStick(0), - myLastHat(0), - myLastAxis(JoyAxis::NONE), - myLastDir(JoyDir::NONE), - myLastHatDir(JoyHatDir::CENTER), - myMod(0), - myLastKey(0), - myLastButton(JOY_CTRL_NONE), - myFirstTime(true) + myEventMode(mode) { const int fontHeight = font.getFontHeight(), lineHeight = font.getLineHeight(), @@ -139,8 +125,6 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font, VariantList combolist = instance().eventHandler().getComboList(mode); myComboDialog = new ComboDialog(boss, font, combolist); } - else - myComboButton = nullptr; // Show message for currently selected event xpos = HBORDER; diff --git a/src/gui/EventMappingWidget.hxx b/src/gui/EventMappingWidget.hxx index c199cbd53..d0cd8c228 100644 --- a/src/gui/EventMappingWidget.hxx +++ b/src/gui/EventMappingWidget.hxx @@ -81,49 +81,49 @@ class EventMappingWidget : public Widget, public CommandSender void enableButtons(bool state); private: - ButtonWidget* myMapButton; - ButtonWidget* myCancelMapButton; - ButtonWidget* myEraseButton; - ButtonWidget* myResetButton; - ButtonWidget* myComboButton; - PopUpWidget* myFilterPopup; - StringListWidget* myActionsList; - EditTextWidget* myKeyMapping; + ButtonWidget* myMapButton{nullptr}; + ButtonWidget* myCancelMapButton{nullptr}; + ButtonWidget* myEraseButton{nullptr}; + ButtonWidget* myResetButton{nullptr}; + ButtonWidget* myComboButton{nullptr}; + PopUpWidget* myFilterPopup{nullptr}; + StringListWidget* myActionsList{nullptr}; + EditTextWidget* myKeyMapping{nullptr}; - ComboDialog* myComboDialog; + ComboDialog* myComboDialog{nullptr}; // Since this widget can be used for different collections of events, // we need to specify exactly which group of events we are remapping - EventMode myEventMode; + EventMode myEventMode{EventMode::kEmulationMode}; // Since we can filter events, the event mode is not specific enough - Event::Group myEventGroup; + Event::Group myEventGroup{Event::Group::Emulation}; // Indicates the event that is currently selected - int myActionSelected; + int myActionSelected{-1}; // Indicates if we're currently in remap mode // In this mode, the next event received is remapped to some action - bool myRemapStatus; + bool myRemapStatus{false}; // Joystick axes and hats can be more problematic than ordinary buttons // or keys, in that there can be 'drift' in the values // Therefore, we map these events when they've been 'released', rather // than on their first occurrence (aka, when they're 'pressed') // As a result, we need to keep track of their old values - int myLastStick, myLastHat; - JoyAxis myLastAxis; - JoyDir myLastDir; - JoyHatDir myLastHatDir; + int myLastStick{0}, myLastHat{0}; + JoyAxis myLastAxis{JoyAxis::NONE}; + JoyDir myLastDir{JoyDir::NONE}; + JoyHatDir myLastHatDir{JoyHatDir::CENTER}; // Aggregates the modifier flags of the mapping - int myMod; + int myMod{0}; // Saves the last *pressed* key - int myLastKey; + int myLastKey{0}; // Saves the last *pressed* button - int myLastButton; + int myLastButton{JOY_CTRL_NONE}; - bool myFirstTime; + bool myFirstTime{true}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/FileListWidget.cxx b/src/gui/FileListWidget.cxx index a49b77939..954f7c9ca 100644 --- a/src/gui/FileListWidget.cxx +++ b/src/gui/FileListWidget.cxx @@ -27,15 +27,10 @@ FileListWidget::FileListWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h) : StringListWidget(boss, font, x, y, w, h), - _fsmode(FilesystemNode::ListMode::All), - _selected(0), - _quickSelectTime(0) + _filter([](const FilesystemNode& node) { return true; }) { // This widget is special, in that it catches signals and redirects them setTarget(this); - - // By default, all filenames are valid - _filter = [](const FilesystemNode& node) { return true; }; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/FileListWidget.hxx b/src/gui/FileListWidget.hxx index 6aebefa0c..bf6f9e13f 100644 --- a/src/gui/FileListWidget.hxx +++ b/src/gui/FileListWidget.hxx @@ -92,16 +92,16 @@ class FileListWidget : public StringListWidget void handleCommand(CommandSender* sender, int cmd, int data, int id) override; private: - FilesystemNode::ListMode _fsmode; + FilesystemNode::ListMode _fsmode{FilesystemNode::ListMode::All}; FilesystemNode::NameFilter _filter; FilesystemNode _node; FSList _fileList; Common::FixedStack _history; - uInt32 _selected; + uInt32 _selected{0}; string _quickSelectStr; - uInt64 _quickSelectTime; + uInt64 _quickSelectTime{0}; static uInt64 _QUICK_SELECT_DELAY; private: diff --git a/src/gui/GameInfoDialog.hxx b/src/gui/GameInfoDialog.hxx index a12c387e8..fd81339c7 100644 --- a/src/gui/GameInfoDialog.hxx +++ b/src/gui/GameInfoDialog.hxx @@ -58,49 +58,49 @@ class GameInfoDialog : public Dialog, public CommandSender void eraseEEPROM(); private: - TabWidget* myTab; + TabWidget* myTab{nullptr}; // Emulation properties - PopUpWidget* myBSType; - StaticTextWidget* myTypeDetected; - StaticTextWidget* myStartBankLabel; - PopUpWidget* myStartBank; - PopUpWidget* myFormat; - StaticTextWidget* myFormatDetected; - SliderWidget* myVCenter; - CheckboxWidget* myPhosphor; - SliderWidget* myPPBlend; - CheckboxWidget* mySound; + PopUpWidget* myBSType{nullptr}; + StaticTextWidget* myTypeDetected{nullptr}; + StaticTextWidget* myStartBankLabel{nullptr}; + PopUpWidget* myStartBank{nullptr}; + PopUpWidget* myFormat{nullptr}; + StaticTextWidget* myFormatDetected{nullptr}; + SliderWidget* myVCenter{nullptr}; + CheckboxWidget* myPhosphor{nullptr}; + SliderWidget* myPPBlend{nullptr}; + CheckboxWidget* mySound{nullptr}; // Console properties - RadioButtonGroup* myLeftDiffGroup; - RadioButtonGroup* myRightDiffGroup; - RadioButtonGroup* myTVTypeGroup; + RadioButtonGroup* myLeftDiffGroup{nullptr}; + RadioButtonGroup* myRightDiffGroup{nullptr}; + RadioButtonGroup* myTVTypeGroup{nullptr}; // Controller properties - StaticTextWidget* myLeftPortLabel; - StaticTextWidget* myRightPortLabel; - PopUpWidget* myLeftPort; - StaticTextWidget* myLeftPortDetected; - PopUpWidget* myRightPort; - StaticTextWidget* myRightPortDetected; - CheckboxWidget* mySwapPorts; - CheckboxWidget* mySwapPaddles; - StaticTextWidget* myEraseEEPROMLabel; - ButtonWidget* myEraseEEPROMButton; - StaticTextWidget* myEraseEEPROMInfo; - CheckboxWidget* myMouseControl; - PopUpWidget* myMouseX; - PopUpWidget* myMouseY; - SliderWidget* myMouseRange; + StaticTextWidget* myLeftPortLabel{nullptr}; + StaticTextWidget* myRightPortLabel{nullptr}; + PopUpWidget* myLeftPort{nullptr}; + StaticTextWidget* myLeftPortDetected{nullptr}; + PopUpWidget* myRightPort{nullptr}; + StaticTextWidget* myRightPortDetected{nullptr}; + CheckboxWidget* mySwapPorts{nullptr}; + CheckboxWidget* mySwapPaddles{nullptr}; + StaticTextWidget* myEraseEEPROMLabel{nullptr}; + ButtonWidget* myEraseEEPROMButton{nullptr}; + StaticTextWidget* myEraseEEPROMInfo{nullptr}; + CheckboxWidget* myMouseControl{nullptr}; + PopUpWidget* myMouseX{nullptr}; + PopUpWidget* myMouseY{nullptr}; + SliderWidget* myMouseRange{nullptr}; // Cartridge properties - EditTextWidget* myName; - EditTextWidget* myMD5; - EditTextWidget* myManufacturer; - EditTextWidget* myModelNo; - EditTextWidget* myRarity; - EditTextWidget* myNote; + EditTextWidget* myName{nullptr}; + EditTextWidget* myMD5{nullptr}; + EditTextWidget* myManufacturer{nullptr}; + EditTextWidget* myModelNo{nullptr}; + EditTextWidget* myRarity{nullptr}; + EditTextWidget* myNote{nullptr}; enum { kVCenterChanged = 'Vcch', diff --git a/src/gui/GlobalPropsDialog.hxx b/src/gui/GlobalPropsDialog.hxx index cb3e5b833..0b2bd0400 100644 --- a/src/gui/GlobalPropsDialog.hxx +++ b/src/gui/GlobalPropsDialog.hxx @@ -48,15 +48,15 @@ class GlobalPropsDialog : public Dialog, public CommandSender kJ1Up, kJ1Down, kJ1Left, kJ1Right, kJ1Fire }; - PopUpWidget* myBSType; - PopUpWidget* myLeftDiff; - PopUpWidget* myRightDiff; - PopUpWidget* myTVType; - PopUpWidget* myDebug; + PopUpWidget* myBSType{nullptr}; + PopUpWidget* myLeftDiff{nullptr}; + PopUpWidget* myRightDiff{nullptr}; + PopUpWidget* myTVType{nullptr}; + PopUpWidget* myDebug{nullptr}; - std::array myJoy; - CheckboxWidget* myHoldSelect; - CheckboxWidget* myHoldReset; + std::array myJoy{nullptr}; + CheckboxWidget* myHoldSelect{nullptr}; + CheckboxWidget* myHoldReset{nullptr}; static const std::array ourJoyState; diff --git a/src/gui/GuiObject.hxx b/src/gui/GuiObject.hxx index 0072e1c18..3521c7b8a 100644 --- a/src/gui/GuiObject.hxx +++ b/src/gui/GuiObject.hxx @@ -59,8 +59,7 @@ class GuiObject : public CommandReceiver : myOSystem(osystem), myParent(parent), myDialog(dialog), - _x(x), _y(y), _w(w), _h(h), - _firstWidget(nullptr) { } + _x(x), _y(y), _w(w), _h(h) { } virtual ~GuiObject() = default; @@ -104,9 +103,9 @@ class GuiObject : public CommandReceiver Dialog& myDialog; protected: - int _x, _y, _w, _h; + int _x{0}, _y{0}, _w{0}, _h{0}; - Widget* _firstWidget; + Widget* _firstWidget{nullptr}; WidgetArray _focusList; private: diff --git a/src/gui/HelpDialog.cxx b/src/gui/HelpDialog.cxx index b03700040..d0b714b89 100644 --- a/src/gui/HelpDialog.cxx +++ b/src/gui/HelpDialog.cxx @@ -26,9 +26,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - HelpDialog::HelpDialog(OSystem& osystem, DialogContainer& parent, const GUI::Font& font) - : Dialog(osystem, parent, font, "Help"), - myPage(1), - myNumPages(5) + : Dialog(osystem, parent, font, "Help") { const int lineHeight = font.getLineHeight(), fontWidth = font.getMaxCharWidth(), diff --git a/src/gui/HelpDialog.hxx b/src/gui/HelpDialog.hxx index a8f4ff7d3..52fb2a97e 100644 --- a/src/gui/HelpDialog.hxx +++ b/src/gui/HelpDialog.hxx @@ -41,17 +41,17 @@ class HelpDialog : public Dialog private: static constexpr uInt32 LINES_PER_PAGE = 10; - ButtonWidget* myNextButton; - ButtonWidget* myPrevButton; + ButtonWidget* myNextButton{nullptr}; + ButtonWidget* myPrevButton{nullptr}; StaticTextWidget* myTitle; - std::array myKey; - std::array myDesc; + std::array myKey{nullptr}; + std::array myDesc{nullptr}; std::array myKeyStr; std::array myDescStr; - uInt8 myPage; - uInt8 myNumPages; + uInt8 myPage{1}; + uInt8 myNumPages{5}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/InputDialog.cxx b/src/gui/InputDialog.cxx index 476633e98..63667e660 100644 --- a/src/gui/InputDialog.cxx +++ b/src/gui/InputDialog.cxx @@ -39,7 +39,6 @@ InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent, const GUI::Font& font, int max_w, int max_h) : Dialog(osystem, parent, font, "Input settings"), - myConfirmMsg(nullptr), myMaxWidth(max_w), myMaxHeight(max_h) { diff --git a/src/gui/InputDialog.hxx b/src/gui/InputDialog.hxx index 33431b267..8f2b891a6 100644 --- a/src/gui/InputDialog.hxx +++ b/src/gui/InputDialog.hxx @@ -76,34 +76,34 @@ class InputDialog : public Dialog kConfirmEEEraseCmd = 'EEcf' }; - TabWidget* myTab; + TabWidget* myTab{nullptr}; - EventMappingWidget* myEmulEventMapper; - EventMappingWidget* myMenuEventMapper; + EventMappingWidget* myEmulEventMapper{nullptr}; + EventMappingWidget* myMenuEventMapper{nullptr}; - CheckboxWidget* mySAPort; - PopUpWidget* myMouseControl; - PopUpWidget* myCursorState; + CheckboxWidget* mySAPort{nullptr}; + PopUpWidget* myMouseControl{nullptr}; + PopUpWidget* myCursorState{nullptr}; - EditTextWidget* myAVoxPort; + EditTextWidget* myAVoxPort{nullptr}; - SliderWidget* myDeadzone; - StaticTextWidget* myDeadzoneLabel; - SliderWidget* myDejitterBase; - SliderWidget* myDejitterDiff; - SliderWidget* myDPaddleSpeed; - SliderWidget* myMPaddleSpeed; - SliderWidget* myTrackBallSpeed; - StaticTextWidget* myDejitterLabel; - StaticTextWidget* myDPaddleLabel; - StaticTextWidget* myMPaddleLabel; - StaticTextWidget* myTrackBallLabel; - CheckboxWidget* myAllowAll4; - CheckboxWidget* myGrabMouse; - CheckboxWidget* myModCombo; + SliderWidget* myDeadzone{nullptr}; + StaticTextWidget* myDeadzoneLabel{nullptr}; + SliderWidget* myDejitterBase{nullptr}; + SliderWidget* myDejitterDiff{nullptr}; + SliderWidget* myDPaddleSpeed{nullptr}; + SliderWidget* myMPaddleSpeed{nullptr}; + SliderWidget* myTrackBallSpeed{nullptr}; + StaticTextWidget* myDejitterLabel{nullptr}; + StaticTextWidget* myDPaddleLabel{nullptr}; + StaticTextWidget* myMPaddleLabel{nullptr}; + StaticTextWidget* myTrackBallLabel{nullptr}; + CheckboxWidget* myAllowAll4{nullptr}; + CheckboxWidget* myGrabMouse{nullptr}; + CheckboxWidget* myModCombo{nullptr}; - ButtonWidget* myJoyDlgButton; - ButtonWidget* myEraseEEPROMButton; + ButtonWidget* myJoyDlgButton{nullptr}; + ButtonWidget* myEraseEEPROMButton{nullptr}; // Show the list of joysticks that the eventhandler knows about unique_ptr myJoyDialog; @@ -112,7 +112,7 @@ class InputDialog : public Dialog unique_ptr myConfirmMsg; // Maximum width and height for this dialog - int myMaxWidth, myMaxHeight; + int myMaxWidth{0}, myMaxHeight{0}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/InputTextDialog.cxx b/src/gui/InputTextDialog.cxx index 1ed10a81e..275508b4d 100644 --- a/src/gui/InputTextDialog.cxx +++ b/src/gui/InputTextDialog.cxx @@ -31,11 +31,7 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font, const StringList& labels, const string& title) : Dialog(boss->instance(), boss->parent(), font, title), - CommandSender(boss), - myEnableCenter(false), - myErrorFlag(false), - myXOrig(0), - myYOrig(0) + CommandSender(boss) { initialize(font, font, labels); } diff --git a/src/gui/InputTextDialog.hxx b/src/gui/InputTextDialog.hxx index 6b8ef2eac..79aee65a8 100644 --- a/src/gui/InputTextDialog.hxx +++ b/src/gui/InputTextDialog.hxx @@ -61,13 +61,13 @@ class InputTextDialog : public Dialog, public CommandSender private: vector myInput; - StaticTextWidget* myMessage; + StaticTextWidget* myMessage{nullptr}; - bool myEnableCenter; - bool myErrorFlag; - int myCmd; + bool myEnableCenter{false}; + bool myErrorFlag{false}; + int myCmd{0}; - uInt32 myXOrig, myYOrig; + uInt32 myXOrig{0}, myYOrig{0}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/JoystickDialog.hxx b/src/gui/JoystickDialog.hxx index 6b0cb5615..5941ce4f6 100644 --- a/src/gui/JoystickDialog.hxx +++ b/src/gui/JoystickDialog.hxx @@ -45,11 +45,11 @@ class JoystickDialog : public Dialog void handleCommand(CommandSender* sender, int cmd, int data, int id) override; private: - StringListWidget* myJoyList; - EditTextWidget* myJoyText; + StringListWidget* myJoyList{nullptr}; + EditTextWidget* myJoyText{nullptr}; - ButtonWidget* myRemoveBtn; - ButtonWidget* myCloseBtn; + ButtonWidget* myRemoveBtn{nullptr}; + ButtonWidget* myCloseBtn{nullptr}; IntArray myJoyIDs; diff --git a/src/gui/Launcher.cxx b/src/gui/Launcher.cxx index 1ee2c895a..bec26916e 100644 --- a/src/gui/Launcher.cxx +++ b/src/gui/Launcher.cxx @@ -27,8 +27,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Launcher::Launcher(OSystem& osystem) - : DialogContainer(osystem), - myBaseDialog(nullptr) + : DialogContainer(osystem) { const Common::Size& s = myOSystem.settings().getSize("launcherres"); const Common::Size& d = myOSystem.frameBuffer().desktopSize(); diff --git a/src/gui/Launcher.hxx b/src/gui/Launcher.hxx index 537ff61ef..45b51f2b2 100644 --- a/src/gui/Launcher.hxx +++ b/src/gui/Launcher.hxx @@ -70,11 +70,11 @@ class Launcher : public DialogContainer Dialog* baseDialog() override; private: - Dialog* myBaseDialog; + Dialog* myBaseDialog{nullptr}; // The width and height of this dialog - uInt32 myWidth; - uInt32 myHeight; + uInt32 myWidth{0}; + uInt32 myHeight{0}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index 1b8b3795b..5a9435c99 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -46,17 +46,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent, int x, int y, int w, int h) - : Dialog(osystem, parent, x, y, w, h), - myStartButton(nullptr), - myPrevDirButton(nullptr), - myOptionsButton(nullptr), - myQuitButton(nullptr), - myList(nullptr), - myPattern(nullptr), - myAllFiles(nullptr), - myRomInfoWidget(nullptr), - mySelectedItem(0), - myEventHandled(false) + : Dialog(osystem, parent, x, y, w, h) { myUseMinimalUI = instance().settings().getBool("minimal_ui"); diff --git a/src/gui/LauncherDialog.hxx b/src/gui/LauncherDialog.hxx index fa1a6a0d2..8633f0831 100644 --- a/src/gui/LauncherDialog.hxx +++ b/src/gui/LauncherDialog.hxx @@ -111,26 +111,26 @@ class LauncherDialog : public Dialog unique_ptr myGlobalProps; unique_ptr myRomDir; - ButtonWidget* myStartButton; - ButtonWidget* myPrevDirButton; - ButtonWidget* myOptionsButton; - ButtonWidget* myQuitButton; + ButtonWidget* myStartButton{nullptr}; + ButtonWidget* myPrevDirButton{nullptr}; + ButtonWidget* myOptionsButton{nullptr}; + ButtonWidget* myQuitButton{nullptr}; - FileListWidget* myList; - StaticTextWidget* myDirLabel; - EditTextWidget* myDir; - StaticTextWidget* myRomCount; - EditTextWidget* myPattern; - CheckboxWidget* myAllFiles; + FileListWidget* myList{nullptr}; + StaticTextWidget* myDirLabel{nullptr}; + EditTextWidget* myDir{nullptr}; + StaticTextWidget* myRomCount{nullptr}; + EditTextWidget* myPattern{nullptr}; + CheckboxWidget* myAllFiles{nullptr}; - RomInfoWidget* myRomInfoWidget; + RomInfoWidget* myRomInfoWidget{nullptr}; std::unordered_map myMD5List; - int mySelectedItem; + int mySelectedItem{0}; - bool myShowOnlyROMs; - bool myUseMinimalUI; - bool myEventHandled; + bool myShowOnlyROMs{false}; + bool myUseMinimalUI{false}; + bool myEventHandled{false}; enum { kAllfilesCmd = 'lalf', // show all files (or ROMs only) diff --git a/src/gui/ListWidget.cxx b/src/gui/ListWidget.cxx index a798ec284..de9a45d61 100644 --- a/src/gui/ListWidget.cxx +++ b/src/gui/ListWidget.cxx @@ -27,13 +27,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ListWidget::ListWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h) - : EditableWidget(boss, font, x, y, 16, 16), - _rows(0), - _cols(0), - _currentPos(0), - _selectedItem(-1), - _highlightedItem(-1), - _editMode(false) + : EditableWidget(boss, font, x, y, 16, 16) { _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS; _bgcolor = kWidColor; diff --git a/src/gui/ListWidget.hxx b/src/gui/ListWidget.hxx index 88ce7f646..bec316fca 100644 --- a/src/gui/ListWidget.hxx +++ b/src/gui/ListWidget.hxx @@ -94,14 +94,14 @@ class ListWidget : public EditableWidget void scrollToCurrent(int item); protected: - int _rows; - int _cols; - int _currentPos; - int _selectedItem; - int _highlightedItem; - bool _editMode; + int _rows{0}; + int _cols{0}; + int _currentPos{0}; + int _selectedItem{-1}; + int _highlightedItem{-1}; + bool _editMode{false}; - ScrollBarWidget* _scrollBar; + ScrollBarWidget* _scrollBar{nullptr}; StringList _list; diff --git a/src/gui/LoggerDialog.cxx b/src/gui/LoggerDialog.cxx index 624174238..672de8456 100644 --- a/src/gui/LoggerDialog.cxx +++ b/src/gui/LoggerDialog.cxx @@ -34,8 +34,7 @@ LoggerDialog::LoggerDialog(OSystem& osystem, DialogContainer& parent, const GUI::Font& font, int max_w, int max_h, bool uselargefont) - : Dialog(osystem, parent, font, "System logs"), - myLogInfo(nullptr) + : Dialog(osystem, parent, font, "System logs") { const int lineHeight = font.getLineHeight(), buttonWidth = font.getStringWidth("Save log to disk") + 20, diff --git a/src/gui/LoggerDialog.hxx b/src/gui/LoggerDialog.hxx index c4b814619..56fbe96b1 100644 --- a/src/gui/LoggerDialog.hxx +++ b/src/gui/LoggerDialog.hxx @@ -42,9 +42,9 @@ class LoggerDialog : public Dialog void handleCommand(CommandSender* sender, int cmd, int data, int id) override; private: - StringListWidget* myLogInfo; - PopUpWidget* myLogLevel; - CheckboxWidget* myLogToConsole; + StringListWidget* myLogInfo{nullptr}; + PopUpWidget* myLogLevel{nullptr}; + CheckboxWidget* myLogToConsole{nullptr}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/Menu.cxx b/src/gui/Menu.cxx index f50fd5200..88e47d05f 100644 --- a/src/gui/Menu.cxx +++ b/src/gui/Menu.cxx @@ -25,9 +25,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Menu::Menu(OSystem& osystem) - : DialogContainer(osystem), - stellaSettingDialog(nullptr), - optionsDialog(nullptr) + : DialogContainer(osystem) { } diff --git a/src/gui/Menu.hxx b/src/gui/Menu.hxx index cc9da0daa..95e8d0370 100644 --- a/src/gui/Menu.hxx +++ b/src/gui/Menu.hxx @@ -43,8 +43,8 @@ class Menu : public DialogContainer private: Dialog* baseDialog() override; - StellaSettingsDialog* stellaSettingDialog; - OptionsDialog* optionsDialog; + StellaSettingsDialog* stellaSettingDialog{nullptr}; + OptionsDialog* optionsDialog{nullptr}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/MessageBox.hxx b/src/gui/MessageBox.hxx index a0aa0a2be..7b97afd52 100644 --- a/src/gui/MessageBox.hxx +++ b/src/gui/MessageBox.hxx @@ -54,7 +54,7 @@ class MessageBox : public Dialog, public CommandSender void handleCommand(CommandSender* sender, int cmd, int data, int id) override; private: - int myCmd; + int myCmd{0}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/MinUICommandDialog.cxx b/src/gui/MinUICommandDialog.cxx index 8b31d26c2..7713b98b6 100644 --- a/src/gui/MinUICommandDialog.cxx +++ b/src/gui/MinUICommandDialog.cxx @@ -33,9 +33,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MinUICommandDialog::MinUICommandDialog(OSystem& osystem, DialogContainer& parent) - : Dialog(osystem, parent, osystem.frameBuffer().font(), "Commands"), - myStellaSettingsDialog(nullptr), - myOptionsDialog(nullptr) + : Dialog(osystem, parent, osystem.frameBuffer().font(), "Commands") { const int HBORDER = 10; const int VBORDER = 10; diff --git a/src/gui/MinUICommandDialog.hxx b/src/gui/MinUICommandDialog.hxx index 7b997f239..6afe2836e 100644 --- a/src/gui/MinUICommandDialog.hxx +++ b/src/gui/MinUICommandDialog.hxx @@ -44,19 +44,19 @@ class MinUICommandDialog : public Dialog void processCancel() override; // column 0 - ButtonWidget* myColorButton; - ButtonWidget* myLeftDiffButton; - ButtonWidget* myRightDiffButton; + ButtonWidget* myColorButton{nullptr}; + ButtonWidget* myLeftDiffButton{nullptr}; + ButtonWidget* myRightDiffButton{nullptr}; // column 1 - ButtonWidget* mySaveStateButton; - ButtonWidget* myStateSlotButton; - ButtonWidget* myLoadStateButton; - ButtonWidget* myRewindButton; - ButtonWidget* myUnwindButton; + ButtonWidget* mySaveStateButton{nullptr}; + ButtonWidget* myStateSlotButton{nullptr}; + ButtonWidget* myLoadStateButton{nullptr}; + ButtonWidget* myRewindButton{nullptr}; + ButtonWidget* myUnwindButton{nullptr}; // column 2 - ButtonWidget* myTVFormatButton; - ButtonWidget* myStretchButton; - ButtonWidget* myPhosphorButton; + ButtonWidget* myTVFormatButton{nullptr}; + ButtonWidget* myStretchButton{nullptr}; + ButtonWidget* myPhosphorButton{nullptr}; unique_ptr myStellaSettingsDialog; unique_ptr myOptionsDialog; diff --git a/src/gui/OptionsDialog.hxx b/src/gui/OptionsDialog.hxx index 3f91ecc79..b569e9b87 100644 --- a/src/gui/OptionsDialog.hxx +++ b/src/gui/OptionsDialog.hxx @@ -67,12 +67,12 @@ class OptionsDialog : public Dialog unique_ptr myHelpDialog; unique_ptr myAboutDialog; - ButtonWidget* myRomAuditButton; - ButtonWidget* myGameInfoButton; - ButtonWidget* myCheatCodeButton; + ButtonWidget* myRomAuditButton{nullptr}; + ButtonWidget* myGameInfoButton{nullptr}; + ButtonWidget* myCheatCodeButton{nullptr}; // Indicates if this dialog is used for global (vs. in-game) settings - Menu::AppMode myMode; + Menu::AppMode myMode{Menu::AppMode::emulator}; enum { kBasSetCmd = 'BAST', diff --git a/src/gui/PopUpWidget.cxx b/src/gui/PopUpWidget.cxx index afbed7cb0..fd1746d9d 100644 --- a/src/gui/PopUpWidget.cxx +++ b/src/gui/PopUpWidget.cxx @@ -30,8 +30,7 @@ PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font, : Widget(boss, font, x, y - 1, w, h + 2), CommandSender(boss), _label(label), - _labelWidth(labelWidth), - _changed(false) + _labelWidth(labelWidth) { _flags = Widget::FLAG_ENABLED | Widget::FLAG_RETAIN_FOCUS; _bgcolor = kDlgColor; diff --git a/src/gui/PopUpWidget.hxx b/src/gui/PopUpWidget.hxx index df17338d0..f0d464dec 100644 --- a/src/gui/PopUpWidget.hxx +++ b/src/gui/PopUpWidget.hxx @@ -72,12 +72,12 @@ class PopUpWidget : public Widget, public CommandSender private: unique_ptr myMenu; - int myArrowsY; - int myTextY; + int myArrowsY{0}; + int myTextY{0}; string _label; - int _labelWidth; - bool _changed; + int _labelWidth{0}; + bool _changed{false}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/ProgressDialog.cxx b/src/gui/ProgressDialog.cxx index d7e9f21de..3ebaf2b37 100644 --- a/src/gui/ProgressDialog.cxx +++ b/src/gui/ProgressDialog.cxx @@ -27,12 +27,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ProgressDialog::ProgressDialog(GuiObject* boss, const GUI::Font& font, const string& message) - : Dialog(boss->instance(), boss->parent()), - myMessage(nullptr), - mySlider(nullptr), - myStart(0), - myFinish(0), - myStep(0) + : Dialog(boss->instance(), boss->parent()) { const int fontWidth = font.getMaxCharWidth(), fontHeight = font.getFontHeight(), diff --git a/src/gui/ProgressDialog.hxx b/src/gui/ProgressDialog.hxx index a240dbf83..110f5758a 100644 --- a/src/gui/ProgressDialog.hxx +++ b/src/gui/ProgressDialog.hxx @@ -36,10 +36,10 @@ class ProgressDialog : public Dialog void setProgress(int progress); private: - StaticTextWidget* myMessage; - SliderWidget* mySlider; + StaticTextWidget* myMessage{nullptr}; + SliderWidget* mySlider{nullptr}; - int myStart, myFinish, myStep; + int myStart{0}, myFinish{0}, myStep{0}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/R77HelpDialog.cxx b/src/gui/R77HelpDialog.cxx index 9223e075b..1cf8345f6 100644 --- a/src/gui/R77HelpDialog.cxx +++ b/src/gui/R77HelpDialog.cxx @@ -24,10 +24,8 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - R77HelpDialog::R77HelpDialog(OSystem& osystem, DialogContainer& parent, - const GUI::Font& font) - : Dialog(osystem, parent, font, "RetroN 77 help"), - myPage(1), - myNumPages(4) + const GUI::Font& font) + : Dialog(osystem, parent, font, "RetroN 77 help") { const int lineHeight = font.getLineHeight(), fontWidth = font.getMaxCharWidth(), diff --git a/src/gui/R77HelpDialog.hxx b/src/gui/R77HelpDialog.hxx index 40789039f..3519e32ee 100644 --- a/src/gui/R77HelpDialog.hxx +++ b/src/gui/R77HelpDialog.hxx @@ -42,19 +42,19 @@ class R77HelpDialog : public Dialog private: static constexpr uInt32 LINES_PER_PAGE = 11; - ButtonWidget* myNextButton; - ButtonWidget* myPrevButton; + ButtonWidget* myNextButton{nullptr}; + ButtonWidget* myPrevButton{nullptr}; - StaticTextWidget* myTitle; - std::array myJoy; - std::array myBtn; - std::array myDesc; + StaticTextWidget* myTitle{nullptr}; + std::array myJoy{nullptr}; + std::array myBtn{nullptr}; + std::array myDesc{nullptr}; std::array myJoyStr; std::array myBtnStr; std::array myDescStr; - uInt8 myPage; - uInt8 myNumPages; + uInt8 myPage{1}; + uInt8 myNumPages{4}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/RadioButtonWidget.cxx b/src/gui/RadioButtonWidget.cxx index 65ea729a9..f86adf148 100644 --- a/src/gui/RadioButtonWidget.cxx +++ b/src/gui/RadioButtonWidget.cxx @@ -46,8 +46,7 @@ static constexpr std::array radio_img_inactive = { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RadioButtonWidget::RadioButtonWidget(GuiObject* boss, const GUI::Font& font, int x, int y, const string& label, - RadioButtonGroup* group, - int cmd) + RadioButtonGroup* group, int cmd) : CheckboxWidget(boss, font, x, y, label, cmd), myGroup(group) { @@ -62,7 +61,6 @@ RadioButtonWidget::RadioButtonWidget(GuiObject* boss, const GUI::Font& font, _w = font.getStringWidth(label) + 20; _h = font.getFontHeight() < 14 ? 14 : font.getFontHeight(); - // Depending on font size, either the font or box will need to be // centered vertically if(_h > 14) // center box diff --git a/src/gui/RadioButtonWidget.hxx b/src/gui/RadioButtonWidget.hxx index 462d42692..838ac5557 100644 --- a/src/gui/RadioButtonWidget.hxx +++ b/src/gui/RadioButtonWidget.hxx @@ -42,7 +42,7 @@ class RadioButtonWidget : public CheckboxWidget void drawWidget(bool hilite) override; private: - RadioButtonGroup* myGroup; + RadioButtonGroup* myGroup{nullptr}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/RomAuditDialog.hxx b/src/gui/RomAuditDialog.hxx index fbd82e693..8db60fe7b 100644 --- a/src/gui/RomAuditDialog.hxx +++ b/src/gui/RomAuditDialog.hxx @@ -57,17 +57,17 @@ class RomAuditDialog : public Dialog const GUI::Font& myFont; // ROM audit path - EditTextWidget* myRomPath; + EditTextWidget* myRomPath{nullptr}; // Show the results of the ROM audit - EditTextWidget* myResults1; - EditTextWidget* myResults2; + EditTextWidget* myResults1{nullptr}; + EditTextWidget* myResults2{nullptr}; // Show a message about the dangers of using this function unique_ptr myConfirmMsg; // Maximum width and height for this dialog - int myMaxWidth, myMaxHeight; + int myMaxWidth{0}, myMaxHeight{0}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/RomInfoWidget.cxx b/src/gui/RomInfoWidget.cxx index c6914dc57..08e2eb926 100644 --- a/src/gui/RomInfoWidget.cxx +++ b/src/gui/RomInfoWidget.cxx @@ -36,8 +36,6 @@ RomInfoWidget::RomInfoWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h) : Widget(boss, font, x, y, w, h), - mySurfaceIsValid(false), - myHaveProperties(false), myAvail(w > 400 ? Common::Size(TIAConstants::viewableWidth*2, TIAConstants::viewableHeight*2) : Common::Size(TIAConstants::viewableWidth, TIAConstants::viewableHeight)) diff --git a/src/gui/RomInfoWidget.hxx b/src/gui/RomInfoWidget.hxx index ff893266f..608724f40 100644 --- a/src/gui/RomInfoWidget.hxx +++ b/src/gui/RomInfoWidget.hxx @@ -49,7 +49,7 @@ class RomInfoWidget : public Widget shared_ptr mySurface; // Whether the surface should be redrawn by drawWidget() - bool mySurfaceIsValid; + bool mySurfaceIsValid{false}; // Some ROM properties info, as well as 'tEXt' chunks from the PNG image StringList myRomInfo; @@ -58,7 +58,7 @@ class RomInfoWidget : public Widget Properties myProperties; // Indicates if the current properties should actually be used - bool myHaveProperties; + bool myHaveProperties{false}; // Indicates if an error occurred in creating/displaying the surface string mySurfaceErrorMsg; diff --git a/src/gui/ScrollBarWidget.cxx b/src/gui/ScrollBarWidget.cxx index 0fcf10946..02ad1acb3 100644 --- a/src/gui/ScrollBarWidget.cxx +++ b/src/gui/ScrollBarWidget.cxx @@ -33,16 +33,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ScrollBarWidget::ScrollBarWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h) - : Widget(boss, font, x, y, w, h), CommandSender(boss), - _numEntries(0), - _entriesPerPage(0), - _currentPos(0), - _wheel_lines(0), - _part(kNoPart), - _draggingPart(kNoPart), - _sliderHeight(0), - _sliderPos(0), - _sliderDeltaMouseDownPos(0) + : Widget(boss, font, x, y, w, h), CommandSender(boss) { _flags = Widget::FLAG_ENABLED | Widget::FLAG_TRACK_MOUSE | Widget::FLAG_CLEARBG; _bgcolor = kWidColor; @@ -54,7 +45,7 @@ void ScrollBarWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount) { // Ignore subsequent mouse clicks when the slider is being moved - if(_draggingPart == kSliderPart) + if(_draggingPart == Part::Slider) return; int old_pos = _currentPos; @@ -67,13 +58,13 @@ void ScrollBarWidget::handleMouseDown(int x, int y, MouseButton b, { // Up arrow _currentPos--; - _draggingPart = kUpArrowPart; + _draggingPart = Part::UpArrow; } else if(y >= _h - UP_DOWN_BOX_HEIGHT) { // Down arrow _currentPos++; - _draggingPart = kDownArrowPart; + _draggingPart = Part::DownArrow; } else if(y < _sliderPos) { @@ -85,7 +76,7 @@ void ScrollBarWidget::handleMouseDown(int x, int y, MouseButton b, } else { - _draggingPart = kSliderPart; + _draggingPart = Part::Slider; _sliderDeltaMouseDownPos = y - _sliderPos; } @@ -97,7 +88,7 @@ void ScrollBarWidget::handleMouseDown(int x, int y, MouseButton b, void ScrollBarWidget::handleMouseUp(int x, int y, MouseButton b, int clickCount) { - _draggingPart = kNoPart; + _draggingPart = Part::None; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -124,7 +115,7 @@ void ScrollBarWidget::handleMouseMoved(int x, int y) if(_numEntries <= _entriesPerPage) return; - if(_draggingPart == kSliderPart) + if(_draggingPart == Part::Slider) { int old_pos = _currentPos; _sliderPos = y - _sliderDeltaMouseDownPos; @@ -141,18 +132,18 @@ void ScrollBarWidget::handleMouseMoved(int x, int y) } else { - int old_part = _part; + Part old_part = _part; if(y <= UP_DOWN_BOX_HEIGHT) // Up arrow - _part = kUpArrowPart; + _part = Part::UpArrow; else if(y >= _h - UP_DOWN_BOX_HEIGHT) // Down arrow - _part = kDownArrowPart; + _part = Part::DownArrow; else if(y < _sliderPos) - _part = kPageUpPart; + _part = Part::PageUp; else if(y >= _sliderPos + _sliderHeight) - _part = kPageDownPart; + _part = Part::PageDown; else - _part = kSliderPart; + _part = Part::Slider; if (old_part != _part) setDirty(); @@ -191,7 +182,7 @@ void ScrollBarWidget::handleMouseEntered() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ScrollBarWidget::handleMouseLeft() { - _part = kNoPart; + _part = Part::None; clearFlags(Widget::FLAG_HILITED); setDirty(); } @@ -255,28 +246,28 @@ void ScrollBarWidget::drawWidget(bool hilite) s.frameRect(_x, _y, _w, _h, hilite ? kWidColorHi : kColor); - if(_draggingPart != kNoPart) + if(_draggingPart != Part::None) _part = _draggingPart; // Up arrow - if(hilite && _part == kUpArrowPart) + if(hilite && _part == Part::UpArrow) s.fillRect(_x + 1, _y + 1, _w - 2, UP_DOWN_BOX_HEIGHT - 2, kScrollColor); s.drawBitmap(up_arrow.data(), _x+4, _y+5, - onTop ? isSinglePage ? kColor : (hilite && _part == kUpArrowPart) ? kWidColor + onTop ? isSinglePage ? kColor : (hilite && _part == Part::UpArrow) ? kWidColor : kTextColor : kColor, 8); // Down arrow - if(hilite && _part == kDownArrowPart) + if(hilite && _part == Part::DownArrow) s.fillRect(_x + 1, bottomY - UP_DOWN_BOX_HEIGHT + 1, _w - 2, UP_DOWN_BOX_HEIGHT - 2, kScrollColor); s.drawBitmap(down_arrow.data(), _x+4, bottomY - UP_DOWN_BOX_HEIGHT + 5, - onTop ? isSinglePage ? kColor : (hilite && _part == kDownArrowPart) ? + onTop ? isSinglePage ? kColor : (hilite && _part == Part::DownArrow) ? kWidColor : kTextColor : kColor, 8); // Slider if(!isSinglePage) { s.fillRect(_x + 1, _y + _sliderPos - 1, _w - 2, _sliderHeight + 2, - onTop ? (hilite && _part == kSliderPart) ? kScrollColorHi : kScrollColor : kColor); + onTop ? (hilite && _part == Part::Slider) ? kScrollColorHi : kScrollColor : kColor); } } diff --git a/src/gui/ScrollBarWidget.hxx b/src/gui/ScrollBarWidget.hxx index c44a0a638..f6f0fb2d6 100644 --- a/src/gui/ScrollBarWidget.hxx +++ b/src/gui/ScrollBarWidget.hxx @@ -53,26 +53,19 @@ class ScrollBarWidget : public Widget, public CommandSender void handleMouseLeft() override; public: - int _numEntries; - int _entriesPerPage; - int _currentPos; - int _wheel_lines; + int _numEntries{0}; + int _entriesPerPage{0}; + int _currentPos{0}; + int _wheel_lines{0}; private: - enum Part { - kNoPart, - kUpArrowPart, - kDownArrowPart, - kSliderPart, - kPageUpPart, - kPageDownPart - }; + enum class Part { None, UpArrow, DownArrow, Slider, PageUp, PageDown }; - Part _part; - Part _draggingPart; - int _sliderHeight; - int _sliderPos; - int _sliderDeltaMouseDownPos; + Part _part{Part::None}; + Part _draggingPart{Part::None}; + int _sliderHeight{0}; + int _sliderPos{0}; + int _sliderDeltaMouseDownPos{0}; static int _WHEEL_LINES; diff --git a/src/gui/SnapshotDialog.hxx b/src/gui/SnapshotDialog.hxx index 88cf25363..65d775e8f 100644 --- a/src/gui/SnapshotDialog.hxx +++ b/src/gui/SnapshotDialog.hxx @@ -55,13 +55,13 @@ class SnapshotDialog : public Dialog const GUI::Font& myFont; // Config paths - EditTextWidget* mySnapSavePath; + EditTextWidget* mySnapSavePath{nullptr}; - CheckboxWidget* mySnapName; - SliderWidget* mySnapInterval; + CheckboxWidget* mySnapName{nullptr}; + SliderWidget* mySnapInterval{nullptr}; - CheckboxWidget* mySnapSingle; - CheckboxWidget* mySnap1x; + CheckboxWidget* mySnapSingle{nullptr}; + CheckboxWidget* mySnap1x{nullptr}; unique_ptr myBrowser; diff --git a/src/gui/StellaSettingsDialog.hxx b/src/gui/StellaSettingsDialog.hxx index e5b70b607..ec1e8cfa0 100644 --- a/src/gui/StellaSettingsDialog.hxx +++ b/src/gui/StellaSettingsDialog.hxx @@ -70,30 +70,30 @@ class StellaSettingsDialog : public Dialog private: // UI theme - PopUpWidget* myThemePopup; - PopUpWidget* myPositionPopup; + PopUpWidget* myThemePopup{nullptr}; + PopUpWidget* myPositionPopup{nullptr}; // TV effects - PopUpWidget* myTVMode; + PopUpWidget* myTVMode{nullptr}; // TV scanline intensity - SliderWidget* myTVScanIntense; + SliderWidget* myTVScanIntense{nullptr}; // TV phosphor effect - SliderWidget* myTVPhosLevel; + SliderWidget* myTVPhosLevel{nullptr}; // TV Overscan - SliderWidget* myTVOverscan; + SliderWidget* myTVOverscan{nullptr}; // Controller properties - StaticTextWidget* myGameSettings; + StaticTextWidget* myGameSettings{nullptr}; - StaticTextWidget* myLeftPortLabel; - StaticTextWidget* myRightPortLabel; - PopUpWidget* myLeftPort; - StaticTextWidget* myLeftPortDetected; - PopUpWidget* myRightPort; - StaticTextWidget* myRightPortDetected; + StaticTextWidget* myLeftPortLabel{nullptr}; + StaticTextWidget* myRightPortLabel{nullptr}; + PopUpWidget* myLeftPort{nullptr}; + StaticTextWidget* myLeftPortDetected{nullptr}; + PopUpWidget* myRightPort{nullptr}; + StaticTextWidget* myRightPortDetected{nullptr}; unique_ptr myConfirmMsg; #if defined(RETRON77) @@ -103,7 +103,7 @@ class StellaSettingsDialog : public Dialog #endif // Indicates if this dialog is used for global (vs. in-game) settings - Menu::AppMode myMode; + Menu::AppMode myMode{Menu::AppMode::emulator}; enum { kAdvancedSettings = 'SSad', diff --git a/src/gui/StringListWidget.hxx b/src/gui/StringListWidget.hxx index d311b5918..6d3561d4d 100644 --- a/src/gui/StringListWidget.hxx +++ b/src/gui/StringListWidget.hxx @@ -38,7 +38,7 @@ class StringListWidget : public ListWidget Common::Rect getEditRect() const override; protected: - bool _hilite; + bool _hilite{false}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/TabWidget.cxx b/src/gui/TabWidget.cxx index 999ca8013..7f644628e 100644 --- a/src/gui/TabWidget.cxx +++ b/src/gui/TabWidget.cxx @@ -28,10 +28,7 @@ TabWidget::TabWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h) : Widget(boss, font, x, y, w, h), - CommandSender(boss), - _tabWidth(40), - _activeTab(-1), - _firstTime(true) + CommandSender(boss) { _id = 0; // For dialogs with multiple tab widgets, they should specifically // call ::setID to differentiate among them diff --git a/src/gui/TabWidget.hxx b/src/gui/TabWidget.hxx index 5b5664b89..80c6e7fb0 100644 --- a/src/gui/TabWidget.hxx +++ b/src/gui/TabWidget.hxx @@ -76,10 +76,10 @@ class TabWidget : public Widget, public CommandSender private: struct Tab { string title; - Widget* firstWidget; - Widget* parentWidget; - bool enabled; - int tabWidth; + Widget* firstWidget{nullptr}; + Widget* parentWidget{nullptr}; + bool enabled{true}; + int tabWidth{0}; Tab(const string& t, int tw = NO_WIDTH, Widget* first = nullptr, Widget* parent = nullptr, bool e = true) @@ -88,10 +88,10 @@ class TabWidget : public Widget, public CommandSender using TabList = vector; TabList _tabs; - int _tabWidth; - int _tabHeight; - int _activeTab; - bool _firstTime; + int _tabWidth{40}; + int _tabHeight{1}; + int _activeTab{-1}; + bool _firstTime{true}; enum { kTabLeftOffset = 0, diff --git a/src/gui/TimeLineWidget.cxx b/src/gui/TimeLineWidget.cxx index 923ec7ddf..1a67b7019 100644 --- a/src/gui/TimeLineWidget.cxx +++ b/src/gui/TimeLineWidget.cxx @@ -33,10 +33,6 @@ 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), - _value(0), - _valueMin(0), - _valueMax(0), - _isDragging(false), _labelWidth(labelWidth) { _flags = Widget::FLAG_ENABLED | Widget::FLAG_TRACK_MOUSE; diff --git a/src/gui/TimeLineWidget.hxx b/src/gui/TimeLineWidget.hxx index 693ae4b89..d8a9d046b 100644 --- a/src/gui/TimeLineWidget.hxx +++ b/src/gui/TimeLineWidget.hxx @@ -53,10 +53,10 @@ class TimeLineWidget : public ButtonWidget uInt32 posToValue(uInt32 pos); protected: - uInt32 _value; - uInt32 _valueMin, _valueMax; - bool _isDragging; - uInt32 _labelWidth; + uInt32 _value{0}; + uInt32 _valueMin{0}, _valueMax{0}; + bool _isDragging{false}; + uInt32 _labelWidth{0}; uIntArray _stepValue; diff --git a/src/gui/TimeMachine.cxx b/src/gui/TimeMachine.cxx index 629c49392..53dfb9d77 100644 --- a/src/gui/TimeMachine.cxx +++ b/src/gui/TimeMachine.cxx @@ -23,7 +23,6 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TimeMachine::TimeMachine(OSystem& osystem) : DialogContainer(osystem), - myBaseDialog(nullptr), myWidth(FBMinimum::Width) { myBaseDialog = new TimeMachineDialog(myOSystem, *this, myWidth); diff --git a/src/gui/TimeMachine.hxx b/src/gui/TimeMachine.hxx index 22a339d91..902aaca2b 100644 --- a/src/gui/TimeMachine.hxx +++ b/src/gui/TimeMachine.hxx @@ -50,9 +50,9 @@ class TimeMachine : public DialogContainer void setEnterWinds(Int32 numWinds); private: - Dialog* myBaseDialog; + Dialog* myBaseDialog{nullptr}; - uInt32 myWidth; + uInt32 myWidth{0}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/TimeMachineDialog.cxx b/src/gui/TimeMachineDialog.cxx index bf8f4ed0b..b256da0ee 100644 --- a/src/gui/TimeMachineDialog.cxx +++ b/src/gui/TimeMachineDialog.cxx @@ -184,8 +184,7 @@ static constexpr std::array LOAD_ALL = { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent, int width) - : Dialog(osystem, parent), - _enterWinds(0) + : Dialog(osystem, parent) { const GUI::Font& font = instance().frameBuffer().font(); const int H_BORDER = 6, BUTTON_GAP = 4, V_BORDER = 4; diff --git a/src/gui/TimeMachineDialog.hxx b/src/gui/TimeMachineDialog.hxx index c0adc17a2..0abd14b37 100644 --- a/src/gui/TimeMachineDialog.hxx +++ b/src/gui/TimeMachineDialog.hxx @@ -69,25 +69,25 @@ class TimeMachineDialog : public Dialog kLoadAll = 'TMld', }; - TimeLineWidget* myTimeline; + TimeLineWidget* myTimeline{nullptr}; - ButtonWidget* myToggleWidget; - ButtonWidget* myPlayWidget; - ButtonWidget* myRewindAllWidget; - ButtonWidget* myRewind1Widget; - ButtonWidget* myUnwind1Widget; - ButtonWidget* myUnwindAllWidget; - ButtonWidget* mySaveAllWidget; - ButtonWidget* myLoadAllWidget; + ButtonWidget* myToggleWidget{nullptr}; + ButtonWidget* myPlayWidget{nullptr}; + ButtonWidget* myRewindAllWidget{nullptr}; + ButtonWidget* myRewind1Widget{nullptr}; + ButtonWidget* myUnwind1Widget{nullptr}; + ButtonWidget* myUnwindAllWidget{nullptr}; + ButtonWidget* mySaveAllWidget{nullptr}; + ButtonWidget* myLoadAllWidget{nullptr}; - StaticTextWidget* myCurrentTimeWidget; - StaticTextWidget* myLastTimeWidget; + StaticTextWidget* myCurrentTimeWidget{nullptr}; + StaticTextWidget* myLastTimeWidget{nullptr}; - StaticTextWidget* myCurrentIdxWidget; - StaticTextWidget* myLastIdxWidget; - StaticTextWidget* myMessageWidget; + StaticTextWidget* myCurrentIdxWidget{nullptr}; + StaticTextWidget* myLastIdxWidget{nullptr}; + StaticTextWidget* myMessageWidget{nullptr}; - Int32 _enterWinds; + Int32 _enterWinds{0}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/UIDialog.hxx b/src/gui/UIDialog.hxx index d61177f87..d457ada76 100644 --- a/src/gui/UIDialog.hxx +++ b/src/gui/UIDialog.hxx @@ -50,32 +50,32 @@ class UIDialog : public Dialog, public CommandSender }; const GUI::Font& myFont; - TabWidget* myTab; + TabWidget* myTab{nullptr}; // Launcher options - EditTextWidget* myRomPath; - SliderWidget* myLauncherWidthSlider; - SliderWidget* myLauncherHeightSlider; - PopUpWidget* myLauncherFontPopup; - PopUpWidget* myRomViewerPopup; - ButtonWidget* myOpenBrowserButton; - EditTextWidget* mySnapLoadPath; - CheckboxWidget* myLauncherExitWidget; + EditTextWidget* myRomPath{nullptr}; + SliderWidget* myLauncherWidthSlider{nullptr}; + SliderWidget* myLauncherHeightSlider{nullptr}; + PopUpWidget* myLauncherFontPopup{nullptr}; + PopUpWidget* myRomViewerPopup{nullptr}; + ButtonWidget* myOpenBrowserButton{nullptr}; + EditTextWidget* mySnapLoadPath{nullptr}; + CheckboxWidget* myLauncherExitWidget{nullptr}; // Misc options - PopUpWidget* myPalettePopup; - CheckboxWidget* myHidpiWidget; - PopUpWidget* myPositionPopup; - SliderWidget* myListDelaySlider; - SliderWidget* myWheelLinesSlider; - SliderWidget* myControllerRateSlider; - SliderWidget* myControllerDelaySlider; - SliderWidget* myDoubleClickSlider; + PopUpWidget* myPalettePopup{nullptr}; + CheckboxWidget* myHidpiWidget{nullptr}; + PopUpWidget* myPositionPopup{nullptr}; + SliderWidget* myListDelaySlider{nullptr}; + SliderWidget* myWheelLinesSlider{nullptr}; + SliderWidget* myControllerRateSlider{nullptr}; + SliderWidget* myControllerDelaySlider{nullptr}; + SliderWidget* myDoubleClickSlider{nullptr}; unique_ptr myBrowser; // Indicates if this dialog is used for global (vs. in-game) settings - bool myIsGlobal; + bool myIsGlobal{false}; private: // Following constructors and assignment operators not supported diff --git a/src/gui/VideoDialog.hxx b/src/gui/VideoDialog.hxx index 5cbd7940a..32267dc30 100644 --- a/src/gui/VideoDialog.hxx +++ b/src/gui/VideoDialog.hxx @@ -54,51 +54,51 @@ class VideoDialog : public Dialog TabWidget* myTab; // General options - PopUpWidget* myRenderer; - SliderWidget* myTIAZoom; - PopUpWidget* myTIAPalette; - CheckboxWidget* myTIAInterpolate; - SliderWidget* myNAspectRatio; - SliderWidget* myPAspectRatio; - SliderWidget* mySpeed; + PopUpWidget* myRenderer{nullptr}; + SliderWidget* myTIAZoom{nullptr}; + PopUpWidget* myTIAPalette{nullptr}; + CheckboxWidget* myTIAInterpolate{nullptr}; + SliderWidget* myNAspectRatio{nullptr}; + SliderWidget* myPAspectRatio{nullptr}; + SliderWidget* mySpeed{nullptr}; - CheckboxWidget* myFullscreen; + CheckboxWidget* myFullscreen{nullptr}; //PopUpWidget* myFullScreenMode; - CheckboxWidget* myUseStretch; - SliderWidget* myTVOverscan; - CheckboxWidget* myUseVSync; - CheckboxWidget* myUIMessages; - CheckboxWidget* myCenter; - CheckboxWidget* myFastSCBios; - CheckboxWidget* myUseThreads; + CheckboxWidget* myUseStretch{nullptr}; + SliderWidget* myTVOverscan{nullptr}; + CheckboxWidget* myUseVSync{nullptr}; + CheckboxWidget* myUIMessages{nullptr}; + CheckboxWidget* myCenter{nullptr}; + CheckboxWidget* myFastSCBios{nullptr}; + CheckboxWidget* myUseThreads{nullptr}; // TV effects adjustables (custom mode) - PopUpWidget* myTVMode; - SliderWidget* myTVSharp; - SliderWidget* myTVHue; - SliderWidget* myTVRes; - SliderWidget* myTVArtifacts; - SliderWidget* myTVFringe; - SliderWidget* myTVBleed; - SliderWidget* myTVBright; - SliderWidget* myTVContrast; - SliderWidget* myTVSatur; - SliderWidget* myTVGamma; + PopUpWidget* myTVMode{nullptr}; + SliderWidget* myTVSharp{nullptr}; + SliderWidget* myTVHue{nullptr}; + SliderWidget* myTVRes{nullptr}; + SliderWidget* myTVArtifacts{nullptr}; + SliderWidget* myTVFringe{nullptr}; + SliderWidget* myTVBleed{nullptr}; + SliderWidget* myTVBright{nullptr}; + SliderWidget* myTVContrast{nullptr}; + SliderWidget* myTVSatur{nullptr}; + SliderWidget* myTVGamma{nullptr}; // TV phosphor effect - CheckboxWidget* myTVPhosphor; - SliderWidget* myTVPhosLevel; + CheckboxWidget* myTVPhosphor{nullptr}; + SliderWidget* myTVPhosLevel{nullptr}; // TV scanline intensity and interpolation - StaticTextWidget* myTVScanLabel; - SliderWidget* myTVScanIntense; + StaticTextWidget* myTVScanLabel{nullptr}; + SliderWidget* myTVScanIntense{nullptr}; // TV effects adjustables presets (custom mode) - ButtonWidget* myCloneComposite; - ButtonWidget* myCloneSvideo; - ButtonWidget* myCloneRGB; - ButtonWidget* myCloneBad; - ButtonWidget* myCloneCustom; + ButtonWidget* myCloneComposite{nullptr}; + ButtonWidget* myCloneSvideo{nullptr}; + ButtonWidget* myCloneRGB{nullptr}; + ButtonWidget* myCloneBad{nullptr}; + ButtonWidget* myCloneCustom{nullptr}; enum { kSpeedupChanged = 'VDSp', diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx index 711ef65a8..f1a782688 100644 --- a/src/gui/Widget.cxx +++ b/src/gui/Widget.cxx @@ -32,17 +32,7 @@ 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), - _id(0), - _flags(0), - _hasFocus(false), - _bgcolor(kWidColor), - _bgcolorhi(kWidColor), - _bgcolorlo(kBGColorLo), - _textcolor(kTextColor), - _textcolorhi(kTextColorHi), - _textcolorlo(kBGColorLo), - _shadowcolor(kShadowColor) + _font(font) { // Insert into the widget list of the boss _next = _boss->_firstWidget; @@ -311,6 +301,7 @@ 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) { _flags = Widget::FLAG_ENABLED; @@ -319,9 +310,6 @@ StaticTextWidget::StaticTextWidget(GuiObject* boss, const GUI::Font& font, _textcolor = kTextColor; _textcolorhi = kTextColor; _shadowcolor = shadowColor; - - _label = text; - _editable = false; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -368,11 +356,7 @@ ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font, : StaticTextWidget(boss, font, x, y, w, h, label, TextAlign::Center), CommandSender(boss), _cmd(cmd), - _repeat(repeat), - _useBitmap(false), - _bitmap(nullptr), - _bmw(0), - _bmh(0) + _repeat(repeat) { _flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG; _bgcolor = kBtnColor; @@ -381,15 +365,14 @@ ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font, _textcolor = kBtnTextColor; _textcolorhi = kBtnTextColorHi; _textcolorlo = kBGColorLo; - - _editable = false; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int dw, const string& label, int cmd, bool repeat) - : ButtonWidget(boss, font, x, y, font.getStringWidth(label) + dw, font.getLineHeight() + 4, label, cmd, repeat) + : ButtonWidget(boss, font, x, y, font.getStringWidth(label) + dw, + font.getLineHeight() + 4, label, cmd, repeat) { } @@ -499,14 +482,7 @@ void ButtonWidget::drawWidget(bool hilite) CheckboxWidget::CheckboxWidget(GuiObject* boss, const GUI::Font& font, int x, int y, const string& label, int cmd) - : ButtonWidget(boss, font, x, y, 16, 16, label, cmd), - _state(false), - _holdFocus(true), - _drawBox(true), - _changed(false), - _fillColor(kColor), - _boxY(0), - _textY(0) + : ButtonWidget(boss, font, x, y, 16, 16, label, cmd) { _flags = Widget::FLAG_ENABLED; _bgcolor = _bgcolorhi = kWidColor; @@ -520,7 +496,6 @@ CheckboxWidget::CheckboxWidget(GuiObject* boss, const GUI::Font& font, _w = font.getStringWidth(label) + 20; _h = font.getFontHeight() < 14 ? 14 : font.getFontHeight(); - // Depending on font size, either the font or box will need to be // centered vertically if(_h > 14) // center box @@ -648,17 +623,10 @@ SliderWidget::SliderWidget(GuiObject* boss, const GUI::Font& font, const string& label, int labelWidth, int cmd, int valueLabelWidth, const string& valueUnit, int valueLabelGap) : ButtonWidget(boss, font, x, y, w, h, label, cmd), - _value(-1), - _stepValue(1), - _valueMin(0), - _valueMax(100), - _isDragging(false), _labelWidth(labelWidth), - _valueLabel(""), _valueUnit(valueUnit), _valueLabelGap(valueLabelGap), - _valueLabelWidth(valueLabelWidth), - _numIntervals(0) + _valueLabelWidth(valueLabelWidth) { _flags = Widget::FLAG_ENABLED | Widget::FLAG_TRACK_MOUSE; _bgcolor = kDlgColor; diff --git a/src/gui/Widget.hxx b/src/gui/Widget.hxx index 63a3bcc74..a1aa1eec0 100644 --- a/src/gui/Widget.hxx +++ b/src/gui/Widget.hxx @@ -133,21 +133,21 @@ class Widget : public GuiObject { assert(_boss); _boss->handleCommand(sender, cmd, data, id); } protected: - GuiObject* _boss; + GuiObject* _boss{nullptr}; const GUI::Font& _font; - Widget* _next; - uInt32 _id; - uInt32 _flags; - bool _hasFocus; - int _fontWidth; - int _fontHeight; - ColorId _bgcolor; - ColorId _bgcolorhi; - ColorId _bgcolorlo; - ColorId _textcolor; - ColorId _textcolorhi; - ColorId _textcolorlo; - ColorId _shadowcolor; + Widget* _next{nullptr}; + uInt32 _id{0}; + uInt32 _flags{0}; + bool _hasFocus{false}; + int _fontWidth{0}; + int _fontHeight{0}; + ColorId _bgcolor{kWidColor}; + ColorId _bgcolorhi{kWidColor}; + ColorId _bgcolorlo{kBGColorLo}; + ColorId _textcolor{kTextColor}; + ColorId _textcolorhi{kTextColorHi}; + ColorId _textcolorlo{kBGColorLo}; + ColorId _shadowcolor{kShadowColor}; public: static Widget* findWidgetInChain(Widget* start, int x, int y); @@ -200,8 +200,8 @@ class StaticTextWidget : public Widget protected: string _label; - bool _editable; - TextAlign _align; + bool _editable{false}; + TextAlign _align{TextAlign::Left}; private: // Following constructors and assignment operators not supported @@ -249,9 +249,9 @@ class ButtonWidget : public StaticTextWidget, public CommandSender protected: int _cmd{0}; bool _repeat{false}; // button repeats - bool _useBitmap; - const uInt32* _bitmap; - int _bmw, _bmh; + bool _useBitmap{false}; + const uInt32* _bitmap{nullptr}; + int _bmw{0}, _bmh{0}; private: // Following constructors and assignment operators not supported @@ -291,15 +291,15 @@ class CheckboxWidget : public ButtonWidget void drawWidget(bool hilite) override; protected: - bool _state; - bool _holdFocus; - bool _drawBox; - bool _changed; + bool _state{false}; + bool _holdFocus{true}; + bool _drawBox{true}; + bool _changed{false}; - const uInt32* _img; - ColorId _fillColor; - int _boxY; - int _textY; + const uInt32* _img{nullptr}; + ColorId _fillColor{kColor}; + int _boxY{0}; + int _textY{0}; private: // Following constructors and assignment operators not supported @@ -317,11 +317,13 @@ class SliderWidget : public ButtonWidget SliderWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h, const string& label = "", int labelWidth = 0, int cmd = 0, - int valueLabelWidth = 0, const string& valueUnit = "", int valueLabelGap = 4); + int valueLabelWidth = 0, const string& valueUnit = "", + int valueLabelGap = 4); SliderWidget(GuiObject* boss, const GUI::Font& font, int x, int y, const string& label = "", int labelWidth = 0, int cmd = 0, - int valueLabelWidth = 0, const string& valueUnit = "", int valueLabelGap = 4); + int valueLabelWidth = 0, const string& valueUnit = "", + int valueLabelGap = 4); virtual ~SliderWidget() = default; void setValue(int value); @@ -353,15 +355,15 @@ class SliderWidget : public ButtonWidget int posToValue(int pos) const; protected: - int _value, _stepValue; - int _valueMin, _valueMax; - bool _isDragging; - int _labelWidth; + int _value{-1}, _stepValue{1}; + int _valueMin{0}, _valueMax{100}; + bool _isDragging{false}; + int _labelWidth{0}; string _valueLabel; string _valueUnit; - int _valueLabelGap; - int _valueLabelWidth; - int _numIntervals; + int _valueLabelGap{0}; + int _valueLabelWidth{0}; + int _numIntervals{0}; private: // Following constructors and assignment operators not supported diff --git a/src/macos/OSystemMACOS.hxx b/src/macos/OSystemMACOS.hxx index 7426dfc41..905f73d9e 100644 --- a/src/macos/OSystemMACOS.hxx +++ b/src/macos/OSystemMACOS.hxx @@ -54,9 +54,8 @@ class OSystemMACOS : public OSystem string& savedir, string& loaddir, bool useappdir, const string& usedir) override; -protected: - - virtual shared_ptr createSettingsRepository() override; + protected: + virtual shared_ptr createSettingsRepository() override; private: // Following constructors and assignment operators not supported diff --git a/src/macos/SerialPortMACOS.cxx b/src/macos/SerialPortMACOS.cxx index 77dfcee08..781b6ecc0 100644 --- a/src/macos/SerialPortMACOS.cxx +++ b/src/macos/SerialPortMACOS.cxx @@ -29,8 +29,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SerialPortMACOS::SerialPortMACOS() - : SerialPort(), - myHandle(0) + : SerialPort() { } diff --git a/src/macos/SerialPortMACOS.hxx b/src/macos/SerialPortMACOS.hxx index b2fc6855f..ecfbec499 100644 --- a/src/macos/SerialPortMACOS.hxx +++ b/src/macos/SerialPortMACOS.hxx @@ -50,7 +50,7 @@ class SerialPortMACOS : public SerialPort private: // File descriptor for serial connection - int myHandle; + int myHandle{0}; private: // Following constructors and assignment operators not supported diff --git a/src/macos/SettingsRepositoryMACOS.hxx b/src/macos/SettingsRepositoryMACOS.hxx index 84c285d73..084ee8ab4 100644 --- a/src/macos/SettingsRepositoryMACOS.hxx +++ b/src/macos/SettingsRepositoryMACOS.hxx @@ -22,12 +22,12 @@ class SettingsRepositoryMACOS : public KeyValueRepository { -public: - std::map load() override; + public: + std::map load() override; - void save(const std::map& values) override; + void save(const std::map& values) override; - void save(const string& key, const Variant& value) override; + void save(const string& key, const Variant& value) override; }; #endif // SETTINGS_REPOSITORY_MACOS_HXX diff --git a/src/windows/FSNodeWINDOWS.cxx b/src/windows/FSNodeWINDOWS.cxx index ddc5687f7..ffc71e4fd 100644 --- a/src/windows/FSNodeWINDOWS.cxx +++ b/src/windows/FSNodeWINDOWS.cxx @@ -178,12 +178,6 @@ const TCHAR* FilesystemNodeWINDOWS::toUnicode(const char* str) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - FilesystemNodeWINDOWS::FilesystemNodeWINDOWS() { - // Create a virtual root directory for standard Windows system - _isDirectory = true; - _isFile = false; - _isValid = false; - _path = ""; - _isPseudoRoot = true; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/windows/FSNodeWINDOWS.hxx b/src/windows/FSNodeWINDOWS.hxx index 6d0e3ed37..3dd767002 100644 --- a/src/windows/FSNodeWINDOWS.hxx +++ b/src/windows/FSNodeWINDOWS.hxx @@ -76,10 +76,10 @@ class FilesystemNodeWINDOWS : public AbstractFSNode protected: string _displayName; string _path; - bool _isDirectory; - bool _isFile; - bool _isPseudoRoot; - bool _isValid; + bool _isDirectory{true}; + bool _isFile{false}; + bool _isPseudoRoot{true}; + bool _isValid{false}; private: /** diff --git a/src/windows/SerialPortWINDOWS.cxx b/src/windows/SerialPortWINDOWS.cxx index 0f6e67fa5..face0ecff 100644 --- a/src/windows/SerialPortWINDOWS.cxx +++ b/src/windows/SerialPortWINDOWS.cxx @@ -21,8 +21,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SerialPortWINDOWS::SerialPortWINDOWS() - : SerialPort(), - myHandle(0) + : SerialPort() { } diff --git a/src/windows/SerialPortWINDOWS.hxx b/src/windows/SerialPortWINDOWS.hxx index 6287aa597..4da79dee9 100644 --- a/src/windows/SerialPortWINDOWS.hxx +++ b/src/windows/SerialPortWINDOWS.hxx @@ -49,7 +49,7 @@ class SerialPortWINDOWS : public SerialPort private: // Handle to serial port - HANDLE myHandle; + HANDLE myHandle{0}; private: // Following constructors and assignment operators not supported From 733db7250adec94f077d26d73f80ed8021f839b3 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sun, 29 Dec 2019 20:22:05 -0330 Subject: [PATCH 3/5] Fix typo that caused entering the debugger to crash. --- src/debugger/gui/RomListWidget.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/debugger/gui/RomListWidget.hxx b/src/debugger/gui/RomListWidget.hxx index 19afa7753..622aa4541 100644 --- a/src/debugger/gui/RomListWidget.hxx +++ b/src/debugger/gui/RomListWidget.hxx @@ -101,7 +101,7 @@ class RomListWidget : public EditableWidget Common::Base::Fmt _base{Common::Base::Fmt::_DEFAULT}; // base used during editing const CartDebug::Disassembly* myDisasm{nullptr}; - vector myCheckList{nullptr}; + vector myCheckList; private: // Following constructors and assignment operators not supported From 767f952e4e49f32959dea3616cd63995d13a0831 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sun, 29 Dec 2019 21:08:50 -0330 Subject: [PATCH 4/5] A few cleanups missed in the previous commits. --- src/common/audio/SimpleResampler.cxx | 6 +----- src/gui/InputTextDialog.cxx | 6 +----- src/gui/InputTextDialog.hxx | 3 ++- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/common/audio/SimpleResampler.cxx b/src/common/audio/SimpleResampler.cxx index ecaec92d5..9871b66a5 100644 --- a/src/common/audio/SimpleResampler.cxx +++ b/src/common/audio/SimpleResampler.cxx @@ -22,11 +22,7 @@ SimpleResampler::SimpleResampler( Resampler::Format formatFrom, Resampler::Format formatTo, const Resampler::NextFragmentCallback& nextFragmentCallback) - : Resampler(formatFrom, formatTo, nextFragmentCallback), - myCurrentFragment(nullptr), - myTimeIndex(0), - myFragmentIndex(0), - myIsUnderrun(true) + : Resampler(formatFrom, formatTo, nextFragmentCallback) { } diff --git a/src/gui/InputTextDialog.cxx b/src/gui/InputTextDialog.cxx index 275508b4d..c43f9afca 100644 --- a/src/gui/InputTextDialog.cxx +++ b/src/gui/InputTextDialog.cxx @@ -41,11 +41,7 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont, const StringList& labels, const string& title) : Dialog(boss->instance(), boss->parent(), lfont, title), - CommandSender(boss), - myEnableCenter(false), - myErrorFlag(false), - myXOrig(0), - myYOrig(0) + CommandSender(boss) { initialize(lfont, nfont, labels); } diff --git a/src/gui/InputTextDialog.hxx b/src/gui/InputTextDialog.hxx index 79aee65a8..5c61945be 100644 --- a/src/gui/InputTextDialog.hxx +++ b/src/gui/InputTextDialog.hxx @@ -32,7 +32,8 @@ class InputTextDialog : public Dialog, public CommandSender InputTextDialog(GuiObject* boss, const GUI::Font& font, const StringList& labels, const string& title = ""); InputTextDialog(GuiObject* boss, const GUI::Font& lfont, - const GUI::Font& nfont, const StringList& labels, const string& title = ""); + const GUI::Font& nfont, const StringList& labels, + const string& title = ""); virtual ~InputTextDialog() = default; /** Place the input dialog onscreen and center it */ From bfb5bee2082a85ebcdfce663fdb076f48a149908 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Mon, 30 Dec 2019 09:46:46 +0100 Subject: [PATCH 5/5] make user aware of grab mouse limitations --- src/emucore/EventHandler.cxx | 7 +++++-- src/emucore/FrameBuffer.cxx | 25 ++++++++++++++++++------- src/gui/InputDialog.cxx | 34 +++++++++++++++++++++++++++------- src/gui/InputDialog.hxx | 20 +++++++++++--------- 4 files changed, 61 insertions(+), 25 deletions(-) diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 88e9cc345..3b8ffe6eb 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -566,9 +566,12 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated) case Event::ToggleGrabMouse: if (pressed && !repeated && !myOSystem.frameBuffer().fullScreen()) { + bool oldState = myOSystem.frameBuffer().grabMouseEnabled(); myOSystem.frameBuffer().toggleGrabMouse(); - myOSystem.frameBuffer().showMessage(myOSystem.frameBuffer().grabMouseEnabled() - ? "Grab mouse enabled" : "Grab mouse disabled"); + bool newState = myOSystem.frameBuffer().grabMouseEnabled(); + myOSystem.frameBuffer().showMessage(oldState != newState ? myOSystem.frameBuffer().grabMouseEnabled() + ? "Grab mouse enabled" : "Grab mouse disabled" + : "Grab mouse not allowed while cursor shown"); } return; diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index 922c694dd..e4e6bf480 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -843,16 +843,27 @@ void FrameBuffer::setCursorState() myOSystem.console().rightController().isAnalog()) : false; bool alwaysUseMouse = BSPF::equalsIgnoreCase("always", myOSystem.settings().getString("usemouse")); - grabMouse(emulation && (analog || alwaysUseMouse) && myGrabMouse); - // Show/hide cursor in UI/emulation mode based on 'cursor' setting - switch(myOSystem.settings().getInt("cursor")) + int cursor = myOSystem.settings().getInt("cursor"); + switch(cursor) { - case 0: showCursor(false); break; - case 1: showCursor(emulation); break; - case 2: showCursor(!emulation); break; - case 3: showCursor(true); break; + case 0: + showCursor(false); + break; + case 1: + showCursor(emulation); + myGrabMouse = false; // disable grab while cursor is shown in emulation + break; + case 2: + showCursor(!emulation); + break; + case 3: + showCursor(true); + myGrabMouse = false; // disable grab while cursor is shown in emulation + break; } + + grabMouse(emulation && (analog || alwaysUseMouse) && myGrabMouse); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/InputDialog.cxx b/src/gui/InputDialog.cxx index 63667e660..7a30b20a3 100644 --- a/src/gui/InputDialog.cxx +++ b/src/gui/InputDialog.cxx @@ -129,7 +129,7 @@ void InputDialog::addDevicePortTab(const GUI::Font& font) VarList::push_back(items, "+UI, -Emulation", "2"); VarList::push_back(items, "+UI, +Emulation", "3"); myCursorState = new PopUpWidget(myTab, font, HBORDER, ypos, pwidth, lineHeight, items, - "Mouse cursor visibility ", lwidth); + "Mouse cursor visibility ", lwidth, kCursorStateChanged); wid.push_back(myCursorState); #ifndef WINDOWED_SUPPORT myCursorState->clearFlags(Widget::FLAG_ENABLED); @@ -272,6 +272,7 @@ void InputDialog::loadConfig() // Mouse cursor state myCursorState->setSelected(instance().settings().getString("cursor"), "2"); + handleCursorState(); // Joystick deadzone myDeadzone->setValue(instance().settings().getInt("joydeadzone")); @@ -280,7 +281,7 @@ void InputDialog::loadConfig() // Paddle speed (digital and mouse) myDejitterBase->setValue(instance().settings().getInt("dejitter.base")); myDejitterDiff->setValue(instance().settings().getInt("dejitter.diff")); - UpdateDejitter(); + updateDejitter(); myDPaddleSpeed->setValue(instance().settings().getInt("dsense")); myDPaddleLabel->setLabel(instance().settings().getString("dsense")); myMPaddleSpeed->setValue(instance().settings().getInt("msense")); @@ -365,8 +366,12 @@ void InputDialog::saveConfig() // Grab mouse and hide cursor const string& cursor = myCursorState->getSelectedTag().toString(); instance().settings().setValue("cursor", cursor); - instance().settings().setValue("grabmouse", myGrabMouse->getState()); - instance().frameBuffer().enableGrabMouse(myGrabMouse->getState()); + // only allow grab mouse if cursor is hidden in emulation + int state = myCursorState->getSelected(); + bool enableGrab = state != 1 && state != 3; + bool grab = enableGrab ? myGrabMouse->getState() : false; + instance().settings().setValue("grabmouse", grab); + instance().frameBuffer().enableGrabMouse(grab); // Enable/disable modifier key-combos instance().settings().setValue("modcombo", myModCombo->getState()); @@ -416,7 +421,7 @@ void InputDialog::setDefaults() myDejitterBase->setValue(0); myDejitterDiff->setValue(0); #endif - UpdateDejitter(); + updateDejitter(); myTrackBallSpeed->setValue(10); myTrackBallLabel->setLabel("10"); @@ -432,6 +437,8 @@ void InputDialog::setDefaults() // Enable/disable modifier key-combos myModCombo->setState(true); + handleCursorState(); + break; } @@ -559,6 +566,10 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd, setDefaults(); break; + case kCursorStateChanged: + handleCursorState(); + break; + case kDeadzoneChanged: myDeadzoneLabel->setValue(3200 + 1000*myDeadzone->getValue()); break; @@ -572,7 +583,7 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd, break; case kDejitterChanged: - UpdateDejitter(); + updateDejitter(); break; case kTBSpeedChanged: @@ -618,7 +629,16 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd, } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void InputDialog::UpdateDejitter() +void InputDialog::handleCursorState() +{ + int state = myCursorState->getSelected(); + bool enableGrab = state != 1 && state != 3; + + myGrabMouse->setEnabled(enableGrab); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void InputDialog::updateDejitter() { int strength = myDejitterBase->getValue(); stringstream label; diff --git a/src/gui/InputDialog.hxx b/src/gui/InputDialog.hxx index 8f2b891a6..9df3c7879 100644 --- a/src/gui/InputDialog.hxx +++ b/src/gui/InputDialog.hxx @@ -61,19 +61,21 @@ class InputDialog : public Dialog void addDevicePortTab(const GUI::Font& font); + void handleCursorState(); + void updateDejitter(); void eraseEEPROM(); - void UpdateDejitter(); private: enum { - kDeadzoneChanged = 'DZch', - kDejitterChanged = 'Pjch', - kDPSpeedChanged = 'PDch', - kMPSpeedChanged = 'PMch', - kTBSpeedChanged = 'TBch', - kDBButtonPressed = 'DBbp', - kEEButtonPressed = 'EEbp', - kConfirmEEEraseCmd = 'EEcf' + kCursorStateChanged = 'CSch', + kDeadzoneChanged = 'DZch', + kDejitterChanged = 'Pjch', + kDPSpeedChanged = 'PDch', + kMPSpeedChanged = 'PMch', + kTBSpeedChanged = 'TBch', + kDBButtonPressed = 'DBbp', + kEEButtonPressed = 'EEbp', + kConfirmEEEraseCmd = 'EEcf' }; TabWidget* myTab{nullptr};