Merge branch 'master' into feature/filesystem

This commit is contained in:
Stephen Anthony 2022-09-13 23:06:04 -02:30
commit a1843a28c6
115 changed files with 557 additions and 509 deletions

View File

@ -89,12 +89,12 @@ CheatCodeDialog::CheatCodeDialog(OSystem& osystem, DialogContainer& parent,
myCheatInput->setTarget(this);
// Add filtering for each textfield
EditableWidget::TextFilter f0 = [](char c) {
const EditableWidget::TextFilter f0 = [](char c) {
return isprint(c) && c != '\"' && c != ':';
};
myCheatInput->setTextFilter(f0, 0);
EditableWidget::TextFilter f1 = [](char c) {
const EditableWidget::TextFilter f1 = [](char c) {
return (c >= 'a' && c <= 'f') || (c >= '0' && c <= '9');
};
myCheatInput->setTextFilter(f1, 1);

View File

@ -36,7 +36,7 @@ CheatManager::CheatManager(OSystem& osystem)
bool CheatManager::add(const string& name, const string& code,
bool enable, int idx)
{
shared_ptr<Cheat> cheat = createCheat(name, code);
const shared_ptr<Cheat> cheat = createCheat(name, code);
if(!cheat)
return false;
@ -120,7 +120,7 @@ void CheatManager::addPerFrame(const string& name, const string& code, bool enab
void CheatManager::addOneShot(const string& name, const string& code)
{
// Evaluate this cheat once, and then immediately discard it
shared_ptr<Cheat> cheat = createCheat(name, code);
const shared_ptr<Cheat> cheat = createCheat(name, code);
if(cheat)
cheat->evaluate();
}
@ -299,7 +299,7 @@ void CheatManager::saveCheats(const string& md5sum)
cheats << ",";
}
bool changed = cheats.str() != myCurrentCheat;
const bool changed = cheats.str() != myCurrentCheat;
// Only update the list if absolutely necessary
if(changed)

View File

@ -54,7 +54,7 @@ uInt32 AudioQueue::capacity() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 AudioQueue::size() const
{
lock_guard<mutex> guard(myMutex);
const lock_guard<mutex> guard(myMutex);
return mySize;
}
@ -74,7 +74,7 @@ uInt32 AudioQueue::fragmentSize() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Int16* AudioQueue::enqueue(Int16* fragment)
{
lock_guard<mutex> guard(myMutex);
const lock_guard<mutex> guard(myMutex);
Int16* newFragment = nullptr;
@ -105,7 +105,7 @@ Int16* AudioQueue::enqueue(Int16* fragment)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Int16* AudioQueue::dequeue(Int16* fragment)
{
lock_guard<mutex> guard(myMutex);
const lock_guard<mutex> guard(myMutex);
if (mySize == 0) return nullptr;
@ -128,7 +128,7 @@ Int16* AudioQueue::dequeue(Int16* fragment)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AudioQueue::closeSink(Int16* fragment)
{
lock_guard<mutex> guard(myMutex);
const lock_guard<mutex> guard(myMutex);
if (myFirstFragmentForDequeue && fragment)
throw runtime_error("attempt to return unknown buffer on closeSink");

View File

@ -51,7 +51,7 @@ AudioSettings::AudioSettings(Settings& settings)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AudioSettings::normalize(Settings& settings)
{
int settingPreset = settings.getInt(SETTING_PRESET);
const int settingPreset = settings.getInt(SETTING_PRESET);
const Preset preset = normalizedPreset(settingPreset);
if (static_cast<int>(preset) != settingPreset) settings.setValue(SETTING_PRESET, static_cast<int>(DEFAULT_PRESET));
@ -80,18 +80,19 @@ void AudioSettings::normalize(Settings& settings)
break;
}
int settingBufferSize = settings.getInt(SETTING_BUFFER_SIZE);
const int settingBufferSize = settings.getInt(SETTING_BUFFER_SIZE);
if (settingBufferSize < 0 || settingBufferSize > MAX_BUFFER_SIZE) settings.setValue(SETTING_BUFFER_SIZE, DEFAULT_BUFFER_SIZE);
int settingHeadroom = settings.getInt(SETTING_HEADROOM);
const int settingHeadroom = settings.getInt(SETTING_HEADROOM);
if (settingHeadroom < 0 || settingHeadroom > MAX_HEADROOM) settings.setValue(SETTING_HEADROOM, DEFAULT_HEADROOM);
int settingResamplingQuality = settings.getInt(SETTING_RESAMPLING_QUALITY);
const ResamplingQuality resamplingQuality = normalizeResamplingQuality(settingResamplingQuality);
const int settingResamplingQuality = settings.getInt(SETTING_RESAMPLING_QUALITY);
const ResamplingQuality resamplingQuality =
normalizeResamplingQuality(settingResamplingQuality);
if (static_cast<int>(resamplingQuality) != settingResamplingQuality)
settings.setValue(SETTING_RESAMPLING_QUALITY, static_cast<int>(DEFAULT_RESAMPLING_QUALITY));
int settingVolume = settings.getInt(SETTING_VOLUME);
const int settingVolume = settings.getInt(SETTING_VOLUME);
if (settingVolume < 0 || settingVolume > 100) settings.setValue(SETTING_VOLUME, DEFAULT_VOLUME);
}

View File

@ -309,7 +309,7 @@ bool FBBackendSDL2::setVideoMode(const VideoModeHandler::Mode& mode,
mode.screenS.w, mode.screenS.h, flags);
if(myWindow == nullptr)
{
string msg = "ERROR: Unable to open SDL window: " + string(SDL_GetError());
const string msg = "ERROR: Unable to open SDL window: " + string(SDL_GetError());
Logger::error(msg);
return false;
}
@ -438,7 +438,7 @@ bool FBBackendSDL2::createRenderer()
if(myRenderer == nullptr)
{
string msg = "ERROR: Unable to create SDL renderer: " + string(SDL_GetError());
const string msg = "ERROR: Unable to create SDL renderer: " + string(SDL_GetError());
Logger::error(msg);
return false;
}

View File

@ -131,7 +131,7 @@ uInt32 HighScoresManager::numVariations(const json& jprops)
bool HighScoresManager::get(const Properties& props, uInt32& numVariationsR,
ScoresProps& info) const
{
json jprops = properties(props);
const json jprops = properties(props);
numVariationsR = numVariations(jprops);
@ -313,7 +313,7 @@ Int32 HighScoresManager::variation(uInt16 addr, bool varBCD, bool zeroBased,
Int32 HighScoresManager::variation() const
{
json jprops;
uInt16 addr = varAddress(properties(jprops));
const uInt16 addr = varAddress(properties(jprops));
if(addr == DEFAULT_ADDRESS) {
if(numVariations() == 1)
@ -361,7 +361,7 @@ Int32 HighScoresManager::score(uInt32 numAddrBytes, uInt32 trailingZeroes,
Int32 HighScoresManager::score() const
{
json jprops;
uInt32 numBytes = numAddrBytes(properties(jprops));
const uInt32 numBytes = numAddrBytes(properties(jprops));
const ScoreAddresses scoreAddr = getPropScoreAddr(jprops);
if(static_cast<uInt32>(scoreAddr.size()) < numBytes)
@ -432,7 +432,7 @@ Int32 HighScoresManager::special() const
return NO_VALUE;
json jprops;
uInt16 addr = specialAddress(properties(jprops));
const uInt16 addr = specialAddress(properties(jprops));
if (addr == DEFAULT_ADDRESS)
return NO_VALUE;

View File

@ -36,7 +36,7 @@ JPGLibrary::JPGLibrary(OSystem& osystem)
void JPGLibrary::loadImage(const string& filename, FBSurface& surface,
VariantList& metaData)
{
const auto loadImageERROR = [&](const char* s) {
const auto loadImageERROR = [](const char* s) {
if(s)
throw runtime_error(s);
};

View File

@ -248,11 +248,21 @@ int JoyMap::loadMapping(const json& eventMappings, const EventMode mode)
int i = 0;
for(const json& eventMapping : eventMappings) {
int button = eventMapping.contains("button") ? eventMapping.at("button").get<int>() : JOY_CTRL_NONE;
JoyAxis axis = eventMapping.contains("axis") ? eventMapping.at("axis").get<JoyAxis>() : JoyAxis::NONE;
JoyDir axisDirection = eventMapping.contains("axis") ? eventMapping.at("axisDirection").get<JoyDir>() : JoyDir::NONE;
int hat = eventMapping.contains("hat") ? eventMapping.at("hat").get<int>() : -1;
JoyHatDir hatDirection = eventMapping.contains("hat") ? eventMapping.at("hatDirection").get<JoyHatDir>() : JoyHatDir::CENTER;
const int button = eventMapping.contains("button")
? eventMapping.at("button").get<int>()
: JOY_CTRL_NONE;
const JoyAxis axis = eventMapping.contains("axis")
? eventMapping.at("axis").get<JoyAxis>()
: JoyAxis::NONE;
const JoyDir axisDirection = eventMapping.contains("axis")
? eventMapping.at("axisDirection").get<JoyDir>()
: JoyDir::NONE;
const int hat = eventMapping.contains("hat")
? eventMapping.at("hat").get<int>()
: -1;
const JoyHatDir hatDirection = eventMapping.contains("hat")
? eventMapping.at("hatDirection").get<JoyHatDir>()
: JoyHatDir::CENTER;
try {
// avoid blocking mappings for NoType events

View File

@ -29,7 +29,7 @@ namespace {
json serializedMask = json::array();
for(StellaMod mod: {
for(const StellaMod mod: {
StellaMod::KBDM_CTRL,
StellaMod::KBDM_SHIFT,
StellaMod::KBDM_ALT,
@ -207,15 +207,16 @@ 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(const Event::Type event,
const EventMode mode) const
{
MappingArray map;
MappingArray ma;
for (const auto& [_mapping, _event]: myMap)
if (_event == event && _mapping.mode == mode)
map.push_back(_mapping);
ma.push_back(_mapping);
return map;
return ma;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -51,7 +51,7 @@ void Logger::debug(const string& message)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Logger::logMessage(const string& message, Level level)
{
std::lock_guard<std::mutex> lock(mutex);
const std::lock_guard<std::mutex> lock(mutex);
if(level == Logger::Level::ERR)
{

View File

@ -169,8 +169,8 @@ void MouseControl::addLeftControllerModes(bool noswap)
{
ostringstream msg;
msg << "Mouse is left " << myLeftController.name() << " controller";
Controller::Type type = myLeftController.type();
int id = noswap ? 0 : 1;
const Controller::Type type = myLeftController.type();
const int id = noswap ? 0 : 1;
myModeList.emplace_back(type, id, type, id, msg.str());
}
}
@ -190,8 +190,8 @@ void MouseControl::addRightControllerModes(bool noswap)
{
ostringstream msg;
msg << "Mouse is right " << myRightController.name() << " controller";
Controller::Type type = myRightController.type();
int id = noswap ? 1 : 0;
const Controller::Type type = myRightController.type();
const int id = noswap ? 1 : 0;
myModeList.emplace_back(type, id, type, id, msg.str());
}
}

View File

@ -190,7 +190,7 @@ bool PhysicalJoystickHandler::remove(int id)
// So we use the 'active' joystick list to access them
try
{
PhysicalJoystickPtr stick = mySticks.at(id);
const PhysicalJoystickPtr stick = mySticks.at(id);
const auto it = myDatabase.find(stick->name);
if(it != myDatabase.end() && it->second.joy == stick)
@ -607,7 +607,7 @@ void PhysicalJoystickHandler::enableMapping(const Event::Type event, EventMode m
{
const PhysicalJoystickPtr j = stick.second;
JoyMap::JoyMappingArray joyMappings = j->joyMap.getEventMapping(event, mode);
const JoyMap::JoyMappingArray joyMappings = j->joyMap.getEventMapping(event, mode);
for (const auto& mapping : joyMappings)
j->joyMap.add(event, EventMode::kEmulationMode, mapping.button,
@ -713,7 +713,7 @@ void PhysicalJoystickHandler::saveMapping()
for(const auto& [_name, _info]: myDatabase)
{
json map = _info.joy ? _info.joy->getMap() : _info.mapping;
const json map = _info.joy ? _info.joy->getMap() : _info.mapping;
if (!map.is_null()) mapping.emplace_back(map);
}
@ -1042,8 +1042,9 @@ ostream& operator<<(ostream& os, const PhysicalJoystickHandler& jh)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::changeDigitalDeadZone(int direction)
{
int deadZone = BSPF::clamp(myOSystem.settings().getInt("joydeadzone") + direction,
Controller::MIN_DIGITAL_DEADZONE, Controller::MAX_DIGITAL_DEADZONE);
const int deadZone =
BSPF::clamp(myOSystem.settings().getInt("joydeadzone") + direction,
Controller::MIN_DIGITAL_DEADZONE, Controller::MAX_DIGITAL_DEADZONE);
myOSystem.settings().setValue("joydeadzone", deadZone);
Controller::setDigitalDeadZone(deadZone);
@ -1051,15 +1052,17 @@ void PhysicalJoystickHandler::changeDigitalDeadZone(int direction)
ostringstream ss;
ss << std::round(Controller::digitalDeadZoneValue(deadZone) * 100.F / 32768) << "%";
myOSystem.frameBuffer().showGaugeMessage("Digital controller dead zone", ss. str(), deadZone,
Controller::MIN_DIGITAL_DEADZONE, Controller::MAX_DIGITAL_DEADZONE);
myOSystem.frameBuffer().showGaugeMessage(
"Digital controller dead zone", ss. str(), deadZone,
Controller::MIN_DIGITAL_DEADZONE, Controller::MAX_DIGITAL_DEADZONE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::changeAnalogPaddleDeadZone(int direction)
{
int deadZone = BSPF::clamp(myOSystem.settings().getInt("adeadzone") + direction,
Controller::MIN_ANALOG_DEADZONE, Controller::MAX_ANALOG_DEADZONE);
const int deadZone =
BSPF::clamp(myOSystem.settings().getInt("adeadzone") + direction,
Controller::MIN_ANALOG_DEADZONE, Controller::MAX_ANALOG_DEADZONE);
myOSystem.settings().setValue("adeadzone", deadZone);
Controller::setAnalogDeadZone(deadZone);
@ -1067,15 +1070,17 @@ void PhysicalJoystickHandler::changeAnalogPaddleDeadZone(int direction)
ostringstream ss;
ss << std::round(Controller::analogDeadZoneValue(deadZone) * 100.F / 32768) << "%";
myOSystem.frameBuffer().showGaugeMessage("Analog controller dead zone", ss.str(), deadZone,
Controller::MIN_ANALOG_DEADZONE, Controller::MAX_ANALOG_DEADZONE);
myOSystem.frameBuffer().showGaugeMessage(
"Analog controller dead zone", ss.str(), deadZone,
Controller::MIN_ANALOG_DEADZONE, Controller::MAX_ANALOG_DEADZONE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::changeAnalogPaddleSensitivity(int direction)
{
int sense = BSPF::clamp(myOSystem.settings().getInt("psense") + direction,
Paddles::MIN_ANALOG_SENSE, Paddles::MAX_ANALOG_SENSE);
const int sense =
BSPF::clamp(myOSystem.settings().getInt("psense") + direction,
Paddles::MIN_ANALOG_SENSE, Paddles::MAX_ANALOG_SENSE);
myOSystem.settings().setValue("psense", sense);
Paddles::setAnalogSensitivity(sense);
@ -1083,15 +1088,17 @@ void PhysicalJoystickHandler::changeAnalogPaddleSensitivity(int direction)
ostringstream ss;
ss << std::round(Paddles::analogSensitivityValue(sense) * 100.F) << "%";
myOSystem.frameBuffer().showGaugeMessage("Analog paddle sensitivity", ss.str(), sense,
Paddles::MIN_ANALOG_SENSE, Paddles::MAX_ANALOG_SENSE);
myOSystem.frameBuffer().showGaugeMessage(
"Analog paddle sensitivity", ss.str(), sense,
Paddles::MIN_ANALOG_SENSE, Paddles::MAX_ANALOG_SENSE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::changeAnalogPaddleLinearity(int direction)
{
int linear = BSPF::clamp(myOSystem.settings().getInt("plinear") + direction * 5,
Paddles::MIN_ANALOG_LINEARITY, Paddles::MAX_ANALOG_LINEARITY);
const int linear =
BSPF::clamp(myOSystem.settings().getInt("plinear") + direction * 5,
Paddles::MIN_ANALOG_LINEARITY, Paddles::MAX_ANALOG_LINEARITY);
myOSystem.settings().setValue("plinear", linear);
Paddles::setAnalogLinearity(linear);
@ -1102,15 +1109,17 @@ void PhysicalJoystickHandler::changeAnalogPaddleLinearity(int direction)
else
ss << "Off";
myOSystem.frameBuffer().showGaugeMessage("Analog paddle linearity", ss.str(), linear,
Paddles::MIN_ANALOG_LINEARITY, Paddles::MAX_ANALOG_LINEARITY);
myOSystem.frameBuffer().showGaugeMessage(
"Analog paddle linearity", ss.str(), linear,
Paddles::MIN_ANALOG_LINEARITY, Paddles::MAX_ANALOG_LINEARITY);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::changePaddleDejitterAveraging(int direction)
{
int dejitter = BSPF::clamp(myOSystem.settings().getInt("dejitter.base") + direction,
Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER);
const int dejitter =
BSPF::clamp(myOSystem.settings().getInt("dejitter.base") + direction,
Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER);
myOSystem.settings().setValue("dejitter.base", dejitter);
Paddles::setDejitterBase(dejitter);
@ -1121,16 +1130,17 @@ void PhysicalJoystickHandler::changePaddleDejitterAveraging(int direction)
else
ss << "Off";
myOSystem.frameBuffer().showGaugeMessage("Analog paddle dejitter averaging",
ss.str(), dejitter,
Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER);
myOSystem.frameBuffer().showGaugeMessage(
"Analog paddle dejitter averaging", ss.str(), dejitter,
Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::changePaddleDejitterReaction(int direction)
{
int dejitter = BSPF::clamp(myOSystem.settings().getInt("dejitter.diff") + direction,
Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER);
const int dejitter =
BSPF::clamp(myOSystem.settings().getInt("dejitter.diff") + direction,
Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER);
myOSystem.settings().setValue("dejitter.diff", dejitter);
Paddles::setDejitterDiff(dejitter);
@ -1141,16 +1151,17 @@ void PhysicalJoystickHandler::changePaddleDejitterReaction(int direction)
else
ss << "Off";
myOSystem.frameBuffer().showGaugeMessage("Analog paddle dejitter reaction",
ss.str(), dejitter,
Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER);
myOSystem.frameBuffer().showGaugeMessage(
"Analog paddle dejitter reaction", ss.str(), dejitter,
Paddles::MIN_DEJITTER, Paddles::MAX_DEJITTER);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::changeDigitalPaddleSensitivity(int direction)
{
int sense = BSPF::clamp(myOSystem.settings().getInt("dsense") + direction,
Paddles::MIN_DIGITAL_SENSE, Paddles::MAX_DIGITAL_SENSE);
const int sense =
BSPF::clamp(myOSystem.settings().getInt("dsense") + direction,
Paddles::MIN_DIGITAL_SENSE, Paddles::MAX_DIGITAL_SENSE);
myOSystem.settings().setValue("dsense", sense);
Paddles::setDigitalSensitivity(sense);
@ -1161,16 +1172,17 @@ void PhysicalJoystickHandler::changeDigitalPaddleSensitivity(int direction)
else
ss << "Off";
myOSystem.frameBuffer().showGaugeMessage("Digital sensitivity",
ss.str(), sense,
Paddles::MIN_DIGITAL_SENSE, Paddles::MAX_DIGITAL_SENSE);
myOSystem.frameBuffer().showGaugeMessage(
"Digital sensitivity", ss.str(), sense,
Paddles::MIN_DIGITAL_SENSE, Paddles::MAX_DIGITAL_SENSE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::changeMousePaddleSensitivity(int direction)
{
int sense = BSPF::clamp(myOSystem.settings().getInt("msense") + direction,
Controller::MIN_MOUSE_SENSE, Controller::MAX_MOUSE_SENSE);
const int sense =
BSPF::clamp(myOSystem.settings().getInt("msense") + direction,
Controller::MIN_MOUSE_SENSE, Controller::MAX_MOUSE_SENSE);
myOSystem.settings().setValue("msense", sense);
Controller::setMouseSensitivity(sense);
@ -1178,16 +1190,17 @@ void PhysicalJoystickHandler::changeMousePaddleSensitivity(int direction)
ostringstream ss;
ss << sense * 10 << "%";
myOSystem.frameBuffer().showGaugeMessage("Mouse paddle sensitivity",
ss.str(), sense,
Controller::MIN_MOUSE_SENSE, Controller::MAX_MOUSE_SENSE);
myOSystem.frameBuffer().showGaugeMessage(
"Mouse paddle sensitivity", ss.str(), sense,
Controller::MIN_MOUSE_SENSE, Controller::MAX_MOUSE_SENSE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::changeMouseTrackballSensitivity(int direction)
{
int sense = BSPF::clamp(myOSystem.settings().getInt("tsense") + direction,
PointingDevice::MIN_SENSE, PointingDevice::MAX_SENSE);
const int sense =
BSPF::clamp(myOSystem.settings().getInt("tsense") + direction,
PointingDevice::MIN_SENSE, PointingDevice::MAX_SENSE);
myOSystem.settings().setValue("tsense", sense);
PointingDevice::setSensitivity(sense);
@ -1195,16 +1208,17 @@ void PhysicalJoystickHandler::changeMouseTrackballSensitivity(int direction)
ostringstream ss;
ss << sense * 10 << "%";
myOSystem.frameBuffer().showGaugeMessage("Mouse trackball sensitivity",
ss.str(), sense,
PointingDevice::MIN_SENSE, PointingDevice::MAX_SENSE);
myOSystem.frameBuffer().showGaugeMessage(
"Mouse trackball sensitivity", ss.str(), sense,
PointingDevice::MIN_SENSE, PointingDevice::MAX_SENSE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystickHandler::changeDrivingSensitivity(int direction)
{
int sense = BSPF::clamp(myOSystem.settings().getInt("dcsense") + direction,
Driving::MIN_SENSE, Driving::MAX_SENSE);
const int sense =
BSPF::clamp(myOSystem.settings().getInt("dcsense") + direction,
Driving::MIN_SENSE, Driving::MAX_SENSE);
myOSystem.settings().setValue("dcsense", sense);
Driving::setSensitivity(sense);
@ -1212,9 +1226,9 @@ void PhysicalJoystickHandler::changeDrivingSensitivity(int direction)
ostringstream ss;
ss << sense * 10 << "%";
myOSystem.frameBuffer().showGaugeMessage("Driving controller sensitivity",
ss.str(), sense,
Driving::MIN_SENSE, Driving::MAX_SENSE);
myOSystem.frameBuffer().showGaugeMessage(
"Driving controller sensitivity", ss.str(), sense,
Driving::MIN_SENSE, Driving::MAX_SENSE);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -44,7 +44,7 @@ PhysicalKeyboardHandler::PhysicalKeyboardHandler(OSystem& system, EventHandler&
: myOSystem{system},
myHandler{handler}
{
Int32 version = myOSystem.settings().getInt("event_ver");
const Int32 version = myOSystem.settings().getInt("event_ver");
bool updateDefaults = false;
// Compare if event list version has changed so that key maps became invalid
@ -396,7 +396,7 @@ void PhysicalKeyboardHandler::enableMapping(const Event::Type event,
EventMode mode)
{
// copy from controller mode into emulation mode
KeyMap::MappingArray mappings = myKeyMap.getEventMapping(event, mode);
const KeyMap::MappingArray mappings = myKeyMap.getEventMapping(event, mode);
for (const auto& mapping : mappings)
myKeyMap.add(event, EventMode::kEmulationMode, mapping.key, mapping.mod);

View File

@ -295,9 +295,9 @@ void PNGLibrary::takeSnapshot(uInt32 number)
// Figure out the correct snapshot name
string filename;
string sspath = myOSystem.snapshotSaveDir().getPath() +
(myOSystem.settings().getString("snapname") != "int" ?
myOSystem.romFile().getNameWithExt()
const string sspath = myOSystem.snapshotSaveDir().getPath() +
(myOSystem.settings().getString("snapname") != "int"
? myOSystem.romFile().getNameWithExt("")
: myOSystem.console().properties().get(PropType::Cart_Name));
// Check whether we want multiple snapshots created
@ -313,7 +313,7 @@ void PNGLibrary::takeSnapshot(uInt32 number)
// Determine if the file already exists, checking each successive filename
// until one doesn't exist
filename = sspath + ".png";
FSNode node(filename);
const FSNode node(filename);
if(node.exists())
{
ostringstream buf;
@ -321,7 +321,7 @@ void PNGLibrary::takeSnapshot(uInt32 number)
{
buf.str("");
buf << sspath << "_" << i << ".png";
FSNode next(buf.str());
const FSNode next(buf.str());
if(!next.exists())
break;
}

View File

@ -477,7 +477,6 @@ void PaletteHandler::generateCustomPalette(ConsoleTiming timing) const
float G = Y + dotProduct(IQ[chroma], IQG);
float B = Y + dotProduct(IQ[chroma], IQB);
if(R < 0) R = 0;
if(G < 0) G = 0;
if(B < 0) B = 0;
@ -486,9 +485,9 @@ void PaletteHandler::generateCustomPalette(ConsoleTiming timing) const
G = powf(G, 0.9F);
B = powf(B, 0.9F);
int r = BSPF::clamp(R * 255.F, 0.F, 255.F);
int g = BSPF::clamp(G * 255.F, 0.F, 255.F);
int b = BSPF::clamp(B * 255.F, 0.F, 255.F);
const int r = BSPF::clamp(R * 255.F, 0.F, 255.F),
g = BSPF::clamp(G * 255.F, 0.F, 255.F),
b = BSPF::clamp(B * 255.F, 0.F, 255.F);
ourCustomNTSCPalette[(chroma * NUM_LUMA + luma) << 1] = (r << 16) + (g << 8) + b;
}
@ -504,7 +503,7 @@ void PaletteHandler::generateCustomPalette(ConsoleTiming timing) const
// colors 0, 1, 14 and 15 are grayscale
for(int chroma = 2; chroma < NUM_CHROMA - 2; chroma++)
{
int idx = NUM_CHROMA - 1 - chroma;
const int idx = NUM_CHROMA - 1 - chroma;
UV[idx].x = SATURATION * sinf(offset - fixedShift * chroma);
if ((idx & 1) == 0)
@ -539,9 +538,9 @@ void PaletteHandler::generateCustomPalette(ConsoleTiming timing) const
G = powf(G, 1.2F);
B = powf(B, 1.2F);
int r = BSPF::clamp(R * 255.F, 0.F, 255.F);
int g = BSPF::clamp(G * 255.F, 0.F, 255.F);
int b = BSPF::clamp(B * 255.F, 0.F, 255.F);
const int r = BSPF::clamp(R * 255.F, 0.F, 255.F),
g = BSPF::clamp(G * 255.F, 0.F, 255.F),
b = BSPF::clamp(B * 255.F, 0.F, 255.F);
ourCustomPALPalette[(chroma * NUM_LUMA + luma) << 1] = (r << 16) + (g << 8) + b;
}

View File

@ -245,7 +245,7 @@ string RewindManager::saveAllStates()
const uInt32 curIdx = getCurrentIdx();
rewindStates(MAX_BUF_SIZE);
uInt32 numStates = static_cast<uInt32>(cyclesList().size());
const uInt32 numStates = static_cast<uInt32>(cyclesList().size());
// Save header
buf.str("");
@ -296,7 +296,7 @@ string RewindManager::loadAllStates()
<< ".sta";
// Make sure the file can be opened for reading
Serializer in(buf.str(), Serializer::Mode::ReadOnly);
const Serializer in(buf.str(), Serializer::Mode::ReadOnly);
if (!in)
return "Can't load from all states file";

View File

@ -159,7 +159,7 @@ void SoundSDL2::setEnabled(bool enable)
void SoundSDL2::open(shared_ptr<AudioQueue> audioQueue,
EmulationTiming* emulationTiming)
{
string pre_about = myAboutString;
const string pre_about = myAboutString;
// Do we need to re-open the sound device?
// Only do this when absolutely necessary
@ -344,12 +344,13 @@ void SoundSDL2::processFragment(float* stream, uInt32 length)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SoundSDL2::initResampler()
{
Resampler::NextFragmentCallback nextFragmentCallback = [this] () -> Int16* {
const Resampler::NextFragmentCallback nextFragmentCallback = [this] () -> Int16* {
Int16* nextFragment = nullptr;
if(myUnderrun)
nextFragment = myAudioQueue->size() >= myEmulationTiming->prebufferFragmentCount() ?
myAudioQueue->dequeue(myCurrentFragment) : nullptr;
nextFragment = myAudioQueue->size() >= myEmulationTiming->prebufferFragmentCount()
? myAudioQueue->dequeue(myCurrentFragment)
: nullptr;
else
nextFragment = myAudioQueue->dequeue(myCurrentFragment);
@ -360,10 +361,10 @@ void SoundSDL2::initResampler()
return nextFragment;
};
Resampler::Format formatFrom =
const Resampler::Format formatFrom =
Resampler::Format(myEmulationTiming->audioSampleRate(),
myAudioQueue->fragmentSize(), myAudioQueue->isStereo());
Resampler::Format formatTo =
const Resampler::Format formatTo =
Resampler::Format(myHardwareSpec.freq, myHardwareSpec.samples,
myHardwareSpec.channels > 1);
@ -401,39 +402,44 @@ void SoundSDL2::callback(void* udata, uInt8* stream, int len)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool SoundSDL2::playWav(const string& fileName, uInt32 position, uInt32 length)
bool SoundSDL2::playWav(const string& fileName, const uInt32 position,
const uInt32 length)
{
uInt32 wavLength{0};
// Stop any playing WAVs
stopWav();
// Load WAV file
auto* result = SDL_LoadWAV(fileName.c_str(), &myWavSpec, &myWavBuffer, &wavLength);
if(result == nullptr || position > wavLength)
if(fileName != myWavFilename || myWavBuffer == nullptr)
{
if(myWavBuffer)
{
SDL_FreeWAV(myWavBuffer);
myWavBuffer = nullptr;
}
if(SDL_LoadWAV(fileName.c_str(), &myWavSpec, &myWavBuffer, &myWavLength) == nullptr)
return false;
// Set the callback function
myWavSpec.callback = wavCallback;
myWavSpec.userdata = nullptr;
}
if(position > myWavLength)
return false;
length = length
? std::min(length, wavLength - position)
: wavLength;
// Set the callback function
myWavSpec.callback = wavCallback;
myWavSpec.userdata = nullptr;
myWavFilename = fileName;
myWavLen = length
? std::min(length, myWavLength - position)
: myWavLength;
myWavPos = myWavBuffer + position;
myWavLen = length;
// Open audio device
const char* device = myDeviceId ? myDevices.at(myDeviceId).first.c_str() : nullptr;
myWavDevice = SDL_OpenAudioDevice(device, 0, &myWavSpec, nullptr, 0);
if(!myWavDevice)
return false;
// Play audio
SDL_PauseAudioDevice(myWavDevice, 0);
{
const char* device = myDeviceId ? myDevices.at(myDeviceId).first.c_str() : nullptr;
myWavDevice = SDL_OpenAudioDevice(device, 0, &myWavSpec, nullptr, 0);
if(!myWavDevice)
return false;
// Play audio
SDL_PauseAudioDevice(myWavDevice, 0);
}
return true;
}
@ -443,9 +449,10 @@ void SoundSDL2::stopWav()
if(myWavBuffer)
{
// Clean up
myWavLen = 0;
SDL_CloseAudioDevice(myWavDevice);
myWavDevice = 0;
SDL_FreeWAV(myWavBuffer);
myWavBuffer = nullptr;
}
}

View File

@ -116,8 +116,8 @@ class SoundSDL2 : public Sound
@return True, if the WAV file can be played
*/
bool playWav(const string& fileName, uInt32 position = 0,
uInt32 length = 0) override;
bool playWav(const string& fileName, const uInt32 position = 0,
const uInt32 length = 0) override;
/**
Stop any currently playing WAV file.
@ -186,6 +186,8 @@ class SoundSDL2 : public Sound
AudioSettings& myAudioSettings;
// WAV file sound variables
string myWavFilename{EmptyString};
uInt32 myWavLength{0};
SDL_AudioDeviceID myWavDevice{0};
uInt8* myWavBuffer{nullptr};

View File

@ -25,7 +25,7 @@ using namespace std::chrono;
namespace {
string currentTimestamp()
{
std::tm now = BSPF::localTime();
const std::tm now = BSPF::localTime();
std::array<char, 100> formattedTime;
formattedTime.fill(0);
@ -57,7 +57,7 @@ StaggeredLogger::~StaggeredLogger()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StaggeredLogger::log()
{
std::lock_guard<std::mutex> lock(myMutex);
const std::lock_guard<std::mutex> lock(myMutex);
_log();
}
@ -132,7 +132,7 @@ void StaggeredLogger::startInterval()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StaggeredLogger::onTimerExpired(uInt32 timerCallbackId)
{
std::lock_guard<std::mutex> lock(myMutex);
const std::lock_guard<std::mutex> lock(myMutex);
if (timerCallbackId != myTimerCallbackId) return;

View File

@ -313,7 +313,7 @@ void StateManager::changeState(int direction)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StateManager::toggleAutoSlot()
{
bool autoSlot = !myOSystem.settings().getBool("autoslot");
const bool autoSlot = !myOSystem.settings().getBool("autoslot");
// Print appropriate message
ostringstream buf;

View File

@ -98,14 +98,14 @@ void TimerManager::clear()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
std::size_t TimerManager::size() const noexcept
{
ScopedLock lock(sync);
const ScopedLock lock(sync);
return active.size();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool TimerManager::empty() const noexcept
{
ScopedLock lock(sync);
const ScopedLock lock(sync);
return active.empty();
}

View File

@ -284,7 +284,7 @@ void ZipHandler::ZipFile::readEcd()
buflen = myLength;
// Allocate buffer
ByteBuffer buffer = make_unique<uInt8[]>(buflen + 1);
const ByteBuffer buffer = make_unique<uInt8[]>(buflen + 1);
if(buffer == nullptr)
throw runtime_error(errorMessage(ZipError::OUT_OF_MEMORY));

View File

@ -259,7 +259,7 @@ int main(int ac, char* av[])
// Check to see if the user requested info about a specific ROM,
// or the list of internal ROMs
// If so, show the information and immediately exit
string romfile = localOpts["ROMFILE"].toString();
const string romfile = localOpts["ROMFILE"].toString();
if(localOpts["listrominfo"].toBool())
{
attachConsole();
@ -272,7 +272,7 @@ int main(int ac, char* av[])
{
attachConsole();
Logger::debug("Showing output from 'rominfo' ...");
FSNode romnode(romfile);
const FSNode romnode(romfile);
Logger::error(theOSystem->getROMInfo(romnode));
freeConsole();
return Cleanup();
@ -293,11 +293,11 @@ int main(int ac, char* av[])
// open the rom launcher in that directory.
// If not, use the built-in ROM launcher. In this case, we enter 'launcher'
// mode and let the main event loop take care of opening a new console/ROM.
FSNode romnode(romfile);
const FSNode romnode(romfile);
if(romfile.empty() || romnode.isDirectory())
{
Logger::debug("Attempting to use ROM launcher ...");
bool launcherOpened = !romfile.empty() ?
const bool launcherOpened = !romfile.empty() ?
theOSystem->createLauncher(romnode.getPath()) : theOSystem->createLauncher();
if(!launcherOpened)
{
@ -336,7 +336,7 @@ int main(int ac, char* av[])
if(!localOpts["break"].toString().empty())
{
Debugger& dbg = theOSystem->debugger();
uInt16 bp = uInt16(dbg.stringToValue(localOpts["break"].toString()));
const uInt16 bp = uInt16(dbg.stringToValue(localOpts["break"].toString()));
dbg.setBreakPoint(bp);
}
#endif

View File

@ -23,7 +23,7 @@ using nlohmann::json;
namespace {
json jsonIfValid(const string& s) {
json parsed = json::parse(s, nullptr, false);
const json parsed = json::parse(s, nullptr, false);
return parsed.is_discarded() ? json(s) : parsed;
}

View File

@ -60,7 +60,7 @@ void SqliteDatabase::initialize()
if (!dbInitialized) {
if (myHandle) {
string emsg = sqlite3_errmsg(myHandle);
const string emsg = sqlite3_errmsg(myHandle);
sqlite3_close_v2(myHandle);
myHandle = nullptr;

View File

@ -68,7 +68,7 @@ void BilinearBlitter::free()
ASSERT_MAIN_THREAD;
std::array<SDL_Texture*, 2> textures = { myTexture, mySecondaryTexture };
const std::array<SDL_Texture*, 2> textures = { myTexture, mySecondaryTexture };
for (SDL_Texture* texture: textures) {
if (!texture) continue;
@ -128,7 +128,7 @@ void BilinearBlitter::recreateTexturesIfNecessary()
if (myAttributes.blending) {
const auto blendAlpha = static_cast<uInt8>(myAttributes.blendalpha * 2.55);
std::array<SDL_Texture*, 2> textures = { myTexture, mySecondaryTexture };
const std::array<SDL_Texture*, 2> textures = { myTexture, mySecondaryTexture };
for (SDL_Texture* texture: textures) {
if (!texture) continue;

View File

@ -75,7 +75,7 @@ void QisBlitter::free()
ASSERT_MAIN_THREAD;
std::array<SDL_Texture*, 3> textures = {
const std::array<SDL_Texture*, 3> textures = {
mySrcTexture, myIntermediateTexture, mySecondaryIntermedateTexture
};
for (SDL_Texture* texture: textures) {
@ -183,7 +183,7 @@ void QisBlitter::recreateTexturesIfNecessary()
if (myAttributes.blending) {
const auto blendAlpha = static_cast<uInt8>(myAttributes.blendalpha * 2.55);
std::array<SDL_Texture*, 3> textures = {
const std::array<SDL_Texture*, 3> textures = {
mySrcTexture, myIntermediateTexture, mySecondaryIntermedateTexture
};
for (SDL_Texture* texture: textures) {

View File

@ -343,12 +343,10 @@ void AtariNTSC::init(init_t& impl, const Setup& setup)
int n2 = 3;
do
{
float i = *in++;
float q = *in++;
*out++ = i;
*out++ = q;
*out++ = *in++;
*out++ = *in++;
}
while ( --n2 );
while (--n2);
#if 0 // burst_count is always 0
if ( burst_count > 1 )
ROTATE_IQ( s, c, 0.866025F, -0.5F ); /* +120 degrees */
@ -387,7 +385,7 @@ void AtariNTSC::initFilters(init_t& impl, const Setup& setup)
pow_a_n * cosf( maxh * angle ) +
pow_a_n * rolloff * cosf( (maxh - 1) * angle );
const float den = 1 - rolloff_cos_a - rolloff_cos_a + rolloff * rolloff;
float dsf = num / den;
const float dsf = num / den;
kernels [kernel_size * 3 / 2 - kernel_half + i] = dsf - 0.5F;
}
}
@ -397,7 +395,7 @@ void AtariNTSC::initFilters(init_t& impl, const Setup& setup)
for ( int i = 0; i < kernel_half * 2 + 1; i++ )
{
const float x = BSPF::PI_f * 2 / (kernel_half * 2) * i;
float blackman = 0.42F - 0.5F * cosf( x ) + 0.08F * cosf( x * 2 );
const float blackman = 0.42F - 0.5F * cosf( x ) + 0.08F * cosf( x * 2 );
sum += (kernels [kernel_size * 3 / 2 - kernel_half + i] *= blackman);
}
@ -454,12 +452,12 @@ void AtariNTSC::initFilters(init_t& impl, const Setup& setup)
for ( int i = 0; i < kernel_size * 2; i++ )
{
const float cur = kernels [i];
float m = cur * weight;
const float m = cur * weight;
*out++ = m + remain;
remain = cur - m;
}
}
while ( --n );
while (--n);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -101,7 +101,7 @@ bool BreakpointMap::check(const uInt16 addr, const uInt8 bank) const
BreakpointMap::BreakpointList BreakpointMap::getBreakpoints() const
{
BreakpointList map;
std::map<Breakpoint, uInt32> ordered(myMap.begin(), myMap.end());
const std::map<Breakpoint, uInt32> ordered(myMap.begin(), myMap.end());
for(const auto& item : ordered)
map.push_back(item.first);

View File

@ -386,8 +386,8 @@ bool CartDebug::fillDisassemblyList(BankInfo& info, Disassembly& disassembly,
disassembly.fieldwidth = 24 + myLabelLength;
// line offset must be set before calling DiStella!
auto lineOfs = static_cast<uInt32>(myDisassembly.list.size());
DiStella distella(*this, disassembly.list, info, DiStella::settings,
myDisLabels, myDisDirectives, myReserved);
const DiStella distella(*this, disassembly.list, info, DiStella::settings,
myDisLabels, myDisDirectives, myReserved);
// Parts of the disassembly will be accessed later in different ways
// We place those parts in separate maps, to speed up access
@ -812,7 +812,7 @@ string CartDebug::loadListFile()
// The default naming/location for list files is the ROM dir based on the
// actual ROM filename
FSNode lst(myOSystem.romFile().getPathWithExt(".lst"));
const FSNode lst(myOSystem.romFile().getPathWithExt(".lst"));
if(!lst.isReadable())
return DebuggerParser::red("list file \'" + lst.getShortPath() + "\' not found");
@ -873,7 +873,7 @@ string CartDebug::loadSymbolFile()
// The default naming/location for symbol files is the ROM dir based on the
// actual ROM filename
FSNode sym(myOSystem.romFile().getPathWithExt(".sym"));
const FSNode sym(myOSystem.romFile().getPathWithExt(".sym"));
if(!sym.isReadable())
return DebuggerParser::red("symbol file \'" + sym.getShortPath() + "\' not found");
@ -934,7 +934,7 @@ string CartDebug::loadConfigFile()
// The default naming/location for config files is the CFG dir and based
// on the actual ROM filename
FSNode romNode(myOSystem.romFile().getPathWithExt(".cfg"));
const FSNode romNode(myOSystem.romFile().getPathWithExt(".cfg"));
FSNode cfg = myOSystem.cfgDir(); cfg /= romNode.getName();
if(!cfg.isReadable())
return DebuggerParser::red("config file \'" + cfg.getShortPath() + "\' not found");
@ -1073,7 +1073,7 @@ string CartDebug::saveConfigFile()
stringstream retVal;
try
{
FSNode romNode(myOSystem.romFile().getPathWithExt(".cfg"));
const FSNode romNode(myOSystem.romFile().getPathWithExt(".cfg"));
FSNode cfg = myOSystem.cfgDir(); cfg /= romNode.getName();
if(!cfg.getParent().isWritable())
return DebuggerParser::red("config file \'" + cfg.getShortPath() + "\' not writable");
@ -1145,8 +1145,8 @@ string CartDebug::saveDisassembly(string path)
// Disassemble bank
disasm.list.clear();
DiStella distella(*this, disasm.list, info, settings,
myDisLabels, myDisDirectives, myReserved);
const DiStella distella(*this, disasm.list, info, settings,
myDisLabels, myDisDirectives, myReserved);
if (myReserved.breakFound)
addLabel("Break", myDebugger.dpeek(0xfffe));
@ -1258,7 +1258,7 @@ string CartDebug::saveDisassembly(string path)
if(myConsole.timing() == ConsoleTiming::ntsc)
{
string NTSC_COLOR[16] = {
const string NTSC_COLOR[16] = {
"BLACK", "YELLOW", "BROWN", "ORANGE",
"RED", "MAUVE", "VIOLET", "PURPLE",
"BLUE", "BLUE_CYAN", "CYAN", "CYAN_GREEN",
@ -1270,7 +1270,7 @@ string CartDebug::saveDisassembly(string path)
}
else if(myConsole.timing() == ConsoleTiming::pal)
{
string PAL_COLOR[16] = {
const string PAL_COLOR[16] = {
"BLACK0", "BLACK1", "YELLOW", "GREEN_YELLOW",
"ORANGE", "GREEN", "RED", "CYAN_GREEN",
"MAUVE", "CYAN", "VIOLET", "BLUE_CYAN",
@ -1282,7 +1282,7 @@ string CartDebug::saveDisassembly(string path)
}
else
{
string SECAM_COLOR[8] = {
const string SECAM_COLOR[8] = {
"BLACK", "BLUE", "RED", "PURPLE",
"GREEN", "CYAN", "YELLOW", "WHITE"
};
@ -1410,7 +1410,7 @@ string CartDebug::saveDisassembly(string path)
if(path.find_last_of('.') == string::npos)
path += ".asm";
FSNode node(path);
const FSNode node(path);
stringstream retVal;
try
{
@ -1438,7 +1438,7 @@ string CartDebug::saveRom(string path)
if(path.find_last_of('.') == string::npos)
path += ".a26";
FSNode node(path);
const FSNode node(path);
if(myConsole.cartridge().saveROM(node))
return "saved ROM as " + node.getShortPath();
@ -1464,7 +1464,7 @@ string CartDebug::saveAccessFile(string path)
if(path.find_last_of('.') == string::npos)
path += ".csv";
FSNode node(path);
const FSNode node(path);
node.write(out);
return "saved access counters as " + node.getShortPath();
@ -1489,7 +1489,7 @@ string CartDebug::listConfig(int bank)
buf << "(items marked '*' are user-defined)" << endl;
for(uInt32 b = startbank; b < endbank; ++b)
{
BankInfo& info = myBankInfo[b];
const BankInfo& info = myBankInfo[b];
buf << "Bank [" << b << "]" << endl;
for(const auto& i: info.directiveList)
{

View File

@ -112,7 +112,7 @@ void Debugger::initialize()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FBInitStatus Debugger::initializeVideo()
{
string title = string("Stella ") + STELLA_VERSION + ": Debugger mode";
const string title = string("Stella ") + STELLA_VERSION + ": Debugger mode";
return myOSystem.frameBuffer().createDisplay(
title, BufferType::Debugger, mySize
);
@ -177,13 +177,13 @@ string Debugger::autoExec(StringList* history)
ostringstream buf;
// autoexec.script is always run
FSNode autoexec(myOSystem.baseDir().getPath() + "autoexec.script");
const FSNode autoexec(myOSystem.baseDir().getPath() + "autoexec.script");
buf << "autoExec():" << endl
<< myParser->exec(autoexec, history) << endl;
// Also, "romname.script" if present
const string path = myOSystem.userDir().getPath() + myOSystem.romFile().getNameWithExt(".script");
FSNode romname(path);
const FSNode romname(path);
buf << myParser->exec(romname, history) << endl;
// Init builtins

View File

@ -165,7 +165,7 @@ string DebuggerParser::exec(const FSNode& file, StringList* history)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerParser::outputCommandError(const string& errorMsg, int command)
{
string example = commands[command].extendedDesc.substr(commands[command].extendedDesc.find("Example:"));
const string example = commands[command].extendedDesc.substr(commands[command].extendedDesc.find("Example:"));
commandResult << red(errorMsg);
if(!example.empty())
@ -614,8 +614,8 @@ void DebuggerParser::listTraps(bool listCond)
string DebuggerParser::trapStatus(const Trap& trap)
{
stringstream result;
string lblb = debugger.cartDebug().getLabel(trap.begin, !trap.write);
string lble = debugger.cartDebug().getLabel(trap.end, !trap.write);
const string lblb = debugger.cartDebug().getLabel(trap.begin, !trap.write);
const string lble = debugger.cartDebug().getLabel(trap.end, !trap.write);
if(!lblb.empty()) {
result << " (";
@ -643,7 +643,7 @@ string DebuggerParser::trapStatus(const Trap& trap)
string DebuggerParser::saveScriptFile(string file)
{
stringstream out;
Debugger::FunctionDefMap funcs = debugger.getFunctionDefMap();
const Debugger::FunctionDefMap funcs = debugger.getFunctionDefMap();
for(const auto& [name, cmd]: funcs)
if (!Debugger::isBuiltinFunction(name))
out << "function " << name << " {" << cmd << "}" << endl;
@ -691,7 +691,7 @@ string DebuggerParser::saveScriptFile(string file)
if(file.find_first_of(FSNode::PATH_SEPARATOR) == string::npos)
file = debugger.myOSystem.userDir().getPath() + file;
FSNode node(file);
const FSNode node(file);
if(node.exists() || out.str().length())
{
@ -770,7 +770,7 @@ void DebuggerParser::executeAud()
// "autoSave"
void DebuggerParser::executeAutoSave()
{
bool enable = !settings.getBool("dbg.autosave");
const bool enable = !settings.getBool("dbg.autosave");
settings.setValue("dbg.autosave", enable);
commandResult << "autoSave " << (enable ? "enabled" : "disabled");
@ -871,10 +871,10 @@ void DebuggerParser::executeBreak()
// "breakIf"
void DebuggerParser::executeBreakIf()
{
int res = YaccParser::parse(argStrings[0]);
const int res = YaccParser::parse(argStrings[0]);
if(res == 0)
{
string condition = argStrings[0];
const string condition = argStrings[0];
for(uInt32 i = 0; i < debugger.m6502().getCondBreakNames().size(); ++i)
{
if(condition == debugger.m6502().getCondBreakNames()[i])
@ -1276,7 +1276,7 @@ void DebuggerParser::executeDump()
{
if(OK)
{
stringstream localOut(outStr);
const stringstream localOut(outStr);
ostringstream localResult(resultStr, std::ios_base::app);
saveDump(node, localOut, localResult);
@ -1350,7 +1350,7 @@ void DebuggerParser::executeFunction()
return;
}
int res = YaccParser::parse(argStrings[1]);
const int res = YaccParser::parse(argStrings[1]);
if(res == 0)
{
debugger.addFunction(argStrings[0], argStrings[1], YaccParser::getResult());
@ -1608,8 +1608,6 @@ void DebuggerParser::executeListFunctions()
// "listSaveStateIfs"
void DebuggerParser::executeListSaveStateIfs()
{
ostringstream buf;
StringList conds = debugger.m6502().getCondSaveStateNames();
if(!conds.empty())
{
@ -1629,7 +1627,7 @@ void DebuggerParser::executeListSaveStateIfs()
// "listTraps"
void DebuggerParser::executeListTraps()
{
StringList names = debugger.m6502().getCondTrapNames();
const StringList names = debugger.m6502().getCondTrapNames();
if(myTraps.size() != names.size())
{
@ -2085,10 +2083,10 @@ void DebuggerParser::executeSaveState()
// "saveStateIf"
void DebuggerParser::executeSaveStateIf()
{
int res = YaccParser::parse(argStrings[0]);
const int res = YaccParser::parse(argStrings[0]);
if(res == 0)
{
string condition = argStrings[0];
const string condition = argStrings[0];
for(uInt32 i = 0; i < debugger.m6502().getCondSaveStateNames().size(); ++i)
{
if(condition == debugger.m6502().getCondSaveStateNames()[i])
@ -2128,7 +2126,7 @@ void DebuggerParser::executeStep()
// "stepWhile"
void DebuggerParser::executeStepWhile()
{
int res = YaccParser::parse(argStrings[0]);
const int res = YaccParser::parse(argStrings[0]);
if(res != 0) {
commandResult << red("invalid expression");
return;
@ -2225,9 +2223,9 @@ void DebuggerParser::executeTrapWriteIf()
void DebuggerParser::executeTraps(bool read, bool write, const string& command,
bool hasCond)
{
const uInt32 ofs = hasCond ? 1 : 0;
uInt32 begin = args[ofs];
uInt32 end = argCount == 2 + ofs ? args[1 + ofs] : begin;
const uInt32 ofs = hasCond ? 1 : 0,
begin = args[ofs],
end = argCount == 2 + ofs ? args[1 + ofs] : begin;
if(argCount < 1 + ofs)
{
@ -2284,7 +2282,7 @@ void DebuggerParser::executeTraps(bool read, bool write, const string& command,
const string condition = conditionBuf.str();
int res = YaccParser::parse(condition);
const int res = YaccParser::parse(condition);
if(res == 0)
{
// duplicates will remove each other
@ -2309,7 +2307,7 @@ void DebuggerParser::executeTraps(bool read, bool write, const string& command,
}
if(add)
{
uInt32 ret = debugger.m6502().addCondTrap(
const uInt32 ret = debugger.m6502().addCondTrap(
YaccParser::getResult(), hasCond ? argStrings[0] : "");
commandResult << "added trap " << Base::toString(ret);
@ -2466,7 +2464,7 @@ void DebuggerParser::executeWatch()
void DebuggerParser::executeWinds(bool unwind)
{
const uInt16 states = (argCount == 0) ? 1 : args[0];
string type = unwind ? "unwind" : "rewind";
const string type = unwind ? "unwind" : "rewind";
string message;
const uInt16 winds = unwind ? debugger.unwindStates(states, message)

View File

@ -1139,19 +1139,19 @@ void DiStella::outputGraphics()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DiStella::outputColors()
{
string NTSC_COLOR[16] = {
const string NTSC_COLOR[16] = {
"BLACK", "YELLOW", "BROWN", "ORANGE",
"RED", "MAUVE", "VIOLET", "PURPLE",
"BLUE", "BLUE_CYAN", "CYAN", "CYAN_GREEN",
"GREEN", "GREEN_YELLOW", "GREEN_BEIGE", "BEIGE"
};
string PAL_COLOR[16] = {
const string PAL_COLOR[16] = {
"BLACK0", "BLACK1", "YELLOW", "GREEN_YELLOW",
"ORANGE", "GREEN", "RED", "CYAN_GREEN",
"MAUVE", "CYAN", "VIOLET", "BLUE_CYAN",
"PURPLE", "BLUE", "BLACKE", "BLACKF"
};
string SECAM_COLOR[8] = {
const string SECAM_COLOR[8] = {
"BLACK", "BLUE", "RED", "PURPLE",
"GREEN", "CYAN", "YELLOW", "WHITE"
};

View File

@ -26,7 +26,7 @@ Cartridge4A50Widget::Cartridge4A50Widget(
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
myCart{cart}
{
string info =
const string info =
"4A50 cartridge - 128K ROM and 32K RAM, split in various bank configurations\n"
"Multiple hotspots, see documentation for further details\n"
"Lower bank region (2K) : $F000 - $F7FF\n"
@ -55,9 +55,9 @@ Cartridge4A50Widget::Cartridge4A50Widget(
VarList::push_back(items256, i);
VarList::push_back(items256, "Inactive", "");
string lowerlabel = "Set lower 2K region ($F000 - $F7FF): ";
string middlelabel = "Set middle 1.5K region ($F800 - $FDFF): ";
string highlabel = "Set high 256B region ($FE00 - $FEFF): ";
const string lowerlabel = "Set lower 2K region ($F000 - $F7FF): ";
const string middlelabel = "Set middle 1.5K region ($F800 - $FDFF): ";
const string highlabel = "Set high 256B region ($FE00 - $FEFF): ";
const int lwidth = _font.getStringWidth(middlelabel),
fwidth = _font.getStringWidth("Inactive"),
flwidth = _font.getStringWidth("ROM ");

View File

@ -141,7 +141,7 @@ void CartridgeARMWidget::saveOldState()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeARMWidget::loadConfig()
{
bool devSettings = instance().settings().getBool("dev.settings");
const bool devSettings = instance().settings().getBool("dev.settings");
IntArray alist;
IntArray vlist;
BoolArray changed;
@ -218,16 +218,18 @@ void CartridgeARMWidget::handleCommand(CommandSender* sender,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeARMWidget::handleChipType()
{
bool devSettings = instance().settings().getBool("dev.settings");
const bool devSettings = instance().settings().getBool("dev.settings");
myChipType->setEnabled(devSettings);
if(devSettings)
{
instance().settings().setValue("dev.thumb.chiptype", myChipType->getSelectedTag().toInt());
instance().settings().setValue("dev.thumb.chiptype",
myChipType->getSelectedTag().toInt());
Thumbulator::ChipPropsType chipProps
= myCart.setChipType(static_cast<Thumbulator::ChipType>(myChipType->getSelectedTag().toInt()));
const Thumbulator::ChipPropsType chipProps =
myCart.setChipType(static_cast<Thumbulator::ChipType>
(myChipType->getSelectedTag().toInt()));
// update tooltip with currently selecte chip's properties
string tip = myChipType->getToolTip(Common::Point(0, 0));
@ -258,10 +260,9 @@ void CartridgeARMWidget::handleMamMode()
// override MAM mode set by ROM
const Int32 mode = myMamMode->getSelected();
string name = myMamMode->getSelectedName();
const string name = myMamMode->getSelectedName();
myMamMode->setSelectedName(name + "XXX");
instance().settings().setValue("dev.thumb.mammode", mode);
myCart.setMamMode(static_cast<Thumbulator::MamModeType>(mode));
}

View File

@ -31,7 +31,7 @@ CartridgeARWidget::CartridgeARWidget(
{
const size_t size = myCart.mySize;
string info =
const string info =
"Supercharger cartridge, four 2K slices (3 RAM, 1 ROM)\n"
"\nTHIS SCHEME IS NOT FULLY IMPLEMENTED OR TESTED\n";

View File

@ -207,7 +207,7 @@ CartridgeCDFWidget::CartridgeCDFWidget(
xpos = HBORDER + INDENT; ypos += myLineHeight + VGAP;
int lwidth2 = _font.getStringWidth("Sample Pointer ");
const int lwidth2 = _font.getStringWidth("Sample Pointer ");
new StaticTextWidget(boss, _font, xpos, ypos, "Sample Pointer");
mySamplePointer = new DataGridWidget(boss, _nfont, xpos + lwidth2, ypos - 2, 1, 1, 8, 32,

View File

@ -35,7 +35,7 @@ CartridgeCMWidget::CartridgeCMWidget(
{
constexpr uInt16 size = 4 * 4096;
string info =
const string info =
"CM cartridge, four 4K banks + 2K RAM\n"
"2K RAM accessible @ $1800 - $1FFF in read or write-only mode "
"(no separate ports)\n"

View File

@ -31,7 +31,7 @@ CartridgeCTYWidget::CartridgeCTYWidget(
{
constexpr uInt16 size = 8 * 4096;
string info =
const string info =
"Chetiry cartridge, eight 4K banks (bank 0 is ARM code and is ignored)\n"
"64 bytes RAM @ $F000 - $F080\n"
" $F040 - $F07F (R), $F000 - $F03F (W)\n"

View File

@ -66,7 +66,8 @@ int CartDebugWidget::addBaseInformation(size_t bytes, const string& manufacturer
w->setEditable(false);
y += myLineHeight + 4;
StringParser bs(desc, (fwidth - ScrollBarWidget::scrollBarWidth(_font)) / myFontWidth - 4);
const StringParser bs(desc, (fwidth - ScrollBarWidget::scrollBarWidth(_font)) /
myFontWidth - 4);
const StringList& sl = bs.stringList();
size_t lines = sl.size();
if(lines < 3) lines = 3;

View File

@ -105,13 +105,13 @@ string CartridgeEnhancedWidget::romDescription()
{
uInt16 start = (image[offset + 1] << 8) | image[offset];
start -= start % 0x1000;
string hash = myCart.romBankCount() > 10 && bank < 10 ? " #" : "#";
const string hash = myCart.romBankCount() > 10 && bank < 10 ? " #" : "#";
info << "Bank " << hash << std::dec << bank << " @ $"
<< Common::Base::HEX4 << (start + myCart.myRomOffset) << " - $" << (start + 0xFFF);
if(myCart.hotspot() != 0)
{
string hs = hotspotStr(bank, 0, true);
const string hs = hotspotStr(bank, 0, true);
if(hs.length() > 22)
info << "\n ";
info << " " << hs;

View File

@ -39,8 +39,8 @@ CartRamWidget::CartRamWidget(
myLineHeight{lfont.getLineHeight()},
myButtonHeight{myLineHeight + 4}
{
int lwidth = lfont.getStringWidth("Description ");
const int fwidth = w - lwidth - 20;
const int lwidth = lfont.getStringWidth("Description "),
fwidth = w - lwidth - 20;
EditTextWidget* etw = nullptr;
ostringstream buf;

View File

@ -133,7 +133,6 @@ void DataGridWidget::setList(const IntArray& alist, const IntArray& vlist,
_changedList = changed;
// An efficiency thing
string temp;
for(size_t i = 0; i < size; ++i)
_valueStringList.push_back(Common::Base::toString(_valueList[i], _base));
@ -759,8 +758,8 @@ void DataGridWidget::endEditMode()
enableEditMode(false);
// Update the both the string representation and the real data
if(!editString().empty() && !(editString()[0] == '$' ||
editString()[0] == '#' || editString()[0] == '\\'))
if(!editString().empty() && editString()[0] != '$' &&
editString()[0] != '#' && editString()[0] != '\\')
{
switch(_base)
{

View File

@ -377,8 +377,8 @@ void DebuggerDialog::doExitRom()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerDialog::createFont()
{
string fontSize = instance().settings().getString("dbg.fontsize");
int fontStyle = instance().settings().getInt("dbg.fontstyle");
const string fontSize = instance().settings().getString("dbg.fontsize");
const int fontStyle = instance().settings().getInt("dbg.fontstyle");
if(fontSize == "large")
{

View File

@ -45,7 +45,7 @@ DelayQueueWidget::DelayQueueWidget(
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DelayQueueWidget::loadConfig() {
shared_ptr<DelayQueueIterator> delayQueueIterator =
const shared_ptr<DelayQueueIterator> delayQueueIterator =
instance().debugger().tiaDebug().delayQueueIterator();
using Common::Base;

View File

@ -122,7 +122,7 @@ void PromptWidget::handleMouseWheel(int x, int y, int direction)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PromptWidget::printPrompt()
{
string watches = instance().debugger().showWatches();
const string watches = instance().debugger().showWatches();
if(watches.length() > 0)
print(watches);
@ -374,7 +374,7 @@ void PromptWidget::loadConfig()
_firstTime = false;
// Display greetings & prompt
string version = string("Stella ") + STELLA_VERSION + "\n";
const string version = string("Stella ") + STELLA_VERSION + "\n";
print(version);
print(PROMPT);
@ -534,9 +534,7 @@ void PromptWidget::textCut()
void PromptWidget::textCopy()
{
#if defined(PSEUDO_CUT_COPY_PASTE)
string text = getLine();
instance().eventHandler().copyText(text);
instance().eventHandler().copyText(getLine());
#endif
}
@ -598,7 +596,7 @@ void PromptWidget::addToHistory(const char* str)
do
{
int prevJ = j;
const int prevJ = j;
historyDir(j, +1);
_history[prevJ] = _history[j];
}
@ -676,13 +674,13 @@ bool PromptWidget::execute()
if(len > 0)
{
// Copy the user input to command
string command = getLine();
const string command = getLine();
// Add the input to the history
addToHistory(command.c_str());
// Pass the command to the debugger, and print the result
string result = instance().debugger().run(command);
const string result = instance().debugger().run(command);
// This is a bit of a hack
// Certain commands remove the debugger dialog from underneath us,

View File

@ -33,7 +33,7 @@ QuadTariWidget::QuadTariWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, Controller& controller)
: ControllerWidget(boss, font, x, y, controller)
{
string label = (isLeftPort() ? "Left" : "Right") + string(" (QuadTari)");
const string label = (isLeftPort() ? "Left" : "Right") + string(" (QuadTari)");
const StaticTextWidget* t = new StaticTextWidget(boss, font, x, y + 2, label);
const QuadTari& qt = static_cast<QuadTari&>(controller);
@ -79,7 +79,7 @@ void QuadTariWidget::addController(GuiObject* boss, int x, int y,
widget = new NullControlWidget(boss, _font, x, y, controller, true);
break;
}
WidgetArray focusList = widget->getFocusList();
const WidgetArray focusList = widget->getFocusList();
if(!focusList.empty())
addToFocusList(focusList);
}

View File

@ -177,7 +177,7 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
myLabel->setEditable(false, true);
// Inputbox which will pop up when searching RAM
StringList labels = { "Value" };
const StringList labels = { "Value" };
myInputBox = make_unique<InputTextDialog>(boss, lfont, nfont, labels, " ");
myInputBox->setTarget(this);

View File

@ -390,7 +390,7 @@ void RiotWidget::loadConfig()
myP0Diff->setSelectedIndex(riot.diffP0(), state.swchbReadBits[1] != oldstate.swchbReadBits[1]);
myP1Diff->setSelectedIndex(riot.diffP1(), state.swchbReadBits[0] != oldstate.swchbReadBits[0]);
bool devSettings = instance().settings().getBool("dev.settings");
const bool devSettings = instance().settings().getBool("dev.settings");
myConsole->setText(instance().settings().getString(devSettings ? "dev.console" : "plr.console") == "7800" ? "Atari 7800" : "Atari 2600");
myConsole->setEditable(false, true);
@ -565,8 +565,9 @@ RiotWidget::addControlWidget(GuiObject* boss, const GUI::Font& font,
void RiotWidget::handleConsole()
{
RiotDebug& riot = instance().debugger().riotDebug();
bool devSettings = instance().settings().getBool("dev.settings");
bool is7800 = instance().settings().getString(devSettings ? "dev.console" : "plr.console") == "7800";
const bool devSettings = instance().settings().getBool("dev.settings");
const bool is7800 = instance().settings().getString(
devSettings ? "dev.console" : "plr.console") == "7800";
myTVType->setEnabled(!is7800);
myPause->setEnabled(is7800);

View File

@ -90,7 +90,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
}
// Add filtering
EditableWidget::TextFilter f = [&](char c)
const EditableWidget::TextFilter f = [&](char c)
{
switch(_base)
{

View File

@ -36,8 +36,6 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
: Widget(boss, lfont, x, y, w, h),
CommandSender(boss)
{
WidgetArray wid;
// Show current bank state
int xpos = x, ypos = y + 7;
auto* t = new StaticTextWidget(boss, lfont, xpos, ypos, "Info ");
@ -165,7 +163,7 @@ void RomWidget::toggleBreak(int disasm_line)
if (address != 0)
{
Debugger& debugger = instance().debugger();
const Debugger& debugger = instance().debugger();
debugger.toggleBreakPoint(address, debugger.cartDebug().getBank(address));
}

View File

@ -38,7 +38,7 @@ TiaInfoWidget::TiaInfoWidget(GuiObject* boss, const GUI::Font& lfont,
const int VGAP = lfont.getLineHeight() / 4;
constexpr int VBORDER = 5 + 1;
const int COLUMN_GAP = _fontWidth * 1.25;
bool longstr = lfont.getStringWidth("Frame Cycls12345") + _fontWidth * 0.5
const bool longstr = lfont.getStringWidth("Frame Cycls12345") + _fontWidth * 0.5
+ COLUMN_GAP + lfont.getStringWidth("Scanline262262")
+ EditTextWidget::calcWidth(lfont) * 3 <= max_w;
const int lineHeight = lfont.getLineHeight();

View File

@ -87,7 +87,7 @@ void TiaOutputWidget::saveSnapshot(int execDepth, const string& execPrefix,
{
// Determine if the file already exists, checking each successive filename
// until one doesn't exist
FSNode node(sspath.str() + ".png");
const FSNode node(sspath.str() + ".png");
if(node.exists())
{
ostringstream suffix;
@ -98,7 +98,7 @@ void TiaOutputWidget::saveSnapshot(int execDepth, const string& execPrefix,
suffix.str("");
suffix << "_" << i;
buf << sspath.str() << suffix.str() << ".png";
FSNode next(buf.str());
const FSNode next(buf.str());
if(!next.exists())
break;
}
@ -166,7 +166,7 @@ void TiaOutputWidget::handleCommand(CommandSender* sender, int cmd, int data, in
if(lines > 0)
{
command << "scanLine #" << lines;
string message = instance().debugger().parser().run(command.str());
const string message = instance().debugger().parser().run(command.str());
instance().frameBuffer().showTextMessage(message);
}
}
@ -266,7 +266,7 @@ void TiaOutputWidget::drawWidget(bool hilite)
for(uInt32 x = 0; x < width; ++x, ++i)
{
const uInt8 shift = i >= scanoffset ? 1 : 0;
uInt32 pixel = tiaSurface.mapIndexedPixel(tiaOutputBuffer[i], shift);
const uInt32 pixel = tiaSurface.mapIndexedPixel(tiaOutputBuffer[i], shift);
*line_ptr++ = pixel;
*line_ptr++ = pixel;
}

View File

@ -255,7 +255,7 @@ void TiaZoomWidget::handleCommand(CommandSender* sender, int cmd, int data, int
if(lines > 0)
{
command << "scanline #" << lines;
string message = instance().debugger().parser().run(command.str());
const string& message = instance().debugger().parser().run(command.str());
instance().frameBuffer().showTextMessage(message);
}
}

View File

@ -36,7 +36,7 @@ Cartridge::Cartridge(const Settings& settings, const string& md5)
const uInt32 seed = to_uInt32(md5, 0) ^ to_uInt32(md5, 8) ^
to_uInt32(md5, 16) ^ to_uInt32(md5, 24);
Random rand(seed);
const Random rand(seed);
for(uInt32 i = 0; i < 256; ++i)
myRWPRandomValues[i] = rand.next();
@ -95,7 +95,7 @@ uInt16 Cartridge::bankSize(uInt16 bank) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 Cartridge::peekRAM(uInt8& dest, uInt16 address)
{
uInt8 value = myRWPRandomValues[address & 0xFF];
const uInt8 value = myRWPRandomValues[address & 0xFF];
// Reading from the write port triggers an unwanted write
// But this only happens when in normal emulation mode

View File

@ -59,7 +59,7 @@ CartridgeBUS::CartridgeBUS(const ByteBuffer& image, size_t size,
// Pointer to BUS driver in RAM
myDriverImage = myRAM.data();
bool devSettings = settings.getBool("dev.settings");
const bool devSettings = settings.getBool("dev.settings");
if (myBUSSubtype == BUSSubtype::BUS0)
{

View File

@ -99,7 +99,7 @@ CartridgeCDF::CartridgeCDF(const ByteBuffer& image, size_t size,
}
// Create Thumbulator ARM emulator
bool devSettings = settings.getBool("dev.settings");
const bool devSettings = settings.getBool("dev.settings");
myThumbEmulator = make_unique<Thumbulator>(
reinterpret_cast<uInt16*>(myImage.get()),
reinterpret_cast<uInt16*>(myRAM.data()),

View File

@ -512,7 +512,7 @@ void CartridgeCTY::updateTune()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCTY::loadScore(uInt8 index)
{
Serializer serializer(myEEPROMFile, Serializer::Mode::ReadOnly);
const Serializer serializer(myEEPROMFile, Serializer::Mode::ReadOnly);
if(serializer)
{
std::array<uInt8, 256> scoreRAM;

View File

@ -200,7 +200,7 @@ CartCreator::createFromMultiCart(const ByteBuffer& image, size_t& size,
settings.setValue("romloadcount", i);
size /= numRoms;
ByteBuffer slice = make_unique<uInt8[]>(size);
const ByteBuffer slice = make_unique<uInt8[]>(size);
std::copy_n(image.get() + i * size, size, slice.get());
// We need a new md5 and name

View File

@ -48,7 +48,7 @@ CartridgeDPCPlus::CartridgeDPCPlus(const ByteBuffer& image, size_t size,
myFrequencyImage = myDisplayImage + 4_KB;
// Create Thumbulator ARM emulator
bool devSettings = settings.getBool("dev.settings");
const bool devSettings = settings.getBool("dev.settings");
myThumbEmulator = make_unique<Thumbulator>
(reinterpret_cast<uInt16*>(myImage.get()),
reinterpret_cast<uInt16*>(myDPCRAM.data()),

View File

@ -221,7 +221,7 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
setTIAProperties();
bool joyallow4 = myOSystem.settings().getBool("joyallow4");
const bool joyallow4 = myOSystem.settings().getBool("joyallow4");
myOSystem.eventHandler().allowAllDirections(joyallow4);
// Reset the system to its power-on state
@ -280,7 +280,7 @@ void Console::autodetectFrameLayout(bool reset)
// will take over 250 frames!
// The 'fastscbios' option must be changed before the system is reset
Settings& settings = myOSystem.settings();
bool fastscbios = settings.getBool("fastscbios");
const bool fastscbios = settings.getBool("fastscbios");
settings.setValue("fastscbios", true);
FrameLayoutDetector frameLayoutDetector;
@ -363,7 +363,7 @@ string Console::formatFromFilename() const
{
try
{
std::regex rgx(pat[0], std::regex_constants::icase);
const std::regex rgx(pat[0], std::regex_constants::icase);
if(std::regex_search(filename, rgx))
return pat[1];
}
@ -426,7 +426,6 @@ bool Console::load(Serializer& in)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::selectFormat(int direction)
{
string saveformat, message;
Int32 format = myCurrentFormat;
format = BSPF::clampw(format + direction, 0, 6);
@ -534,8 +533,8 @@ void Console::toggleColorLoss(bool toggle)
myOSystem.settings().setValue(
myOSystem.settings().getBool("dev.settings") ? "dev.colorloss" : "plr.colorloss", colorloss);
string message = string("PAL color-loss ") +
(colorloss ? "enabled" : "disabled");
const string message = string("PAL color-loss ") +
(colorloss ? "enabled" : "disabled");
myOSystem.frameBuffer().showTextMessage(message);
}
else
@ -576,7 +575,7 @@ void Console::toggleInter(bool toggle)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::toggleTurbo()
{
bool enabled = myOSystem.settings().getBool("turbo");
const bool enabled = myOSystem.settings().getBool("turbo");
myOSystem.settings().setValue("turbo", !enabled);
@ -595,7 +594,7 @@ void Console::toggleTurbo()
void Console::changeSpeed(int direction)
{
int speed = mapSpeed(myOSystem.settings().getFloat("speed"));
bool turbo = myOSystem.settings().getBool("turbo");
const bool turbo = myOSystem.settings().getBool("turbo");
speed = BSPF::clamp(speed + direction * SPEED_STEP, MIN_SPEED, MAX_SPEED);
myOSystem.settings().setValue("speed", unmapSpeed(speed));
@ -674,7 +673,7 @@ FBInitStatus Console::initializeVideo(bool full)
Common::Size(TIAConstants::viewableWidth, TIAConstants::viewableHeight) :
Common::Size(2 * myTIA->width(), myTIA->height());
bool devSettings = myOSystem.settings().getBool("dev.settings");
const bool devSettings = myOSystem.settings().getBool("dev.settings");
const string& title = string("Stella ") + STELLA_VERSION +
": \"" + myProperties.get(PropType::Cart_Name) + "\"";
fbstatus = myOSystem.frameBuffer().createDisplay(title,
@ -827,7 +826,7 @@ void Console::setTIAProperties()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::createAudioQueue()
{
bool useStereo = myOSystem.settings().getBool(AudioSettings::SETTING_STEREO)
const bool useStereo = myOSystem.settings().getBool(AudioSettings::SETTING_STEREO)
|| myProperties.get(PropType::Cart_Sound) == "STEREO";
myAudioQueue = make_shared<AudioQueue>(
@ -971,7 +970,8 @@ unique_ptr<Controller> Console::getControllerPort(const Controller::Type type,
case Controller::Type::PaddlesIAxDr:
{
// Also check if we should swap the paddles plugged into a jack
bool swapPaddles = myProperties.get(PropType::Controller_SwapPaddles) == "YES";
const bool swapPaddles =
myProperties.get(PropType::Controller_SwapPaddles) == "YES";
bool swapAxis = false, swapDir = false;
if(type == Controller::Type::PaddlesIAxis)
swapAxis = true;
@ -1002,8 +1002,9 @@ unique_ptr<Controller> Console::getControllerPort(const Controller::Type type,
{
FSNode nvramfile = myOSystem.nvramDir();
nvramfile /= "atarivox_eeprom.dat";
Controller::onMessageCallback callback = [&os = myOSystem](const string& msg) {
bool devSettings = os.settings().getBool("dev.settings");
const Controller::onMessageCallback callback = [&os = myOSystem](const string& msg)
{
const bool devSettings = os.settings().getBool("dev.settings");
if(os.settings().getBool(devSettings ? "dev.extaccess" : "plr.extaccess"))
os.frameBuffer().showTextMessage(msg);
};
@ -1015,8 +1016,9 @@ unique_ptr<Controller> Console::getControllerPort(const Controller::Type type,
{
FSNode nvramfile = myOSystem.nvramDir();
nvramfile /= "savekey_eeprom.dat";
Controller::onMessageCallback callback = [&os = myOSystem](const string& msg) {
bool devSettings = os.settings().getBool("dev.settings");
const Controller::onMessageCallback callback = [&os = myOSystem](const string& msg)
{
const bool devSettings = os.settings().getBool("dev.settings");
if(os.settings().getBool(devSettings ? "dev.extaccess" : "plr.extaccess"))
os.frameBuffer().showTextMessage(msg);
};
@ -1029,12 +1031,14 @@ unique_ptr<Controller> Console::getControllerPort(const Controller::Type type,
case Controller::Type::KidVid:
{
Controller::onMessageCallbackForced callback = [&os = myOSystem](const string& msg, bool force) {
bool devSettings = os.settings().getBool("dev.settings");
const Controller::onMessageCallbackForced callback =
[&os = myOSystem](const string& msg, bool force) {
const bool devSettings = os.settings().getBool("dev.settings");
if(force || os.settings().getBool(devSettings ? "dev.extaccess" : "plr.extaccess"))
os.frameBuffer().showTextMessage(msg);
};
controller = make_unique<KidVid>(port, myEvent, myOSystem, *mySystem, romMd5, callback);
controller = make_unique<KidVid>
(port, myEvent, myOSystem, *mySystem, romMd5, callback);
break;
}
@ -1043,7 +1047,8 @@ unique_ptr<Controller> Console::getControllerPort(const Controller::Type type,
break;
case Controller::Type::Lightgun:
controller = make_unique<Lightgun>(port, myEvent, *mySystem, romMd5, myOSystem.frameBuffer());
controller = make_unique<Lightgun>
(port, myEvent, *mySystem, romMd5, myOSystem.frameBuffer());
break;
case Controller::Type::QuadTari:
@ -1159,7 +1164,7 @@ void Console::changePaddleAxesRange(int direction)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::toggleAutoFire(bool toggle)
{
bool enabled = myOSystem.settings().getBool("autofire");
const bool enabled = myOSystem.settings().getBool("autofire");
if(toggle)
{

View File

@ -44,7 +44,7 @@ EmulationWorker::~EmulationWorker()
{
// This has to run in a block in order to release the mutex before joining
{
std::unique_lock<std::mutex> lock(myThreadIsRunningMutex);
const std::unique_lock<std::mutex> lock(myThreadIsRunningMutex);
if (myState != State::exception) {
signalQuit();
@ -61,7 +61,7 @@ EmulationWorker::~EmulationWorker()
void EmulationWorker::handlePossibleException()
{
if (myState == State::exception && myPendingException) {
std::exception_ptr ex = myPendingException;
const std::exception_ptr ex = myPendingException;
// Make sure that the exception is not thrown a second time (destructor!!!)
myPendingException = nullptr;
@ -78,8 +78,8 @@ void EmulationWorker::start(uInt32 cyclesPerSecond, uInt64 maxCycles, uInt64 min
// Run in a block to release the mutex before notifying; this avoids an unecessary
// block that will waste a timeslice
{
// Aquire the mutex -> wait until the thread is suspended
std::unique_lock<std::mutex> lock(myThreadIsRunningMutex);
// Acquire the mutex -> wait until the thread is suspended
const std::unique_lock<std::mutex> lock(myThreadIsRunningMutex);
// Pass on possible exceptions
handlePossibleException();
@ -115,7 +115,7 @@ uInt64 EmulationWorker::stop()
uInt64 totalCycles{0};
{
std::unique_lock<std::mutex> lock(myThreadIsRunningMutex);
const std::unique_lock<std::mutex> lock(myThreadIsRunningMutex);
// Paranoia: make sure that we don't doublecount an emulation timeslice
totalCycles = myTotalCycles;
@ -148,7 +148,7 @@ void EmulationWorker::threadMain(std::condition_variable* initializedCondition,
try {
{
// Wait until our parent releases the lock and sleeps
std::lock_guard<std::mutex> guard(*initializationMutex);
const std::lock_guard<std::mutex> guard(*initializationMutex);
// Update the state...
myState = State::initialized;
@ -303,7 +303,7 @@ void EmulationWorker::dispatchEmulation(std::unique_lock<std::mutex>& lock)
void EmulationWorker::clearSignal()
{
{
std::unique_lock<std::mutex> lock(mySignalChangeMutex);
const std::unique_lock<std::mutex> lock(mySignalChangeMutex);
myPendingSignal = Signal::none;
}
@ -314,7 +314,7 @@ void EmulationWorker::clearSignal()
void EmulationWorker::signalQuit()
{
{
std::unique_lock<std::mutex> lock(mySignalChangeMutex);
const std::unique_lock<std::mutex> lock(mySignalChangeMutex);
myPendingSignal = Signal::quit;
}

View File

@ -1539,7 +1539,7 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
{
StringList msg;
const string saveOnExit = myOSystem.settings().getString("saveonexit");
bool activeTM = myOSystem.settings().getBool(
const bool activeTM = myOSystem.settings().getBool(
myOSystem.settings().getBool("dev.settings") ? "dev.timemachine" : "plr.timemachine");
@ -1986,11 +1986,11 @@ void EventHandler::setComboMap()
{
for(const json& combo : mapping)
{
int i = combo.at("combo").get<Event::Type>() - Event::Combo1,
j = 0;
json events = combo.at("events");
const int i = combo.at("combo").get<Event::Type>() - Event::Combo1;
int j = 0;
const json events = combo.at("events");
for(const json& event : events)
for(const json& event: events)
myComboTable[i][j++] = event;
}
}
@ -2297,7 +2297,7 @@ VariantList EventHandler::getComboList()
{
const Event::Type event = EventHandler::ourEmulActionList[i].event;
// exclude combos events
if(!(event >= Event::Combo1 && event <= Event::Combo16))
if(event < Event::Combo1 || event > Event::Combo16)
{
buf << i;
VarList::push_back(l, EventHandler::ourEmulActionList[i].action, buf.str());
@ -2549,7 +2549,7 @@ void EventHandler::changeMouseControllerMode(int direction)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::changeMouseCursor(int direction)
{
int cursor = BSPF::clampw(myOSystem.settings().getInt("cursor") + direction, 0, 3);
const int cursor = BSPF::clampw(myOSystem.settings().getInt("cursor") + direction, 0, 3);
myOSystem.settings().setValue("cursor", cursor);
myOSystem.frameBuffer().setCursorState();

View File

@ -191,8 +191,8 @@ void FBSurface::drawChar(const GUI::Font& font, uInt8 chr,
bby = desc.bbx[chr].y; // NOLINT
}
uInt32 cx = tx + bbx;
uInt32 cy = ty + desc.ascent - bby - bbh;
const uInt32 cx = tx + bbx;
const uInt32 cy = ty + desc.ascent - bby - bbh;
if(!checkBounds(cx , cy) || !checkBounds(cx + bbw - 1, cy + bbh - 1))
return;

View File

@ -85,7 +85,7 @@ bool FSNode::getAllChildren(FSList& fslist, ListMode mode,
{
if(BSPF::endsWithIgnoreCase(i.getPath(), ".zip"))
{
FSNodeZIP zipNode(i.getPath());
const FSNodeZIP zipNode(i.getPath());
i.setName(zipNode.getName());
}
}
@ -108,9 +108,9 @@ bool FSNode::getAllChildren(FSList& fslist, ListMode mode,
if(BSPF::endsWithIgnoreCase(i.getPath(), ".zip"))
{
// Force ZIP c'tor to be called
AbstractFSNodePtr ptr = FSNodeFactory::create(
const AbstractFSNodePtr ptr = FSNodeFactory::create(
i.getPath(), FSNodeFactory::Type::ZIP);
FSNode zipNode(ptr);
const FSNode zipNode(ptr);
i = zipNode;
}
}
@ -149,7 +149,7 @@ bool FSNode::getChildren(FSList& fslist, ListMode mode,
{
if(BSPF::endsWithIgnoreCase(i->getPath(), ".zip"))
{
FSNodeZIP node(i->getPath());
const FSNodeZIP node(i->getPath());
i->setName(node.getName());
}
}
@ -184,9 +184,9 @@ bool FSNode::getChildren(FSList& fslist, ListMode mode,
if (BSPF::endsWithIgnoreCase(i->getPath(), ".zip"))
{
// Force ZIP c'tor to be called
AbstractFSNodePtr ptr = FSNodeFactory::create(
const AbstractFSNodePtr ptr = FSNodeFactory::create(
i->getPath(), FSNodeFactory::Type::ZIP);
FSNode zipNode(ptr);
const FSNode zipNode(ptr);
if(filter(zipNode))
{
@ -195,7 +195,7 @@ bool FSNode::getChildren(FSList& fslist, ListMode mode,
else
{
// filter by zip node but add file node
FSNode node(i);
const FSNode node(i);
fslist.emplace_back(node);
}
}
@ -203,7 +203,7 @@ bool FSNode::getChildren(FSList& fslist, ListMode mode,
else
#endif
{
FSNode node(i);
const FSNode node(i);
if(includeChildDirectories)
{

View File

@ -170,10 +170,12 @@ void FrameBuffer::setupFonts()
else
{
constexpr int NUM_FONTS = 7;
FontDesc FONT_DESC[NUM_FONTS] = {GUI::consoleDesc, GUI::consoleMediumDesc, GUI::stellaMediumDesc,
GUI::stellaLargeDesc, GUI::stella12x24tDesc, GUI::stella14x28tDesc, GUI::stella16x32tDesc};
const FontDesc FONT_DESC[NUM_FONTS] = {
GUI::consoleDesc, GUI::consoleMediumDesc, GUI::stellaMediumDesc,
GUI::stellaLargeDesc, GUI::stella12x24tDesc, GUI::stella14x28tDesc,
GUI::stella16x32tDesc};
const string& dialogFont = myOSystem.settings().getString("dialogfont");
FontDesc fd = getFontDesc(dialogFont);
const FontDesc fd = getFontDesc(dialogFont);
// The general font used in all UI elements
myFont = make_unique<GUI::Font>(fd); // default: 9x18
@ -274,9 +276,9 @@ FBInitStatus FrameBuffer::createDisplay(const string& title, BufferType type,
if(myBufferType == BufferType::Emulator)
{
// Determine possible TIA windowed zoom levels
float currentTIAZoom = myOSystem.settings().getFloat("tia.zoom");
const float currentTIAZoom = myOSystem.settings().getFloat("tia.zoom");
myOSystem.settings().setValue("tia.zoom",
BSPF::clampw(currentTIAZoom, supportedTIAMinZoom(), supportedTIAMaxZoom()));
BSPF::clampw(currentTIAZoom, supportedTIAMinZoom(), supportedTIAMaxZoom()));
}
#ifdef GUI_SUPPORT // TODO: put message stuff in its own class
@ -311,7 +313,7 @@ FBInitStatus FrameBuffer::createDisplay(const string& title, BufferType type,
myVidModeHandler.setImageSize(size);
// Initialize video subsystem
string pre_about = myBackend->about();
const string pre_about = myBackend->about();
const FBInitStatus status = applyVideoMode();
// Only set phosphor once when ROM is started
@ -344,7 +346,7 @@ FBInitStatus FrameBuffer::createDisplay(const string& title, BufferType type,
}
else
{
string post_about = myBackend->about();
const string post_about = myBackend->about();
if(post_about != pre_about)
Logger::info(post_about);
}
@ -383,7 +385,7 @@ void FrameBuffer::update(UpdateMode mode)
case EventHandlerState::PAUSE:
{
// Show a pause message immediately and then every 7 seconds
bool shade = myOSystem.settings().getBool("pausedim");
const bool shade = myOSystem.settings().getBool("pausedim");
if(myPausedCount-- <= 0)
{
@ -1214,7 +1216,7 @@ void FrameBuffer::switchVideoMode(int direction)
// is irrelevant
if(direction == +1 || direction == -1)
{
bool stretch = myOSystem.settings().getBool("tia.fs_stretch");
const bool stretch = myOSystem.settings().getBool("tia.fs_stretch");
myOSystem.settings().setValue("tia.fs_stretch", !stretch);
}
}
@ -1366,7 +1368,7 @@ bool FrameBuffer::grabMouseAllowed()
const bool alwaysUseMouse = BSPF::equalsIgnoreCase("always", myOSystem.settings().getString("usemouse"));
// Disable grab while cursor is shown in emulation
bool cursorHidden = !(myOSystem.settings().getInt("cursor") & 1);
const bool cursorHidden = !(myOSystem.settings().getInt("cursor") & 1);
return emulation && (analog || usesLightgun || alwaysUseMouse) && cursorHidden;
}

View File

@ -68,7 +68,7 @@ void KidVid::update()
{
// Continue playing song after state load
const uInt8 temp = ourSongPositions[mySongPointer - 1] & 0x7f;
const uInt32 songLength = ourSongStart[temp + 1] - ourSongStart[temp];
const uInt32 songLength = ourSongStart[temp + 1] - ourSongStart[temp] - (262 * ClickFrames);
// Play the remaining WAV file
const string& fileName = myOSystem.baseDir().getPath() + ((temp < 10) ? "KVSHARED.WAV" : getFileName());
@ -140,6 +140,10 @@ void KidVid::update()
{
setPin(DigitalPin::Four, (ourData[myIdx >> 3] << (myIdx & 0x07)) & 0x80);
#ifdef DEBUG_BUILD
cerr << (DigitalPin::Four, (ourData[myIdx >> 3] << (myIdx & 0x07)) & 0x80 ? "X" : ".");
#endif
// increase to next bit
++myIdx;
--myBlockIdx;
@ -172,7 +176,7 @@ void KidVid::update()
if(mySongPlaying)
{
mySongLength = myOSystem.sound().wavSize();
myTapeBusy = (mySongLength > 262 * ClickFrames) || !myBeep;
myTapeBusy = (mySongLength > 262 * TapeFrames) || !myBeep;
// Check for end of played sample
if(mySongLength == 0)
{
@ -188,7 +192,7 @@ void KidVid::update()
if(mySongLength)
{
--mySongLength;
myTapeBusy = (mySongLength > ClickFrames);
myTapeBusy = (mySongLength > TapeFrames);
}
}
}
@ -259,6 +263,7 @@ void KidVid::openSampleFiles()
44 + 38 + 42 + 62
};
#ifdef SOUND_SUPPORT
if(!myFilesFound)
{
int i = myGame == Game::Smurfs ? myTape - 1 : myTape + 2;
@ -267,13 +272,14 @@ void KidVid::openSampleFiles()
myFilesFound = FSNode(myOSystem.baseDir().getPath() + getFileName()).exists() &&
FSNode(myOSystem.baseDir().getPath() + "KVSHARED.WAV").exists();
#ifdef DEBUG_BUILD
#ifdef DEBUG_BUILD
if(myFilesFound)
cerr << endl
<< "found file: " << getFileName() << endl
<< "found file: " << "KVSHARED.WAV" << endl;
#endif
#endif
#endif
mySongLength = 0;
mySongPointer = firstSongPointer[i];
}
@ -288,7 +294,7 @@ void KidVid::setNextSong()
myBeep = (ourSongPositions[mySongPointer] & 0x80) == 0;
const uInt8 temp = ourSongPositions[mySongPointer] & 0x7f;
mySongLength = ourSongStart[temp + 1] - ourSongStart[temp];
mySongLength = ourSongStart[temp + 1] - ourSongStart[temp] - (262 * ClickFrames);
// Play the WAV file
const string& fileName = (temp < 10) ? "KVSHARED.WAV" : getFileName();
@ -298,9 +304,9 @@ void KidVid::setNextSong()
msg << "Read song #" << mySongPointer << " (" << fileName << ")";
myCallback(msg.str(), false);
#ifdef DEBUG_BUILD
#ifdef DEBUG_BUILD
cerr << fileName << ": " << (ourSongPositions[mySongPointer] & 0x7f) << endl;
#endif
#endif
mySongPlaying = myTapeBusy = true;
++mySongPointer;
@ -309,7 +315,7 @@ void KidVid::setNextSong()
{
myBeep = true;
myTapeBusy = true;
mySongLength = 80; /* delay needed for Harmony without tape */
mySongLength = TapeFrames + 32; /* delay needed for Harmony without tape */
}
}
@ -438,14 +444,14 @@ const std::array<uInt32, KidVid::SongStartSize> KidVid::ourSongStart = {
3059116,
/* kvs1 */
44, /* Harmony into 1 */
164685, /* falling notes (into 2) */
44, /* Harmony intro 1 */
164685, /* falling notes (intro 2) */
395182, /* instructions */
750335, /* high notes are high */
962016, /* my hat's off to you */
1204273, /* 1 2 3 do re mi */
1538258, /* Harmony */
1801683, /* concratulations (all of the Smurfs voted) */
1801683, /* congratulations (all of the Smurfs voted) */
2086276, /* line or space */
2399093, /* hooray */
2589606, /* hear yeeh */

View File

@ -111,7 +111,8 @@ class KidVid : public Controller
NumBlockBits = NumBlocks * 8, // number of bits / block
SongPosSize = 44 + 38 + 42 + 62 + 80 + 62,
SongStartSize = 104,
ClickFrames = 48 // eliminate click noise at song end
TapeFrames = 60,
ClickFrames = 3 // eliminate click noise at song end
;
// Whether the KidVid device is enabled (only for games that it

View File

@ -103,9 +103,8 @@ bool Lightgun::read(DigitalPin pin)
if (xTia < 0)
xTia += TIAConstants::H_CLOCKS;
const bool enable = !((xTia - xMouse) >= 0 && (xTia - xMouse) < 15 && (yTia - yMouse) >= 0);
return enable;
return (xTia - xMouse) < 0 || (xTia - xMouse) >= 15 ||
(yTia - yMouse) < 0;
}
default:
return Controller::read(pin);

View File

@ -65,7 +65,7 @@ void M6502::reset()
myExecutionStatus = 0;
// Set registers to random or default values
bool devSettings = mySettings.getBool("dev.settings");
const bool devSettings = mySettings.getBool("dev.settings");
const string& cpurandom = mySettings.getString(devSettings ? "dev.cpurandom" : "plr.cpurandom");
SP = BSPF::containsIgnoreCase(cpurandom, "S") ?
mySystem->randGenerator().next() : 0xfd;

View File

@ -47,7 +47,7 @@ void M6532::reset()
};
// Initialize the 128 bytes of memory
bool devSettings = mySettings.getBool("dev.settings");
const bool devSettings = mySettings.getBool("dev.settings");
if(mySettings.getString(devSettings ? "dev.console" : "plr.console") == "7800")
std::copy_n(RAM_7800.begin(), RAM_7800.size(), myRAM.begin());
else if(mySettings.getBool(devSettings ? "dev.ramrandom" : "plr.ramrandom"))

View File

@ -143,7 +143,7 @@ static void MD5Update(MD5_CTX* context, const uInt8* const input,
auto index = static_cast<uInt32>((context->count[0] >> 3) & 0x3F);
/* Update number of bits */
if ((context->count[0] += (inputLen << 3)) < (inputLen << 3))
if ((context->count[0] += (inputLen << 3)) < (inputLen << 3)) // NOLINT
context->count[1]++;
context->count[1] += (inputLen >> 29);

View File

@ -474,9 +474,10 @@ string OSystem::createConsole(const FSNode& rom, const string& md5sum,
}
myConsole->initializeAudio();
string saveOnExit = settings().getString("saveonexit");
bool devSettings = settings().getBool("dev.settings");
bool activeTM = settings().getBool(devSettings ? "dev.timemachine" : "plr.timemachine");
const string saveOnExit = settings().getString("saveonexit");
const bool devSettings = settings().getBool("dev.settings");
const bool activeTM = settings().getBool(
devSettings ? "dev.timemachine" : "plr.timemachine");
if (saveOnExit == "all" && activeTM)
myEventHandler->handleEvent(Event::LoadAllStates);
@ -492,7 +493,7 @@ string OSystem::createConsole(const FSNode& rom, const string& md5sum,
}
buf << "Game console created:" << endl
<< " ROM file: " << myRomFile.getShortPath() << endl;
FSNode propsFile(myRomFile.getPathWithExt(".pro"));
const FSNode propsFile(myRomFile.getPathWithExt(".pro"));
if(propsFile.exists())
buf << " PRO file: " << propsFile.getShortPath() << endl;
buf << endl << getROMInfo(*myConsole);
@ -528,7 +529,7 @@ string OSystem::createConsole(const FSNode& rom, const string& md5sum,
constexpr int ID_LEN = 32;
const char* HEX_DIGITS = "0123456789ABCDEF";
char id_chr[ID_LEN] = { 0 };
Random rnd;
const Random rnd;
for(char& c : id_chr)
c = HEX_DIGITS[rnd.next() % 16];
@ -667,7 +668,7 @@ unique_ptr<Console> OSystem::openConsole(const FSNode& romfile, string& md5)
const string& type = props.get(PropType::Cart_Type);
const Cartridge::messageCallback callback = [&os = *this](const string& msg)
{
bool devSettings = os.settings().getBool("dev.settings");
const bool devSettings = os.settings().getBool("dev.settings");
if(os.settings().getBool(devSettings ? "dev.extaccess" : "plr.extaccess"))
os.frameBuffer().showTextMessage(msg);

View File

@ -215,7 +215,7 @@ Paddles::getReadOut(int lastAxis,int& newAxis, int center)
// dejitter, suppress small changes only
const float dejitter = powf(baseFactor, std::abs(newAxis - lastAxis) * diffFactor);
int newVal = newAxis * (1 - dejitter) + lastAxis * dejitter;
const int newVal = newAxis * (1 - dejitter) + lastAxis * dejitter;
// only use new dejittered value for larger differences
if(abs(newVal - newAxis) > 10)

View File

@ -90,7 +90,7 @@ class PlusROMRequest {
<< "nick=" << myId.nick;
httplib::Client client(myDestination.host);
httplib::Headers headers = {
const httplib::Headers headers = {
{"PlusROM-Info", content.str()}
};
@ -375,7 +375,7 @@ bool PlusROM::isValidHost(const string& host)
// of each part between '.' in the range 1 .. 63
// Perhaps a better function will be included with whatever network
// library we decide to use
static std::regex rgx(R"(^(([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)*([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])$)", std::regex_constants::icase);
static const std::regex rgx(R"(^(([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)*([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])$)", std::regex_constants::icase);
return std::regex_match(host, rgx);
}

View File

@ -60,14 +60,14 @@ ProfilingRunner::ProfilingRunner(int argc, char* argv[])
for (int i = 2; i < argc; i++) {
ProfilingRun& run(profilingRuns[i-2]);
string arg = argv[i];
const string arg = argv[i];
const size_t splitPoint = arg.find_first_of(':');
run.romFile = splitPoint == string::npos ? arg : arg.substr(0, splitPoint);
if (splitPoint == string::npos) run.runtime = RUNTIME_DEFAULT;
else {
int runtime = BSPF::stringToInt(arg.substr(splitPoint+1, string::npos));
const int runtime = BSPF::stringToInt(arg.substr(splitPoint+1, string::npos));
run.runtime = runtime > 0 ? runtime : RUNTIME_DEFAULT;
}
}
@ -95,7 +95,7 @@ bool ProfilingRunner::run()
// stacksize '16384'. Consider moving some data to heap.
bool ProfilingRunner::runOne(const ProfilingRun& run)
{
FSNode imageFile(run.romFile);
const FSNode imageFile(run.romFile);
if (!imageFile.isFile()) {
cout << "ERROR: " << run.romFile << " is not a ROM image" << endl;
@ -110,7 +110,7 @@ bool ProfilingRunner::runOne(const ProfilingRun& run)
}
string md5 = MD5::hash(image, size);
string type;
const string type;
unique_ptr<Cartridge> cartridge = CartCreator::create(
imageFile, image, size, md5, type, mySettings);
@ -121,7 +121,7 @@ bool ProfilingRunner::runOne(const ProfilingRun& run)
IO consoleIO;
Random rng(0);
Event event;
const Event event;
M6502 cpu(mySettings);
M6532 riot(consoleIO, mySettings);

View File

@ -154,7 +154,7 @@ void PropertiesSet::loadPerROM(const FSNode& rom, const string& md5)
// First, does this ROM have a per-ROM properties entry?
// If so, load it into the database
FSNode propsNode(rom.getPathWithExt(".pro"));
const FSNode propsNode(rom.getPathWithExt(".pro"));
if (propsNode.exists()) {
KeyValueRepositoryPropertyFile repo(propsNode);
props.load(repo);

View File

@ -69,18 +69,19 @@ QuadTari::QuadTari(Jack jack, const OSystem& osystem, const System& system,
unique_ptr<Controller> QuadTari::addController(const Controller::Type type, bool second)
{
FSNode nvramfile = myOSystem.nvramDir();
Controller::onMessageCallback callback = [&os = myOSystem](const string& msg) {
bool devSettings = os.settings().getBool("dev.settings");
if(os.settings().getBool(devSettings ? "dev.extaccess" : "plr.extaccess"))
os.frameBuffer().showTextMessage(msg);
};
const Controller::onMessageCallback callback = [&os = myOSystem]
(const string& msg) {
const bool devSettings = os.settings().getBool("dev.settings");
if(os.settings().getBool(devSettings ? "dev.extaccess" : "plr.extaccess"))
os.frameBuffer().showTextMessage(msg);
};
switch(type)
{
case Controller::Type::Paddles:
{
// Check if we should swap the paddles plugged into a jack
bool swapPaddles = myProperties.get(PropType::Controller_SwapPaddles) == "YES";
const bool swapPaddles = myProperties.get(PropType::Controller_SwapPaddles) == "YES";
return make_unique<Paddles>(myJack, myEvent, mySystem, swapPaddles,
false, false, second);

View File

@ -26,7 +26,7 @@ Serializer::Serializer(const string& filename, Mode m)
{
if(m == Mode::ReadOnly)
{
FSNode node(filename);
const FSNode node(filename);
if(node.isFile() && node.isReadable())
{
unique_ptr<fstream> str = make_unique<fstream>(filename, ios::in | ios::binary);

View File

@ -306,7 +306,7 @@ void Settings::setRepository(shared_ptr<KeyValueRepository> repository)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Settings::load(const Options& options)
{
Options fromFile = myRespository->load();
const Options fromFile = myRespository->load();
for (const auto& opt: fromFile)
setValue(opt.first, opt.second, false);
@ -330,7 +330,7 @@ void Settings::save()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Settings::validate()
{
float f = getFloat("speed");
const float f = getFloat("speed");
if (f <= 0) setValue("speed", "1.0");
int i = getInt("tia.vsizeadjust");

View File

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

View File

@ -188,7 +188,7 @@ bool Switches::load(Serializer& in)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Switches::check7800Mode(const Settings& settings)
{
bool devSettings = settings.getBool("dev.settings");
const bool devSettings = settings.getBool("dev.settings");
myIs7800 = (settings.getString(devSettings ? "dev.console" : "plr.console") == "7800");
return myIs7800;

View File

@ -3088,7 +3088,7 @@ bool Thumbulator::isMamBuffered(uInt32 addr, AccessType accessType)
else // e.g. LPC2104_05_06
{
// dual Flash bank
uInt32 bank = (addr & 0x80) ? 1 : 0;
const uInt32 bank = (addr & 0x80) ? 1 : 0;
addr &= ~0x7F; // 128-bit address line

View File

@ -191,9 +191,10 @@ void TIA::initialize()
applyDeveloperSettings();
// Must be done last, after all other items have reset
bool devSettings = mySettings.getBool("dev.settings");
const bool devSettings = mySettings.getBool("dev.settings");
setFixedColorPalette(mySettings.getString("tia.dbgcolors"));
enableFixedColors(mySettings.getBool(devSettings ? "dev.debugcolors" : "plr.debugcolors"));
enableFixedColors(
mySettings.getBool(devSettings ? "dev.debugcolors" : "plr.debugcolors"));
#ifdef DEBUGGER_SUPPORT
createAccessArrays();
@ -941,10 +942,11 @@ bool TIA::loadDisplay(const Serializer& in)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::applyDeveloperSettings()
{
bool devSettings = mySettings.getBool("dev.settings");
const bool devSettings = mySettings.getBool("dev.settings");
if(devSettings)
{
bool custom = BSPF::equalsIgnoreCase("custom", mySettings.getString("dev.tia.type"));
const bool custom =
BSPF::equalsIgnoreCase("custom", mySettings.getString("dev.tia.type"));
setPlInvertedPhaseClock(custom
? mySettings.getBool("dev.tia.plinvphase")

View File

@ -65,14 +65,16 @@ AboutDialog::AboutDialog(OSystem& osystem, DialogContainer& parent,
addCancelWidget(b);
xpos = HBORDER; ypos = _th + VBORDER + (buttonHeight - fontHeight) / 2;
int bwidth = font.getStringWidth("What's New" + ELLIPSIS) + fontWidth * 2.5;
const int bwidth = font.getStringWidth("What's New" + ELLIPSIS) + fontWidth * 2.5;
myTitle = new StaticTextWidget(this, font, xpos + bwidth, ypos, _w - (xpos + bwidth) * 2,
myTitle = new StaticTextWidget(this, font, xpos + bwidth, ypos,
_w - (xpos + bwidth) * 2,
fontHeight, "", TextAlign::Center);
myTitle->setTextColor(kTextColorEm);
myWhatsNewButton =
new ButtonWidget(this, font, _w - HBORDER - bwidth, ypos - (buttonHeight - fontHeight) / 2,
new ButtonWidget(this, font, _w - HBORDER - bwidth,
ypos - (buttonHeight - fontHeight) / 2,
bwidth, buttonHeight, "What's New" + ELLIPSIS, kWhatsNew);
wid.push_back(myWhatsNewButton);
@ -320,7 +322,7 @@ string AboutDialog::getUrl(const string& text)
for(size_t i = 0; i < text.size(); ++i)
{
string remainder = text.substr(i);
const string remainder = text.substr(i);
const char ch = text[i];
if(!isUrl

View File

@ -167,7 +167,7 @@ void BrowserDialog::show(const string& startpath,
if(_mode != Mode::Directories)
{
// split startpath into path and filename
FSNode fs = FSNode(startpath);
const FSNode fs = FSNode(startpath);
fileName = fs.getName();
directory = fs.isDirectory() ? "" : fs.getParent().getPath();
}

View File

@ -137,7 +137,7 @@ void ContextMenu::setSelected(const Variant& tag, const Variant& defaultTag)
};
// First try searching for a valid tag
bool tagSelected = tag != "" && SEARCH_AND_SELECT(tag);
const bool tagSelected = tag != "" && SEARCH_AND_SELECT(tag);
// Otherwise use the default tag
if(!tagSelected)

View File

@ -98,7 +98,7 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
int ypos = VBORDER;
WidgetArray wid;
VariantList items;
int tabID = myTab->addTab(" Emulation ", TabWidget::AUTO_WIDTH);
const int tabID = myTab->addTab(" Emulation ", TabWidget::AUTO_WIDTH);
// settings set
mySettingsGroupEmulation = new RadioButtonGroup();
@ -139,8 +139,8 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
items.clear();
VarList::push_back(items, "Atari 2600", "2600");
VarList::push_back(items, "Atari 7800", "7800");
int lwidth = font.getStringWidth("Console ");
int pwidth = font.getStringWidth("Atari 2600");
const int lwidth = font.getStringWidth("Console ");
const int pwidth = font.getStringWidth("Atari 2600");
myConsoleWidget = new PopUpWidget(myTab, font, HBORDER + INDENT * 1, ypos, pwidth, lineHeight, items,
"Console ", lwidth, kConsole);
@ -232,10 +232,10 @@ void DeveloperDialog::addTiaTab(const GUI::Font& font)
VGAP = Dialog::vGap(),
INDENT = Dialog::indent();
int ypos = VBORDER;
int pwidth = font.getStringWidth("Faulty Cosmic Ark stars");
const int pwidth = font.getStringWidth("Faulty Cosmic Ark stars");
WidgetArray wid;
VariantList items;
int tabID = myTab->addTab(" TIA ", TabWidget::AUTO_WIDTH);
const int tabID = myTab->addTab(" TIA ", TabWidget::AUTO_WIDTH);
wid.clear();
@ -354,7 +354,7 @@ void DeveloperDialog::addVideoTab(const GUI::Font& font)
int pwidth = fontWidth * 6;
WidgetArray wid;
VariantList items;
int tabID = myTab->addTab(" Video ", TabWidget::AUTO_WIDTH);
const int tabID = myTab->addTab(" Video ", TabWidget::AUTO_WIDTH);
wid.clear();
@ -516,7 +516,7 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
lwidth = fontWidth * 11;
WidgetArray wid;
VariantList items;
int tabID = myTab->addTab(" Time Machine ", TabWidget::AUTO_WIDTH);
const int tabID = myTab->addTab(" Time Machine ", TabWidget::AUTO_WIDTH);
// settings set
mySettingsGroupTM = new RadioButtonGroup();
@ -574,7 +574,7 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
items.clear();
for(int i = 0; i < NUM_INTERVALS; ++i)
VarList::push_back(items, INTERVALS[i], INT_SETTINGS[i]);
int pwidth = font.getStringWidth("10 seconds");
const int pwidth = font.getStringWidth("10 seconds");
myStateIntervalWidget = new PopUpWidget(myTab, font, xpos, ypos, pwidth,
lineHeight, items, "Interval ", 0, kIntervalChanged);
myStateIntervalWidget->setToolTip("Define the interval between each saved state.");
@ -606,7 +606,7 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::addDebuggerTab(const GUI::Font& font)
{
int tabID = myTab->addTab(" Debugger ", TabWidget::AUTO_WIDTH);
const int tabID = myTab->addTab(" Debugger ", TabWidget::AUTO_WIDTH);
WidgetArray wid;
#ifdef DEBUGGER_SUPPORT
@ -816,7 +816,7 @@ void DeveloperDialog::setWidgetStates(SettingsSet set)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::loadConfig()
{
bool devSettings = instance().settings().getBool("dev.settings");
const bool devSettings = instance().settings().getBool("dev.settings");
handleSettings(devSettings);
mySettings = devSettings;
mySettingsGroupEmulation->setSelected(devSettings ? 1 : 0);
@ -842,11 +842,11 @@ void DeveloperDialog::loadConfig()
myDebuggerHeightSlider->setValue(h);
// Debugger font size
string size = instance().settings().getString("dbg.fontsize");
const string size = instance().settings().getString("dbg.fontsize");
myDebuggerFontSize->setSelected(size, "medium");
// Debugger font style
int style = instance().settings().getInt("dbg.fontstyle");
const int style = instance().settings().getInt("dbg.fontstyle");
myDebuggerFontStyle->setSelected(style, "0");
// Ghost reads trap
@ -1121,7 +1121,7 @@ void DeveloperDialog::handleSettings(bool devSettings)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::handleTVJitterChange()
{
bool enable = myTVJitterWidget->getState();
const bool enable = myTVJitterWidget->getState();
myTVJitterSenseWidget->setEnabled(enable);
myTVJitterRecWidget->setEnabled(enable);

View File

@ -167,7 +167,8 @@ void Dialog::initHelp()
{
if(_helpWidget == nullptr)
{
string key = instance().eventHandler().getMappingDesc(Event::UIHelp, EventMode::kMenuMode);
const string key = instance().eventHandler().getMappingDesc(
Event::UIHelp, EventMode::kMenuMode);
_helpWidget = new ButtonWidget(this, _font,
_w - _font.getMaxCharWidth() * 3.5, 0,

View File

@ -412,7 +412,7 @@ bool EditableWidget::handleKeyDown(StellaKey key, StellaMod mod)
case Event::Undo:
case Event::Redo:
{
string oldString = _editString;
const string oldString = _editString;
myUndoHandler->endChars(_editString);
// Reverse Y and Z for QWERTZ keyboards
@ -846,7 +846,7 @@ bool EditableWidget::cutSelectedText()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool EditableWidget::copySelectedText()
{
string selected = selectString();
const string selected = selectString();
// only copy if anything is selected, else keep old copied text
if(!selected.empty())
@ -860,7 +860,7 @@ bool EditableWidget::copySelectedText()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool EditableWidget::pasteSelectedText()
{
bool selected = !selectString().empty();
const bool selected = !selectString().empty();
string pasted;
myUndoHandler->endChars(_editString);

View File

@ -74,9 +74,8 @@ EmulationDialog::EmulationDialog(OSystem& osystem, DialogContainer& parent,
HBORDER = Dialog::hBorder(),
VGAP = Dialog::vGap(),
INDENT = Dialog::indent();
int lwidth = font.getStringWidth("Emulation speed ");
const int lwidth = font.getStringWidth("Emulation speed ");
WidgetArray wid;
VariantList items;
const int swidth = fontWidth * 10;
// Set real dimensions
@ -174,7 +173,7 @@ void EmulationDialog::loadConfig()
const Settings& settings = instance().settings();
// Emulation speed
int speed = mapSpeed(settings.getFloat("speed"));
const int speed = mapSpeed(settings.getFloat("speed"));
mySpeed->setValue(speed);
mySpeed->setValueLabel(formatSpeed(speed));
@ -200,7 +199,7 @@ void EmulationDialog::loadConfig()
myConfirmExitWidget->setState(settings.getBool("confirmexit"));
// Save on exit
string saveOnExit = settings.getString("saveonexit");
const string saveOnExit = settings.getString("saveonexit");
mySaveOnExitGroup->setSelected(saveOnExit == "all" ? 2 : saveOnExit == "current" ? 1 : 0);
// Automatically change save state slots
myAutoSlotWidget->setState(settings.getBool("autoslot"));

View File

@ -121,8 +121,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
myComboButton->setTarget(this);
addFocusWidget(myComboButton);
VariantList combolist = EventHandler::getComboList();
myComboDialog = make_unique<ComboDialog>(boss, font, combolist);
myComboDialog = make_unique<ComboDialog>(boss, font, EventHandler::getComboList());
// Show message for currently selected event
xpos = HBORDER;
@ -166,9 +165,7 @@ void EventMappingWidget::updateActions()
? EventMode::kMenuMode
: EventMode::kEmulationMode;
StringList actions = EventHandler::getActionList(myEventGroup);
myActionsList->setList(actions);
myActionsList->setList(EventHandler::getActionList(myEventGroup));
myActionSelected = myActionsList->getSelected();
drawKeyMapping();
enableButtons(true);

View File

@ -42,10 +42,10 @@ void FavoritesManager::load()
try
{
const json& jUser = json::parse(serializedUser);
for (const auto& u : jUser)
for (const auto& u: jUser)
{
const string& path = u.get<string>();
FSNode node(path);
const FSNode node(path);
if (node.exists())
addUser(path);
}
@ -66,10 +66,10 @@ void FavoritesManager::load()
try
{
const json& jRecent = json::parse(serializedRecent);
for (const auto& r : jRecent)
for (const auto& r: jRecent)
{
const string& path = r.get<string>();
FSNode node(path);
const FSNode node(path);
if (node.exists())
addRecent(path);
}
@ -89,11 +89,11 @@ void FavoritesManager::load()
try
{
const json& jPopular = json::parse(serializedPopular);
for (const auto& p : jPopular)
for (const auto& p: jPopular)
{
const string& path = p[0].get<string>();
const uInt32 count = p[1].get<uInt32>();
FSNode node(path);
const FSNode node(path);
if (node.exists())
myPopularMap.emplace(path, count);
}
@ -186,9 +186,10 @@ const FavoritesManager::UserList& FavoritesManager::userList() const
[](const string& a, const string& b)
{
// Sort without path
FSNode aNode(a);
FSNode bNode(b);
const bool realDir = aNode.isDirectory() && !BSPF::endsWithIgnoreCase(aNode.getPath(), ".zip");
const FSNode aNode(a);
const FSNode bNode(b);
const bool realDir = aNode.isDirectory() &&
!BSPF::endsWithIgnoreCase(aNode.getPath(), ".zip");
if(realDir != (bNode.isDirectory() && !BSPF::endsWithIgnoreCase(bNode.getPath(), ".zip")))
return realDir;
@ -237,7 +238,7 @@ void FavoritesManager::removeAllRecent()
const FavoritesManager::RecentList& FavoritesManager::recentList() const
{
static RecentList sortedList;
bool sortByName = mySettings.getBool("altsorting");
const bool sortByName = mySettings.getBool("altsorting");
sortedList.clear();
if(sortByName)
@ -248,8 +249,8 @@ const FavoritesManager::RecentList& FavoritesManager::recentList() const
[](const string& a, const string& b)
{
// Sort alphabetical, without path
FSNode aNode(a);
FSNode bNode(b);
const FSNode aNode(a);
const FSNode bNode(b);
return BSPF::compareIgnoreCase(aNode.getName(), bNode.getName()) < 0;
});
@ -288,7 +289,7 @@ void FavoritesManager::incPopular(const string& path)
// Limit number of entries and age data
if(myPopularMap.size() >= max_popular)
{
PopularList sortedList = sortedPopularList(); // sorted by frequency!
const PopularList& sortedList = sortedPopularList(); // sorted by frequency!
for(const auto& item: sortedList)
{
const auto entry = myPopularMap.find(item.first);
@ -313,7 +314,8 @@ const FavoritesManager::PopularList& FavoritesManager::popularList() const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const FavoritesManager::PopularList& FavoritesManager::sortedPopularList(bool sortByName) const
const FavoritesManager::PopularList&
FavoritesManager::sortedPopularList(bool sortByName) const
{
// Return most to least popular or sorted by name
static PopularList sortedList;
@ -329,8 +331,8 @@ const FavoritesManager::PopularList& FavoritesManager::sortedPopularList(bool so
return a.second > b.second;
// 2. Sort alphabetical, without path
FSNode aNode(a.first);
FSNode bNode(b.first);
const FSNode aNode(a.first);
const FSNode bNode(b.first);
return BSPF::compareIgnoreCase(aNode.getName(), bNode.getName()) < 0;
});
return sortedList;

View File

@ -94,7 +94,7 @@ void FileListWidget::setLocation(const FSNode& node, const string& select)
// Now fill the list widget with the names from the file list,
// even if cancelled
StringList list;
size_t orgLen = _node.getShortPath().length();
const size_t orgLen = _node.getShortPath().length();
_dirList.clear();
_iconTypeList.clear();
@ -193,7 +193,7 @@ void FileListWidget::selectParent()
if(_node.hasParent())
{
string name = _node.getName();
FSNode parent(_node.getParent());
const FSNode parent(_node.getParent());
_currentHistory->selected = selected().getName();
addHistory(parent);
@ -672,10 +672,10 @@ const FileListWidget::Icon* FileListWidget::getIcon(int i) const
0b11111111111'11111111110
};
const int idx = static_cast<int>(IconType::numTypes);
static const Icon* small_icons[idx] = {
static const Icon* const small_icons[idx] = {
&unknown_small, &rom_small, &directory_small, &zip_small, &up_small
};
static const Icon* large_icons[idx] = {
static const Icon* const large_icons[idx] = {
&unknown_large, &rom_large, &directory_large, &zip_large, &up_large,
};
const bool smallIcon = iconWidth() < 24;

View File

@ -114,7 +114,7 @@ void GameInfoDialog::addEmulationTab()
VariantList items;
// 1) Emulation properties
int tabID = myTab->addTab("Emulation", TabWidget::AUTO_WIDTH);
const int tabID = myTab->addTab("Emulation", TabWidget::AUTO_WIDTH);
int ypos = VBORDER;
@ -209,11 +209,11 @@ void GameInfoDialog::addConsoleTab()
WidgetArray wid;
// 2) Console properties
int tabID = myTab->addTab(" Console ", TabWidget::AUTO_WIDTH);
const int tabID = myTab->addTab(" Console ", TabWidget::AUTO_WIDTH);
const int xpos = HBORDER;
int ypos = VBORDER;
int lwidth = _font.getStringWidth(GUI::RIGHT_DIFFICULTY + " ");
const int lwidth = _font.getStringWidth(GUI::RIGHT_DIFFICULTY + " ");
new StaticTextWidget(myTab, _font, xpos, ypos + 1, "TV type");
myTVTypeGroup = new RadioButtonGroup();
@ -275,7 +275,7 @@ void GameInfoDialog::addControllersTab()
// 3) Controller properties
wid.clear();
int tabID = myTab->addTab("Controllers", TabWidget::AUTO_WIDTH);
const int tabID = myTab->addTab("Controllers", TabWidget::AUTO_WIDTH);
items.clear();
VarList::push_back(items, "Auto-detect", "AUTO");
@ -429,15 +429,14 @@ void GameInfoDialog::addCartridgeTab()
VGAP = Dialog::vGap(),
HGAP = Dialog::fontWidth() / 4;
WidgetArray wid;
VariantList items;
wid.clear();
int tabID = myTab->addTab("Cartridge", TabWidget::AUTO_WIDTH);
const int tabID = myTab->addTab("Cartridge", TabWidget::AUTO_WIDTH);
const int xpos = HBORDER;
int ypos = VBORDER;
int lwidth = _font.getStringWidth("Manufacturer ");
const int fwidth = _w - lwidth - HBORDER * 2 - 2;
const int lwidth = _font.getStringWidth("Manufacturer "),
fwidth = _w - lwidth - HBORDER * 2 - 2;
new StaticTextWidget(myTab, _font, xpos, ypos + 1, lwidth, fontHeight, "Name");
myName = new EditTextWidget(myTab, _font, xpos + lwidth, ypos - 1,
fwidth, lineHeight, "");
@ -503,21 +502,20 @@ void GameInfoDialog::addHighScoresTab()
WidgetArray wid;
VariantList items;
int tabID = myTab->addTab("High Scores", TabWidget::AUTO_WIDTH);
const int tabID = myTab->addTab("High Scores", TabWidget::AUTO_WIDTH);
EditableWidget::TextFilter fAddr = [](char c) {
const EditableWidget::TextFilter fAddr = [](char c) {
return (c >= 'a' && c <= 'f') || (c >= '0' && c <= '9');
};
EditableWidget::TextFilter fVars = [](char c) {
const EditableWidget::TextFilter fVars = [](char c) {
return (c >= '0' && c <= '9');
};
EditableWidget::TextFilter fText = [](char c) {
const EditableWidget::TextFilter fText = [](char c) {
return (c >= 'a' && c <= 'z') || (c >= ' ' && c < ',') || (c > ',' && c < '@');
};
int xpos = HBORDER, ypos = VBORDER;
int lwidth = _font.getStringWidth("Variations ");
const int lwidth = _font.getStringWidth("Variations ");
myHighScores = new CheckboxWidget(myTab, _font, xpos, ypos + 1, "Enable High Scores",
kHiScoresChanged);
@ -976,7 +974,7 @@ void GameInfoDialog::saveProperties()
if(myMouseControl->getState())
mcontrol = myMouseX->getSelectedTag().toString() +
myMouseY->getSelectedTag().toString();
string range = myMouseRange->getValueLabel();
const string range = myMouseRange->getValueLabel();
if(range != "100")
mcontrol += " " + range;
myGameProperties.set(PropType::Controller_MouseAxis, mcontrol);
@ -1073,7 +1071,7 @@ void GameInfoDialog::saveHighScoresProperties()
info.scoreAddr[a] = stringToIntBase16(strAddr, HSM::DEFAULT_ADDRESS);
}
string strVars = myVariations->getText();
const string strVars = myVariations->getText();
HighScoresManager::set(myGameProperties, stringToInt(strVars,
HSM::DEFAULT_VARIATION), info);
@ -1322,7 +1320,7 @@ void GameInfoDialog::eraseEEPROM()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void GameInfoDialog::updateLink()
{
string link = myUrl->getText();
const string link = myUrl->getText();
const bool enable = startsWithIgnoreCase(link, "http://")
|| startsWithIgnoreCase(link, "https://")
|| startsWithIgnoreCase(link, "www.");
@ -1401,7 +1399,7 @@ void GameInfoDialog::updateHighScoresWidgets()
if(a < numAddr)
{
setAddressVal(myScoreAddress[a], myScoreAddressVal[a]);
string strAddr = myScoreAddress[a]->getText();
const string strAddr = myScoreAddress[a]->getText();
scoreAddr[a] = stringToIntBase16(strAddr, HSM::DEFAULT_ADDRESS);
}
else

View File

@ -39,8 +39,8 @@ GlobalPropsDialog::GlobalPropsDialog(GuiObject* boss, const GUI::Font& font)
VBORDER = Dialog::vBorder(),
HBORDER = Dialog::hBorder(),
VGAP = Dialog::vGap();
int lwidth = font.getStringWidth("Right difficulty "),
pwidth = font.getStringWidth("CM (SpectraVideo CompuMate)");
const int lwidth = font.getStringWidth("Right difficulty ");
int pwidth = font.getStringWidth("CM (SpectraVideo CompuMate)");
WidgetArray wid;
VariantList items;
const GUI::Font& infofont = instance().frameBuffer().infoFont();

View File

@ -60,7 +60,7 @@ HelpDialog::HelpDialog(OSystem& osystem, DialogContainer& parent,
xpos += buttonWidth + fontWidth;
int updButtonWidth = Dialog::buttonWidth("Check for Update" + ELLIPSIS);
const int updButtonWidth = Dialog::buttonWidth("Check for Update" + ELLIPSIS);
myUpdateButton =
new ButtonWidget(this, font, xpos, ypos, updButtonWidth, buttonHeight,
"Check for Update" + ELLIPSIS, kUpdateCmd);

View File

@ -117,16 +117,16 @@ HighScoresDialog::HighScoresDialog(OSystem& osystem, DialogContainer& parent,
HBORDER = Dialog::hBorder(),
VGAP = Dialog::vGap();
const int xposRank = HBORDER;
int xposScore = xposRank + _font.getStringWidth("Rank");
int xposSpecial = xposScore + _font.getStringWidth(" Score ");
int xposName = xposSpecial + _font.getStringWidth("Round ");
int xposDate = xposName + _font.getStringWidth("Name ");
int xposDelete = xposDate + _font.getStringWidth("YY-MM-DD HH:MM ");
int nWidth = _font.getStringWidth("ABC") + fontWidth * 0.75;
const int xposScore = xposRank + _font.getStringWidth("Rank");
const int xposSpecial = xposScore + _font.getStringWidth(" Score ");
const int xposName = xposSpecial + _font.getStringWidth("Round ");
const int xposDate = xposName + _font.getStringWidth("Name ");
const int xposDelete = xposDate + _font.getStringWidth("YY-MM-DD HH:MM ");
const int nWidth = _font.getStringWidth("ABC") + fontWidth * 0.75;
const bool smallFont = _font.getFontHeight() < 24;
const int buttonSize = smallFont ? BUTTON_GFX_H : BUTTON_GFX_H_LARGE;
WidgetArray wid;
VariantList items;
const VariantList items;
const int xpos = HBORDER;
int ypos = VBORDER + _th;
@ -542,7 +542,7 @@ string HighScoresDialog::cartName() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string HighScoresDialog::now()
{
std::tm now = BSPF::localTime();
const std::tm now = BSPF::localTime();
ostringstream ss;
ss << std::setfill('0') << std::right

View File

@ -66,7 +66,7 @@ InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent,
addTabWidget(myTab);
// 1) Event mapper
int tabID = myTab->addTab(" Event Mappings ", TabWidget::AUTO_WIDTH);
const int tabID = myTab->addTab(" Event Mappings ", TabWidget::AUTO_WIDTH);
myEventMapper = new EventMappingWidget(myTab, _font, 2, 2,
myTab->getWidth(),
myTab->getHeight() - VGAP);
@ -110,7 +110,7 @@ void InputDialog::addDevicePortTab()
WidgetArray wid;
// Devices/ports
int tabID = myTab->addTab(" Devices & Ports ", TabWidget::AUTO_WIDTH);
const int tabID = myTab->addTab(" Devices & Ports ", TabWidget::AUTO_WIDTH);
int xpos = HBORDER, ypos = VBORDER;
int lwidth = _font.getStringWidth("Digital paddle sensitivity ");
@ -282,11 +282,11 @@ void InputDialog::addMouseTab()
VariantList items;
// Mouse
int tabID = myTab->addTab(" Mouse ", TabWidget::AUTO_WIDTH);
const int tabID = myTab->addTab(" Mouse ", TabWidget::AUTO_WIDTH);
int xpos = HBORDER, ypos = VBORDER;
int lwidth = _font.getStringWidth("Use mouse as a controller ");
int pwidth = _font.getStringWidth("-UI, -Emulation");
const int pwidth = _font.getStringWidth("-UI, -Emulation");
// Use mouse as controller
VarList::push_back(items, "Always", "always");

View File

@ -31,7 +31,7 @@ Launcher::Launcher(OSystem& osystem)
mySize{myOSystem.settings().getSize("launcherres")}
{
const Common::Size& d = myOSystem.frameBuffer().desktopSize(BufferType::Launcher);
double overscan = 1 - myOSystem.settings().getInt("tia.fs_overscan") / 100.0;
const double overscan = 1 - myOSystem.settings().getInt("tia.fs_overscan") / 100.0;
// The launcher dialog is resizable, within certain bounds
// We check those bounds now
@ -54,7 +54,7 @@ Launcher::~Launcher()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FBInitStatus Launcher::initializeVideo()
{
string title = string("Stella ") + STELLA_VERSION;
const string title = string("Stella ") + STELLA_VERSION;
return myOSystem.frameBuffer().createDisplay(
title, BufferType::Launcher, mySize
);

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