mirror of https://github.com/stella-emu/stella.git
Yay, got clang-tidy working again. First pass at fixing suggestions.
This commit is contained in:
parent
6215829efa
commit
f987c3f72c
|
@ -111,7 +111,7 @@ CheatCodeDialog::CheatCodeDialog(OSystem& osystem, DialogContainer& parent,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CheatCodeDialog::~CheatCodeDialog()
|
||||
CheatCodeDialog::~CheatCodeDialog() // NOLINT (we need an empty d'tor)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -93,8 +93,8 @@ void CheatManager::addPerFrame(const string& name, const string& code, bool enab
|
|||
}
|
||||
|
||||
// Make sure there are no duplicates
|
||||
bool found = false;
|
||||
uInt32 i;
|
||||
bool found{false};
|
||||
uInt32 i{0};
|
||||
for(i = 0; i < myPerFrameList.size(); ++i)
|
||||
{
|
||||
if(myPerFrameList[i]->code() == cheat->code())
|
||||
|
|
|
@ -29,16 +29,20 @@ AudioQueue::AudioQueue(uInt32 fragmentSize, uInt32 capacity, bool isStereo)
|
|||
{
|
||||
const uInt8 sampleSize = myIsStereo ? 2 : 1;
|
||||
|
||||
myFragmentBuffer = make_unique<Int16[]>(myFragmentSize * sampleSize * (capacity + 2));
|
||||
myFragmentBuffer = make_unique<Int16[]>(
|
||||
static_cast<size_t>(myFragmentSize) * sampleSize * (capacity + 2));
|
||||
|
||||
for (uInt32 i = 0; i < capacity; ++i)
|
||||
myFragmentQueue[i] = myAllFragments[i] = myFragmentBuffer.get() + i * sampleSize * myFragmentSize;
|
||||
myFragmentQueue[i] = myAllFragments[i] = myFragmentBuffer.get() +
|
||||
static_cast<size_t>(myFragmentSize) * sampleSize * i;
|
||||
|
||||
myAllFragments[capacity] = myFirstFragmentForEnqueue =
|
||||
myFragmentBuffer.get() + capacity * sampleSize * myFragmentSize;
|
||||
myFragmentBuffer.get() + static_cast<size_t>(myFragmentSize) * sampleSize *
|
||||
capacity;
|
||||
|
||||
myAllFragments[capacity + 1] = myFirstFragmentForDequeue =
|
||||
myFragmentBuffer.get() + (capacity + 1) * sampleSize * myFragmentSize;
|
||||
myFragmentBuffer.get() + static_cast<size_t>(myFragmentSize) * sampleSize *
|
||||
(capacity + 1);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -83,7 +87,7 @@ Int16* AudioQueue::enqueue(Int16* fragment)
|
|||
return newFragment;
|
||||
}
|
||||
|
||||
const uInt8 capacity = static_cast<uInt8>(myFragmentQueue.size());
|
||||
const auto capacity = static_cast<uInt8>(myFragmentQueue.size());
|
||||
const uInt8 fragmentIndex = (myNextFragment + mySize) % capacity;
|
||||
|
||||
newFragment = myFragmentQueue.at(fragmentIndex);
|
||||
|
|
|
@ -47,74 +47,83 @@ string Base::toString(int value, Common::Base::Fmt outputBase)
|
|||
|
||||
case Base::Fmt::_10: // base 10: 3 or 5 bytes (depending on value)
|
||||
if(value > -0x100 && value < 0x100)
|
||||
std::snprintf(vToS_buf, 5, "%3d", static_cast<Int16>(value));
|
||||
std::ignore = std::snprintf(vToS_buf, 5, "%3d", static_cast<Int16>(value));
|
||||
else
|
||||
std::snprintf(vToS_buf, 6, "%5d", value);
|
||||
std::ignore = std::snprintf(vToS_buf, 6, "%5d", value);
|
||||
break;
|
||||
|
||||
case Base::Fmt::_10_02: // base 10: 2 digits (with leading zero)
|
||||
std::snprintf(vToS_buf, 3, "%02d", value);
|
||||
std::ignore = std::snprintf(vToS_buf, 3, "%02d", value);
|
||||
break;
|
||||
|
||||
case Base::Fmt::_10_3: // base 10: 3 digits
|
||||
std::snprintf(vToS_buf, 4, "%3d", value);
|
||||
std::ignore = std::snprintf(vToS_buf, 4, "%3d", value);
|
||||
break;
|
||||
|
||||
case Base::Fmt::_10_4: // base 10: 4 digits
|
||||
std::snprintf(vToS_buf, 5, "%4d", value);
|
||||
std::ignore = std::snprintf(vToS_buf, 5, "%4d", value);
|
||||
break;
|
||||
|
||||
case Base::Fmt::_10_5: // base 10: 5 digits
|
||||
std::snprintf(vToS_buf, 6, "%5d", value);
|
||||
std::ignore = std::snprintf(vToS_buf, 6, "%5d", value);
|
||||
break;
|
||||
|
||||
case Base::Fmt::_10_6: // base 10: 6 digits
|
||||
std::snprintf(vToS_buf, 7, "%6d", value);
|
||||
std::ignore = std::snprintf(vToS_buf, 7, "%6d", value);
|
||||
break;
|
||||
|
||||
case Base::Fmt::_10_8: // base 10: 8 digits
|
||||
std::snprintf(vToS_buf, 9, "%8d", value);
|
||||
std::ignore = std::snprintf(vToS_buf, 9, "%8d", value);
|
||||
break;
|
||||
|
||||
case Base::Fmt::_16_1: // base 16: 1 byte wide
|
||||
std::snprintf(vToS_buf, 2, hexUppercase() ? "%1X" : "%1x", value);
|
||||
std::ignore = std::snprintf(
|
||||
vToS_buf, 2, hexUppercase() ? "%1X" : "%1x", value);
|
||||
break;
|
||||
case Base::Fmt::_16_2: // base 16: 2 bytes wide
|
||||
std::snprintf(vToS_buf, 3, hexUppercase() ? "%02X" : "%02x", value);
|
||||
std::ignore = std::snprintf(
|
||||
vToS_buf, 3, hexUppercase() ? "%02X" : "%02x", value);
|
||||
break;
|
||||
case Base::Fmt::_16_2_2:
|
||||
std::snprintf(vToS_buf, 6, hexUppercase() ? "%02X.%02X" : "%02x.%02x",
|
||||
value >> 8, value & 0xff );
|
||||
std::ignore = std::snprintf(
|
||||
vToS_buf, 6, hexUppercase() ? "%02X.%02X" : "%02x.%02x",
|
||||
value >> 8, value & 0xff );
|
||||
break;
|
||||
case Base::Fmt::_16_3_2:
|
||||
std::snprintf(vToS_buf, 7, hexUppercase() ? "%03X.%02X" : "%03x.%02x",
|
||||
value >> 8, value & 0xff );
|
||||
std::ignore = std::snprintf(
|
||||
vToS_buf, 7, hexUppercase() ? "%03X.%02X" : "%03x.%02x",
|
||||
value >> 8, value & 0xff );
|
||||
break;
|
||||
case Base::Fmt::_16_4: // base 16: 4 bytes wide
|
||||
std::snprintf(vToS_buf, 5, hexUppercase() ? "%04X" : "%04x", value);
|
||||
std::ignore = std::snprintf(
|
||||
vToS_buf, 5, hexUppercase() ? "%04X" : "%04x", value);
|
||||
break;
|
||||
case Base::Fmt::_16_8: // base 16: 8 bytes wide
|
||||
std::snprintf(vToS_buf, 9, hexUppercase() ? "%08X" : "%08x", value);
|
||||
std::ignore = std::snprintf(
|
||||
vToS_buf, 9, hexUppercase() ? "%08X" : "%08x", value);
|
||||
break;
|
||||
|
||||
case Base::Fmt::_16: // base 16: 2, 4, 8 bytes (depending on value)
|
||||
default:
|
||||
if(value < 0x100)
|
||||
std::snprintf(vToS_buf, 3, hexUppercase() ? "%02X" : "%02x", value);
|
||||
std::ignore = std::snprintf(
|
||||
vToS_buf, 3, hexUppercase() ? "%02X" : "%02x", value);
|
||||
else if(value < 0x10000)
|
||||
std::snprintf(vToS_buf, 5, hexUppercase() ? "%04X" : "%04x", value);
|
||||
std::ignore = std::snprintf(
|
||||
vToS_buf, 5, hexUppercase() ? "%04X" : "%04x", value);
|
||||
else
|
||||
std::snprintf(vToS_buf, 9, hexUppercase() ? "%08X" : "%08x", value);
|
||||
std::ignore = std::snprintf(
|
||||
vToS_buf, 9, hexUppercase() ? "%08X" : "%08x", value);
|
||||
break;
|
||||
}
|
||||
|
||||
return string(vToS_buf);
|
||||
return {vToS_buf};
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Base::Fmt Base::myDefaultBase = Base::Fmt::_16;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
std::ios_base::fmtflags Base::myHexflags = std::ios_base::hex;
|
||||
std::ios_base::fmtflags Base::myHexflags = std::ios_base::hex; // NOLINT
|
||||
|
||||
} // Namespace Common
|
||||
|
|
|
@ -141,7 +141,7 @@ void EventHandlerSDL2::pollEvent()
|
|||
|
||||
case SDL_MOUSEWHEEL:
|
||||
{
|
||||
int x, y;
|
||||
int x{0}, y{0};
|
||||
SDL_GetMouseState(&x, &y); // we need mouse position too
|
||||
if(myEvent.wheel.y < 0)
|
||||
handleMouseButtonEvent(MouseButton::WHEELDOWN, true, x, y);
|
||||
|
|
|
@ -174,11 +174,11 @@ void FBBackendSDL2::queryHardware(vector<Common::Size>& fullscreenRes,
|
|||
{
|
||||
// Map SDL names into nicer Stella names (if available)
|
||||
bool found = false;
|
||||
for(size_t j = 0; j < RENDERER_NAMES.size(); ++j)
|
||||
for(const auto& render: RENDERER_NAMES)
|
||||
{
|
||||
if(RENDERER_NAMES[j].sdlName == info.name)
|
||||
if(render.sdlName == info.name)
|
||||
{
|
||||
VarList::push_back(renderers, RENDERER_NAMES[j].stellaName, info.name);
|
||||
VarList::push_back(renderers, render.stellaName, info.name);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ bool FBBackendSDL2::setVideoMode(const VideoModeHandler::Mode& mode,
|
|||
if(myWindow)
|
||||
{
|
||||
const int d = SDL_GetWindowDisplayIndex(myWindow);
|
||||
int w, h;
|
||||
int w{0}, h{0};
|
||||
|
||||
SDL_GetWindowSize(myWindow, &w, &h);
|
||||
if(d != displayIndex || static_cast<uInt32>(w) != mode.screenS.w ||
|
||||
|
@ -567,7 +567,7 @@ unique_ptr<FBSurface> FBBackendSDL2::createSurface(
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBBackendSDL2::readPixels(uInt8* pixels, uInt32 pitch,
|
||||
void FBBackendSDL2::readPixels(uInt8* pixels, size_t pitch,
|
||||
const Common::Rect& rect) const
|
||||
{
|
||||
ASSERT_MAIN_THREAD;
|
||||
|
@ -576,7 +576,7 @@ void FBBackendSDL2::readPixels(uInt8* pixels, uInt32 pitch,
|
|||
r.x = rect.x(); r.y = rect.y();
|
||||
r.w = rect.w(); r.h = rect.h();
|
||||
|
||||
SDL_RenderReadPixels(myRenderer, &r, 0, pixels, pitch);
|
||||
SDL_RenderReadPixels(myRenderer, &r, 0, pixels, static_cast<int>(pitch));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -121,7 +121,7 @@ class FBBackendSDL2 : public FBBackend
|
|||
@param pitch The pitch (in bytes) for the pixel data
|
||||
@param rect The bounding rectangle for the buffer
|
||||
*/
|
||||
void readPixels(uInt8* buffer, uInt32 pitch,
|
||||
void readPixels(uInt8* buffer, size_t pitch,
|
||||
const Common::Rect& rect) const override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -249,9 +249,10 @@ void FBSurfaceSDL2::createSurface(uInt32 width, uInt32 height,
|
|||
|
||||
myIsStatic = data != nullptr;
|
||||
if(myIsStatic)
|
||||
SDL_memcpy(mySurface->pixels, data, mySurface->w * mySurface->h * 4);
|
||||
SDL_memcpy(mySurface->pixels, data,
|
||||
static_cast<size_t>(mySurface->w) * mySurface->h * 4);
|
||||
|
||||
reload();
|
||||
reload(); // NOLINT
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -65,9 +65,10 @@ HighScoresManager::HighScoresManager(OSystem& osystem)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void HighScoresManager::setRepository(shared_ptr<CompositeKeyValueRepositoryAtomic> repo)
|
||||
void HighScoresManager::setRepository(
|
||||
shared_ptr<CompositeKeyValueRepositoryAtomic> repo)
|
||||
{
|
||||
myHighscoreRepository = repo;
|
||||
myHighscoreRepository = std::move(repo);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -701,12 +702,12 @@ bool HighScoresManager::load(const json& hsData, ScoresData& data)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void HighScoresManager::clearHighScores(ScoresData& data)
|
||||
{
|
||||
for(uInt32 r = 0; r < NUM_RANKS; ++r)
|
||||
for(auto& s: data.scores)
|
||||
{
|
||||
data.scores[r].score = 0;
|
||||
data.scores[r].special = 0;
|
||||
data.scores[r].name = "";
|
||||
data.scores[r].date = "";
|
||||
s.score = 0;
|
||||
s.special = 0;
|
||||
s.name = "";
|
||||
s.date = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ void JPGLibrary::loadImagetoSurface(FBSurface& surface)
|
|||
surface.setSrcSize(iw, ih);
|
||||
|
||||
// Convert RGB triples into pixels and store in the surface
|
||||
uInt32* s_buf, s_pitch;
|
||||
uInt32 *s_buf{nullptr}, s_pitch{0};
|
||||
surface.basePtr(s_buf, s_pitch);
|
||||
const uInt8* i_buf = myReadInfo.buffer;
|
||||
const uInt32 i_pitch = myReadInfo.pitch;
|
||||
|
|
|
@ -46,7 +46,8 @@ class JPGLibrary
|
|||
runtime_error is thrown containing a more detailed
|
||||
error message.
|
||||
*/
|
||||
void loadImage(const string& filename, FBSurface& surface, VariantList& metaData);
|
||||
void loadImage(const string& filename, FBSurface& surface,
|
||||
VariantList& metaData);
|
||||
|
||||
private:
|
||||
// Global OSystem object
|
||||
|
|
|
@ -25,7 +25,7 @@ using json = nlohmann::json;
|
|||
namespace {
|
||||
json serializeModkeyMask(int mask)
|
||||
{
|
||||
if(mask == StellaMod::KBDM_NONE) return json(nullptr);
|
||||
if(mask == StellaMod::KBDM_NONE) return {};
|
||||
|
||||
json serializedMask = json::array();
|
||||
|
||||
|
|
|
@ -41,8 +41,10 @@ MouseControl::MouseControl(Console& console, const string& mode)
|
|||
m_mode[0] >= '0' && m_mode[0] <= '8' &&
|
||||
m_mode[1] >= '0' && m_mode[1] <= '8')
|
||||
{
|
||||
const MouseControl::Type xaxis = static_cast<MouseControl::Type>(static_cast<int>(m_mode[0]) - '0');
|
||||
const MouseControl::Type yaxis = static_cast<MouseControl::Type>(static_cast<int>(m_mode[1]) - '0');
|
||||
const auto xaxis = static_cast<MouseControl::Type>
|
||||
(static_cast<int>(m_mode[0]) - '0');
|
||||
const auto yaxis = static_cast<MouseControl::Type>
|
||||
(static_cast<int>(m_mode[1]) - '0');
|
||||
ostringstream msg;
|
||||
Controller::Type xtype = Controller::Type::Joystick, ytype = Controller::Type::Joystick;
|
||||
int xid = -1, yid = -1;
|
||||
|
|
|
@ -149,11 +149,9 @@ int PhysicalJoystickHandler::add(const PhysicalJoystickPtr& stick)
|
|||
// We're potentially swapping out an input device behind the back of
|
||||
// the Event system, so we make sure all Stelladaptor-generated events
|
||||
// are reset
|
||||
for(int port = 0; port < NUM_PORTS; ++port)
|
||||
{
|
||||
for(int axis = 0; axis < NUM_SA_AXIS; ++axis)
|
||||
for(int port = 0; port < NUM_PORTS; ++port) // NOLINT
|
||||
for(int axis = 0; axis < NUM_SA_AXIS; ++axis) // NOLINT
|
||||
myEvent.set(SA_Axis[port][axis], 0);
|
||||
}
|
||||
|
||||
return stick->ID;
|
||||
}
|
||||
|
@ -588,7 +586,7 @@ void PhysicalJoystickHandler::enableCommonMappings()
|
|||
{
|
||||
for (int i = Event::NoType + 1; i < Event::LastType; i++)
|
||||
{
|
||||
const Event::Type event = static_cast<Event::Type>(i);
|
||||
const auto event = static_cast<Event::Type>(i);
|
||||
|
||||
if(isCommonEvent(event))
|
||||
enableMapping(event, EventMode::kCommonMode);
|
||||
|
|
|
@ -219,10 +219,8 @@ void PhysicalKeyboardHandler::setDefaultMapping(Event::Type event, EventMode mod
|
|||
void PhysicalKeyboardHandler::defineControllerMappings(
|
||||
const Controller::Type type, Controller::Jack port, const Properties& properties)
|
||||
{
|
||||
|
||||
//const string& test = myOSystem.settings().getString("aq");
|
||||
// determine controller events to use
|
||||
switch(type)
|
||||
// Determine controller events to use
|
||||
switch(type) // NOLINT (could be written as IF/ELSE)
|
||||
{
|
||||
case Controller::Type::QuadTari:
|
||||
if(port == Controller::Jack::Left)
|
||||
|
@ -377,7 +375,7 @@ void PhysicalKeyboardHandler::enableCommonMappings()
|
|||
{
|
||||
for (int i = Event::NoType + 1; i < Event::LastType; i++)
|
||||
{
|
||||
const Event::Type event = static_cast<Event::Type>(i);
|
||||
const auto event = static_cast<Event::Type>(i);
|
||||
|
||||
if (isCommonEvent(event))
|
||||
enableMapping(event, EventMode::kCommonMode);
|
||||
|
|
|
@ -135,16 +135,16 @@ void PNGLibrary::saveImage(const string& filename, const VariantList& metaData)
|
|||
fb.scaleX(rectUnscaled.w()), fb.scaleY(rectUnscaled.h())
|
||||
);
|
||||
|
||||
const png_uint_32 width = rect.w(), height = rect.h();
|
||||
const size_t width = rect.w(), height = rect.h();
|
||||
|
||||
// Get framebuffer pixel data (we get ABGR format)
|
||||
vector<png_byte> buffer(width * height * 4);
|
||||
fb.readPixels(buffer.data(), width*4, rect);
|
||||
fb.readPixels(buffer.data(), width * 4, rect);
|
||||
|
||||
// Set up pointers into "buffer" byte array
|
||||
vector<png_bytep> rows(height);
|
||||
for(png_uint_32 k = 0; k < height; ++k)
|
||||
rows[k] = buffer.data() + k*width*4;
|
||||
for(size_t k = 0; k < height; ++k)
|
||||
rows[k] = buffer.data() + k * width * 4;
|
||||
|
||||
// And save the image
|
||||
saveImageToDisk(out, rows, width, height, metaData);
|
||||
|
@ -159,7 +159,7 @@ void PNGLibrary::saveImage(const string& filename, const FBSurface& surface,
|
|||
throw runtime_error("ERROR: Couldn't create snapshot file");
|
||||
|
||||
// Do we want the entire surface or just a section?
|
||||
png_uint_32 width = rect.w(), height = rect.h();
|
||||
size_t width = rect.w(), height = rect.h();
|
||||
if(rect.empty())
|
||||
{
|
||||
width = surface.width();
|
||||
|
@ -168,12 +168,12 @@ void PNGLibrary::saveImage(const string& filename, const FBSurface& surface,
|
|||
|
||||
// Get the surface pixel data (we get ABGR format)
|
||||
vector<png_byte> buffer(width * height * 4);
|
||||
surface.readPixels(buffer.data(), width, rect);
|
||||
surface.readPixels(buffer.data(), static_cast<uInt32>(width), rect);
|
||||
|
||||
// Set up pointers into "buffer" byte array
|
||||
vector<png_bytep> rows(height);
|
||||
for(png_uint_32 k = 0; k < height; ++k)
|
||||
rows[k] = buffer.data() + k*width*4;
|
||||
for(size_t k = 0; k < height; ++k)
|
||||
rows[k] = buffer.data() + k * width * 4;
|
||||
|
||||
// And save the image
|
||||
saveImageToDisk(out, rows, width, height, metaData);
|
||||
|
@ -181,10 +181,10 @@ void PNGLibrary::saveImage(const string& filename, const FBSurface& surface,
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PNGLibrary::saveImageToDisk(std::ofstream& out, const vector<png_bytep>& rows,
|
||||
png_uint_32 width, png_uint_32 height, const VariantList& metaData)
|
||||
size_t width, size_t height, const VariantList& metaData)
|
||||
{
|
||||
png_structp png_ptr = nullptr;
|
||||
png_infop info_ptr = nullptr;
|
||||
png_structp png_ptr{nullptr};
|
||||
png_infop info_ptr{nullptr};
|
||||
|
||||
const auto saveImageERROR = [&](const char* s) {
|
||||
if(png_ptr)
|
||||
|
@ -208,7 +208,8 @@ void PNGLibrary::saveImageToDisk(std::ofstream& out, const vector<png_bytep>& ro
|
|||
png_set_write_fn(png_ptr, &out, png_write_data, png_io_flush);
|
||||
|
||||
// Write PNG header info
|
||||
png_set_IHDR(png_ptr, info_ptr, width, height, 8,
|
||||
png_set_IHDR(png_ptr, info_ptr,
|
||||
static_cast<png_uint_32>(width), static_cast<png_uint_32>(height), 8,
|
||||
PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
|
||||
PNG_FILTER_TYPE_DEFAULT);
|
||||
|
||||
|
@ -381,7 +382,7 @@ void PNGLibrary::takeSnapshot(uInt32 number)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool PNGLibrary::allocateStorage(png_uint_32 w, png_uint_32 h)
|
||||
bool PNGLibrary::allocateStorage(size_t w, size_t h)
|
||||
{
|
||||
// Create space for the entire image (3 bytes per pixel in RGB format)
|
||||
const size_t req_buffer_size = w * h * 3;
|
||||
|
@ -392,9 +393,9 @@ bool PNGLibrary::allocateStorage(png_uint_32 w, png_uint_32 h)
|
|||
if(req_row_size > ReadInfo.row_pointers.capacity())
|
||||
ReadInfo.row_pointers.reserve(req_row_size * 1.5);
|
||||
|
||||
ReadInfo.width = w;
|
||||
ReadInfo.height = h;
|
||||
ReadInfo.pitch = w * 3;
|
||||
ReadInfo.width = static_cast<png_uint_32>(w);
|
||||
ReadInfo.height = static_cast<png_uint_32>(h);
|
||||
ReadInfo.pitch = static_cast<png_uint_32>(w * 3);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -413,7 +414,7 @@ void PNGLibrary::loadImagetoSurface(FBSurface& surface)
|
|||
surface.setSrcSize(iw, ih);
|
||||
|
||||
// Convert RGB triples into pixels and store in the surface
|
||||
uInt32 *s_buf, s_pitch;
|
||||
uInt32 *s_buf{nullptr}, s_pitch{0};
|
||||
surface.basePtr(s_buf, s_pitch);
|
||||
const uInt8* i_buf = ReadInfo.buffer.data();
|
||||
const uInt32 i_pitch = ReadInfo.pitch;
|
||||
|
@ -429,30 +430,32 @@ void PNGLibrary::loadImagetoSurface(FBSurface& surface)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PNGLibrary::writeMetaData(const png_structp png_ptr, png_infop info_ptr,
|
||||
const VariantList& metaData)
|
||||
void PNGLibrary::writeMetaData(
|
||||
const png_structp png_ptr, png_infop info_ptr, // NOLINT
|
||||
const VariantList& metaData)
|
||||
{
|
||||
const uInt32 numMetaData = static_cast<uInt32>(metaData.size());
|
||||
const size_t numMetaData = metaData.size();
|
||||
if(numMetaData == 0)
|
||||
return;
|
||||
|
||||
vector<png_text> text_ptr(numMetaData);
|
||||
for(uInt32 i = 0; i < numMetaData; ++i)
|
||||
for(size_t i = 0; i < numMetaData; ++i)
|
||||
{
|
||||
text_ptr[i].key = const_cast<char*>(metaData[i].first.c_str());
|
||||
text_ptr[i].text = const_cast<char*>(metaData[i].second.toCString());
|
||||
text_ptr[i].compression = PNG_TEXT_COMPRESSION_NONE;
|
||||
text_ptr[i].text_length = 0;
|
||||
}
|
||||
png_set_text(png_ptr, info_ptr, text_ptr.data(), numMetaData);
|
||||
png_set_text(png_ptr, info_ptr, text_ptr.data(), static_cast<int>(numMetaData));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PNGLibrary::readMetaData(const png_structp png_ptr, png_infop info_ptr,
|
||||
VariantList& metaData)
|
||||
void PNGLibrary::readMetaData(
|
||||
const png_structp png_ptr, png_infop info_ptr, // NOLINT
|
||||
VariantList& metaData)
|
||||
{
|
||||
png_textp text_ptr;
|
||||
int numMetaData = 0;
|
||||
png_textp text_ptr{nullptr};
|
||||
int numMetaData{0};
|
||||
|
||||
png_get_text(png_ptr, info_ptr, &text_ptr, &numMetaData);
|
||||
|
||||
|
@ -464,33 +467,37 @@ void PNGLibrary::readMetaData(const png_structp png_ptr, png_infop info_ptr,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PNGLibrary::png_read_data(const png_structp ctx, png_bytep area, png_size_t size)
|
||||
void PNGLibrary::png_read_data(const png_structp ctx, // NOLINT
|
||||
png_bytep area, png_size_t size)
|
||||
{
|
||||
(static_cast<std::ifstream*>(png_get_io_ptr(ctx)))->read(
|
||||
reinterpret_cast<char *>(area), size);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PNGLibrary::png_write_data(const png_structp ctx, png_bytep area, png_size_t size)
|
||||
void PNGLibrary::png_write_data(const png_structp ctx, // NOLINT
|
||||
png_bytep area, png_size_t size)
|
||||
{
|
||||
(static_cast<std::ofstream*>(png_get_io_ptr(ctx)))->write(
|
||||
reinterpret_cast<const char *>(area), size);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PNGLibrary::png_io_flush(const png_structp ctx)
|
||||
void PNGLibrary::png_io_flush(const png_structp ctx) // NOLINT
|
||||
{
|
||||
(static_cast<std::ofstream*>(png_get_io_ptr(ctx)))->flush();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PNGLibrary::png_user_warn(const png_structp ctx, png_const_charp str)
|
||||
void PNGLibrary::png_user_warn(const png_structp ctx, // NOLINT
|
||||
png_const_charp str)
|
||||
{
|
||||
throw runtime_error(string("PNGLibrary warning: ") + str);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PNGLibrary::png_user_error(const png_structp ctx, png_const_charp str)
|
||||
void PNGLibrary::png_user_error(const png_structp ctx, // NOLINT
|
||||
png_const_charp str)
|
||||
{
|
||||
throw runtime_error(string("PNGLibrary error: ") + str);
|
||||
}
|
||||
|
|
|
@ -152,7 +152,7 @@ class PNGLibrary
|
|||
@param iwidth The width of the PNG image
|
||||
@param iheight The height of the PNG image
|
||||
*/
|
||||
bool allocateStorage(png_uint_32 iwidth, png_uint_32 iheight);
|
||||
bool allocateStorage(size_t iwidth, size_t iheight);
|
||||
|
||||
/** The actual method which saves a PNG image.
|
||||
|
||||
|
@ -163,7 +163,7 @@ class PNGLibrary
|
|||
@param metaData The meta data to add to the PNG image
|
||||
*/
|
||||
void saveImageToDisk(std::ofstream& out, const vector<png_bytep>& rows,
|
||||
png_uint_32 width, png_uint_32 height,
|
||||
size_t width, size_t height,
|
||||
const VariantList& metaData);
|
||||
|
||||
/**
|
||||
|
|
|
@ -389,7 +389,7 @@ PaletteArray PaletteHandler::adjustedPalette(const PaletteArray& palette)
|
|||
// Fill the odd numbered palette entries with gray values (calculated
|
||||
// using the standard RGB -> grayscale conversion formula)
|
||||
// Used for PAL color-loss data and 'greying out' the frame in the debugger.
|
||||
const uInt8 lum = static_cast<uInt8>((r * PR) + (g * PG) + (b * PB));
|
||||
const auto lum = static_cast<uInt8>((r * PR) + (g * PG) + (b * PB));
|
||||
|
||||
destPalette[i + 1] = (lum << 16) + (lum << 8) + lum;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace {
|
|||
}
|
||||
|
||||
EventMode eventModeFromJsonName(const string& name) {
|
||||
EventMode result;
|
||||
EventMode result{};
|
||||
|
||||
from_json(json(name), result);
|
||||
|
||||
|
@ -120,7 +120,7 @@ json PhysicalJoystick::convertLegacyMapping(const string& mapping, const string&
|
|||
|
||||
while (getline(buf, map, MODE_DELIM))
|
||||
{
|
||||
int mode;
|
||||
int mode{0};
|
||||
|
||||
// Get event mode
|
||||
std::replace(map.begin(), map.end(), '|', ' ');
|
||||
|
@ -158,7 +158,7 @@ void PhysicalJoystick::getValues(const string& list, IntArray& map) const
|
|||
map.clear();
|
||||
istringstream buf(list);
|
||||
|
||||
int value;
|
||||
int value{0};
|
||||
buf >> value; // we don't need to know the # of items at this point
|
||||
while(buf >> value)
|
||||
map.push_back(value);
|
||||
|
|
|
@ -146,7 +146,7 @@ bool RewindManager::addState(const string& message, bool timeMachine)
|
|||
uInt32 RewindManager::rewindStates(uInt32 numStates)
|
||||
{
|
||||
const uInt64 startCycles = myOSystem.console().tia().cycles();
|
||||
uInt32 i;
|
||||
uInt32 i{0};
|
||||
string message;
|
||||
|
||||
for(i = 0; i < numStates; ++i)
|
||||
|
@ -186,7 +186,7 @@ uInt32 RewindManager::rewindStates(uInt32 numStates)
|
|||
uInt32 RewindManager::unwindStates(uInt32 numStates)
|
||||
{
|
||||
const uInt64 startCycles = myOSystem.console().tia().cycles();
|
||||
uInt32 i;
|
||||
uInt32 i{0};
|
||||
string message;
|
||||
|
||||
for(i = 0; i < numStates; ++i)
|
||||
|
@ -256,7 +256,7 @@ string RewindManager::saveAllStates()
|
|||
{
|
||||
RewindState& state = myStateList.current();
|
||||
Serializer& s = state.data;
|
||||
const uInt32 stateSize = static_cast<uInt32>(s.size());
|
||||
const auto stateSize = static_cast<uInt32>(s.size());
|
||||
|
||||
out.putInt(stateSize);
|
||||
|
||||
|
@ -354,7 +354,7 @@ void RewindManager::compressStates()
|
|||
double maxError = 1.5;
|
||||
uInt32 idx = myStateList.size() - 2;
|
||||
// in case maxError is <= 1.5 remove first state by default:
|
||||
Common::LinkedObjectPool<RewindState>::const_iter removeIter = myStateList.first();
|
||||
auto removeIter = myStateList.first();
|
||||
/*if(myUncompressed < mySize)
|
||||
// if compression is enabled, the first but one state is removed by default:
|
||||
removeIter++;*/
|
||||
|
@ -406,35 +406,35 @@ string RewindManager::loadState(Int64 startCycles, uInt32 numStates)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string RewindManager::getUnitString(Int64 cycles)
|
||||
{
|
||||
constexpr Int32 NTSC_FREQ = 1193182; // ~76*262*60
|
||||
constexpr Int32 PAL_FREQ = 1182298; // ~76*312*50
|
||||
const Int32 scanlines = std::max<Int32>(
|
||||
constexpr size_t NTSC_FREQ = 1193182; // ~76*262*60
|
||||
constexpr size_t PAL_FREQ = 1182298; // ~76*312*50
|
||||
const size_t scanlines = std::max<size_t>(
|
||||
myOSystem.console().tia().scanlinesLastFrame(), 240);
|
||||
const bool isNTSC = scanlines <= 287;
|
||||
const Int32 freq = isNTSC ? NTSC_FREQ : PAL_FREQ; // = cycles/second
|
||||
const size_t freq = isNTSC ? NTSC_FREQ : PAL_FREQ; // = cycles/second
|
||||
|
||||
constexpr Int32 NUM_UNITS = 5;
|
||||
constexpr size_t NUM_UNITS = 5;
|
||||
const std::array<string, NUM_UNITS> UNIT_NAMES = {
|
||||
"cycle", "scanline", "frame", "second", "minute"
|
||||
};
|
||||
const std::array<Int64, NUM_UNITS+1> UNIT_CYCLES = {
|
||||
const std::array<uInt64, NUM_UNITS+1> UNIT_CYCLES = {
|
||||
1, 76, 76 * scanlines, freq, freq * 60, Int64{1} << 62
|
||||
};
|
||||
|
||||
stringstream result;
|
||||
Int32 i = 0;
|
||||
size_t i = 0;
|
||||
|
||||
cycles = std::abs(cycles);
|
||||
const uInt64 u_cycles = std::abs(cycles);
|
||||
|
||||
for(i = 0; i < NUM_UNITS - 1; ++i)
|
||||
{
|
||||
// use the lower unit up to twice the nextCycles unit, except for an exact match of the nextCycles unit
|
||||
// TODO: does the latter make sense, e.g. for ROMs with changing scanlines?
|
||||
if(cycles == 0 || (cycles < UNIT_CYCLES[i + 1] * 2 && cycles % UNIT_CYCLES[i + 1] != 0))
|
||||
if(u_cycles == 0 || (u_cycles < UNIT_CYCLES[i + 1] * 2 && u_cycles % UNIT_CYCLES[i + 1] != 0))
|
||||
break;
|
||||
}
|
||||
result << (cycles / UNIT_CYCLES[i]) << " " << UNIT_NAMES[i];
|
||||
if(cycles / UNIT_CYCLES[i] != 1)
|
||||
result << (u_cycles / UNIT_CYCLES[i]) << " " << UNIT_NAMES[i];
|
||||
if(u_cycles / UNIT_CYCLES[i] != 1)
|
||||
result << "s";
|
||||
|
||||
return result.str();
|
||||
|
@ -467,6 +467,7 @@ IntArray RewindManager::cyclesList() const
|
|||
IntArray arr;
|
||||
|
||||
const uInt64 firstCycle = getFirstCycles();
|
||||
// NOLINTNEXTLINE (TODO: convert myStateList to use range-for)
|
||||
for(auto it = myStateList.cbegin(); it != myStateList.cend(); ++it)
|
||||
arr.push_back(uInt32(it->cycles - firstCycle));
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ SoundSDL2::SoundSDL2(OSystem& osystem, AudioSettings& audioSettings)
|
|||
return;
|
||||
}
|
||||
|
||||
queryHardware(myDevices);
|
||||
queryHardware(myDevices); // NOLINT
|
||||
|
||||
SDL_zero(myHardwareSpec);
|
||||
if(!openDevice())
|
||||
|
@ -387,7 +387,7 @@ void SoundSDL2::initResampler()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SoundSDL2::callback(void* udata, uInt8* stream, int len)
|
||||
{
|
||||
SoundSDL2* self = static_cast<SoundSDL2*>(udata);
|
||||
auto* self = static_cast<SoundSDL2*>(udata);
|
||||
|
||||
if (self->myAudioQueue)
|
||||
self->processFragment(reinterpret_cast<float*>(stream), len >> 2);
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace {
|
|||
|
||||
std::array<char, 100> formattedTime;
|
||||
formattedTime.fill(0);
|
||||
std::strftime(formattedTime.data(), 99, "%H:%M:%S", &now);
|
||||
std::ignore = std::strftime(formattedTime.data(), 99, "%H:%M:%S", &now);
|
||||
|
||||
return formattedTime.data();
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ StateManager::StateManager(OSystem& osystem)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
StateManager::~StateManager()
|
||||
StateManager::~StateManager() // NOLINT (we need an empty d'tor)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ TimerManager::TimerId TimerManager::addTimer(
|
|||
Duration(msPeriod), func));
|
||||
|
||||
// Insert a reference to the Timer into ordering queue
|
||||
const Queue::iterator place = queue.emplace(iter.first->second);
|
||||
const auto place = queue.emplace(iter.first->second);
|
||||
|
||||
// We need to notify the timer thread only if we inserted
|
||||
// this timer into the front of the timer queue
|
||||
|
@ -204,7 +204,7 @@ bool TimerManager::destroy_impl(ScopedLock& lock, TimerMap::iterator i,
|
|||
timer.running = false;
|
||||
|
||||
// Assign a condition variable to this timer
|
||||
timer.waitCond.reset(new ConditionVar);
|
||||
timer.waitCond = std::make_unique<ConditionVar>();
|
||||
|
||||
// Block until the callback is finished
|
||||
if (std::this_thread::get_id() != worker.get_id())
|
||||
|
|
|
@ -156,18 +156,18 @@ string ZipHandler::errorMessage(ZipError err)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
ZipHandler::ZipFilePtr ZipHandler::findCached(const string& filename)
|
||||
{
|
||||
for(size_t cachenum = 0; cachenum < myZipCache.size(); ++cachenum)
|
||||
for(auto& cache: myZipCache)
|
||||
{
|
||||
// If we have a valid entry and it matches our filename,
|
||||
// use it and remove from the cache
|
||||
if(myZipCache[cachenum] && (filename == myZipCache[cachenum]->myFilename))
|
||||
if(cache && (filename == cache->myFilename))
|
||||
{
|
||||
ZipFilePtr result;
|
||||
std::swap(myZipCache[cachenum], result);
|
||||
std::swap(cache, result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return ZipFilePtr();
|
||||
return {};
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -180,7 +180,7 @@ void ZipHandler::addToCache()
|
|||
myZip->close();
|
||||
|
||||
// Find the first nullptr entry in the cache
|
||||
size_t cachenum;
|
||||
size_t cachenum{0};
|
||||
for(cachenum = 0; cachenum < myZipCache.size(); ++cachenum)
|
||||
if(myZipCache[cachenum] == nullptr)
|
||||
break;
|
||||
|
|
|
@ -76,7 +76,8 @@ LanczosResampler::LanczosResampler(
|
|||
myHighPassR{HIGH_PASS_CUT_OFF, float(formatFrom.sampleRate)},
|
||||
myHighPass{HIGH_PASS_CUT_OFF, float(formatFrom.sampleRate)}
|
||||
{
|
||||
myPrecomputedKernels = make_unique<float[]>(myPrecomputedKernelCount * myKernelSize);
|
||||
myPrecomputedKernels = make_unique<float[]>(
|
||||
static_cast<size_t>(myPrecomputedKernelCount) * myKernelSize);
|
||||
|
||||
if (myFormatFrom.stereo)
|
||||
{
|
||||
|
@ -96,7 +97,8 @@ void LanczosResampler::precomputeKernels()
|
|||
uInt32 timeIndex = 0;
|
||||
|
||||
for (uInt32 i = 0; i < myPrecomputedKernelCount; ++i) {
|
||||
float* kernel = myPrecomputedKernels.get() + myKernelSize * i;
|
||||
float* kernel = myPrecomputedKernels.get() +
|
||||
static_cast<size_t>(myKernelSize) * i;
|
||||
// The kernel is normalized such to be evaluate on time * formatFrom.sampleRate
|
||||
const float center =
|
||||
static_cast<float>(timeIndex) / static_cast<float>(myFormatTo.sampleRate);
|
||||
|
@ -140,10 +142,11 @@ void LanczosResampler::fillFragment(float* fragment, uInt32 length)
|
|||
return;
|
||||
}
|
||||
|
||||
const uInt32 outputSamples = myFormatTo.stereo ? (length >> 1) : length;
|
||||
const size_t outputSamples = myFormatTo.stereo ? (length >> 1) : length;
|
||||
|
||||
for (uInt32 i = 0; i < outputSamples; ++i) {
|
||||
const float* kernel = myPrecomputedKernels.get() + (myCurrentKernelIndex * myKernelSize);
|
||||
for (size_t i = 0; i < outputSamples; ++i) {
|
||||
const float* kernel = myPrecomputedKernels.get() +
|
||||
static_cast<size_t>(myCurrentKernelIndex) * myKernelSize;
|
||||
myCurrentKernelIndex = (myCurrentKernelIndex + 1) % myPrecomputedKernelCount;
|
||||
|
||||
if (myFormatFrom.stereo) {
|
||||
|
@ -180,11 +183,16 @@ inline void LanczosResampler::shiftSamples(uInt32 samplesToShift)
|
|||
{
|
||||
while (samplesToShift-- > 0) {
|
||||
if (myFormatFrom.stereo) {
|
||||
myBufferL->shift(myHighPassL.apply(myCurrentFragment[2*myFragmentIndex] / static_cast<float>(0x7fff)));
|
||||
myBufferR->shift(myHighPassR.apply(myCurrentFragment[2*myFragmentIndex + 1] / static_cast<float>(0x7fff)));
|
||||
myBufferL->shift(myHighPassL.apply(
|
||||
myCurrentFragment[2 * static_cast<size_t>(myFragmentIndex)] /
|
||||
static_cast<float>(0x7fff)));
|
||||
myBufferR->shift(myHighPassR.apply(
|
||||
myCurrentFragment[2 * static_cast<size_t>(myFragmentIndex) + 1] /
|
||||
static_cast<float>(0x7fff)));
|
||||
}
|
||||
else
|
||||
myBuffer->shift(myHighPass.apply(myCurrentFragment[myFragmentIndex] / static_cast<float>(0x7fff)));
|
||||
myBuffer->shift(myHighPass.apply(myCurrentFragment[myFragmentIndex] /
|
||||
static_cast<float>(0x7fff)));
|
||||
|
||||
++myFragmentIndex;
|
||||
|
||||
|
|
|
@ -44,13 +44,17 @@ void SimpleResampler::fillFragment(float* fragment, uInt32 length)
|
|||
return;
|
||||
}
|
||||
|
||||
const uInt32 outputSamples = myFormatTo.stereo ? (length >> 1) : length;
|
||||
const size_t outputSamples = myFormatTo.stereo ? (length >> 1) : length;
|
||||
|
||||
// For the following math, remember that myTimeIndex = time * myFormatFrom.sampleRate * myFormatTo.sampleRate
|
||||
for (uInt32 i = 0; i < outputSamples; ++i) {
|
||||
for (size_t i = 0; i < outputSamples; ++i) {
|
||||
if (myFormatFrom.stereo) {
|
||||
const float sampleL = static_cast<float>(myCurrentFragment[2*myFragmentIndex]) / static_cast<float>(0x7fff);
|
||||
const float sampleR = static_cast<float>(myCurrentFragment[2*myFragmentIndex + 1]) / static_cast<float>(0x7fff);
|
||||
const float sampleL = static_cast<float>(
|
||||
myCurrentFragment[2*static_cast<size_t>(myFragmentIndex)]) /
|
||||
static_cast<float>(0x7fff);
|
||||
const float sampleR = static_cast<float>(
|
||||
myCurrentFragment[2*static_cast<size_t>(myFragmentIndex) + 1]) /
|
||||
static_cast<float>(0x7fff);
|
||||
|
||||
if (myFormatTo.stereo) {
|
||||
fragment[2*i] = sampleL;
|
||||
|
@ -59,7 +63,8 @@ void SimpleResampler::fillFragment(float* fragment, uInt32 length)
|
|||
else
|
||||
fragment[i] = (sampleL + sampleR) / 2.F;
|
||||
} else {
|
||||
const float sample = static_cast<float>(myCurrentFragment[myFragmentIndex] / static_cast<float>(0x7fff));
|
||||
const auto sample = static_cast<float>(myCurrentFragment[myFragmentIndex] /
|
||||
static_cast<float>(0x7fff));
|
||||
|
||||
if (myFormatTo.stereo)
|
||||
fragment[2*i] = fragment[2*i + 1] = sample;
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace {
|
|||
{}
|
||||
|
||||
std::map<string, Variant> load() override {
|
||||
if (!myKvr.has(myKey)) return std::map<string, Variant>();
|
||||
if (!myKvr.has(myKey)) return {};
|
||||
|
||||
Variant serialized;
|
||||
myKvr.get(myKey, serialized);
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
|
||||
#include "repository/CompositeKeyValueRepository.hxx"
|
||||
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool CompositeKeyValueRepositoryAtomic::get(const string& key1, const string& key2, Variant& value)
|
||||
{
|
||||
|
@ -28,8 +27,7 @@ bool CompositeKeyValueRepositoryAtomic::get(const string& key1, const string& ke
|
|||
shared_ptr<KeyValueRepositoryAtomic> CompositeKeyValueRepositoryAtomic::getAtomic(const string& key)
|
||||
{
|
||||
auto repo = get(key);
|
||||
|
||||
return shared_ptr<KeyValueRepositoryAtomic>(repo, repo->atomic());
|
||||
return {repo, repo->atomic()};
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -55,14 +55,16 @@ std::map<string, Variant> KeyValueRepositoryJsonFile::load(istream& in)
|
|||
return map;
|
||||
}
|
||||
catch (const json::exception& err) {
|
||||
Logger::error("KeyValueRepositoryJsonFile: error during deserialization: " + string(err.what()));
|
||||
Logger::error("KeyValueRepositoryJsonFile: error during deserialization: " +
|
||||
string(err.what()));
|
||||
|
||||
return std::map<string, Variant>();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool KeyValueRepositoryJsonFile::save(ostream& out, const std::map<string, Variant>& values)
|
||||
bool KeyValueRepositoryJsonFile::save(ostream& out,
|
||||
const std::map<string, Variant>& values)
|
||||
{
|
||||
try {
|
||||
json serializedJson = json::object();
|
||||
|
@ -75,7 +77,8 @@ bool KeyValueRepositoryJsonFile::save(ostream& out, const std::map<string, Varia
|
|||
return true;
|
||||
}
|
||||
catch (const json::exception& err) {
|
||||
Logger::error("KeyValueRepositoryJsonFile: error during serialization: " + string(err.what()));
|
||||
Logger::error("KeyValueRepositoryJsonFile: error during serialization: " +
|
||||
string(err.what()));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace {
|
|||
string readQuotedString(istream& in)
|
||||
{
|
||||
// Read characters until we see a quote
|
||||
char c;
|
||||
char c{0};
|
||||
while(in.get(c))
|
||||
if(c == '"')
|
||||
break;
|
||||
|
@ -49,24 +49,23 @@ namespace {
|
|||
void writeQuotedString(ostream& out, const string& s)
|
||||
{
|
||||
out.put('"');
|
||||
for(uInt32 i = 0; i < s.length(); ++i)
|
||||
for(auto c: s)
|
||||
{
|
||||
if(s[i] == '\\')
|
||||
if(c == '\\')
|
||||
{
|
||||
out.put('\\');
|
||||
out.put('\\');
|
||||
}
|
||||
else if(s[i] == '\"')
|
||||
else if(c == '\"')
|
||||
{
|
||||
out.put('\\');
|
||||
out.put('"');
|
||||
}
|
||||
else
|
||||
out.put(s[i]);
|
||||
out.put(c);
|
||||
}
|
||||
out.put('"');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -109,7 +108,8 @@ std::map<string, Variant> KeyValueRepositoryPropertyFile::load(istream& in)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool KeyValueRepositoryPropertyFile::save(ostream& out, const std::map<string, Variant>& values)
|
||||
bool KeyValueRepositoryPropertyFile::save(ostream& out,
|
||||
const std::map<string, Variant>& values)
|
||||
{
|
||||
for (auto& [key, value]: values) {
|
||||
writeQuotedString(out, key);
|
||||
|
|
|
@ -51,7 +51,7 @@ void SqliteDatabase::initialize()
|
|||
if (!dbInitialized && tries == 1) {
|
||||
Logger::info("sqlite DB " + myDatabaseFile + " seems to be corrupt, removing and retrying...");
|
||||
|
||||
remove(myDatabaseFile.c_str());
|
||||
std::ignore = remove(myDatabaseFile.c_str());
|
||||
if (myHandle) sqlite3_close_v2(myHandle);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,8 @@ SqliteStatement::~SqliteStatement()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
SqliteStatement& SqliteStatement::bind(int index, const string& value)
|
||||
{
|
||||
if (sqlite3_bind_text(myStmt, index, value.c_str(), -1, SQLITE_TRANSIENT) != SQLITE_OK)
|
||||
if (sqlite3_bind_text(myStmt, index, value.c_str(), -1,
|
||||
SQLITE_TRANSIENT) != SQLITE_OK) // NOLINT (performance-no-int-to-ptr)
|
||||
throw SqliteError(myHandle);
|
||||
|
||||
return *this;
|
||||
|
|
|
@ -201,7 +201,7 @@ void StellaDb::importOldPropset(const FSNode& node)
|
|||
void StellaDb::migrate()
|
||||
{
|
||||
const Int32 version = myDb->getUserVersion();
|
||||
switch (version) {
|
||||
switch (version) { // NOLINT (could be written as IF/ELSE)
|
||||
case 1:
|
||||
return;
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ void BilinearBlitter::recreateTexturesIfNecessary()
|
|||
}
|
||||
|
||||
if (myAttributes.blending) {
|
||||
const uInt8 blendAlpha = static_cast<uInt8>(myAttributes.blendalpha * 2.55);
|
||||
const auto blendAlpha = static_cast<uInt8>(myAttributes.blendalpha * 2.55);
|
||||
|
||||
std::array<SDL_Texture*, 2> textures = { myTexture, mySecondaryTexture };
|
||||
for (SDL_Texture* texture: textures) {
|
||||
|
|
|
@ -181,7 +181,7 @@ void QisBlitter::recreateTexturesIfNecessary()
|
|||
}
|
||||
|
||||
if (myAttributes.blending) {
|
||||
const uInt8 blendAlpha = static_cast<uInt8>(myAttributes.blendalpha * 2.55);
|
||||
const auto blendAlpha = static_cast<uInt8>(myAttributes.blendalpha * 2.55);
|
||||
|
||||
std::array<SDL_Texture*, 3> textures = {
|
||||
mySrcTexture, myIntermediateTexture, mySecondaryIntermedateTexture
|
||||
|
|
|
@ -42,11 +42,11 @@ void AtariNTSC::initialize(const Setup& setup)
|
|||
void AtariNTSC::setPalette(const PaletteArray& palette)
|
||||
{
|
||||
uInt8* ptr = myRGBPalette.data();
|
||||
for(size_t i = 0; i < palette.size(); ++i)
|
||||
for(auto p: palette)
|
||||
{
|
||||
*ptr++ = (palette[i] >> 16) & 0xff;
|
||||
*ptr++ = (palette[i] >> 8) & 0xff;
|
||||
*ptr++ = palette[i] & 0xff;
|
||||
*ptr++ = (p >> 16) & 0xff;
|
||||
*ptr++ = (p >> 8) & 0xff;
|
||||
*ptr++ = p & 0xff;
|
||||
}
|
||||
generateKernels();
|
||||
}
|
||||
|
@ -60,10 +60,10 @@ void AtariNTSC::generateKernels()
|
|||
const float r = (*ptr++) / 255.F * rgb_unit + rgb_offset,
|
||||
g = (*ptr++) / 255.F * rgb_unit + rgb_offset,
|
||||
b = (*ptr++) / 255.F * rgb_unit + rgb_offset;
|
||||
float y, i, q; RGB_TO_YIQ( r, g, b, y, i, q );
|
||||
float y, i, q; RGB_TO_YIQ( r, g, b, y, i, q ); // NOLINT
|
||||
|
||||
// Generate kernel
|
||||
int ir, ig, ib; YIQ_TO_RGB( y, i, q, myImpl.to_rgb.data(), ir, ig, ib );
|
||||
int ir, ig, ib; YIQ_TO_RGB( y, i, q, myImpl.to_rgb.data(), ir, ig, ib ); //NOLINT
|
||||
const uInt32 rgb = PACK_RGB( ir, ig, ib );
|
||||
|
||||
uInt32* kernel = myColorTable[entry].data();
|
||||
|
@ -123,7 +123,7 @@ void AtariNTSC::render(const uInt8* atari_in, const uInt32 in_width,
|
|||
|
||||
// Copy phosphor values into out buffer
|
||||
if(rgb_in != nullptr)
|
||||
memcpy(rgb_out, rgb_in, in_height * out_pitch);
|
||||
memcpy(rgb_out, rgb_in, static_cast<size_t>(in_height) * out_pitch);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -134,8 +134,8 @@ void AtariNTSC::renderThread(const uInt8* atari_in, const uInt32 in_width,
|
|||
// Adapt parameters to thread number
|
||||
const uInt32 yStart = in_height * threadNum / numThreads;
|
||||
const uInt32 yEnd = in_height * (threadNum + 1) / numThreads;
|
||||
atari_in += in_width * yStart;
|
||||
rgb_out = static_cast<char*>(rgb_out) + out_pitch * yStart;
|
||||
atari_in += static_cast<size_t>(in_width) * yStart;
|
||||
rgb_out = static_cast<char*>(rgb_out) + static_cast<size_t>(out_pitch) * yStart;
|
||||
|
||||
uInt32 const chunk_count = (in_width - 1) / PIXEL_in_chunk;
|
||||
|
||||
|
@ -143,7 +143,7 @@ void AtariNTSC::renderThread(const uInt8* atari_in, const uInt32 in_width,
|
|||
{
|
||||
const uInt8* line_in = atari_in;
|
||||
ATARI_NTSC_BEGIN_ROW(NTSC_black, line_in[0]);
|
||||
uInt32* restrict line_out = static_cast<uInt32*>(rgb_out);
|
||||
auto* restrict line_out = static_cast<uInt32*>(rgb_out);
|
||||
++line_in;
|
||||
|
||||
// shift right by 2 pixel
|
||||
|
@ -210,8 +210,8 @@ void AtariNTSC::renderWithPhosphorThread(const uInt8* atari_in, const uInt32 in_
|
|||
const uInt32 yEnd = in_height * (threadNum + 1) / numThreads;
|
||||
uInt32 bufofs = AtariNTSC::outWidth(in_width) * yStart;
|
||||
const uInt32* out = static_cast<uInt32*>(rgb_out);
|
||||
atari_in += in_width * yStart;
|
||||
rgb_out = static_cast<char*>(rgb_out) + out_pitch * yStart;
|
||||
atari_in += static_cast<size_t>(in_width) * yStart;
|
||||
rgb_out = static_cast<char*>(rgb_out) + static_cast<size_t>(out_pitch) * yStart;
|
||||
|
||||
uInt32 const chunk_count = (in_width - 1) / PIXEL_in_chunk;
|
||||
|
||||
|
@ -219,7 +219,7 @@ void AtariNTSC::renderWithPhosphorThread(const uInt8* atari_in, const uInt32 in_
|
|||
{
|
||||
const uInt8* line_in = atari_in;
|
||||
ATARI_NTSC_BEGIN_ROW(NTSC_black, line_in[0]);
|
||||
uInt32* restrict line_out = static_cast<uInt32*>(rgb_out);
|
||||
auto* restrict line_out = static_cast<uInt32*>(rgb_out);
|
||||
++line_in;
|
||||
|
||||
// shift right by 2 pixel
|
||||
|
@ -335,9 +335,8 @@ void AtariNTSC::init(init_t& impl, const Setup& setup)
|
|||
/* setup decoder matricies */
|
||||
{
|
||||
float* out = impl.to_rgb.data();
|
||||
int n;
|
||||
|
||||
n = burst_count;
|
||||
int n = burst_count;
|
||||
do
|
||||
{
|
||||
float const* in = default_decoder.data();
|
||||
|
@ -355,14 +354,14 @@ void AtariNTSC::init(init_t& impl, const Setup& setup)
|
|||
ROTATE_IQ( s, c, 0.866025F, -0.5F ); /* +120 degrees */
|
||||
#endif
|
||||
}
|
||||
while ( --n );
|
||||
while (--n);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void AtariNTSC::initFilters(init_t& impl, const Setup& setup)
|
||||
{
|
||||
std::array<float, kernel_size * 2> kernels{0};
|
||||
std::array<float, static_cast<size_t>(kernel_size) * 2> kernels{0};
|
||||
|
||||
/* generate luma (y) filter using sinc kernel */
|
||||
{
|
||||
|
@ -433,12 +432,11 @@ void AtariNTSC::initFilters(init_t& impl, const Setup& setup)
|
|||
for ( int i = 0; i < 2; i++ )
|
||||
{
|
||||
float sum = 0;
|
||||
int x;
|
||||
for ( x = i; x < kernel_size; x += 2 )
|
||||
for ( int x = i; x < kernel_size; x += 2 )
|
||||
sum += kernels [x];
|
||||
|
||||
sum = 1.0F / sum;
|
||||
for ( x = i; x < kernel_size; x += 2 )
|
||||
for ( int x = i; x < kernel_size; x += 2 )
|
||||
{
|
||||
kernels [x] *= sum;
|
||||
}
|
||||
|
@ -506,12 +504,13 @@ void AtariNTSC::genKernel(init_t& impl, float y, float i, float q, uInt32* out)
|
|||
const float fq = k[1]*qc1 + k[3]*qc3;
|
||||
const float fy = k[kernel_size+0]*yc0 + k[kernel_size+1]*yc1 +
|
||||
k[kernel_size+2]*yc2 + k[kernel_size+3]*yc3 + rgb_offset;
|
||||
if ( k < &impl.kernel [kernel_size * 2 * (rescale_out - 1)] )
|
||||
if ( k < &impl.kernel [static_cast<size_t>(kernel_size) * 2 *
|
||||
(rescale_out - 1)] )
|
||||
k += kernel_size * 2 - 1;
|
||||
else
|
||||
k -= kernel_size * 2 * (rescale_out - 1) + 2;
|
||||
{
|
||||
int r, g, b; YIQ_TO_RGB( fy, fi, fq, to_rgb, r, g, b );
|
||||
int r, g, b; YIQ_TO_RGB( fy, fi, fq, to_rgb, r, g, b ); // NOLINT
|
||||
*out++ = PACK_RGB( r, g, b ) - rgb_bias;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -140,8 +140,8 @@ CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem)
|
|||
const DebuggerState& CartDebug::getState()
|
||||
{
|
||||
myState.ram.clear();
|
||||
for(uInt32 i = 0; i < myState.rport.size(); ++i)
|
||||
myState.ram.push_back(myDebugger.peek(myState.rport[i]));
|
||||
for(auto addr: myState.rport)
|
||||
myState.ram.push_back(myDebugger.peek(addr));
|
||||
|
||||
if(myDebugWidget)
|
||||
myState.bank = myDebugWidget->bankState();
|
||||
|
@ -153,8 +153,8 @@ const DebuggerState& CartDebug::getState()
|
|||
void CartDebug::saveOldState()
|
||||
{
|
||||
myOldState.ram.clear();
|
||||
for(uInt32 i = 0; i < myOldState.rport.size(); ++i)
|
||||
myOldState.ram.push_back(myDebugger.peek(myOldState.rport[i]));
|
||||
for(auto addr: myOldState.rport)
|
||||
myOldState.ram.push_back(myDebugger.peek(addr));
|
||||
|
||||
if(myDebugWidget)
|
||||
{
|
||||
|
@ -209,8 +209,8 @@ string CartDebug::toString()
|
|||
return DebuggerParser::red("invalid base, this is a BUG");
|
||||
}
|
||||
|
||||
const CartState& state = static_cast<const CartState&>(getState());
|
||||
const CartState& oldstate = static_cast<const CartState&>(getOldState());
|
||||
const auto& state = static_cast<const CartState&>(getState());
|
||||
const auto& oldstate = static_cast<const CartState&>(getOldState());
|
||||
|
||||
uInt32 curraddr = 0, bytesSoFar = 0;
|
||||
for(uInt32 i = 0; i < state.ram.size(); i += bytesPerLine, bytesSoFar += bytesPerLine)
|
||||
|
@ -221,7 +221,7 @@ string CartDebug::toString()
|
|||
if(state.rport[i] - curraddr > bytesPerLine || bytesSoFar >= 256)
|
||||
{
|
||||
char port[37]; // NOLINT (convert to stringstream)
|
||||
std::snprintf(port, 36, "%04x: (rport = %04x, wport = %04x)\n",
|
||||
std::ignore = std::snprintf(port, 36, "%04x: (rport = %04x, wport = %04x)\n",
|
||||
state.rport[i], state.rport[i], state.wport[i]);
|
||||
port[2] = port[3] = 'x';
|
||||
buf << DebuggerParser::red(port);
|
||||
|
@ -260,14 +260,10 @@ bool CartDebug::disassembleAddr(uInt16 address, bool force)
|
|||
const int bank = cart.getSegmentBank(seg);
|
||||
Disassembly disassembly;
|
||||
AddrToLineList addrToLineList;
|
||||
uInt16 segAddress;
|
||||
BankInfo& info = myBankInfo[bank];
|
||||
|
||||
info.offset = cart.bankOrigin(bank) | cart.bankSize() * seg;
|
||||
if(bank == addrBank)
|
||||
segAddress = address;
|
||||
else
|
||||
segAddress = info.offset;
|
||||
const uInt16 segAddress = bank == addrBank ? address : info.offset;
|
||||
// Disassemble segment
|
||||
const bool newChanged = disassemble(bank, segAddress, disassembly, addrToLineList, force);
|
||||
|
||||
|
@ -388,7 +384,7 @@ bool CartDebug::fillDisassemblyList(BankInfo& info, Disassembly& disassembly,
|
|||
|
||||
disassembly.fieldwidth = 24 + myLabelLength;
|
||||
// line offset must be set before calling DiStella!
|
||||
uInt32 lineOfs = static_cast<uInt32>(myDisassembly.list.size());
|
||||
auto lineOfs = static_cast<uInt32>(myDisassembly.list.size());
|
||||
DiStella distella(*this, disassembly.list, info, DiStella::settings,
|
||||
myDisLabels, myDisDirectives, myReserved);
|
||||
|
||||
|
@ -569,7 +565,7 @@ bool CartDebug::addDirective(Device::AccessType type,
|
|||
// Can we also merge with the previous range (if any)?
|
||||
if(i != list.begin())
|
||||
{
|
||||
DirectiveList::iterator p = i;
|
||||
auto p = i;
|
||||
--p;
|
||||
if(p->type == tag.type && p->end + 1 == tag.start)
|
||||
{
|
||||
|
@ -1164,9 +1160,9 @@ string CartDebug::saveDisassembly(string path)
|
|||
origin += static_cast<uInt32>(info.size);
|
||||
|
||||
// Format in 'distella' style
|
||||
for(uInt32 i = 0; i < disasm.list.size(); ++i)
|
||||
for(const auto& dt: disasm.list)
|
||||
{
|
||||
const DisassemblyTag& tag = disasm.list[i];
|
||||
const DisassemblyTag& tag = dt;
|
||||
|
||||
// Add label (if any)
|
||||
if(tag.label != "")
|
||||
|
|
|
@ -236,7 +236,7 @@ int DebuggerParser::decipher_arg(const string& str)
|
|||
}
|
||||
|
||||
// Special cases (registers):
|
||||
const CpuState& state = static_cast<const CpuState&>(debugger.cpuDebug().getState());
|
||||
const auto& state = static_cast<const CpuState&>(debugger.cpuDebug().getState());
|
||||
int result = 0;
|
||||
if(arg == "a" && str != "$a") result = state.A;
|
||||
else if(arg == "x") result = state.X;
|
||||
|
@ -488,7 +488,9 @@ bool DebuggerParser::validateArgs(int cmd)
|
|||
if(curArgInt != 2 && curArgInt != 10 && curArgInt != 16
|
||||
&& curArgStr != "hex" && curArgStr != "dec" && curArgStr != "bin")
|
||||
{
|
||||
commandResult.str(red("invalid base (must be #2, #10, #16, \"bin\", \"dec\", or \"hex\")"));
|
||||
commandResult.str(red(
|
||||
R"(invalid base (must be #2, #10, #16, "bin", "dec", or "hex"))"
|
||||
));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
@ -1640,8 +1642,8 @@ void DebuggerParser::executeListTraps()
|
|||
if (names.size() > 0)
|
||||
{
|
||||
bool trapFound = false, trapifFound = false;
|
||||
for(uInt32 i = 0; i < names.size(); ++i)
|
||||
if(names[i] == "")
|
||||
for(const auto& name: names)
|
||||
if(name == "")
|
||||
trapFound = true;
|
||||
else
|
||||
trapifFound = true;
|
||||
|
|
|
@ -123,7 +123,7 @@ void DiStella::disasm(uInt32 distart, int pass)
|
|||
// and this results into an access at e.g. 0xffff,
|
||||
// we have to fix the consequences here (ugly!).
|
||||
if(myPC == myAppData.end)
|
||||
goto FIX_LAST;
|
||||
goto FIX_LAST; // NOLINT
|
||||
|
||||
if(checkBits(myPC, Device::GFX | Device::PGFX,
|
||||
Device::CODE))
|
||||
|
@ -1038,7 +1038,7 @@ void DiStella::addEntry(Device::AccessType type)
|
|||
|
||||
// Only include addresses within the requested range
|
||||
if (tag.address < myAppData.start)
|
||||
goto DONE_WITH_ADD;
|
||||
goto DONE_WITH_ADD; // NOLINT
|
||||
|
||||
// Label (a user-defined label always overrides any auto-generated one)
|
||||
myDisasmBuf.seekg(5, std::ios::beg);
|
||||
|
|
|
@ -363,8 +363,8 @@ string RiotDebug::switchesString()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string RiotDebug::toString()
|
||||
{
|
||||
const RiotState& state = static_cast<const RiotState&>(getState());
|
||||
const RiotState& oldstate = static_cast<const RiotState&>(getOldState());
|
||||
const auto& state = static_cast<const RiotState&>(getState());
|
||||
const auto& oldstate = static_cast<const RiotState&>(getOldState());
|
||||
|
||||
ostringstream buf;
|
||||
buf << "280/SWCHA(R)=" << myDebugger.invIfChanged(state.SWCHA_R, oldstate.SWCHA_R)
|
||||
|
|
|
@ -1037,7 +1037,7 @@ string TIADebug::audFreq(uInt8 dist, uInt8 div)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string TIADebug::stringOnly(string value, bool changed)
|
||||
string TIADebug::stringOnly(const string& value, bool changed)
|
||||
{
|
||||
ostringstream buf;
|
||||
|
||||
|
@ -1051,7 +1051,8 @@ string TIADebug::stringOnly(string value, bool changed)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string TIADebug::decWithLabel(string label, uInt16 value, bool changed, uInt16 width)
|
||||
string TIADebug::decWithLabel(const string& label, uInt16 value,
|
||||
bool changed, uInt16 width)
|
||||
{
|
||||
ostringstream buf;
|
||||
|
||||
|
@ -1068,7 +1069,8 @@ string TIADebug::decWithLabel(string label, uInt16 value, bool changed, uInt16 w
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string TIADebug::hexWithLabel(string label, uInt16 value, bool changed, uInt16 width)
|
||||
string TIADebug::hexWithLabel(const string& label, uInt16 value,
|
||||
bool changed, uInt16 width)
|
||||
{
|
||||
ostringstream buf;
|
||||
|
||||
|
@ -1085,7 +1087,7 @@ string TIADebug::hexWithLabel(string label, uInt16 value, bool changed, uInt16 w
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string TIADebug::binWithLabel(string label, uInt16 value, bool changed)
|
||||
string TIADebug::binWithLabel(const string& label, uInt16 value, bool changed)
|
||||
{
|
||||
ostringstream buf;
|
||||
|
||||
|
@ -1102,13 +1104,16 @@ string TIADebug::binWithLabel(string label, uInt16 value, bool changed)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string TIADebug::boolWithLabel(string label, bool value, bool changed)
|
||||
string TIADebug::boolWithLabel(const string& label, bool value, bool changed)
|
||||
{
|
||||
ostringstream buf;
|
||||
|
||||
if(value)
|
||||
buf << "\177" << BSPF::toUpperCase(label) << "\177";
|
||||
{
|
||||
string l = label;
|
||||
buf << "\177" << BSPF::toUpperCase(l) << "\177";
|
||||
//return "+" + BSPF::toUpperCase(label);
|
||||
}
|
||||
else
|
||||
buf << label;
|
||||
//return "-" + BSPF::toLowerCase(label);
|
||||
|
@ -1174,11 +1179,11 @@ string TIADebug::toString()
|
|||
// TODO: strobes? WSYNC RSYNC RESP0/1 RESM0/1 RESBL HMOVE HMCLR CXCLR
|
||||
|
||||
RiotDebug& riot = myDebugger.riotDebug();
|
||||
const RiotState& riotState = static_cast<const RiotState&>(riot.getState());
|
||||
const RiotState& oldRiotState = static_cast<const RiotState&>(riot.getOldState());
|
||||
const auto& riotState = static_cast<const RiotState&>(riot.getState());
|
||||
const auto& oldRiotState = static_cast<const RiotState&>(riot.getOldState());
|
||||
|
||||
const TiaState& state = static_cast<const TiaState&>(getState());
|
||||
const TiaState& oldState = static_cast<const TiaState&>(getOldState());
|
||||
const auto& state = static_cast<const TiaState&>(getState());
|
||||
const auto& oldState = static_cast<const TiaState&>(getOldState());
|
||||
|
||||
// build up output, then return it.
|
||||
buf << std::setfill(' ') << std::left
|
||||
|
|
|
@ -188,11 +188,11 @@ class TIADebug : public DebuggerSystem
|
|||
string colorSwatch(uInt8 c) const;
|
||||
|
||||
string audFreq(uInt8 dist, uInt8 div);
|
||||
string stringOnly(string value, bool changed = false);
|
||||
string decWithLabel(string label, uInt16 value, bool changed = false, uInt16 width = 3);
|
||||
string hexWithLabel(string label, uInt16 value, bool changed = false, uInt16 width = 2);
|
||||
string binWithLabel(string label, uInt16 value, bool changed = false);
|
||||
string boolWithLabel(string label, bool value, bool changed = false);
|
||||
string stringOnly(const string& value, bool changed = false);
|
||||
string decWithLabel(const string& label, uInt16 value, bool changed = false, uInt16 width = 3);
|
||||
string hexWithLabel(const string& label, uInt16 value, bool changed = false, uInt16 width = 2);
|
||||
string binWithLabel(const string& label, uInt16 value, bool changed = false);
|
||||
string boolWithLabel(const string& label, bool value, bool changed = false);
|
||||
|
||||
private:
|
||||
TiaState myState;
|
||||
|
|
|
@ -30,15 +30,13 @@ AtariVoxWidget::AtariVoxWidget(GuiObject* boss, const GUI::Font& font,
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void AtariVoxWidget::eraseCurrent()
|
||||
{
|
||||
AtariVox& avox = static_cast<AtariVox&>(controller());
|
||||
|
||||
auto& avox = static_cast<AtariVox&>(controller());
|
||||
avox.eraseCurrent();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool AtariVoxWidget::isPageUsed(uInt32 page)
|
||||
{
|
||||
const AtariVox& avox = static_cast<AtariVox&>(controller());
|
||||
|
||||
const auto& avox = static_cast<AtariVox&>(controller());
|
||||
return avox.isPageUsed(page);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include "TIADebug.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "Base.hxx"
|
||||
using Common::Base;
|
||||
|
||||
#include "AudioWidget.hxx"
|
||||
|
||||
|
@ -102,8 +101,8 @@ void AudioWidget::loadConfig()
|
|||
|
||||
const Debugger& dbg = instance().debugger();
|
||||
TIADebug& tia = dbg.tiaDebug();
|
||||
const TiaState& state = static_cast<const TiaState&>(tia.getState());
|
||||
const TiaState& oldstate = static_cast<const TiaState&>(tia.getOldState());
|
||||
const auto& state = static_cast<const TiaState&>(tia.getState());
|
||||
const auto& oldstate = static_cast<const TiaState&>(tia.getOldState());
|
||||
|
||||
// AUDF0/1
|
||||
alist.clear(); vlist.clear(); changed.clear();
|
||||
|
|
|
@ -26,10 +26,8 @@ BoosterWidget::BoosterWidget(GuiObject* boss, const GUI::Font& font,
|
|||
|
||||
const int fontHeight = font.getFontHeight();
|
||||
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Booster)");
|
||||
StaticTextWidget* t;
|
||||
|
||||
t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth,
|
||||
fontHeight, label, TextAlign::Left);
|
||||
auto* t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth,
|
||||
fontHeight, label, TextAlign::Left);
|
||||
xpos += t->getWidth()/2 - 5; ypos += t->getHeight() + 10;
|
||||
myPins[kJUp] = new CheckboxWidget(boss, font, xpos, ypos, "",
|
||||
CheckboxWidget::kCheckActionCmd);
|
||||
|
|
|
@ -34,7 +34,7 @@ Cartridge3EPlusWidget::Cartridge3EPlusWidget(
|
|||
string Cartridge3EPlusWidget::description()
|
||||
{
|
||||
ostringstream info;
|
||||
size_t size;
|
||||
size_t size{0};
|
||||
const ByteBuffer& image = myCart.getImage(size);
|
||||
const uInt16 numRomBanks = myCart.romBankCount();
|
||||
const uInt16 numRamBanks = myCart.ramBankCount();
|
||||
|
@ -59,7 +59,7 @@ string Cartridge3EPlusWidget::description()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Cartridge3EPlusWidget::bankSelect(int& ypos)
|
||||
{
|
||||
size_t size;
|
||||
size_t size{0};
|
||||
const ByteBuffer& image = myCart.getImage(size);
|
||||
const int VGAP = myFontHeight / 4;
|
||||
VariantList banktype;
|
||||
|
@ -118,22 +118,24 @@ void Cartridge3EPlusWidget::bankSelect(int& ypos)
|
|||
const int addr1 = start + (seg * 0x400), addr2 = addr1 + 0x200;
|
||||
|
||||
label.str("");
|
||||
label << "$" << Common::Base::HEX4 << addr1 << "-$" << Common::Base::HEX4 << (addr1 + 0x1FF);
|
||||
StaticTextWidget* t = new StaticTextWidget(_boss, _font, xpos_s, ypos_s + 2, label.str());
|
||||
label << "$" << Common::Base::HEX4 << addr1 << "-$"
|
||||
<< Common::Base::HEX4 << (addr1 + 0x1FF);
|
||||
auto* t = new StaticTextWidget(_boss, _font, xpos_s, ypos_s + 2, label.str());
|
||||
|
||||
const int xoffset = t->getRight() + _font.getMaxCharWidth();
|
||||
myBankState[2 * seg] = new EditTextWidget(_boss, _font, xoffset, ypos_s,
|
||||
_w - xoffset - 10, myLineHeight, "");
|
||||
myBankState[2 * seg]->setEditable(false, true);
|
||||
const size_t bank_off = static_cast<size_t>(seg) * 2;
|
||||
myBankState[bank_off] = new EditTextWidget(_boss, _font, xoffset, ypos_s,
|
||||
_w - xoffset - 10, myLineHeight, "");
|
||||
myBankState[bank_off]->setEditable(false, true);
|
||||
ypos_s += myLineHeight + VGAP;
|
||||
|
||||
label.str("");
|
||||
label << "$" << Common::Base::HEX4 << addr2 << "-$" << Common::Base::HEX4 << (addr2 + 0x1FF);
|
||||
new StaticTextWidget(_boss, _font, xpos_s, ypos_s + 2, label.str());
|
||||
|
||||
myBankState[2 * seg + 1] = new EditTextWidget(_boss, _font, xoffset, ypos_s,
|
||||
_w - xoffset - 10, myLineHeight, "");
|
||||
myBankState[2 * seg + 1]->setEditable(false, true);
|
||||
myBankState[bank_off + 1] = new EditTextWidget(_boss, _font,
|
||||
xoffset, ypos_s, _w - xoffset - 10, myLineHeight, "");
|
||||
myBankState[bank_off + 1]->setEditable(false, true);
|
||||
|
||||
ypos += myLineHeight + VGAP * 4;
|
||||
}
|
||||
|
@ -198,6 +200,7 @@ void Cartridge3EPlusWidget::updateUIState()
|
|||
for(int seg = 0; seg < myCart3EP.myBankSegs; ++seg)
|
||||
{
|
||||
const uInt16 bank = myCart.getSegmentBank(seg);
|
||||
const size_t bank_off = static_cast<size_t>(seg) * 2;
|
||||
ostringstream buf;
|
||||
|
||||
if(bank >= myCart.romBankCount()) // was RAM mapped here?
|
||||
|
@ -205,13 +208,13 @@ void Cartridge3EPlusWidget::updateUIState()
|
|||
const uInt16 ramBank = bank - myCart.romBankCount();
|
||||
|
||||
buf << "RAM @ $" << Common::Base::HEX4
|
||||
<< (ramBank << myCart3EP.myBankShift) << " (R)";
|
||||
myBankState[seg * 2]->setText(buf.str());
|
||||
<< (ramBank << myCart3EP.myBankShift) << " (R)";
|
||||
myBankState[bank_off]->setText(buf.str());
|
||||
|
||||
buf.str("");
|
||||
buf << "RAM @ $" << Common::Base::HEX4
|
||||
<< ((ramBank << myCart3EP.myBankShift) + myCart3EP.myBankSize) << " (W)";
|
||||
myBankState[seg * 2 + 1]->setText(buf.str());
|
||||
myBankState[bank_off + 1]->setText(buf.str());
|
||||
|
||||
myBankWidgets[seg]->setSelectedIndex(ramBank);
|
||||
myBankType[seg]->setSelected("RAM");
|
||||
|
@ -220,12 +223,12 @@ void Cartridge3EPlusWidget::updateUIState()
|
|||
{
|
||||
buf << "ROM @ $" << Common::Base::HEX4
|
||||
<< ((bank << myCart3EP.myBankShift));
|
||||
myBankState[seg * 2]->setText(buf.str());
|
||||
myBankState[bank_off]->setText(buf.str());
|
||||
|
||||
buf.str("");
|
||||
buf << "ROM @ $" << Common::Base::HEX4
|
||||
<< ((bank << myCart3EP.myBankShift) + myCart3EP.myBankSize);
|
||||
myBankState[seg * 2 + 1]->setText(buf.str());
|
||||
myBankState[bank_off + 1]->setText(buf.str());
|
||||
|
||||
myBankWidgets[seg]->setSelectedIndex(bank);
|
||||
myBankType[seg]->setSelected("ROM");
|
||||
|
|
|
@ -32,7 +32,7 @@ Cartridge3EWidget::Cartridge3EWidget(
|
|||
string Cartridge3EWidget::description()
|
||||
{
|
||||
ostringstream info;
|
||||
size_t size;
|
||||
size_t size{0};
|
||||
const ByteBuffer& image = myCart.getImage(size);
|
||||
const uInt16 numRomBanks = myCart.romBankCount();
|
||||
const uInt16 numRamBanks = myCart.ramBankCount();
|
||||
|
@ -69,9 +69,9 @@ void Cartridge3EWidget::bankList(uInt16 bankCount, int seg, VariantList& items,
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Cartridge3EWidget::bankSelect(int& ypos)
|
||||
{
|
||||
int xpos = 2;
|
||||
int xpos{2};
|
||||
VariantList items;
|
||||
int pw;
|
||||
int pw{0};
|
||||
|
||||
myBankWidgets = make_unique<PopUpWidget* []>(2);
|
||||
|
||||
|
@ -84,7 +84,8 @@ void Cartridge3EWidget::bankSelect(int& ypos)
|
|||
myBankWidgets[0]->setID(0);
|
||||
addFocusWidget(myBankWidgets[0]);
|
||||
|
||||
StaticTextWidget* t = new StaticTextWidget(_boss, _font, myBankWidgets[0]->getRight(), ypos - 1, " (ROM)");
|
||||
auto* t = new StaticTextWidget(_boss, _font,
|
||||
myBankWidgets[0]->getRight(), ypos - 1, " (ROM)");
|
||||
|
||||
xpos = t->getRight() + 20;
|
||||
items.clear();
|
||||
|
|
|
@ -68,8 +68,8 @@ void CartridgeARMWidget::addCycleWidgets(int xpos, int ypos)
|
|||
myThumbCycles->setEditable(false);
|
||||
myThumbCycles->setToolTip("Approximated CPU cycles of last ARM run.\n");
|
||||
|
||||
StaticTextWidget* s = new StaticTextWidget(_boss, _font, myCycleFactor->getLeft(), ypos + 1,
|
||||
"Instructions #");
|
||||
auto* s = new StaticTextWidget(_boss, _font, myCycleFactor->getLeft(), ypos + 1,
|
||||
"Instructions #");
|
||||
|
||||
myPrevThumbInstructions = new DataGridWidget(_boss, _font, s->getRight(), ypos - 1,
|
||||
1, 1, 6, 32, Common::Base::Fmt::_10_6);
|
||||
|
|
|
@ -83,8 +83,8 @@ CartridgeARWidget::CartridgeARWidget(
|
|||
void CartridgeARWidget::loadConfig()
|
||||
{
|
||||
CartDebug& cart = instance().debugger().cartDebug();
|
||||
const CartState& state = static_cast<const CartState&>(cart.getState());
|
||||
const CartState& oldstate = static_cast<const CartState&>(cart.getOldState());
|
||||
const auto& state = static_cast<const CartState&>(cart.getState());
|
||||
const auto& oldstate = static_cast<const CartState&>(cart.getOldState());
|
||||
|
||||
myBank->setSelectedIndex(myCart.getBank(), state.bank != oldstate.bank);
|
||||
|
||||
|
|
|
@ -99,8 +99,7 @@ CartridgeBUSWidget::CartridgeBUSWidget(
|
|||
myDatastreamPointers2->setTarget(this);
|
||||
myDatastreamPointers2->setEditable(false);
|
||||
|
||||
uInt32 row;
|
||||
for(row = 0; row < 4; ++row)
|
||||
for(uInt32 row = 0; row < 4; ++row)
|
||||
{
|
||||
myDatastreamLabels[row] =
|
||||
new StaticTextWidget(_boss, _font, DS_X - _font.getStringWidth("xx "),
|
||||
|
|
|
@ -111,8 +111,7 @@ CartridgeCDFWidget::CartridgeCDFWidget(
|
|||
myJumpStreamPointers->setTarget(this);
|
||||
myJumpStreamPointers->setEditable(false);
|
||||
|
||||
uInt32 row;
|
||||
for(row = 0; row < 8; ++row)
|
||||
for(uInt32 row = 0; row < 8; ++row)
|
||||
{
|
||||
myDatastreamLabels[row] =
|
||||
new StaticTextWidget(_boss, _font, DS_X - _font.getStringWidth("xx "),
|
||||
|
|
|
@ -166,7 +166,7 @@ void CartridgeCMWidget::loadConfig()
|
|||
myBank->setSelectedIndex(myCart.getBank(), myCart.getBank() != myOldState.bank);
|
||||
|
||||
RiotDebug& riot = Debugger::debugger().riotDebug();
|
||||
const RiotState& state = static_cast<const RiotState&>(riot.getState());
|
||||
const auto& state = static_cast<const RiotState&>(riot.getState());
|
||||
|
||||
const uInt8 swcha = myCart.mySWCHA;
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ int CartridgeEnhancedWidget::initialize()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
size_t CartridgeEnhancedWidget::size()
|
||||
{
|
||||
size_t size;
|
||||
size_t size{0};
|
||||
|
||||
myCart.getImage(size);
|
||||
|
||||
|
@ -96,7 +96,7 @@ string CartridgeEnhancedWidget::ramDescription()
|
|||
string CartridgeEnhancedWidget::romDescription()
|
||||
{
|
||||
ostringstream info;
|
||||
size_t size;
|
||||
size_t size{0};
|
||||
const ByteBuffer& image = myCart.getImage(size);
|
||||
|
||||
if(myCart.romBankCount() > 1)
|
||||
|
@ -328,15 +328,15 @@ void CartridgeEnhancedWidget::loadConfig()
|
|||
ostringstream buf;
|
||||
ByteArray arr = myCart.myPlusROM->getSend();
|
||||
|
||||
for(size_t i = 0; i < arr.size(); ++i)
|
||||
buf << Common::Base::HEX2 << int(arr[i]) << " ";
|
||||
for(auto i: arr)
|
||||
buf << Common::Base::HEX2 << static_cast<int>(i) << " ";
|
||||
myPlusROMSendWidget->setText(buf.str(), arr != myOldState.send);
|
||||
|
||||
buf.str("");
|
||||
arr = myCart.myPlusROM->getReceive();
|
||||
|
||||
for(size_t i = 0; i < arr.size(); ++i)
|
||||
buf << Common::Base::HEX2 << int(arr[i]) << " ";
|
||||
for(auto i: arr)
|
||||
buf << Common::Base::HEX2 << static_cast<int>(i) << " ";
|
||||
myPlusROMReceiveWidget->setText(buf.str(), arr != myOldState.receive);
|
||||
}
|
||||
if(myBankWidgets != nullptr)
|
||||
|
|
|
@ -30,7 +30,7 @@ CartridgeFA2Widget::CartridgeFA2Widget(
|
|||
|
||||
const int bwidth = _font.getStringWidth("Erase") + 20;
|
||||
|
||||
StaticTextWidget* t = new StaticTextWidget(boss, _font, xpos, ypos,
|
||||
auto* t = new StaticTextWidget(boss, _font, xpos, ypos,
|
||||
_font.getStringWidth("Harmony flash memory "),
|
||||
myFontHeight, "Harmony flash memory ", TextAlign::Left);
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ CartRamWidget::CartRamWidget(
|
|||
constexpr uInt16 maxlines = 6;
|
||||
const StringParser bs(desc, (fwidth - ScrollBarWidget::scrollBarWidth(_font)) / myFontWidth);
|
||||
const StringList& sl = bs.stringList();
|
||||
uInt32 lines = static_cast<uInt32>(sl.size());
|
||||
auto lines = static_cast<uInt32>(sl.size());
|
||||
bool useScrollbar = false;
|
||||
|
||||
if(lines < 2) lines = 2;
|
||||
|
|
|
@ -299,8 +299,8 @@ void CpuWidget::loadConfig()
|
|||
const Debugger& dbg = instance().debugger();
|
||||
const CartDebug& cart = dbg.cartDebug();
|
||||
CpuDebug& cpu = dbg.cpuDebug();
|
||||
const CpuState& state = static_cast<const CpuState&>(cpu.getState());
|
||||
const CpuState& oldstate = static_cast<const CpuState&>(cpu.getOldState());
|
||||
const auto& state = static_cast<const CpuState&>(cpu.getState());
|
||||
const auto& oldstate = static_cast<const CpuState&>(cpu.getOldState());
|
||||
|
||||
// Add PC to its own DataGridWidget
|
||||
alist.push_back(kPCRegAddr);
|
||||
|
|
|
@ -57,7 +57,7 @@ DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
|
|||
_valueList.push_back(0);
|
||||
_valueStringList.push_back(EmptyString);
|
||||
_toolTipList.push_back(EmptyString);
|
||||
_changedList.push_back(0);
|
||||
_changedList.push_back(false);
|
||||
_hiliteList.push_back(false);
|
||||
}
|
||||
|
||||
|
@ -259,8 +259,7 @@ void DataGridWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount
|
|||
|
||||
resetSelection();
|
||||
// First check whether the selection changed
|
||||
int newSelectedItem;
|
||||
newSelectedItem = findItem(x, y);
|
||||
int newSelectedItem = findItem(x, y);
|
||||
if (newSelectedItem > static_cast<int>(_valueList.size()) - 1)
|
||||
newSelectedItem = -1;
|
||||
|
||||
|
@ -714,11 +713,13 @@ void DataGridWidget::drawWidget(bool hilite)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Common::Rect DataGridWidget::getEditRect() const
|
||||
{
|
||||
const int rowoffset = _currentRow * _rowHeight;
|
||||
const int coloffset = _currentCol * _colWidth + 4;
|
||||
const uInt32 rowoffset = _currentRow * _rowHeight;
|
||||
const uInt32 coloffset = _currentCol * _colWidth + 4;
|
||||
|
||||
return Common::Rect(1 + coloffset, rowoffset,
|
||||
_colWidth + coloffset - 5, _rowHeight + rowoffset);
|
||||
return {
|
||||
1 + coloffset, rowoffset,
|
||||
_colWidth + coloffset - 5, _rowHeight + rowoffset
|
||||
};
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -72,7 +72,7 @@ DebuggerDialog::DebuggerDialog(OSystem& osystem, DialogContainer& parent,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
DebuggerDialog::~DebuggerDialog()
|
||||
DebuggerDialog::~DebuggerDialog() // NOLINT (we need an empty d'tor)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -475,22 +475,22 @@ void DebuggerDialog::addTabArea()
|
|||
|
||||
// The TIA tab
|
||||
tabID = myTab->addTab("TIA");
|
||||
TiaWidget* tia = new TiaWidget(myTab, *myLFont, *myNFont,
|
||||
2, 2, widWidth, widHeight);
|
||||
auto* tia = new TiaWidget(myTab, *myLFont, *myNFont,
|
||||
2, 2, widWidth, widHeight);
|
||||
myTab->setParentWidget(tabID, tia);
|
||||
addToFocusList(tia->getFocusList(), myTab, tabID);
|
||||
|
||||
// The input/output tab (includes RIOT and INPTx from TIA)
|
||||
tabID = myTab->addTab("I/O");
|
||||
RiotWidget* riot = new RiotWidget(myTab, *myLFont, *myNFont,
|
||||
2, 2, widWidth, widHeight);
|
||||
auto* riot = new RiotWidget(myTab, *myLFont, *myNFont,
|
||||
2, 2, widWidth, widHeight);
|
||||
myTab->setParentWidget(tabID, riot);
|
||||
addToFocusList(riot->getFocusList(), myTab, tabID);
|
||||
|
||||
// The Audio tab
|
||||
tabID = myTab->addTab("Audio");
|
||||
AudioWidget* aud = new AudioWidget(myTab, *myLFont, *myNFont,
|
||||
2, 2, widWidth, widHeight);
|
||||
auto* aud = new AudioWidget(myTab, *myLFont, *myNFont,
|
||||
2, 2, widWidth, widHeight);
|
||||
myTab->setParentWidget(tabID, aud);
|
||||
addToFocusList(aud->getFocusList(), myTab, tabID);
|
||||
|
||||
|
@ -624,7 +624,7 @@ void DebuggerDialog::addRomArea()
|
|||
wid1.push_back(myRewindButton);
|
||||
wid1.push_back(myUnwindButton);
|
||||
|
||||
DataGridOpsWidget* ops = new DataGridOpsWidget(this, *myLFont, xpos, ypos);
|
||||
auto* ops = new DataGridOpsWidget(this, *myLFont, xpos, ypos);
|
||||
|
||||
const int max_w = xpos - r.x() - 10;
|
||||
xpos = r.x() + 10; ypos = 5;
|
||||
|
@ -713,8 +713,10 @@ void DebuggerDialog::addRomArea()
|
|||
Common::Rect DebuggerDialog::getTiaBounds() const
|
||||
{
|
||||
// The area showing the TIA image (NTSC and PAL supported, up to 274 lines without scaling)
|
||||
return Common::Rect(0, 0, 320, std::max(static_cast<int>(FrameManager::Metrics::baseHeightPAL),
|
||||
static_cast<int>(_h * 0.35)));
|
||||
return {
|
||||
0, 0, 320,
|
||||
std::max<uInt32>(FrameManager::Metrics::baseHeightPAL, _h * 0.35)
|
||||
};
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -722,7 +724,10 @@ Common::Rect DebuggerDialog::getRomBounds() const
|
|||
{
|
||||
// The ROM area is the full area to the right of the tabs
|
||||
const Common::Rect& status = getStatusBounds();
|
||||
return Common::Rect(status.x() + status.w() + 1, 0, _w, _h);
|
||||
return {
|
||||
status.x() + status.w() + 1, 0,
|
||||
static_cast<uInt32>(_w), static_cast<uInt32>(_h)
|
||||
};
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -733,11 +738,12 @@ Common::Rect DebuggerDialog::getStatusBounds() const
|
|||
// 30% of any space above 1030 pixels will be allocated to this area
|
||||
const Common::Rect& tia = getTiaBounds();
|
||||
|
||||
return Common::Rect(
|
||||
return {
|
||||
tia.x() + tia.w() + 1,
|
||||
0,
|
||||
tia.x() + tia.w() + 225 + (_w > 1030 ? int(0.35 * (_w - 1030)) : 0),
|
||||
tia.y() + tia.h());
|
||||
tia.y() + tia.h()
|
||||
};
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -747,6 +753,8 @@ Common::Rect DebuggerDialog::getTabBounds() const
|
|||
const Common::Rect& tia = getTiaBounds();
|
||||
const Common::Rect& status = getStatusBounds();
|
||||
|
||||
return Common::Rect(0, tia.y() + tia.h() + 1,
|
||||
status.x() + status.w() + 1, _h);
|
||||
return {
|
||||
0, tia.y() + tia.h() + 1,
|
||||
status.x() + status.w() + 1, static_cast<uInt32>(_h)
|
||||
};
|
||||
}
|
||||
|
|
|
@ -26,10 +26,8 @@ Joy2BPlusWidget::Joy2BPlusWidget(GuiObject* boss, const GUI::Font& font,
|
|||
|
||||
const int fontHeight = font.getFontHeight();
|
||||
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (Joy 2B+)");
|
||||
StaticTextWidget* t;
|
||||
|
||||
t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth,
|
||||
fontHeight, label, TextAlign::Left);
|
||||
auto* t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth,
|
||||
fontHeight, label, TextAlign::Left);
|
||||
xpos += t->getWidth()/2 - 5; ypos += t->getHeight() + 10;
|
||||
myPins[kJUp] = new CheckboxWidget(boss, font, xpos, ypos, "",
|
||||
CheckboxWidget::kCheckActionCmd);
|
||||
|
|
|
@ -87,9 +87,9 @@ void PointingDeviceWidget::loadConfig()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PointingDeviceWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||
{
|
||||
// since the PointingDevice uses its own, internal state (not reading the controller),
|
||||
// we have to communicate directly with it
|
||||
PointingDevice& pDev = static_cast<PointingDevice&>(controller());
|
||||
// Since the PointingDevice uses its own, internal state (not reading the
|
||||
// controller), we have to communicate directly with it
|
||||
auto& pDev = static_cast<PointingDevice&>(controller());
|
||||
|
||||
switch(cmd)
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ void PointingDeviceWidget::handleCommand(CommandSender* sender, int cmd, int dat
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PointingDeviceWidget::setGrayCodeH()
|
||||
{
|
||||
PointingDevice& pDev = static_cast<PointingDevice&>(controller());
|
||||
auto& pDev = static_cast<PointingDevice&>(controller());
|
||||
|
||||
pDev.myCountH &= 0b11;
|
||||
setValue(myGrayValueH, pDev.myCountH, pDev.myTrackBallLeft);
|
||||
|
@ -133,7 +133,7 @@ void PointingDeviceWidget::setGrayCodeH()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PointingDeviceWidget::setGrayCodeV()
|
||||
{
|
||||
PointingDevice& pDev = static_cast<PointingDevice&>(controller());
|
||||
auto& pDev = static_cast<PointingDevice&>(controller());
|
||||
|
||||
pDev.myCountV &= 0b11;
|
||||
setValue(myGrayValueV, pDev.myCountV, !pDev.myTrackBallDown);
|
||||
|
|
|
@ -382,10 +382,9 @@ void PromptWidget::loadConfig()
|
|||
// fill the history from the saved breaks, traps and watches commands
|
||||
StringList history;
|
||||
print(instance().debugger().autoExec(&history));
|
||||
for(uInt32 i = 0; i < history.size(); ++i)
|
||||
{
|
||||
addToHistory(history[i].c_str());
|
||||
}
|
||||
for(const auto& h: history)
|
||||
addToHistory(h.c_str());
|
||||
|
||||
history.clear();
|
||||
print(instance().debugger().cartDebug().loadConfigFile() + "\n");
|
||||
print(instance().debugger().cartDebug().loadListFile() + "\n");
|
||||
|
@ -595,11 +594,11 @@ void PromptWidget::addToHistory(const char* str)
|
|||
|
||||
if(!BSPF::compareIgnoreCase(_history[i], str))
|
||||
{
|
||||
int j = i, prevJ;
|
||||
int j = i;
|
||||
|
||||
do
|
||||
{
|
||||
prevJ = j;
|
||||
int prevJ = j;
|
||||
historyDir(j, +1);
|
||||
_history[prevJ] = _history[j];
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
|
|||
TextAlign::Left);
|
||||
}
|
||||
|
||||
uInt32 row;
|
||||
uInt32 row{0};
|
||||
for(row = 0; row < myNumRows; ++row)
|
||||
{
|
||||
myRamLabels[row] =
|
||||
|
@ -190,7 +190,7 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
RamWidget::~RamWidget()
|
||||
RamWidget::~RamWidget() // NOLINT (we need an empty d'tor)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -33,21 +33,21 @@ RiotRamWidget::RiotRamWidget(GuiObject* boss, const GUI::Font& lfont,
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 RiotRamWidget::getValue(int addr) const
|
||||
{
|
||||
const CartState& state = static_cast<const CartState&>(myDbg.getState());
|
||||
const auto& state = static_cast<const CartState&>(myDbg.getState());
|
||||
return instance().debugger().peek(state.rport[addr]);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RiotRamWidget::setValue(int addr, uInt8 value)
|
||||
{
|
||||
const CartState& state = static_cast<const CartState&>(myDbg.getState());
|
||||
const auto& state = static_cast<const CartState&>(myDbg.getState());
|
||||
instance().debugger().poke(state.wport[addr], value);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string RiotRamWidget::getLabel(int addr) const
|
||||
{
|
||||
const CartState& state = static_cast<const CartState&>(myDbg.getState());
|
||||
const auto& state = static_cast<const CartState&>(myDbg.getState());
|
||||
return myDbg.getLabel(state.rport[addr], true);
|
||||
}
|
||||
|
||||
|
@ -55,8 +55,8 @@ string RiotRamWidget::getLabel(int addr) const
|
|||
void RiotRamWidget::fillList(uInt32 start, uInt32 size, IntArray& alist,
|
||||
IntArray& vlist, BoolArray& changed) const
|
||||
{
|
||||
const CartState& state = static_cast<const CartState&>(myDbg.getState());
|
||||
const CartState& oldstate = static_cast<const CartState&>(myDbg.getOldState());
|
||||
const auto& state = static_cast<const CartState&>(myDbg.getState());
|
||||
const auto& oldstate = static_cast<const CartState&>(myDbg.getOldState());
|
||||
|
||||
for(uInt32 i = 0; i < size; ++i)
|
||||
{
|
||||
|
@ -69,13 +69,13 @@ void RiotRamWidget::fillList(uInt32 start, uInt32 size, IntArray& alist,
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 RiotRamWidget::readPort(uInt32 start) const
|
||||
{
|
||||
const CartState& state = static_cast<const CartState&>(myDbg.getState());
|
||||
const auto& state = static_cast<const CartState&>(myDbg.getState());
|
||||
return state.rport[start];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const ByteArray& RiotRamWidget::currentRam(uInt32) const
|
||||
{
|
||||
const CartState& state = static_cast<const CartState&>(myDbg.getState());
|
||||
const auto& state = static_cast<const CartState&>(myDbg.getState());
|
||||
return state.ram;
|
||||
}
|
||||
|
|
|
@ -295,8 +295,8 @@ void RiotWidget::loadConfig()
|
|||
// We push the enumerated items as addresses, and deal with the real
|
||||
// address in the callback (handleCommand)
|
||||
RiotDebug& riot = instance().debugger().riotDebug();
|
||||
const RiotState& state = static_cast<const RiotState&>(riot.getState());
|
||||
const RiotState& oldstate = static_cast<const RiotState&>(riot.getOldState());
|
||||
const auto& state = static_cast<const RiotState&>(riot.getState());
|
||||
const auto& oldstate = static_cast<const RiotState&>(riot.getOldState());
|
||||
|
||||
// Update the SWCHA register booleans (poke mode)
|
||||
IO_REGS_UPDATE(mySWCHAWriteBits, swchaWriteBits)
|
||||
|
|
|
@ -36,21 +36,21 @@ RomListSettings::RomListSettings(GuiObject* boss, const GUI::Font& font)
|
|||
WidgetArray wid;
|
||||
|
||||
// Set PC to current line
|
||||
ButtonWidget* setPC =
|
||||
auto* setPC =
|
||||
new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
|
||||
"Set PC @ current line", RomListWidget::kSetPCCmd);
|
||||
wid.push_back(setPC);
|
||||
|
||||
// RunTo PC on current line
|
||||
ypos += buttonHeight + 4;
|
||||
ButtonWidget* runtoPC =
|
||||
auto* runtoPC =
|
||||
new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
|
||||
"RunTo PC @ current line", RomListWidget::kRuntoPCCmd);
|
||||
wid.push_back(runtoPC);
|
||||
|
||||
// Re-disassemble
|
||||
ypos += buttonHeight + 4;
|
||||
ButtonWidget* disasm =
|
||||
auto* disasm =
|
||||
new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
|
||||
"Disassemble @ current line", RomListWidget::kDisassembleCmd);
|
||||
wid.push_back(disasm);
|
||||
|
|
|
@ -78,7 +78,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
|
|||
// Create a CheckboxWidget for each row in the list
|
||||
for(int i = 0; i < _rows; ++i)
|
||||
{
|
||||
CheckboxWidget* t = new CheckboxWidget(boss, lfont, _x + 2, ypos, "",
|
||||
auto* t = new CheckboxWidget(boss, lfont, _x + 2, ypos, "",
|
||||
CheckboxWidget::kCheckActionCmd);
|
||||
t->setTarget(this);
|
||||
t->setID(i);
|
||||
|
@ -254,8 +254,7 @@ void RomListWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
|
|||
else
|
||||
{
|
||||
// First check whether the selection changed
|
||||
int newSelectedItem;
|
||||
newSelectedItem = findItem(x, y);
|
||||
int newSelectedItem = findItem(x, y);
|
||||
if (newSelectedItem > static_cast<int>(myDisasm->list.size()) - 1)
|
||||
newSelectedItem = -1;
|
||||
|
||||
|
@ -490,7 +489,7 @@ string RomListWidget::getToolTip(const Common::Point& pos) const
|
|||
|
||||
if(idx.x < 2 || bytes.length() < 8)
|
||||
// 1 or 2 hex bytes, get one hex byte
|
||||
valStr = bytes.substr((idx.x / 3) * 3, 2);
|
||||
valStr = bytes.substr((static_cast<size_t>(idx.x) / 3) * 3, 2);
|
||||
else
|
||||
// 3 hex bytes, get two rightmost hex bytes
|
||||
valStr = bytes.substr(6, 2) + bytes.substr(3, 2);
|
||||
|
@ -632,20 +631,25 @@ void RomListWidget::drawWidget(bool hilite)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Common::Rect RomListWidget::getLineRect() const
|
||||
{
|
||||
const int yoffset = std::max(0, (_selectedItem - _currentPos) * _lineHeight),
|
||||
xoffset = CheckboxWidget::boxSize(_font) + 10;
|
||||
const uInt32
|
||||
yoffset = std::max(0, (_selectedItem - _currentPos) * _lineHeight),
|
||||
xoffset = CheckboxWidget::boxSize(_font) + 10;
|
||||
|
||||
return Common::Rect(2 + xoffset, 1 + yoffset,
|
||||
_w - (xoffset - 15), _lineHeight + yoffset);
|
||||
return {
|
||||
2 + xoffset, 1 + yoffset,
|
||||
_w - (xoffset - 15), _lineHeight + yoffset
|
||||
};
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Common::Rect RomListWidget::getEditRect() const
|
||||
{
|
||||
const int yoffset = std::max(0, (_selectedItem - _currentPos) * _lineHeight);
|
||||
const uInt32 yoffset = std::max(0, (_selectedItem - _currentPos) * _lineHeight);
|
||||
|
||||
return Common::Rect(2 + _w - _bytesWidth, 1 + yoffset + 1,
|
||||
_w, _lineHeight + yoffset + 1);
|
||||
return {
|
||||
static_cast<uInt32>(2 + _w - _bytesWidth), 1 + yoffset + 1,
|
||||
static_cast<uInt32>(_w), _lineHeight + yoffset + 1
|
||||
};
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -40,7 +40,7 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& lfont, const GUI::Font& n
|
|||
|
||||
// Show current bank state
|
||||
int xpos = x, ypos = y + 7;
|
||||
StaticTextWidget* t = new StaticTextWidget(boss, lfont, xpos, ypos, "Info ");
|
||||
auto* t = new StaticTextWidget(boss, lfont, xpos, ypos, "Info ");
|
||||
|
||||
xpos += t->getRight();
|
||||
myBank = new EditTextWidget(boss, nfont, xpos, ypos-2,
|
||||
|
@ -60,8 +60,8 @@ void RomWidget::loadConfig()
|
|||
{
|
||||
const Debugger& dbg = instance().debugger();
|
||||
CartDebug& cart = dbg.cartDebug();
|
||||
const CartState& state = static_cast<const CartState&>(cart.getState());
|
||||
const CartState& oldstate = static_cast<const CartState&>(cart.getOldState());
|
||||
const auto& state = static_cast<const CartState&>(cart.getState());
|
||||
const auto& oldstate = static_cast<const CartState&>(cart.getOldState());
|
||||
|
||||
// Fill romlist the current bank of source or disassembly
|
||||
myListIsDirty |= cart.disassemblePC(myListIsDirty);
|
||||
|
|
|
@ -29,15 +29,13 @@ SaveKeyWidget::SaveKeyWidget(GuiObject* boss, const GUI::Font& font,
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SaveKeyWidget::eraseCurrent()
|
||||
{
|
||||
SaveKey& skey = static_cast<SaveKey&>(controller());
|
||||
|
||||
auto& skey = static_cast<SaveKey&>(controller());
|
||||
skey.eraseCurrent();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool SaveKeyWidget::isPageUsed(uInt32 page)
|
||||
{
|
||||
const SaveKey& skey = static_cast<SaveKey&>(controller());
|
||||
|
||||
const auto& skey = static_cast<SaveKey&>(controller());
|
||||
return skey.isPageUsed(page);
|
||||
}
|
||||
|
|
|
@ -158,9 +158,9 @@ void TiaInfoWidget::loadConfig()
|
|||
{
|
||||
const Debugger& dbg = instance().debugger();
|
||||
TIADebug& tia = dbg.tiaDebug();
|
||||
const TiaState& oldTia = static_cast<const TiaState&>(tia.getOldState());
|
||||
const auto& oldTia = static_cast<const TiaState&>(tia.getOldState());
|
||||
RiotDebug& riot = dbg.riotDebug();
|
||||
const RiotState& oldRiot = static_cast<const RiotState&>(riot.getOldState());
|
||||
const auto& oldRiot = static_cast<const RiotState&>(riot.getOldState());
|
||||
|
||||
myFrameCount->setText(Common::Base::toString(tia.frameCount(), Common::Base::Fmt::_10_5),
|
||||
tia.frameCount() != oldTia.info[0]);
|
||||
|
|
|
@ -978,8 +978,8 @@ void TiaWidget::loadConfig()
|
|||
BoolArray changed;
|
||||
|
||||
TIADebug& tia = instance().debugger().tiaDebug();
|
||||
const TiaState& state = static_cast<const TiaState&>(tia.getState());
|
||||
const TiaState& oldstate = static_cast<const TiaState&>(tia.getOldState());
|
||||
const auto& state = static_cast<const TiaState&>(tia.getState());
|
||||
const auto& oldstate = static_cast<const TiaState&>(tia.getOldState());
|
||||
|
||||
// Color registers
|
||||
alist.clear(); vlist.clear(); changed.clear();
|
||||
|
|
|
@ -49,13 +49,8 @@ TiaZoomWidget::TiaZoomWidget(GuiObject* boss, const GUI::Font& font,
|
|||
addFocusWidget(this);
|
||||
|
||||
// Initialize positions
|
||||
myZoomLevel = 2;
|
||||
myNumCols = (_w - 4) / myZoomLevel;
|
||||
myNumRows = (_h - 4) / myZoomLevel;
|
||||
myOffX = myOffY = myOffXLo = myOffYLo = 0;
|
||||
|
||||
myMouseMoving = false;
|
||||
myClickX = myClickY = 0;
|
||||
|
||||
// Create context menu for zoom levels
|
||||
VariantList l;
|
||||
|
@ -351,7 +346,7 @@ void TiaZoomWidget::drawWidget(bool hilite)
|
|||
for(int x = myOffX >> 1, col = 0; x < (myNumCols+myOffX) >> 1; ++x, col += wzoom)
|
||||
{
|
||||
const uInt32 idx = y*width + x;
|
||||
const ColorId color = static_cast<ColorId>(currentFrame[idx] | (idx > scanoffset ? 1 : 0));
|
||||
const auto color = static_cast<ColorId>(currentFrame[idx] | (idx > scanoffset ? 1 : 0));
|
||||
s.fillRect(_x + col + 1, _y + row + 1, wzoom, hzoom, color);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ class TiaZoomWidget : public Widget, public CommandSender
|
|||
private:
|
||||
unique_ptr<ContextMenu> myMenu;
|
||||
|
||||
int myZoomLevel{0};
|
||||
int myZoomLevel{2};
|
||||
int myNumCols{0}, myNumRows{0};
|
||||
int myOffX{0}, myOffY{0};
|
||||
int myOffXLo{0}, myOffYLo{0};
|
||||
|
|
|
@ -43,8 +43,7 @@ void ToggleWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount)
|
|||
return;
|
||||
|
||||
// First check whether the selection changed
|
||||
int newSelectedItem;
|
||||
newSelectedItem = findItem(x, y);
|
||||
int newSelectedItem = findItem(x, y);
|
||||
if (newSelectedItem > static_cast<int>(_stateList.size()) - 1)
|
||||
newSelectedItem = -1;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ void yyerror(const char* e);
|
|||
#pragma clang diagnostic ignored "-Wold-style-cast"
|
||||
#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
|
||||
#pragma clang diagnostic ignored "-Wmissing-variable-declarations"
|
||||
#include "y.tab.c"
|
||||
#include "y.tab.c" // NOLINT
|
||||
#pragma clang diagnostic pop
|
||||
#else
|
||||
#include "y.tab.c"
|
||||
|
@ -279,7 +279,7 @@ TiaMethod getTiaSpecial(char* ch)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int yylex() {
|
||||
static char idbuf[255]; // NOLINT (will be rewritten soon)
|
||||
char o, p;
|
||||
char o{0}, p{0};
|
||||
yylval.val = 0;
|
||||
while(*c != '\0') {
|
||||
switch(state) {
|
||||
|
@ -392,7 +392,7 @@ int yylex() {
|
|||
} else if(is_operator(*c)) {
|
||||
state = State::OPERATOR;
|
||||
} else {
|
||||
yylval.val = *c++;
|
||||
yylval.val = *c++; // NOLINT
|
||||
return yylval.val;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -43,7 +43,7 @@ AtariVox::AtariVox(Jack jack, const Event& event, const System& system,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AtariVox::~AtariVox()
|
||||
AtariVox::~AtariVox() // NOLINT (we need an empty d'tor)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ bool Cartridge::bankChanged()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt16 Cartridge::bankSize(uInt16 bank) const
|
||||
{
|
||||
size_t size;
|
||||
size_t size{0};
|
||||
getImage(size);
|
||||
|
||||
return static_cast<uInt16>(
|
||||
|
|
|
@ -24,5 +24,5 @@ Cartridge3EX::Cartridge3EX(const ByteBuffer& image, size_t size,
|
|||
{
|
||||
// 0xFFFA contains RAM bank count - 1;
|
||||
myRamBankCount = image[size - 6] + 1;
|
||||
myRamSize = (myBankSize >> 1) * myRamBankCount;
|
||||
myRamSize = (myBankSize >> 1) * myRamBankCount; // NOLINT
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
CartridgeAR::CartridgeAR(const ByteBuffer& image, size_t size,
|
||||
const string& md5, const Settings& settings)
|
||||
: Cartridge(settings, md5),
|
||||
mySize{std::max<size_t>(size, LOAD_SIZE)}
|
||||
mySize{std::max(size, LOAD_SIZE)}
|
||||
{
|
||||
// Create a load image buffer and copy the given image
|
||||
myLoadImages = make_unique<uInt8[]>(mySize);
|
||||
|
@ -291,39 +291,43 @@ uInt8 CartridgeAR::checksum(const uInt8* s, uInt16 length)
|
|||
void CartridgeAR::loadIntoRAM(uInt8 load)
|
||||
{
|
||||
bool success = true;
|
||||
uInt16 image;
|
||||
|
||||
// Scan through all of the loads to see if we find the one we're looking for
|
||||
for(image = 0; image < myNumberOfLoadImages; ++image)
|
||||
for(uInt16 image = 0; image < myNumberOfLoadImages; ++image)
|
||||
{
|
||||
const size_t image_off = image * LOAD_SIZE;
|
||||
|
||||
// Is this the correct load?
|
||||
if(myLoadImages[(image * LOAD_SIZE) + myImage.size() + 5] == load)
|
||||
if(myLoadImages[image_off + myImage.size() + 5] == load)
|
||||
{
|
||||
// Copy the load's header
|
||||
std::copy_n(myLoadImages.get() + (image * LOAD_SIZE) + myImage.size(), myHeader.size(), myHeader.data());
|
||||
std::copy_n(myLoadImages.get() + image_off + myImage.size(),
|
||||
myHeader.size(), myHeader.data());
|
||||
|
||||
// Verify the load's header
|
||||
if(checksum(myHeader.data(), 8) != 0x55)
|
||||
{
|
||||
cerr << "WARNING: The Supercharger header checksum is invalid...\n";
|
||||
myMsgCallback("Supercharger load #" + std::to_string(load) + " done with hearder checksum error");
|
||||
myMsgCallback("Supercharger load #" + std::to_string(load) +
|
||||
" done with hearder checksum error");
|
||||
success = false;
|
||||
}
|
||||
|
||||
// Load all of the pages from the load
|
||||
bool invalidPageChecksumSeen = false;
|
||||
for(uInt32 j = 0; j < myHeader[3]; ++j)
|
||||
for(size_t j = 0; j < myHeader[3]; ++j)
|
||||
{
|
||||
uInt32 bank = myHeader[16 + j] & 0b00011;
|
||||
uInt32 page = (myHeader[16 + j] & 0b11100) >> 2;
|
||||
const uInt8* const src = myLoadImages.get() + (image * LOAD_SIZE) + (j * 256);
|
||||
const size_t bank = myHeader[16 + j] & 0b00011;
|
||||
const size_t page = (myHeader[16 + j] & 0b11100) >> 2;
|
||||
const uInt8* const src = myLoadImages.get() + image_off + j * 256;
|
||||
const uInt8 sum = checksum(src, 256) + myHeader[16 + j] + myHeader[64 + j];
|
||||
|
||||
if(!invalidPageChecksumSeen && (sum != 0x55))
|
||||
{
|
||||
cerr << "WARNING: Some Supercharger page checksums are invalid...\n";
|
||||
myMsgCallback("Supercharger load #" + std::to_string(load) + " done with page #"
|
||||
+ std::to_string(j) + " checksum error");
|
||||
myMsgCallback("Supercharger load #" + std::to_string(load) +
|
||||
" done with page #" + std::to_string(j) +
|
||||
" checksum error");
|
||||
invalidPageChecksumSeen = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,9 +44,9 @@ class CartridgeAR : public Cartridge
|
|||
friend class CartridgeARWidget;
|
||||
|
||||
public:
|
||||
static constexpr uInt32 BANK_SIZE = static_cast<uInt32>(2_KB);
|
||||
static constexpr uInt32 RAM_SIZE = 3 * BANK_SIZE;
|
||||
static constexpr uInt32 LOAD_SIZE = 8448;
|
||||
static constexpr size_t BANK_SIZE = 2_KB;
|
||||
static constexpr size_t RAM_SIZE = 3 * BANK_SIZE;
|
||||
static constexpr size_t LOAD_SIZE = 8448;
|
||||
|
||||
public:
|
||||
/**
|
||||
|
|
|
@ -112,7 +112,7 @@ CartridgeBUS::CartridgeBUS(const ByteBuffer& image, size_t size,
|
|||
this);
|
||||
}
|
||||
|
||||
this->setInitialState();
|
||||
this->setInitialState(); // NOLINT
|
||||
|
||||
myPlusROM = make_unique<PlusROM>(mySettings, *this);
|
||||
|
||||
|
@ -190,12 +190,12 @@ void CartridgeBUS::install(System& system)
|
|||
inline void CartridgeBUS::updateMusicModeDataFetchers()
|
||||
{
|
||||
// Calculate the number of cycles since the last update
|
||||
const uInt32 cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);
|
||||
const auto cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);
|
||||
myAudioCycles = mySystem->cycles();
|
||||
|
||||
// Calculate the number of BUS OSC clocks since the last update
|
||||
const double clocks = ((20000.0 * cycles) / myClockRate) + myFractionalClocks;
|
||||
uInt32 wholeClocks = static_cast<uInt32>(clocks);
|
||||
const auto wholeClocks = static_cast<uInt32>(clocks);
|
||||
myFractionalClocks = clocks - static_cast<double>(wholeClocks);
|
||||
|
||||
// Let's update counters and flags of the music mode data fetchers
|
||||
|
@ -214,7 +214,7 @@ inline void CartridgeBUS::callFunction(uInt8 value)
|
|||
// time for Stella as ARM code "runs in zero 6507 cycles".
|
||||
case 255: // call without IRQ driven audio
|
||||
try {
|
||||
uInt32 cycles = static_cast<uInt32>(mySystem->cycles() - myARMCycles);
|
||||
auto cycles = static_cast<uInt32>(mySystem->cycles() - myARMCycles);
|
||||
|
||||
myARMCycles = mySystem->cycles();
|
||||
myThumbEmulator->run(cycles, value == 254);
|
||||
|
|
|
@ -111,7 +111,7 @@ CartridgeCDF::CartridgeCDF(const ByteBuffer& image, size_t size,
|
|||
thumulatorConfiguration(myCDFSubtype),
|
||||
this);
|
||||
|
||||
this->setInitialState();
|
||||
this->setInitialState(); // NOLINT
|
||||
|
||||
myPlusROM = make_unique<PlusROM>(mySettings, *this);
|
||||
|
||||
|
@ -175,12 +175,12 @@ void CartridgeCDF::install(System& system)
|
|||
inline void CartridgeCDF::updateMusicModeDataFetchers()
|
||||
{
|
||||
// Calculate the number of cycles since the last update
|
||||
const uInt32 cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);
|
||||
const auto cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);
|
||||
myAudioCycles = mySystem->cycles();
|
||||
|
||||
// Calculate the number of CDF OSC clocks since the last update
|
||||
const double clocks = ((20000.0 * cycles) / myClockRate) + myFractionalClocks;
|
||||
uInt32 wholeClocks = static_cast<uInt32>(clocks);
|
||||
const auto wholeClocks = static_cast<uInt32>(clocks);
|
||||
myFractionalClocks = clocks - static_cast<double>(wholeClocks);
|
||||
|
||||
// Let's update counters and flags of the music mode data fetchers
|
||||
|
@ -199,7 +199,7 @@ inline void CartridgeCDF::callFunction(uInt8 value)
|
|||
// time for Stella as ARM code "runs in zero 6507 cycles".
|
||||
case 255: // call without IRQ driven audio
|
||||
try {
|
||||
uInt32 cycles = static_cast<uInt32>(mySystem->cycles() - myARMCycles);
|
||||
auto cycles = static_cast<uInt32>(mySystem->cycles() - myARMCycles);
|
||||
|
||||
myARMCycles = mySystem->cycles();
|
||||
myThumbEmulator->run(cycles, value == 254);
|
||||
|
|
|
@ -588,12 +588,12 @@ void CartridgeCTY::wipeAllScores()
|
|||
inline void CartridgeCTY::updateMusicModeDataFetchers()
|
||||
{
|
||||
// Calculate the number of cycles since the last update
|
||||
const uInt32 cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);
|
||||
const auto cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);
|
||||
myAudioCycles = mySystem->cycles();
|
||||
|
||||
// Calculate the number of CTY OSC clocks since the last update
|
||||
const double clocks = ((20000.0 * cycles) / myClockRate) + myFractionalClocks;
|
||||
const uInt32 wholeClocks = static_cast<uInt32>(clocks);
|
||||
const auto wholeClocks = static_cast<uInt32>(clocks);
|
||||
myFractionalClocks = clocks - static_cast<double>(wholeClocks);
|
||||
|
||||
// Let's update counters and flags of the music mode data fetchers
|
||||
|
|
|
@ -94,12 +94,12 @@ inline void CartridgeDPC::clockRandomNumberGenerator()
|
|||
inline void CartridgeDPC::updateMusicModeDataFetchers()
|
||||
{
|
||||
// Calculate the number of cycles since the last update
|
||||
const uInt32 cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);
|
||||
const auto cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);
|
||||
myAudioCycles = mySystem->cycles();
|
||||
|
||||
// Calculate the number of DPC OSC clocks since the last update
|
||||
const double clocks = ((myDpcPitch * cycles) / myClockRate) + myFractionalClocks;
|
||||
const uInt32 wholeClocks = static_cast<uInt32>(clocks);
|
||||
const auto wholeClocks = static_cast<uInt32>(clocks);
|
||||
myFractionalClocks = clocks - static_cast<double>(wholeClocks);
|
||||
|
||||
if(wholeClocks == 0)
|
||||
|
@ -112,7 +112,7 @@ inline void CartridgeDPC::updateMusicModeDataFetchers()
|
|||
if(myMusicMode[x - 5])
|
||||
{
|
||||
const Int32 top = myTops[x] + 1;
|
||||
Int32 newLow = static_cast<Int32>(myCounters[x] & 0x00ff);
|
||||
auto newLow = static_cast<Int32>(myCounters[x] & 0x00ff);
|
||||
|
||||
if(myTops[x] != 0)
|
||||
{
|
||||
|
|
|
@ -78,7 +78,7 @@ CartridgeDPCPlus::CartridgeDPCPlus(const ByteBuffer& image, size_t size,
|
|||
myDriverMD5 == "8dd73b44fd11c488326ce507cbeb19d1" )
|
||||
myFractionalLowMask = 0x0F0000;
|
||||
|
||||
this->setInitialState();
|
||||
this->setInitialState(); // NOLINT
|
||||
|
||||
myPlusROM = make_unique<PlusROM>(mySettings, *this);
|
||||
|
||||
|
@ -165,12 +165,12 @@ inline void CartridgeDPCPlus::priorClockRandomNumberGenerator()
|
|||
inline void CartridgeDPCPlus::updateMusicModeDataFetchers()
|
||||
{
|
||||
// Calculate the number of cycles since the last update
|
||||
const uInt32 cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);
|
||||
const auto cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);
|
||||
myAudioCycles = mySystem->cycles();
|
||||
|
||||
// Calculate the number of DPC+ OSC clocks since the last update
|
||||
const double clocks = ((20000.0 * cycles) / myClockRate) + myFractionalClocks;
|
||||
const uInt32 wholeClocks = static_cast<uInt32>(clocks);
|
||||
const auto wholeClocks = static_cast<uInt32>(clocks);
|
||||
myFractionalClocks = clocks - static_cast<double>(wholeClocks);
|
||||
|
||||
// Let's update counters and flags of the music mode data fetchers
|
||||
|
@ -204,7 +204,7 @@ inline void CartridgeDPCPlus::callFunction(uInt8 value)
|
|||
// time for Stella as ARM code "runs in zero 6507 cycles".
|
||||
case 255: // call without IRQ driven audio
|
||||
try {
|
||||
uInt32 cycles = static_cast<uInt32>(mySystem->cycles() - myARMCycles);
|
||||
auto cycles = static_cast<uInt32>(mySystem->cycles() - myARMCycles);
|
||||
|
||||
myARMCycles = mySystem->cycles();
|
||||
myThumbEmulator->run(cycles, value == 254);
|
||||
|
|
|
@ -267,11 +267,11 @@ bool CartDetector::searchForBytes(const uInt8* image, size_t imagesize,
|
|||
const uInt8* signature, uInt32 sigsize,
|
||||
uInt32 minhits)
|
||||
{
|
||||
uInt32 count = 0;
|
||||
uInt32 count{0};
|
||||
|
||||
for(uInt32 i = 0; i < imagesize - sigsize; ++i)
|
||||
{
|
||||
uInt32 j;
|
||||
uInt32 j{0};
|
||||
|
||||
for(j = 0; j < sigsize; ++j)
|
||||
{
|
||||
|
@ -331,16 +331,16 @@ bool CartDetector::isProbably0840(const ByteBuffer& image, size_t size)
|
|||
{ 0xAD, 0x40, 0x08 }, // LDA $0840
|
||||
{ 0x2C, 0x00, 0x08 } // BIT $0800
|
||||
};
|
||||
for(uInt32 i = 0; i < 3; ++i)
|
||||
if(searchForBytes(image, size, signature1[i], 3, 2))
|
||||
for(const auto* const sig: signature1)
|
||||
if(searchForBytes(image, size, sig, 3, 2))
|
||||
return true;
|
||||
|
||||
static constexpr uInt8 signature2[2][4] = {
|
||||
{ 0x0C, 0x00, 0x08, 0x4C }, // NOP $0800; JMP ...
|
||||
{ 0x0C, 0xFF, 0x0F, 0x4C } // NOP $0FFF; JMP ...
|
||||
};
|
||||
for(uInt32 i = 0; i < 2; ++i)
|
||||
if(searchForBytes(image, size, signature2[i], 4, 2))
|
||||
for(const auto* const sig: signature2)
|
||||
if(searchForBytes(image, size, sig, 4, 2))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -358,8 +358,8 @@ bool CartDetector::isProbably0FA0(const ByteBuffer& image, size_t size)
|
|||
{ 0xAD, 0xC0, 0x0F }, // LDA $FC0 (Front Line, Zaxxon)
|
||||
{ 0x2C, 0xC0, 0xEF } // BIT $EFC0 (Motocross)
|
||||
};
|
||||
for(uInt32 i = 0; i < 4; ++i)
|
||||
if(searchForBytes(image, size, signature[i], 3))
|
||||
for(const auto* const sig: signature)
|
||||
if(searchForBytes(image, size, sig, 3))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -560,8 +560,8 @@ bool CartDetector::isProbablyE0(const ByteBuffer& image, size_t size)
|
|||
{ 0xAD, 0xED, 0xFF }, // LDA $FFED
|
||||
{ 0xAD, 0xF3, 0xBF } // LDA $BFF3
|
||||
};
|
||||
for(uInt32 i = 0; i < 8; ++i)
|
||||
if(searchForBytes(image, size, signature[i], 3))
|
||||
for(const auto* const sig: signature)
|
||||
if(searchForBytes(image, size, sig, 3))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -585,8 +585,8 @@ bool CartDetector::isProbablyE7(const ByteBuffer& image, size_t size)
|
|||
{ 0x8D, 0xE7, 0xFF }, // STA $FFE7
|
||||
{ 0x8D, 0xE7, 0x1F } // STA $1FE7
|
||||
};
|
||||
for(uInt32 i = 0; i < 7; ++i)
|
||||
if(searchForBytes(image, size, signature[i], 3))
|
||||
for(const auto* const sig: signature)
|
||||
if(searchForBytes(image, size, sig, 3))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -604,8 +604,8 @@ bool CartDetector::isProbablyE78K(const ByteBuffer& image, size_t size)
|
|||
{ 0xAD, 0xE5, 0xFF }, // LDA $FFE5
|
||||
{ 0xAD, 0xE6, 0xFF }, // LDA $FFE6
|
||||
};
|
||||
for(uInt32 i = 0; i < 3; ++i)
|
||||
if(searchForBytes(image, size, signature[i], 3))
|
||||
for(const auto* const sig: signature)
|
||||
if(searchForBytes(image, size, sig, 3))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -640,9 +640,9 @@ bool CartDetector::isProbablyEF(const ByteBuffer& image, size_t size,
|
|||
{ 0x0C, 0xE0, 0x1F }, // NOP $1FE0
|
||||
{ 0xAD, 0xE0, 0x1F } // LDA $1FE0
|
||||
};
|
||||
for(uInt32 i = 0; i < 4; ++i)
|
||||
for(const auto* const sig: signature)
|
||||
{
|
||||
if(searchForBytes(image, size, signature[i], 3))
|
||||
if(searchForBytes(image, size, sig, 3))
|
||||
{
|
||||
isEF = true;
|
||||
break;
|
||||
|
@ -684,8 +684,8 @@ bool CartDetector::isProbablyFC(const ByteBuffer& image, size_t size)
|
|||
{ 0x8d, 0xf8, 0xff, 0x8d, 0xfc, 0xff }, // STA $FFF8, STA $FFFC Surf's Up (4K)
|
||||
{ 0x8c, 0xf9, 0xff, 0xad, 0xfc, 0xff } // STY $FFF9, LDA $FFFC 3-D Havoc
|
||||
};
|
||||
for(uInt32 i = 0; i < 3; ++i)
|
||||
if(searchForBytes(image, size, signature[i], 6))
|
||||
for(const auto* const sig: signature)
|
||||
if(searchForBytes(image, size, sig, 6))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -703,8 +703,8 @@ bool CartDetector::isProbablyFE(const ByteBuffer& image, size_t size)
|
|||
{ 0xD0, 0xFB, 0x20, 0x73, 0xFE }, // BNE $FB; JSR $FE73
|
||||
{ 0x20, 0x00, 0xF0, 0x84, 0xD6 } // JSR $F000; $84, $D6
|
||||
};
|
||||
for(uInt32 i = 0; i < 4; ++i)
|
||||
if(searchForBytes(image, size, signature[i], 5))
|
||||
for(const auto* const sig: signature)
|
||||
if(searchForBytes(image, size, sig, 5))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -787,8 +787,8 @@ bool CartDetector::isProbablyUA(const ByteBuffer& image, size_t size)
|
|||
{ 0x8D, 0xC0, 0x02 }, // STA $2C0 (Fathom, Vanguard)
|
||||
{ 0xAD, 0xC0, 0x02 }, // LDA $2C0 (Mickey)
|
||||
};
|
||||
for(uInt32 i = 0; i < 6; ++i)
|
||||
if(searchForBytes(image, size, signature[i], 3))
|
||||
for(const auto* const sig: signature)
|
||||
if(searchForBytes(image, size, sig, 3))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -816,8 +816,8 @@ bool CartDetector::isProbablyX07(const ByteBuffer& image, size_t size)
|
|||
{ 0x0C, 0x1D, 0x08 }, // NOP $081D
|
||||
{ 0x0C, 0x2D, 0x08 } // NOP $082D
|
||||
};
|
||||
for(uInt32 i = 0; i < 6; ++i)
|
||||
if(searchForBytes(image, size, signature[i], 3))
|
||||
for(const auto* const sig: signature)
|
||||
if(searchForBytes(image, size, sig, 3))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
|
@ -37,7 +37,10 @@ void CartridgeE7::initialize(const ByteBuffer& image, size_t size)
|
|||
std::copy_n(image.get(), std::min<size_t>(romSize(), size), myImage.get());
|
||||
createRomAccessArrays(romSize() + myRAM.size());
|
||||
|
||||
myRAMBank = romBankCount() - 1;
|
||||
myRAM.fill(0xFF);
|
||||
myCurrentBank.fill(0);
|
||||
|
||||
myRAMBank = romBankCount() - 1; // NOLINT
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -98,8 +101,10 @@ void CartridgeE7::install(System& system)
|
|||
0, nullptr, 0x1fc0, System::PA_NONE, 0x1fc0);*/
|
||||
|
||||
// Setup the second segment to always point to the last ROM bank
|
||||
const auto offset = static_cast<uInt16>(myRAMBank * BANK_SIZE);
|
||||
setAccess(0x1A00, 0x1FE0U & (~System::PAGE_MASK - 0x1A00),
|
||||
myRAMBank * BANK_SIZE, myImage.get(), myRAMBank * BANK_SIZE, System::PageAccessType::READ, BANK_SIZE - 1);
|
||||
offset, myImage.get(), offset,
|
||||
System::PageAccessType::READ, static_cast<uInt16>(BANK_SIZE - 1));
|
||||
myCurrentBank[1] = myRAMBank;
|
||||
|
||||
// Install some default banks for the RAM and first segment
|
||||
|
@ -177,7 +182,7 @@ bool CartridgeE7::poke(uInt16 address, uInt8 value)
|
|||
else
|
||||
{
|
||||
// Writing to the read port should be ignored, but trigger a break if option enabled
|
||||
uInt8 dummy;
|
||||
uInt8 dummy{0};
|
||||
|
||||
pokeRAM(dummy, pokeAddress, value);
|
||||
myRamWriteAccess = pokeAddress;
|
||||
|
@ -197,7 +202,7 @@ bool CartridgeE7::poke(uInt16 address, uInt8 value)
|
|||
else
|
||||
{
|
||||
// Writing to the read port should be ignored, but trigger a break if option enabled
|
||||
uInt8 dummy;
|
||||
uInt8 dummy{0};
|
||||
|
||||
pokeRAM(dummy, pokeAddress, value);
|
||||
myRamWriteAccess = pokeAddress;
|
||||
|
@ -345,5 +350,5 @@ uInt16 CartridgeE7::romBankCount() const
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt16 CartridgeE7::romSize() const
|
||||
{
|
||||
return romBankCount() * BANK_SIZE;
|
||||
return romBankCount() * BANK_SIZE; // NOLINT
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ class CartridgeE7 : public Cartridge
|
|||
void checkSwitchBank(uInt16 address);
|
||||
|
||||
// Size of a ROM or RAM bank
|
||||
static constexpr uInt32 BANK_SIZE = 0x800; // 2K
|
||||
static constexpr size_t BANK_SIZE = 0x800; // 2K
|
||||
|
||||
private:
|
||||
// Size of RAM in the cart
|
||||
|
@ -221,8 +221,9 @@ class CartridgeE7 : public Cartridge
|
|||
*/
|
||||
uInt16 romSize() const;
|
||||
|
||||
void setAccess(uInt16 addrFrom, uInt16 size, uInt16 directOffset, uInt8* directData,
|
||||
uInt16 codeOffset, System::PageAccessType type, uInt16 addrMask = 0);
|
||||
void setAccess(uInt16 addrFrom, uInt16 size, uInt16 directOffset,
|
||||
uInt8* directData, uInt16 codeOffset,
|
||||
System::PageAccessType type, uInt16 addrMask = 0);
|
||||
|
||||
private:
|
||||
// Pointer to a dynamically allocated ROM image of the cartridge
|
||||
|
|
|
@ -100,27 +100,27 @@ void CartridgeEnhanced::install(System& system)
|
|||
// Set the page accessing method for the RAM writing pages
|
||||
// Note: Writes are mapped to poke() (NOT using directPokeBase) to check for read from write port (RWP)
|
||||
access.type = System::PageAccessType::WRITE;
|
||||
for(uInt16 addr = ROM_OFFSET + myWriteOffset; addr < ROM_OFFSET + myWriteOffset + myRamSize; addr += System::PAGE_SIZE)
|
||||
for(size_t addr = ROM_OFFSET + myWriteOffset; addr < ROM_OFFSET + myWriteOffset + myRamSize; addr += System::PAGE_SIZE)
|
||||
{
|
||||
const uInt16 offset = addr & myRamMask;
|
||||
|
||||
access.romAccessBase = &myRomAccessBase[myWriteOffset + offset];
|
||||
access.romPeekCounter = &myRomAccessCounter[myWriteOffset + offset];
|
||||
access.romPokeCounter = &myRomAccessCounter[myWriteOffset + offset + myAccessSize];
|
||||
mySystem->setPageAccess(addr, access);
|
||||
mySystem->setPageAccess(static_cast<uInt16>(addr), access);
|
||||
}
|
||||
|
||||
// Set the page accessing method for the RAM reading pages
|
||||
access.type = System::PageAccessType::READ;
|
||||
for(uInt16 addr = ROM_OFFSET + myReadOffset; addr < ROM_OFFSET + myReadOffset + myRamSize; addr += System::PAGE_SIZE)
|
||||
for(size_t addr = ROM_OFFSET + myReadOffset; addr < ROM_OFFSET + myReadOffset + myRamSize; addr += System::PAGE_SIZE)
|
||||
{
|
||||
const uInt16 offset = addr & myRamMask;
|
||||
const size_t offset = addr & myRamMask;
|
||||
|
||||
access.directPeekBase = &myRAM[offset];
|
||||
access.romAccessBase = &myRomAccessBase[myReadOffset + offset];
|
||||
access.romPeekCounter = &myRomAccessCounter[myReadOffset + offset];
|
||||
access.romPokeCounter = &myRomAccessCounter[myReadOffset + offset + myAccessSize];
|
||||
mySystem->setPageAccess(addr, access);
|
||||
mySystem->setPageAccess(static_cast<uInt16>(addr), access);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ bool CartridgeEnhanced::poke(uInt16 address, uInt8 value)
|
|||
}
|
||||
}
|
||||
// Writing to the read port should be ignored, but trigger a break if option enabled
|
||||
uInt8 dummy;
|
||||
uInt8 dummy{0};
|
||||
|
||||
pokeRAM(dummy, pokeAddress, value);
|
||||
myRamWriteAccess = pokeAddress;
|
||||
|
|
|
@ -135,7 +135,7 @@ class StreamReader : public Serializable
|
|||
|
||||
uInt8 readAudio() { return *myAudio++; }
|
||||
|
||||
uInt8 peekAudio() const { return *myAudio; }
|
||||
[[nodiscard]] uInt8 peekAudio() const { return *myAudio; }
|
||||
|
||||
void startTimeCode() { myGraph = myTimecode; }
|
||||
|
||||
|
@ -744,7 +744,7 @@ class MovieCart : public Serializable
|
|||
bool save(Serializer& out) const override;
|
||||
bool load(Serializer& in) override;
|
||||
|
||||
uInt8 readROM(uInt16 address) const {
|
||||
[[nodiscard]] uInt8 readROM(uInt16 address) const {
|
||||
return myROM[address & 1023];
|
||||
}
|
||||
|
||||
|
@ -1091,7 +1091,6 @@ void MovieCart::updateTransport()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void MovieCart::fill_addr_right_line()
|
||||
{
|
||||
uint8_t v;
|
||||
writeAudio(addr_set_aud_right + 1);
|
||||
|
||||
writeGraph(addr_set_gdata5 + 1);
|
||||
|
@ -1100,7 +1099,7 @@ void MovieCart::fill_addr_right_line()
|
|||
writeGraph(addr_set_gdata8 + 1);
|
||||
writeGraph(addr_set_gdata9 + 1);
|
||||
|
||||
v = myStream.readColor();
|
||||
uint8_t v = myStream.readColor();
|
||||
writeColor(addr_set_gcol5 + 1, v);
|
||||
|
||||
v = myStream.readColor();
|
||||
|
@ -1118,21 +1117,19 @@ void MovieCart::fill_addr_right_line()
|
|||
// alternate between background color and playfield color
|
||||
if (myForceColor)
|
||||
{
|
||||
v = 0;
|
||||
writeROM(addr_set_colubk_r + 1, v);
|
||||
v = 0;
|
||||
writeROM(addr_set_colubk_r + 1, v);
|
||||
}
|
||||
else
|
||||
{
|
||||
v = myStream.readColorBK();
|
||||
writeColor(addr_set_colubk_r + 1, v);
|
||||
v = myStream.readColorBK();
|
||||
writeColor(addr_set_colubk_r + 1, v);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void MovieCart::fill_addr_left_line(bool again)
|
||||
{
|
||||
uint8_t v;
|
||||
|
||||
writeAudio(addr_set_aud_left + 1);
|
||||
|
||||
writeGraph(addr_set_gdata0 + 1);
|
||||
|
@ -1141,7 +1138,7 @@ void MovieCart::fill_addr_left_line(bool again)
|
|||
writeGraph(addr_set_gdata3 + 1);
|
||||
writeGraph(addr_set_gdata4 + 1);
|
||||
|
||||
v = myStream.readColor();
|
||||
uint8_t v = myStream.readColor();
|
||||
writeColor(addr_set_gcol0 + 1, v);
|
||||
|
||||
v = myStream.readColor();
|
||||
|
@ -1160,13 +1157,13 @@ void MovieCart::fill_addr_left_line(bool again)
|
|||
// alternate between background color and playfield color
|
||||
if (myForceColor)
|
||||
{
|
||||
v = 0;
|
||||
writeROM(addr_set_colupf_l + 1, v);
|
||||
v = 0;
|
||||
writeROM(addr_set_colupf_l + 1, v);
|
||||
}
|
||||
else
|
||||
{
|
||||
v = myStream.readColorBK();
|
||||
writeColor(addr_set_colupf_l + 1, v);
|
||||
v = myStream.readColorBK();
|
||||
writeColor(addr_set_colupf_l + 1, v);
|
||||
}
|
||||
|
||||
// addr_pick_line_end
|
||||
|
@ -1330,9 +1327,11 @@ void MovieCart::runStateMachine()
|
|||
}
|
||||
|
||||
if(myOdd)
|
||||
myStream.overrideGraph(&levelBarsOddData[levelValue * 40]);
|
||||
myStream.overrideGraph(
|
||||
&levelBarsOddData[static_cast<ptrdiff_t>(levelValue) * 40]);
|
||||
else
|
||||
myStream.overrideGraph(&levelBarsEvenData[levelValue * 40]);
|
||||
myStream.overrideGraph(
|
||||
&levelBarsEvenData[static_cast<ptrdiff_t>(levelValue) * 40]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1362,14 +1361,14 @@ void MovieCart::runStateMachine()
|
|||
|
||||
if(myLines >= 1)
|
||||
{
|
||||
fill_addr_left_line(1);
|
||||
fill_addr_left_line(true);
|
||||
|
||||
myLines -= 1;
|
||||
myState = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
fill_addr_left_line(0);
|
||||
fill_addr_left_line(false);
|
||||
fill_addr_end_lines();
|
||||
|
||||
myStream.swapField(myBufferIndex, myOdd);
|
||||
|
@ -1411,8 +1410,8 @@ void MovieCart::runStateMachine()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool MovieCart::process(uInt16 address)
|
||||
{
|
||||
const bool a12 = (address & (1 << 12)) ? 1:0;
|
||||
const bool a11 = (address & (1 << 11)) ? 1:0;
|
||||
const bool a12 = (address & (1 << 12));
|
||||
const bool a11 = (address & (1 << 11));
|
||||
|
||||
// count a10 pulses
|
||||
const bool a10i = (address & (1 << 10));
|
||||
|
@ -1570,7 +1569,7 @@ CartridgeMVC::CartridgeMVC(const string& path, size_t size,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeMVC::~CartridgeMVC()
|
||||
CartridgeMVC::~CartridgeMVC() // NOLINT (we need an empty d'tor)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class MovieCart;
|
|||
class CartridgeMVC : public Cartridge
|
||||
{
|
||||
public:
|
||||
static constexpr uInt32
|
||||
static constexpr size_t
|
||||
MVC_FIELD_SIZE = 2560, // round field to nearest 512 byte boundary
|
||||
MVC_FIELD_PAD_SIZE = 4096; // round to nearest 4K
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
|
|||
setControllers(md5);
|
||||
|
||||
// Mute audio and clear framebuffer while autodetection runs
|
||||
myOSystem.sound().mute(1);
|
||||
myOSystem.sound().mute(true);
|
||||
myOSystem.frameBuffer().clear();
|
||||
|
||||
if(myDisplayFormat == "AUTO" || myOSystem.settings().getBool("rominfo"))
|
||||
|
@ -360,13 +360,13 @@ string Console::formatFromFilename() const
|
|||
|
||||
// Get filename, and search using regex's above
|
||||
const string& filename = myOSystem.romFile().getName();
|
||||
for(size_t i = 0; i < Pattern.size(); ++i)
|
||||
for(const auto& pat: Pattern)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::regex rgx(Pattern[i][0], std::regex_constants::icase);
|
||||
std::regex rgx(pat[0], std::regex_constants::icase);
|
||||
if(std::regex_search(filename, rgx))
|
||||
return Pattern[i][1];
|
||||
return pat[1];
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
|
@ -1129,7 +1129,7 @@ void Console::changePaddleAxesRange(int direction)
|
|||
{
|
||||
istringstream m_axis(myProperties.get(PropType::Controller_MouseAxis));
|
||||
string mode = "AUTO";
|
||||
int range;
|
||||
int range{0};
|
||||
|
||||
m_axis >> mode;
|
||||
if(!(m_axis >> range))
|
||||
|
|
|
@ -181,16 +181,16 @@ bool ControllerDetector::usesJoystickButton(const ByteBuffer& image, size_t size
|
|||
{ 0xad, 0x0c, 0x00, 0x29, 0x80 } // lda.w INPT4|$30; and #$80 (joystick games only)
|
||||
};
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS_0; ++i)
|
||||
if(searchForBytes(image, size, signature_0[i], SIG_SIZE_0))
|
||||
for(const auto* const sig: signature_0)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_0))
|
||||
return true;
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS_1; ++i)
|
||||
if(searchForBytes(image, size, signature_1[i], SIG_SIZE_1))
|
||||
for(const auto* const sig: signature_1)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_1))
|
||||
return true;
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS_2; ++i)
|
||||
if(searchForBytes(image, size, signature_2[i], SIG_SIZE_2))
|
||||
for(const auto* const sig: signature_2)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_2))
|
||||
return true;
|
||||
}
|
||||
else if(port == Controller::Jack::Right)
|
||||
|
@ -235,16 +235,16 @@ bool ControllerDetector::usesJoystickButton(const ByteBuffer& image, size_t size
|
|||
{ 0xad, 0x0d, 0x00, 0x29, 0x80 } // lda.w INPT5|$30; and #$80 (joystick games only)
|
||||
};
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS_0; ++i)
|
||||
if(searchForBytes(image, size, signature_0[i], SIG_SIZE_0))
|
||||
for(const auto* const sig: signature_0)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_0))
|
||||
return true;
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS_1; ++i)
|
||||
if(searchForBytes(image, size, signature_1[i], SIG_SIZE_1))
|
||||
for(const auto* const sig: signature_1)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_1))
|
||||
return true;
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS_2; ++i)
|
||||
if(searchForBytes(image, size, signature_2[i], SIG_SIZE_2))
|
||||
for(const auto* const sig: signature_2)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_2))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -268,8 +268,8 @@ bool ControllerDetector::usesJoystickDirections(const ByteBuffer& image, size_t
|
|||
{ 0xad, 0x88, 0x02 }, // lda SWCHA|8 (Jawbreaker)
|
||||
};
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS; ++i)
|
||||
if(searchForBytes(image, size, signature[i], SIG_SIZE))
|
||||
for(const auto* const sig: signature)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -319,29 +319,29 @@ bool ControllerDetector::usesKeyboard(const ByteBuffer& image, size_t size,
|
|||
|
||||
bool found = false;
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS_0_0; ++i)
|
||||
if(searchForBytes(image, size, signature_0_0[i], SIG_SIZE_0_0))
|
||||
for(const auto* const sig: signature_0_0)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_0_0))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
if(!found)
|
||||
for(uInt32 i = 0; i < NUM_SIGS_0_2; ++i)
|
||||
if(searchForBytes(image, size, signature_0_2[i], SIG_SIZE_0_2))
|
||||
for(const auto* const sig: signature_0_2)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_0_2))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
if(found)
|
||||
{
|
||||
for(uInt32 j = 0; j < NUM_SIGS_1_0; ++j)
|
||||
if(searchForBytes(image, size, signature_1_0[j], SIG_SIZE_1_0))
|
||||
for(const auto* const sig: signature_1_0)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_1_0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
for(uInt32 j = 0; j < NUM_SIGS_1_2; ++j)
|
||||
if(searchForBytes(image, size, signature_1_2[j], SIG_SIZE_1_2))
|
||||
for(const auto* const sig: signature_1_2)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_1_2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -384,16 +384,16 @@ bool ControllerDetector::usesKeyboard(const ByteBuffer& image, size_t size,
|
|||
|
||||
bool found = false;
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS_0_0; ++i)
|
||||
if(searchForBytes(image, size, signature_0_0[i], SIG_SIZE_0_0))
|
||||
for(const auto* const sig: signature_0_0)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_0_0))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(!found)
|
||||
for(uInt32 i = 0; i < NUM_SIGS_0_2; ++i)
|
||||
if(searchForBytes(image, size, signature_0_2[i], SIG_SIZE_0_2))
|
||||
for(const auto* const sig: signature_0_2)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_0_2))
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
|
@ -401,14 +401,14 @@ bool ControllerDetector::usesKeyboard(const ByteBuffer& image, size_t size,
|
|||
|
||||
if(found)
|
||||
{
|
||||
for(uInt32 j = 0; j < NUM_SIGS_1_0; ++j)
|
||||
if(searchForBytes(image, size, signature_1_0[j], SIG_SIZE_1_0))
|
||||
for(const auto* const sig: signature_1_0)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_1_0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
for(uInt32 j = 0; j < NUM_SIGS_1_2; ++j)
|
||||
if(searchForBytes(image, size, signature_1_2[j], SIG_SIZE_1_2))
|
||||
for(const auto* const sig: signature_1_2)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_1_2))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -448,8 +448,8 @@ bool ControllerDetector::usesGenesisButton(const ByteBuffer& image, size_t size,
|
|||
{ 0x25, 0x39, 0x30 }, // and INPT1|$30; bmi (Genesis only)
|
||||
{ 0x25, 0x09, 0x10 } // and INPT1; bpl (Genesis only)
|
||||
};
|
||||
for(uInt32 i = 0; i < NUM_SIGS_0; ++i)
|
||||
if(searchForBytes(image, size, signature_0[i], SIG_SIZE_0))
|
||||
for(const auto* const sig: signature_0)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_0))
|
||||
return true;
|
||||
}
|
||||
else if(port == Controller::Jack::Right)
|
||||
|
@ -469,8 +469,8 @@ bool ControllerDetector::usesGenesisButton(const ByteBuffer& image, size_t size,
|
|||
{ 0xa6, 0x3b, 0x8e }, // ldx INPT3|$30; stx
|
||||
{ 0x25, 0x0b, 0x10 } // and INPT3; bpl (Genesis only)
|
||||
};
|
||||
for(uInt32 i = 0; i < NUM_SIGS_0; ++i)
|
||||
if(searchForBytes(image, size, signature_0[i], SIG_SIZE_0))
|
||||
for(const auto* const sig: signature_0)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_0))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -519,16 +519,16 @@ bool ControllerDetector::usesPaddle(const ByteBuffer& image, size_t size,
|
|||
{ 0xb1, 0xf2, 0x30, 0x02, 0xe6 } // lda ($f2),y; bmi...; inc (Warplock)
|
||||
};
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS_0; ++i)
|
||||
if(searchForBytes(image, size, signature_0[i], SIG_SIZE_0))
|
||||
for(const auto* const sig: signature_0)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_0))
|
||||
return true;
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS_1; ++i)
|
||||
if(searchForBytes(image, size, signature_1[i], SIG_SIZE_1))
|
||||
for(const auto* const sig: signature_1)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_1))
|
||||
return true;
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS_2; ++i)
|
||||
if(searchForBytes(image, size, signature_2[i], SIG_SIZE_2))
|
||||
for(const auto* const sig: signature_2)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_2))
|
||||
return true;
|
||||
}
|
||||
else if(port == Controller::Jack::Right)
|
||||
|
@ -569,16 +569,16 @@ bool ControllerDetector::usesPaddle(const ByteBuffer& image, size_t size,
|
|||
{ 0xb5, 0x38, 0x49, 0xff, 0x0a } // lda INPT0|$30,x; eor #$ff; asl (Blackjack)
|
||||
};
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS_0; ++i)
|
||||
if(searchForBytes(image, size, signature_0[i], SIG_SIZE_0))
|
||||
for(const auto* const sig: signature_0)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_0))
|
||||
return true;
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS_1; ++i)
|
||||
if(searchForBytes(image, size, signature_1[i], SIG_SIZE_1))
|
||||
for(const auto* const sig: signature_1)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_1))
|
||||
return true;
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS_2; ++i)
|
||||
if(searchForBytes(image, size, signature_2[i], SIG_SIZE_2))
|
||||
for(const auto* const sig: signature_2)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE_2))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -597,8 +597,8 @@ bool ControllerDetector::isProbablyTrakBall(const ByteBuffer& image, size_t size
|
|||
{ 0x00, 0x01, 0x81, 0x01, 0x82, 0x03 } // .MovementTab_1 (Omegamatrix)
|
||||
}; // all pattern checked, only TrakBall matches
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS; ++i)
|
||||
if(searchForBytes(image, size, signature[i], SIG_SIZE))
|
||||
for(const auto* const sig: signature)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -616,8 +616,8 @@ bool ControllerDetector::isProbablyAtariMouse(const ByteBuffer& image, size_t si
|
|||
{ 0x00, 0x81, 0x01, 0x00, 0x02, 0x83 } // .MovementTab_1 (Omegamatrix)
|
||||
}; // all pattern checked, only Atari Mouse matches
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS; ++i)
|
||||
if(searchForBytes(image, size, signature[i], SIG_SIZE))
|
||||
for(const auto* const sig: signature)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -636,8 +636,8 @@ bool ControllerDetector::isProbablyAmigaMouse(const ByteBuffer& image, size_t si
|
|||
{ 0b100, 0b000, 0b000, 0b000, 0b101, 0b001} // NextTrackTbl (T. Jentzsch, MCTB)
|
||||
}; // all pattern checked, only Amiga Mouse matches
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS; ++i)
|
||||
if(searchForBytes(image, size, signature[i], SIG_SIZE))
|
||||
for(const auto* const sig: signature)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -680,8 +680,8 @@ bool ControllerDetector::isProbablySaveKey(const ByteBuffer& image, size_t size,
|
|||
}
|
||||
};
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS; ++i)
|
||||
if(searchForBytes(image, size, signature[i], SIG_SIZE))
|
||||
for(const auto* const sig: signature)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -702,8 +702,8 @@ bool ControllerDetector::isProbablyLightGun(const ByteBuffer& image, size_t size
|
|||
{ 0xea, 0xea, 0xea, 0x24, 0x3c, 0x10 }
|
||||
}; // all pattern checked, only 'Sentinel' and 'Shooting Arcade' match
|
||||
|
||||
for (uInt32 i = 0; i < NUM_SIGS; ++i)
|
||||
if (searchForBytes(image, size, signature[i], SIG_SIZE))
|
||||
for(const auto* const sig: signature)
|
||||
if (searchForBytes(image, size, sig, SIG_SIZE))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -718,8 +718,8 @@ bool ControllerDetector::isProbablyLightGun(const ByteBuffer& image, size_t size
|
|||
{ 0xea, 0xea, 0xea, 0x24, 0x3d, 0x10 }
|
||||
}; // all pattern checked, only 'Bobby is Hungry' matches
|
||||
|
||||
for (uInt32 i = 0; i < NUM_SIGS; ++i)
|
||||
if (searchForBytes(image, size, signature[i], SIG_SIZE))
|
||||
for(const auto* const sig: signature)
|
||||
if (searchForBytes(image, size, sig, SIG_SIZE))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -737,8 +737,8 @@ bool ControllerDetector::isProbablyQuadTari(const ByteBuffer& image, size_t size
|
|||
{ 'Q', 'U', 'A', 'D', 'T', 'A', 'R', 'I' }
|
||||
}; // "QUADTARI"
|
||||
|
||||
for(uInt32 i = 0; i < NUM_SIGS; ++i)
|
||||
if(searchForBytes(image, size, signatureBoth[i], SIG_SIZE))
|
||||
for(const auto* const sig: signatureBoth)
|
||||
if(searchForBytes(image, size, sig, SIG_SIZE))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ uInt64 EmulationWorker::stop()
|
|||
// See EmulationWorker::start above for the gory details
|
||||
waitUntilPendingSignalHasProcessed();
|
||||
|
||||
uInt64 totalCycles;
|
||||
uInt64 totalCycles{0};
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(myThreadIsRunningMutex);
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ EventHandler::EventHandler(OSystem& osystem)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
EventHandler::~EventHandler()
|
||||
EventHandler::~EventHandler() // NOLINT (we need an empty d'tor)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -2015,7 +2015,7 @@ json EventHandler::convertLegacyComboMapping(string list)
|
|||
|
||||
try
|
||||
{
|
||||
int numCombos;
|
||||
int numCombos{0};
|
||||
// Get combo count, which should be the first int in the list
|
||||
// If it isn't, then we treat the entire list as invalid
|
||||
buf >> numCombos;
|
||||
|
@ -2028,8 +2028,7 @@ json EventHandler::convertLegacyComboMapping(string list)
|
|||
|
||||
for(int j = 0; j < EVENTS_PER_COMBO; ++j)
|
||||
{
|
||||
int event;
|
||||
|
||||
int event{0};
|
||||
buf >> event;
|
||||
// skip all NoType events
|
||||
if(event != Event::NoType)
|
||||
|
@ -2362,10 +2361,10 @@ int EventHandler::getEmulActionListIndex(int idx, const Event::EventSet& events)
|
|||
// ordered by 'ourEmulActionList'!
|
||||
Event::Type event = Event::NoType;
|
||||
|
||||
for(uInt32 i = 0; i < ourEmulActionList.size(); ++i)
|
||||
for(auto& alist: ourEmulActionList)
|
||||
{
|
||||
for(const auto& item : events)
|
||||
if(EventHandler::ourEmulActionList[i].event == item)
|
||||
if(alist.event == item)
|
||||
{
|
||||
idx--;
|
||||
if(idx < 0)
|
||||
|
|
|
@ -147,7 +147,7 @@ class FBBackend
|
|||
@param pitch The pitch (in bytes) for the pixel data
|
||||
@param rect The bounding rectangle for the buffer
|
||||
*/
|
||||
virtual void readPixels(uInt8* buffer, uInt32 pitch,
|
||||
virtual void readPixels(uInt8* buffer, size_t pitch,
|
||||
const Common::Rect& rect) const = 0;
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FBSurface::readPixels(uInt8* buffer, uInt32 pitch, const Common::Rect& rect) const
|
||||
{
|
||||
uInt8* src = reinterpret_cast<uInt8*>(myPixels + rect.y() * myPitch + rect.x());
|
||||
auto* src = reinterpret_cast<uInt8*>(myPixels +
|
||||
(rect.y() * static_cast<size_t>(myPitch)) + rect.x());
|
||||
|
||||
if(rect.empty())
|
||||
std::copy_n(src, width() * height() * 4, buffer);
|
||||
|
@ -42,8 +43,8 @@ void FBSurface::readPixels(uInt8* buffer, uInt32 pitch, const Common::Rect& rect
|
|||
while(h--)
|
||||
{
|
||||
std::copy_n(src, w * 4, dst);
|
||||
src += myPitch * 4;
|
||||
dst += pitch * 4;
|
||||
src += static_cast<size_t>(myPitch) * 4;
|
||||
dst += static_cast<size_t>(pitch) * 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +53,7 @@ void FBSurface::readPixels(uInt8* buffer, uInt32 pitch, const Common::Rect& rect
|
|||
void FBSurface::pixel(uInt32 x, uInt32 y, ColorId color)
|
||||
{
|
||||
// Note: checkbounds() must be done in calling method
|
||||
uInt32* buffer = myPixels + y * myPitch + x;
|
||||
uInt32* buffer = myPixels + (y * static_cast<size_t>(myPitch)) + x;
|
||||
|
||||
*buffer = myPalette[color];
|
||||
}
|
||||
|
@ -125,7 +126,7 @@ void FBSurface::hLine(uInt32 x, uInt32 y, uInt32 x2, ColorId color)
|
|||
if(!checkBounds(x, y) || !checkBounds(x2, 2))
|
||||
return;
|
||||
|
||||
uInt32* buffer = myPixels + y * myPitch + x;
|
||||
uInt32* buffer = myPixels + (y * static_cast<size_t>(myPitch)) + x;
|
||||
while(x++ <= x2)
|
||||
*buffer++ = myPalette[color];
|
||||
}
|
||||
|
@ -136,7 +137,7 @@ void FBSurface::vLine(uInt32 x, uInt32 y, uInt32 y2, ColorId color)
|
|||
if(!checkBounds(x, y) || !checkBounds(x, y2))
|
||||
return;
|
||||
|
||||
uInt32* buffer = myPixels + y * myPitch + x;
|
||||
uInt32* buffer = myPixels + (y * static_cast<size_t>(myPitch)) + x;
|
||||
while(y++ <= y2)
|
||||
{
|
||||
*buffer = myPalette[color];
|
||||
|
@ -197,7 +198,7 @@ void FBSurface::drawChar(const GUI::Font& font, uInt8 chr,
|
|||
return;
|
||||
|
||||
const uInt16* tmp = desc.bits + (desc.offset ? desc.offset[chr] : (chr * desc.fbbh));
|
||||
uInt32* buffer = myPixels + cy * myPitch + cx;
|
||||
uInt32* buffer = myPixels + (cy * static_cast<size_t>(myPitch)) + cx;
|
||||
|
||||
for(int y = 0; y < bbh; y++)
|
||||
{
|
||||
|
@ -227,7 +228,7 @@ void FBSurface::drawBitmap(const uInt32* bitmap, uInt32 tx, uInt32 ty,
|
|||
if(!checkBounds(tx, ty) || !checkBounds(tx + w - 1, ty + h - 1))
|
||||
return;
|
||||
|
||||
uInt32* buffer = myPixels + ty * myPitch + tx;
|
||||
uInt32* buffer = myPixels + (ty * static_cast<size_t>(myPitch)) + tx;
|
||||
|
||||
for(uInt32 y = 0; y < h; ++y)
|
||||
{
|
||||
|
@ -246,7 +247,7 @@ void FBSurface::drawPixels(const uInt32* data, uInt32 tx, uInt32 ty, uInt32 nump
|
|||
if(!checkBounds(tx, ty) || !checkBounds(tx + numpixels - 1, ty))
|
||||
return;
|
||||
|
||||
uInt32* buffer = myPixels + ty * myPitch + tx;
|
||||
uInt32* buffer = myPixels + (ty * static_cast<size_t>(myPitch)) + tx;
|
||||
|
||||
for(uInt32 i = 0; i < numpixels; ++i)
|
||||
*buffer++ = data[i];
|
||||
|
@ -401,14 +402,14 @@ void FBSurface::drawString(const GUI::Font& font, const string& s,
|
|||
int w2 = font.getStringWidth(ELLIPSIS);
|
||||
|
||||
// SLOW algorithm to find the acceptable length. But it is good enough for now.
|
||||
for(size_t i = 0; i < s.size(); ++i)
|
||||
for(auto c: s)
|
||||
{
|
||||
const int charWidth = font.getCharWidth(s[i]);
|
||||
const int charWidth = font.getCharWidth(c);
|
||||
if(w2 + charWidth > w)
|
||||
break;
|
||||
|
||||
w2 += charWidth;
|
||||
str += s[i];
|
||||
str += c;
|
||||
}
|
||||
str += ELLIPSIS;
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ FrameBuffer::FrameBuffer(OSystem& osystem)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
FrameBuffer::~FrameBuffer()
|
||||
FrameBuffer::~FrameBuffer() // NOLINT (we need an empty d'tor)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -512,7 +512,7 @@ void FrameBuffer::update(UpdateMode mode)
|
|||
success = r.unwindStates(1);
|
||||
|
||||
// Determine playback speed, the faster the more the states are apart
|
||||
const Int64 frameCycles = 76 * std::max<Int32>(myOSystem.console().tia().scanlinesLastFrame(), 240);
|
||||
const Int64 frameCycles = static_cast<Int64>(76) * std::max<Int32>(myOSystem.console().tia().scanlinesLastFrame(), 240);
|
||||
const Int64 intervalFrames = r.getInterval() / frameCycles;
|
||||
const Int64 stateFrames = (r.getCurrentCycles() - prevCycles) / frameCycles;
|
||||
|
||||
|
@ -616,7 +616,7 @@ void FrameBuffer::createMessage(const string& message, MessagePosition position,
|
|||
const int fontHeight = font().getFontHeight();
|
||||
const int VBORDER = fontHeight / 4;
|
||||
|
||||
myMsg.counter = std::min(uInt32(myOSystem.frameRate()) * 2, 120u); // Show message for 2 seconds
|
||||
myMsg.counter = std::min(uInt32(myOSystem.frameRate()) * 2, 120U); // Show message for 2 seconds
|
||||
if(myMsg.counter == 0)
|
||||
myMsg.counter = 120;
|
||||
|
||||
|
@ -925,7 +925,7 @@ shared_ptr<FBSurface> FrameBuffer::allocateSurface(
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FrameBuffer::deallocateSurface(shared_ptr<FBSurface> surface)
|
||||
void FrameBuffer::deallocateSurface(const shared_ptr<FBSurface>& surface)
|
||||
{
|
||||
if(surface)
|
||||
mySurfaceList.remove(surface);
|
||||
|
|
|
@ -171,7 +171,7 @@ class FrameBuffer
|
|||
|
||||
@param surface The surface to remove/deallocate
|
||||
*/
|
||||
void deallocateSurface(shared_ptr<FBSurface> surface);
|
||||
void deallocateSurface(const shared_ptr<FBSurface>& surface);
|
||||
|
||||
/**
|
||||
Set up the TIA/emulation palette. Due to the way the palette is stored,
|
||||
|
@ -370,7 +370,7 @@ class FrameBuffer
|
|||
@param pitch The pitch (in bytes) for the pixel data
|
||||
@param rect The bounding rectangle for the buffer
|
||||
*/
|
||||
void readPixels(uInt8* buffer, uInt32 pitch, const Common::Rect& rect) const {
|
||||
void readPixels(uInt8* buffer, size_t pitch, const Common::Rect& rect) const {
|
||||
myBackend->readPixels(buffer, pitch, rect);
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ bool GlobalKeyHandler::handleEvent(const Event::Type event, bool pressed, bool r
|
|||
if(pressed && !repeated)
|
||||
{
|
||||
const int direction = (event == Event::PreviousSettingGroup ? -1 : +1);
|
||||
const Group group = static_cast<Group>(
|
||||
const auto group = static_cast<Group>(
|
||||
BSPF::clampw(static_cast<int>(getGroup()) + direction,
|
||||
0, static_cast<int>(Group::NUM_GROUPS) - 1));
|
||||
const std::map<Group, GroupData> GroupMap = {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue