More fixes for warnings from clang-tidy, in `src/cheat` and `src/common`.

This commit is contained in:
Stephen Anthony 2024-08-01 12:20:40 -02:30
parent 2fd4756f2d
commit c48f03b2a1
65 changed files with 306 additions and 289 deletions

View File

@ -27,7 +27,7 @@ class Cheat
public:
Cheat(OSystem& osystem, string_view name, string_view code)
: myOSystem{osystem},
myName{name == "" ? code : name},
myName{name.empty() ? code : name},
myCode{code} { }
virtual ~Cheat() = default;

View File

@ -38,6 +38,7 @@ class CheatManager
{
public:
explicit CheatManager(OSystem& osystem);
~CheatManager() = default;
/**
Adds the specified cheat to an internal list.

View File

@ -46,6 +46,7 @@ class AudioQueue
@param isStereo Whether samples are stereo or mono.
*/
AudioQueue(uInt32 fragmentSize, uInt32 capacity, bool isStereo);
~AudioQueue() = default;
/**
Capacity getter.
@ -133,7 +134,6 @@ class AudioQueue
StaggeredLogger myOverflowLogger{"audio buffer overflow", Logger::Level::INFO};
private:
AudioQueue() = delete;
AudioQueue(const AudioQueue&) = delete;
AudioQueue(AudioQueue&&) = delete;

View File

@ -26,7 +26,7 @@ class AudioSettings
{
public:
enum class Preset {
enum class Preset: uInt8 {
custom = 1,
lowQualityMediumLag = 2,
highQualityMediumLag = 3,
@ -34,7 +34,7 @@ class AudioSettings
ultraQualityMinimalLag = 5
};
enum class ResamplingQuality {
enum class ResamplingQuality: uInt8 {
nearestNeighbour = 1,
lanczos_2 = 2,
lanczos_3 = 3

View File

@ -24,7 +24,7 @@ string Base::toString(int value, Common::Base::Fmt outputBase)
{
static char vToS_buf[32]; // NOLINT : One place where C-style is acceptable
if(outputBase == Base::Fmt::_DEFAULT)
if(outputBase == Base::Fmt::DEFAULT)
outputBase = myDefaultBase;
switch(outputBase)

View File

@ -38,7 +38,7 @@ class Base
// The base to use for conversion from integers to strings
// Note that the actual number of places will be determined by
// the magnitude of the value itself in the general case
enum class Fmt {
enum class Fmt: uInt8 {
_16, // base 16: 2, 4, 8 bytes (depending on value)
_16_1, // base 16: 1 byte wide
_16_2, // base 16: 2 bytes wide
@ -56,7 +56,7 @@ class Base
_2, // base 2: 8 or 16 bits (depending on value)
_2_8, // base 2: 1 byte (8 bits) wide
_2_16, // base 2: 2 bytes (16 bits) wide
_DEFAULT
DEFAULT
};
public:
@ -72,31 +72,31 @@ class Base
static bool hexUppercase() { return myHexflags & std::ios_base::uppercase; }
/** Output HEX digits in 0.5/1/2/4 byte format */
static inline std::ostream& HEX1(std::ostream& os) {
static std::ostream& HEX1(std::ostream& os) {
os.flags(myHexflags);
return os << std::setw(1);
}
static inline std::ostream& HEX2(std::ostream& os) {
static std::ostream& HEX2(std::ostream& os) {
os.flags(myHexflags);
return os << std::setw(2) << std::setfill('0');
}
static inline std::ostream& HEX3(std::ostream& os)
static std::ostream& HEX3(std::ostream& os)
{
os.flags(myHexflags);
return os << std::setw(3) << std::setfill('0');
}
static inline std::ostream& HEX4(std::ostream& os) {
static std::ostream& HEX4(std::ostream& os) {
os.flags(myHexflags);
return os << std::setw(4) << std::setfill('0');
}
static inline std::ostream& HEX8(std::ostream& os) {
static std::ostream& HEX8(std::ostream& os) {
os.flags(myHexflags);
return os << std::setw(8) << std::setfill('0');
}
/** Convert integer to a string in the given base format */
static string toString(int value,
Common::Base::Fmt outputBase = Common::Base::Fmt::_DEFAULT);
Common::Base::Fmt outputBase = Common::Base::Fmt::DEFAULT);
private:
// Default format to use when none is specified
@ -108,6 +108,7 @@ class Base
private:
// Following constructors and assignment operators not supported
Base() = delete;
~Base() = delete;
Base(const Base&) = delete;
Base(Base&&) = delete;
Base& operator=(const Base&) = delete;

View File

@ -21,6 +21,7 @@
class OSystem;
#include <array>
#include "bspf.hxx"
/**
This class takes care of developer settings sets.
@ -30,13 +31,14 @@ class OSystem;
class DevSettingsHandler
{
public:
enum SettingsSet {
enum SettingsSet: uInt8 {
player,
developer,
numSets
};
explicit DevSettingsHandler(OSystem& osystem);
~DevSettingsHandler() = default;
void loadSettings(SettingsSet set);
void saveSettings(SettingsSet set);

View File

@ -120,7 +120,7 @@ class FBBackendSDL2 : public FBBackend
@param g The green component of the color.
@param b The blue component of the color.
*/
inline uInt32 mapRGB(uInt8 r, uInt8 g, uInt8 b) const override
uInt32 mapRGB(uInt8 r, uInt8 g, uInt8 b) const override
{ return SDL_MapRGB(myPixelFormat, r, g, b); }
/**
@ -131,7 +131,7 @@ class FBBackendSDL2 : public FBBackend
@param b The blue component of the color.
@param a The alpha component of the color.
*/
inline uInt32 mapRGBA(uInt8 r, uInt8 g, uInt8 b, uInt8 a) const override
uInt32 mapRGBA(uInt8 r, uInt8 g, uInt8 b, uInt8 a) const override
{ return SDL_MapRGBA(myPixelFormat, r, g, b, a); }
/**

View File

@ -69,7 +69,7 @@ class FBSurfaceSDL2 : public FBSurface
void applyAttributes() override;
private:
inline bool setSrcPosInternal(uInt32 x, uInt32 y) {
bool setSrcPosInternal(uInt32 x, uInt32 y) {
if(x != static_cast<uInt32>(mySrcR.x) || y != static_cast<uInt32>(mySrcR.y))
{
mySrcR.x = x; mySrcR.y = y;
@ -78,7 +78,7 @@ class FBSurfaceSDL2 : public FBSurface
}
return false;
}
inline bool setSrcSizeInternal(uInt32 w, uInt32 h) {
bool setSrcSizeInternal(uInt32 w, uInt32 h) {
if(w != static_cast<uInt32>(mySrcR.w) || h != static_cast<uInt32>(mySrcR.h))
{
mySrcR.w = w; mySrcR.h = h;
@ -87,7 +87,7 @@ class FBSurfaceSDL2 : public FBSurface
}
return false;
}
inline bool setDstPosInternal(uInt32 x, uInt32 y) {
bool setDstPosInternal(uInt32 x, uInt32 y) {
if(x != static_cast<uInt32>(myDstR.x) || y != static_cast<uInt32>(myDstR.y))
{
myDstR.x = x; myDstR.y = y;
@ -96,7 +96,7 @@ class FBSurfaceSDL2 : public FBSurface
}
return false;
}
inline bool setDstSizeInternal(uInt32 w, uInt32 h) {
bool setDstSizeInternal(uInt32 w, uInt32 h) {
if(w != static_cast<uInt32>(myDstR.w) || h != static_cast<uInt32>(myDstR.h))
{
myDstR.w = w; myDstR.h = h;

View File

@ -41,7 +41,7 @@ class AbstractFSNode;
class FSNodeFactory
{
public:
enum class Type { SYSTEM, ZIP };
enum class Type: uInt8 { SYSTEM, ZIP };
public:
static unique_ptr<AbstractFSNode> create(string_view path, Type type)
@ -71,6 +71,7 @@ class FSNodeFactory
private:
// Following constructors and assignment operators not supported
FSNodeFactory() = delete;
~FSNodeFactory() = delete;
FSNodeFactory(const FSNodeFactory&) = delete;
FSNodeFactory(FSNodeFactory&&) = delete;
FSNodeFactory& operator=(const FSNodeFactory&) = delete;

View File

@ -88,7 +88,7 @@ class FSNodeZIP : public AbstractFSNode
private:
/* Error types */
enum class zip_error
enum class zip_error: uInt8
{
NONE,
NOT_A_FILE,

View File

@ -27,6 +27,7 @@ class FpsMeter
public:
explicit FpsMeter(uInt32 queueSize);
~FpsMeter() = default;
void reset(uInt32 garbageFrameLimit = 0);

View File

@ -23,6 +23,9 @@
class OSystem;
class FBSurface;
#include "Variant.hxx"
#include "bspf.hxx"
/**
This class implements a thin wrapper around the nanojpeg library, and
abstracts all the irrelevant details other loading an actual image.
@ -33,6 +36,7 @@ class JPGLibrary
{
public:
explicit JPGLibrary(OSystem& osystem);
~JPGLibrary() = default;
/**
Read a JPG image from the specified file into a FBSurface structure,

View File

@ -22,22 +22,21 @@
using json = nlohmann::json;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void JoyMap::add(const Event::Type event, const JoyMapping& mapping)
void JoyMap::add(Event::Type event, const JoyMapping& mapping)
{
myMap[mapping] = event;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void JoyMap::add(const Event::Type event, const EventMode mode, const int button,
const JoyAxis axis, const JoyDir adir,
const int hat, const JoyHatDir hdir)
void JoyMap::add(Event::Type event, EventMode mode, int button,
JoyAxis axis, JoyDir adir, int hat, JoyHatDir hdir)
{
add(event, JoyMapping(mode, button, axis, adir, hat, hdir));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void JoyMap::add(const Event::Type event, const EventMode mode, const int button,
const int hat, const JoyHatDir hdir)
void JoyMap::add(Event::Type event, EventMode mode, int button,
int hat, JoyHatDir hdir)
{
add(event, JoyMapping(mode, button, hat, hdir));
}
@ -49,15 +48,13 @@ void JoyMap::erase(const JoyMapping& mapping)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void JoyMap::erase(const EventMode mode, const int button,
const JoyAxis axis, const JoyDir adir)
void JoyMap::erase(EventMode mode, int button, JoyAxis axis, JoyDir adir)
{
erase(JoyMapping(mode, button, axis, adir));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void JoyMap::erase(const EventMode mode, const int button,
const int hat, const JoyHatDir hdir)
void JoyMap::erase(EventMode mode, int button, int hat, JoyHatDir hdir)
{
erase(JoyMapping(mode, button, hat, hdir));
}
@ -82,15 +79,15 @@ Event::Type JoyMap::get(const JoyMapping& mapping) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Event::Type JoyMap::get(const EventMode mode, const int button,
const JoyAxis axis, const JoyDir adir) const
Event::Type JoyMap::get(EventMode mode, int button,
JoyAxis axis, JoyDir adir) const
{
return get(JoyMapping(mode, button, axis, adir));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Event::Type JoyMap::get(const EventMode mode, const int button,
const int hat, const JoyHatDir hdir) const
Event::Type JoyMap::get(EventMode mode, int button,
int hat, JoyHatDir hdir) const
{
return get(JoyMapping(mode, button, hat, hdir));
}
@ -102,15 +99,14 @@ bool JoyMap::check(const JoyMapping& mapping) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool JoyMap::check(const EventMode mode, const int button,
const JoyAxis axis, const JoyDir adir,
const int hat, const JoyHatDir hdir) const
bool JoyMap::check(EventMode mode, int button, JoyAxis axis, JoyDir adir,
int hat, JoyHatDir hdir) const
{
return check(JoyMapping(mode, button, axis, adir, hat, hdir));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string JoyMap::getDesc(const Event::Type event, const JoyMapping& mapping)
string JoyMap::getDesc(Event::Type event, const JoyMapping& mapping)
{
ostringstream buf;
@ -156,7 +152,8 @@ string JoyMap::getDesc(const Event::Type event, const JoyMapping& mapping)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string JoyMap::getEventMappingDesc(int stick, const Event::Type event, const EventMode mode) const
string JoyMap::getEventMappingDesc(int stick, Event::Type event,
EventMode mode) const
{
ostringstream buf;
@ -173,7 +170,8 @@ string JoyMap::getEventMappingDesc(int stick, const Event::Type event, const Eve
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
JoyMap::JoyMappingArray JoyMap::getEventMapping(const Event::Type event, const EventMode mode) const
JoyMap::JoyMappingArray JoyMap::getEventMapping(Event::Type event,
EventMode mode) const
{
JoyMappingArray map;
@ -185,7 +183,7 @@ JoyMap::JoyMappingArray JoyMap::getEventMapping(const Event::Type event, const E
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
json JoyMap::saveMapping(const EventMode mode) const
json JoyMap::saveMapping(EventMode mode) const
{
using MapType = std::pair<JoyMapping, Event::Type>;
std::vector<MapType> sortedMap(myMap.begin(), myMap.end());
@ -241,7 +239,7 @@ json JoyMap::saveMapping(const EventMode mode) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int JoyMap::loadMapping(const json& eventMappings, const EventMode mode)
int JoyMap::loadMapping(const json& eventMappings, EventMode mode)
{
int i = 0;
@ -327,7 +325,7 @@ json JoyMap::convertLegacyMapping(string list)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void JoyMap::eraseMode(const EventMode mode)
void JoyMap::eraseMode(EventMode mode)
{
for(auto item = myMap.begin(); item != myMap.end();)
if(item->first.mode == mode) {
@ -338,7 +336,7 @@ void JoyMap::eraseMode(const EventMode mode)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void JoyMap::eraseEvent(const Event::Type event, const EventMode mode)
void JoyMap::eraseEvent(Event::Type event, EventMode mode)
{
for(auto item = myMap.begin(); item != myMap.end();)
if(item->second == event && item->first.mode == mode) {

View File

@ -58,6 +58,7 @@ class JoyMap
axis{JoyAxis::NONE}, adir{JoyDir::NONE},
hat{c_hat}, hdir{c_hdir} { }
~JoyMapping() = default;
JoyMapping(const JoyMapping&) = default;
JoyMapping& operator=(const JoyMapping&) = default;
JoyMapping(JoyMapping&&) = default;
@ -77,64 +78,61 @@ class JoyMap
using JoyMappingArray = std::vector<JoyMapping>;
JoyMap() = default;
~JoyMap() = default;
/** Add new mapping for given event */
void add(const Event::Type event, const JoyMapping& mapping);
void add(const Event::Type event, const EventMode mode, const int button,
const JoyAxis axis, const JoyDir adir,
const int hat = JOY_CTRL_NONE, const JoyHatDir hdir = JoyHatDir::CENTER);
void add(const Event::Type event, const EventMode mode, const int button,
const int hat, const JoyHatDir hdir);
void add(Event::Type event, const JoyMapping& mapping);
void add(Event::Type event, EventMode mode, int button,
JoyAxis axis, JoyDir adir,
int hat = JOY_CTRL_NONE, JoyHatDir hdir = JoyHatDir::CENTER);
void add(Event::Type event, EventMode mode, int button,
int hat, JoyHatDir hdir);
/** Erase mapping */
void erase(const JoyMapping& mapping);
void erase(const EventMode mode, const int button,
const JoyAxis axis, const JoyDir adir);
void erase(const EventMode mode, const int button,
const int hat, const JoyHatDir hdir);
void erase(EventMode mode, int button, JoyAxis axis, JoyDir adir);
void erase(EventMode mode, int button, int hat, JoyHatDir hdir);
/** Get event for mapping */
Event::Type get(const JoyMapping& mapping) const;
Event::Type get(const EventMode mode, const int button,
const JoyAxis axis = JoyAxis::NONE, const JoyDir adir = JoyDir::NONE) const;
Event::Type get(const EventMode mode, const int button,
const int hat, const JoyHatDir hdir) const;
Event::Type get(EventMode mode, int button, JoyAxis axis = JoyAxis::NONE,
JoyDir adir = JoyDir::NONE) const;
Event::Type get(EventMode mode, int button, int hat, JoyHatDir hdir) const;
/** Check if a mapping exists */
bool check(const JoyMapping& mapping) const;
bool check(const EventMode mode, const int button,
const JoyAxis axis, const JoyDir adir,
const int hat = JOY_CTRL_NONE, const JoyHatDir hdir = JoyHatDir::CENTER) const;
bool check(EventMode mode, int button, JoyAxis axis, JoyDir adir,
int hat = JOY_CTRL_NONE, JoyHatDir hdir = JoyHatDir::CENTER) const;
/** Get mapping description */
string getEventMappingDesc(int stick, const Event::Type event, const EventMode mode) const;
string getEventMappingDesc(int stick, Event::Type event, EventMode mode) const;
JoyMappingArray getEventMapping(const Event::Type event, const EventMode mode) const;
JoyMappingArray getEventMapping(Event::Type event, EventMode mode) const;
nlohmann::json saveMapping(const EventMode mode) const;
int loadMapping(const nlohmann::json& eventMappings, const EventMode mode);
nlohmann::json saveMapping(EventMode mode) const;
int loadMapping(const nlohmann::json& eventMappings, EventMode mode);
static nlohmann::json convertLegacyMapping(string list);
/** Erase all mappings for given mode */
void eraseMode(const EventMode mode);
void eraseMode(EventMode mode);
/** Erase given event's mapping for given mode */
void eraseEvent(const Event::Type event, const EventMode mode);
void eraseEvent(Event::Type event, EventMode mode);
/** clear all mappings for a modes */
// void clear() { myMap.clear(); }
size_t size() const { return myMap.size(); }
private:
static string getDesc(const Event::Type event, const JoyMapping& mapping);
static string getDesc(Event::Type event, const JoyMapping& mapping);
struct JoyHash {
size_t operator()(const JoyMapping& m)const {
return std::hash<uInt64>()((uInt64(m.mode)) // 3 bits
+ ((uInt64(m.button)) * 7) // 3 bits
+ (((uInt64(m.axis)) << 0) // 2 bits
| ((uInt64(m.adir)) << 2) // 2 bits
| ((uInt64(m.hat )) << 4) // 1 bit
| ((uInt64(m.hdir)) << 5) // 2 bits
return std::hash<uInt64>()((static_cast<uInt64>(m.mode)) // 3 bits
+ ((static_cast<uInt64>(m.button)) * 7) // 3 bits
+ (((static_cast<uInt64>(m.axis)) << 0) // 2 bits
| ((static_cast<uInt64>(m.adir)) << 2) // 2 bits
| ((static_cast<uInt64>(m.hat )) << 4) // 1 bit
| ((static_cast<uInt64>(m.hdir)) << 5) // 2 bits
) * 61
);
}

View File

@ -68,13 +68,13 @@ namespace {
} // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void KeyMap::add(const Event::Type event, const Mapping& mapping)
void KeyMap::add(Event::Type event, const Mapping& mapping)
{
myMap[convertMod(mapping)] = event;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void KeyMap::add(const Event::Type event, const EventMode mode, const int key, const int mod)
void KeyMap::add(Event::Type event, EventMode mode, int key, int mod)
{
add(event, Mapping(mode, key, mod));
}
@ -86,7 +86,7 @@ void KeyMap::erase(const Mapping& mapping)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void KeyMap::erase(const EventMode mode, const int key, const int mod)
void KeyMap::erase(EventMode mode, int key, int mod)
{
erase(Mapping(mode, key, mod));
}
@ -114,7 +114,7 @@ Event::Type KeyMap::get(const Mapping& mapping) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Event::Type KeyMap::get(const EventMode mode, const int key, const int mod) const
Event::Type KeyMap::get(EventMode mode, int key, int mod) const
{
return get(Mapping(mode, key, mod));
}
@ -126,7 +126,7 @@ bool KeyMap::check(const Mapping& mapping) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool KeyMap::check(const EventMode mode, const int key, const int mod) const
bool KeyMap::check(EventMode mode, int key, int mod) const
{
return check(Mapping(mode, key, mod));
}
@ -181,13 +181,13 @@ string KeyMap::getDesc(const Mapping& mapping)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string KeyMap::getDesc(const EventMode mode, const int key, const int mod)
string KeyMap::getDesc(EventMode mode, int key, int mod)
{
return getDesc(Mapping(mode, key, mod));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string KeyMap::getEventMappingDesc(const Event::Type event, const EventMode mode) const
string KeyMap::getEventMappingDesc(Event::Type event, EventMode mode) const
{
ostringstream buf;
@ -204,8 +204,8 @@ string KeyMap::getEventMappingDesc(const Event::Type event, const EventMode mode
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyMap::MappingArray KeyMap::getEventMapping(const Event::Type event,
const EventMode mode) const
KeyMap::MappingArray KeyMap::getEventMapping(Event::Type event,
EventMode mode) const
{
MappingArray ma;
@ -217,7 +217,7 @@ KeyMap::MappingArray KeyMap::getEventMapping(const Event::Type event,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
json KeyMap::saveMapping(const EventMode mode) const
json KeyMap::saveMapping(EventMode mode) const
{
using MapType = std::pair<Mapping, Event::Type>;
std::vector<MapType> sortedMap(myMap.begin(), myMap.end());
@ -256,7 +256,8 @@ json KeyMap::saveMapping(const EventMode mode) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int KeyMap::loadMapping(const json& mappings, const EventMode mode) {
int KeyMap::loadMapping(const json& mappings, EventMode mode)
{
int i = 0;
for(const json& mapping : mappings)
@ -313,7 +314,7 @@ json KeyMap::convertLegacyMapping(string_view lm)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void KeyMap::eraseMode(const EventMode mode)
void KeyMap::eraseMode(EventMode mode)
{
for(auto item = myMap.begin(); item != myMap.end();)
if(item->first.mode == mode) {
@ -324,7 +325,7 @@ void KeyMap::eraseMode(const EventMode mode)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void KeyMap::eraseEvent(const Event::Type event, const EventMode mode)
void KeyMap::eraseEvent(Event::Type event, EventMode mode)
{
for(auto item = myMap.begin(); item != myMap.end();)
if(item->second == event && item->first.mode == mode) {

View File

@ -42,6 +42,7 @@ class KeyMap
: mode{c_mode}, key{c_key}, mod{c_mod} { }
explicit Mapping(EventMode c_mode, int c_key, int c_mod)
: mode{c_mode}, key{static_cast<StellaKey>(c_key)}, mod{static_cast<StellaMod>(c_mod)} { }
~Mapping() = default;
Mapping(const Mapping&) = default;
Mapping& operator=(const Mapping&) = default;
Mapping(Mapping&&) = default;
@ -61,41 +62,42 @@ class KeyMap
using MappingArray = std::vector<Mapping>;
KeyMap() = default;
~KeyMap() = default;
/** Add new mapping for given event */
void add(const Event::Type event, const Mapping& mapping);
void add(const Event::Type event, const EventMode mode, const int key, const int mod);
void add(Event::Type event, const Mapping& mapping);
void add(Event::Type event, EventMode mode, int key, int mod);
/** Erase mapping */
void erase(const Mapping& mapping);
void erase(const EventMode mode, const int key, const int mod);
void erase(EventMode mode, int key, int mod);
/** Get event for mapping */
Event::Type get(const Mapping& mapping) const;
Event::Type get(const EventMode mode, const int key, const int mod) const;
Event::Type get(EventMode mode, int key, int mod) const;
/** Check if a mapping exists */
bool check(const Mapping& mapping) const;
bool check(const EventMode mode, const int key, const int mod) const;
bool check(EventMode mode, int key, int mod) const;
/** Get mapping description */
static string getDesc(const Mapping& mapping);
static string getDesc(const EventMode mode, const int key, const int mod);
static string getDesc(EventMode mode, int key, int mod);
/** Get the mapping description(s) for given event and mode */
string getEventMappingDesc(const Event::Type event, const EventMode mode) const;
string getEventMappingDesc(Event::Type event, EventMode mode) const;
MappingArray getEventMapping(const Event::Type event, const EventMode mode) const;
MappingArray getEventMapping(Event::Type event, EventMode mode) const;
nlohmann::json saveMapping(const EventMode mode) const;
int loadMapping(const nlohmann::json& mapping, const EventMode mode);
nlohmann::json saveMapping(EventMode mode) const;
int loadMapping(const nlohmann::json& mapping, EventMode mode);
static nlohmann::json convertLegacyMapping(string_view lm);
/** Erase all mappings for given mode */
void eraseMode(const EventMode mode);
void eraseMode(EventMode mode);
/** Erase given event's mapping for given mode */
void eraseEvent(const Event::Type event, const EventMode mode);
void eraseEvent(Event::Type event, EventMode mode);
/** clear all mappings for a modes */
// void clear() { myMap.clear(); }
size_t size() { return myMap.size(); }
@ -108,12 +110,12 @@ class KeyMap
struct KeyHash {
size_t operator()(const Mapping& m) const {
return std::hash<uInt64>()((uInt64(m.mode)) // 3 bits
+ ((uInt64(m.key)) * 7) // 8 bits
+ (((uInt64((m.mod & KBDM_SHIFT) != 0) << 0)) // 1 bit
| ((uInt64((m.mod & KBDM_ALT ) != 0) << 1)) // 1 bit
| ((uInt64((m.mod & KBDM_GUI ) != 0) << 2)) // 1 bit
| ((uInt64((m.mod & KBDM_CTRL ) != 0) << 3)) // 1 bit
return std::hash<uInt64>()((static_cast<uInt64>(m.mode)) // 3 bits
+ ((static_cast<uInt64>(m.key)) * 7) // 8 bits
+ (((static_cast<uInt64>((m.mod & KBDM_SHIFT) != 0) << 0)) // 1 bit
| ((static_cast<uInt64>((m.mod & KBDM_ALT ) != 0) << 1)) // 1 bit
| ((static_cast<uInt64>((m.mod & KBDM_GUI ) != 0) << 2)) // 1 bit
| ((static_cast<uInt64>((m.mod & KBDM_CTRL ) != 0) << 3)) // 1 bit
) * 2047
);
}

View File

@ -60,6 +60,7 @@ class LinkedObjectPool
Create a pool of size CAPACITY; the active list starts out empty.
*/
LinkedObjectPool() { resize(CAPACITY); }
~LinkedObjectPool() = default;
/**
Return node data that the 'current' iterator points to.

View File

@ -27,7 +27,7 @@ class Logger {
public:
enum class Level {
enum class Level: uInt8 {
ERR = 0, // cannot use ERROR???
INFO = 1,
DEBUG = 2,
@ -55,6 +55,7 @@ class Logger {
protected:
Logger() = default;
~Logger() = default;
private:
int myLogLevel{static_cast<int>(Level::MAX)};

View File

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

View File

@ -19,9 +19,9 @@
#define MOUSE_CONTROL_HXX
class Console;
class Controller;
class Properties;
#include "Control.hxx"
#include "bspf.hxx"
/**
@ -41,7 +41,7 @@ class MouseControl
/**
Enumeration of mouse axis control types
*/
enum class Type
enum class Type: uInt8
{
LeftPaddleA = 0, LeftPaddleB, RightPaddleA, RightPaddleB,
LeftDriving, RightDriving, LeftMindLink, RightMindLink,
@ -56,6 +56,7 @@ class MouseControl
@param mode Contains information about how to use the mouse axes/buttons
*/
MouseControl(Console& console, string_view mode);
~MouseControl() = default;
/**
Cycle through each available mouse control mode

View File

@ -235,7 +235,7 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalKeyboardHandler::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)
{
// Determine controller events to use
@ -265,7 +265,7 @@ void PhysicalKeyboardHandler::defineControllerMappings(
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventMode PhysicalKeyboardHandler::getMode(const Properties& properties,
const PropType propType)
PropType propType)
{
const string& propName = properties.get(propType);
@ -276,7 +276,7 @@ EventMode PhysicalKeyboardHandler::getMode(const Properties& properties,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventMode PhysicalKeyboardHandler::getMode(const Controller::Type type)
EventMode PhysicalKeyboardHandler::getMode(Controller::Type type)
{
switch(type)
{
@ -408,8 +408,7 @@ void PhysicalKeyboardHandler::enableMappings(const Event::EventSet& events,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalKeyboardHandler::enableMapping(const Event::Type event,
EventMode mode)
void PhysicalKeyboardHandler::enableMapping(Event::Type event, EventMode mode)
{
// copy from controller mode into emulation mode
const KeyMap::MappingArray mappings = myKeyMap.getEventMapping(event, mode);
@ -419,8 +418,7 @@ void PhysicalKeyboardHandler::enableMapping(const Event::Type event,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventMode PhysicalKeyboardHandler::getEventMode(const Event::Type event,
const EventMode mode)
EventMode PhysicalKeyboardHandler::getEventMode(Event::Type event, EventMode mode)
{
if (mode == EventMode::kEmulationMode)
{
@ -444,7 +442,7 @@ EventMode PhysicalKeyboardHandler::getEventMode(const Event::Type event,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PhysicalKeyboardHandler::isJoystickEvent(const Event::Type event)
bool PhysicalKeyboardHandler::isJoystickEvent(Event::Type event)
{
return LeftJoystickEvents.contains(event)
|| QTJoystick3Events.contains(event)
@ -453,7 +451,7 @@ bool PhysicalKeyboardHandler::isJoystickEvent(const Event::Type event)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PhysicalKeyboardHandler::isPaddleEvent(const Event::Type event)
bool PhysicalKeyboardHandler::isPaddleEvent(Event::Type event)
{
return LeftPaddlesEvents.contains(event)
|| QTPaddles3Events.contains(event)
@ -462,21 +460,21 @@ bool PhysicalKeyboardHandler::isPaddleEvent(const Event::Type event)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PhysicalKeyboardHandler::isKeyboardEvent(const Event::Type event)
bool PhysicalKeyboardHandler::isKeyboardEvent(Event::Type event)
{
return LeftKeyboardEvents.contains(event)
|| RightKeyboardEvents.contains(event);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PhysicalKeyboardHandler::isDrivingEvent(const Event::Type event)
bool PhysicalKeyboardHandler::isDrivingEvent(Event::Type event)
{
return LeftDrivingEvents.contains(event)
|| RightDrivingEvents.contains(event);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PhysicalKeyboardHandler::isCommonEvent(const Event::Type event)
bool PhysicalKeyboardHandler::isCommonEvent(Event::Type event)
{
return !(isJoystickEvent(event) || isPaddleEvent(event)
|| isKeyboardEvent(event) || isDrivingEvent(event));

View File

@ -24,6 +24,7 @@ class OSystem;
class EventHandler;
#include "bspf.hxx"
#include "Control.hxx"
#include "Event.hxx"
#include "EventHandlerConstants.hxx"
#include "Props.hxx"
@ -52,7 +53,7 @@ class PhysicalKeyboardHandler
bool updateDefaults = false);
/** define mappings for current controllers */
void defineControllerMappings(const Controller::Type type,
void defineControllerMappings(Controller::Type type,
Controller::Jack port,
const Properties& properties,
Controller::Type qtType1 = Controller::Type::Unknown,
@ -108,23 +109,23 @@ class PhysicalKeyboardHandler
EventMode mode = EventMode::kEmulationMode, bool updateDefaults = false);
/** 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. */
static bool isJoystickEvent(const Event::Type event);
static bool isPaddleEvent(const Event::Type event);
static bool isKeyboardEvent(const Event::Type event);
static bool isDrivingEvent(const Event::Type event);
static bool isCommonEvent(const Event::Type event);
static bool isJoystickEvent(Event::Type event);
static bool isPaddleEvent(Event::Type event);
static bool isKeyboardEvent(Event::Type event);
static bool isDrivingEvent(Event::Type event);
static bool isCommonEvent(Event::Type event);
void enableCommonMappings();
void enableMappings(const Event::EventSet& events, EventMode mode);
void enableMapping(const Event::Type event, EventMode mode);
void enableMapping(Event::Type event, EventMode mode);
/** 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 */
static EventMode getMode(const Controller::Type type);
static EventMode getMode(Controller::Type type);
#ifdef DEBUG_BUILD
void verifyDefaultMapping(PhysicalKeyboardHandler::EventMappingArray mapping,

View File

@ -442,9 +442,8 @@ void PNGLibrary::loadImagetoSurface(FBSurface& surface, bool hasAlpha)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PNGLibrary::writeMetaData(
const png_structp png_ptr, png_infop info_ptr, // NOLINT
const VariantList& metaData)
void PNGLibrary::writeMetaData(png_structp png_ptr, png_infop info_ptr,
const VariantList& metaData)
{
const size_t numMetaData = metaData.size();
if(numMetaData == 0)
@ -462,9 +461,8 @@ void PNGLibrary::writeMetaData(
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PNGLibrary::readMetaData(
const png_structp png_ptr, png_infop info_ptr, // NOLINT
VariantList& metaData)
void PNGLibrary::readMetaData(png_structp png_ptr, png_infop info_ptr,
VariantList& metaData)
{
png_textp text_ptr{nullptr};
int numMetaData{0};
@ -479,37 +477,33 @@ void PNGLibrary::readMetaData(
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PNGLibrary::png_read_data(const png_structp ctx, // NOLINT
png_bytep area, png_size_t size)
void PNGLibrary::png_read_data(png_structp ctx, png_bytep area, png_size_t size)
{
(static_cast<std::ifstream*>(png_get_io_ptr(ctx)))->read(
reinterpret_cast<char *>(area), size);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PNGLibrary::png_write_data(const png_structp ctx, // NOLINT
png_bytep area, png_size_t size)
void PNGLibrary::png_write_data(png_structp ctx, png_bytep area, png_size_t size)
{
(static_cast<std::ofstream*>(png_get_io_ptr(ctx)))->write(
reinterpret_cast<const char *>(area), size);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PNGLibrary::png_io_flush(const png_structp ctx) // NOLINT
void PNGLibrary::png_io_flush(png_structp ctx)
{
(static_cast<std::ofstream*>(png_get_io_ptr(ctx)))->flush();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PNGLibrary::png_user_warn(const png_structp ctx, // NOLINT
png_const_charp str)
void PNGLibrary::png_user_warn(png_structp ctx, png_const_charp str)
{
throw runtime_error(string("PNGLibrary warning: ") + str);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PNGLibrary::png_user_error(const png_structp ctx, // NOLINT
png_const_charp str)
void PNGLibrary::png_user_error(png_structp ctx, png_const_charp str)
{
throw runtime_error(string("PNGLibrary error: ") + str);
}

View File

@ -22,6 +22,9 @@
#include <png.h>
#include "bspf.hxx"
#include "Variant.hxx"
class OSystem;
class FBSurface;
@ -36,6 +39,7 @@ class PNGLibrary
{
public:
explicit PNGLibrary(OSystem& osystem);
~PNGLibrary() = default;
/**
Read a PNG image from the specified file into a FBSurface structure,
@ -178,25 +182,21 @@ class PNGLibrary
/**
Write PNG tEXt chunks to the image.
*/
static void writeMetaData(const png_structp png_ptr, png_infop info_ptr,
static void writeMetaData(png_structp png_ptr, png_infop info_ptr,
const VariantList& metaData);
/**
Read PNG tEXt chunks from the image.
*/
static void readMetaData(const png_structp png_ptr, png_infop info_ptr,
static void readMetaData(png_structp png_ptr, png_infop info_ptr,
VariantList& metaData);
/** PNG library callback functions */
static void png_read_data(const png_structp ctx, png_bytep area,
png_size_t size);
static void png_write_data(const png_structp ctx, png_bytep area,
png_size_t size);
static void png_io_flush(const png_structp ctx);
[[noreturn]] static void png_user_warn(const png_structp ctx,
png_const_charp str);
[[noreturn]] static void png_user_error(const png_structp ctx,
png_const_charp str);
static void png_read_data(png_structp ctx, png_bytep area, png_size_t size);
static void png_write_data(png_structp ctx, png_bytep area, png_size_t size);
static void png_io_flush(png_structp ctx);
[[noreturn]] static void png_user_warn(png_structp ctx, png_const_charp str);
[[noreturn]] static void png_user_error(png_structp ctx, png_const_charp str);
private:
// Following constructors and assignment operators not supported

View File

@ -39,7 +39,7 @@ class PaletteHandler
static constexpr float DEF_RGB_SHIFT = 0.0F;
static constexpr float MAX_RGB_SHIFT = 22.5F;
enum Adjustables : uInt32 {
enum Adjustables : uInt8 {
PHASE_SHIFT,
RED_SCALE,
GREEN_SCALE,
@ -66,6 +66,7 @@ class PaletteHandler
public:
explicit PaletteHandler(OSystem& system);
~PaletteHandler() = default;
/**
Cycle through available palettes.
@ -124,7 +125,7 @@ class PaletteHandler
private:
static constexpr char DEGREE = 0x1c;
enum PaletteType {
enum PaletteType: uInt8 {
Standard,
Z26,
User,

View File

@ -33,7 +33,7 @@ class PhosphorHandler
static constexpr string_view VALUE_AUTO_ON = "autoon";
static constexpr string_view VALUE_AUTO = "auto";
enum PhosphorMode {
enum PhosphorMode: uInt8 {
ByRom,
Always,
Auto_on,
@ -44,6 +44,7 @@ class PhosphorHandler
static constexpr string_view DEFAULT_BLEND = "50"; // align with myPhosphorPercent!
PhosphorHandler() = default;
~PhosphorHandler() = default;
bool initialize(bool enable, int blend);
@ -63,12 +64,12 @@ class PhosphorHandler
static constexpr uInt32 getPixel(const uInt32 c, const uInt32 p)
{
// Mix current calculated frame with previous displayed frame
const uInt8 rc = static_cast<uInt8>(c >> 16),
gc = static_cast<uInt8>(c >> 8),
bc = static_cast<uInt8>(c),
rp = static_cast<uInt8>(p >> 16),
gp = static_cast<uInt8>(p >> 8),
bp = static_cast<uInt8>(p);
const auto rc = static_cast<uInt8>(c >> 16),
gc = static_cast<uInt8>(c >> 8),
bc = static_cast<uInt8>(c),
rp = static_cast<uInt8>(p >> 16),
gp = static_cast<uInt8>(p >> 8),
bp = static_cast<uInt8>(p);
return (ourPhosphorLUT[rc][rp] << 16) | (ourPhosphorLUT[gc][gp] << 8) |
ourPhosphorLUT[bc][bp];

View File

@ -111,7 +111,7 @@ bool PhysicalJoystick::setMap(const json& map)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
json PhysicalJoystick::convertLegacyMapping(string_view mapping, string_view name)
{
istringstream buf(string{mapping}); // TODO: fixed in C++20
istringstream buf(string{mapping}); // TODO: fixed in C++23
json convertedMapping = json::object();
string map;

View File

@ -43,7 +43,7 @@ class PhysicalJoystick
static constexpr char MODE_DELIM = '>'; // must not be '^', '|' or '#'
public:
enum class Port {
enum class Port: uInt8 {
AUTO,
LEFT,
RIGHT,
@ -51,10 +51,11 @@ class PhysicalJoystick
};
PhysicalJoystick() = default;
~PhysicalJoystick() = default;
nlohmann::json getMap() const;
bool setMap(const nlohmann::json& map);
void setPort(const Port _port) { port = _port; }
void setPort(Port _port) { port = _port; }
static nlohmann::json convertLegacyMapping(string_view mapping,
string_view name);
@ -68,7 +69,7 @@ class PhysicalJoystick
int axes, int buttons, int hats, int balls);
private:
enum class Type {
enum class Type: uInt8 {
REGULAR,
LEFT_STELLADAPTOR, RIGHT_STELLADAPTOR,
LEFT_2600DAPTOR, RIGHT_2600DAPTOR
@ -89,7 +90,7 @@ class PhysicalJoystick
// Convert from string to Port type and vice versa
static string getName(const Port _port) {
static constexpr std::array<string_view,
static_cast<int>(PhysicalJoystick::Port::NUM_PORTS)> NAMES = {
static_cast<uInt8>(PhysicalJoystick::Port::NUM_PORTS)> NAMES = {
"Auto", "Left", "Right"
};
@ -98,11 +99,11 @@ class PhysicalJoystick
static Port getPort(string_view portName) {
static constexpr std::array<string_view,
static_cast<int>(PhysicalJoystick::Port::NUM_PORTS)> NAMES = {
static_cast<uInt8>(PhysicalJoystick::Port::NUM_PORTS)> NAMES = {
"Auto", "Left", "Right"
};
for(int i = 0; i < static_cast<int>(PhysicalJoystick::Port::NUM_PORTS); ++i)
for(uInt8 i = 0; i < static_cast<uInt8>(PhysicalJoystick::Port::NUM_PORTS); ++i)
if (BSPF::equalsIgnoreCase(portName, NAMES[i]))
return PhysicalJoystick::Port{i};

View File

@ -22,6 +22,7 @@ class OSystem;
class StateManager;
#include "LinkedObjectPool.hxx"
#include "Serializer.hxx"
#include "bspf.hxx"
/**
@ -47,12 +48,13 @@ class RewindManager
{
public:
RewindManager(OSystem& system, StateManager& statemgr);
~RewindManager() = default;
public:
static constexpr uInt32 MAX_BUF_SIZE = 1000;
static constexpr int NUM_INTERVALS = 7;
// cycle values for the intervals
const std::array<uInt32, NUM_INTERVALS> INTERVAL_CYCLES = {
static constexpr std::array<uInt32, NUM_INTERVALS> INTERVAL_CYCLES = {
76 * 262,
76 * 262 * 3,
76 * 262 * 10,
@ -74,7 +76,7 @@ class RewindManager
static constexpr int NUM_HORIZONS = 8;
// cycle values for the horzions
const std::array<uInt64, NUM_HORIZONS> HORIZON_CYCLES = {
static constexpr std::array<uInt64, NUM_HORIZONS> HORIZON_CYCLES = {
uInt64{76} * 262 * 60 * 3,
uInt64{76} * 262 * 60 * 10,
uInt64{76} * 262 * 60 * 30,
@ -187,7 +189,7 @@ class RewindManager
RewindState() = default;
~RewindState() = default;
RewindState(const RewindState& rs) : cycles(rs.cycles) { }
RewindState& operator= (const RewindState& rs) { cycles = rs.cycles; return *this; }
RewindState& operator= (const RewindState& rs) { cycles = rs.cycles; return *this; } // NOLINT: we don't worry about self-assignment here
RewindState(RewindState&&) = default;
RewindState& operator=(RewindState&&) = default;

View File

@ -63,7 +63,7 @@ static inline string SDLVersion()
static inline bool SDLSupportsURL()
{
return static_cast<bool>(SDL_VERSION_ATLEAST(2,0,14));
return SDL_VERSION_ATLEAST(2,0,14);
}
static inline bool SDLOpenURL(const string& url)

View File

@ -385,8 +385,7 @@ void SoundSDL2::callback(void* object, uInt8* stream, int len)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SoundSDL2::playWav(const string& fileName, const uInt32 position,
const uInt32 length)
bool SoundSDL2::playWav(const string& fileName, uInt32 position, uInt32 length)
{
const char* const device = myDeviceId
? myDevices.at(myDeviceId).first.c_str()
@ -409,9 +408,7 @@ uInt32 SoundSDL2::wavSize() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SoundSDL2::WavHandlerSDL2::play(
const string& fileName, const char* device,
const uInt32 position, const uInt32 length
)
const string& fileName, const char* device, uInt32 position, uInt32 length)
{
// Load WAV file
if(fileName != myFilename || myBuffer == nullptr)

View File

@ -44,10 +44,6 @@ class SoundSDL2 : public Sound
using the object.
*/
SoundSDL2(OSystem& osystem, AudioSettings& audioSettings);
/**
Destructor
*/
~SoundSDL2() override;
public:
@ -121,8 +117,8 @@ class SoundSDL2 : public Sound
@return True if the WAV file can be played, else false
*/
bool playWav(const string& fileName, const uInt32 position = 0,
const uInt32 length = 0) override;
bool playWav(const string& fileName, uInt32 position = 0,
uInt32 length = 0) override;
/**
Stop any currently playing WAV file.
@ -185,7 +181,7 @@ class SoundSDL2 : public Sound
~WavHandlerSDL2();
bool play(const string& fileName, const char* device,
const uInt32 position, const uInt32 length);
uInt32 position, uInt32 length);
void stop();
uInt32 size() const { return myBuffer ? myRemaining : 0; }

View File

@ -38,6 +38,7 @@ class FixedStack
using StackFunction = std::function<void(T&)>;
FixedStack() = default;
~FixedStack() = default;
bool empty() const { return _size == 0; }
bool full() const { return _size >= CAPACITY; }

View File

@ -35,7 +35,7 @@ class RewindManager;
class StateManager
{
public:
enum class Mode {
enum class Mode: uInt8 {
Off,
TimeMachine,
MovieRecord,

View File

@ -417,7 +417,7 @@ enum StellaMod
// Test if specified modifier is pressed
namespace StellaModTest
{
inline constexpr bool isAlt(int mod)
constexpr bool isAlt(int mod)
{
#if defined(BSPF_MACOS) || defined(MACOS_KEYS)
return (mod & KBDM_GUI);
@ -426,16 +426,16 @@ namespace StellaModTest
#endif
}
inline constexpr bool isControl(int mod)
constexpr bool isControl(int mod)
{
return (mod & KBDM_CTRL);
}
inline constexpr bool isShift(int mod)
constexpr bool isShift(int mod)
{
return (mod & KBDM_SHIFT);
}
}
} // namespace StellaModTest
namespace StellaKeyName
{
@ -447,6 +447,6 @@ namespace StellaKeyName
return string_view{};
#endif
}
}
} // namespace StellaKeyName
#endif /* StellaKeys */

View File

@ -36,12 +36,13 @@ class StringParser
*/
explicit StringParser(string_view str)
{
istringstream buf(string{str}); // TODO: fixed in C++20
istringstream buf(string{str}); // TODO: fixed in C++23
string line;
while(std::getline(buf, line, '\n'))
myStringList.push_back(line);
}
~StringParser() = default;
/**
Split the given string based on the newline character, making sure that
@ -52,7 +53,7 @@ class StringParser
*/
StringParser(string_view str, uInt32 maxlen)
{
istringstream buf(string{str}); // TODO: fixed in C++20
istringstream buf(string{str}); // TODO: fixed in C++23
string line;
while(std::getline(buf, line, '\n'))

View File

@ -49,6 +49,7 @@ class ThreadDebuggingHelper {
[[noreturn]] static void fail(const string& message);
ThreadDebuggingHelper() = default;
~ThreadDebuggingHelper() = default;
std::thread::id myMainThreadId;

View File

@ -205,7 +205,7 @@ class TimerManager
bool done{false};
// Valid IDs are guaranteed not to be this value
static TimerId constexpr no_timer = TimerId(0);
static TimerId constexpr no_timer = static_cast<TimerId>(0);
private:
// Following constructors and assignment operators not supported

View File

@ -42,7 +42,7 @@ class Variant
}
public:
Variant() = default; // NOLINT
Variant() = default;
Variant(const string& s) : data{s} { }
Variant(string_view s) : data{s} { }
@ -89,6 +89,6 @@ namespace VarList {
{
list.emplace_back(name.toString(), tag);
}
}
} // namespace VarList
#endif

View File

@ -34,7 +34,7 @@ class VideoModeHandler
// 'screen' are the dimensions of the screen itself
struct Mode
{
enum class Stretch {
enum class Stretch: uInt8 {
Preserve, // Stretch to fill all available space; preserve aspect ratio
Fill, // Stretch to fill all available space
None // No stretching (1x zoom)
@ -70,6 +70,7 @@ class VideoModeHandler
public:
VideoModeHandler() = default;
~VideoModeHandler() = default;
/**
Set the base size of the image. Scaling can be applied to this,

View File

@ -35,6 +35,7 @@ class ZipHandler
{
public:
ZipHandler() = default;
~ZipHandler() = default;
// Open ZIP file for processing
// An exception will be thrown on any errors
@ -54,7 +55,7 @@ class ZipHandler
private:
// Error types
enum class ZipError
enum class ZipError: uInt8
{
NONE = 0,
OUT_OF_MEMORY,
@ -182,7 +183,7 @@ class ZipHandler
}
string read_string(size_t offs, size_t len = string::npos) const
{
return string(reinterpret_cast<char const *>(myBuf + offs), len);
return {reinterpret_cast<char const *>(myBuf + offs), len};
}
private:

View File

@ -23,12 +23,12 @@
class ConvolutionBuffer
{
public:
explicit ConvolutionBuffer(uInt32 size);
~ConvolutionBuffer() = default;
void shift(float nextValue);
float convoluteWith(const float* const kernel) const;
float convoluteWith(const float* kernel) const;
private:
@ -39,7 +39,6 @@ class ConvolutionBuffer
uInt32 mySize{0};
private:
ConvolutionBuffer() = delete;
ConvolutionBuffer(const ConvolutionBuffer&) = delete;
ConvolutionBuffer(ConvolutionBuffer&&) = delete;

View File

@ -29,6 +29,7 @@ class SimpleResampler : public Resampler
Resampler::Format formatTo,
const Resampler::NextFragmentCallback& NextFragmentCallback
);
~SimpleResampler() override = default;
void fillFragment(float* fragment, uInt32 length) override;

View File

@ -88,8 +88,8 @@ using BoolArray = std::vector<bool>;
using ByteArray = std::vector<uInt8>;
using ShortArray = std::vector<uInt16>;
using StringList = std::vector<std::string>;
using ByteBuffer = std::unique_ptr<uInt8[]>; // NOLINT
using DWordBuffer = std::unique_ptr<uInt32[]>; // NOLINT
using ByteBuffer = std::unique_ptr<uInt8[]>;
using DWordBuffer = std::unique_ptr<uInt32[]>;
// We use KB a lot; let's make a literal for it
constexpr size_t operator "" _KB(unsigned long long size)
@ -105,7 +105,7 @@ std::ostream& operator<< (std::ostream& out, const std::vector<T>& v) {
return out;
}
static const string EmptyString("");
static const string EmptyString;
// This is defined by some systems, but Stella has other uses for it
#undef PAGE_SIZE
@ -147,7 +147,7 @@ namespace BSPF
#endif
// Get next power of two greater than or equal to the given value
inline constexpr size_t nextPowerOfTwo(size_t size) {
constexpr size_t nextPowerOfTwo(size_t size) {
if(size < 2) return 1;
size_t power2 = 1;
while(power2 < size)
@ -157,7 +157,7 @@ namespace BSPF
// Get next multiple of the given value
// Note that this only works when multiple is a power of two
inline constexpr size_t nextMultipleOf(size_t size, size_t multiple) {
constexpr size_t nextMultipleOf(size_t size, size_t multiple) {
return (size + multiple - 1) & ~(multiple - 1);
}
@ -167,15 +167,15 @@ namespace BSPF
// Combines 'max' and 'min', and clamps value to the upper/lower value
// if it is outside the specified range
template<typename T> inline constexpr T clamp(T val, T lower, T upper)
template<typename T> constexpr T clamp(T val, T lower, T upper)
{
return std::clamp<T>(val, lower, upper);
}
template<typename T> inline constexpr void clamp(T& val, T lower, T upper, T setVal)
template<typename T> constexpr void clamp(T& val, T lower, T upper, T setVal)
{
if(val < lower || val > upper) val = setVal;
}
template<typename T> inline constexpr T clampw(T val, T lower, T upper)
template<typename T> constexpr T clampw(T val, T lower, T upper)
{
return (val < lower) ? upper : (val > upper) ? lower : val;
}
@ -204,7 +204,7 @@ namespace BSPF
{
try {
int i{};
s = s.substr(s.find_first_not_of(" "));
s = s.substr(s.find_first_not_of(' '));
auto result = std::from_chars(s.data(), s.data() + s.size(), i, BASE);
return result.ec == std::errc() ? i : defaultValue;
}
@ -226,13 +226,13 @@ namespace BSPF
}
// Test whether two strings are equal (case insensitive)
inline constexpr bool equalsIgnoreCase(string_view s1, string_view s2)
constexpr bool equalsIgnoreCase(string_view s1, string_view s2)
{
return s1.size() == s2.size() ? (compareIgnoreCase(s1, s2) == 0) : false;
}
// Test whether the first string starts with the second one (case insensitive)
inline constexpr bool startsWithIgnoreCase(string_view s1, string_view s2)
constexpr bool startsWithIgnoreCase(string_view s1, string_view s2)
{
if(s1.size() >= s2.size())
return compareIgnoreCase(s1.substr(0, s2.size()), s2) == 0;
@ -241,7 +241,7 @@ namespace BSPF
}
// Test whether the first string ends with the second one (case insensitive)
inline constexpr bool endsWithIgnoreCase(string_view s1, string_view s2)
constexpr bool endsWithIgnoreCase(string_view s1, string_view s2)
{
if(s1.size() >= s2.size())
return compareIgnoreCase(s1.substr(s1.size() - s2.size()), s2) == 0;
@ -253,7 +253,7 @@ namespace BSPF
// starting from 'startpos' in the first string
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 *const pos = std::search(s1.cbegin()+startpos, s1.cend(),
s2.cbegin(), s2.cend(), [](char ch1, char ch2) {
return toupper(static_cast<uInt8>(ch1)) == toupper(static_cast<uInt8>(ch2));
});

View File

@ -25,7 +25,7 @@
#include "FSNode.hxx"
#include "bspf.hxx"
template<class T>
template<typename T>
class KeyValueRepositoryFile : public KeyValueRepository {
public:
explicit KeyValueRepositoryFile(const FSNode& node);
@ -44,16 +44,17 @@ class KeyValueRepositoryFile : public KeyValueRepository {
///////////////////////////////////////////////////////////////////////////////
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<class T>
template<typename T>
KeyValueRepositoryFile<T>::KeyValueRepositoryFile(const FSNode& node)
: myNode{node}
{}
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<class T>
template<typename T>
KVRMap KeyValueRepositoryFile<T>::load()
{
if (!myNode.exists()) return KVRMap();
if (!myNode.exists()) return {};
stringstream in;
@ -64,18 +65,18 @@ KVRMap KeyValueRepositoryFile<T>::load()
catch (const runtime_error& err) {
Logger::error(err.what());
return KVRMap();
return {};
}
catch (...) {
return KVRMap();
return {};
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<class T>
template<typename T>
bool KeyValueRepositoryFile<T>::save(const KVRMap& values)
{
if (values.size() == 0) return true;
if (values.empty()) return true;
stringstream out;

View File

@ -37,6 +37,7 @@ class CompositeKeyValueRepositorySqlite : public CompositeKeyValueRepositoryAtom
string_view colKey2,
string_view colValue
);
~CompositeKeyValueRepositorySqlite() override = default;
shared_ptr<KeyValueRepository> get(string_view key) override;
@ -53,6 +54,7 @@ class CompositeKeyValueRepositorySqlite : public CompositeKeyValueRepositoryAtom
ProxyRepository(const CompositeKeyValueRepositorySqlite& repo,
string_view key);
~ProxyRepository() override = default;
protected:

View File

@ -29,6 +29,7 @@ class KeyValueRepositorySqlite : public AbstractKeyValueRepositorySqlite
KeyValueRepositorySqlite(SqliteDatabase& db, string_view tableName,
string_view colKey, string_view colValue);
~KeyValueRepositorySqlite() override = default;
void initialize();

View File

@ -34,7 +34,7 @@ class SqliteDatabase
const string& fileName() const { return myDatabaseFile; }
operator sqlite3*() const { return myHandle; }
operator sqlite3*() const { return myHandle; } // NOLINT: explicit not required
void exec(string_view sql);

View File

@ -30,7 +30,7 @@ class SqliteError : public std::exception
const char* what() const noexcept override { return myMessage.c_str(); }
private:
const string myMessage;
string myMessage;
};
#endif // SQLITE_ERROR_HXX

View File

@ -32,7 +32,7 @@ class SqliteStatement {
~SqliteStatement();
operator sqlite3_stmt*() const { return myStmt; }
operator sqlite3_stmt*() const { return myStmt; } // NOLINT: explicit not required
SqliteStatement& bind(int index, string_view value);
SqliteStatement& bind(int index, Int32 value);

View File

@ -27,7 +27,7 @@
class BlitterFactory {
public:
enum class ScalingAlgorithm {
enum class ScalingAlgorithm: uInt8 {
nearestNeighbour,
bilinear,
quasiInteger

View File

@ -29,56 +29,56 @@ constexpr uInt8 smartmod(uInt8 x)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<>
inline constexpr uInt8 smartmod<2>(uInt8 x)
constexpr uInt8 smartmod<2>(uInt8 x)
{
return x & 0x01;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<>
inline constexpr uInt8 smartmod<4>(uInt8 x)
constexpr uInt8 smartmod<4>(uInt8 x)
{
return x & 0x03;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<>
inline constexpr uInt8 smartmod<8>(uInt8 x)
constexpr uInt8 smartmod<8>(uInt8 x)
{
return x & 0x07;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<>
inline constexpr uInt8 smartmod<16>(uInt8 x)
constexpr uInt8 smartmod<16>(uInt8 x)
{
return x & 0x0F;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<>
inline constexpr uInt8 smartmod<32>(uInt8 x)
constexpr uInt8 smartmod<32>(uInt8 x)
{
return x & 0x1F;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<>
inline constexpr uInt8 smartmod<64>(uInt8 x)
constexpr uInt8 smartmod<64>(uInt8 x)
{
return x & 0x3F;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<>
inline constexpr uInt8 smartmod<128>(uInt8 x)
constexpr uInt8 smartmod<128>(uInt8 x)
{
return x & 0x7F;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<>
inline constexpr uInt8 smartmod<256>(uInt8 x)
constexpr uInt8 smartmod<256>(uInt8 x)
{
return x & 0xFF;
}

View File

@ -100,9 +100,8 @@ void AtariNTSC::enableThreading(bool enable)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AtariNTSC::render(const uInt8* atari_in, const uInt32 in_width,
const uInt32 in_height, void* rgb_out,
const uInt32 out_pitch, uInt32* rgb_in)
void AtariNTSC::render(const uInt8* atari_in, uInt32 in_width, uInt32 in_height,
void* rgb_out, uInt32 out_pitch, uInt32* rgb_in)
{
// Spawn the threads...
for(uInt32 i = 0; i < myWorkerThreads; ++i)
@ -130,9 +129,9 @@ void AtariNTSC::render(const uInt8* atari_in, const uInt32 in_width,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AtariNTSC::renderThread(const uInt8* atari_in, const uInt32 in_width,
const uInt32 in_height, const uInt32 numThreads, const uInt32 threadNum,
void* rgb_out, const uInt32 out_pitch)
void AtariNTSC::renderThread(const uInt8* atari_in, uInt32 in_width,
uInt32 in_height, uInt32 numThreads, uInt32 threadNum,
void* rgb_out, uInt32 out_pitch)
{
// Adapt parameters to thread number
const uInt32 yStart = in_height * threadNum / numThreads;
@ -204,9 +203,9 @@ void AtariNTSC::renderThread(const uInt8* atari_in, const uInt32 in_width,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AtariNTSC::renderWithPhosphorThread(const uInt8* atari_in, const uInt32 in_width,
const uInt32 in_height, const uInt32 numThreads, const uInt32 threadNum,
uInt32* rgb_in, void* rgb_out, const uInt32 out_pitch)
void AtariNTSC::renderWithPhosphorThread(const uInt8* atari_in, uInt32 in_width,
uInt32 in_height, uInt32 numThreads, uInt32 threadNum, uInt32* rgb_in,
void* rgb_out, uInt32 out_pitch)
{
// Adapt parameters to thread number
const uInt32 yStart = in_height * threadNum / numThreads;

View File

@ -94,8 +94,8 @@ class AtariNTSC
// palette colors.
// In_row_width is the number of pixels to get to the next input row.
// Out_pitch is the number of *bytes* to get to the next output row.
void render(const uInt8* atari_in, const uInt32 in_width, const uInt32 in_height,
void* rgb_out, const uInt32 out_pitch, uInt32* rgb_in = nullptr);
void render(const uInt8* atari_in, uInt32 in_width, uInt32 in_height,
void* rgb_out, uInt32 out_pitch, uInt32* rgb_in = nullptr);
// Number of output pixels written by blitter for given input width.
// Width might be rounded down slightly; use inWidth() on result to
@ -109,10 +109,11 @@ class AtariNTSC
void generateKernels();
// Threaded rendering
void renderThread(const uInt8* atari_in, const uInt32 in_width,
const uInt32 in_height, const uInt32 numThreads, const uInt32 threadNum, void* rgb_out, const uInt32 out_pitch);
void renderWithPhosphorThread(const uInt8* atari_in, const uInt32 in_width,
const uInt32 in_height, const uInt32 numThreads, const uInt32 threadNum, uInt32* rgb_in, void* rgb_out, const uInt32 out_pitch);
void renderThread(const uInt8* atari_in, uInt32 in_width, uInt32 in_height,
uInt32 numThreads, uInt32 threadNum, void* rgb_out, uInt32 out_pitch);
void renderWithPhosphorThread(const uInt8* atari_in, uInt32 in_width,
uInt32 in_height, uInt32 numThreads, uInt32 threadNum, uInt32* rgb_in,
void* rgb_out, uInt32 out_pitch);
private:
static constexpr Int32
@ -153,20 +154,21 @@ class AtariNTSC
luma_cutoff = 0.20F
;
std::array<uInt8, palette_size*3> myRGBPalette;
std::array<uInt8, palette_size * 3L> myRGBPalette;
BSPF::array2D<uInt32, palette_size, entry_size> myColorTable;
// Rendering threads
unique_ptr<std::thread[]> myThreads; // NOLINT
unique_ptr<std::thread[]> myThreads;
// Number of rendering and total threads
uInt32 myWorkerThreads{0}, myTotalThreads{0};
struct init_t
{
std::array<float, burst_count * 6> to_rgb{0.F};
std::array<float, burst_count * 6L> to_rgb{0.F};
float artifacts{0.F};
float fringing{0.F};
std::array<float, rescale_out * kernel_size * 2> kernel{0.F};
std::array<float, static_cast<size_t>
(rescale_out * kernel_size * 2)> kernel{0.F};
init_t() {
to_rgb.fill(0.0);
@ -213,10 +215,10 @@ class AtariNTSC
// 8888: 00000000 RRRRRRRR GGGGGGGG BBBBBBBB (8-8-8-8 32-bit ARGB)
#define ATARI_NTSC_RGB_OUT_8888( index, rgb_out ) {\
uInt32 raw_ =\
kernel0 [index ] + kernel1 [(index+10)%7+14] +\
kernelx0 [(index+7)%14] + kernelx1 [(index+ 3)%7+14+7];\
kernel0 [(index) ] + kernel1 [((index)+10)%7+14] +\
kernelx0 [((index)+7)%14] + kernelx1 [((index)+ 3)%7+14+7];\
ATARI_NTSC_CLAMP( raw_, 0 );\
rgb_out = (raw_>>5 & 0x00FF0000)|(raw_>>3 & 0x0000FF00)|(raw_>>1 & 0x000000FF);\
(rgb_out) = (raw_>>5 & 0x00FF0000)|(raw_>>3 & 0x0000FF00)|(raw_>>1 & 0x000000FF);\
}
// Common ntsc macros

View File

@ -36,10 +36,11 @@ class NTSCFilter
{
public:
NTSCFilter() = default;
~NTSCFilter() = default;
public:
// Set one of the available preset adjustments (Composite, S-Video, RGB, etc)
enum class Preset {
enum class Preset: uInt8 {
OFF,
RGB,
SVIDEO,
@ -47,7 +48,7 @@ class NTSCFilter
BAD,
CUSTOM
};
enum class Adjustables {
enum class Adjustables: uInt8 {
SHARPNESS,
RESOLUTION,
ARTIFACTS,
@ -106,19 +107,19 @@ class NTSCFilter
// Perform Blargg filtering on input buffer, place results in
// output buffer
inline void render(const uInt8* src_buf, uInt32 src_width, uInt32 src_height,
uInt32* dest_buf, uInt32 dest_pitch)
void render(const uInt8* src_buf, uInt32 src_width, uInt32 src_height,
uInt32* dest_buf, uInt32 dest_pitch)
{
myNTSC.render(src_buf, src_width, src_height, dest_buf, dest_pitch);
}
inline void render(const uInt8* src_buf, uInt32 src_width, uInt32 src_height,
uInt32* dest_buf, uInt32 dest_pitch, uInt32* prev_buf)
void render(const uInt8* src_buf, uInt32 src_width, uInt32 src_height,
uInt32* dest_buf, uInt32 dest_pitch, uInt32* prev_buf)
{
myNTSC.render(src_buf, src_width, src_height, dest_buf, dest_pitch, prev_buf);
}
// Enable threading for the NTSC rendering
inline void enableThreading(bool enable)
void enableThreading(bool enable)
{
myNTSC.enableThreading(enable);
}

View File

@ -200,7 +200,7 @@ string CartDebug::toString()
bytesPerLine = 0x04;
break;
case Base::Fmt::_DEFAULT:
case Base::Fmt::DEFAULT:
default:
return DebuggerParser::red("invalid base, this is a BUG");
}

View File

@ -30,7 +30,7 @@ class DataGridRamWidget : public DataGridWidget
const GUI::Font& font,
int x, int y, int cols, int rows,
int colchars, int bits,
Common::Base::Fmt base = Common::Base::Fmt::_DEFAULT,
Common::Base::Fmt base = Common::Base::Fmt::DEFAULT,
bool useScrollbar = false);
~DataGridRamWidget() override = default;

View File

@ -778,7 +778,7 @@ void DataGridWidget::endEditMode()
case Common::Base::Fmt::_10:
editString().insert(0, 1, '#');
break;
case Common::Base::Fmt::_DEFAULT:
case Common::Base::Fmt::DEFAULT:
default: // TODO - properly handle all other cases
break;
}

View File

@ -43,7 +43,7 @@ class DataGridWidget : public EditableWidget
DataGridWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int cols, int rows,
int colchars, int bits,
Common::Base::Fmt base = Common::Base::Fmt::_DEFAULT,
Common::Base::Fmt base = Common::Base::Fmt::DEFAULT,
bool useScrollbar = false);
~DataGridWidget() override = default;

View File

@ -109,7 +109,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
case Common::Base::Fmt::_10:
return (c >= '0' && c <= '9') || c == ' ';
case Common::Base::Fmt::_DEFAULT:
case Common::Base::Fmt::DEFAULT:
default: // TODO - properly handle all other cases
return false;
}

View File

@ -103,7 +103,7 @@ class RomListWidget : public EditableWidget
int _selectedItem{-1};
int _highlightedItem{-1};
StellaKey _currentKeyDown{KBDK_UNKNOWN};
Common::Base::Fmt _base{Common::Base::Fmt::_DEFAULT}; // base used during editing
Common::Base::Fmt _base{Common::Base::Fmt::DEFAULT}; // base used during editing
const CartDebug::Disassembly* myDisasm{nullptr};
vector<CheckboxWidget*> myCheckList;

View File

@ -90,7 +90,7 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
case RomListWidget::kRomChangedCmd:
// 'data' is the line in the disassemblylist to be accessed
// 'id' is the base to use for the data to be changed
patchROM(data, myRomList->getText(), Common::Base::Fmt{id});
patchROM(data, myRomList->getText(), Common::Base::Fmt(id));
break;
case RomListWidget::kSetPCCmd:

View File

@ -18,6 +18,8 @@
#ifndef EVENTHANDLER_CONSTANTS_HXX
#define EVENTHANDLER_CONSTANTS_HXX
#include <string>
// Enumeration representing the different states of operation
enum class EventHandlerState {
EMULATION,
@ -93,17 +95,17 @@ enum class EventMode {
namespace GUI
{
#ifdef RETRON77
static const string SELECT = "Mode";
static const string LEFT_DIFFICULTY = "P1 skill";
static const string RIGHT_DIFFICULTY = "P2 skill";
static const string LEFT_DIFF = "P1 Skill";
static const string RIGHT_DIFF = "P2 Skill";
static const std::string SELECT = "Mode";
static const std::string LEFT_DIFFICULTY = "P1 skill";
static const std::string RIGHT_DIFFICULTY = "P2 skill";
static const std::string LEFT_DIFF = "P1 Skill";
static const std::string RIGHT_DIFF = "P2 Skill";
#else
static const string SELECT = "Select";
static const string LEFT_DIFFICULTY = "Left difficulty";
static const string RIGHT_DIFFICULTY = "Right difficulty";
static const string LEFT_DIFF = "Left Diff";
static const string RIGHT_DIFF = "Right Diff";
static const std::string SELECT = "Select";
static const std::string LEFT_DIFFICULTY = "Left difficulty";
static const std::string RIGHT_DIFFICULTY = "Right difficulty";
static const std::string LEFT_DIFF = "Left Diff";
static const std::string RIGHT_DIFF = "Right Diff";
#endif
}

View File

@ -118,8 +118,8 @@ class Sound
@return True, if the WAV file can be played
*/
virtual bool playWav(const string& fileName, const uInt32 position = 0,
const uInt32 length = 0) { return false; }
virtual bool playWav(const string& fileName, uInt32 position = 0,
uInt32 length = 0) { return false; }
/**
Stop any currently playing WAV file.