Fourth pass at updates for warnings from Visual Studio.

This commit is contained in:
Stephen Anthony 2022-04-02 19:25:35 -02:30
parent 11ff4aca4f
commit 40127109c8
56 changed files with 209 additions and 176 deletions

View File

@ -44,7 +44,7 @@ CheatCodeDialog::CheatCodeDialog(OSystem& osystem, DialogContainer& parent,
VBORDER = Dialog::vBorder(), VBORDER = Dialog::vBorder(),
HBORDER = Dialog::hBorder(); HBORDER = Dialog::hBorder();
WidgetArray wid; WidgetArray wid;
ButtonWidget* b; ButtonWidget* b = nullptr;
// Set real dimensions // Set real dimensions
_w = 45 * fontWidth + HBORDER * 2; _w = 45 * fontWidth + HBORDER * 2;

View File

@ -47,7 +47,7 @@ string Base::toString(int value, Common::Base::Fmt outputBase)
case Base::Fmt::_10: // base 10: 3 or 5 bytes (depending on value) case Base::Fmt::_10: // base 10: 3 or 5 bytes (depending on value)
if(value > -0x100 && value < 0x100) if(value > -0x100 && value < 0x100)
std::snprintf(vToS_buf, 5, "%3d", Int16(value)); std::snprintf(vToS_buf, 5, "%3d", static_cast<Int16>(value));
else else
std::snprintf(vToS_buf, 6, "%5d", value); std::snprintf(vToS_buf, 6, "%5d", value);
break; break;

View File

@ -99,8 +99,8 @@ void EventHandlerSDL2::pollEvent()
case SDL_KEYUP: case SDL_KEYUP:
case SDL_KEYDOWN: case SDL_KEYDOWN:
{ {
handleKeyEvent(StellaKey(myEvent.key.keysym.scancode), handleKeyEvent(static_cast<StellaKey>(myEvent.key.keysym.scancode),
StellaMod(myEvent.key.keysym.mod), static_cast<StellaMod>(myEvent.key.keysym.mod),
myEvent.key.type == SDL_KEYDOWN, myEvent.key.type == SDL_KEYDOWN,
myEvent.key.repeat); myEvent.key.repeat);
break; break;

View File

@ -68,6 +68,14 @@ class EventHandlerSDL2 : public EventHandler
private: private:
SDL_Joystick* myStick{nullptr}; SDL_Joystick* myStick{nullptr};
private:
// Following constructors and assignment operators not supported
JoystickSDL2() = delete;
JoystickSDL2(const JoystickSDL2&) = delete;
JoystickSDL2(JoystickSDL2&&) = delete;
JoystickSDL2& operator=(const JoystickSDL2&) = delete;
JoystickSDL2& operator=(JoystickSDL2&&) = delete;
}; };
private: private:

View File

@ -38,7 +38,6 @@ class StaggeredLogger
public: public:
StaggeredLogger(const string& message, Logger::Level level); StaggeredLogger(const string& message, Logger::Level level);
~StaggeredLogger(); ~StaggeredLogger();
void log(); void log();
@ -83,6 +82,13 @@ class StaggeredLogger
// returns. This id is unique per timer and is used to return from the callback // returns. This id is unique per timer and is used to return from the callback
// early in case the time is stale. // early in case the time is stale.
uInt32 myTimerCallbackId{0}; uInt32 myTimerCallbackId{0};
private:
// Following constructors and assignment operators not supported
StaggeredLogger(const StaggeredLogger&) = delete;
StaggeredLogger(StaggeredLogger&&) = delete;
StaggeredLogger& operator=(const StaggeredLogger&) = delete;
StaggeredLogger& operator=(StaggeredLogger&&) = delete;
}; };
#endif // STAGGERED_LOGGER #endif // STAGGERED_LOGGER

View File

@ -146,15 +146,17 @@ class TimerManager
struct Timer struct Timer
{ {
explicit Timer(TimerId tid = 0) : id(tid) { } explicit Timer(TimerId tid = 0) : id{tid} { }
Timer(Timer&& r) noexcept; Timer(Timer&& r) noexcept;
Timer& operator=(Timer&& r) noexcept;
Timer(TimerId id, Timestamp next, Duration period, const TFunction& func) noexcept; Timer(TimerId id, Timestamp next, Duration period, const TFunction& func) noexcept;
// Never called // Never called
Timer() = default;
~Timer() = default;
Timer(Timer const& r) = delete; Timer(Timer const& r) = delete;
Timer& operator=(Timer const& r) = delete; Timer& operator=(Timer const& r) = delete;
Timer& operator=(Timer&& r) = delete;
TimerId id{0}; TimerId id{0};
Timestamp next; Timestamp next;
@ -204,6 +206,13 @@ class TimerManager
// 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);
private:
// Following constructors and assignment operators not supported
TimerManager(const TimerManager&) = delete;
TimerManager(TimerManager&&) = delete;
TimerManager& operator=(const TimerManager&) = delete;
TimerManager& operator=(TimerManager&&) = delete;
}; };
#endif // TIMERTHREAD_H #endif // TIMERTHREAD_H

View File

@ -113,7 +113,7 @@ uInt64 ZipHandler::decompress(ByteBuffer& image)
{ {
if(myZip && myZip->myHeader.uncompressedLength > 0) if(myZip && myZip->myHeader.uncompressedLength > 0)
{ {
uInt64 length = myZip->myHeader.uncompressedLength; const uInt64 length = myZip->myHeader.uncompressedLength;
image = make_unique<uInt8[]>(length); image = make_unique<uInt8[]>(length);
if(image == nullptr) if(image == nullptr)
throw runtime_error(errorMessage(ZipError::OUT_OF_MEMORY)); throw runtime_error(errorMessage(ZipError::OUT_OF_MEMORY));
@ -247,7 +247,7 @@ void ZipHandler::ZipFile::initialize()
// Read the central directory // Read the central directory
uInt64 read_length = 0; uInt64 read_length = 0;
bool success = readStream(myCd, myEcd.cdStartDiskOffset, myEcd.cdSize, read_length); const bool success = readStream(myCd, myEcd.cdStartDiskOffset, myEcd.cdSize, read_length);
if(!success) if(!success)
throw runtime_error(errorMessage(ZipError::FILE_ERROR)); throw runtime_error(errorMessage(ZipError::FILE_ERROR));
else if(read_length != myEcd.cdSize) else if(read_length != myEcd.cdSize)
@ -275,7 +275,7 @@ void ZipHandler::ZipFile::readEcd()
// We may need multiple tries // We may need multiple tries
while(buflen < 65536) while(buflen < 65536)
{ {
uInt64 read_length; uInt64 read_length = 0;
// Max out the buf length at the size of the file // Max out the buf length at the size of the file
if(buflen > myLength) if(buflen > myLength)
@ -287,15 +287,15 @@ void ZipHandler::ZipFile::readEcd()
throw runtime_error(errorMessage(ZipError::OUT_OF_MEMORY)); throw runtime_error(errorMessage(ZipError::OUT_OF_MEMORY));
// Read in one buffers' worth of data // Read in one buffers' worth of data
bool success = readStream(buffer, myLength - buflen, buflen, read_length); const bool success = readStream(buffer, myLength - buflen, buflen, read_length);
if(!success || read_length != buflen) if(!success || read_length != buflen)
throw runtime_error(errorMessage(ZipError::FILE_ERROR)); throw runtime_error(errorMessage(ZipError::FILE_ERROR));
// Find the ECD signature // Find the ECD signature
Int32 offset; Int32 offset = 0;
for(offset = Int32(buflen - EcdReader::minimumLength()); offset >= 0; --offset) for(offset = static_cast<Int32>(buflen - EcdReader::minimumLength()); offset >= 0; --offset)
{ {
EcdReader reader(buffer.get() + offset); const EcdReader reader(buffer.get() + offset);
if(reader.signatureCorrect() && ((reader.totalLength() + offset) <= buflen)) if(reader.signatureCorrect() && ((reader.totalLength() + offset) <= buflen))
break; break;
} }
@ -324,7 +324,7 @@ void ZipHandler::ZipFile::readEcd()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool ZipHandler::ZipFile::readStream(ByteBuffer& out, uInt64 offset, bool ZipHandler::ZipFile::readStream(const ByteBuffer& out, uInt64 offset,
uInt64 length, uInt64& actual) uInt64 length, uInt64& actual)
{ {
try try
@ -368,7 +368,7 @@ const ZipHandler::ZipHeader* ZipHandler::ZipFile::nextFile()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ZipHandler::ZipFile::decompress(ByteBuffer& out, uInt64 length) void ZipHandler::ZipFile::decompress(const ByteBuffer& out, uInt64 length)
{ {
// If we don't have enough buffer, error // If we don't have enough buffer, error
if(length < myHeader.uncompressedLength) if(length < myHeader.uncompressedLength)
@ -381,7 +381,7 @@ void ZipHandler::ZipFile::decompress(ByteBuffer& out, uInt64 length)
try try
{ {
// Get the compressed data offset // Get the compressed data offset
uInt64 offset = getCompressedDataOffset(); const uInt64 offset = getCompressedDataOffset();
// Handle compression types // Handle compression types
switch(myHeader.compression) switch(myHeader.compression)
@ -420,14 +420,14 @@ uInt64 ZipHandler::ZipFile::getCompressedDataOffset()
// Read the fixed-sized part of the local file header // Read the fixed-sized part of the local file header
uInt64 read_length = 0; uInt64 read_length = 0;
bool success = readStream(myBuffer, myHeader.localHeaderOffset, 0x1e, read_length); const bool success = readStream(myBuffer, myHeader.localHeaderOffset, 0x1e, read_length);
if(!success) if(!success)
throw runtime_error(errorMessage(ZipError::FILE_ERROR)); throw runtime_error(errorMessage(ZipError::FILE_ERROR));
else if(read_length != LocalFileHeaderReader::minimumLength()) else if(read_length != LocalFileHeaderReader::minimumLength())
throw runtime_error(errorMessage(ZipError::FILE_TRUNCATED)); throw runtime_error(errorMessage(ZipError::FILE_TRUNCATED));
// Compute the final offset // Compute the final offset
LocalFileHeaderReader reader(&myBuffer[0]); const LocalFileHeaderReader reader(&myBuffer[0]);
if(!reader.signatureCorrect()) if(!reader.signatureCorrect())
throw runtime_error(errorMessage(ZipError::BAD_SIGNATURE)); throw runtime_error(errorMessage(ZipError::BAD_SIGNATURE));
@ -436,11 +436,11 @@ uInt64 ZipHandler::ZipFile::getCompressedDataOffset()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ZipHandler::ZipFile::decompressDataType0( void ZipHandler::ZipFile::decompressDataType0(
uInt64 offset, ByteBuffer& out, uInt64 length) uInt64 offset, const ByteBuffer& out, uInt64 length)
{ {
// The data is uncompressed; just read it // The data is uncompressed; just read it
uInt64 read_length = 0; uInt64 read_length = 0;
bool success = readStream(out, offset, myHeader.compressedLength, read_length); const bool success = readStream(out, offset, myHeader.compressedLength, read_length);
if(!success) if(!success)
throw runtime_error(errorMessage(ZipError::FILE_ERROR)); throw runtime_error(errorMessage(ZipError::FILE_ERROR));
else if(read_length != myHeader.compressedLength) else if(read_length != myHeader.compressedLength)
@ -449,18 +449,18 @@ void ZipHandler::ZipFile::decompressDataType0(
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ZipHandler::ZipFile::decompressDataType8( void ZipHandler::ZipFile::decompressDataType8(
uInt64 offset, ByteBuffer& out, uInt64 length) uInt64 offset, const ByteBuffer& out, uInt64 length)
{ {
uInt64 input_remaining = myHeader.compressedLength; uInt64 input_remaining = myHeader.compressedLength;
// Reset the stream // Reset the stream
z_stream stream; z_stream stream{};
stream.zalloc = Z_NULL; stream.zalloc = Z_NULL;
stream.zfree = Z_NULL; stream.zfree = Z_NULL;
stream.opaque = Z_NULL; stream.opaque = Z_NULL;
stream.avail_in = 0; stream.avail_in = 0;
stream.next_out = reinterpret_cast<Bytef *>(out.get()); stream.next_out = reinterpret_cast<Bytef *>(out.get());
stream.avail_out = uInt32(length); // TODO - use zip64 stream.avail_out = static_cast<uInt32>(length); // TODO - use zip64
// Initialize the decompressor // Initialize the decompressor
int zerr = inflateInit2(&stream, -MAX_WBITS); int zerr = inflateInit2(&stream, -MAX_WBITS);
@ -472,8 +472,8 @@ void ZipHandler::ZipFile::decompressDataType8(
{ {
// Read in the next chunk of data // Read in the next chunk of data
uInt64 read_length = 0; uInt64 read_length = 0;
bool success = readStream(myBuffer, offset, const bool success = readStream(myBuffer, offset,
std::min(input_remaining, uInt64(sizeof(myBuffer.get()))), read_length); std::min(input_remaining, static_cast<uInt64>(sizeof(myBuffer.get()))), read_length);
if(!success) if(!success)
{ {
inflateEnd(&stream); inflateEnd(&stream);
@ -490,7 +490,7 @@ void ZipHandler::ZipFile::decompressDataType8(
// Fill out the input data // Fill out the input data
stream.next_in = myBuffer.get(); stream.next_in = myBuffer.get();
stream.avail_in = uInt32(read_length); // TODO - use zip64 stream.avail_in = static_cast<uInt32>(read_length); // TODO - use zip64
input_remaining -= read_length; input_remaining -= read_length;
// Add a dummy byte at end of compressed data // Add a dummy byte at end of compressed data

View File

@ -126,22 +126,22 @@ class ZipHandler
void readEcd(); void readEcd();
/** Read data from stream */ /** Read data from stream */
bool readStream(ByteBuffer& out, uInt64 offset, uInt64 length, uInt64& actual); bool readStream(const ByteBuffer& out, uInt64 offset, uInt64 length, uInt64& actual);
/** Return the next entry in the ZIP file */ /** Return the next entry in the ZIP file */
const ZipHeader* nextFile(); const ZipHeader* nextFile();
/** Decompress the most recently found file in the ZIP into target buffer */ /** Decompress the most recently found file in the ZIP into target buffer */
void decompress(ByteBuffer& out, uInt64 length); void decompress(const ByteBuffer& out, uInt64 length);
/** Return the offset of the compressed data */ /** Return the offset of the compressed data */
uInt64 getCompressedDataOffset(); uInt64 getCompressedDataOffset();
/** Decompress type 0 data (which is uncompressed) */ /** Decompress type 0 data (which is uncompressed) */
void decompressDataType0(uInt64 offset, ByteBuffer& out, uInt64 length); void decompressDataType0(uInt64 offset, const ByteBuffer& out, uInt64 length);
/** Decompress type 8 data (which is deflated) */ /** Decompress type 8 data (which is deflated) */
void decompressDataType8(uInt64 offset, ByteBuffer& out, uInt64 length); void decompressDataType8(uInt64 offset, const ByteBuffer& out, uInt64 length);
}; };
using ZipFilePtr = unique_ptr<ZipFile>; using ZipFilePtr = unique_ptr<ZipFile>;

View File

@ -28,6 +28,7 @@ class CompositeKeyValueRepositoryAtomic;
class CompositeKeyValueRepository class CompositeKeyValueRepository
{ {
public: public:
CompositeKeyValueRepository() = default;
virtual ~CompositeKeyValueRepository() = default; virtual ~CompositeKeyValueRepository() = default;
@ -38,6 +39,13 @@ class CompositeKeyValueRepository
virtual void remove(const string& key) = 0; virtual void remove(const string& key) = 0;
virtual CompositeKeyValueRepositoryAtomic* atomic() { return nullptr; } virtual CompositeKeyValueRepositoryAtomic* atomic() { return nullptr; }
private:
// Following constructors and assignment operators not supported
CompositeKeyValueRepository(const CompositeKeyValueRepository&) = delete;
CompositeKeyValueRepository(CompositeKeyValueRepository&&) = delete;
CompositeKeyValueRepository& operator=(const CompositeKeyValueRepository&) = delete;
CompositeKeyValueRepository& operator=(CompositeKeyValueRepository&&) = delete;
}; };
class CompositeKeyValueRepositoryAtomic : public CompositeKeyValueRepository class CompositeKeyValueRepositoryAtomic : public CompositeKeyValueRepository

View File

@ -21,7 +21,8 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyValueRepositoryConfigfile::KeyValueRepositoryConfigfile(const FilesystemNode& file) KeyValueRepositoryConfigfile::KeyValueRepositoryConfigfile(const FilesystemNode& file)
: KeyValueRepositoryFile<KeyValueRepositoryConfigfile>(file) : KeyValueRepositoryFile<KeyValueRepositoryConfigfile>(file)
{} {
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
std::map<string, Variant> KeyValueRepositoryConfigfile::load(istream& in) std::map<string, Variant> KeyValueRepositoryConfigfile::load(istream& in)
@ -29,7 +30,7 @@ std::map<string, Variant> KeyValueRepositoryConfigfile::load(istream& in)
std::map<string, Variant> values; std::map<string, Variant> values;
string line, key, value; string line, key, value;
string::size_type equalPos, garbage; string::size_type equalPos = 0, garbage = 0;
while(getline(in, line)) while(getline(in, line))
{ {

View File

@ -32,7 +32,8 @@ namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyValueRepositoryJsonFile::KeyValueRepositoryJsonFile(const FilesystemNode& node) KeyValueRepositoryJsonFile::KeyValueRepositoryJsonFile(const FilesystemNode& node)
: KeyValueRepositoryFile<KeyValueRepositoryJsonFile>(node) : KeyValueRepositoryFile<KeyValueRepositoryJsonFile>(node)
{} {
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
std::map<string, Variant> KeyValueRepositoryJsonFile::load(istream& in) std::map<string, Variant> KeyValueRepositoryJsonFile::load(istream& in)

View File

@ -72,7 +72,8 @@ namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyValueRepositoryPropertyFile::KeyValueRepositoryPropertyFile(const FilesystemNode& node) KeyValueRepositoryPropertyFile::KeyValueRepositoryPropertyFile(const FilesystemNode& node)
: KeyValueRepositoryFile<KeyValueRepositoryPropertyFile>(node) : KeyValueRepositoryFile<KeyValueRepositoryPropertyFile>(node)
{} {
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
std::map<string, Variant> KeyValueRepositoryPropertyFile::load(istream& in) std::map<string, Variant> KeyValueRepositoryPropertyFile::load(istream& in)

View File

@ -80,7 +80,6 @@ bool AbstractKeyValueRepositorySqlite::get(const string& key, Variant& value)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool AbstractKeyValueRepositorySqlite::save(const std::map<string, Variant>& values) bool AbstractKeyValueRepositorySqlite::save(const std::map<string, Variant>& values)
{ {

View File

@ -1,3 +1,20 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2022 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#ifndef ABSTRACT_KEY_VALUE_REPOSITORY_SQLITE_HXX #ifndef ABSTRACT_KEY_VALUE_REPOSITORY_SQLITE_HXX
#define ABSTRACT_KEY_VALUE_REPOSITORY_SQLITE_HXX #define ABSTRACT_KEY_VALUE_REPOSITORY_SQLITE_HXX

View File

@ -50,7 +50,7 @@ bool CompositeKeyValueRepositorySqlite::has(const string& key)
if (!myStmtCountSet->step()) if (!myStmtCountSet->step())
throw SqliteError("count failed"); throw SqliteError("count failed");
Int32 rowCount = myStmtCountSet->columnInt(0); const Int32 rowCount = myStmtCountSet->columnInt(0);
myStmtCountSet->reset(); myStmtCountSet->reset();

View File

@ -62,7 +62,7 @@ SqliteStatement& SqliteStatement::bind(int index, Int32 value)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SqliteStatement::step() bool SqliteStatement::step()
{ {
int result = sqlite3_step(myStmt); const int result = sqlite3_step(myStmt);
if (result == SQLITE_ERROR) throw SqliteError(myHandle); if (result == SQLITE_ERROR) throw SqliteError(myHandle);

View File

@ -200,7 +200,7 @@ void StellaDb::importOldPropset(const FilesystemNode& node)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaDb::migrate() void StellaDb::migrate()
{ {
Int32 version = myDb->getUserVersion(); const Int32 version = myDb->getUserVersion();
switch (version) { switch (version) {
case 1: case 1:
return; return;

View File

@ -42,7 +42,7 @@ class BreakpointMap
uInt16 addr{0}; uInt16 addr{0};
uInt8 bank{0}; uInt8 bank{0};
explicit Breakpoint(uInt16 c_addr, uInt8 c_bank) : addr(c_addr), bank(c_bank) { } explicit constexpr Breakpoint(uInt16 c_addr, uInt8 c_bank) : addr{c_addr}, bank{c_bank} { }
bool operator==(const Breakpoint& other) const bool operator==(const Breakpoint& other) const
{ {

View File

@ -117,7 +117,7 @@ class DivExpression : public Expression
public: public:
DivExpression(Expression* left, Expression* right) : Expression(left, right) { } DivExpression(Expression* left, Expression* right) : Expression(left, right) { }
Int32 evaluate() const override Int32 evaluate() const override
{ int denom = myRHS->evaluate(); { const int denom = myRHS->evaluate();
return denom == 0 ? 0 : myLHS->evaluate() / denom; } return denom == 0 ? 0 : myLHS->evaluate() / denom; }
}; };
@ -250,7 +250,7 @@ class ModExpression : public Expression
public: public:
ModExpression(Expression* left, Expression* right) : Expression(left, right) { } ModExpression(Expression* left, Expression* right) : Expression(left, right) { }
Int32 evaluate() const override Int32 evaluate() const override
{ int rhs = myRHS->evaluate(); { const int rhs = myRHS->evaluate();
return rhs == 0 ? 0 : myLHS->evaluate() % rhs; } return rhs == 0 ? 0 : myLHS->evaluate() % rhs; }
}; };

View File

@ -61,7 +61,7 @@ CartridgeE7Widget::CartridgeE7Widget(
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeE7Widget::initialize(GuiObject* boss, void CartridgeE7Widget::initialize(GuiObject* boss,
CartridgeE7& cart, ostringstream& info) const CartridgeE7& cart, const ostringstream& info)
{ {
const uInt32 size = cart.romBankCount() * cart.BANK_SIZE; const uInt32 size = cart.romBankCount() * cart.BANK_SIZE;

View File

@ -52,7 +52,7 @@ class CartridgeE7Widget : public CartDebugWidget
}; };
protected: protected:
void initialize(GuiObject* boss, CartridgeE7& cart, ostringstream& info); void initialize(GuiObject* boss, const CartridgeE7& cart, const ostringstream& info);
const char* getSpotLower(int idx); const char* getSpotLower(int idx);
const char* getSpotUpper(int idx); const char* getSpotUpper(int idx);

View File

@ -47,8 +47,8 @@ DrivingWidget::DrivingWidget(GuiObject* boss, const GUI::Font& font,
const int lwidth = font.getStringWidth("Right (Driving)"), const int lwidth = font.getStringWidth("Right (Driving)"),
bWidth = font.getStringWidth("Gray code +") + _fontWidth * 1.25; bWidth = font.getStringWidth("Gray code +") + _fontWidth * 1.25;
StaticTextWidget* t = new StaticTextWidget(boss, font, xpos, ypos + 2, lwidth, const StaticTextWidget* t = new StaticTextWidget(boss, font, xpos, ypos + 2, lwidth,
lineHeight, label, TextAlign::Left); lineHeight, label, TextAlign::Left);
ypos = t->getBottom() + _lineHeight * 1.334; ypos = t->getBottom() + _lineHeight * 1.334;
myGrayUp = new ButtonWidget(boss, font, xpos, ypos, bWidth, bHeight, myGrayUp = new ButtonWidget(boss, font, xpos, ypos, bWidth, bHeight,
@ -125,10 +125,7 @@ void DrivingWidget::handleCommand(
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DrivingWidget::setValue(int idx) void DrivingWidget::setValue(int idx)
{ {
int grayCode = ourGrayTable[idx]; const int grayCode = ourGrayTable[idx];
// FIXME * 8 = a nasty hack, because the DataGridWidget does not support 2 digit binary output // FIXME * 8 = a nasty hack, because the DataGridWidget does not support 2 digit binary output
myGrayValue->setList(0, (grayCode & 0b01) + (grayCode & 0b10) * 8); myGrayValue->setList(0, (grayCode & 0b01) + (grayCode & 0b10) * 8);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const std::array<uInt8, 4> DrivingWidget::ourGrayTable = { 0x03, 0x01, 0x00, 0x02 };

View File

@ -44,7 +44,9 @@ class DrivingWidget : public ControllerWidget
int myGrayIndex{0}; int myGrayIndex{0};
static const std::array<uInt8, 4> ourGrayTable; static constexpr std::array<uInt8, 4> ourGrayTable = {
{ 0x03, 0x01, 0x00, 0x02 }
};
private: private:
void loadConfig() override; void loadConfig() override;

View File

@ -26,10 +26,9 @@ GenesisWidget::GenesisWidget(GuiObject* boss, const GUI::Font& font,
const int fontHeight = font.getFontHeight(); const int fontHeight = font.getFontHeight();
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Genesis)"); int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Genesis)");
StaticTextWidget* t;
t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, const StaticTextWidget* t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth,
fontHeight, label, TextAlign::Left); fontHeight, label, TextAlign::Left);
xpos += t->getWidth()/2 - 5; ypos += t->getHeight() + 20; xpos += t->getWidth()/2 - 5; ypos += t->getHeight() + 20;
myPins[kJUp] = new CheckboxWidget(boss, font, xpos, ypos, "", myPins[kJUp] = new CheckboxWidget(boss, font, xpos, ypos, "",
CheckboxWidget::kCheckActionCmd); CheckboxWidget::kCheckActionCmd);
@ -114,6 +113,3 @@ void GenesisWidget::handleCommand(
} }
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
constexpr std::array<Controller::DigitalPin, 5> GenesisWidget::ourPinNo;

View File

@ -30,10 +30,8 @@ JoystickWidget::JoystickWidget(GuiObject* boss, const GUI::Font& font,
{ {
const string& label = getHeader(); const string& label = getHeader();
const int lwidth = font.getStringWidth("Right (Joystick)"); const int lwidth = font.getStringWidth("Right (Joystick)");
StaticTextWidget* t; const StaticTextWidget* t = new StaticTextWidget(boss, font, xpos, ypos + 2, lwidth,
_lineHeight, label, TextAlign::Left);
t = new StaticTextWidget(boss, font, xpos, ypos + 2, lwidth,
_lineHeight, label, TextAlign::Left);
xpos += t->getWidth() / 2 - 5; ypos = t->getBottom() + fontHeight; xpos += t->getWidth() / 2 - 5; ypos = t->getBottom() + fontHeight;
} }
myPins[kJUp] = new CheckboxWidget(boss, font, xpos, ypos, "", myPins[kJUp] = new CheckboxWidget(boss, font, xpos, ypos, "",
@ -91,6 +89,3 @@ void JoystickWidget::handleCommand(
if(cmd == CheckboxWidget::kCheckActionCmd) if(cmd == CheckboxWidget::kCheckActionCmd)
setPin(ourPinNo[id], !myPins[id]->getState()); setPin(ourPinNo[id], !myPins[id]->getState());
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
constexpr std::array<Controller::DigitalPin, 5> JoystickWidget::ourPinNo;

View File

@ -28,10 +28,8 @@ KeyboardWidget::KeyboardWidget(GuiObject* boss, const GUI::Font& font,
const int fontHeight = font.getFontHeight(); const int fontHeight = font.getFontHeight();
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Keyboard)"); int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Keyboard)");
StaticTextWidget* t; const StaticTextWidget* t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth,
fontHeight, label, TextAlign::Left);
t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth,
fontHeight, label, TextAlign::Left);
xpos += 30; ypos += t->getHeight() + 20; xpos += 30; ypos += t->getHeight() + 20;
@ -67,7 +65,3 @@ void KeyboardWidget::handleCommand(
if(cmd == CheckboxWidget::kCheckActionCmd) if(cmd == CheckboxWidget::kCheckActionCmd)
instance().eventHandler().handleEvent(myEvent[id], myBox[id]->getState()); instance().eventHandler().handleEvent(myEvent[id], myBox[id]->getState());
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
constexpr std::array<Event::Type, 12> KeyboardWidget::ourLeftEvents;
constexpr std::array<Event::Type, 12> KeyboardWidget::ourRightEvents;

View File

@ -29,9 +29,8 @@ PointingDeviceWidget::PointingDeviceWidget(GuiObject* boss, const GUI::Font& fon
xMid = xLeft + 30, xMid = xLeft + 30,
xRight = xLeft + 60, xRight = xLeft + 60,
xValue = xLeft + 87; xValue = xLeft + 87;
StaticTextWidget* t; const StaticTextWidget* t = new StaticTextWidget(boss, font,
x, y + 2, getHeader());
t = new StaticTextWidget(boss, font, x, y + 2, getHeader());
ypos += t->getHeight() + 8; ypos += t->getHeight() + 8;
// add gray code and up widgets // add gray code and up widgets

View File

@ -17,6 +17,7 @@
#include "TrakBallWidget.hxx" #include "TrakBallWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TrakBallWidget::TrakBallWidget(GuiObject* boss, const GUI::Font& font, TrakBallWidget::TrakBallWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, Controller& controller) int x, int y, Controller& controller)
: PointingDeviceWidget(boss, font, x, y, controller) : PointingDeviceWidget(boss, font, x, y, controller)

View File

@ -55,8 +55,8 @@ class Bankswitch
// Info about the various bankswitch schemes, useful for displaying // Info about the various bankswitch schemes, useful for displaying
// in GUI dropdown boxes, etc // in GUI dropdown boxes, etc
struct Description { struct Description {
const char* const name; const char* const name{nullptr};
const char* const desc; const char* const desc{nullptr};
}; };
static const std::array<Description, static_cast<int>(Type::NumSchemes)> BSList; static const std::array<Description, static_cast<int>(Type::NumSchemes)> BSList;

View File

@ -44,7 +44,7 @@ class CartridgeAR : public Cartridge
friend class CartridgeARWidget; friend class CartridgeARWidget;
public: public:
static constexpr uInt32 BANK_SIZE = uInt32(2_KB); static constexpr uInt32 BANK_SIZE = static_cast<uInt32>(2_KB);
static constexpr uInt32 RAM_SIZE = 3 * BANK_SIZE; static constexpr uInt32 RAM_SIZE = 3 * BANK_SIZE;
static constexpr uInt32 LOAD_SIZE = 8448; static constexpr uInt32 LOAD_SIZE = 8448;

View File

@ -27,17 +27,18 @@
#include "exception/FatalEmulationError.hxx" #include "exception/FatalEmulationError.hxx"
// Location of data within the RAM copy of the BUS Driver. // Location of data within the RAM copy of the BUS Driver.
#define DSxPTR 0x06D8 static constexpr int
#define DSxINC 0x0720 DSxPTR = 0x06D8,
#define DSMAPS 0x0760 DSxINC = 0x0720,
#define WAVEFORM 0x07F4 DSMAPS = 0x0760,
#define DSRAM 0x0800 WAVEFORM = 0x07F4,
DSRAM = 0x0800,
#define COMMSTREAM 0x10 COMMSTREAM = 0x10,
#define JUMPSTREAM 0x11 JUMPSTREAM = 0x11;
#define BUS_STUFF_ON ((myMode & 0x0F) == 0) static constexpr bool BUS_STUFF_ON(uInt8 mode) { return (mode & 0x0F) == 0; }
#define DIGITAL_AUDIO_ON ((myMode & 0xF0) == 0) static constexpr bool DIGITAL_AUDIO_ON(uInt8 mode) { return (mode & 0xF0) == 0; }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeBUS::CartridgeBUS(const ByteBuffer& image, size_t size, CartridgeBUS::CartridgeBUS(const ByteBuffer& image, size_t size,
@ -221,7 +222,7 @@ uInt8 CartridgeBUS::peek(uInt16 address)
} }
// test for JMP FASTJUMP where FASTJUMP = $0000 // test for JMP FASTJUMP where FASTJUMP = $0000
if (BUS_STUFF_ON if (BUS_STUFF_ON(myMode)
&& peekvalue == 0x4C && peekvalue == 0x4C
&& myProgramImage[myBankOffset + address+1] == 0 && myProgramImage[myBankOffset + address+1] == 0
&& myProgramImage[myBankOffset + address+2] == 0) && myProgramImage[myBankOffset + address+2] == 0)
@ -234,7 +235,7 @@ uInt8 CartridgeBUS::peek(uInt16 address)
myJMPoperandAddress = 0; myJMPoperandAddress = 0;
// save the STY's zero page address // save the STY's zero page address
if (BUS_STUFF_ON && mySTYZeroPageAddress == address) if (BUS_STUFF_ON(myMode) && mySTYZeroPageAddress == address)
myBusOverdriveAddress = peekvalue; myBusOverdriveAddress = peekvalue;
mySTYZeroPageAddress = 0; mySTYZeroPageAddress = 0;
@ -245,7 +246,7 @@ uInt8 CartridgeBUS::peek(uInt16 address)
// Update the music data fetchers (counter & flag) // Update the music data fetchers (counter & flag)
updateMusicModeDataFetchers(); updateMusicModeDataFetchers();
if DIGITAL_AUDIO_ON if (DIGITAL_AUDIO_ON(myMode))
{ {
// retrieve packed sample (max size is 2K, or 4K of unpacked data) // retrieve packed sample (max size is 2K, or 4K of unpacked data)
const uInt32 sampleaddress = getSample() + (myMusicCounters[0] >> 21); const uInt32 sampleaddress = getSample() + (myMusicCounters[0] >> 21);
@ -327,7 +328,7 @@ uInt8 CartridgeBUS::peek(uInt16 address)
} }
// this might not work right for STY $84 // this might not work right for STY $84
if (BUS_STUFF_ON && peekvalue == 0x84) if (BUS_STUFF_ON(myMode) && peekvalue == 0x84)
mySTYZeroPageAddress = address + 1; mySTYZeroPageAddress = address + 1;
return peekvalue; return peekvalue;

View File

@ -236,7 +236,7 @@ CartCreator::createFromMultiCart(const ByteBuffer& image, size_t& size,
std::copy_n(image.get()+i*size, size, slice.get()); std::copy_n(image.get()+i*size, size, slice.get());
// We need a new md5 and name // We need a new md5 and name
md5 = MD5::hash(slice, uInt32(size)); // FIXME md5 = MD5::hash(slice, size);
ostringstream buf; ostringstream buf;
buf << " [G" << (i+1) << "]"; buf << " [G" << (i+1) << "]";
id = buf.str(); id = buf.str();

View File

@ -162,17 +162,3 @@ bool CartridgeWD::load(Serializer& in)
return true; return true;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const std::array<CartridgeWD::BankOrg, 8> CartridgeWD::ourBankOrg = {{
// 0 1 2 3 4 5 6 7
{ 0, 0, 1, 3 }, // Bank 0, 8 2 1 - 1 - - - -
{ 0, 1, 2, 3 }, // Bank 1, 9 1 1 1 1 - - - -
{ 4, 5, 6, 7 }, // Bank 2, 10 - - - - 1 1 1 1
{ 7, 4, 2, 3 }, // Bank 3, 11 - - 1 1 1 - - 1
{ 0, 0, 6, 7 }, // Bank 4, 12 2 - - - - - 1 1
{ 0, 1, 7, 6 }, // Bank 5, 13 1 1 - - - - 1 1
{ 2, 3, 4, 5 }, // Bank 6, 14 - - 1 1 1 1 - -
{ 6, 0, 5, 1 } // Bank 7, 15 1 1 - - - 1 1 -
// count 7 4 3 4 3 3 4 4
}};

View File

@ -176,7 +176,18 @@ class CartridgeWD : public CartridgeEnhanced
struct BankOrg { struct BankOrg {
uInt8 zero{0}, one{0}, two{0}, three{0}; uInt8 zero{0}, one{0}, two{0}, three{0};
}; };
static const std::array<BankOrg, 8> ourBankOrg; static constexpr std::array<BankOrg, 8> ourBankOrg = {{
// 0 1 2 3 4 5 6 7
{ 0, 0, 1, 3 }, // Bank 0, 8 2 1 - 1 - - - -
{ 0, 1, 2, 3 }, // Bank 1, 9 1 1 1 1 - - - -
{ 4, 5, 6, 7 }, // Bank 2, 10 - - - - 1 1 1 1
{ 7, 4, 2, 3 }, // Bank 3, 11 - - 1 1 1 - - 1
{ 0, 0, 6, 7 }, // Bank 4, 12 2 - - - - - 1 1
{ 0, 1, 7, 6 }, // Bank 5, 13 1 1 - - - - 1 1
{ 2, 3, 4, 5 }, // Bank 6, 14 - - 1 1 1 1 - -
{ 6, 0, 5, 1 } // Bank 7, 15 1 1 - - - 1 1 -
// count 7 4 3 4 3 3 4 4
}};
private: private:
// log(ROM bank segment size) / log(2) // log(ROM bank segment size) / log(2)

View File

@ -27,7 +27,7 @@
static constexpr uInt32 DEF_PROPS_SIZE = 3533; static constexpr uInt32 DEF_PROPS_SIZE = 3533;
static const BSPF::array2D<const char*, DEF_PROPS_SIZE, 29> DefProps = {{ static constexpr BSPF::array2D<const char*, DEF_PROPS_SIZE, 29> DefProps = {{
{ "000509d1ed2b8d30a9d94be1b3b5febb", "Greg Zumwalt", "", "Jungle Jane (2003) (Greg Zumwalt) (Hack)", "Hack of Pitfall!", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "{\"score_addresses\":[\"0xd5\",\"0xd6\",\"0xd7\"],\"score_digits\":6,\"variations_count\":1}", "" }, { "000509d1ed2b8d30a9d94be1b3b5febb", "Greg Zumwalt", "", "Jungle Jane (2003) (Greg Zumwalt) (Hack)", "Hack of Pitfall!", "Hack", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "{\"score_addresses\":[\"0xd5\",\"0xd6\",\"0xd7\"],\"score_digits\":6,\"variations_count\":1}", "" },
{ "0060a89b4c956b9c703a59b181cb3018", "CommaVid, Irwin Gaines - Ariola", "CM-008 - 712 008-720", "Cakewalk (1983) (CommaVid) (PAL)", "AKA Alarm in der Backstube", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "0060a89b4c956b9c703a59b181cb3018", "CommaVid, Irwin Gaines - Ariola", "CM-008 - 712 008-720", "Cakewalk (1983) (CommaVid) (PAL)", "AKA Alarm in der Backstube", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },
{ "007d18dedc1f0565f09c42aa61a6f585", "CCE", "C-843", "Worm War I (1983) (CCE)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }, { "007d18dedc1f0565f09c42aa61a6f585", "CCE", "C-843", "Worm War I (1983) (CCE)", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" },

View File

@ -25,9 +25,9 @@ Driving::Driving(Jack jack, const Event& event, const System& system, bool altma
{ {
if(!altmap) if(!altmap)
{ {
myCCWEvent = Event::LeftDrivingCCW; myCCWEvent = Event::LeftDrivingCCW;
myCWEvent = Event::LeftDrivingCW; myCWEvent = Event::LeftDrivingCW;
myFireEvent = Event::LeftDrivingFire; myFireEvent = Event::LeftDrivingFire;
myAnalogEvent = Event::LeftDrivingAnalog; myAnalogEvent = Event::LeftDrivingAnalog;
} }
else else
@ -43,9 +43,9 @@ Driving::Driving(Jack jack, const Event& event, const System& system, bool altma
{ {
if(!altmap) if(!altmap)
{ {
myCCWEvent = Event::RightDrivingCCW; myCCWEvent = Event::RightDrivingCCW;
myCWEvent = Event::RightDrivingCW; myCWEvent = Event::RightDrivingCW;
myFireEvent = Event::RightDrivingFire; myFireEvent = Event::RightDrivingFire;
myAnalogEvent = Event::RightDrivingAnalog; myAnalogEvent = Event::RightDrivingAnalog;
} }
else else

View File

@ -22,9 +22,9 @@ Genesis::Genesis(Jack jack, const Event& event, const System& system)
: Joystick(jack, event, system, Controller::Type::Genesis) : Joystick(jack, event, system, Controller::Type::Genesis)
{ {
if(myJack == Jack::Left) if(myJack == Jack::Left)
myButtonCEvent = Event::LeftJoystickFire5; myButtonCEvent = Event::LeftJoystickFire5;
else else
myButtonCEvent = Event::RightJoystickFire5; myButtonCEvent = Event::RightJoystickFire5;
setPin(AnalogPin::Five, AnalogReadout::connectToVcc()); setPin(AnalogPin::Five, AnalogReadout::connectToVcc());
setPin(AnalogPin::Nine, AnalogReadout::connectToVcc()); setPin(AnalogPin::Nine, AnalogReadout::connectToVcc());

View File

@ -153,7 +153,7 @@ class GlobalKeyHandler
struct GroupData struct GroupData
{ {
Setting start{Setting::NONE}; Setting start{Setting::NONE};
string name{EmptyString}; string name;
}; };
struct SettingData struct SettingData

View File

@ -32,38 +32,38 @@ Joystick::Joystick(Jack jack, const Event& event, const System& system,
{ {
if(!altmap) if(!altmap)
{ {
myUpEvent = Event::LeftJoystickUp; myUpEvent = Event::LeftJoystickUp;
myDownEvent = Event::LeftJoystickDown; myDownEvent = Event::LeftJoystickDown;
myLeftEvent = Event::LeftJoystickLeft; myLeftEvent = Event::LeftJoystickLeft;
myRightEvent = Event::LeftJoystickRight; myRightEvent = Event::LeftJoystickRight;
myFireEvent = Event::LeftJoystickFire; myFireEvent = Event::LeftJoystickFire;
} }
else else
{ {
myUpEvent = Event::QTJoystickThreeUp; myUpEvent = Event::QTJoystickThreeUp;
myDownEvent = Event::QTJoystickThreeDown; myDownEvent = Event::QTJoystickThreeDown;
myLeftEvent = Event::QTJoystickThreeLeft; myLeftEvent = Event::QTJoystickThreeLeft;
myRightEvent = Event::QTJoystickThreeRight; myRightEvent = Event::QTJoystickThreeRight;
myFireEvent = Event::QTJoystickThreeFire; myFireEvent = Event::QTJoystickThreeFire;
} }
} }
else else
{ {
if(!altmap) if(!altmap)
{ {
myUpEvent = Event::RightJoystickUp; myUpEvent = Event::RightJoystickUp;
myDownEvent = Event::RightJoystickDown; myDownEvent = Event::RightJoystickDown;
myLeftEvent = Event::RightJoystickLeft; myLeftEvent = Event::RightJoystickLeft;
myRightEvent = Event::RightJoystickRight; myRightEvent = Event::RightJoystickRight;
myFireEvent = Event::RightJoystickFire; myFireEvent = Event::RightJoystickFire;
} }
else else
{ {
myUpEvent = Event::QTJoystickFourUp; myUpEvent = Event::QTJoystickFourUp;
myDownEvent = Event::QTJoystickFourDown; myDownEvent = Event::QTJoystickFourDown;
myLeftEvent = Event::QTJoystickFourLeft; myLeftEvent = Event::QTJoystickFourLeft;
myRightEvent = Event::QTJoystickFourRight; myRightEvent = Event::QTJoystickFourRight;
myFireEvent = Event::QTJoystickFourFire; myFireEvent = Event::QTJoystickFourFire;
} }
} }
} }

View File

@ -54,8 +54,9 @@ Keyboard::Keyboard(Jack jack, const Event& event, const System& system)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Keyboard::ColumnState Keyboard::processColumn(const Event::Type buttons[]) { Keyboard::ColumnState Keyboard::processColumn(const Event::Type buttons[]) {
constexpr DigitalPin signals[] = static constexpr DigitalPin signals[] =
{DigitalPin::One, DigitalPin::Two, DigitalPin::Three, DigitalPin::Four}; {DigitalPin::One, DigitalPin::Two, DigitalPin::Three, DigitalPin::Four};
for (uInt8 i = 0; i < 4; i++) for (uInt8 i = 0; i < 4; i++)
@ -67,6 +68,7 @@ Keyboard::ColumnState Keyboard::processColumn(const Event::Type buttons[]) {
return ColumnState::notConnected; return ColumnState::notConnected;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AnalogReadout::Connection Keyboard::columnStateToAnalogSignal(ColumnState state) const { AnalogReadout::Connection Keyboard::columnStateToAnalogSignal(ColumnState state) const {
switch (state) { switch (state) {
case ColumnState::gnd: case ColumnState::gnd:
@ -83,7 +85,6 @@ AnalogReadout::Connection Keyboard::columnStateToAnalogSignal(ColumnState state)
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Keyboard::write(DigitalPin pin, bool value) void Keyboard::write(DigitalPin pin, bool value)
{ {

View File

@ -50,8 +50,8 @@ Paddles::Paddles(Jack jack, const Event& event, const System& system,
if(!altmap) if(!altmap)
{ {
// First paddle is left A, second is left B // First paddle is left A, second is left B
myAAxisValue = Event::LeftPaddleAAnalog; myAAxisValue = Event::LeftPaddleAAnalog;
myBAxisValue = Event::LeftPaddleBAnalog; myBAxisValue = Event::LeftPaddleBAnalog;
myLeftAFireEvent = Event::LeftPaddleAFire; myLeftAFireEvent = Event::LeftPaddleAFire;
myLeftBFireEvent = Event::LeftPaddleBFire; myLeftBFireEvent = Event::LeftPaddleBFire;
@ -77,8 +77,8 @@ Paddles::Paddles(Jack jack, const Event& event, const System& system,
if(!altmap) if(!altmap)
{ {
// First paddle is right A, second is right B // First paddle is right A, second is right B
myAAxisValue = Event::RightPaddleAAnalog; myAAxisValue = Event::RightPaddleAAnalog;
myBAxisValue = Event::RightPaddleBAnalog; myBAxisValue = Event::RightPaddleBAnalog;
myLeftAFireEvent = Event::RightPaddleAFire; myLeftAFireEvent = Event::RightPaddleAFire;
myLeftBFireEvent = Event::RightPaddleBFire; myLeftBFireEvent = Event::RightPaddleBFire;
@ -159,6 +159,7 @@ void Paddles::update()
updateB(); updateB();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Paddles::updateA() void Paddles::updateA()
{ {
setPin(DigitalPin::Four, true); setPin(DigitalPin::Four, true);
@ -274,7 +275,6 @@ bool Paddles::updateAnalogAxesA()
return sa_changed; return sa_changed;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Paddles::updateMouseA(bool& firePressedA) void Paddles::updateMouseA(bool& firePressedA)
{ {
@ -342,6 +342,7 @@ void Paddles::updateDigitalAxesA()
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Paddles::updateB() void Paddles::updateB()
{ {
setPin(DigitalPin::Three, true); setPin(DigitalPin::Three, true);

View File

@ -27,7 +27,10 @@
#include "repository/KeyValueRepositoryPropertyFile.hxx" #include "repository/KeyValueRepositoryPropertyFile.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertiesSet::PropertiesSet() : myRepository{make_shared<CompositeKeyValueRepositoryNoop>()} {} PropertiesSet::PropertiesSet()
: myRepository{make_shared<CompositeKeyValueRepositoryNoop>()}
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PropertiesSet::setRepository(shared_ptr<CompositeKeyValueRepository> repository) void PropertiesSet::setRepository(shared_ptr<CompositeKeyValueRepository> repository)

View File

@ -37,7 +37,7 @@ class Sound
Create a new sound object. The open method must be invoked before Create a new sound object. The open method must be invoked before
using the object. using the object.
*/ */
Sound(OSystem& osystem) : myOSystem(osystem) { } Sound(OSystem& osystem) : myOSystem{osystem} { }
virtual ~Sound() = default; virtual ~Sound() = default;
public: public:

View File

@ -166,24 +166,6 @@ bool AnalogReadout::load(Serializer& in)
return true; return true;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AnalogReadout::Connection AnalogReadout::connectToGround(uInt32 resistance)
{
return Connection{ConnectionType::ground, resistance};
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AnalogReadout::Connection AnalogReadout::connectToVcc(uInt32 resistance)
{
return Connection{ConnectionType::vcc, resistance};
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AnalogReadout::Connection AnalogReadout::disconnect()
{
return Connection{ConnectionType::disconnected, 0};
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool AnalogReadout::Connection::save(Serializer& out) const bool AnalogReadout::Connection::save(Serializer& out) const
{ {

View File

@ -31,8 +31,8 @@ class AnalogReadout : public Serializable
}; };
struct Connection { struct Connection {
ConnectionType type; ConnectionType type{ConnectionType::ground};
uInt32 resistance; uInt32 resistance{0};
bool save(Serializer& out) const; bool save(Serializer& out) const;
bool load(const Serializer& in); bool load(const Serializer& in);
@ -61,11 +61,17 @@ class AnalogReadout : public Serializable
public: public:
static Connection connectToGround(uInt32 resistance = 0); static constexpr Connection connectToGround(uInt32 resistance = 0) {
return Connection{ConnectionType::ground, resistance};
}
static Connection connectToVcc(uInt32 resistance = 0); static constexpr Connection connectToVcc(uInt32 resistance = 0) {
return Connection{ConnectionType::vcc, resistance};
}
static Connection disconnect(); static constexpr Connection disconnect() {
return Connection{ConnectionType::disconnected, 0};
}
private: private:

View File

@ -79,12 +79,12 @@ void DelayQueue<length, capacity>::push(uInt8 address, uInt8 value, uInt8 delay)
if (delay >= length) if (delay >= length)
throw runtime_error("delay exceeds queue length"); throw runtime_error("delay exceeds queue length");
uInt8 currentIndex = myIndices[address]; const uInt8 currentIndex = myIndices[address];
if (currentIndex < length) if (currentIndex < length)
myMembers[currentIndex].remove(address); myMembers[currentIndex].remove(address);
uInt8 index = smartmod<length>(myIndex + delay); const uInt8 index = smartmod<length>(myIndex + delay);
myMembers[index].push(address, value); myMembers[index].push(address, value);
myIndices[address] = index; myIndices[address] = index;

View File

@ -23,6 +23,7 @@
class DelayQueueIterator class DelayQueueIterator
{ {
public: public:
DelayQueueIterator() = default;
virtual ~DelayQueueIterator() = default; virtual ~DelayQueueIterator() = default;
public: public:
@ -35,6 +36,13 @@ class DelayQueueIterator
virtual uInt8 value() const = 0; virtual uInt8 value() const = 0;
virtual bool next() = 0; virtual bool next() = 0;
private:
// Following constructors and assignment operators not supported
DelayQueueIterator(const DelayQueueIterator&) = delete;
DelayQueueIterator(DelayQueueIterator&&) = delete;
DelayQueueIterator& operator=(const DelayQueueIterator&) = delete;
DelayQueueIterator& operator=(DelayQueueIterator&&) = delete;
}; };
#endif // TIA_DELAY_QUEUE_ITERATOR #endif // TIA_DELAY_QUEUE_ITERATOR

View File

@ -34,7 +34,7 @@ class FrameManager: public AbstractFrameManager {
frameSizePAL = 312, frameSizePAL = 312,
baseHeightNTSC = 228, // 217..239 baseHeightNTSC = 228, // 217..239
baseHeightPAL = 274, // 260..288 baseHeightPAL = 274, // 260..288
maxHeight = uInt32(baseHeightPAL * 1.05 + 0.5), // 288 maxHeight = static_cast<uInt32>(baseHeightPAL * 1.05 + 0.5), // 288
maxLinesVsync = 50, maxLinesVsync = 50,
initialGarbageFrames = TIAConstants::initialGarbageFrames, initialGarbageFrames = TIAConstants::initialGarbageFrames,
ystartNTSC = 23, ystartNTSC = 23,

View File

@ -463,7 +463,7 @@ void Dialog::addTabWidget(TabWidget* w)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Dialog::setFocus(Widget* w) void Dialog::setFocus(const Widget* w)
{ {
// If the click occured inside a widget which is not the currently // If the click occured inside a widget which is not the currently
// focused one, change the focus to that widget. // focused one, change the focus to that widget.

View File

@ -84,7 +84,7 @@ class Dialog : public GuiObject
void addExtraWidget(ButtonWidget* w) { _extraWidget = w; } void addExtraWidget(ButtonWidget* w) { _extraWidget = w; }
void addOKWidget(ButtonWidget* w) { _okWidget = w; } void addOKWidget(ButtonWidget* w) { _okWidget = w; }
void addCancelWidget(ButtonWidget* w) { _cancelWidget = w; } void addCancelWidget(ButtonWidget* w) { _cancelWidget = w; }
void setFocus(Widget* w); void setFocus(const Widget* w);
/** Returns the base surface associated with this dialog. */ /** Returns the base surface associated with this dialog. */
FBSurface& surface() const { return *_surface; } FBSurface& surface() const { return *_surface; }

View File

@ -25,7 +25,7 @@ using json = nlohmann::json;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FavoritesManager::FavoritesManager(Settings& settings) FavoritesManager::FavoritesManager(Settings& settings)
: mySettings(settings) : mySettings{settings}
{ {
} }

View File

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

View File

@ -22,7 +22,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HighScoresMenu::HighScoresMenu(OSystem& osystem) HighScoresMenu::HighScoresMenu(OSystem& osystem)
: DialogContainer{osystem} : DialogContainer(osystem)
{ {
} }

View File

@ -60,7 +60,7 @@ QuadTariDialog::QuadTariDialog(GuiObject* boss, const GUI::Font& font, int max_w
//VarList::push_back(ctrls, "MindLink", "MINDLINK"); //VarList::push_back(ctrls, "MindLink", "MINDLINK");
//VarList::push_back(ctrls, "QuadTari", "QUADTARI"); //VarList::push_back(ctrls, "QuadTari", "QUADTARI");
int pwidth = font.getStringWidth("Joystick12"); // a bit wider looks better overall const int pwidth = font.getStringWidth("Joystick12"); // a bit wider looks better overall
myLeftPortLabel = new StaticTextWidget(this, font, xpos, ypos + 1, "Left port"); myLeftPortLabel = new StaticTextWidget(this, font, xpos, ypos + 1, "Left port");

View File

@ -66,7 +66,7 @@ SnapshotDialog::SnapshotDialog(OSystem& osystem, DialogContainer& parent,
wid.push_back(mySnapInterval); wid.push_back(mySnapInterval);
// Booleans for saving snapshots // Booleans for saving snapshots
int fwidth = font.getStringWidth("When saving snapshots:"); const int fwidth = font.getStringWidth("When saving snapshots:");
xpos = HBORDER; ypos += lineHeight + VGAP * 3; xpos = HBORDER; ypos += lineHeight + VGAP * 3;
new StaticTextWidget(this, font, xpos, ypos, fwidth, lineHeight, new StaticTextWidget(this, font, xpos, ypos, fwidth, lineHeight,
"When saving snapshots:", TextAlign::Left); "When saving snapshots:", TextAlign::Left);

View File

@ -316,7 +316,7 @@ string Widget::getToolTip(const Common::Point& pos) const
{ {
// Merge hotkeys if they only differ by "+Shift" // Merge hotkeys if they only differ by "+Shift"
const string mod = "+Shift"; const string mod = "+Shift";
size_t p = BSPF::findIgnoreCase(hotkey, mod); const size_t p = BSPF::findIgnoreCase(hotkey, mod);
if(p != string::npos) if(p != string::npos)
{ {