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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,17 +23,6 @@
#include "bspf.hxx" #include "bspf.hxx"
#include "PhysicalJoystick.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, void PhysicalJoystick::initialize(int index, const string& desc,
int axes, int buttons, int hats, int /*balls*/) 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 '#' static constexpr char MODE_DELIM = '>'; // must not be '^', '|' or '#'
public: public:
PhysicalJoystick(); PhysicalJoystick() = default;
string getMap() const; string getMap() const;
bool setMap(const string& map); bool setMap(const string& map);
@ -65,10 +65,10 @@ class PhysicalJoystick
JT_2600DAPTOR_RIGHT = 5 JT_2600DAPTOR_RIGHT = 5
}; };
JoyType type; JoyType type{JT_NONE};
int ID; int ID{-1};
string name; string name{"None"};
int numAxes, numButtons, numHats; int numAxes{0}, numButtons{0}, numHats{0};
IntArray axisLastValue; IntArray axisLastValue;
IntArray buttonLast; IntArray buttonLast;

View File

@ -32,12 +32,12 @@ namespace Common {
*/ */
struct Point struct Point
{ {
Int32 x; //!< The horizontal part of the point Int32 x{0}; //!< The horizontal part of the point
Int32 y; //!< The vertical 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(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'; char c = '\0';
istringstream buf(p); istringstream buf(p);
buf >> x >> c >> y; buf >> x >> c >> y;
@ -55,12 +55,12 @@ struct Point
struct Size struct Size
{ {
uInt32 w; //!< The width part of the size uInt32 w{0}; //!< The width part of the size
uInt32 h; //!< The height 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(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'; char c = '\0';
istringstream buf(s); istringstream buf(s);
buf >> w >> c >> h; buf >> w >> c >> h;
@ -102,11 +102,13 @@ struct Size
struct Rect struct Rect
{ {
private: private:
uInt32 top, left; //!< The point at the top left of the rectangle (part of the rect). //!< 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). 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: 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()); } 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(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()); } 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; OSystem& myOSystem;
StateManager& myStateManager; StateManager& myStateManager;
uInt32 mySize; uInt32 mySize{0};
uInt32 myUncompressed; uInt32 myUncompressed{0};
uInt32 myInterval; uInt32 myInterval{0};
uInt64 myHorizon; uInt64 myHorizon{0};
double myFactor; double myFactor{0.0};
bool myLastTimeMachineAdd; bool myLastTimeMachineAdd{false};
uInt32 myStateSize; uInt32 myStateSize{0};
struct RewindState { struct RewindState {
Serializer data; // actual save state Serializer data; // actual save state
string message; // describes save state origin 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 // We do nothing on object instantiation or copy
// The goal of LinkedObjectPool is to not do any allocations at all // 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(const RewindState& rs) : cycles(rs.cycles) { }
RewindState& operator= (const RewindState& rs) { cycles = rs.cycles; return *this; } RewindState& operator= (const RewindState& rs) { cycles = rs.cycles; return *this; }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -196,9 +196,6 @@ void ZipHandler::addToCache()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ZipHandler::ZipFile::ZipFile(const string& filename) ZipHandler::ZipFile::ZipFile(const string& filename)
: myFilename(filename), : myFilename(filename),
myLength(0),
myRomfiles(0),
myCdPos(0),
myBuffer(make_unique<uInt8[]>(DECOMPRESS_BUFSIZE)) myBuffer(make_unique<uInt8[]>(DECOMPRESS_BUFSIZE))
{ {
std::fill(myBuffer.get(), myBuffer.get() + DECOMPRESS_BUFSIZE, 0); std::fill(myBuffer.get(), myBuffer.get() + DECOMPRESS_BUFSIZE, 0);
@ -512,31 +509,4 @@ void ZipHandler::ZipFile::decompressDataType8(
throw runtime_error(errorMessage(ZipError::DECOMPRESS_ERROR)); 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 */ #endif /* ZIP_SUPPORT */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -27,9 +27,6 @@ class DispatchResult
public: public:
DispatchResult()
: myStatus(Status::invalid), myCycles(0), myAddress(0), myWasReadTrap(false) { }
Status getStatus() const { return myStatus; } Status getStatus() const { return myStatus; }
uInt64 getCycles() const { return myCycles; } uInt64 getCycles() const { return myCycles; }
@ -44,7 +41,8 @@ class DispatchResult
void setOk(uInt64 cycles); 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); void setFatal(uInt64 cycles);
@ -66,15 +64,15 @@ class DispatchResult
private: private:
Status myStatus; Status myStatus{Status::invalid};
uInt64 myCycles; uInt64 myCycles{0};
string myMessage; string myMessage;
int myAddress; int myAddress{0};
bool myWasReadTrap; bool myWasReadTrap{false};
}; };
#endif // DISPATCH_RESULT_HXX #endif // DISPATCH_RESULT_HXX

View File

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

View File

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

View File

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

View File

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

View File

@ -25,19 +25,6 @@
#include "Font.hxx" #include "Font.hxx"
#endif #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 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 is responsible for extending an FBSurface object suitable to the
FrameBuffer type. FrameBuffer type.
NOTE: myPixels and myPitch MUST be set in child classes that inherit
from this class
@author Stephen Anthony @author Stephen Anthony
*/ */
class FBSurface class FBSurface
{ {
public: public:
FBSurface(); FBSurface() = default;
virtual ~FBSurface() = default; virtual ~FBSurface() = default;
/** /**
@ -327,8 +330,8 @@ class FBSurface
the specific functionality actually exists. the specific functionality actually exists.
*/ */
struct Attributes { struct Attributes {
bool blending; // Blending is enabled bool blending{false}; // Blending is enabled
uInt32 blendalpha; // Alpha to use in blending mode (0-100%) uInt32 blendalpha{100}; // Alpha to use in blending mode (0-100%)
bool operator==(const Attributes& other) const { bool operator==(const Attributes& other) const {
return blendalpha == other.blendalpha && blending == other.blending; return blendalpha == other.blendalpha && blending == other.blending;
@ -374,8 +377,8 @@ class FBSurface
bool isWhiteSpace(const char s) const; bool isWhiteSpace(const char s) const;
protected: protected:
uInt32* myPixels; uInt32* myPixels{nullptr}; // NOTE: MUST be set in child classes
uInt32 myPitch; uInt32 myPitch{0}; // NOTE: MUST be set in child classes
Attributes myAttributes; Attributes myAttributes;

View File

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

View File

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

View File

@ -53,36 +53,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
M6502::M6502(const Settings& settings) M6502::M6502(const Settings& settings)
: myExecutionStatus(0), : mySettings(settings)
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)
{ {
#ifdef DEBUGGER_SUPPORT
myDebugger = nullptr;
myJustHitReadTrapFlag = myJustHitWriteTrapFlag = false;
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

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

View File

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

View File

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

View File

@ -33,11 +33,7 @@ System::System(Random& random, M6502& m6502, M6532& m6532,
myM6502(m6502), myM6502(m6502),
myM6532(m6532), myM6532(m6532),
myTIA(mTIA), myTIA(mTIA),
myCart(mCart), myCart(mCart)
myCycles(0),
myDataBusState(0),
myDataBusLocked(false),
mySystemInAutodetect(false)
{ {
// Initialize page access table // Initialize page access table
PageAccess access(&myNullDevice, System::PageAccessType::READ); 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 this page, while other values are the base address of an array
to directly access for reads to this page. 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 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 this page, while other values are the base address of an array
to directly access for pokes to this page. 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 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 conclusively determine if a section of address space is CODE, even
if the disassembler failed to mark it as such. 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 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. 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 The manner in which the pages are accessed by the system
(READ, WRITE, READWRITE) (READ, WRITE, READWRITE)
*/ */
PageAccessType type; PageAccessType type{PageAccessType::READ};
// Constructors // Constructors
PageAccess() PageAccess() = default;
: directPeekBase(nullptr), PageAccess(Device* dev, PageAccessType access) : device(dev), type(access) { }
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) { }
}; };
/** /**
@ -393,7 +382,7 @@ class System : public Serializable
Cartridge& myCart; Cartridge& myCart;
// Number of system cycles executed since last reset // Number of system cycles executed since last reset
uInt64 myCycles; uInt64 myCycles{0};
// Null device to use for page which are not installed // Null device to use for page which are not installed
NullDevice myNullDevice; NullDevice myNullDevice;
@ -405,17 +394,17 @@ class System : public Serializable
std::array<bool, NUM_PAGES> myPageIsDirtyTable; std::array<bool, NUM_PAGES> myPageIsDirtyTable;
// The current state of the Data Bus // The current state of the Data Bus
uInt8 myDataBusState; uInt8 myDataBusState{0};
// Whether or not peek() updates the data bus state. This // Whether or not peek() updates the data bus state. This
// is true during normal emulation, and false when the // is true during normal emulation, and false when the
// debugger is active. // debugger is active.
bool myDataBusLocked; bool myDataBusLocked{false};
// Whether autodetection is currently running (ie, the emulation // Whether autodetection is currently running (ie, the emulation
// core is attempting to autodetect display settings, cart modes, etc) // core is attempting to autodetect display settings, cart modes, etc)
// Some parts of the codebase need to act differently in such a case // Some parts of the codebase need to act differently in such a case
bool mySystemInAutodetect; bool mySystemInAutodetect{false};
private: private:
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -38,18 +38,6 @@ enum Metrics: uInt32 {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FrameManager::FrameManager() 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(); reset();
updateYStart(); updateYStart();

View File

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

View File

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

View File

@ -54,21 +54,21 @@ class JitterEmulation: public Serializable {
private: 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: 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) const string& title, int x, int y, int w, int h)
: GuiObject(instance, parent, *this, x, y, w, h), : GuiObject(instance, parent, *this, x, y, w, h),
_font(font), _font(font),
_mouseWidget(nullptr),
_focusedWidget(nullptr),
_dragWidget(nullptr),
_defaultWidget(nullptr),
_okWidget(nullptr),
_cancelWidget(nullptr),
_visible(false),
_onTop(true),
_processCancel(false),
_title(title), _title(title),
_th(0), _flags(Widget::FLAG_ENABLED | Widget::FLAG_BORDER | Widget::FLAG_CLEARBG)
_layer(0),
_surface(nullptr),
_tabID(0),
_flags(Widget::FLAG_ENABLED | Widget::FLAG_BORDER | Widget::FLAG_CLEARBG),
_max_w(0),
_max_h(0)
{ {
setTitle(title); setTitle(title);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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