First pass at moving to default member initialization.

This fixes potential issues with forgetting to initialize in c'tors.
This commit is contained in:
Stephen Anthony 2019-12-28 21:14:52 -03:30
parent 04fe64568a
commit b2c70d7677
69 changed files with 338 additions and 635 deletions

View File

@ -25,21 +25,8 @@
#include "FSNodeFactory.hxx"
#include "FSNodeZIP.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeZIP::FilesystemNodeZIP()
: _error(zip_error::NOT_A_FILE),
_numFiles(0),
_isDirectory(false),
_isFile(false)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodeZIP::FilesystemNodeZIP(const string& p)
: _error(zip_error::NONE),
_numFiles(0),
_isDirectory(false),
_isFile(false)
{
// Extract ZIP file and virtual file (if specified)
size_t pos = BSPF::findIgnoreCase(p, ".zip");
@ -107,9 +94,7 @@ FilesystemNodeZIP::FilesystemNodeZIP(const string& p)
FilesystemNodeZIP::FilesystemNodeZIP(
const string& zipfile, const string& virtualpath,
const AbstractFSNodePtr& realnode, bool isdir)
: _error(zip_error::NONE),
_numFiles(0),
_isDirectory(isdir),
: _isDirectory(isdir),
_isFile(!isdir)
{
setFlags(zipfile, virtualpath, realnode);

View File

@ -38,7 +38,7 @@ class FilesystemNodeZIP : public AbstractFSNode
/**
* Creates a FilesystemNodeZIP with the root node as path.
*/
FilesystemNodeZIP();
// FilesystemNodeZIP();
/**
* Creates a FilesystemNodeZIP for a given path.
@ -101,10 +101,10 @@ class FilesystemNodeZIP : public AbstractFSNode
string _zipFile, _virtualPath;
string _name, _path, _shortPath;
zip_error _error;
uInt32 _numFiles;
zip_error _error{zip_error::NONE};
uInt32 _numFiles{0};
bool _isDirectory, _isFile;
bool _isDirectory{false}, _isFile{false};
// ZipHandler static reference variable responsible for accessing ZIP files
static unique_ptr<ZipHandler> myZipHandler;

View File

@ -32,17 +32,13 @@ class JoyMap
public:
struct JoyMapping
{
EventMode mode;
int button; // button number
JoyAxis axis; // horizontal/vertical
JoyDir adir; // axis direction (neg/pos)
int hat; // hat number
JoyHatDir hdir; // hat direction (left/right/up/down)
EventMode mode{EventMode(0)};
int button{0}; // button number
JoyAxis axis{JoyAxis(0)}; // horizontal/vertical
JoyDir adir{JoyDir(0)}; // axis direction (neg/pos)
int hat{0}; // hat number
JoyHatDir hdir{JoyHatDir(0)}; // hat direction (left/right/up/down)
JoyMapping()
: mode(EventMode(0)), button(0),
axis(JoyAxis(0)), adir(JoyDir(0)),
hat(0), hdir(JoyHatDir(0)) { }
explicit JoyMapping(EventMode c_mode, int c_button,
JoyAxis c_axis, JoyDir c_adir,
int c_hat, JoyHatDir c_hdir)

View File

@ -32,11 +32,10 @@ class KeyMap
public:
struct Mapping
{
EventMode mode;
StellaKey key;
StellaMod mod;
EventMode mode{EventMode(0)};
StellaKey key{StellaKey(0)};
StellaMod mod{StellaMod(0)};
Mapping() : mode(EventMode(0)), key(StellaKey(0)), mod(StellaMod(0)) { }
explicit Mapping(EventMode c_mode, StellaKey c_key, StellaMod c_mod)
: mode(c_mode), key(c_key), mod(c_mod) { }
explicit Mapping(EventMode c_mode, int c_key, int c_mod)
@ -59,7 +58,7 @@ class KeyMap
};
using MappingArray = std::vector<Mapping>;
KeyMap() : myModEnabled(true) { }
KeyMap() = default;
/** Add new mapping for given event */
void add(const Event::Type event, const Mapping& mapping);
@ -122,7 +121,7 @@ class KeyMap
// being used or not (e.g. Ctrl by default is the fire button,
// pressing it with a movement key could inadvertantly activate
// a Ctrl combo when it isn't wanted)
bool myModEnabled;
bool myModEnabled{true};
// Following constructors and assignment operators not supported
KeyMap(const KeyMap&) = delete;

View File

@ -59,9 +59,7 @@ class LinkedObjectPool
/*
Create a pool of size CAPACITY; the active list starts out empty.
*/
LinkedObjectPool<T, CAPACITY>() : myCurrent(myList.end()), myCapacity(0) {
resize(CAPACITY);
}
LinkedObjectPool<T, CAPACITY>() { resize(CAPACITY); }
/**
Return node data that the 'current' iterator points to.
@ -272,10 +270,10 @@ class LinkedObjectPool
std::list<T> myList, myPool;
// Current position in the active list (end() indicates an invalid position)
iter myCurrent;
iter myCurrent{myList.end()};
// Total capacity of the pool
uInt32 myCapacity;
uInt32 myCapacity{0};
private:
// Following constructors and assignment operators not supported

View File

@ -26,8 +26,7 @@
MouseControl::MouseControl(Console& console, const string& mode)
: myProps(console.properties()),
myLeftController(console.leftController()),
myRightController(console.rightController()),
myCurrentModeNum(0)
myRightController(console.rightController())
{
istringstream m_axis(mode);
string m_mode;

View File

@ -76,16 +76,11 @@ class MouseControl
Controller& myRightController;
struct MouseMode {
Controller::Type xtype, ytype;
int xid, yid;
Controller::Type xtype{Controller::Type::Joystick}, ytype{Controller::Type::Joystick};
int xid{-1}, yid{-1};
string message;
explicit MouseMode(const string& msg = "")
: xtype(Controller::Type::Joystick),
ytype(Controller::Type::Joystick),
xid(-1),
yid(-1),
message(msg) { }
explicit MouseMode(const string& msg = "") : message(msg) { }
MouseMode(Controller::Type xt, int xi,
Controller::Type yt, int yi,
const string& msg)
@ -104,7 +99,7 @@ class MouseControl
}
};
int myCurrentModeNum;
int myCurrentModeNum{0};
vector<MouseMode> myModeList;
private:

View File

@ -32,9 +32,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PNGLibrary::PNGLibrary(OSystem& osystem)
: myOSystem(osystem),
mySnapInterval(0),
mySnapCounter(0)
: myOSystem(osystem)
{
}

View File

@ -131,17 +131,15 @@ class PNGLibrary
OSystem& myOSystem;
// Used for continuous snapshot mode
uInt32 mySnapInterval;
uInt32 mySnapCounter;
uInt32 mySnapInterval{0};
uInt32 mySnapCounter{0};
// The following data remains between invocations of allocateStorage,
// and is only changed when absolutely necessary.
struct ReadInfoType {
vector<png_byte> buffer;
vector<png_bytep> row_pointers;
png_uint_32 width, height, pitch;
ReadInfoType() : width(0), height(0), pitch(0) { }
png_uint_32 width{0}, height{0}, pitch{0};
};
static ReadInfoType ReadInfo;

View File

@ -17,13 +17,6 @@
#include "PhosphorHandler.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PhosphorHandler::PhosphorHandler()
: myUsePhosphor(false),
myPhosphorPercent(0.60F)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PhosphorHandler::initialize(bool enable, int blend)
{

View File

@ -24,7 +24,7 @@
class PhosphorHandler
{
public:
PhosphorHandler();
PhosphorHandler() = default;
bool initialize(bool enable, int blend);
@ -54,10 +54,10 @@ class PhosphorHandler
private:
// Use phosphor effect
bool myUsePhosphor;
bool myUsePhosphor{false};
// Amount to blend when using phosphor effect
float myPhosphorPercent;
float myPhosphorPercent{0.60F};
// Precalculated averaged phosphor colors
using PhosphorLUT = BSPF::array2D<uInt8, kColor, kColor>;

View File

@ -23,17 +23,6 @@
#include "bspf.hxx"
#include "PhysicalJoystick.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PhysicalJoystick::PhysicalJoystick()
: type(JT_NONE),
ID(-1),
name("None"),
numAxes(0),
numButtons(0),
numHats(0)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystick::initialize(int index, const string& desc,
int axes, int buttons, int hats, int /*balls*/)

View File

@ -42,7 +42,7 @@ class PhysicalJoystick
static constexpr char MODE_DELIM = '>'; // must not be '^', '|' or '#'
public:
PhysicalJoystick();
PhysicalJoystick() = default;
string getMap() const;
bool setMap(const string& map);
@ -65,10 +65,10 @@ class PhysicalJoystick
JT_2600DAPTOR_RIGHT = 5
};
JoyType type;
int ID;
string name;
int numAxes, numButtons, numHats;
JoyType type{JT_NONE};
int ID{-1};
string name{"None"};
int numAxes{0}, numButtons{0}, numHats{0};
IntArray axisLastValue;
IntArray buttonLast;

View File

@ -32,12 +32,12 @@ namespace Common {
*/
struct Point
{
Int32 x; //!< The horizontal part of the point
Int32 y; //!< The vertical part of the point
Int32 x{0}; //!< The horizontal part of the point
Int32 y{0}; //!< The vertical part of the point
Point() : x(0), y(0) { }
Point() = default;
explicit Point(Int32 x1, Int32 y1) : x(x1), y(y1) { }
explicit Point(const string& p) : x(0), y(0) {
explicit Point(const string& p) {
char c = '\0';
istringstream buf(p);
buf >> x >> c >> y;
@ -55,12 +55,12 @@ struct Point
struct Size
{
uInt32 w; //!< The width part of the size
uInt32 h; //!< The height part of the size
uInt32 w{0}; //!< The width part of the size
uInt32 h{0}; //!< The height part of the size
Size() : w(0), h(0) { }
Size() = default;
explicit Size(uInt32 w1, uInt32 h1) : w(w1), h(h1) { }
explicit Size(const string& s) : w(0), h(0) {
explicit Size(const string& s) {
char c = '\0';
istringstream buf(s);
buf >> w >> c >> h;
@ -102,11 +102,13 @@ struct Size
struct Rect
{
private:
uInt32 top, left; //!< The point at the top left of the rectangle (part of the rect).
uInt32 bottom, right; //!< The point at the bottom right of the rectangle (not part of the rect).
//!< The point at the top left of the rectangle (part of the rect).
uInt32 top{0}, left{0};
//!< The point at the bottom right of the rectangle (not part of the rect).
uInt32 bottom{0}, right{0};
public:
Rect() : top(0), left(0), bottom(0), right(0) { assert(valid()); }
Rect() = default;
explicit Rect(const Size& s) : top(0), left(0), bottom(s.h), right(s.w) { assert(valid()); }
Rect(uInt32 w, uInt32 h) : top(0), left(0), bottom(h), right(w) { assert(valid()); }
Rect(const Point& p, uInt32 w, uInt32 h) : top(p.y), left(p.x), bottom(h), right(w) { assert(valid()); }

View File

@ -170,22 +170,22 @@ class RewindManager
OSystem& myOSystem;
StateManager& myStateManager;
uInt32 mySize;
uInt32 myUncompressed;
uInt32 myInterval;
uInt64 myHorizon;
double myFactor;
bool myLastTimeMachineAdd;
uInt32 myStateSize;
uInt32 mySize{0};
uInt32 myUncompressed{0};
uInt32 myInterval{0};
uInt64 myHorizon{0};
double myFactor{0.0};
bool myLastTimeMachineAdd{false};
uInt32 myStateSize{0};
struct RewindState {
Serializer data; // actual save state
string message; // describes save state origin
uInt64 cycles; // cycles since emulation started
uInt64 cycles{0}; // cycles since emulation started
// We do nothing on object instantiation or copy
// The goal of LinkedObjectPool is to not do any allocations at all
RewindState() : cycles(0) { }
RewindState() = default;
RewindState(const RewindState& rs) : cycles(rs.cycles) { }
RewindState& operator= (const RewindState& rs) { cycles = rs.cycles; return *this; }

View File

@ -32,12 +32,12 @@ class FixedStack
{
private:
std::array<T, CAPACITY> _stack;
uInt32 _size;
uInt32 _size{0};
public:
using StackFunction = std::function<void(T&)>;
FixedStack<T, CAPACITY>() : _size(0) { }
FixedStack<T, CAPACITY>() { }
bool empty() const { return _size <= 0; }
bool full() const { return _size >= CAPACITY; }

View File

@ -17,12 +17,6 @@
#include "ThreadDebugging.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ThreadDebuggingHelper::ThreadDebuggingHelper()
: myMainThreadIdConfigured(false)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ThreadDebuggingHelper& ThreadDebuggingHelper::instance()
{

View File

@ -48,11 +48,11 @@ class ThreadDebuggingHelper {
[[noreturn]] void fail(const string& message);
ThreadDebuggingHelper();
ThreadDebuggingHelper() = default;
std::thread::id myMainThreadId;
bool myMainThreadIdConfigured;
bool myMainThreadIdConfigured{false};
private:

View File

@ -21,8 +21,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TimerManager::TimerManager()
: nextId(no_timer + 1),
queue(),
done(false)
queue()
{
}
@ -231,13 +230,6 @@ bool TimerManager::destroy_impl(ScopedLock& lock, TimerMap::iterator i,
// TimerManager::Timer implementation
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TimerManager::Timer::Timer(TimerId tid)
: id(tid),
running(false)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TimerManager::Timer::Timer(Timer&& r) noexcept
: id(r.id),
@ -254,7 +246,6 @@ TimerManager::Timer::Timer(TimerId tid, Timestamp tnext, Duration tperiod,
: id(tid),
next(tnext),
period(tperiod),
handler(func),
running(false)
handler(func)
{
}

View File

@ -146,7 +146,7 @@ class TimerManager
struct Timer
{
explicit Timer(TimerId id = 0);
explicit Timer(TimerId tid = 0) : id(tid) { }
Timer(Timer&& r) noexcept;
Timer& operator=(Timer&& r) noexcept;
@ -156,7 +156,7 @@ class TimerManager
Timer(Timer const& r) = delete;
Timer& operator=(Timer const& r) = delete;
TimerId id;
TimerId id{0};
Timestamp next;
Duration period;
TFunction handler;
@ -164,7 +164,7 @@ class TimerManager
// You must be holding the 'sync' lock to assign waitCond
std::unique_ptr<ConditionVar> waitCond;
bool running;
bool running{false};
};
// Comparison functor to sort the timer "queue" by Timer::next
@ -200,7 +200,7 @@ class TimerManager
mutable Lock sync;
ConditionVar wakeUp;
std::thread worker;
bool done;
bool done{false};
// Valid IDs are guaranteed not to be this value
static TimerId constexpr no_timer = TimerId(0);

View File

@ -196,9 +196,6 @@ void ZipHandler::addToCache()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ZipHandler::ZipFile::ZipFile(const string& filename)
: myFilename(filename),
myLength(0),
myRomfiles(0),
myCdPos(0),
myBuffer(make_unique<uInt8[]>(DECOMPRESS_BUFSIZE))
{
std::fill(myBuffer.get(), myBuffer.get() + DECOMPRESS_BUFSIZE, 0);
@ -512,31 +509,4 @@ void ZipHandler::ZipFile::decompressDataType8(
throw runtime_error(errorMessage(ZipError::DECOMPRESS_ERROR));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ZipHandler::ZipHeader::ZipHeader()
: versionCreated(0),
versionNeeded(0),
bitFlag(0),
compression(0),
fileTime(0),
fileDate(0),
crc(0),
compressedLength(0),
uncompressedLength(0),
startDiskNumber(0),
localHeaderOffset(0)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ZipHandler::ZipEcd::ZipEcd()
: diskNumber(0),
cdStartDiskNumber(0),
cdDiskEntries(0),
cdTotalEntries(0),
cdSize(0),
cdStartDiskOffset(0)
{
}
#endif /* ZIP_SUPPORT */

View File

@ -69,52 +69,46 @@ class ZipHandler
// Contains extracted file header information
struct ZipHeader
{
uInt16 versionCreated; // version made by
uInt16 versionNeeded; // version needed to extract
uInt16 bitFlag; // general purpose bit flag
uInt16 compression; // compression method
uInt16 fileTime; // last mod file time
uInt16 fileDate; // last mod file date
uInt32 crc; // crc-32
uInt64 compressedLength; // compressed size
uInt64 uncompressedLength; // uncompressed size
uInt32 startDiskNumber; // disk number start
uInt64 localHeaderOffset; // relative offset of local header
string filename; // filename
/** Constructor */
ZipHeader();
uInt16 versionCreated{0}; // version made by
uInt16 versionNeeded{0}; // version needed to extract
uInt16 bitFlag{0}; // general purpose bit flag
uInt16 compression{0}; // compression method
uInt16 fileTime{0}; // last mod file time
uInt16 fileDate{0}; // last mod file date
uInt32 crc{0}; // crc-32
uInt64 compressedLength{0}; // compressed size
uInt64 uncompressedLength{0}; // uncompressed size
uInt32 startDiskNumber{0}; // disk number start
uInt64 localHeaderOffset{0}; // relative offset of local header
string filename; // filename
};
// Contains extracted end of central directory information
struct ZipEcd
{
uInt32 diskNumber; // number of this disk
uInt32 cdStartDiskNumber; // number of the disk with the start of the central directory
uInt64 cdDiskEntries; // total number of entries in the central directory on this disk
uInt64 cdTotalEntries; // total number of entries in the central directory
uInt64 cdSize; // size of the central directory
uInt64 cdStartDiskOffset; // offset of start of central directory with respect to the starting disk number
/** Constructor */
ZipEcd();
uInt32 diskNumber{0}; // number of this disk
uInt32 cdStartDiskNumber{0}; // number of the disk with the start of the central directory
uInt64 cdDiskEntries{0}; // total number of entries in the central directory on this disk
uInt64 cdTotalEntries{0}; // total number of entries in the central directory
uInt64 cdSize{0}; // size of the central directory
uInt64 cdStartDiskOffset{0}; // offset of start of central directory with respect to the starting disk number
};
// Describes an open ZIP file
struct ZipFile
{
string myFilename; // copy of ZIP filename (for caching)
fstream myStream; // C++ fstream file handle
uInt64 myLength; // length of zip file
uInt16 myRomfiles; // number of ROM files in central directory
string myFilename; // copy of ZIP filename (for caching)
fstream myStream; // C++ fstream file handle
uInt64 myLength{0}; // length of zip file
uInt16 myRomfiles{0}; // number of ROM files in central directory
ZipEcd myEcd; // end of central directory
ZipEcd myEcd; // end of central directory
ByteBuffer myCd; // central directory raw data
uInt64 myCdPos; // position in central directory
ZipHeader myHeader; // current file header
ByteBuffer myCd; // central directory raw data
uInt64 myCdPos{0}; // position in central directory
ZipHeader myHeader; // current file header
ByteBuffer myBuffer; // buffer for decompression
ByteBuffer myBuffer; // buffer for decompression
/** Constructor */
explicit ZipFile(const string& filename);
@ -190,7 +184,7 @@ class ZipHandler
}
private:
const uInt8* const myBuf;
const uInt8* const myBuf{nullptr};
};
class LocalFileHeaderReader : public ReaderBase
@ -289,7 +283,7 @@ class ZipHandler
bool directoryEncryption() const { return bool(myValue & 0x2000); }
private:
uInt16 myValue;
uInt16 myValue{0};
};
private:

View File

@ -57,18 +57,18 @@ class AtariNTSC
struct Setup
{
// Basic parameters
float hue; // -1 = -180 degrees +1 = +180 degrees
float saturation; // -1 = grayscale (0.0) +1 = oversaturated colors (2.0)
float contrast; // -1 = dark (0.5) +1 = light (1.5)
float brightness; // -1 = dark (0.5) +1 = light (1.5)
float sharpness; // edge contrast enhancement/blurring
float hue{0.F}; // -1 = -180 degrees +1 = +180 degrees
float saturation{0.F}; // -1 = grayscale (0.0) +1 = oversaturated colors (2.0)
float contrast{0.F}; // -1 = dark (0.5) +1 = light (1.5)
float brightness{0.F}; // -1 = dark (0.5) +1 = light (1.5)
float sharpness{0.F}; // edge contrast enhancement/blurring
// Advanced parameters
float gamma; // -1 = dark (1.5) +1 = light (0.5)
float resolution; // image resolution
float artifacts; // artifacts caused by color changes
float fringing; // color artifacts caused by brightness changes
float bleed; // color bleed (color resolution reduction)
float gamma{0.F}; // -1 = dark (1.5) +1 = light (0.5)
float resolution{0.F}; // image resolution
float artifacts{0.F}; // artifacts caused by color changes
float fringing{0.F}; // color artifacts caused by brightness changes
float bleed{0.F}; // color bleed (color resolution reduction)
};
// Video format presets
@ -157,19 +157,19 @@ class AtariNTSC
// Rendering threads
unique_ptr<std::thread[]> myThreads; // NOLINT
// Number of rendering and total threads
uInt32 myWorkerThreads, myTotalThreads;
uInt32 myWorkerThreads{0}, myTotalThreads{0};
struct init_t
{
std::array<float, burst_count * 6> to_rgb;
std::array<float, gamma_size> to_float;
float contrast;
float brightness;
float artifacts;
float fringing;
float contrast{0.F};
float brightness{0.F};
float artifacts{0.F};
float fringing{0.F};
std::array<float, rescale_out * kernel_size * 2> kernel;
init_t() : contrast(0.0), brightness(0.0), artifacts(0.0), fringing(0.0) {
init_t() {
to_rgb.fill(0.0);
to_float.fill(0.0);
kernel.fill(0.0);

View File

@ -23,14 +23,6 @@
constexpr float scaleFrom100(float x) { return (x/50.F) - 1.F; }
constexpr uInt32 scaleTo100(float x) { return uInt32(50*(x+1.F)); }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NTSCFilter::NTSCFilter()
: mySetup(AtariNTSC::TV_Composite),
myPreset(Preset::OFF),
myCurrentAdjustable(0)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string NTSCFilter::setPreset(Preset preset)
{

View File

@ -35,7 +35,7 @@ class Settings;
class NTSCFilter
{
public:
NTSCFilter();
NTSCFilter() = default;
public:
// Set one of the available preset adjustments (Composite, S-Video, RGB, etc)
@ -125,20 +125,20 @@ class NTSCFilter
// Contains controls used to adjust the palette in the NTSC filter
// This is the main setup object used by the underlying ntsc code
AtariNTSC::Setup mySetup;
AtariNTSC::Setup mySetup{AtariNTSC::TV_Composite};
// This setup is used only in custom mode (after it is modified,
// it is copied to mySetup)
static AtariNTSC::Setup myCustomSetup;
// Current preset in use
Preset myPreset;
Preset myPreset{Preset::OFF};
struct AdjustableTag {
const char* const type;
float* value;
const char* const type{nullptr};
float* value{nullptr};
};
uInt32 myCurrentAdjustable;
uInt32 myCurrentAdjustable{0};
static const std::array<AdjustableTag, 10> ourCustomAdjustables;
private:

View File

@ -35,20 +35,14 @@ class BreakpointMap
public:
// breakpoint flags
static const uInt32 ONE_SHOT = 1 << 0; // used for 'trace' command
static const uInt8 ANY_BANK = 255; // breakpoint valid in any bank
struct Breakpoint
{
uInt16 addr;
uInt8 bank;
uInt16 addr{0};
uInt8 bank{0};
Breakpoint() : addr(0), bank(0) { }
explicit Breakpoint(uInt16 c_addr, uInt8 c_bank) : addr(c_addr), bank(c_bank) { }
Breakpoint(const Breakpoint&) = default;
Breakpoint& operator=(const Breakpoint&) = default;
Breakpoint(Breakpoint&&) = default;
Breakpoint& operator=(Breakpoint&&) = default;
bool operator==(const Breakpoint& other) const
{
@ -68,7 +62,7 @@ class BreakpointMap
};
using BreakpointList = std::vector<Breakpoint>;
BreakpointMap() : myInitialized(false) { }
BreakpointMap() = default;
bool isInitialized() const { return myInitialized; }
@ -107,7 +101,7 @@ class BreakpointMap
};
std::unordered_map<Breakpoint, uInt32, BreakpointHash> myMap;
bool myInitialized;
bool myInitialized{false};
// Following constructors and assignment operators not supported
BreakpointMap(const BreakpointMap&) = delete;

View File

@ -45,10 +45,7 @@ using std::right;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem)
: DebuggerSystem(dbg, console),
myOSystem(osystem),
myDebugWidget(nullptr),
myAddrToLineIsROM(true),
myLabelLength(8) // longest pre-defined label
myOSystem(osystem)
{
// Add case sensitive compare for user labels
// TODO - should user labels be case insensitive too?

View File

@ -70,19 +70,19 @@ class CartDebug : public DebuggerSystem
WRITE = TCODE // 0x40, address written to
};
struct DisassemblyTag {
DisasmType type;
uInt16 address;
DisasmType type{NONE};
uInt16 address{0};
string label;
string disasm;
string ccount;
string ctotal;
string bytes;
bool hllabel;
bool hllabel{false};
};
using DisassemblyList = vector<DisassemblyTag>;
struct Disassembly {
DisassemblyList list;
int fieldwidth;
int fieldwidth{0};
};
// Determine 'type' of address (ie, what part of the system accessed)
@ -260,22 +260,20 @@ class CartDebug : public DebuggerSystem
using AddrTypeArray = std::array<uInt8, 0x1000>;
struct DirectiveTag {
DisasmType type;
uInt16 start;
uInt16 end;
DisasmType type{NONE};
uInt16 start{0};
uInt16 end{0};
};
using AddressList = std::list<uInt16>;
using DirectiveList = std::list<DirectiveTag>;
struct BankInfo {
uInt16 start; // start of address space
uInt16 end; // end of address space
uInt16 offset; // ORG value
size_t size; // size of a bank (in bytes)
uInt16 start{0}; // start of address space
uInt16 end{0}; // end of address space
uInt16 offset{0}; // ORG value
size_t size{0}; // size of a bank (in bytes)
AddressList addressList; // addresses which PC has hit
DirectiveList directiveList; // overrides for automatic code determination
BankInfo() : start(0), end(0), offset(0), size(0) { }
};
// Address type information determined by Distella
@ -316,7 +314,7 @@ class CartDebug : public DebuggerSystem
CartState myState;
CartState myOldState;
CartDebugWidget* myDebugWidget;
CartDebugWidget* myDebugWidget{nullptr};
// A complete record of relevant diassembly information for each bank
vector<BankInfo> myBankInfo;
@ -325,7 +323,7 @@ class CartDebug : public DebuggerSystem
// to corresponding lines of text in that display
Disassembly myDisassembly;
std::map<uInt16, int> myAddrToLineList;
bool myAddrToLineIsROM;
bool myAddrToLineIsROM{true};
// Mappings from label to address (and vice versa) for items
// defined by the user (either through a DASM symbol file or manually
@ -346,7 +344,7 @@ class CartDebug : public DebuggerSystem
LabelToAddr mySystemAddresses;
// The maximum length of all labels currently defined
uInt16 myLabelLength;
uInt16 myLabelLength{8}; // longest pre-defined label
// Filenames to use for various I/O (currently these are hardcoded)
string myListFile, mySymbolFile, myCfgFile, myDisasmFile, myRomFile;

View File

@ -30,11 +30,9 @@ using CpuMethod = int (CpuDebug::*)() const;
class CpuState : public DebuggerState
{
public:
int PC, SP, PS, A, X, Y;
int srcS, srcA, srcX, srcY;
int PC{0}, SP{0}, PS{0}, A{0}, X{0}, Y{0};
int srcS{0}, srcA{0}, srcX{0}, srcY{0};
BoolArray PSbits;
CpuState() : PC(0), SP(0), PS(0), A(0), X(0), Y(0), srcS(0), srcA(0), srcX(0), srcY(0) { }
};
class CpuDebug : public DebuggerSystem

View File

@ -27,7 +27,7 @@ class RiotDebug;
class RiotState : public DebuggerState
{
public:
uInt8 SWCHA_R, SWCHA_W, SWACNT, SWCHB_R, SWCHB_W, SWBCNT;
uInt8 SWCHA_R{0}, SWCHA_W{0}, SWACNT{0}, SWCHB_R{0}, SWCHB_W{0}, SWBCNT{0};
BoolArray swchaReadBits;
BoolArray swchaWriteBits;
BoolArray swacntBits;
@ -35,20 +35,12 @@ class RiotState : public DebuggerState
BoolArray swchbWriteBits;
BoolArray swbcntBits;
uInt8 TIM1T, TIM8T, TIM64T, T1024T, INTIM, TIMINT;
Int32 TIMCLKS, INTIMCLKS, TIMDIV;
uInt8 TIM1T{0}, TIM8T{0}, TIM64T{0}, T1024T{0}, INTIM{0}, TIMINT{0};
Int32 TIMCLKS{0}, INTIMCLKS{0}, TIMDIV{0};
// These are actually from the TIA, but are I/O related
uInt8 INPT0, INPT1, INPT2, INPT3, INPT4, INPT5;
bool INPTLatch, INPTDump;
RiotState()
: SWCHA_R(0), SWCHA_W(0), SWACNT(0), SWCHB_R(0), SWCHB_W(0), SWBCNT(0),
TIM1T(0), TIM8T(0), TIM64T(0), T1024T(0), INTIM(0), TIMINT(0),
TIMCLKS(0), INTIMCLKS(0), TIMDIV(0),
INPT0(0), INPT1(0), INPT2(0), INPT3(0), INPT4(0), INPT5(0),
INPTLatch(false), INPTDump(false)
{ }
uInt8 INPT0{0}, INPT1{0}, INPT2{0}, INPT3{0}, INPT4{0}, INPT5{0};
bool INPTLatch{false}, INPTDump{false};
};
class RiotDebug : public DebuggerSystem

View File

@ -23,7 +23,7 @@
class TrapArray
{
public:
TrapArray() : myInitialized(false) {}
TrapArray() = default;
bool isSet(const uInt16 address) const { return myCount[address]; }
bool isClear(const uInt16 address) const { return myCount[address] == 0; }
@ -46,7 +46,7 @@ class TrapArray
std::array<uInt8, 0x10000> myCount;
// Indicates whether we should treat this array as initialized
bool myInitialized;
bool myInitialized{false};
private:
// Following constructors and assignment operators not supported

View File

@ -33,7 +33,7 @@ class System;
class Device : public Serializable
{
public:
Device() : mySystem(nullptr) { }
Device() = default;
virtual ~Device() = default;
public:
@ -114,7 +114,7 @@ class Device : public Serializable
protected:
/// Pointer to the system the device is installed in or the null pointer
System* mySystem;
System* mySystem{nullptr};
private:
// Following constructors and assignment operators not supported

View File

@ -27,9 +27,6 @@ class DispatchResult
public:
DispatchResult()
: myStatus(Status::invalid), myCycles(0), myAddress(0), myWasReadTrap(false) { }
Status getStatus() const { return myStatus; }
uInt64 getCycles() const { return myCycles; }
@ -44,7 +41,8 @@ class DispatchResult
void setOk(uInt64 cycles);
void setDebugger(uInt64 cycles, const string& message = "", int address = -1, bool wasReadTrap = true);
void setDebugger(uInt64 cycles, const string& message = "", int address = -1,
bool wasReadTrap = true);
void setFatal(uInt64 cycles);
@ -66,15 +64,15 @@ class DispatchResult
private:
Status myStatus;
Status myStatus{Status::invalid};
uInt64 myCycles;
uInt64 myCycles{0};
string myMessage;
int myAddress;
int myAddress{0};
bool myWasReadTrap;
bool myWasReadTrap{false};
};
#endif // DISPATCH_RESULT_HXX

View File

@ -31,12 +31,7 @@ namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EmulationTiming::EmulationTiming(FrameLayout frameLayout, ConsoleTiming consoleTiming) :
myFrameLayout(frameLayout),
myConsoleTiming(consoleTiming),
myPlaybackRate(44100),
myPlaybackPeriod(512),
myAudioQueueExtraFragments(1),
myAudioQueueHeadroom(2),
mySpeedFactor(1)
myConsoleTiming(consoleTiming)
{
recalculate();
}

View File

@ -68,22 +68,22 @@ class EmulationTiming {
FrameLayout myFrameLayout;
ConsoleTiming myConsoleTiming;
uInt32 myPlaybackRate;
uInt32 myPlaybackPeriod;
uInt32 myAudioQueueExtraFragments;
uInt32 myAudioQueueHeadroom;
uInt32 myPlaybackRate{44100};
uInt32 myPlaybackPeriod{512};
uInt32 myAudioQueueExtraFragments{1};
uInt32 myAudioQueueHeadroom{2};
uInt32 myMaxCyclesPerTimeslice;
uInt32 myMinCyclesPerTimeslice;
uInt32 myLinesPerFrame;
uInt32 myCyclesPerFrame;
uInt32 myCyclesPerSecond;
uInt32 myAudioFragmentSize;
uInt32 myAudioSampleRate;
uInt32 myAudioQueueCapacity;
uInt32 myPrebufferFragmentCount;
uInt32 myMaxCyclesPerTimeslice{0};
uInt32 myMinCyclesPerTimeslice{0};
uInt32 myLinesPerFrame{0};
uInt32 myCyclesPerFrame{0};
uInt32 myCyclesPerSecond{0};
uInt32 myAudioFragmentSize{0};
uInt32 myAudioSampleRate{0};
uInt32 myAudioQueueCapacity{0};
uInt32 myPrebufferFragmentCount{0};
double mySpeedFactor;
double mySpeedFactor{1.0};
private:

View File

@ -25,14 +25,6 @@ using namespace std::chrono;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EmulationWorker::EmulationWorker()
: myPendingSignal(Signal::none),
myState(State::initializing),
myTia(nullptr),
myCyclesPerSecond(0),
myMaxCycles(0),
myMinCycles(0),
myDispatchResult(nullptr),
myTotalCycles(0)
{
std::mutex mutex;
std::unique_lock<std::mutex> lock(mutex);

View File

@ -183,19 +183,19 @@ class EmulationWorker
std::exception_ptr myPendingException;
// Any pending signal (or Signal::none)
Signal myPendingSignal;
Signal myPendingSignal{Signal::none};
// The initial access to myState is not synchronized -> make this atomic
std::atomic<State> myState;
std::atomic<State> myState{State::initializing};
// Emulation parameters
TIA* myTia;
uInt64 myCyclesPerSecond;
uInt64 myMaxCycles;
uInt64 myMinCycles;
DispatchResult* myDispatchResult;
TIA* myTia{nullptr};
uInt64 myCyclesPerSecond{0};
uInt64 myMaxCycles{0};
uInt64 myMinCycles{0};
DispatchResult* myDispatchResult{nullptr};
// Total number of cycles during this emulation run
uInt64 myTotalCycles;
uInt64 myTotalCycles{0};
// 6507 time
std::chrono::time_point<std::chrono::high_resolution_clock> myVirtualTime;

View File

@ -25,19 +25,6 @@
#include "Font.hxx"
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FBSurface::FBSurface()
: myPixels(nullptr),
myPitch(0)
{
// NOTE: myPixels and myPitch MUST be set in child classes that inherit
// from this class
// Set default attributes
myAttributes.blending = false;
myAttributes.blendalpha = 100;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FBSurface::readPixels(uInt8* buffer, uInt32 pitch, const Common::Rect& rect) const
{

View File

@ -40,12 +40,15 @@ namespace Common {
is responsible for extending an FBSurface object suitable to the
FrameBuffer type.
NOTE: myPixels and myPitch MUST be set in child classes that inherit
from this class
@author Stephen Anthony
*/
class FBSurface
{
public:
FBSurface();
FBSurface() = default;
virtual ~FBSurface() = default;
/**
@ -327,8 +330,8 @@ class FBSurface
the specific functionality actually exists.
*/
struct Attributes {
bool blending; // Blending is enabled
uInt32 blendalpha; // Alpha to use in blending mode (0-100%)
bool blending{false}; // Blending is enabled
uInt32 blendalpha{100}; // Alpha to use in blending mode (0-100%)
bool operator==(const Attributes& other) const {
return blendalpha == other.blendalpha && blending == other.blending;
@ -374,8 +377,8 @@ class FBSurface
bool isWhiteSpace(const char s) const;
protected:
uInt32* myPixels;
uInt32 myPitch;
uInt32* myPixels{nullptr}; // NOTE: MUST be set in child classes
uInt32 myPitch{0}; // NOTE: MUST be set in child classes
Attributes myAttributes;

View File

@ -47,17 +47,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBuffer::FrameBuffer(OSystem& osystem)
: myOSystem(osystem),
myNumDisplays(1),
myInitializedCount(0),
myPausedCount(0),
myStatsEnabled(false),
myLastScanlines(0),
myGrabMouse(false),
myHiDPIAllowed(false),
myHiDPIEnabled(false),
myCurrentModeList(nullptr),
myTIAMaxZoom(1.0)
: myOSystem(osystem)
{
}
@ -1021,15 +1011,6 @@ const FrameBuffer::VideoMode& FrameBuffer::getSavedVidMode(bool fullscreen)
//
// VideoMode implementation
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBuffer::VideoMode::VideoMode()
: stretch(VideoMode::Stretch::None),
description(""),
zoom(1),
fsIndex(-1)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBuffer::VideoMode::VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh,
Stretch smode, float overscan, const string& desc,
@ -1116,12 +1097,6 @@ FrameBuffer::VideoMode::VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh,
//
// VideoModeList implementation
//
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameBuffer::VideoModeList::VideoModeList()
: myIdx(-1)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::VideoModeList::add(const VideoMode& mode)
{

View File

@ -61,13 +61,13 @@ class FrameBuffer
Common::Rect image;
Common::Size screen;
Stretch stretch;
Stretch stretch{VideoMode::Stretch::None};
string description;
float zoom;
Int32 fsIndex;
float zoom{1.F};
Int32 fsIndex{-1};
VideoMode();
VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh, Stretch smode, float overscan = 1.0,
VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh,
Stretch smode, float overscan = 1.F,
const string& desc = "", float zoomLevel = 1, Int32 fsindex = -1);
friend ostream& operator<<(ostream& os, const VideoMode& vm)
@ -408,7 +408,7 @@ class FrameBuffer
/**
This method is called to create a surface with the given attributes.
z
@param w The requested width of the new surface.
@param h The requested height of the new surface.
@param interpolation Interpolation mode
@ -499,10 +499,6 @@ z
class VideoModeList
{
public:
VideoModeList();
VideoModeList(const VideoModeList&) = default;
VideoModeList& operator=(const VideoModeList&) = default;
void add(const FrameBuffer::VideoMode& mode);
void clear();
@ -525,7 +521,7 @@ z
private:
vector<FrameBuffer::VideoMode> myModeList;
int myIdx;
int myIdx{-1};
};
protected:
@ -533,7 +529,7 @@ z
string myScreenTitle;
// Number of displays
int myNumDisplays;
int myNumDisplays{1};
// The resolution of the attached displays in fullscreen mode
// The primary display is typically the first in the array
@ -545,10 +541,10 @@ z
void drawFrameStats(float framesPerSecond);
// Indicates the number of times the framebuffer was initialized
uInt32 myInitializedCount;
uInt32 myInitializedCount{0};
// Used to set intervals between messages while in pause mode
Int32 myPausedCount;
Int32 myPausedCount{0};
// Dimensions of the actual image, after zooming, and taking into account
// any image 'centering'
@ -592,33 +588,29 @@ z
// (scanline count and framerate)
struct Message {
string text;
int counter;
int x, y, w, h;
MessagePosition position;
ColorId color;
int counter{-1};
int x{0}, y{0}, w{0}, h{0};
MessagePosition position{MessagePosition::BottomCenter};
ColorId color{kNone};
shared_ptr<FBSurface> surface;
bool enabled;
Message()
: counter(-1), x(0), y(0), w(0), h(0), position(MessagePosition::BottomCenter),
color(kNone), enabled(false) { }
bool enabled{false};
};
Message myMsg;
Message myStatsMsg;
bool myStatsEnabled;
uInt32 myLastScanlines;
bool myStatsEnabled{false};
uInt32 myLastScanlines{0};
bool myGrabMouse;
bool myHiDPIAllowed;
bool myHiDPIEnabled;
bool myGrabMouse{false};
bool myHiDPIAllowed{false};
bool myHiDPIEnabled{false};
// The list of all available video modes for this framebuffer
VideoModeList* myCurrentModeList;
VideoModeList* myCurrentModeList{nullptr};
VideoModeList myWindowedModeList;
vector<VideoModeList> myFullscreenModeLists;
// Maximum TIA zoom level that can be used for this framebuffer
float myTIAMaxZoom;
float myTIAMaxZoom{1.F};
// Holds a reference to all the surfaces that have been created
vector<shared_ptr<FBSurface>> mySurfaceList;

View File

@ -53,36 +53,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
M6502::M6502(const Settings& settings)
: myExecutionStatus(0),
mySystem(nullptr),
mySettings(settings),
A(0), X(0), Y(0), SP(0), IR(0), PC(0),
N(false), V(false), B(false), D(false), I(false), notZ(false), C(false),
icycles(0),
myNumberOfDistinctAccesses(0),
myLastAddress(0),
myLastBreakCycle(ULLONG_MAX),
myLastPeekAddress(0),
myLastPokeAddress(0),
myLastPeekBaseAddress(0),
myLastPokeBaseAddress(0),
myFlags(DISASM_NONE),
myLastSrcAddressS(-1),
myLastSrcAddressA(-1),
myLastSrcAddressX(-1),
myLastSrcAddressY(-1),
myDataAddressForPoke(0),
myOnHaltCallback(nullptr),
myHaltRequested(false),
myGhostReadsTrap(false),
myReadFromWritePortBreak(false),
myWriteToReadPortBreak(false),
myStepStateByInstruction(false)
: mySettings(settings)
{
#ifdef DEBUGGER_SUPPORT
myDebugger = nullptr;
myJustHitReadTrapFlag = myJustHitWriteTrapFlag = false;
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -336,68 +336,68 @@ class M6502 : public Serializable
MaskableInterruptBit = 0x04,
NonmaskableInterruptBit = 0x08
;
uInt8 myExecutionStatus;
uInt8 myExecutionStatus{0};
/// Pointer to the system the processor is installed in or the null pointer
System* mySystem;
System* mySystem{nullptr};
/// Reference to the settings
const Settings& mySettings;
uInt8 A; // Accumulator
uInt8 X; // X index register
uInt8 Y; // Y index register
uInt8 SP; // Stack Pointer
uInt8 IR; // Instruction register
uInt16 PC; // Program Counter
uInt8 A{0}; // Accumulator
uInt8 X{0}; // X index register
uInt8 Y{0}; // Y index register
uInt8 SP{0}; // Stack Pointer
uInt8 IR{0}; // Instruction register
uInt16 PC{0}; // Program Counter
bool N; // N flag for processor status register
bool V; // V flag for processor status register
bool B; // B flag for processor status register
bool D; // D flag for processor status register
bool I; // I flag for processor status register
bool notZ; // Z flag complement for processor status register
bool C; // C flag for processor status register
bool N{false}; // N flag for processor status register
bool V{false}; // V flag for processor status register
bool B{false}; // B flag for processor status register
bool D{false}; // D flag for processor status register
bool I{false}; // I flag for processor status register
bool notZ{false}; // Z flag complement for processor status register
bool C{false}; // C flag for processor status register
uInt8 icycles; // cycles of last instruction
uInt8 icycles{0}; // cycles of last instruction
/// Indicates the numer of distinct memory accesses
uInt32 myNumberOfDistinctAccesses;
uInt32 myNumberOfDistinctAccesses{0};
/// Indicates the last address which was accessed
uInt16 myLastAddress;
uInt16 myLastAddress{0};
/// Last cycle that triggered a breakpoint
uInt64 myLastBreakCycle;
uInt64 myLastBreakCycle{ULLONG_MAX};
/// Indicates the last address which was accessed specifically
/// by a peek or poke command
uInt16 myLastPeekAddress, myLastPokeAddress;
uInt16 myLastPeekAddress{0}, myLastPokeAddress{0};
/// Indicates the last base (= non-mirrored) address which was
/// accessed specifically by a peek or poke command
uInt16 myLastPeekBaseAddress, myLastPokeBaseAddress;
uInt16 myLastPeekBaseAddress{0}, myLastPokeBaseAddress{0};
// Indicates the type of the last access
uInt8 myFlags;
uInt8 myFlags{0};
/// Indicates the last address used to access data by a peek command
/// for the CPU registers (S/A/X/Y)
Int32 myLastSrcAddressS, myLastSrcAddressA,
myLastSrcAddressX, myLastSrcAddressY;
Int32 myLastSrcAddressS{-1}, myLastSrcAddressA{-1},
myLastSrcAddressX{-1}, myLastSrcAddressY{-1};
/// Indicates the data address used by the last command that performed
/// a poke (currently, the last address used by STx)
/// If an address wasn't used (ie, as in immediate mode), the address
/// is set to zero
uInt16 myDataAddressForPoke;
uInt16 myDataAddressForPoke{0};
/// Indicates the number of system cycles per processor cycle
static constexpr uInt32 SYSTEM_CYCLES_PER_CPU = 1;
/// Called when the processor enters halt state
onHaltCallback myOnHaltCallback;
onHaltCallback myOnHaltCallback{nullptr};
/// Indicates whether RDY was pulled low
bool myHaltRequested;
bool myHaltRequested{false};
#ifdef DEBUGGER_SUPPORT
Int32 evalCondBreaks() {
@ -427,19 +427,17 @@ class M6502 : public Serializable
}
/// Pointer to the debugger for this processor or the null pointer
Debugger* myDebugger;
Debugger* myDebugger{nullptr};
// Addresses for which the specified action should occur
TrapArray myReadTraps, myWriteTraps;
// Did we just now hit a trap?
bool myJustHitReadTrapFlag;
bool myJustHitWriteTrapFlag;
bool myJustHitReadTrapFlag{false};
bool myJustHitWriteTrapFlag{false};
struct HitTrapInfo {
string message;
int address;
HitTrapInfo() : message(""), address(0) { }
int address{0};
};
HitTrapInfo myHitTrapInfo;
@ -452,10 +450,10 @@ class M6502 : public Serializable
StringList myTrapCondNames;
#endif // DEBUGGER_SUPPORT
bool myGhostReadsTrap; // trap on ghost reads
bool myReadFromWritePortBreak; // trap on reads from write ports
bool myWriteToReadPortBreak; // trap on writes to read ports
bool myStepStateByInstruction;
bool myGhostReadsTrap{false}; // trap on ghost reads
bool myReadFromWritePortBreak{false}; // trap on reads from write ports
bool myWriteToReadPortBreak{false}; // trap on writes to read ports
bool myStepStateByInstruction{false};
private:
// Following constructors and assignment operators not supported

View File

@ -70,15 +70,8 @@
using namespace std::chrono;
namespace {
constexpr uInt32 FPS_METER_QUEUE_SIZE = 100;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystem::OSystem()
: myLauncherUsed(false),
myQuitLoop(false),
myFpsMeter(FPS_METER_QUEUE_SIZE)
{
// Get built-in features
#ifdef SOUND_SUPPORT

View File

@ -502,10 +502,10 @@ class OSystem
unique_ptr<TimerManager> myTimerManager;
// Indicates whether ROM launcher was ever opened during this run
bool myLauncherUsed;
bool myLauncherUsed{false};
// Indicates whether to stop the main loop
bool myQuitLoop;
bool myQuitLoop{false};
private:
string myBaseDir;
@ -527,7 +527,8 @@ class OSystem
string myFeatures;
string myBuildInfo;
FpsMeter myFpsMeter;
static constexpr uInt32 FPS_METER_QUEUE_SIZE = 100;
FpsMeter myFpsMeter{FPS_METER_QUEUE_SIZE};
// If not empty, a hint for derived classes to use this as the
// base directory (where all settings are stored)

View File

@ -33,11 +33,7 @@ System::System(Random& random, M6502& m6502, M6532& m6532,
myM6502(m6502),
myM6532(m6532),
myTIA(mTIA),
myCart(mCart),
myCycles(0),
myDataBusState(0),
myDataBusLocked(false),
mySystemInAutodetect(false)
myCart(mCart)
{
// Initialize page access table
PageAccess access(&myNullDevice, System::PageAccessType::READ);

View File

@ -260,7 +260,7 @@ class System : public Serializable
to this page, while other values are the base address of an array
to directly access for reads to this page.
*/
uInt8* directPeekBase;
uInt8* directPeekBase{nullptr};
/**
Pointer to a block of memory or the null pointer. The null pointer
@ -268,7 +268,7 @@ class System : public Serializable
to this page, while other values are the base address of an array
to directly access for pokes to this page.
*/
uInt8* directPokeBase;
uInt8* directPokeBase{nullptr};
/**
Pointer to a lookup table for marking an address as CODE. A CODE
@ -277,34 +277,23 @@ class System : public Serializable
conclusively determine if a section of address space is CODE, even
if the disassembler failed to mark it as such.
*/
uInt8* codeAccessBase;
uInt8* codeAccessBase{nullptr};
/**
Pointer to the device associated with this page or to the system's
null device if the page hasn't been mapped to a device.
*/
Device* device;
Device* device{nullptr};
/**
The manner in which the pages are accessed by the system
(READ, WRITE, READWRITE)
*/
PageAccessType type;
PageAccessType type{PageAccessType::READ};
// Constructors
PageAccess()
: directPeekBase(nullptr),
directPokeBase(nullptr),
codeAccessBase(nullptr),
device(nullptr),
type(System::PageAccessType::READ) { }
PageAccess(Device* dev, PageAccessType access)
: directPeekBase(nullptr),
directPokeBase(nullptr),
codeAccessBase(nullptr),
device(dev),
type(access) { }
PageAccess() = default;
PageAccess(Device* dev, PageAccessType access) : device(dev), type(access) { }
};
/**
@ -393,7 +382,7 @@ class System : public Serializable
Cartridge& myCart;
// Number of system cycles executed since last reset
uInt64 myCycles;
uInt64 myCycles{0};
// Null device to use for page which are not installed
NullDevice myNullDevice;
@ -405,17 +394,17 @@ class System : public Serializable
std::array<bool, NUM_PAGES> myPageIsDirtyTable;
// The current state of the Data Bus
uInt8 myDataBusState;
uInt8 myDataBusState{0};
// Whether or not peek() updates the data bus state. This
// is true during normal emulation, and false when the
// debugger is active.
bool myDataBusLocked;
bool myDataBusLocked{false};
// Whether autodetection is currently running (ie, the emulation
// core is attempting to autodetect display settings, cart modes, etc)
// Some parts of the codebase need to act differently in such a case
bool mySystemInAutodetect;
bool mySystemInAutodetect{false};
private:
// Following constructors and assignment operators not supported

View File

@ -32,11 +32,8 @@ namespace {
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Audio::Audio()
: myAudioQueue(nullptr),
myCurrentFragment(nullptr)
{
for (uInt8 i = 0; i <= 0x1e; ++i) myMixingTableSum[i] = mixingTableEntry(i, 0x1e);
for (uInt8 i = 0; i <= 0x0f; ++i) myMixingTableIndividual[i] = mixingTableEntry(i, 0x0f);

View File

@ -51,7 +51,7 @@ class Audio : public Serializable
private:
shared_ptr<AudioQueue> myAudioQueue;
uInt8 myCounter;
uInt8 myCounter{0};
AudioChannel myChannel0;
AudioChannel myChannel1;
@ -59,8 +59,8 @@ class Audio : public Serializable
std::array<Int16, 0x1e + 1> myMixingTableSum;
std::array<Int16, 0x0f + 1> myMixingTableIndividual;
Int16* myCurrentFragment;
uInt32 mySampleIndex;
Int16* myCurrentFragment{nullptr};
uInt32 mySampleIndex{0};
private:
Audio(const Audio&) = delete;

View File

@ -18,13 +18,6 @@
#include "Background.hxx"
#include "TIA.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Background::Background()
: myTIA(nullptr)
{
reset();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Background::reset()
{

View File

@ -26,7 +26,7 @@ class TIA;
class Background : public Serializable
{
public:
Background();
Background() = default;
public:
void setTIA(TIA* tia) { myTIA = tia; }
@ -51,11 +51,11 @@ class Background : public Serializable
void applyColors();
private:
uInt8 myColor;
uInt8 myObjectColor, myDebugColor;
bool myDebugEnabled;
uInt8 myColor{0};
uInt8 myObjectColor{0}, myDebugColor{0};
bool myDebugEnabled{false};
TIA* myTIA;
TIA* myTIA{nullptr};
private:
Background(const Background&) = delete;

View File

@ -51,7 +51,7 @@ class DelayQueue : public Serializable
private:
std::array<DelayQueueMember<capacity>, length> myMembers;
uInt8 myIndex;
uInt8 myIndex{0};
std::array<uInt8, 0xFF> myIndices;
private:
@ -68,7 +68,6 @@ class DelayQueue : public Serializable
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<unsigned length, unsigned capacity>
DelayQueue<length, capacity>::DelayQueue()
: myIndex(0)
{
myIndices.fill(0xFF);
}

View File

@ -26,10 +26,8 @@ class DelayQueueMember : public Serializable {
public:
struct Entry {
uInt8 address;
uInt8 value;
Entry() : address(0), value(0) { }
uInt8 address{0};
uInt8 value{0};
};
public:
@ -50,7 +48,7 @@ class DelayQueueMember : public Serializable {
public:
std::array<Entry, capacity> myEntries;
uInt8 mySize;
uInt8 mySize{0};
private:
DelayQueueMember(const DelayQueueMember<capacity>&) = delete;
@ -67,7 +65,6 @@ class DelayQueueMember : public Serializable {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<unsigned capacity>
DelayQueueMember<capacity>::DelayQueueMember()
: mySize(0)
{
}

View File

@ -18,13 +18,7 @@
#include "AbstractFrameManager.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbstractFrameManager::AbstractFrameManager() :
myIsRendering(false),
myVsync(false),
myVblank(false),
myLayout(FrameLayout::pal),
myOnFrameStart(nullptr),
myOnFrameComplete(nullptr)
AbstractFrameManager::AbstractFrameManager()
{
layout(FrameLayout::ntsc);
}

View File

@ -244,50 +244,50 @@ class AbstractFrameManager : public Serializable
/**
* Rendering flag.
*/
bool myIsRendering;
bool myIsRendering{false};
/**
* Vsync flag.
*/
bool myVsync;
bool myVsync{false};
/**
* Vblank flag.
*/
bool myVblank;
bool myVblank{false};
/**
* Current scanline count in the current frame.
*/
uInt32 myCurrentFrameTotalLines;
uInt32 myCurrentFrameTotalLines{0};
/**
* Total number of scanlines in the last complete frame.
*/
uInt32 myCurrentFrameFinalLines;
uInt32 myCurrentFrameFinalLines{0};
/**
* Total number of scanlines in the second last complete frame.
*/
uInt32 myPreviousFrameFinalLines;
uInt32 myPreviousFrameFinalLines{0};
/**
* Total frame count.
*/
uInt32 myTotalFrames;
uInt32 myTotalFrames{0};
private:
/**
* Current frame layout.
*/
FrameLayout myLayout;
FrameLayout myLayout{FrameLayout::pal};
/**
* The various lifecycle callbacks.
*/
callback myOnFrameStart;
callback myOnFrameComplete;
callback myOnFrameStart{nullptr};
callback myOnFrameComplete{nullptr};
private:

View File

@ -44,10 +44,6 @@ FrameLayout FrameLayoutDetector::detectedLayout() const{
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameLayoutDetector::FrameLayoutDetector()
: myState(State::waitForVsyncStart),
myNtscFrames(0),
myPalFrames(0),
myLinesWaitingForVsyncToStart(0)
{
reset();
}

View File

@ -85,18 +85,18 @@ class FrameLayoutDetector: public AbstractFrameManager {
/**
* The current state.
*/
State myState;
State myState{State::waitForVsyncStart};
/**
* The total number of frames detected as the respective frame layout.
*/
uInt32 myNtscFrames, myPalFrames;
uInt32 myNtscFrames{0}, myPalFrames{0};
/**
* We count the number of scanlines we spend waiting for vsync to be
* toggled. If a threshold is exceeded, we force the transition.
*/
uInt32 myLinesWaitingForVsyncToStart;
uInt32 myLinesWaitingForVsyncToStart{0};
private:

View File

@ -38,18 +38,6 @@ enum Metrics: uInt32 {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameManager::FrameManager()
: myState(State::waitForVsyncStart),
myLineInState(0),
myVsyncLines(0),
myY(0), myLastY(0),
myVblankLines(0),
myKernelLines(0),
myOverscanLines(0),
myFrameLines(0),
myHeight(0),
myYStart(0),
myVcenter(0),
myJitterEnabled(false)
{
reset();
updateYStart();

View File

@ -83,20 +83,20 @@ class FrameManager: public AbstractFrameManager {
private:
State myState;
uInt32 myLineInState;
uInt32 myVsyncLines;
uInt32 myY, myLastY;
State myState{State::waitForVsyncStart};
uInt32 myLineInState{0};
uInt32 myVsyncLines{0};
uInt32 myY{0}, myLastY{0};
uInt32 myVblankLines;
uInt32 myKernelLines;
uInt32 myOverscanLines;
uInt32 myFrameLines;
uInt32 myHeight;
uInt32 myYStart;
Int32 myVcenter;
uInt32 myVblankLines{0};
uInt32 myKernelLines{0};
uInt32 myOverscanLines{0};
uInt32 myFrameLines{0};
uInt32 myHeight{0};
uInt32 myYStart{0};
Int32 myVcenter{0};
bool myJitterEnabled;
bool myJitterEnabled{false};
JitterEmulation myJitterEmulation;

View File

@ -26,8 +26,6 @@ enum Metrics: uInt32 {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
JitterEmulation::JitterEmulation()
: myJitterFactor(0),
myYStart(0)
{
reset();
}

View File

@ -54,21 +54,21 @@ class JitterEmulation: public Serializable {
private:
uInt32 myLastFrameScanlines;
uInt32 myLastFrameScanlines{0};
Int32 myStableFrameFinalLines;
Int32 myStableFrameFinalLines{-1};
uInt32 myStableFrames;
uInt32 myStableFrames{0};
uInt32 myStabilizationCounter;
uInt32 myStabilizationCounter{0};
uInt32 myDestabilizationCounter;
uInt32 myDestabilizationCounter{0};
Int32 myJitter;
Int32 myJitter{0};
Int32 myJitterFactor;
Int32 myJitterFactor{0};
uInt32 myYStart;
uInt32 myYStart{0};
private:

View File

@ -49,23 +49,8 @@ Dialog::Dialog(OSystem& instance, DialogContainer& parent, const GUI::Font& font
const string& title, int x, int y, int w, int h)
: GuiObject(instance, parent, *this, x, y, w, h),
_font(font),
_mouseWidget(nullptr),
_focusedWidget(nullptr),
_dragWidget(nullptr),
_defaultWidget(nullptr),
_okWidget(nullptr),
_cancelWidget(nullptr),
_visible(false),
_onTop(true),
_processCancel(false),
_title(title),
_th(0),
_layer(0),
_surface(nullptr),
_tabID(0),
_flags(Widget::FLAG_ENABLED | Widget::FLAG_BORDER | Widget::FLAG_CLEARBG),
_max_w(0),
_max_h(0)
_flags(Widget::FLAG_ENABLED | Widget::FLAG_BORDER | Widget::FLAG_CLEARBG)
{
setTitle(title);
}

View File

@ -176,25 +176,25 @@ class Dialog : public GuiObject
protected:
const GUI::Font& _font;
Widget* _mouseWidget;
Widget* _focusedWidget;
Widget* _dragWidget;
Widget* _defaultWidget;
Widget* _okWidget;
Widget* _cancelWidget;
Widget* _mouseWidget{nullptr};
Widget* _focusedWidget{nullptr};
Widget* _dragWidget{nullptr};
Widget* _defaultWidget{nullptr};
Widget* _okWidget{nullptr};
Widget* _cancelWidget{nullptr};
bool _visible;
bool _onTop;
bool _processCancel;
bool _visible{false};
bool _onTop{true};
bool _processCancel{false};
string _title;
int _th;
int _layer;
int _th{0};
int _layer{0};
Common::FixedStack<shared_ptr<FBSurface>> mySurfaceStack;
private:
struct Focus {
Widget* widget;
Widget* widget{nullptr};
WidgetArray list;
explicit Focus(Widget* w = nullptr) : widget(w) { }
@ -206,11 +206,11 @@ class Dialog : public GuiObject
using FocusList = vector<Focus>;
struct TabFocus {
TabWidget* widget;
TabWidget* widget{nullptr};
FocusList focus;
uInt32 currentTab;
uInt32 currentTab{0};
explicit TabFocus(TabWidget* w = nullptr) : widget(w), currentTab(0) { }
explicit TabFocus(TabWidget* w = nullptr) : widget(w) { }
virtual ~TabFocus() = default;
TabFocus(const TabFocus&) = default;
@ -228,11 +228,11 @@ class Dialog : public GuiObject
WidgetArray _buttonGroup;
shared_ptr<FBSurface> _surface;
int _tabID;
int _flags;
bool _dirty;
uInt32 _max_w; // maximum wanted width
uInt32 _max_h; // maximum wanted height
int _tabID{0};
int _flags{0};
bool _dirty{false};
uInt32 _max_w{0}; // maximum wanted width
uInt32 _max_h{0}; // maximum wanted height
private:
// Following constructors and assignment operators not supported

View File

@ -56,7 +56,7 @@ class RadioButtonWidget : public CheckboxWidget
class RadioButtonGroup
{
public:
RadioButtonGroup() : mySelected(0) { }
RadioButtonGroup() = default;
// add widget to group
void addWidget(RadioButtonWidget* widget);
@ -67,7 +67,7 @@ class RadioButtonGroup
private:
WidgetArray myWidgets;
uInt32 mySelected;
uInt32 mySelected{0};
private:
// Following constructors and assignment operators not supported

View File

@ -247,8 +247,8 @@ class ButtonWidget : public StaticTextWidget, public CommandSender
void drawWidget(bool hilite) override;
protected:
int _cmd;
bool _repeat; // button repeats
int _cmd{0};
bool _repeat{false}; // button repeats
bool _useBitmap;
const uInt32* _bitmap;
int _bmw, _bmh;

View File

@ -26,18 +26,12 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodePOSIX::FilesystemNodePOSIX()
: _path(ROOT_DIR),
_displayName(_path),
_isValid(true),
_isFile(false),
_isDirectory(true)
_displayName(_path)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNodePOSIX::FilesystemNodePOSIX(const string& path, bool verify)
: _isValid(true),
_isFile(false),
_isDirectory(true)
{
// Default to home directory
_path = path.length() > 0 ? path : "~";

View File

@ -79,9 +79,9 @@ class FilesystemNodePOSIX : public AbstractFSNode
protected:
string _path;
string _displayName;
bool _isValid;
bool _isFile;
bool _isDirectory;
bool _isValid{true};
bool _isFile{false};
bool _isDirectory{true};
private:
/**

View File

@ -28,8 +28,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SerialPortUNIX::SerialPortUNIX()
: SerialPort(),
myHandle(0)
: SerialPort()
{
}

View File

@ -50,7 +50,7 @@ class SerialPortUNIX : public SerialPort
private:
// File descriptor for serial connection
int myHandle;
int myHandle{0};
private:
// Following constructors and assignment operators not supported