libretro: Run clang-tidy on all files.

This commit is contained in:
Stephen Anthony 2024-08-03 21:15:22 -02:30
parent 67974a92e0
commit 352c449940
7 changed files with 37 additions and 21 deletions

View File

@ -34,7 +34,7 @@ class FBBackendLIBRETRO : public FBBackend
{
public:
explicit FBBackendLIBRETRO(OSystem&) { }
~FBBackendLIBRETRO() override { }
~FBBackendLIBRETRO() override = default;
protected:
/**

View File

@ -33,7 +33,7 @@ class FBSurfaceLIBRETRO : public FBSurface
FBSurfaceLIBRETRO(uInt32 width, uInt32 height)
: myWidth{width},
myHeight{height},
myPixelData{make_unique<uInt32[]>(myWidth * myHeight)}
myPixelData{make_unique<uInt32[]>(static_cast<size_t>(myWidth) * myHeight)}
{
////////////////////////////////////////////////////
// These *must* be set for the parent class
@ -41,7 +41,7 @@ class FBSurfaceLIBRETRO : public FBSurface
myPitch = myWidth;
////////////////////////////////////////////////////
}
~FBSurfaceLIBRETRO() override { }
~FBSurfaceLIBRETRO() override = default;
// Most of the surface drawing primitives are implemented in FBSurface;
void fillRect(uInt32 x, uInt32 y, uInt32 w,

View File

@ -20,7 +20,6 @@
#include "FSNode.hxx"
#include "OSystem.hxx"
#include "OSystemLIBRETRO.hxx"
#include "repository/KeyValueRepositoryNoop.hxx"
#include "repository/CompositeKeyValueRepositoryNoop.hxx"
@ -80,6 +79,13 @@ class OSystemLIBRETRO : public OSystem
protected:
void initPersistence(FSNode& basedir) override { }
string describePresistence() override { return "none"; }
private:
// Following constructors and assignment operators not supported
OSystemLIBRETRO(const OSystemLIBRETRO&) = delete;
OSystemLIBRETRO(OSystemLIBRETRO&&) = delete;
OSystemLIBRETRO& operator=(const OSystemLIBRETRO&) = delete;
OSystemLIBRETRO& operator=(OSystemLIBRETRO&&) = delete;
};
#endif

View File

@ -104,15 +104,15 @@ class SoundLIBRETRO : public Sound
for (uInt32 i = 0; i < myAudioQueue->fragmentSize(); ++i)
{
Int16 sampleL, sampleR;
Int16 sampleL = 0, sampleR = 0;
if (myAudioQueue->isStereo())
{
sampleL = static_cast<Int16>(myCurrentFragment[2*i + 0]);
sampleR = static_cast<Int16>(myCurrentFragment[2*i + 1]);
sampleL = myCurrentFragment[2*i + 0];
sampleR = myCurrentFragment[2*i + 1];
}
else
sampleL = sampleR = static_cast<Int16>(myCurrentFragment[i]);
sampleL = sampleR = myCurrentFragment[i];
stream[outIndex++] = sampleL;
stream[outIndex++] = sampleR;

View File

@ -46,7 +46,7 @@ bool StellaLIBRETRO::create(bool logging)
myOSystem = make_unique<OSystemLIBRETRO>();
Settings::Options options;
const Settings::Options options;
myOSystem->initialize(options);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -92,7 +92,7 @@ bool StellaLIBRETRO::create(bool logging)
settings.setValue(AudioSettings::SETTING_VOLUME, 100);
settings.setValue(AudioSettings::SETTING_STEREO, audio_mode);
FSNode rom(rom_path);
const FSNode rom(rom_path);
if(myOSystem->createConsole(rom) != EmptyString)
return false;
@ -160,7 +160,7 @@ void StellaLIBRETRO::updateVideo()
{
TIA& tia = myOSystem->console().tia();
while (1)
while (true)
{
tia.updateScanline();
@ -227,7 +227,7 @@ size_t StellaLIBRETRO::getStateSize() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
float StellaLIBRETRO::getVideoAspectPar() const
{
float par;
float par = 0.F;
if (getVideoNTSC())
{
@ -236,7 +236,7 @@ float StellaLIBRETRO::getVideoAspectPar() const
if (video_filter != NTSCFilter::Preset::OFF)
{
// non-interlace square pixel clock -- 1.0 pixel @ color burst -- double-width pixels
par = (6.1363635f / 3.579545454f) / 2.0;
par = (6.1363635F / 3.579545454F) / 2.0;
}
else
{
@ -254,7 +254,7 @@ float StellaLIBRETRO::getVideoAspectPar() const
if (video_filter != NTSCFilter::Preset::OFF)
{
// non-interlace square pixel clock -- 0.8 pixel @ color burst -- double-width pixels
par = (7.3750000f / (4.43361875f * 4.0f / 5.0f)) / 2.0f;
par = (7.3750000F / (4.43361875F * 4.F / 5.F)) / 2.F;
}
else
{
@ -272,7 +272,7 @@ float StellaLIBRETRO::getVideoAspectPar() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
float StellaLIBRETRO::getVideoAspect() const
{
uInt32 width = myOSystem->console().tia().width() * 2;
const uInt32 width = myOSystem->console().tia().width() * 2;
// display aspect ratio
return (width * getVideoAspectPar()) / getVideoHeight();
@ -335,6 +335,7 @@ void StellaLIBRETRO::setConsoleFormat(uInt32 mode)
case 4: console_format = "NTSC50"; break;
case 5: console_format = "PAL60"; break;
case 6: console_format = "SECAM60"; break;
default: break;
}
if (system_ready)
@ -371,6 +372,7 @@ void StellaLIBRETRO::setVideoPhosphor(uInt32 mode, uInt32 blend)
case 0: video_phosphor = "byrom"; break;
case 1: video_phosphor = "never"; break;
case 2: video_phosphor = "always"; break;
default: break;
}
video_phosphor_blend = blend;
@ -385,6 +387,7 @@ void StellaLIBRETRO::setVideoPhosphor(uInt32 mode, uInt32 blend)
case 0: myOSystem->frameBuffer().tiaSurface().enablePhosphor(phosphor_default, blend); break;
case 1: myOSystem->frameBuffer().tiaSurface().enablePhosphor(false, blend); break;
case 2: myOSystem->frameBuffer().tiaSurface().enablePhosphor(true, blend); break;
default: break;
}
}
}
@ -397,6 +400,7 @@ void StellaLIBRETRO::setAudioStereo(int mode)
case 0: audio_mode = "byrom"; break;
case 1: audio_mode = "mono"; break;
case 2: audio_mode = "stereo"; break;
default: break;
}
if (system_ready)

View File

@ -41,6 +41,7 @@ class StellaLIBRETRO
{
public:
StellaLIBRETRO();
~StellaLIBRETRO() = default;
public:
OSystemLIBRETRO& osystem() const { return *myOSystem; }
@ -60,7 +61,9 @@ class StellaLIBRETRO
void* getROM() const { return rom_image.get(); }
uInt32 getROMSize() const { return rom_size; }
constexpr uInt32 getROMMax() const { return uInt32(Cartridge::maxSize()); }
constexpr uInt32 getROMMax() const {
return static_cast<uInt32>(Cartridge::maxSize());
}
uInt8* getRAM() { return system_ram; }
constexpr uInt32 getRAMSize() const { return 128; }

View File

@ -1,10 +1,11 @@
// NOLINTBEGIN (misc-use-anonymous-namespace)
#ifndef _MSC_VER
#include <stdbool.h>
#include <sched.h>
#endif
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#ifdef _MSC_VER
#define snprintf _snprintf
@ -74,7 +75,7 @@ static void update_input()
for (int i = 0; i <= RETRO_DEVICE_ID_JOYPAD_R3; i++) \
input_bitmask[(pad)] |= input_state_cb((pad), RETRO_DEVICE_JOYPAD, 0, i) ? (1 << i) : 0; \
}
#define MASK_EVENT(evt, pad, id) stella.setInputEvent((evt), (input_bitmask[(pad)] & (1 << id)) ? 1 : 0)
#define MASK_EVENT(evt, pad, id) stella.setInputEvent((evt), (input_bitmask[(pad)] & (1 << (id))) ? 1 : 0)
int pad = 0;
GET_BITMASK(pad)
@ -761,3 +762,5 @@ void retro_cheat_reset()
void retro_cheat_set(unsigned index, bool enabled, const char *code)
{
}
// NOLINTEND