mirror of https://github.com/stella-emu/stella.git
Various code cleanups.
This commit is contained in:
parent
c4354aeeea
commit
ceabffe52b
|
@ -43,8 +43,7 @@ namespace {
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
AudioSettings::AudioSettings(Settings& settings)
|
||||
: mySettings(settings),
|
||||
myIsPersistent(true)
|
||||
: mySettings(settings)
|
||||
{
|
||||
setPreset(normalizedPreset(mySettings.getInt(SETTING_PRESET)));
|
||||
}
|
||||
|
|
|
@ -131,13 +131,13 @@ class AudioSettings
|
|||
|
||||
Preset myPreset;
|
||||
|
||||
uInt32 myPresetSampleRate;
|
||||
uInt32 myPresetFragmentSize;
|
||||
uInt32 myPresetBufferSize;
|
||||
uInt32 myPresetHeadroom;
|
||||
uInt32 myPresetSampleRate{0};
|
||||
uInt32 myPresetFragmentSize{0};
|
||||
uInt32 myPresetBufferSize{0};
|
||||
uInt32 myPresetHeadroom{0};
|
||||
ResamplingQuality myPresetResamplingQuality;
|
||||
|
||||
bool myIsPersistent;
|
||||
bool myIsPersistent{true};
|
||||
};
|
||||
|
||||
#endif // AUDIO_PARAMTERS_HXX
|
||||
|
|
|
@ -19,12 +19,14 @@
|
|||
|
||||
using namespace std::chrono;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
FpsMeter::FpsMeter(uInt32 queueSize)
|
||||
: myQueue(queueSize)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FpsMeter::reset(uInt32 garbageFrameLimit)
|
||||
{
|
||||
myQueue.clear();
|
||||
|
@ -35,6 +37,7 @@ void FpsMeter::reset(uInt32 garbageFrameLimit)
|
|||
myGarbageFrameLimit = garbageFrameLimit;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void FpsMeter::render(uInt32 frameCount)
|
||||
{
|
||||
if (myGarbageFrameCounter < myGarbageFrameLimit) {
|
||||
|
@ -67,6 +70,7 @@ void FpsMeter::render(uInt32 frameCount)
|
|||
if (myTimeInterval > 0) myFps = (myFrameCount - first.frames) / myTimeInterval;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
float FpsMeter::fps() const
|
||||
{
|
||||
return myFps;
|
||||
|
|
|
@ -217,7 +217,7 @@ void PhysicalJoystickHandler::mapStelladaptors(const string& saport)
|
|||
// We know there will be only two such devices (at most), since the logic
|
||||
// in setupJoysticks take care of that
|
||||
int saCount = 0;
|
||||
int saOrder[NUM_PORTS] = { 1, 2 };
|
||||
int saOrder[] = { 1, 2 };
|
||||
if(BSPF::equalsIgnoreCase(saport, "rl"))
|
||||
{
|
||||
saOrder[0] = 2; saOrder[1] = 1;
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "PaletteHandler.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PaletteHandler::PaletteHandler(OSystem& system)
|
||||
: myOSystem(system)
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ class PhosphorHandler
|
|||
|
||||
@return Averaged value of the two RGB colors
|
||||
*/
|
||||
static inline uInt32 getPixel(const uInt32 c, const uInt32 p)
|
||||
static constexpr uInt32 getPixel(const uInt32 c, const uInt32 p)
|
||||
{
|
||||
// Mix current calculated frame with previous displayed frame
|
||||
const uInt8 rc = static_cast<uInt8>(c >> 16),
|
||||
|
|
|
@ -232,7 +232,7 @@ class AtariNTSC
|
|||
}
|
||||
|
||||
// Common ntsc macros
|
||||
static inline constexpr void ATARI_NTSC_CLAMP( uInt32& io, uInt32 shift ) {
|
||||
static constexpr void ATARI_NTSC_CLAMP( uInt32& io, uInt32 shift ) {
|
||||
uInt32 sub = io >> (9-(shift)) & atari_ntsc_clamp_mask;
|
||||
uInt32 clamp = atari_ntsc_clamp_add - sub;
|
||||
io |= clamp;
|
||||
|
@ -240,31 +240,31 @@ class AtariNTSC
|
|||
io &= clamp;
|
||||
}
|
||||
|
||||
static inline constexpr void RGB_TO_YIQ(float r, float g, float b,
|
||||
static constexpr void RGB_TO_YIQ(float r, float g, float b,
|
||||
float& y, float& i, float& q) {
|
||||
y = r * 0.299F + g * 0.587F + b * 0.114F;
|
||||
i = r * 0.595716F - g * 0.274453F - b * 0.321263F;
|
||||
q = r * 0.211456F - g * 0.522591F + b * 0.311135F;
|
||||
}
|
||||
static inline constexpr void YIQ_TO_RGB(float y, float i, float q,
|
||||
static constexpr void YIQ_TO_RGB(float y, float i, float q,
|
||||
const float* to_rgb, int& ir, int& ig, int& ib) {
|
||||
ir = static_cast<int>(y + to_rgb[0] * i + to_rgb[1] * q);
|
||||
ig = static_cast<int>(y + to_rgb[2] * i + to_rgb[3] * q);
|
||||
ib = static_cast<int>(y + to_rgb[4] * i + to_rgb[5] * q);
|
||||
}
|
||||
|
||||
static inline constexpr uInt32 PACK_RGB( int r, int g, int b ) {
|
||||
static constexpr uInt32 PACK_RGB( int r, int g, int b ) {
|
||||
return r << 21 | g << 11 | b << 1;
|
||||
}
|
||||
|
||||
// Converted from C-style macros; I don't even pretend to understand the logic here :)
|
||||
static inline constexpr int PIXEL_OFFSET1( int ntsc, int scaled ) {
|
||||
static constexpr int PIXEL_OFFSET1( int ntsc, int scaled ) {
|
||||
return (kernel_size / 2 + ((ntsc) - (scaled) / rescale_out * rescale_in) +
|
||||
((((scaled) + rescale_out * 10) % rescale_out) != 0) +
|
||||
(rescale_out - (((scaled) + rescale_out * 10) % rescale_out)) % rescale_out +
|
||||
(kernel_size * 2 * (((scaled) + rescale_out * 10) % rescale_out)));
|
||||
}
|
||||
static inline constexpr int PIXEL_OFFSET2( int ntsc ) {
|
||||
static constexpr int PIXEL_OFFSET2( int ntsc ) {
|
||||
return 1.0F - (((ntsc) + 100) & 2);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,12 +30,12 @@
|
|||
class BreakpointMap
|
||||
{
|
||||
private:
|
||||
static const uInt16 ADDRESS_MASK = 0x1fff; // either 0x1fff or 0xffff (not needed then)
|
||||
static constexpr uInt16 ADDRESS_MASK = 0x1fff; // either 0x1fff or 0xffff (not needed then)
|
||||
|
||||
public:
|
||||
// breakpoint flags
|
||||
static const uInt32 ONE_SHOT = 1 << 0; // used for 'trace' command
|
||||
static const uInt8 ANY_BANK = 255; // breakpoint valid in any bank
|
||||
static constexpr uInt32 ONE_SHOT = 1 << 0; // used for 'trace' command
|
||||
static constexpr uInt8 ANY_BANK = 255; // breakpoint valid in any bank
|
||||
|
||||
struct Breakpoint
|
||||
{
|
||||
|
|
|
@ -76,9 +76,6 @@ class Debugger : public DialogContainer
|
|||
Debugger(OSystem& osystem, Console& console);
|
||||
~Debugger() override;
|
||||
|
||||
private:
|
||||
static const Int8 ANY_BANK = -1;
|
||||
|
||||
public:
|
||||
/**
|
||||
Initialize the debugger dialog container.
|
||||
|
@ -284,8 +281,6 @@ class Debugger : public DialogContainer
|
|||
*/
|
||||
Dialog* baseDialog() override { return myDialog; }
|
||||
|
||||
static const Int32 NOT_FOUND = -1;
|
||||
|
||||
private:
|
||||
/**
|
||||
Save state of each debugger subsystem and, by default, mark all
|
||||
|
@ -367,6 +362,8 @@ class Debugger : public DialogContainer
|
|||
static std::array<BuiltinFunction, 18> ourBuiltinFunctions;
|
||||
static std::array<PseudoRegister, 16> ourPseudoRegisters;
|
||||
|
||||
static constexpr Int8 ANY_BANK = -1;
|
||||
|
||||
private:
|
||||
// rewind/unwind n states
|
||||
uInt16 windStates(uInt16 numStates, bool unwind, string& message);
|
||||
|
|
|
@ -74,8 +74,6 @@ enum JoyHatMask {
|
|||
EVENT_HATCENTER_M = 1<<4
|
||||
};
|
||||
|
||||
static const int NUM_PORTS = 2;
|
||||
|
||||
enum class EventMode {
|
||||
kEmulationMode, // active mapping used for emulation
|
||||
kMenuMode, // mapping used for dialogs
|
||||
|
|
|
@ -81,10 +81,10 @@ class DeveloperDialog : public Dialog
|
|||
enum SettingsSet { player = 0, developer = 1 };
|
||||
|
||||
// MUST be aligned with RewindManager!
|
||||
static const int NUM_INTERVALS = 7;
|
||||
static const int NUM_HORIZONS = 8;
|
||||
static constexpr int NUM_INTERVALS = 7;
|
||||
static constexpr int NUM_HORIZONS = 8;
|
||||
|
||||
static const int DEBUG_COLORS = 6;
|
||||
static constexpr int DEBUG_COLORS = 6;
|
||||
|
||||
TabWidget* myTab{nullptr};
|
||||
// Emulator widgets
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
class TabWidget : public Widget, public CommandSender
|
||||
{
|
||||
public:
|
||||
static const int NO_WIDTH = 0;
|
||||
static const int AUTO_WIDTH = -1;
|
||||
static constexpr int NO_WIDTH = 0;
|
||||
static constexpr int AUTO_WIDTH = -1;
|
||||
|
||||
enum {
|
||||
kTabChangedCmd = 'TBCH'
|
||||
|
|
Loading…
Reference in New Issue