Fixes from clang-tidy for the entire codebase, including header files.

This commit is contained in:
Stephen Anthony 2024-08-03 20:35:45 -02:30
parent 6c0e6598f5
commit 67974a92e0
149 changed files with 433 additions and 389 deletions

View File

@ -127,7 +127,7 @@ class AudioSettings
private: private:
Settings& mySettings; Settings& mySettings; // NOLINT: we want a reference here
Preset myPreset{Preset::custom}; Preset myPreset{Preset::custom};

View File

@ -326,8 +326,7 @@ bool PhysicalJoystickHandler::hasStelladaptors() const
// 2. reset all events to default (event == Event::NoType, updateDefault == false) // 2. reset all events to default (event == Event::NoType, updateDefault == false)
// 3. reset one event to default (event != Event::NoType) // 3. reset one event to default (event != Event::NoType)
void PhysicalJoystickHandler::setDefaultAction(int stick, void PhysicalJoystickHandler::setDefaultAction(int stick,
EventMapping map, Event::Type event, EventMapping map, Event::Type event, EventMode mode, bool updateDefaults)
EventMode mode, bool updateDefaults)
{ {
const PhysicalJoystickPtr j = joy(stick); const PhysicalJoystickPtr j = joy(stick);
@ -406,11 +405,11 @@ void PhysicalJoystickHandler::setStickDefaultMapping(
setDefaultAction(stick, item, event, EventMode::kDrivingMode, updateDefaults); setDefaultAction(stick, item, event, EventMode::kDrivingMode, updateDefaults);
} }
#if defined(RETRON77) #if defined(RETRON77)
constexpr bool retron77 = true; constexpr bool retron77 = true;
#else #else
constexpr bool retron77 = false; constexpr bool retron77 = false;
#endif #endif
// Regular joysticks can only be used by one player at a time, // Regular joysticks can only be used by one player at a time,
// so we need to separate the paddles onto different // so we need to separate the paddles onto different
@ -501,7 +500,7 @@ void PhysicalJoystickHandler::setDefaultMapping(Event::Type event, EventMode mod
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::defineControllerMappings( void PhysicalJoystickHandler::defineControllerMappings(
const Controller::Type type, Controller::Jack port, const Properties& properties, Controller::Type type, Controller::Jack port, const Properties& properties,
Controller::Type qtType1, Controller::Type qtType2) Controller::Type qtType1, Controller::Type qtType2)
{ {
// Determine controller events to use // Determine controller events to use
@ -531,7 +530,7 @@ void PhysicalJoystickHandler::defineControllerMappings(
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventMode PhysicalJoystickHandler::getMode(const Properties& properties, EventMode PhysicalJoystickHandler::getMode(const Properties& properties,
const PropType propType) PropType propType)
{ {
const string& propName = properties.get(propType); const string& propName = properties.get(propType);
@ -542,7 +541,7 @@ EventMode PhysicalJoystickHandler::getMode(const Properties& properties,
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventMode PhysicalJoystickHandler::getMode(const Controller::Type type) EventMode PhysicalJoystickHandler::getMode(Controller::Type type)
{ {
switch(type) switch(type)
{ {
@ -671,7 +670,7 @@ void PhysicalJoystickHandler::enableMappings(const Event::EventSet& events, Even
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::enableMapping(const Event::Type event, EventMode mode) void PhysicalJoystickHandler::enableMapping(Event::Type event, EventMode mode)
{ {
// copy from controller mode into emulation mode // copy from controller mode into emulation mode
for (auto& stick : mySticks) for (auto& stick : mySticks)
@ -687,8 +686,7 @@ void PhysicalJoystickHandler::enableMapping(const Event::Type event, EventMode m
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventMode PhysicalJoystickHandler::getEventMode(const Event::Type event, EventMode PhysicalJoystickHandler::getEventMode(Event::Type event, EventMode mode)
const EventMode mode)
{ {
if(mode == EventMode::kEmulationMode) if(mode == EventMode::kEmulationMode)
{ {
@ -712,7 +710,7 @@ EventMode PhysicalJoystickHandler::getEventMode(const Event::Type event,
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PhysicalJoystickHandler::isJoystickEvent(const Event::Type event) bool PhysicalJoystickHandler::isJoystickEvent(Event::Type event)
{ {
return LeftJoystickEvents.contains(event) return LeftJoystickEvents.contains(event)
|| QTJoystick3Events.contains(event) || QTJoystick3Events.contains(event)
@ -721,7 +719,7 @@ bool PhysicalJoystickHandler::isJoystickEvent(const Event::Type event)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PhysicalJoystickHandler::isPaddleEvent(const Event::Type event) bool PhysicalJoystickHandler::isPaddleEvent(Event::Type event)
{ {
return LeftPaddlesEvents.contains(event) return LeftPaddlesEvents.contains(event)
|| QTPaddles3Events.contains(event) || QTPaddles3Events.contains(event)
@ -730,21 +728,21 @@ bool PhysicalJoystickHandler::isPaddleEvent(const Event::Type event)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PhysicalJoystickHandler::isKeyboardEvent(const Event::Type event) bool PhysicalJoystickHandler::isKeyboardEvent(Event::Type event)
{ {
return LeftKeyboardEvents.contains(event) return LeftKeyboardEvents.contains(event)
|| RightKeyboardEvents.contains(event); || RightKeyboardEvents.contains(event);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PhysicalJoystickHandler::isDrivingEvent(const Event::Type event) bool PhysicalJoystickHandler::isDrivingEvent(Event::Type event)
{ {
return LeftDrivingEvents.contains(event) return LeftDrivingEvents.contains(event)
|| RightDrivingEvents.contains(event); || RightDrivingEvents.contains(event);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PhysicalJoystickHandler::isCommonEvent(const Event::Type event) bool PhysicalJoystickHandler::isCommonEvent(Event::Type event)
{ {
return !(isJoystickEvent(event) || isPaddleEvent(event) return !(isJoystickEvent(event) || isPaddleEvent(event)
|| isKeyboardEvent(event) || isDrivingEvent(event)); || isKeyboardEvent(event) || isDrivingEvent(event));
@ -820,8 +818,8 @@ string PhysicalJoystickHandler::getMappingDesc(Event::Type event, EventMode mode
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PhysicalJoystickHandler::addJoyMapping(Event::Type event, EventMode mode, int stick, bool PhysicalJoystickHandler::addJoyMapping(Event::Type event, EventMode mode,
int button, JoyAxis axis, JoyDir adir) int stick, int button, JoyAxis axis, JoyDir adir)
{ {
const PhysicalJoystickPtr j = joy(stick); const PhysicalJoystickPtr j = joy(stick);
@ -861,8 +859,8 @@ bool PhysicalJoystickHandler::addJoyMapping(Event::Type event, EventMode mode, i
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PhysicalJoystickHandler::addJoyHatMapping(Event::Type event, EventMode mode, int stick, bool PhysicalJoystickHandler::addJoyHatMapping(Event::Type event, EventMode mode,
int button, int hat, JoyHatDir hdir) int stick, int button, int hat, JoyHatDir hdir)
{ {
const PhysicalJoystickPtr j = joy(stick); const PhysicalJoystickPtr j = joy(stick);

View File

@ -53,7 +53,7 @@ class PhysicalJoystickHandler
int ID; int ID;
PhysicalJoystick::Port port; PhysicalJoystick::Port port;
explicit MinStrickInfo(string _name, int _id, PhysicalJoystick::Port _port) explicit MinStrickInfo(string_view _name, int _id, PhysicalJoystick::Port _port)
: name{_name}, ID{_id}, port{_port} {} : name{_name}, ID{_id}, port{_port} {}
}; };
using MinStrickInfoList = std::vector<MinStrickInfo>; using MinStrickInfoList = std::vector<MinStrickInfo>;
@ -66,7 +66,7 @@ class PhysicalJoystickHandler
// on the 'mapping' instance variable; there lay dragons ... // on the 'mapping' instance variable; there lay dragons ...
// https://json.nlohmann.me/home/faq/#brace-initialization-yields-arrays // https://json.nlohmann.me/home/faq/#brace-initialization-yields-arrays
explicit StickInfo(nlohmann::json map, PhysicalJoystickPtr stick = nullptr) explicit StickInfo(nlohmann::json map, PhysicalJoystickPtr stick = nullptr)
: mapping(map), joy{std::move(stick)} {} : mapping(map), joy{std::move(stick)} {} // NOLINT
nlohmann::json mapping; nlohmann::json mapping;
PhysicalJoystickPtr joy; PhysicalJoystickPtr joy;
@ -92,7 +92,7 @@ class PhysicalJoystickHandler
void setDefaultMapping(Event::Type event, EventMode mode); void setDefaultMapping(Event::Type event, EventMode mode);
/** define mappings for current controllers */ /** define mappings for current controllers */
void defineControllerMappings(const Controller::Type type, Controller::Jack port, void defineControllerMappings(Controller::Type type, Controller::Jack port,
const Properties& properties, const Properties& properties,
Controller::Type qtType1 = Controller::Type::Unknown, Controller::Type qtType1 = Controller::Type::Unknown,
Controller::Type qtType2 = Controller::Type::Unknown); Controller::Type qtType2 = Controller::Type::Unknown);
@ -145,9 +145,9 @@ class PhysicalJoystickHandler
using StickDatabase = std::map<string, StickInfo, std::less<>>; using StickDatabase = std::map<string, StickInfo, std::less<>>;
using StickList = std::map<int, PhysicalJoystickPtr>; using StickList = std::map<int, PhysicalJoystickPtr>;
OSystem& myOSystem; OSystem& myOSystem; // NOLINT: we want a reference here
EventHandler& myHandler; EventHandler& myHandler; // NOLINT: we want a reference here
Event& myEvent; Event& myEvent; // NOLINT: we want a reference here
// Contains all joysticks that Stella knows about, indexed by name // Contains all joysticks that Stella knows about, indexed by name
StickDatabase myDatabase; StickDatabase myDatabase;
@ -157,7 +157,7 @@ class PhysicalJoystickHandler
// Get joystick corresponding to given id (or nullptr if it doesn't exist) // Get joystick corresponding to given id (or nullptr if it doesn't exist)
// Make this inline so it's as fast as possible // Make this inline so it's as fast as possible
const PhysicalJoystickPtr joy(int id) const { PhysicalJoystickPtr joy(int id) const {
const auto& i = mySticks.find(id); const auto& i = mySticks.find(id);
return i != mySticks.cend() ? i->second : nullptr; return i != mySticks.cend() ? i->second : nullptr;
} }
@ -171,8 +171,10 @@ class PhysicalJoystickHandler
friend ostream& operator<<(ostream& os, const PhysicalJoystickHandler& jh); friend ostream& operator<<(ostream& os, const PhysicalJoystickHandler& jh);
JoyDir convertAxisValue(int value) const { static constexpr JoyDir convertAxisValue(int value) {
return value == int(JoyDir::NONE) ? JoyDir::NONE : value > 0 ? JoyDir::POS : JoyDir::NEG; return value == static_cast<int>(JoyDir::NONE)
? JoyDir::NONE
: value > 0 ? JoyDir::POS : JoyDir::NEG;
} }
// Handle regular axis events (besides special Stelladaptor handling) // Handle regular axis events (besides special Stelladaptor handling)
@ -196,23 +198,23 @@ class PhysicalJoystickHandler
bool updateDefaults = false); bool updateDefaults = false);
/** return event mode for given property */ /** return event mode for given property */
static EventMode getMode(const Properties& properties, const PropType propType); static EventMode getMode(const Properties& properties, PropType propType);
/** return event mode for given controller type */ /** return event mode for given controller type */
static EventMode getMode(const Controller::Type type); static EventMode getMode(Controller::Type type);
/** returns the event's controller mode */ /** returns the event's controller mode */
static EventMode getEventMode(const Event::Type event, const EventMode mode); static EventMode getEventMode(Event::Type event, EventMode mode);
/** Checks event type. */ /** Checks event type. */
static bool isJoystickEvent(const Event::Type event); static bool isJoystickEvent(Event::Type event);
static bool isPaddleEvent(const Event::Type event); static bool isPaddleEvent(Event::Type event);
static bool isKeyboardEvent(const Event::Type event); static bool isKeyboardEvent(Event::Type event);
static bool isDrivingEvent(const Event::Type event); static bool isDrivingEvent(Event::Type event);
static bool isCommonEvent(const Event::Type event); static bool isCommonEvent(Event::Type event);
void enableCommonMappings(); void enableCommonMappings();
void enableMappings(const Event::EventSet& events, EventMode mode); void enableMappings(const Event::EventSet& events, EventMode mode);
void enableMapping(const Event::Type event, EventMode mode); void enableMapping(Event::Type event, EventMode mode);
private: private:
EventMode myLeftMode{EventMode::kEmulationMode}; EventMode myLeftMode{EventMode::kEmulationMode};

View File

@ -36,7 +36,7 @@
*/ */
// This comes directly from SDL_scancode.h // This comes directly from SDL_scancode.h
enum StellaKey enum StellaKey // NOLINT: use 32-bit, even though 16-bit is sufficient
{ {
KBDK_UNKNOWN = 0, KBDK_UNKNOWN = 0,
@ -393,7 +393,7 @@ enum StellaKey
}; };
// This comes directly from SDL_keycode.h // This comes directly from SDL_keycode.h
enum StellaMod enum StellaMod: uInt16
{ {
KBDM_NONE = 0x0000, KBDM_NONE = 0x0000,
KBDM_LSHIFT = 0x0001, KBDM_LSHIFT = 0x0001,

View File

@ -29,6 +29,7 @@
@author Stephen Anthony @author Stephen Anthony
*/ */
// NOLINTBEGIN: c'tors cannot be explicit here
class Variant class Variant
{ {
private: private:
@ -91,4 +92,5 @@ namespace VarList {
} }
} // namespace VarList } // namespace VarList
// NOLINTEND
#endif #endif

View File

@ -187,7 +187,7 @@ class ZipHandler
} }
private: private:
const uInt8* const myBuf{nullptr}; const uInt8* const myBuf{nullptr}; // NOLINT: we want const here
}; };
class LocalFileHeaderReader : public ReaderBase class LocalFileHeaderReader : public ReaderBase

View File

@ -253,7 +253,7 @@ namespace BSPF
// starting from 'startpos' in the first string // starting from 'startpos' in the first string
static size_t findIgnoreCase(string_view s1, string_view s2, size_t startpos = 0) static size_t findIgnoreCase(string_view s1, string_view s2, size_t startpos = 0)
{ {
const auto pos = std::search(s1.cbegin()+startpos, s1.cend(), const auto pos = std::search(s1.cbegin()+startpos, s1.cend(), // NOLINT
s2.cbegin(), s2.cend(), [](char ch1, char ch2) { s2.cbegin(), s2.cend(), [](char ch1, char ch2) {
return toupper(static_cast<uInt8>(ch1)) == toupper(static_cast<uInt8>(ch2)); return toupper(static_cast<uInt8>(ch1)) == toupper(static_cast<uInt8>(ch2));
}); });

View File

@ -18,6 +18,9 @@
#ifndef JSON_DEFINITIONS_HXX #ifndef JSON_DEFINITIONS_HXX
#define JSON_DEFINITIONS_HXX #define JSON_DEFINITIONS_HXX
// NOLINTBEGIN: NLOHMANN_JSON_SERIALIZE_ENUM
// warning: use c++17 style variable templates [modernize-type-traits]
#include "EventHandlerConstants.hxx" #include "EventHandlerConstants.hxx"
#include "Event.hxx" #include "Event.hxx"
#include "json_lib.hxx" #include "json_lib.hxx"
@ -769,4 +772,6 @@ NLOHMANN_JSON_SERIALIZE_ENUM(StellaMod, {
{StellaMod::KBDM_GUI, "gui"} {StellaMod::KBDM_GUI, "gui"}
}) })
// NOLINTEND
#endif // JSON_DEFINITIONS_HXX #endif // JSON_DEFINITIONS_HXX

View File

@ -36,7 +36,7 @@ class KeyValueRepositoryFile : public KeyValueRepository {
protected: protected:
const FSNode& myNode; const FSNode& myNode; // NOLINT: we want a reference here
}; };
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -1248,12 +1248,12 @@ void DebuggerParser::executeDump()
{ {
const auto dump = [&](ostream& os, int start, int end) const auto dump = [&](ostream& os, int start, int end)
{ {
for(int i = start; i <= end; i += 16) for(int i = start; i <= end; i += 16) // NOLINT (i is not a const)
{ {
// Print label every 16 bytes // Print label every 16 bytes
os << Base::toString(i) << ": "; os << Base::toString(i) << ": ";
for(int j = i; j < i+16 && j <= end; ++j) for(int j = i; j < i+16 && j <= end; ++j) // NOLINT (j is not a const)
{ {
os << Base::toString(debugger.peek(j)) << " "; os << Base::toString(debugger.peek(j)) << " ";
if(j == i+7 && j != end) os << "- "; if(j == i+7 && j != end) os << "- ";
@ -1291,7 +1291,7 @@ void DebuggerParser::executeDump()
return; return;
} }
ostringstream path; ostringstream path; // NOLINT (path is not a const)
path << debugger.myOSystem.userDir() << cartName() << "_dbg_"; path << debugger.myOSystem.userDir() << cartName() << "_dbg_";
if(execDepth > 0) if(execDepth > 0)
path << execPrefix; path << execPrefix;
@ -1302,7 +1302,7 @@ void DebuggerParser::executeDump()
commandResult << "dumped "; commandResult << "dumped ";
stringstream out; stringstream out; // NOLINT (out is not a const)
if((args[2] & 0x01) != 0) if((args[2] & 0x01) != 0)
{ {
// dump memory // dump memory
@ -1381,6 +1381,7 @@ void DebuggerParser::executeDump()
if(OK) if(OK)
{ {
const stringstream localOut(outStr); const stringstream localOut(outStr);
// NOLINTNEXTLINE (localOut is not a const)
ostringstream localResult(resultStr, std::ios_base::app); ostringstream localResult(resultStr, std::ios_base::app);
saveDump(node, localOut, localResult); saveDump(node, localOut, localResult);
@ -2171,7 +2172,7 @@ void DebuggerParser::executeSaveRom()
// "saveSes" // "saveSes"
void DebuggerParser::executeSaveSes() void DebuggerParser::executeSaveSes()
{ {
ostringstream filename; ostringstream filename; // NOLINT (filename is not a const)
auto timeinfo = BSPF::localTime(); auto timeinfo = BSPF::localTime();
filename << std::put_time(&timeinfo, "session_%F_%H-%M-%S.txt"); filename << std::put_time(&timeinfo, "session_%F_%H-%M-%S.txt");
@ -2193,7 +2194,7 @@ void DebuggerParser::executeSaveSes()
} }
else else
{ {
ostringstream path; ostringstream path; // NOLINT (path is not a const)
if(argCount) if(argCount)
path << argStrings[0]; path << argStrings[0];

View File

@ -24,7 +24,7 @@ AmigaMouseWidget::AmigaMouseWidget(GuiObject* boss, const GUI::Font& font,
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 AmigaMouseWidget::getGrayCodeTable(const int index, const int) const uInt8 AmigaMouseWidget::getGrayCodeTable(int index, int) const
{ {
return myGrayCodeTable[index]; return myGrayCodeTable[index];
} }

View File

@ -31,9 +31,11 @@ class AmigaMouseWidget : public PointingDeviceWidget
~AmigaMouseWidget() override = default; ~AmigaMouseWidget() override = default;
private: private:
const std::array<uInt8, 4> myGrayCodeTable = { 0b00, 0b10, 0b11, 0b01 }; static constexpr std::array<uInt8, 4> myGrayCodeTable = {
0b00, 0b10, 0b11, 0b01
};
uInt8 getGrayCodeTable(const int index, const int direction) const override; uInt8 getGrayCodeTable(int index, int direction) const override;
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported
AmigaMouseWidget() = delete; AmigaMouseWidget() = delete;

View File

@ -24,7 +24,7 @@ AtariMouseWidget::AtariMouseWidget(GuiObject* boss, const GUI::Font& font,
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 AtariMouseWidget::getGrayCodeTable(const int index, const int direction) const uInt8 AtariMouseWidget::getGrayCodeTable(int index, int) const
{ {
return myGrayCodeTable[index]; return myGrayCodeTable[index];
} }

View File

@ -30,9 +30,11 @@ class AtariMouseWidget : public PointingDeviceWidget
~AtariMouseWidget() override = default; ~AtariMouseWidget() override = default;
private: private:
const std::array<uInt8, 4> myGrayCodeTable = { 0b00, 0b01, 0b11, 0b10 }; static constexpr std::array<uInt8, 4> myGrayCodeTable = {
0b00, 0b01, 0b11, 0b10
};
uInt8 getGrayCodeTable(const int index, const int direction) const override; uInt8 getGrayCodeTable(int index, int direction) const override;
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported
AtariMouseWidget() = delete; AtariMouseWidget() = delete;

View File

@ -34,7 +34,7 @@ class AudioWidget : public Widget, public CommandSender
private: private:
// ID's for the various widgets // ID's for the various widgets
// We need ID's, since there are more than one of several types of widgets // We need ID's, since there are more than one of several types of widgets
enum { enum: uInt8 {
kAUDFID, kAUDFID,
kAUDCID, kAUDCID,
kAUDVID kAUDVID
@ -48,7 +48,7 @@ class AudioWidget : public Widget, public CommandSender
StaticTextWidget* myAudEffV{nullptr}; StaticTextWidget* myAudEffV{nullptr};
// Audio channels // Audio channels
enum enum: uInt8
{ {
kAud0Addr, kAud0Addr,
kAud1Addr kAud1Addr

View File

@ -29,7 +29,9 @@ class BoosterWidget : public ControllerWidget
~BoosterWidget() override = default; ~BoosterWidget() override = default;
private: private:
enum { kJUp = 0, kJDown, kJLeft, kJRight, kJFire, kJBooster, kJTrigger }; enum: uInt8 {
kJUp = 0, kJDown, kJLeft, kJRight, kJFire, kJBooster, kJTrigger
};
std::array<CheckboxWidget*, 7> myPins{nullptr}; std::array<CheckboxWidget*, 7> myPins{nullptr};
static constexpr std::array<Controller::DigitalPin, 5> ourPinNo = {{ static constexpr std::array<Controller::DigitalPin, 5> ourPinNo = {{

View File

@ -39,7 +39,7 @@ CartDebugWidget::CartDebugWidget(GuiObject* boss, const GUI::Font& lfont,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartDebugWidget::addBaseInformation(size_t bytes, string_view manufacturer, int CartDebugWidget::addBaseInformation(size_t bytes, string_view manufacturer,
string_view desc, const uInt16 maxlines) string_view desc, uInt16 maxlines)
{ {
const int lwidth = _font.getStringWidth("Manufacturer "), const int lwidth = _font.getStringWidth("Manufacturer "),
fwidth = _w - lwidth - 12; fwidth = _w - lwidth - 12;

View File

@ -23,7 +23,7 @@ class StringListWidget;
namespace GUI { namespace GUI {
class Font; class Font;
} } // namespace GUI
#include "Base.hxx" // not needed here, but all child classes need it #include "Base.hxx" // not needed here, but all child classes need it
#include "Command.hxx" #include "Command.hxx"
@ -39,7 +39,7 @@ class CartDebugWidget : public Widget, public CommandSender
public: public:
int addBaseInformation(size_t bytes, string_view manufacturer, int addBaseInformation(size_t bytes, string_view manufacturer,
string_view desc, const uInt16 maxlines = 10); string_view desc, uInt16 maxlines = 10);
// Inform the ROM Widget that the underlying cart has somehow changed // Inform the ROM Widget that the underlying cart has somehow changed
void invalidate(); void invalidate();

View File

@ -25,7 +25,7 @@ class PopUpWidget;
namespace GUI { namespace GUI {
class Font; class Font;
} } // namespace GUI
#include "Variant.hxx" #include "Variant.hxx"
#include "CartDebugWidget.hxx" #include "CartDebugWidget.hxx"

View File

@ -44,14 +44,14 @@ class CpuWidget : public Widget, public CommandSender
private: private:
// ID's for the various widgets // ID's for the various widgets
// We need ID's, since there are more than one of several types of widgets // We need ID's, since there are more than one of several types of widgets
enum { enum: uInt8 {
kPCRegID, kPCRegID,
kCpuRegID, kCpuRegID,
kCpuRegDecID, kCpuRegDecID,
kCpuRegBinID kCpuRegBinID
}; };
enum { enum: uInt8 {
kPCRegAddr, kPCRegAddr,
kSPRegAddr, kSPRegAddr,
kARegAddr, kARegAddr,
@ -59,7 +59,7 @@ class CpuWidget : public Widget, public CommandSender
kYRegAddr kYRegAddr
}; };
enum { enum: uInt8 {
kPSRegN = 0, kPSRegN = 0,
kPSRegV = 1, kPSRegV = 1,
kPSRegB = 3, kPSRegB = 3,

View File

@ -78,7 +78,7 @@ class DataGridWidget : public EditableWidget
// Account for the extra width of embedded scrollbar // Account for the extra width of embedded scrollbar
int getWidth() const override; int getWidth() const override;
int colWidth() { return _colWidth; } int colWidth() const { return _colWidth; }
void setOpsWidget(DataGridOpsWidget* w) { _opsWidget = w; } void setOpsWidget(DataGridOpsWidget* w) { _opsWidget = w; }

View File

@ -38,10 +38,10 @@ class OptionsDialog;
namespace GUI { namespace GUI {
class MessageBox; class MessageBox;
} } // namespace GUI
namespace Common { namespace Common {
struct Rect; struct Rect;
} } // namespace Common
#include "Dialog.hxx" #include "Dialog.hxx"
@ -50,7 +50,7 @@ class DebuggerDialog : public Dialog
public: public:
// Note: these sizes make sure that all major tabs are fully visible // Note: these sizes make sure that all major tabs are fully visible
// cart dependend information (e.g. DPC+) may require more space // cart dependend information (e.g. DPC+) may require more space
enum { enum: uInt16 {
kSmallFontMinW = 1090, kSmallFontMinH = 720, kSmallFontMinW = 1090, kSmallFontMinH = 720,
kMediumFontMinW = 1160, kMediumFontMinH = 770, kMediumFontMinW = 1160, kMediumFontMinH = 770,
kLargeFontMinW = 1160, kLargeFontMinH = 870 kLargeFontMinW = 1160, kLargeFontMinH = 870

View File

@ -29,7 +29,7 @@ class GenesisWidget : public ControllerWidget
~GenesisWidget() override = default; ~GenesisWidget() override = default;
private: private:
enum { kJUp = 0, kJDown, kJLeft, kJRight, kJBbtn, kJCbtn }; enum: uInt8 { kJUp = 0, kJDown, kJLeft, kJRight, kJBbtn, kJCbtn };
std::array<CheckboxWidget*, 6> myPins{nullptr}; std::array<CheckboxWidget*, 6> myPins{nullptr};
static constexpr std::array<Controller::DigitalPin, 5> ourPinNo = {{ static constexpr std::array<Controller::DigitalPin, 5> ourPinNo = {{

View File

@ -29,7 +29,7 @@ class Joy2BPlusWidget : public ControllerWidget
~Joy2BPlusWidget() override = default; ~Joy2BPlusWidget() override = default;
private: private:
enum { kJUp = 0, kJDown, kJLeft, kJRight, kJButtonB, kJButtonC, kJButton3 }; enum: uInt8 { kJUp = 0, kJDown, kJLeft, kJRight, kJButtonB, kJButtonC, kJButton3 };
std::array<CheckboxWidget*, 7> myPins{nullptr}; std::array<CheckboxWidget*, 7> myPins{nullptr};
static constexpr std::array<Controller::DigitalPin, 5> ourPinNo = {{ static constexpr std::array<Controller::DigitalPin, 5> ourPinNo = {{

View File

@ -29,7 +29,7 @@ class JoystickWidget : public ControllerWidget
~JoystickWidget() override = default; ~JoystickWidget() override = default;
private: private:
enum { kJUp = 0, kJDown, kJLeft, kJRight, kJFire }; enum: uInt8 { kJUp = 0, kJDown, kJLeft, kJRight, kJFire };
std::array<CheckboxWidget*, 5> myPins{nullptr}; std::array<CheckboxWidget*, 5> myPins{nullptr};
static constexpr std::array<Controller::DigitalPin, 5> ourPinNo = {{ static constexpr std::array<Controller::DigitalPin, 5> ourPinNo = {{

View File

@ -141,7 +141,7 @@ void PointingDeviceWidget::setGrayCodeV()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PointingDeviceWidget::setValue(DataGridWidget* grayValue, void PointingDeviceWidget::setValue(DataGridWidget* grayValue,
const int index, const int direction) int index, int direction)
{ {
const uInt8 grayCode = getGrayCodeTable(index, direction); const uInt8 grayCode = getGrayCodeTable(index, direction);

View File

@ -45,14 +45,14 @@ class PointingDeviceWidget : public ControllerWidget
CheckboxWidget* myFire{nullptr}; CheckboxWidget* myFire{nullptr};
private: private:
virtual uInt8 getGrayCodeTable(const int index, const int direction) const = 0; virtual uInt8 getGrayCodeTable(int index, int direction) const = 0;
void loadConfig() override; void loadConfig() override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override; void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
void setGrayCodeH(); void setGrayCodeH();
void setGrayCodeV(); void setGrayCodeV();
void setValue(DataGridWidget* grayValue, const int index, const int direction); void setValue(DataGridWidget* grayValue, int index, int direction);
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported
PointingDeviceWidget() = delete; PointingDeviceWidget() = delete;

View File

@ -100,7 +100,7 @@ class PromptWidget : public Widget, public CommandSender
void resetFunctions(); void resetFunctions();
private: private:
enum { enum: uInt16 {
kBufferSize = 32768, kBufferSize = 32768,
kLineBufferSize = 256, kLineBufferSize = 256,
kHistorySize = 1000 kHistorySize = 1000

View File

@ -75,7 +75,7 @@ class RiotWidget : public Widget, public CommandSender
// ID's for the various widgets // ID's for the various widgets
// We need ID's, since there are more than one of several types of widgets // We need ID's, since there are more than one of several types of widgets
enum { enum: uInt8 {
kTim1TID, kTim8TID, kTim64TID, kTim1024TID, kTimWriteID, kTim1TID, kTim8TID, kTim64TID, kTim1024TID, kTimWriteID,
kSWCHABitsID, kSWACNTBitsID, kSWCHBBitsID, kSWBCNTBitsID, kSWCHABitsID, kSWACNTBitsID, kSWCHBBitsID, kSWBCNTBitsID,
kP0DiffChanged, kP1DiffChanged, kTVTypeChanged, kSelectID, kResetID, kP0DiffChanged, kP1DiffChanged, kTVTypeChanged, kSelectID, kResetID,

View File

@ -102,7 +102,7 @@ class TiaWidget : public Widget, public CommandSender
// ID's for the various widgets // ID's for the various widgets
// We need ID's, since there are more than one of several types of widgets // We need ID's, since there are more than one of several types of widgets
enum { enum: uInt8 {
kP0_PFID, kP0_BLID, kP0_M1ID, kP0_M0ID, kP0_P1ID, kP0_PFID, kP0_BLID, kP0_M1ID, kP0_M0ID, kP0_P1ID,
kP1_PFID, kP1_BLID, kP1_M1ID, kP1_M0ID, kP1_PFID, kP1_BLID, kP1_M1ID, kP1_M0ID,
kM0_PFID, kM0_BLID, kM0_M1ID, kM0_PFID, kM0_BLID, kM0_M1ID,
@ -146,7 +146,7 @@ class TiaWidget : public Widget, public CommandSender
}; };
// Color registers // Color registers
enum { enum: uInt8 {
kCOLUP0Addr, kCOLUP0Addr,
kCOLUP1Addr, kCOLUP1Addr,
kCOLUPFAddr, kCOLUPFAddr,

View File

@ -25,7 +25,7 @@ TrakBallWidget::TrakBallWidget(GuiObject* boss, const GUI::Font& font,
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 TrakBallWidget::getGrayCodeTable(const int index, const int direction) const uInt8 TrakBallWidget::getGrayCodeTable(int index, int direction) const
{ {
return myGrayCodeTable[(index & 0b1) + direction * 2]; return myGrayCodeTable[(index & 0b1) + direction * 2];
} }

View File

@ -31,9 +31,11 @@ class TrakBallWidget : public PointingDeviceWidget
~TrakBallWidget() override = default; ~TrakBallWidget() override = default;
private: private:
const std::array<uInt8, 4> myGrayCodeTable = { 0b00, 0b10, 0b01, 0b11 }; static constexpr std::array<uInt8, 4> myGrayCodeTable = {
0b00, 0b10, 0b01, 0b11
};
uInt8 getGrayCodeTable(const int index, const int direction) const override; uInt8 getGrayCodeTable(int index, int direction) const override;
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported
TrakBallWidget() = delete; TrakBallWidget() = delete;

View File

@ -40,6 +40,6 @@ namespace YaccParser
CpuMethod getCpuSpecial(const char* ch); CpuMethod getCpuSpecial(const char* ch);
RiotMethod getRiotSpecial(const char* ch); RiotMethod getRiotSpecial(const char* ch);
TiaMethod getTiaSpecial(const char* ch); TiaMethod getTiaSpecial(const char* ch);
} } // namespace YaccParser
#endif #endif

View File

@ -37,7 +37,7 @@ class Bankswitch
{ {
public: public:
// Currently supported bankswitch schemes // Currently supported bankswitch schemes
enum class Type { enum class Type: uInt8 {
_AUTO, _03E0, _0840, _0FA0, _2IN1, _4IN1, _8IN1, _16IN1, _AUTO, _03E0, _0840, _0FA0, _2IN1, _4IN1, _8IN1, _16IN1,
_32IN1, _64IN1, _128IN1, _2K, _3E, _3EX, _3EP, _3F, _32IN1, _64IN1, _128IN1, _2K, _3E, _3EX, _3EP, _3F,
_4A50, _4K, _4KSC, _AR, _BF, _BFSC, _BUS, _CDF, _4A50, _4K, _4KSC, _AR, _BF, _BFSC, _BUS, _CDF,
@ -60,7 +60,7 @@ class Bankswitch
static constexpr size_t any_KB = 0; static constexpr size_t any_KB = 0;
static const std::array<SizesType, static const std::array<SizesType,
static_cast<uInt32>(Type::NumSchemes)> Sizes; static_cast<uInt8>(Type::NumSchemes)> Sizes;
// 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
@ -69,7 +69,7 @@ class Bankswitch
string_view desc; string_view desc;
}; };
static const std::array<Description, static const std::array<Description,
static_cast<uInt32>(Type::NumSchemes)> BSList; static_cast<uInt8>(Type::NumSchemes)> BSList;
public: public:
// Convert BSType enum to string // Convert BSType enum to string
@ -96,14 +96,14 @@ class Bankswitch
/** /**
Convenience functions for different parameter types. Convenience functions for different parameter types.
*/ */
static inline bool isValidRomName(const FSNode& name, string& ext) { static bool isValidRomName(const FSNode& name, string& ext) {
return isValidRomName(name.getPath(), ext); return isValidRomName(name.getPath(), ext);
} }
static inline bool isValidRomName(const FSNode& name) { static bool isValidRomName(const FSNode& name) {
string ext; // extension not used string ext; // extension not used
return isValidRomName(name.getPath(), ext); return isValidRomName(name.getPath(), ext);
} }
static inline bool isValidRomName(string_view name) { static bool isValidRomName(string_view name) {
string ext; // extension not used string ext; // extension not used
return isValidRomName(name, ext); return isValidRomName(name, ext);
} }
@ -130,6 +130,7 @@ class Bankswitch
private: private:
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported
Bankswitch() = delete; Bankswitch() = delete;
~Bankswitch() = delete;
Bankswitch(const Bankswitch&) = delete; Bankswitch(const Bankswitch&) = delete;
Bankswitch(Bankswitch&&) = delete; Bankswitch(Bankswitch&&) = delete;
Bankswitch& operator=(const Bankswitch&) = delete; Bankswitch& operator=(const Bankswitch&) = delete;

View File

@ -32,7 +32,7 @@ class Settings;
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
namespace GUI { namespace GUI {
class Font; class Font;
} } // namespace GUI
#endif #endif
/** /**
@ -167,8 +167,8 @@ class Cartridge : public Device
@return Address of illegal access if one occurred, else 0 @return Address of illegal access if one occurred, else 0
*/ */
inline uInt16 getIllegalRAMReadAccess() const { uInt16 getIllegalRAMReadAccess() const {
return myRamReadAccesses.size() > 0 ? myRamReadAccesses[0] : 0; return !myRamReadAccesses.empty() ? myRamReadAccesses[0] : 0;
} }
/** /**
@ -178,7 +178,9 @@ class Cartridge : public Device
@return Address of illegal access if one occurred, else 0 @return Address of illegal access if one occurred, else 0
*/ */
inline uInt16 getIllegalRAMWriteAccess() const { return myRamWriteAccess; } uInt16 getIllegalRAMWriteAccess() const {
return myRamWriteAccess;
}
/** /**
Query the access counters Query the access counters

View File

@ -176,43 +176,37 @@ class Cartridge4A50 : public Cartridge
/** /**
Methods to perform all the ways that banks can be switched Methods to perform all the ways that banks can be switched
*/ */
inline void bankROMLower(uInt16 value) void bankROMLower(uInt16 value) {
{
myIsRomLow = true; myIsRomLow = true;
mySliceLow = value << 11; mySliceLow = value << 11;
myBankChanged = true; myBankChanged = true;
} }
inline void bankRAMLower(uInt16 value) void bankRAMLower(uInt16 value) {
{
myIsRomLow = false; myIsRomLow = false;
mySliceLow = value << 11; mySliceLow = value << 11;
myBankChanged = true; myBankChanged = true;
} }
inline void bankROMMiddle(uInt16 value) void bankROMMiddle(uInt16 value) {
{
myIsRomMiddle = true; myIsRomMiddle = true;
mySliceMiddle = value << 11; mySliceMiddle = value << 11;
myBankChanged = true; myBankChanged = true;
} }
inline void bankRAMMiddle(uInt16 value) void bankRAMMiddle(uInt16 value) {
{
myIsRomMiddle = false; myIsRomMiddle = false;
mySliceMiddle = value << 11; mySliceMiddle = value << 11;
myBankChanged = true; myBankChanged = true;
} }
inline void bankROMHigh(uInt16 value) void bankROMHigh(uInt16 value) {
{
myIsRomHigh = true; myIsRomHigh = true;
mySliceHigh = value << 8; mySliceHigh = value << 8;
myBankChanged = true; myBankChanged = true;
} }
inline void bankRAMHigh(uInt16 value) void bankRAMHigh(uInt16 value) {
{
myIsRomHigh = false; myIsRomHigh = false;
mySliceHigh = value << 8; mySliceHigh = value << 8;
myBankChanged = true; myBankChanged = true;

View File

@ -42,7 +42,7 @@ class CartridgeBUS : public CartridgeARM
friend class CartridgeBUSInfoWidget; friend class CartridgeBUSInfoWidget;
friend class CartridgeRamBUSWidget; friend class CartridgeRamBUSWidget;
enum class BUSSubtype { enum class BUSSubtype: uInt8 {
BUS0, // very old demos when BUS was in flux, not supported in Stella BUS0, // very old demos when BUS was in flux, not supported in Stella
BUS1, // draconian_20161102.bin BUS1, // draconian_20161102.bin
BUS2, // 128bus_20170120.bin, 128chronocolour_20170101.bin, parrot_20161231_NTSC.bin BUS2, // 128bus_20170120.bin, 128chronocolour_20170101.bin, parrot_20161231_NTSC.bin

View File

@ -66,7 +66,7 @@ class CartridgeCDF : public CartridgeARM
public: public:
enum class CDFSubtype { enum class CDFSubtype: uInt8 {
CDF0, CDF0,
CDF1, CDF1,
CDFJ, CDFJ,

View File

@ -86,6 +86,7 @@ class CartCreator
private: private:
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported
CartCreator() = delete; CartCreator() = delete;
~CartCreator() = delete;
CartCreator(const CartCreator&) = delete; CartCreator(const CartCreator&) = delete;
CartCreator(CartCreator&&) = delete; CartCreator(CartCreator&&) = delete;
CartCreator& operator=(const CartCreator&) = delete; CartCreator& operator=(const CartCreator&) = delete;

View File

@ -259,6 +259,7 @@ class CartDetector
private: private:
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported
CartDetector() = delete; CartDetector() = delete;
~CartDetector() = delete;
CartDetector(const CartDetector&) = delete; CartDetector(const CartDetector&) = delete;
CartDetector(CartDetector&&) = delete; CartDetector(CartDetector&&) = delete;
CartDetector& operator=(const CartDetector&) = delete; CartDetector& operator=(const CartDetector&) = delete;

View File

@ -542,7 +542,7 @@ void CartridgeELF::runArm()
) )
return; return;
const uInt32 cyclesGoal = static_cast<uInt32>( const auto cyclesGoal = static_cast<uInt32>(
(mySystem->cycles() + ARM_RUNAHED_MAX) * myArmCyclesPer6502Cycle - getArmCycles()); (mySystem->cycles() + ARM_RUNAHED_MAX) * myArmCyclesPer6502Cycle - getArmCycles());
uInt32 cycles = 0; uInt32 cycles = 0;

View File

@ -52,6 +52,7 @@ class CompuMate
@param system The system using this controller @param system The system using this controller
*/ */
CompuMate(const Console& console, const Event& event, const System& system); CompuMate(const Console& console, const Event& event, const System& system);
~CompuMate() = default;
/** /**
Return the left and right CompuMate controllers Return the left and right CompuMate controllers

View File

@ -968,11 +968,12 @@ void Console::setControllers(string_view romMd5)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changeLeftController(int direction) void Console::changeLeftController(int direction)
{ {
int type = static_cast<int>(Controller::getType(myProperties.get(PropType::Controller_Left))); auto type =
static_cast<uInt8>(Controller::getType(myProperties.get(PropType::Controller_Left)));
if(!type) if(!type)
type = static_cast<int>(Controller::getType(leftController().name())); type = static_cast<uInt8>(Controller::getType(leftController().name()));
type = BSPF::clampw(type + direction, type = BSPF::clampw(type + direction,
1, static_cast<int>(Controller::Type::LastType) - 1); 1, static_cast<uInt8>(Controller::Type::LastType) - 1);
myProperties.set(PropType::Controller_Left, Controller::getPropName(Controller::Type{type})); myProperties.set(PropType::Controller_Left, Controller::getPropName(Controller::Type{type}));
setControllers(myProperties.get(PropType::Cart_MD5)); setControllers(myProperties.get(PropType::Cart_MD5));
@ -985,11 +986,12 @@ void Console::changeLeftController(int direction)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changeRightController(int direction) void Console::changeRightController(int direction)
{ {
int type = static_cast<int>(Controller::getType(myProperties.get(PropType::Controller_Right))); auto type =
static_cast<uInt8>(Controller::getType(myProperties.get(PropType::Controller_Right)));
if(!type) if(!type)
type = static_cast<int>(Controller::getType(rightController().name())); type = static_cast<uInt8>(Controller::getType(rightController().name()));
type = BSPF::clampw(type + direction, type = BSPF::clampw(type + direction,
1, static_cast<int>(Controller::Type::LastType) - 1); 1, static_cast<uInt8>(Controller::Type::LastType) - 1);
myProperties.set(PropType::Controller_Right, Controller::getPropName(Controller::Type{type})); myProperties.set(PropType::Controller_Right, Controller::getPropName(Controller::Type{type}));
setControllers(myProperties.get(PropType::Cart_MD5)); setControllers(myProperties.get(PropType::Cart_MD5));
@ -1001,7 +1003,7 @@ void Console::changeRightController(int direction)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unique_ptr<Controller> Console::getControllerPort( unique_ptr<Controller> Console::getControllerPort(
const Controller::Type type, const Controller::Jack port, string_view romMd5) Controller::Type type, Controller::Jack port, string_view romMd5)
{ {
unique_ptr<Controller> controller; unique_ptr<Controller> controller;

View File

@ -428,8 +428,8 @@ class Console : public Serializable, public ConsoleIO
/** /**
Selects the left or right controller depending on ROM properties Selects the left or right controller depending on ROM properties
*/ */
unique_ptr<Controller> getControllerPort(const Controller::Type type, unique_ptr<Controller> getControllerPort(Controller::Type type,
const Controller::Jack port, Controller::Jack port,
string_view romMd5); string_view romMd5);
void toggleTIABit(TIABit bit, string_view bitname, void toggleTIABit(TIABit bit, string_view bitname,

View File

@ -21,7 +21,7 @@
/** /**
Contains timing information about the specified console. Contains timing information about the specified console.
*/ */
enum class ConsoleTiming enum class ConsoleTiming: uInt8
{ {
ntsc, // console with CPU running at 1.193182 MHz, NTSC colours ntsc, // console with CPU running at 1.193182 MHz, NTSC colours
pal, // console with CPU running at 1.182298 MHz, PAL colours pal, // console with CPU running at 1.182298 MHz, PAL colours

View File

@ -136,7 +136,7 @@ string Controller::getPropName(const Type type)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Controller::Type Controller::getType(string_view propName) Controller::Type Controller::getType(string_view propName)
{ {
for(int i = 0; i < static_cast<int>(Type::LastType); ++i) for(uInt8 i = 0; i < static_cast<uInt8>(Type::LastType); ++i)
if (BSPF::equalsIgnoreCase(propName, getPropName(Type{i}))) if (BSPF::equalsIgnoreCase(propName, getPropName(Type{i})))
return Type{i}; return Type{i};

View File

@ -81,22 +81,22 @@ class Controller : public Serializable
/** /**
Enumeration of the controller jacks Enumeration of the controller jacks
*/ */
enum class Jack { Left = 0, Right = 1, Left2 = 2, Right2 = 3 }; enum class Jack: uInt8 { Left = 0, Right = 1, Left2 = 2, Right2 = 3 };
/** /**
Enumeration of the digital pins of a controller port Enumeration of the digital pins of a controller port
*/ */
enum class DigitalPin { One, Two, Three, Four, Six }; enum class DigitalPin: uInt8 { One, Two, Three, Four, Six };
/** /**
Enumeration of the analog pins of a controller port Enumeration of the analog pins of a controller port
*/ */
enum class AnalogPin { Five, Nine }; enum class AnalogPin: uInt8 { Five, Nine };
/** /**
Enumeration of the controller types Enumeration of the controller types
*/ */
enum class Type enum class Type: uInt8
{ {
Unknown, Unknown,
AmigaMouse, AtariMouse, AtariVox, BoosterGrip, CompuMate, AmigaMouse, AtariMouse, AtariVox, BoosterGrip, CompuMate,
@ -269,12 +269,12 @@ class Controller : public Serializable
/** /**
Returns the display name of the given controller type Returns the display name of the given controller type
*/ */
static string getName(const Type type); static string getName(Type type);
/** /**
Returns the property name of the given controller type Returns the property name of the given controller type
*/ */
static string getPropName(const Type type); static string getPropName(Type type);
/** /**
Returns the controller type of the given property name Returns the controller type of the given property name
@ -305,9 +305,8 @@ class Controller : public Serializable
*/ */
static int analogDeadZoneValue(int deadZone); static int analogDeadZoneValue(int deadZone);
inline static int digitalDeadZone() { return DIGITAL_DEAD_ZONE; } static int digitalDeadZone() { return DIGITAL_DEAD_ZONE; }
static int analogDeadZone() { return ANALOG_DEAD_ZONE; }
inline static int analogDeadZone() { return ANALOG_DEAD_ZONE; }
/** /**
Sets the sensitivity for analog emulation movement Sets the sensitivity for analog emulation movement
@ -338,28 +337,28 @@ class Controller : public Serializable
Derived classes *must* use these accessor/mutator methods. Derived classes *must* use these accessor/mutator methods.
The read/write methods above are meant to be used at a higher level. The read/write methods above are meant to be used at a higher level.
*/ */
inline bool setPin(DigitalPin pin, bool value) { bool setPin(DigitalPin pin, bool value) {
return myDigitalPinState[static_cast<int>(pin)] = value; return myDigitalPinState[static_cast<int>(pin)] = value;
} }
inline bool getPin(DigitalPin pin) const { bool getPin(DigitalPin pin) const {
return myDigitalPinState[static_cast<int>(pin)]; return myDigitalPinState[static_cast<int>(pin)];
} }
inline void setPin(AnalogPin pin, AnalogReadout::Connection value) { void setPin(AnalogPin pin, AnalogReadout::Connection value) {
myAnalogPinValue[static_cast<int>(pin)] = value; myAnalogPinValue[static_cast<int>(pin)] = value;
if(myOnAnalogPinUpdateCallback) if(myOnAnalogPinUpdateCallback)
myOnAnalogPinUpdateCallback(pin); myOnAnalogPinUpdateCallback(pin);
} }
inline AnalogReadout::Connection getPin(AnalogPin pin) const { AnalogReadout::Connection getPin(AnalogPin pin) const {
return myAnalogPinValue[static_cast<int>(pin)]; return myAnalogPinValue[static_cast<int>(pin)];
} }
inline void resetDigitalPins() { void resetDigitalPins() {
setPin(DigitalPin::One, true); setPin(DigitalPin::One, true);
setPin(DigitalPin::Two, true); setPin(DigitalPin::Two, true);
setPin(DigitalPin::Three, true); setPin(DigitalPin::Three, true);
setPin(DigitalPin::Four, true); setPin(DigitalPin::Four, true);
setPin(DigitalPin::Six, true); setPin(DigitalPin::Six, true);
} }
inline void resetAnalogPins() { void resetAnalogPins() {
setPin(AnalogPin::Five, AnalogReadout::disconnect()); setPin(AnalogPin::Five, AnalogReadout::disconnect());
setPin(AnalogPin::Nine, AnalogReadout::disconnect()); setPin(AnalogPin::Nine, AnalogReadout::disconnect());
} }
@ -370,7 +369,7 @@ class Controller : public Serializable
@param pressed True if the fire button is currently pressed @param pressed True if the fire button is currently pressed
@return The result of the auto fire event check @return The result of the auto fire event check
*/ */
inline bool getAutoFireState(bool pressed) bool getAutoFireState(bool pressed)
{ {
if(AUTO_FIRE && AUTO_FIRE_RATE && pressed) if(AUTO_FIRE && AUTO_FIRE_RATE && pressed)
{ {
@ -389,7 +388,7 @@ class Controller : public Serializable
@param pressed True if the fire button is current pressed @param pressed True if the fire button is current pressed
@return The result of the auto fire event check @return The result of the auto fire event check
*/ */
inline bool getAutoFireStateP1(bool pressed) bool getAutoFireStateP1(bool pressed)
{ {
if(AUTO_FIRE && AUTO_FIRE_RATE && pressed) if(AUTO_FIRE && AUTO_FIRE_RATE && pressed)
{ {

View File

@ -38,26 +38,26 @@ class ControllerLowLevel
: myController(controller) { } : myController(controller) { }
virtual ~ControllerLowLevel() = default; virtual ~ControllerLowLevel() = default;
inline bool setPin(Controller::DigitalPin pin, bool value) { bool setPin(Controller::DigitalPin pin, bool value) {
return myController.setPin(pin, value); return myController.setPin(pin, value);
} }
inline bool togglePin(Controller::DigitalPin pin) { return false; } bool togglePin(Controller::DigitalPin pin) { return false; } // NOLINT (is this required?)
inline bool getPin(Controller::DigitalPin pin) const { bool getPin(Controller::DigitalPin pin) const {
return myController.getPin(pin); return myController.getPin(pin);
} }
inline void setPin(Controller::AnalogPin pin, AnalogReadout::Connection value) { void setPin(Controller::AnalogPin pin, AnalogReadout::Connection value) {
myController.setPin(pin, value); myController.setPin(pin, value);
} }
inline AnalogReadout::Connection getPin(Controller::AnalogPin pin) const { AnalogReadout::Connection getPin(Controller::AnalogPin pin) const {
return myController.getPin(pin); return myController.getPin(pin);
} }
inline void resetDigitalPins() { void resetDigitalPins() {
myController.resetDigitalPins(); myController.resetDigitalPins();
} }
inline void resetAnalogPins() { void resetAnalogPins() {
myController.resetAnalogPins(); myController.resetAnalogPins();
} }
inline Controller& controller() const { return myController; } Controller& controller() const { return myController; }
protected: protected:
Controller& myController; Controller& myController;

View File

@ -23,7 +23,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Controller::Type ControllerDetector::detectType( Controller::Type ControllerDetector::detectType(
const ByteBuffer& image, size_t size, const ByteBuffer& image, size_t size,
const Controller::Type type, const Controller::Jack port, Controller::Type type, Controller::Jack port,
const Settings& settings, bool isQuadTari) const Settings& settings, bool isQuadTari)
{ {
if(type == Controller::Type::Unknown || settings.getBool("rominfo")) if(type == Controller::Type::Unknown || settings.getBool("rominfo"))
@ -46,7 +46,7 @@ Controller::Type ControllerDetector::detectType(
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string ControllerDetector::detectName(const ByteBuffer& image, size_t size, string ControllerDetector::detectName(const ByteBuffer& image, size_t size,
const Controller::Type type, const Controller::Jack port, Controller::Type type, Controller::Jack port,
const Settings& settings, bool isQuadTari) const Settings& settings, bool isQuadTari)
{ {
return Controller::getName(detectType(image, size, type, port, settings, isQuadTari)); return Controller::getName(detectType(image, size, type, port, settings, isQuadTari));

View File

@ -43,7 +43,7 @@ class ControllerDetector
@return The detected controller type @return The detected controller type
*/ */
static Controller::Type detectType(const ByteBuffer& image, size_t size, static Controller::Type detectType(const ByteBuffer& image, size_t size,
const Controller::Type type, const Controller::Jack port, Controller::Type type, Controller::Jack port,
const Settings& settings, bool isQuadTari = false); const Settings& settings, bool isQuadTari = false);
/** /**
@ -60,7 +60,7 @@ class ControllerDetector
@return The (detected) controller name @return The (detected) controller name
*/ */
static string detectName(const ByteBuffer& image, size_t size, static string detectName(const ByteBuffer& image, size_t size,
const Controller::Type type, const Controller::Jack port, Controller::Type type, Controller::Jack port,
const Settings& settings, bool isQuadTari = false); const Settings& settings, bool isQuadTari = false);
private: private:
@ -137,6 +137,7 @@ class ControllerDetector
private: private:
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported
ControllerDetector() = delete; ControllerDetector() = delete;
~ControllerDetector() = delete;
ControllerDetector(const ControllerDetector&) = delete; ControllerDetector(const ControllerDetector&) = delete;
ControllerDetector(ControllerDetector&&) = delete; ControllerDetector(ControllerDetector&&) = delete;
ControllerDetector& operator=(const ControllerDetector&) = delete; ControllerDetector& operator=(const ControllerDetector&) = delete;

View File

@ -25,6 +25,8 @@
regenerated and the application recompiled. regenerated and the application recompiled.
*/ */
// NOLINTBEGIN: static analyzer can't tell the following is data
static constexpr uInt32 DEF_PROPS_SIZE = 3661; static constexpr uInt32 DEF_PROPS_SIZE = 3661;
/** /**
@ -3698,4 +3700,6 @@ static constexpr BSPF::array2D<const char*, DEF_PROPS_SIZE, 30> DefProps = {{
{ "ffebb0070689b9d322687edd9c0a2bae", "", "", "Spitfire Attack (1983) (Milton Bradley) [h1]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" } { "ffebb0070689b9d322687edd9c0a2bae", "", "", "Spitfire Attack (1983) (Milton Bradley) [h1]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" }
}}; }};
// NOLINTEND
#endif #endif

View File

@ -33,7 +33,7 @@ class System;
class Device : public Serializable class Device : public Serializable
{ {
public: public:
enum AccessType { enum AccessType: uInt16 {
NONE = 0, NONE = 0,
REFERENCED = 1 << 0, /* 0x01, code somewhere in the program references it, REFERENCED = 1 << 0, /* 0x01, code somewhere in the program references it,
i.e. LDA $F372 referenced $F372 */ i.e. LDA $F372 referenced $F372 */
@ -102,7 +102,7 @@ class Device : public Serializable
@param out The Serializer object to use @param out The Serializer object to use
@return False on any errors, else true @return False on any errors, else true
*/ */
virtual bool save(Serializer& out) const override = 0; bool save(Serializer& out) const override = 0;
/** /**
Load the current state of this device from the given Serializer. Load the current state of this device from the given Serializer.
@ -110,7 +110,7 @@ class Device : public Serializable
@param in The Serializer object to use @param in The Serializer object to use
@return False on any errors, else true @return False on any errors, else true
*/ */
virtual bool load(Serializer& in) override = 0; bool load(Serializer& in) override = 0;
public: public:
/** /**

View File

@ -23,7 +23,7 @@
class DispatchResult class DispatchResult
{ {
public: public:
enum class Status { invalid, ok, debugger, fatal }; enum class Status: uInt8 { invalid, ok, debugger, fatal };
public: public:

View File

@ -25,8 +25,9 @@
class EmulationTiming { class EmulationTiming {
public: public:
EmulationTiming(FrameLayout frameLayout = FrameLayout::ntsc, explicit EmulationTiming(FrameLayout frameLayout = FrameLayout::ntsc,
ConsoleTiming consoleTiming = ConsoleTiming::ntsc); ConsoleTiming consoleTiming = ConsoleTiming::ntsc);
~EmulationTiming() = default;
EmulationTiming& updateFrameLayout(FrameLayout frameLayout); EmulationTiming& updateFrameLayout(FrameLayout frameLayout);

View File

@ -134,7 +134,7 @@ class EmulationWorker
/** /**
Thread state. Thread state.
*/ */
enum class State { enum class State: uInt8 {
// Initial state // Initial state
initializing, initializing,
// Thread has initialized. From the point, myThreadIsRunningMutex is locked if and only if // Thread has initialized. From the point, myThreadIsRunningMutex is locked if and only if
@ -153,7 +153,7 @@ class EmulationWorker
/** /**
Thread behavior is controlled by signals that are raised prior to waking up the thread. Thread behavior is controlled by signals that are raised prior to waking up the thread.
*/ */
enum class Signal { enum class Signal: uInt8 {
// Resume emulation // Resume emulation
resume, resume,
// Stop emulation // Stop emulation

View File

@ -34,7 +34,7 @@ class Event
console and controller event types as well as events that aren't console and controller event types as well as events that aren't
technically part of the emulation core. technically part of the emulation core.
*/ */
enum Type enum Type: uInt16
{ {
NoType = 0, NoType = 0,
ConsoleColor, ConsoleBlackWhite, ConsoleColorToggle, Console7800Pause, ConsoleColor, ConsoleBlackWhite, ConsoleColorToggle, Console7800Pause,
@ -182,7 +182,7 @@ class Event
}; };
// Event categorizing groups // Event categorizing groups
enum Group enum Group: uInt8
{ {
Menu, Emulation, Menu, Emulation,
Misc, AudioVideo, States, Console, Joystick, Paddles, Driving, Keyboard, Misc, AudioVideo, States, Console, Joystick, Paddles, Driving, Keyboard,
@ -201,13 +201,14 @@ class Event
Create a new event object. Create a new event object.
*/ */
Event() { clear(); } Event() { clear(); }
~Event() = default;
public: public:
/** /**
Get the value associated with the event of the specified type. Get the value associated with the event of the specified type.
*/ */
Int32 get(Type type) const { Int32 get(Type type) const {
std::lock_guard<std::mutex> lock(myMutex); const std::lock_guard<std::mutex> lock(myMutex);
return myValues[type]; return myValues[type];
} }
@ -216,7 +217,7 @@ class Event
Set the value associated with the event of the specified type. Set the value associated with the event of the specified type.
*/ */
void set(Type type, Int32 value) { void set(Type type, Int32 value) {
std::lock_guard<std::mutex> lock(myMutex); const std::lock_guard<std::mutex> lock(myMutex);
myValues[type] = value; myValues[type] = value;
} }
@ -226,7 +227,7 @@ class Event
*/ */
void clear() void clear()
{ {
std::lock_guard<std::mutex> lock(myMutex); const std::lock_guard<std::mutex> lock(myMutex);
myValues.fill(Event::NoType); myValues.fill(Event::NoType);
} }

View File

@ -30,7 +30,7 @@ class GlobalKeyHandler;
namespace GUI { namespace GUI {
class Font; class Font;
} } // namespace GUI
#include "Event.hxx" #include "Event.hxx"
#include "EventHandlerConstants.hxx" #include "EventHandlerConstants.hxx"
@ -59,7 +59,7 @@ class EventHandler
/** /**
Create a new event handler object Create a new event handler object
*/ */
EventHandler(OSystem& osystem); explicit EventHandler(OSystem& osystem);
virtual ~EventHandler(); virtual ~EventHandler();
/** /**
@ -428,7 +428,7 @@ class EventHandler
virtual void pollEvent() = 0; virtual void pollEvent() = 0;
// Other events that can be received from the underlying event handler // Other events that can be received from the underlying event handler
enum class SystemEvent { enum class SystemEvent: uInt8 {
WINDOW_SHOWN, WINDOW_SHOWN,
WINDOW_HIDDEN, WINDOW_HIDDEN,
WINDOW_EXPOSED, WINDOW_EXPOSED,

View File

@ -21,7 +21,7 @@
#include <string> #include <string>
// Enumeration representing the different states of operation // Enumeration representing the different states of operation
enum class EventHandlerState { enum class EventHandlerState: uInt8 {
EMULATION, EMULATION,
TIMEMACHINE, TIMEMACHINE,
PLAYBACK, PLAYBACK,
@ -36,7 +36,7 @@ enum class EventHandlerState {
NONE NONE
}; };
enum class MouseButton { enum class MouseButton: uInt8 {
LEFT, LEFT,
RIGHT, RIGHT,
MIDDLE, MIDDLE,
@ -47,7 +47,7 @@ enum class MouseButton {
static constexpr int JOY_CTRL_NONE = -1; static constexpr int JOY_CTRL_NONE = -1;
enum class JoyAxis { enum class JoyAxis: Int8 {
X = 0, // make sure these are set correctly, X = 0, // make sure these are set correctly,
Y = 1, // since they'll be used as array indices Y = 1, // since they'll be used as array indices
Z = 2, Z = 2,
@ -55,14 +55,14 @@ enum class JoyAxis {
NONE = JOY_CTRL_NONE NONE = JOY_CTRL_NONE
}; };
enum class JoyDir { enum class JoyDir: Int8 {
NEG = -1, NEG = -1,
POS = 1, POS = 1,
NONE = 0, NONE = 0,
ANALOG = 2 ANALOG = 2
}; };
enum class JoyHatDir { enum class JoyHatDir: uInt8 {
UP = 0, // make sure these are set correctly, UP = 0, // make sure these are set correctly,
DOWN = 1, // since they'll be used as array indices DOWN = 1, // since they'll be used as array indices
LEFT = 2, LEFT = 2,
@ -70,7 +70,7 @@ enum class JoyHatDir {
CENTER = 4 CENTER = 4
}; };
enum JoyHatMask { enum JoyHatMask: uInt8 {
EVENT_HATUP_M = 1<<0, EVENT_HATUP_M = 1<<0,
EVENT_HATDOWN_M = 1<<1, EVENT_HATDOWN_M = 1<<1,
EVENT_HATLEFT_M = 1<<2, EVENT_HATLEFT_M = 1<<2,
@ -78,7 +78,7 @@ enum JoyHatMask {
EVENT_HATCENTER_M = 1<<4 EVENT_HATCENTER_M = 1<<4
}; };
enum class EventMode { enum class EventMode: uInt8 {
kEmulationMode, // active mapping used for emulation kEmulationMode, // active mapping used for emulation
kMenuMode, // mapping used for dialogs kMenuMode, // mapping used for dialogs
kJoystickMode, // 5 extra modes for mapping controller keys separately for emulation mode kJoystickMode, // 5 extra modes for mapping controller keys separately for emulation mode
@ -92,8 +92,7 @@ enum class EventMode {
kNumModes kNumModes
}; };
namespace GUI namespace GUI {
{
#ifdef RETRON77 #ifdef RETRON77
static const std::string SELECT = "Mode"; static const std::string SELECT = "Mode";
static const std::string LEFT_DIFFICULTY = "P1 skill"; static const std::string LEFT_DIFFICULTY = "P1 skill";
@ -107,6 +106,6 @@ namespace GUI
static const std::string LEFT_DIFF = "Left Diff"; static const std::string LEFT_DIFF = "Left Diff";
static const std::string RIGHT_DIFF = "Right Diff"; static const std::string RIGHT_DIFF = "Right Diff";
#endif #endif
} } // namespace GUI
#endif // EVENTHANDLER_CONSTANTS_HXX #endif // EVENTHANDLER_CONSTANTS_HXX

View File

@ -450,7 +450,7 @@ int FBSurface::drawString(const GUI::Font& font, string_view s,
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FBSurface::checkBounds(const uInt32 x, const uInt32 y) const bool FBSurface::checkBounds(uInt32 x, uInt32 y) const
{ {
if (x <= width() && y <= height()) if (x <= width() && y <= height())
return true; return true;

View File

@ -23,10 +23,10 @@ class TIASurface;
namespace GUI { namespace GUI {
class Font; class Font;
} } // namespace GUI
namespace Common { namespace Common {
struct Rect; struct Rect;
} } // namespace Common
#include "FrameBufferConstants.hxx" #include "FrameBufferConstants.hxx"
#include "FrameBuffer.hxx" #include "FrameBuffer.hxx"
@ -55,8 +55,7 @@ class FBSurface
This method returns the surface pixel pointer and pitch, which are This method returns the surface pixel pointer and pitch, which are
used when one wishes to modify the surface pixels directly. used when one wishes to modify the surface pixels directly.
*/ */
inline void basePtr(uInt32*& pixels, uInt32& pitch) const void basePtr(uInt32*& pixels, uInt32& pitch) const {
{
pixels = myPixels; pixels = myPixels;
pitch = myPitch; pitch = myPitch;
} }
@ -403,14 +402,14 @@ class FBSurface
@param y The y coordinate to check @param y The y coordinate to check
@return True if coordinates are in bounds @return True if coordinates are in bounds
*/ */
bool checkBounds(const uInt32 x, const uInt32 y) const; bool checkBounds(uInt32 x, uInt32 y) const;
/** /**
Check if the given character is a whitespace. Check if the given character is a whitespace.
@param c Character to check @param c Character to check
@return True if whitespace character @return True if whitespace character
*/ */
static bool isWhiteSpace(const char c) { static bool isWhiteSpace(char c) {
static constexpr string_view spaces{" ,.;:+-*/\\'([\n"}; static constexpr string_view spaces{" ,.;:+-*/\\'([\n"};
return spaces.find(c) != string_view::npos; return spaces.find(c) != string_view::npos;
} }

View File

@ -59,7 +59,7 @@ class FSNode
/** /**
* Flag to tell listDir() which kind of files to list. * Flag to tell listDir() which kind of files to list.
*/ */
enum class ListMode { FilesOnly, DirectoriesOnly, All }; enum class ListMode: uInt8 { FilesOnly, DirectoriesOnly, All };
/** Function used to filter the file listing. Returns true if the filename /** Function used to filter the file listing. Returns true if the filename
should be included, else false.*/ should be included, else false.*/
@ -97,8 +97,7 @@ class FSNode
* Compare the name of this node to the name of another, testing for * Compare the name of this node to the name of another, testing for
* equality. * equality.
*/ */
inline bool operator==(const FSNode& node) const bool operator==(const FSNode& node) const {
{
return BSPF::compareIgnoreCase(getName(), node.getName()) == 0; return BSPF::compareIgnoreCase(getName(), node.getName()) == 0;
} }

View File

@ -56,7 +56,7 @@ class FrameBuffer
// Zoom level step interval // Zoom level step interval
static constexpr double ZOOM_STEPS = 0.25; static constexpr double ZOOM_STEPS = 0.25;
enum UpdateMode { enum UpdateMode: uInt8 {
NONE = 0, NONE = 0,
REDRAW = 1, REDRAW = 1,
RERENDER = 2 RERENDER = 2

View File

@ -25,31 +25,31 @@
namespace FBMinimum { namespace FBMinimum {
static constexpr uInt32 Width = TIAConstants::viewableWidth * 2; static constexpr uInt32 Width = TIAConstants::viewableWidth * 2;
static constexpr uInt32 Height = TIAConstants::viewableHeight * 2; static constexpr uInt32 Height = TIAConstants::viewableHeight * 2;
} } // namespace FBMinimum
// Return values for initialization of framebuffer window // Return values for initialization of framebuffer window
enum class FBInitStatus { enum class FBInitStatus: uInt8 {
Success, Success,
FailComplete, FailComplete,
FailTooLarge, FailTooLarge,
FailNotSupported FailNotSupported
}; };
enum class BufferType { enum class BufferType: uInt8 {
None, None,
Launcher, Launcher,
Emulator, Emulator,
Debugger Debugger
}; };
enum class ScalingInterpolation { enum class ScalingInterpolation: uInt8 {
none, none,
sharp, sharp,
blur blur
}; };
// Positions for onscreen/overlaid messages // Positions for onscreen/overlaid messages
enum class MessagePosition { enum class MessagePosition: uInt8 {
TopLeft, TopLeft,
TopCenter, TopCenter,
TopRight, TopRight,
@ -120,14 +120,14 @@ using UIPaletteArray = std::array<uInt32, kNumColors-kColor>;
using FullPaletteArray = std::array<uInt32, kNumColors>; using FullPaletteArray = std::array<uInt32, kNumColors>;
// Text alignment modes for drawString() // Text alignment modes for drawString()
enum class TextAlign { enum class TextAlign: uInt8 {
Left, Left,
Center, Center,
Right Right
}; };
// Line types for drawing rectangular frames // Line types for drawing rectangular frames
enum class FrameStyle { enum class FrameStyle: uInt8 {
Solid, Solid,
Dashed Dashed
}; };

View File

@ -34,7 +34,7 @@ GlobalKeyHandler::GlobalKeyHandler(OSystem& osystem)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool GlobalKeyHandler::handleEvent(const Event::Type event, bool pressed, bool repeated) bool GlobalKeyHandler::handleEvent(Event::Type event, bool pressed, bool repeated)
{ {
// The global settings keys change settings or values as long as the setting // The global settings keys change settings or values as long as the setting
// message from the previous settings event is still displayed. // message from the previous settings event is still displayed.
@ -136,7 +136,7 @@ bool GlobalKeyHandler::handleEvent(const Event::Type event, bool pressed, bool r
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GlobalKeyHandler::setSetting(const Setting setting) void GlobalKeyHandler::setSetting(Setting setting)
{ {
if(setting == Setting::ZOOM && myOSystem.frameBuffer().fullScreen()) if(setting == Setting::ZOOM && myOSystem.frameBuffer().fullScreen())
mySetting = Setting::FS_ASPECT; mySetting = Setting::FS_ASPECT;
@ -146,7 +146,7 @@ void GlobalKeyHandler::setSetting(const Setting setting)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GlobalKeyHandler::setDirectSetting(const Setting setting) void GlobalKeyHandler::setDirectSetting(Setting setting)
{ {
myDirectSetting = setting; myDirectSetting = setting;
} }
@ -331,7 +331,7 @@ GlobalKeyHandler::Function GlobalKeyHandler::cycleSetting(int direction)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
GlobalKeyHandler::SettingData GlobalKeyHandler::getSettingData(const Setting setting) const GlobalKeyHandler::SettingData GlobalKeyHandler::getSettingData(Setting setting) const
{ {
// Notes: // Notes:
// - all setting methods MUST always display a message // - all setting methods MUST always display a message

View File

@ -29,9 +29,10 @@ class GlobalKeyHandler
{ {
public: public:
explicit GlobalKeyHandler(OSystem& osystem); explicit GlobalKeyHandler(OSystem& osystem);
~GlobalKeyHandler() = default;
public: public:
enum class Setting enum class Setting: Int8
{ {
NONE = -1, NONE = -1,
// *** Audio & Video group *** // *** Audio & Video group ***
@ -138,14 +139,14 @@ class GlobalKeyHandler
}; };
public: public:
bool handleEvent(const Event::Type event, bool pressed, bool repeated); bool handleEvent(Event::Type event, bool pressed, bool repeated);
void setSetting(const Setting setting); void setSetting(Setting setting);
void setDirectSetting(const Setting setting); void setDirectSetting(Setting setting);
private: private:
using Function = std::function<void(int)>; using Function = std::function<void(int)>;
enum class Group enum class Group: uInt8
{ {
AV, AV,
INPUT, INPUT,
@ -171,7 +172,7 @@ class GlobalKeyHandler
// Cycle settings using given direction (can be 0) // Cycle settings using given direction (can be 0)
Function cycleSetting(int direction); Function cycleSetting(int direction);
// Get adjustment function and if it is repeated // Get adjustment function and if it is repeated
SettingData getSettingData(const Setting setting) const; SettingData getSettingData(Setting setting) const;
PhysicalJoystickHandler& joyHandler() const { PhysicalJoystickHandler& joyHandler() const {
return myOSystem.eventHandler().joyHandler(); return myOSystem.eventHandler().joyHandler();

View File

@ -63,7 +63,7 @@ class Keyboard : public Controller
string name() const override { return "Keyboard"; } string name() const override { return "Keyboard"; }
private: private:
enum class ColumnState { enum class ColumnState: uInt8 {
vcc, gnd, notConnected vcc, gnd, notConnected
}; };

View File

@ -102,7 +102,7 @@ class KidVid : public Controller
void setNextSong(); void setNextSong();
private: private:
enum class Game { enum class Game: uInt8 {
Smurfs, Smurfs,
BBears BBears
}; };

View File

@ -250,11 +250,14 @@ class M6532 : public Device
std::array<Device::AccessFlags, IO_SIZE> myIOAccessBase; std::array<Device::AccessFlags, IO_SIZE> myIOAccessBase;
// The arrays containing information about every byte of RIOT // The arrays containing information about every byte of RIOT
// indicating how often it is accessed. // indicating how often it is accessed.
std::array<Device::AccessCounter, RAM_SIZE * 2> myRAMAccessCounter; std::array<Device::AccessCounter,
std::array<Device::AccessCounter, STACK_SIZE * 2> myStackAccessCounter; static_cast<size_t>(RAM_SIZE * 2)> myRAMAccessCounter;
std::array<Device::AccessCounter, IO_SIZE * 2> myIOAccessCounter; std::array<Device::AccessCounter,
static_cast<size_t>(STACK_SIZE * 2)> myStackAccessCounter;
std::array<Device::AccessCounter,
static_cast<size_t>(IO_SIZE * 2)> myIOAccessCounter;
// The array used to skip the first ZP access tracking // The array used to skip the first ZP access tracking
std::array<uInt8, RAM_SIZE> myZPAccessDelay; std::array<uInt8, RAM_SIZE> myZPAccessDelay;
// Detect timer being accessed on wraparound // Detect timer being accessed on wraparound
bool myTimWrappedOnRead{false}; bool myTimWrappedOnRead{false};

View File

@ -60,7 +60,7 @@ void MD5::init()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Decodes input (uInt8) into output (uInt32). // Decodes input (uInt8) into output (uInt32).
// Assumes len is a multiple of 4. // Assumes len is a multiple of 4.
void MD5::decode(uInt32* output, const uInt8* const input, uInt32 len) void MD5::decode(uInt32* output, const uInt8* input, uInt32 len)
{ {
for (uInt32 i = 0, j = 0; j < len; ++i, j += 4) for (uInt32 i = 0, j = 0; j < len; ++i, j += 4)
output[i] = (static_cast<uInt32>(input[j])) output[i] = (static_cast<uInt32>(input[j]))
@ -72,7 +72,7 @@ void MD5::decode(uInt32* output, const uInt8* const input, uInt32 len)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Encodes input (uInt32) into output (uInt8). // Encodes input (uInt32) into output (uInt8).
// Assumes len is a multiple of 4. // Assumes len is a multiple of 4.
void MD5::encode(uInt8* output, const uInt32* const input, uInt32 len) void MD5::encode(uInt8* output, const uInt32* input, uInt32 len)
{ {
for (uInt32 i = 0, j = 0; j < len; ++i, j += 4) { for (uInt32 i = 0, j = 0; j < len; ++i, j += 4) {
output[j] = static_cast<uInt8>(input[i] & 0xff); output[j] = static_cast<uInt8>(input[i] & 0xff);
@ -84,7 +84,7 @@ void MD5::encode(uInt8* output, const uInt32* const input, uInt32 len)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Apply MD5 algo on a block. // Apply MD5 algo on a block.
void MD5::transform(const uInt8* const block) void MD5::transform(const uInt8* block)
{ {
std::array<uInt32, 16> x; std::array<uInt32, 16> x;
decode(x.data(), block, BLOCKSIZE); decode(x.data(), block, BLOCKSIZE);
@ -175,7 +175,7 @@ void MD5::transform(const uInt8* const block)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// MD5 block update operation. // MD5 block update operation.
// Continues an MD5 message-digest operation, processing another message block. // Continues an MD5 message-digest operation, processing another message block.
void MD5::update(const uInt8* const input, uInt32 length) void MD5::update(const uInt8* input, uInt32 length)
{ {
// Compute number of bytes mod 64 // Compute number of bytes mod 64
auto index = count[0] / 8 % BLOCKSIZE; auto index = count[0] / 8 % BLOCKSIZE;

View File

@ -72,54 +72,55 @@ class MD5
public: public:
MD5() = default; MD5() = default;
~MD5() = default;
private: private:
void init(); void init();
void update(const uInt8* const input, uInt32 length); void update(const uInt8* input, uInt32 length);
void finalize(); void finalize();
string hexdigest() const; string hexdigest() const;
void transform(const uInt8* block); void transform(const uInt8* block);
static void decode(uInt32* output, const uInt8* const input, uInt32 len); static void decode(uInt32* output, const uInt8* input, uInt32 len);
static void encode(uInt8* output, const uInt32* const input, uInt32 len); static void encode(uInt8* output, const uInt32* input, uInt32 len);
// F, G, H and I are basic MD5 functions. // F, G, H and I are basic MD5 functions.
FORCE_INLINE constexpr uInt32 F(uInt32 x, uInt32 y, uInt32 z) { static constexpr uInt32 F(uInt32 x, uInt32 y, uInt32 z) {
return (x&y) | (~x&z); return (x&y) | (~x&z);
} }
FORCE_INLINE constexpr uInt32 G(uInt32 x, uInt32 y, uInt32 z) { static constexpr uInt32 G(uInt32 x, uInt32 y, uInt32 z) {
return (x&z) | (y&~z); return (x&z) | (y&~z);
} }
FORCE_INLINE constexpr uInt32 H(uInt32 x, uInt32 y, uInt32 z) { static constexpr uInt32 H(uInt32 x, uInt32 y, uInt32 z) {
return x^y^z; return x^y^z;
} }
FORCE_INLINE constexpr uInt32 I(uInt32 x, uInt32 y, uInt32 z) { static constexpr uInt32 I(uInt32 x, uInt32 y, uInt32 z) {
return y ^ (x | ~z); return y ^ (x | ~z);
} }
// rotate_left rotates x left n bits. // rotate_left rotates x left n bits.
FORCE_INLINE constexpr uInt32 rotate_left(uInt32 x, int n) { static constexpr uInt32 rotate_left(uInt32 x, int n) {
return (x << n) | (x >> (32-n)); return (x << n) | (x >> (32-n));
} }
// FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. // FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
// Rotation is separate from addition to prevent recomputation. // Rotation is separate from addition to prevent recomputation.
FORCE_INLINE constexpr void FF(uInt32 &a, uInt32 b, uInt32 c, static constexpr void FF(uInt32 &a, uInt32 b, uInt32 c,
uInt32 d, uInt32 x, uInt32 s, uInt32 ac) { uInt32 d, uInt32 x, uInt32 s, uInt32 ac) {
a = rotate_left(a+ F(b,c,d) + x + ac, s) + b; a = rotate_left(a+ F(b,c,d) + x + ac, s) + b;
} }
FORCE_INLINE constexpr void GG(uInt32 &a, uInt32 b, uInt32 c, uInt32 d, static constexpr void GG(uInt32 &a, uInt32 b, uInt32 c, uInt32 d,
uInt32 x, uInt32 s, uInt32 ac) { uInt32 x, uInt32 s, uInt32 ac) {
a = rotate_left(a + G(b,c,d) + x + ac, s) + b; a = rotate_left(a + G(b,c,d) + x + ac, s) + b;
} }
FORCE_INLINE constexpr void HH(uInt32 &a, uInt32 b, uInt32 c, uInt32 d, static constexpr void HH(uInt32 &a, uInt32 b, uInt32 c, uInt32 d,
uInt32 x, uInt32 s, uInt32 ac) { uInt32 x, uInt32 s, uInt32 ac) {
a = rotate_left(a + H(b,c,d) + x + ac, s) + b; a = rotate_left(a + H(b,c,d) + x + ac, s) + b;
} }
FORCE_INLINE constexpr void II(uInt32 &a, uInt32 b, uInt32 c, uInt32 d, static constexpr void II(uInt32 &a, uInt32 b, uInt32 c, uInt32 d,
uInt32 x, uInt32 s, uInt32 ac) { uInt32 x, uInt32 s, uInt32 ac) {
a = rotate_left(a + I(b,c,d) + x + ac, s) + b; a = rotate_left(a + I(b,c,d) + x + ac, s) + b;
} }
private: private:
static inline constexpr uInt32 BLOCKSIZE = 64; static constexpr uInt32 BLOCKSIZE = 64;
bool finalized{false}; bool finalized{false};
std::array<uInt8, BLOCKSIZE> buffer; // bytes that didn't fit in last chunk std::array<uInt8, BLOCKSIZE> buffer; // bytes that didn't fit in last chunk
std::array<uInt32, 2> count; // 64bit counter for number of bits (lo, hi) std::array<uInt32, 2> count; // 64bit counter for number of bits (lo, hi)

View File

@ -80,7 +80,7 @@ class MT24LC256
void jpee_data_stop(); void jpee_data_stop();
void jpee_clock_fall(); void jpee_clock_fall();
bool jpee_timercheck(int mode); bool jpee_timercheck(int mode);
void jpee_logproc(string_view st) { cerr << " " << st << '\n'; } static void jpee_logproc(string_view st) { cerr << " " << st << '\n'; }
void update(); void update();

View File

@ -105,7 +105,7 @@ class OSystem
@return The frame buffer @return The frame buffer
*/ */
FrameBuffer& frameBuffer() const { return *myFrameBuffer; } FrameBuffer& frameBuffer() const { return *myFrameBuffer; }
bool hasFrameBuffer() const { return myFrameBuffer.get() != nullptr; } bool hasFrameBuffer() const { return myFrameBuffer != nullptr; }
/** /**
Get the sound object of the system. Get the sound object of the system.

View File

@ -97,7 +97,7 @@ class Properties
@return The value of the property @return The value of the property
*/ */
const string& get(PropType key) const { const string& get(PropType key) const {
const uInt8 pos = static_cast<uInt8>(key); const auto pos = static_cast<uInt8>(key);
return pos < static_cast<uInt8>(PropType::NumTypes) ? myProperties[pos] : EmptyString; return pos < static_cast<uInt8>(PropType::NumTypes) ? myProperties[pos] : EmptyString;
} }

View File

@ -40,8 +40,8 @@ class OSystem;
class PropertiesSet class PropertiesSet
{ {
public: public:
PropertiesSet(); PropertiesSet();
~PropertiesSet() = default;
void setRepository(shared_ptr<CompositeKeyValueRepository> repository); void setRepository(shared_ptr<CompositeKeyValueRepository> repository);

View File

@ -82,7 +82,7 @@ QuadTari::QuadTari(Jack jack, const OSystem& osystem, const System& system,
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unique_ptr<Controller> QuadTari::addController(const Controller::Type type, bool second) unique_ptr<Controller> QuadTari::addController(Controller::Type type, bool second)
{ {
FSNode nvramfile = myOSystem.nvramDir(); FSNode nvramfile = myOSystem.nvramDir();
const Controller::onMessageCallback callback = [&os = myOSystem] const Controller::onMessageCallback callback = [&os = myOSystem]

View File

@ -121,7 +121,7 @@ class QuadTari : public Controller
// determine which controller is active // determine which controller is active
bool isFirst() const; bool isFirst() const;
unique_ptr<Controller> addController(const Controller::Type type, bool second); unique_ptr<Controller> addController(Controller::Type type, bool second);
const OSystem& myOSystem; const OSystem& myOSystem;
const Properties& myProperties; const Properties& myProperties;

View File

@ -39,6 +39,7 @@ class Random : public Serializable
explicit Random() { explicit Random() {
initSeed(static_cast<uInt32>(std::chrono::system_clock::now().time_since_epoch().count())); initSeed(static_cast<uInt32>(std::chrono::system_clock::now().time_since_epoch().count()));
} }
~Random() override = default;
/** /**
Create a new random number generator with given seed. Create a new random number generator with given seed.

View File

@ -110,7 +110,7 @@ void SaveKey::eraseCurrent()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SaveKey::isPageUsed(const uInt32 page) const bool SaveKey::isPageUsed(uInt32 page) const
{ {
return myEEPROM->isPageUsed(page); return myEEPROM->isPageUsed(page);
} }

View File

@ -109,7 +109,7 @@ class SaveKey : public Controller
void eraseCurrent(); void eraseCurrent();
/** Returns true if the page is used by the current ROM */ /** Returns true if the page is used by the current ROM */
bool isPageUsed(const uInt32 page) const; bool isPageUsed(uInt32 page) const;
private: private:
// The EEPROM used in the SaveKey // The EEPROM used in the SaveKey

View File

@ -35,7 +35,7 @@
class Serializer class Serializer
{ {
public: public:
enum class Mode { ReadOnly, ReadWrite, ReadWriteTrunc }; enum class Mode: uInt8 { ReadOnly, ReadWrite, ReadWriteTrunc };
public: public:
/** /**

View File

@ -105,10 +105,10 @@ class Settings
const string& getString(string_view key) const { const string& getString(string_view key) const {
return value(key).toString(); return value(key).toString();
} }
const Common::Size getSize(string_view key) const { Common::Size getSize(string_view key) const {
return value(key).toSize(); return value(key).toSize();
} }
const Common::Point getPoint(string_view key) const { Common::Point getPoint(string_view key) const {
return value(key).toPoint(); return value(key).toPoint();
} }

View File

@ -38,7 +38,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} { } explicit Sound(OSystem& osystem) : myOSystem{osystem} { }
virtual ~Sound() = default; virtual ~Sound() = default;
public: public:

View File

@ -101,14 +101,14 @@ class System : public Serializable
@return The attached 6532 microprocessor @return The attached 6532 microprocessor
*/ */
inline M6532& m6532() const { return myM6532; } M6532& m6532() const { return myM6532; }
/** /**
Answer the TIA device attached to the system. Answer the TIA device attached to the system.
@return The attached TIA device @return The attached TIA device
*/ */
inline TIA& tia() const { return myTIA; } TIA& tia() const { return myTIA; }
/** /**
Answer the Cart attached to the system. Answer the Cart attached to the system.
@ -140,14 +140,14 @@ class System : public Serializable
@return The number of system cycles which have passed @return The number of system cycles which have passed
*/ */
inline uInt64 cycles() const { return myCycles; } uInt64 cycles() const { return myCycles; }
/** /**
Increment the system cycles by the specified number of cycles. Increment the system cycles by the specified number of cycles.
@param amount The amount to add to the system cycles counter @param amount The amount to add to the system cycles counter
*/ */
inline void incrementCycles(uInt32 amount) { myCycles += amount; } void incrementCycles(uInt32 amount) { myCycles += amount; }
/** /**
Informs all attached devices that the console type has changed. Informs all attached devices that the console type has changed.
@ -171,7 +171,7 @@ class System : public Serializable
/** /**
* See peekImpl below. * See peekImpl below.
*/ */
inline uInt8 peek(uInt16 address, Device::AccessFlags flags = Device::NONE) uInt8 peek(uInt16 address, Device::AccessFlags flags = Device::NONE)
{ {
return peekImpl<false>(address, flags); return peekImpl<false>(address, flags);
} }
@ -179,7 +179,7 @@ class System : public Serializable
/** /**
* See peekImpl below. * See peekImpl below.
*/ */
inline uInt8 peekOob(uInt16 address, Device::AccessFlags flags = Device::NONE) uInt8 peekOob(uInt16 address, Device::AccessFlags flags = Device::NONE)
{ {
return peekImpl<true>(address, flags); return peekImpl<true>(address, flags);
} }
@ -187,7 +187,7 @@ class System : public Serializable
/** /**
* See pokeImpl below. * See pokeImpl below.
*/ */
inline void poke(uInt16 address, uInt8 value, Device::AccessFlags flags = Device::NONE) void poke(uInt16 address, uInt8 value, Device::AccessFlags flags = Device::NONE)
{ {
pokeImpl<false>(address, value, flags); pokeImpl<false>(address, value, flags);
} }
@ -195,7 +195,7 @@ class System : public Serializable
/** /**
* See pokeImpl below. * See pokeImpl below.
*/ */
inline void pokeOob(uInt16 address, uInt8 value, Device::AccessFlags flags = Device::NONE) void pokeOob(uInt16 address, uInt8 value, Device::AccessFlags flags = Device::NONE)
{ {
pokeImpl<true>(address, value, flags); pokeImpl<true>(address, value, flags);
} }

View File

@ -169,7 +169,7 @@ class TIASurface
Enable/disable/query NTSC filtering effects. Enable/disable/query NTSC filtering effects.
*/ */
void enableNTSC(bool enable); void enableNTSC(bool enable);
bool ntscEnabled() const { return uInt8(myFilter) & 0x10; } bool ntscEnabled() const { return static_cast<uInt8>(myFilter) & 0x10; }
string effectsInfo() const; string effectsInfo() const;
/** /**
@ -195,7 +195,7 @@ class TIASurface
void updateSurfaceSettings(); void updateSurfaceSettings();
private: private:
enum class ScanlineMask { enum class ScanlineMask: uInt8 {
Standard, Standard,
Thin, Thin,
Pixels, Pixels,
@ -246,10 +246,12 @@ class TIASurface
// Phosphor blend // Phosphor blend
int myPBlend{0}; int myPBlend{0};
std::array<uInt32, AtariNTSC::outWidth(TIAConstants::frameBufferWidth) * std::array<uInt32, static_cast<std::size_t>
TIAConstants::frameBufferHeight> myRGBFramebuffer; (AtariNTSC::outWidth(TIAConstants::frameBufferWidth) *
std::array<uInt32, AtariNTSC::outWidth(TIAConstants::frameBufferWidth) * TIAConstants::frameBufferHeight)> myRGBFramebuffer;
TIAConstants::frameBufferHeight> myPrevRGBFramebuffer; std::array<uInt32, static_cast<std::size_t>
(AtariNTSC::outWidth(TIAConstants::frameBufferWidth) *
TIAConstants::frameBufferHeight)> myPrevRGBFramebuffer;
///////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////
// Use scanlines in TIA rendering mode // Use scanlines in TIA rendering mode

View File

@ -135,7 +135,7 @@ using Common::Base;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Thumbulator::Thumbulator(const uInt16* rom_ptr, uInt16* ram_ptr, uInt32 rom_size, Thumbulator::Thumbulator(const uInt16* rom_ptr, uInt16* ram_ptr, uInt32 rom_size,
const uInt32 c_base, const uInt32 c_start, const uInt32 c_stack, uInt32 c_base, uInt32 c_start, uInt32 c_stack,
bool traponfatal, double cyclefactor, bool traponfatal, double cyclefactor,
Thumbulator::ConfigureFor configurefor, Thumbulator::ConfigureFor configurefor,
Cartridge* cartridge) Cartridge* cartridge)
@ -760,9 +760,9 @@ uInt32 Thumbulator::read32(uInt32 addr)
data = systick_count; data = systick_count;
return data; return data;
#ifdef THUMB_CYCLE_COUNT #ifdef THUMB_CYCLE_COUNT
case 0xE01FC100: // APBDIV case 0xE01FC100: // APBDIV
_countCycles = true; // enabe cycle counting _countCycles = true; // enabe cycle counting
return 1; // random value return 1; // random value
#endif #endif
#ifndef UNSAFE_OPTIMIZATIONS #ifndef UNSAFE_OPTIMIZATIONS

View File

@ -50,7 +50,7 @@ class Thumbulator
public: public:
// control cartridge specific features of the Thumbulator class, // control cartridge specific features of the Thumbulator class,
// such as the start location for calling custom code // such as the start location for calling custom code
enum class ConfigureFor { enum class ConfigureFor: uInt8 {
BUS, // cartridges of type BUS BUS, // cartridges of type BUS
CDF, // cartridges of type CDF CDF, // cartridges of type CDF
CDF1, // cartridges of type CDF version 1 CDF1, // cartridges of type CDF version 1
@ -58,7 +58,7 @@ class Thumbulator
CDFJplus, // cartridges of type CDFJ+ CDFJplus, // cartridges of type CDFJ+
DPCplus // cartridges of type DPC+ DPCplus // cartridges of type DPC+
}; };
enum class ChipType { enum class ChipType: Int8 {
AUTO = -1, AUTO = -1,
LPC2101, // Harmony (includes LPC2103) LPC2101, // Harmony (includes LPC2103)
LPC2104_OC, // Dev cart overclocked (includes LPC2105) LPC2104_OC, // Dev cart overclocked (includes LPC2105)
@ -66,7 +66,7 @@ class Thumbulator
LPC213x, // future use (includes LPC2132) LPC213x, // future use (includes LPC2132)
numTypes numTypes
}; };
enum class MamModeType { enum class MamModeType: uInt8 {
mode0, mode1, mode2, modeX mode0, mode1, mode2, modeX
}; };
struct ChipPropsType { struct ChipPropsType {
@ -88,10 +88,11 @@ class Thumbulator
}; };
Thumbulator(const uInt16* rom_ptr, uInt16* ram_ptr, uInt32 rom_size, Thumbulator(const uInt16* rom_ptr, uInt16* ram_ptr, uInt32 rom_size,
const uInt32 c_base, const uInt32 c_start, const uInt32 c_stack, uInt32 c_base, uInt32 c_start, uInt32 c_stack,
bool traponfatal, double cyclefactor, bool traponfatal, double cyclefactor,
Thumbulator::ConfigureFor configurefor, Thumbulator::ConfigureFor configurefor,
Cartridge* cartridge); Cartridge* cartridge);
~Thumbulator() = default;
/** /**
Run the ARM code, and return when finished. A runtime_error exception is Run the ARM code, and return when finished. A runtime_error exception is
@ -198,14 +199,15 @@ class Thumbulator
numOps numOps
}; };
#ifdef THUMB_CYCLE_COUNT #ifdef THUMB_CYCLE_COUNT
enum class CycleType { enum class CycleType: uInt8 {
S, N, I // Sequential, Non-sequential, Internal S, N, I // Sequential, Non-sequential, Internal
}; };
enum class AccessType { enum class AccessType: uInt8 {
prefetch, branch, data prefetch, branch, data
}; };
#endif #endif
const std::array<ChipPropsType, uInt32(ChipType::numTypes)> ChipProps = const std::array<ChipPropsType,
static_cast<uInt32>(ChipType::numTypes)> ChipProps =
{{ {{
{ "LPC2101..3", 70.0, 4, 1 }, // LPC2101_02_03 { "LPC2101..3", 70.0, 4, 1 }, // LPC2101_02_03
{ "LPC2104..6 OC", 70.0, 4, 2 }, // LPC2104_05_06 Overclocked { "LPC2104..6 OC", 70.0, 4, 2 }, // LPC2104_05_06 Overclocked
@ -335,10 +337,10 @@ class Thumbulator
ROMSIZE = ROMADDMASK + 1, // 512KB ROMSIZE = ROMADDMASK + 1, // 512KB
RAMSIZE = RAMADDMASK + 1, // 32KB RAMSIZE = RAMADDMASK + 1, // 32KB
CPSR_N = 1u << 31, CPSR_N = 1U << 31,
CPSR_Z = 1u << 30, CPSR_Z = 1U << 30,
CPSR_C = 1u << 29, CPSR_C = 1U << 29,
CPSR_V = 1u << 28; CPSR_V = 1U << 28;
private: private:
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported

View File

@ -32,7 +32,7 @@ class EmulationWarning : public std::exception
} }
private: private:
const string myMessage; string myMessage;
}; };
#endif // EMULATION_WARNING_HXX #endif // EMULATION_WARNING_HXX

View File

@ -32,7 +32,7 @@ class FatalEmulationError : public std::exception
} }
private: private:
const string myMessage; string myMessage;
}; };
#endif // FATAL_EMULATION_ERROR_HXX #endif // FATAL_EMULATION_ERROR_HXX

View File

@ -43,6 +43,7 @@ class AnalogReadout : public Serializable
public: public:
AnalogReadout(); AnalogReadout();
~AnalogReadout() override = default;
void reset(uInt64 timestamp); void reset(uInt64 timestamp);

View File

@ -28,6 +28,7 @@ class Audio : public Serializable
{ {
public: public:
Audio(); Audio();
~Audio() override = default;
void reset(); void reset();
@ -46,9 +47,9 @@ class Audio : public Serializable
FORCE_INLINE void tick(); FORCE_INLINE void tick();
inline AudioChannel& channel0() { return myChannel0; } AudioChannel& channel0() { return myChannel0; }
inline AudioChannel& channel1() { return myChannel1; } AudioChannel& channel1() { return myChannel1; }
/** /**
Serializable methods (see that class for more information). Serializable methods (see that class for more information).

View File

@ -25,6 +25,7 @@ class AudioChannel : public Serializable
{ {
public: public:
AudioChannel() = default; AudioChannel() = default;
~AudioChannel() override = default;
void reset(); void reset();

View File

@ -27,6 +27,7 @@ class Background : public Serializable
{ {
public: public:
Background() = default; Background() = default;
~Background() override = default;
public: public:
void setTIA(TIA* tia) { myTIA = tia; } void setTIA(TIA* tia) { myTIA = tia; }
@ -39,7 +40,7 @@ class Background : public Serializable
void applyColorLoss(); void applyColorLoss();
inline uInt8 getColor() const { return myColor; } uInt8 getColor() const { return myColor; }
/** /**
Serializable methods (see that class for more information). Serializable methods (see that class for more information).

View File

@ -27,11 +27,11 @@ class TIA;
class Ball : public Serializable class Ball : public Serializable
{ {
public: public:
/** /**
The collision mask is injected at construction The collision mask is injected at construction
*/ */
explicit Ball(uInt32 collisionMask); explicit Ball(uInt32 collisionMask);
~Ball() override = default;
public: public:
@ -123,12 +123,12 @@ class Ball : public Serializable
Is the ball visible? This is determined by looking at bit 15 Is the ball visible? This is determined by looking at bit 15
of the collision mask. of the collision mask.
*/ */
inline bool isOn() const { return (collision & 0x8000); } bool isOn() const { return (collision & 0x8000); }
/** /**
Get the current color. Get the current color.
*/ */
inline uInt8 getColor() const { return myColor; } uInt8 getColor() const { return myColor; }
/** /**
Shuffle the enabled flag. This is called in VDELBL mode when GRP1 is Shuffle the enabled flag. This is called in VDELBL mode when GRP1 is

View File

@ -34,6 +34,7 @@ class DelayQueue : public Serializable
public: public:
DelayQueue(); DelayQueue();
~DelayQueue() override = default;
public: public:

View File

@ -44,7 +44,7 @@ class DelayQueueIteratorImpl : public DelayQueueIterator
uInt8 currentIndex() const; uInt8 currentIndex() const;
private: private:
const DelayQueue<length, capacity>& myDelayQueue; const DelayQueue<length, capacity>& myDelayQueue; // NOLINT: we want a reference here
uInt8 myDelayCycle{0}; uInt8 myDelayCycle{0};
uInt8 myIndex{0}; uInt8 myIndex{0};
}; };

View File

@ -32,6 +32,7 @@ class DelayQueueMember : public Serializable {
public: public:
DelayQueueMember(); DelayQueueMember();
~DelayQueueMember() override = default;
public: public:
void push(uInt8 address, uInt8 value); void push(uInt8 address, uInt8 value);
@ -64,9 +65,7 @@ class DelayQueueMember : public Serializable {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<unsigned capacity> template<unsigned capacity>
DelayQueueMember<capacity>::DelayQueueMember() DelayQueueMember<capacity>::DelayQueueMember() = default;
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<unsigned capacity> template<unsigned capacity>
@ -82,7 +81,7 @@ void DelayQueueMember<capacity>::push(uInt8 address, uInt8 value)
template<unsigned capacity> template<unsigned capacity>
void DelayQueueMember<capacity>::remove(uInt8 address) void DelayQueueMember<capacity>::remove(uInt8 address)
{ {
uInt8 index; uInt8 index = 0;
for (index = 0; index < mySize; ++index) { for (index = 0; index < mySize; ++index) {
if (myEntries[index].address == address) break; if (myEntries[index].address == address) break;

View File

@ -33,6 +33,7 @@ class DrawCounterDecodes
protected: protected:
DrawCounterDecodes(); DrawCounterDecodes();
~DrawCounterDecodes() = default;
private: private:

View File

@ -18,7 +18,7 @@
#ifndef FRAME_LAYOUT #ifndef FRAME_LAYOUT
#define FRAME_LAYOUT #define FRAME_LAYOUT
enum class FrameLayout { enum class FrameLayout: uInt8 {
ntsc, // ROM display has NTSC timings (~60Hz, ~262 scanlines, etc) ntsc, // ROM display has NTSC timings (~60Hz, ~262 scanlines, etc)
pal, // ROM display has PAL timings (~50Hz, ~312 scanlines, etc) pal, // ROM display has PAL timings (~50Hz, ~312 scanlines, etc)
pal60, // ROM display has NTSC timings (~60Hz, ~262 scanlines, etc), but uses PAL colors pal60, // ROM display has NTSC timings (~60Hz, ~262 scanlines, etc), but uses PAL colors

View File

@ -25,6 +25,7 @@ class LatchedInput : public Serializable
{ {
public: public:
LatchedInput() = default; LatchedInput() = default;
~LatchedInput() override = default;
public: public:

View File

@ -30,6 +30,7 @@ class Missile : public Serializable
public: public:
explicit Missile(uInt32 collisionMask); explicit Missile(uInt32 collisionMask);
~Missile() override = default;
public: public:
@ -64,7 +65,7 @@ class Missile : public Serializable
void toggleEnabled(bool enabled); void toggleEnabled(bool enabled);
inline bool isOn() const { return (collision & 0x8000); } bool isOn() const { return (collision & 0x8000); }
uInt8 getColor() const; uInt8 getColor() const;
uInt8 getPosition() const; uInt8 getPosition() const;

Some files were not shown because too many files have changed in this diff Show More