Skip to content

Commit

Permalink
Fixes for minor warnings from clang-tidy.
Browse files Browse the repository at this point in the history
  • Loading branch information
sa666666 committed Dec 29, 2024
1 parent 907f687 commit 28b6e7b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 21 deletions.
14 changes: 7 additions & 7 deletions src/emucore/Console.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -395,22 +395,24 @@ string Console::formatFromSignature() const
static constexpr uInt8 PAL_60[] = { 'P', 'A', 'L', ' ', '6', '0'};
static constexpr uInt8 PAL__60[] = { 'P', 'A', 'L', '-', '6', '0'};

size_t size;
size_t size = 0;
const ByteBuffer& image = myCart->getImage(size);

if(searchForBytes(image, size, PAL60, 5) ||
searchForBytes(image, size, PAL_60, 6) ||
searchForBytes(image, size, PAL__60, 6))
searchForBytes(image, size, PAL_60, 6) ||
searchForBytes(image, size, PAL__60, 6))
return "PAL60";

// Nothing found
return "AUTO";
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Console::searchForBytes(const ByteBuffer& image, size_t imagesize,
const uInt8* signature, uInt32 sigsize) const
const uInt8* signature, uInt32 sigsize)
{
if(imagesize >= sigsize)
{
for(uInt32 i = 0; i < imagesize - sigsize; ++i)
{
uInt32 matches = 0;
Expand All @@ -422,11 +424,9 @@ bool Console::searchForBytes(const ByteBuffer& image, size_t imagesize,
break;
}
if(matches == sigsize)
{
return true;
}
}

}
return false;
}

Expand Down
27 changes: 13 additions & 14 deletions src/emucore/Console.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -426,20 +426,6 @@ class Console : public Serializable, public ConsoleIO
*/
string formatFromSignature() const;

/**
Search the image for the specified byte signature.
@param image A pointer to the ROM image
@param imagesize The size of the ROM image
@param signature The byte sequence to search for
@param sigsize The number of bytes in the signature
@return True if the signature was found, else false
*/
bool searchForBytes(const ByteBuffer& image, size_t imagesize,
const uInt8* signature, uInt32 sigsize) const;


/**
Create the audio queue
*/
Expand All @@ -457,6 +443,19 @@ class Console : public Serializable, public ConsoleIO
void toggleTIACollision(TIABit bit, string_view bitname,
bool show = true, bool toggle = true) const;

/**
Search the image for the specified byte signature.
@param image A pointer to the ROM image
@param imagesize The size of the ROM image
@param signature The byte sequence to search for
@param sigsize The number of bytes in the signature
@return True if the signature was found, else false
*/
static bool searchForBytes(const ByteBuffer& image, size_t imagesize,
const uInt8* signature, uInt32 sigsize);

private:
// Reference to the osystem object
OSystem& myOSystem;
Expand Down
2 changes: 2 additions & 0 deletions src/emucore/tia/frame-manager/FrameManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ void FrameManager::setAdjustVSize(Int32 adjustVSize)
void FrameManager::onSetVblank(uInt64 cycles)
{
if (myState == State::waitForVsyncEnd)
{
if (myVblank) // VBLANK switched on
{
myVblankStart = cycles;
Expand All @@ -129,6 +130,7 @@ void FrameManager::onSetVblank(uInt64 cycles)
{
myVblankCycles += cycles - myVblankStart;
}
}
}

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expand Down

0 comments on commit 28b6e7b

Please sign in to comment.