mirror of https://github.com/stella-emu/stella.git
More conversions of C-style to std::array.
That's it for a little while; getting tired now ...
This commit is contained in:
parent
f9b3d0198a
commit
0c0f732e5f
|
@ -60,7 +60,7 @@ class PhosphorHandler
|
|||
float myPhosphorPercent;
|
||||
|
||||
// Precalculated averaged phosphor colors
|
||||
using PhosphorLUT = std::array<std::array<uInt8, kColor>, kColor>;
|
||||
using PhosphorLUT = BSPF::array2D<uInt8, kColor, kColor>;
|
||||
static PhosphorLUT ourPhosphorLUT;
|
||||
|
||||
private:
|
||||
|
|
|
@ -111,7 +111,8 @@ bool RewindManager::addState(const string& message, bool timeMachine)
|
|||
// adjust frame timed intervals to actual scanlines (vs 262)
|
||||
if(interval >= 76 * 262 && interval <= 76 * 262 * 30)
|
||||
{
|
||||
const uInt32 scanlines = std::max(myOSystem.console().tia().scanlinesLastFrame(), 240u);
|
||||
const uInt32 scanlines = std::max<uInt32>
|
||||
(myOSystem.console().tia().scanlinesLastFrame(), 240);
|
||||
|
||||
interval = interval * scanlines / 262;
|
||||
}
|
||||
|
@ -401,15 +402,19 @@ 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(myOSystem.console().tia().scanlinesLastFrame(), 240u);
|
||||
const bool isNTSC = scanlines <= 287;
|
||||
const Int32 NTSC_FREQ = 1193182; // ~76*262*60
|
||||
const Int32 PAL_FREQ = 1182298; // ~76*312*50
|
||||
const Int32 freq = isNTSC ? NTSC_FREQ : PAL_FREQ; // = cycles/second
|
||||
|
||||
const Int32 NUM_UNITS = 5;
|
||||
const string UNIT_NAMES[NUM_UNITS] = { "cycle", "scanline", "frame", "second", "minute" };
|
||||
const Int64 UNIT_CYCLES[NUM_UNITS + 1] = { 1, 76, 76 * scanlines, freq, freq * 60, Int64(1) << 62 };
|
||||
constexpr Int32 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 = {
|
||||
1, 76, 76 * scanlines, freq, freq * 60, Int64(1) << 62
|
||||
};
|
||||
|
||||
stringstream result;
|
||||
Int32 i;
|
||||
|
|
|
@ -52,7 +52,7 @@ class RewindManager
|
|||
static constexpr uInt32 MAX_BUF_SIZE = 1000;
|
||||
static constexpr int NUM_INTERVALS = 7;
|
||||
// cycle values for the intervals
|
||||
const uInt32 INTERVAL_CYCLES[NUM_INTERVALS] = {
|
||||
const std::array<uInt32, NUM_INTERVALS> INTERVAL_CYCLES = {
|
||||
76 * 262,
|
||||
76 * 262 * 3,
|
||||
76 * 262 * 10,
|
||||
|
@ -62,7 +62,7 @@ class RewindManager
|
|||
76 * 262 * 60 * 10
|
||||
};
|
||||
// settings values for the intervals
|
||||
const string INT_SETTINGS[NUM_INTERVALS] = {
|
||||
const std::array<string, NUM_INTERVALS> INT_SETTINGS = {
|
||||
"1f",
|
||||
"3f",
|
||||
"10f",
|
||||
|
@ -74,7 +74,7 @@ class RewindManager
|
|||
|
||||
static constexpr int NUM_HORIZONS = 8;
|
||||
// cycle values for the horzions
|
||||
const uInt64 HORIZON_CYCLES[NUM_HORIZONS] = {
|
||||
const std::array<uInt64, NUM_HORIZONS> HORIZON_CYCLES = {
|
||||
76 * 262 * 60 * 3,
|
||||
76 * 262 * 60 * 10,
|
||||
76 * 262 * 60 * 30,
|
||||
|
@ -85,7 +85,7 @@ class RewindManager
|
|||
uInt64(76) * 262 * 60 * 60 * 60
|
||||
};
|
||||
// settings values for the horzions
|
||||
const string HOR_SETTINGS[NUM_HORIZONS] = {
|
||||
const std::array<string, NUM_HORIZONS> HOR_SETTINGS = {
|
||||
"3s",
|
||||
"10s",
|
||||
"30s",
|
||||
|
|
|
@ -42,7 +42,7 @@ class Variant
|
|||
}
|
||||
|
||||
public:
|
||||
Variant() { }
|
||||
Variant() { } // NOLINT
|
||||
|
||||
Variant(const string& s) : data(s) { }
|
||||
Variant(const char* s) : data(s) { }
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace {
|
|||
{
|
||||
// We calculate the sinc with double precision in order to compensate for precision loss
|
||||
// around zero
|
||||
return x == 0.f ? 1 : static_cast<float>(
|
||||
return x == 0.F ? 1 : static_cast<float>(
|
||||
sin(BSPF::PI_d * static_cast<double>(x)) / BSPF::PI_d / static_cast<double>(x)
|
||||
);
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ void LanczosResampler::precomputeKernels()
|
|||
|
||||
for (uInt32 j = 0; j < 2 * myKernelParameter; ++j) {
|
||||
kernel[j] = lanczosKernel(
|
||||
center - static_cast<float>(j) + static_cast<float>(myKernelParameter) - 1.f, myKernelParameter
|
||||
center - static_cast<float>(j) + static_cast<float>(myKernelParameter) - 1.F, myKernelParameter
|
||||
) * CLIPPING_FACTOR;
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ void LanczosResampler::fillFragment(float* fragment, uInt32 length)
|
|||
}
|
||||
|
||||
if (!myCurrentFragment) {
|
||||
std::fill_n(fragment, length, 0.f);
|
||||
std::fill_n(fragment, length, 0.F);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ void LanczosResampler::fillFragment(float* fragment, uInt32 length)
|
|||
fragment[2*i + 1] = sampleR;
|
||||
}
|
||||
else
|
||||
fragment[i] = (sampleL + sampleR) / 2.f;
|
||||
fragment[i] = (sampleL + sampleR) / 2.F;
|
||||
} else {
|
||||
float sample = myBuffer->convoluteWith(kernel);
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ class Resampler {
|
|||
|
||||
virtual void fillFragment(float* fragment, uInt32 length) = 0;
|
||||
|
||||
virtual ~Resampler() {}
|
||||
virtual ~Resampler() = default;
|
||||
|
||||
protected:
|
||||
|
||||
|
|
|
@ -118,6 +118,10 @@ namespace BSPF
|
|||
static const string ARCH = "NOARCH";
|
||||
#endif
|
||||
|
||||
// Make 2D-arrays using std::array less verbose
|
||||
template<class T, size_t ROW, size_t COL>
|
||||
using array2D = std::array<std::array<T, COL>, ROW>;
|
||||
|
||||
// Combines 'max' and 'min', and clamps value to the upper/lower value
|
||||
// if it is outside the specified range
|
||||
template<class T> inline T clamp(T val, T lower, T upper)
|
||||
|
|
|
@ -393,7 +393,7 @@ void AtariNTSC::initFilters(init_t& impl, const Setup& setup)
|
|||
float sum;
|
||||
/* quadratic mapping to reduce negative (blurring) range */
|
||||
float to_angle = setup.resolution + 1;
|
||||
to_angle = BSPF::PI_f / maxh * luma_cutoff * (to_angle * to_angle + 1.f);
|
||||
to_angle = BSPF::PI_f / maxh * luma_cutoff * (to_angle * to_angle + 1.F);
|
||||
|
||||
kernels [kernel_size * 3 / 2] = maxh; /* default center value */
|
||||
for ( int i = 0; i < kernel_half * 2 + 1; i++ )
|
||||
|
|
|
@ -152,10 +152,10 @@ class AtariNTSC
|
|||
;
|
||||
|
||||
std::array<uInt8, palette_size*3> myRGBPalette;
|
||||
std::array<std::array<uInt32, entry_size>, palette_size> myColorTable;
|
||||
BSPF::array2D<uInt32, palette_size, entry_size> myColorTable;
|
||||
|
||||
// Rendering threads
|
||||
unique_ptr<std::thread[]> myThreads;
|
||||
unique_ptr<std::thread[]> myThreads; // NOLINT
|
||||
// Number of rendering and total threads
|
||||
uInt32 myWorkerThreads, myTotalThreads;
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
|
||||
#include "NTSCFilter.hxx"
|
||||
|
||||
constexpr float scaleFrom100(float x) { return (x/50.f) - 1.f; }
|
||||
constexpr uInt32 scaleTo100(float x) { return uInt32(50*(x+1.f)); }
|
||||
constexpr float scaleFrom100(float x) { return (x/50.F) - 1.F; }
|
||||
constexpr uInt32 scaleTo100(float x) { return uInt32(50*(x+1.F)); }
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
NTSCFilter::NTSCFilter()
|
||||
|
@ -149,16 +149,16 @@ string NTSCFilter::decreaseAdjustable()
|
|||
void NTSCFilter::loadConfig(const Settings& settings)
|
||||
{
|
||||
// Load adjustables for custom mode
|
||||
myCustomSetup.hue = BSPF::clamp(settings.getFloat("tv.hue"), -1.0f, 1.0f);
|
||||
myCustomSetup.saturation = BSPF::clamp(settings.getFloat("tv.saturation"), -1.0f, 1.0f);
|
||||
myCustomSetup.contrast = BSPF::clamp(settings.getFloat("tv.contrast"), -1.0f, 1.0f);
|
||||
myCustomSetup.brightness = BSPF::clamp(settings.getFloat("tv.brightness"), -1.0f, 1.0f);
|
||||
myCustomSetup.sharpness = BSPF::clamp(settings.getFloat("tv.sharpness"), -1.0f, 1.0f);
|
||||
myCustomSetup.gamma = BSPF::clamp(settings.getFloat("tv.gamma"), -1.0f, 1.0f);
|
||||
myCustomSetup.resolution = BSPF::clamp(settings.getFloat("tv.resolution"), -1.0f, 1.0f);
|
||||
myCustomSetup.artifacts = BSPF::clamp(settings.getFloat("tv.artifacts"), -1.0f, 1.0f);
|
||||
myCustomSetup.fringing = BSPF::clamp(settings.getFloat("tv.fringing"), -1.0f, 1.0f);
|
||||
myCustomSetup.bleed = BSPF::clamp(settings.getFloat("tv.bleed"), -1.0f, 1.0f);
|
||||
myCustomSetup.hue = BSPF::clamp(settings.getFloat("tv.hue"), -1.0F, 1.0F);
|
||||
myCustomSetup.saturation = BSPF::clamp(settings.getFloat("tv.saturation"), -1.0F, 1.0F);
|
||||
myCustomSetup.contrast = BSPF::clamp(settings.getFloat("tv.contrast"), -1.0F, 1.0F);
|
||||
myCustomSetup.brightness = BSPF::clamp(settings.getFloat("tv.brightness"), -1.0F, 1.0F);
|
||||
myCustomSetup.sharpness = BSPF::clamp(settings.getFloat("tv.sharpness"), -1.0F, 1.0F);
|
||||
myCustomSetup.gamma = BSPF::clamp(settings.getFloat("tv.gamma"), -1.0F, 1.0F);
|
||||
myCustomSetup.resolution = BSPF::clamp(settings.getFloat("tv.resolution"), -1.0F, 1.0F);
|
||||
myCustomSetup.artifacts = BSPF::clamp(settings.getFloat("tv.artifacts"), -1.0F, 1.0F);
|
||||
myCustomSetup.fringing = BSPF::clamp(settings.getFloat("tv.fringing"), -1.0F, 1.0F);
|
||||
myCustomSetup.bleed = BSPF::clamp(settings.getFloat("tv.bleed"), -1.0F, 1.0F);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -150,7 +150,9 @@ uInt8 RiotDebug::swbcnt(int newVal)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 RiotDebug::inpt(int x)
|
||||
{
|
||||
static TIARegister _inpt[6] = { INPT0, INPT1, INPT2, INPT3, INPT4, INPT5 };
|
||||
static constexpr std::array<TIARegister, 6> _inpt = {
|
||||
INPT0, INPT1, INPT2, INPT3, INPT4, INPT5
|
||||
};
|
||||
return mySystem.peek(_inpt[x]);
|
||||
}
|
||||
|
||||
|
|
|
@ -967,6 +967,7 @@ string TIADebug::colorSwatch(uInt8 c) const
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// FIXME - how does this work; is this even needed ??
|
||||
// convert to stringstream, get rid of snprintf
|
||||
string TIADebug::audFreq(uInt8 div)
|
||||
{
|
||||
string ret;
|
||||
|
|
|
@ -24,7 +24,7 @@ AmigaMouseWidget::AmigaMouseWidget(GuiObject* boss, const GUI::Font& font,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 AmigaMouseWidget::getGrayCodeTable(const int index, const int direction)
|
||||
uInt8 AmigaMouseWidget::getGrayCodeTable(const int index, const int) const
|
||||
{
|
||||
return myGrayCodeTable[index];
|
||||
}
|
||||
|
|
|
@ -31,9 +31,9 @@ class AmigaMouseWidget : public PointingDeviceWidget
|
|||
virtual ~AmigaMouseWidget() = default;
|
||||
|
||||
private:
|
||||
uInt8 myGrayCodeTable[4] = { 0b00, 0b10, 0b11, 0b01 };
|
||||
const std::array<uInt8, 4> myGrayCodeTable = { 0b00, 0b10, 0b11, 0b01 };
|
||||
|
||||
uInt8 getGrayCodeTable(const int index, const int direction) override;
|
||||
uInt8 getGrayCodeTable(const int index, const int direction) const override;
|
||||
|
||||
// Following constructors and assignment operators not supported
|
||||
AmigaMouseWidget() = delete;
|
||||
|
|
|
@ -24,7 +24,7 @@ AtariMouseWidget::AtariMouseWidget(GuiObject* boss, const GUI::Font& font,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 AtariMouseWidget::getGrayCodeTable(const int index, const int direction)
|
||||
uInt8 AtariMouseWidget::getGrayCodeTable(const int index, const int direction) const
|
||||
{
|
||||
return myGrayCodeTable[index];
|
||||
}
|
||||
|
|
|
@ -31,9 +31,9 @@ class AtariMouseWidget : public PointingDeviceWidget
|
|||
virtual ~AtariMouseWidget() = default;
|
||||
|
||||
private:
|
||||
uInt8 myGrayCodeTable[4] = { 0b00, 0b01, 0b11, 0b10 };
|
||||
const std::array<uInt8, 4> myGrayCodeTable = { 0b00, 0b01, 0b11, 0b10 };
|
||||
|
||||
uInt8 getGrayCodeTable(const int index, const int direction) override;
|
||||
uInt8 getGrayCodeTable(const int index, const int direction) const override;
|
||||
|
||||
// Following constructors and assignment operators not supported
|
||||
AtariMouseWidget() = delete;
|
||||
|
|
|
@ -141,28 +141,26 @@ void AudioWidget::handleVolume()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void AudioWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||
{
|
||||
switch(cmd)
|
||||
if(cmd == DataGridWidget::kItemDataChangedCmd)
|
||||
{
|
||||
case DataGridWidget::kItemDataChangedCmd:
|
||||
switch(id)
|
||||
{
|
||||
case kAUDFID:
|
||||
changeFrequencyRegs();
|
||||
break;
|
||||
switch(id)
|
||||
{
|
||||
case kAUDFID:
|
||||
changeFrequencyRegs();
|
||||
break;
|
||||
|
||||
case kAUDCID:
|
||||
changeControlRegs();
|
||||
break;
|
||||
case kAUDCID:
|
||||
changeControlRegs();
|
||||
break;
|
||||
|
||||
case kAUDVID:
|
||||
changeVolumeRegs();
|
||||
break;
|
||||
case kAUDVID:
|
||||
changeVolumeRegs();
|
||||
break;
|
||||
|
||||
default:
|
||||
cerr << "AudioWidget DG changed\n";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
cerr << "AudioWidget DG changed\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,6 +179,9 @@ void AudioWidget::changeFrequencyRegs()
|
|||
case kAud1Addr:
|
||||
instance().debugger().tiaDebug().audF1(value);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -199,6 +200,9 @@ void AudioWidget::changeControlRegs()
|
|||
case kAud1Addr:
|
||||
instance().debugger().tiaDebug().audC1(value);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
handleVolume();
|
||||
}
|
||||
|
@ -225,11 +229,12 @@ void AudioWidget::changeVolumeRegs()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 AudioWidget::getEffectiveVolume()
|
||||
{
|
||||
const int EFF_VOL[] = {
|
||||
static constexpr std::array<int, 31> EFF_VOL = {
|
||||
0, 6, 13, 18, 24, 29, 33, 38,
|
||||
42, 46, 50, 54, 57, 60, 64, 67,
|
||||
70, 72, 75, 78, 80, 82, 85, 87,
|
||||
89, 91, 93, 95, 97, 98,100};
|
||||
89, 91, 93, 95, 97, 98, 100
|
||||
};
|
||||
|
||||
return EFF_VOL[(instance().debugger().tiaDebug().audC0() ? instance().debugger().tiaDebug().audV0() : 0) +
|
||||
(instance().debugger().tiaDebug().audC1() ? instance().debugger().tiaDebug().audV1() : 0)];
|
||||
|
|
|
@ -115,12 +115,11 @@ void BoosterWidget::handleCommand(
|
|||
myPins[id]->getState() ? Controller::MIN_RESISTANCE :
|
||||
Controller::MAX_RESISTANCE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Controller::DigitalPin BoosterWidget::ourPinNo[5] = {
|
||||
Controller::DigitalPin::One, Controller::DigitalPin::Two, Controller::DigitalPin::Three, Controller::DigitalPin::Four,
|
||||
Controller::DigitalPin::Six
|
||||
};
|
||||
constexpr std::array<Controller::DigitalPin, 5> BoosterWidget::ourPinNo;
|
||||
|
|
|
@ -31,8 +31,12 @@ class BoosterWidget : public ControllerWidget
|
|||
private:
|
||||
enum { kJUp = 0, kJDown, kJLeft, kJRight, kJFire, kJBooster, kJTrigger };
|
||||
|
||||
CheckboxWidget* myPins[7];
|
||||
static Controller::DigitalPin ourPinNo[5];
|
||||
std::array<CheckboxWidget*, 7> myPins;
|
||||
static constexpr std::array<Controller::DigitalPin, 5> ourPinNo = {{
|
||||
Controller::DigitalPin::One, Controller::DigitalPin::Two,
|
||||
Controller::DigitalPin::Three, Controller::DigitalPin::Four,
|
||||
Controller::DigitalPin::Six
|
||||
}};
|
||||
|
||||
private:
|
||||
void loadConfig() override;
|
||||
|
|
|
@ -87,7 +87,7 @@ string Cartridge0840Widget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = { "$800", "$840" };
|
||||
static const std::array<string, 2> spot = { "$800", "$840" };
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
<< ", hotspot = " << spot[myCart.getBank()];
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ void Cartridge3EPlusWidget::loadConfig()
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Cartridge3EPlusWidget::handleCommand(CommandSender* sender,
|
||||
int cmd, int data, int id)
|
||||
int cmd, int data, int id)
|
||||
{
|
||||
uInt16 segment = 0;
|
||||
switch(cmd)
|
||||
|
@ -154,6 +154,8 @@ void Cartridge3EPlusWidget::handleCommand(CommandSender* sender,
|
|||
case kBank3Changed:
|
||||
segment = 3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Ignore bank if either number or type hasn't been selected
|
||||
|
@ -330,6 +332,6 @@ uInt8 Cartridge3EPlusWidget::internalRamGetValue(int addr)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const Cartridge3EPlusWidget::BankID Cartridge3EPlusWidget::bankEnum[4] = {
|
||||
const std::array<Cartridge3EPlusWidget::BankID, 4> Cartridge3EPlusWidget::bankEnum = {
|
||||
kBank0Changed, kBank1Changed, kBank2Changed, kBank3Changed
|
||||
};
|
||||
|
|
|
@ -40,10 +40,10 @@ class Cartridge3EPlusWidget : public CartDebugWidget
|
|||
private:
|
||||
Cartridge3EPlus& myCart;
|
||||
|
||||
PopUpWidget* myBankNumber[4];
|
||||
PopUpWidget* myBankType[4];
|
||||
ButtonWidget* myBankCommit[4];
|
||||
EditTextWidget* myBankState[8];
|
||||
std::array<PopUpWidget*, 4> myBankNumber;
|
||||
std::array<PopUpWidget*, 4> myBankType;
|
||||
std::array<ButtonWidget*, 4> myBankCommit;
|
||||
std::array<EditTextWidget*, 8> myBankState;
|
||||
|
||||
struct CartState {
|
||||
ByteArray internalram;
|
||||
|
@ -56,7 +56,7 @@ class Cartridge3EPlusWidget : public CartDebugWidget
|
|||
kBank2Changed = 'b2CH',
|
||||
kBank3Changed = 'b3CH'
|
||||
};
|
||||
static const BankID bankEnum[4];
|
||||
static const std::array<BankID, 4> bankEnum;
|
||||
|
||||
private:
|
||||
void saveOldState() override;
|
||||
|
|
|
@ -256,6 +256,9 @@ void Cartridge4A50Widget::handleCommand(CommandSender* sender,
|
|||
myCart.bankROMHigh(0);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
myCart.lockBank();
|
||||
|
|
|
@ -159,7 +159,7 @@ string CartridgeBFSCWidget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = {
|
||||
static constexpr std::array<const char*, 64> spot = {
|
||||
"$FF80", "$FF81", "$FF82", "$FF83", "$FF84", "$FF85", "$FF86", "$FF87",
|
||||
"$FF88", "$FF89", "$FF8A", "$FF8B", "$FF8C", "$FF8D", "$FF8E", "$FF8F",
|
||||
"$FF90", "$FF91", "$FF92", "$FF93", "$FF94", "$FF95", "$FF96", "$FF97",
|
||||
|
|
|
@ -149,7 +149,7 @@ string CartridgeBFWidget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = {
|
||||
static constexpr std::array<const char*, 64> spot = {
|
||||
"$FF80", "$FF81", "$FF82", "$FF83", "$FF84", "$FF85", "$FF86", "$FF87",
|
||||
"$FF88", "$FF89", "$FF8A", "$FF8B", "$FF8C", "$FF8D", "$FF8E", "$FF8F",
|
||||
"$FF90", "$FF91", "$FF92", "$FF93", "$FF94", "$FF95", "$FF96", "$FF97",
|
||||
|
|
|
@ -388,7 +388,7 @@ string CartridgeBUSWidget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = {
|
||||
static constexpr std::array<const char*, 7> spot = {
|
||||
"$FFF5", "$FFF6", "$FFF7", "$FFF8", "$FFF9", "$FFFA", "$FFFB"
|
||||
};
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
|
|
|
@ -63,9 +63,9 @@ class CartridgeBUSWidget : public CartDebugWidget
|
|||
DataGridWidget* myMusicWaveforms;
|
||||
DataGridWidget* myMusicWaveformSizes;
|
||||
DataGridWidget* mySamplePointer;
|
||||
StaticTextWidget* myDatastreamLabels[6];
|
||||
CheckboxWidget* myBusOverdrive;
|
||||
CheckboxWidget* myDigitalSample;
|
||||
std::array<StaticTextWidget*, 6> myDatastreamLabels;
|
||||
CartState myOldState;
|
||||
|
||||
enum { kBankChanged = 'bkCH' };
|
||||
|
|
|
@ -387,7 +387,7 @@ string CartridgeCDFWidget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = {
|
||||
static constexpr std::array<const char*, 7> spot = {
|
||||
"$FFF5", "$FFF6", "$FFF7", "$FFF8", "$FFF9", "$FFFA", "$FFFB"
|
||||
};
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
|
|
|
@ -65,7 +65,7 @@ class CartridgeCDFWidget : public CartDebugWidget
|
|||
DataGridWidget* myMusicWaveforms;
|
||||
DataGridWidget* myMusicWaveformSizes;
|
||||
DataGridWidget* mySamplePointer;
|
||||
StaticTextWidget* myDatastreamLabels[10];
|
||||
std::array<StaticTextWidget*, 10> myDatastreamLabels;
|
||||
|
||||
CheckboxWidget* myFastFetch;
|
||||
CheckboxWidget* myDigitalSample;
|
||||
|
|
|
@ -50,9 +50,9 @@ class CartridgeCMWidget : public CartDebugWidget
|
|||
ToggleBitWidget* mySWCHA;
|
||||
DataGridWidget* myColumn;
|
||||
CheckboxWidget *myAudIn, *myAudOut, *myIncrease, *myReset;
|
||||
CheckboxWidget* myRow[4];
|
||||
CheckboxWidget *myFunc, *myShift;
|
||||
EditTextWidget* myRAM;
|
||||
std::array<CheckboxWidget*, 4> myRow;
|
||||
|
||||
CartState myOldState;
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ string CartridgeCTYWidget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = {
|
||||
static constexpr std::array<const char*, 8> spot = {
|
||||
"", "$FFF5", "$FFF6", "$FFF7", "$FFF8", "$FFF9", "$FFFA", "$FFFB"
|
||||
};
|
||||
uInt16 bank = myCart.getBank();
|
||||
|
|
|
@ -152,6 +152,8 @@ void CartridgeDASHWidget::handleCommand(CommandSender* sender,
|
|||
case kBank3Changed:
|
||||
segment = 3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Ignore bank if either number or type hasn't been selected
|
||||
|
@ -364,6 +366,6 @@ uInt8 CartridgeDASHWidget::internalRamGetValue(int addr)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const CartridgeDASHWidget::BankID CartridgeDASHWidget::bankEnum[4] = {
|
||||
const std::array<CartridgeDASHWidget::BankID, 4> CartridgeDASHWidget::bankEnum = {
|
||||
kBank0Changed, kBank1Changed, kBank2Changed, kBank3Changed
|
||||
};
|
||||
|
|
|
@ -40,10 +40,10 @@ class CartridgeDASHWidget : public CartDebugWidget
|
|||
private:
|
||||
CartridgeDASH& myCart;
|
||||
|
||||
PopUpWidget* myBankNumber[4];
|
||||
PopUpWidget* myBankType[4];
|
||||
ButtonWidget* myBankCommit[4];
|
||||
EditTextWidget* myBankState[8];
|
||||
std::array<PopUpWidget*, 4> myBankNumber;
|
||||
std::array<PopUpWidget*, 4> myBankType;
|
||||
std::array<ButtonWidget*, 4> myBankCommit;
|
||||
std::array<EditTextWidget*, 8> myBankState;
|
||||
|
||||
struct CartState {
|
||||
ByteArray internalram;
|
||||
|
@ -56,7 +56,7 @@ class CartridgeDASHWidget : public CartDebugWidget
|
|||
kBank2Changed = 'b2CH',
|
||||
kBank3Changed = 'b3CH'
|
||||
};
|
||||
static const BankID bankEnum[4];
|
||||
static const std::array<BankID, 4> bankEnum;
|
||||
|
||||
private:
|
||||
void saveOldState() override;
|
||||
|
|
|
@ -127,7 +127,7 @@ string CartridgeDFSCWidget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = {
|
||||
static constexpr std::array<const char*, 32> spot = {
|
||||
"$FFC0", "$FFC1", "$FFC2", "$FFC3", "$FFC4", "$FFC5", "$FFC6", "$FFC7",
|
||||
"$FFC8", "$FFC9", "$FFCA", "$FFCB", "$FFCC", "$FFCD", "$FFCE", "$FFCF",
|
||||
"$FFD0", "$FFD1", "$FFD2", "$FFD3", "$FFD4", "$FFD5", "$FFD6", "$FFE7",
|
||||
|
|
|
@ -117,7 +117,7 @@ string CartridgeDFWidget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = {
|
||||
static constexpr std::array<const char*, 32> spot = {
|
||||
"$FFC0", "$FFC1", "$FFC2", "$FFC3", "$FFC4", "$FFC5", "$FFC6", "$FFC7",
|
||||
"$FFC8", "$FFC9", "$FFCA", "$FFCB", "$FFCC", "$FFCD", "$FFCE", "$FFCF",
|
||||
"$FFD0", "$FFD1", "$FFD2", "$FFD3", "$FFD4", "$FFD5", "$FFD6", "$FFD7",
|
||||
|
|
|
@ -229,7 +229,7 @@ string CartridgeDPCWidget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = { "$FFF8", "$FFF9" };
|
||||
static constexpr std::array<const char*, 2> spot = { "$FFF8", "$FFF9" };
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
<< ", hotspot = " << spot[myCart.getBank()];
|
||||
|
||||
|
|
|
@ -19,15 +19,15 @@
|
|||
#include "PopUpWidget.hxx"
|
||||
#include "CartE0Widget.hxx"
|
||||
|
||||
static const char* const seg0[] = {
|
||||
static constexpr std::array<const char*, 8> seg0 = {
|
||||
"0 ($FFE0)", "1 ($FFE1)", "2 ($FFE2)", "3 ($FFE3)",
|
||||
"4 ($FFE4)", "5 ($FFE5)", "6 ($FFE6)", "7 ($FFE7)"
|
||||
};
|
||||
static const char* const seg1[] = {
|
||||
static constexpr std::array<const char*, 8> seg1 = {
|
||||
"0 ($FFE8)", "1 ($FFE9)", "2 ($FFEA)", "3 ($FFEB)",
|
||||
"4 ($FFEC)", "5 ($FFED)", "6 ($FFEE)", "7 ($FFEF)"
|
||||
};
|
||||
static const char* const seg2[] = {
|
||||
static constexpr std::array<const char*, 8> seg2 = {
|
||||
"0 ($FFF0)", "1 ($FFF1)", "2 ($FFF2)", "3 ($FFF3)",
|
||||
"4 ($FFF4)", "5 ($FFF5)", "6 ($FFF6)", "7 ($FFF7)"
|
||||
};
|
||||
|
|
|
@ -52,7 +52,7 @@ CartridgeE78KWidget::CartridgeE78KWidget(
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const char* CartridgeE78KWidget::getSpotLower(int idx)
|
||||
{
|
||||
static const char* const spot_lower[] = {
|
||||
static constexpr std::array<const char*, 4> spot_lower = {
|
||||
"0 - ROM ($FFE4)", "1 - ROM ($FFE5)", "2 - ROM ($FFE6)", "3 - RAM ($FFE7)"
|
||||
};
|
||||
|
||||
|
@ -62,7 +62,7 @@ const char* CartridgeE78KWidget::getSpotLower(int idx)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const char* CartridgeE78KWidget::getSpotUpper(int idx)
|
||||
{
|
||||
static const char* const spot_upper[] = {
|
||||
static constexpr std::array<const char*, 4> spot_upper = {
|
||||
"0 - RAM ($FFE8)", "1 - RAM ($FFE9)", "2 - RAM ($FFEA)", "3 - RAM ($FFEB)"
|
||||
};
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ CartridgeE7Widget::CartridgeE7Widget(
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const char* CartridgeE7Widget::getSpotLower(int idx)
|
||||
{
|
||||
static const char* const spot_lower[] = {
|
||||
static constexpr std::array<const char*, 8> spot_lower = {
|
||||
"0 - ROM ($FFE0)", "1 - ROM ($FFE1)", "2 - ROM ($FFE2)", "3 - ROM ($FFE3)",
|
||||
"4 - ROM ($FFE4)", "5 - ROM ($FFE5)", "6 - ROM ($FFE6)", "7 - RAM ($FFE7)"
|
||||
};
|
||||
|
@ -62,7 +62,7 @@ const char* CartridgeE7Widget::getSpotLower(int idx)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const char* CartridgeE7Widget::getSpotUpper(int idx)
|
||||
{
|
||||
static const char* const spot_upper[] = {
|
||||
static constexpr std::array<const char*, 4> spot_upper = {
|
||||
"0 - RAM ($FFE8)", "1 - RAM ($FFE9)", "2 - RAM ($FFEA)", "3 - RAM ($FFEB)"
|
||||
};
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ string CartridgeEFSCWidget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = {
|
||||
static constexpr std::array<const char*, 16> spot = {
|
||||
"$FFE0", "$FFE1", "$FFE2", "$FFE3", "$FFE4", "$FFE5", "$FFE6", "$FFE7",
|
||||
"$FFE8", "$FFE9", "$FFEA", "$FFEB", "$FFEC", "$FFED", "$FFEE", "$FFEF"
|
||||
};
|
||||
|
|
|
@ -101,7 +101,7 @@ string CartridgeEFWidget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = {
|
||||
static constexpr std::array<const char*, 16> spot = {
|
||||
"$FFE0", "$FFE1", "$FFE2", "$FFE3", "$FFE4", "$FFE5", "$FFE6", "$FFE7",
|
||||
"$FFE8", "$FFE9", "$FFEA", "$FFEB", "$FFEC", "$FFED", "$FFEE", "$FFEF"
|
||||
};
|
||||
|
|
|
@ -102,7 +102,7 @@ string CartridgeF4SCWidget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = {
|
||||
static constexpr std::array<const char*, 8> spot = {
|
||||
"$FFF4", "$FFF5", "$FFF6", "$FFF7", "$FFF8", "$FFF9", "$FFFA", "$FFFB"
|
||||
};
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
|
|
|
@ -92,7 +92,7 @@ string CartridgeF4Widget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = {
|
||||
static constexpr std::array<const char*, 8> spot = {
|
||||
"$FFF4", "$FFF5", "$FFF6", "$FFF7", "$FFF8", "$FFF9", "$FFFA", "$FFFB"
|
||||
};
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
|
|
|
@ -98,7 +98,7 @@ string CartridgeF6SCWidget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = { "$FFF6", "$FFF7", "$FFF8", "$FFF9" };
|
||||
static constexpr std::array<const char*, 4> spot = { "$FFF6", "$FFF7", "$FFF8", "$FFF9" };
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
<< ", hotspot = " << spot[myCart.getBank()];
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ string CartridgeF6Widget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = { "$FFF6", "$FFF7", "$FFF8", "$FFF9" };
|
||||
static constexpr std::array<const char*, 4> spot = { "$FFF6", "$FFF7", "$FFF8", "$FFF9" };
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
<< ", hotspot = " << spot[myCart.getBank()];
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ string CartridgeF8SCWidget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = { "$FFF8", "$FFF9" };
|
||||
static constexpr std::array<const char*, 2> spot = { "$FFF8", "$FFF9" };
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
<< ", hotspot = " << spot[myCart.getBank()];
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ string CartridgeF8Widget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = { "$FFF8", "$FFF9" };
|
||||
static constexpr std::array<const char*, 2> spot = { "$FFF8", "$FFF9" };
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
<< ", hotspot = " << spot[myCart.getBank()];
|
||||
|
||||
|
|
|
@ -140,6 +140,9 @@ void CartridgeFA2Widget::handleCommand(CommandSender* sender,
|
|||
case kFlashSave:
|
||||
myCart.flash(2);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,7 +151,7 @@ string CartridgeFA2Widget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = {
|
||||
static constexpr std::array<const char*, 7> spot = {
|
||||
"$FFF5", "$FFF6", "$FFF7", "$FFF8", "$FFF9", "$FFFA", "$FFFB"
|
||||
};
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
|
|
|
@ -97,7 +97,7 @@ string CartridgeFAWidget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = { "$FFF8", "$FFF9", "$FFFA" };
|
||||
static constexpr std::array<const char*, 3> spot = { "$FFF8", "$FFF9", "$FFFA" };
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
<< ", hotspot = " << spot[myCart.getBank()];
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ string CartridgeFEWidget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const range[] = { "$F000", "$D000" };
|
||||
static constexpr std::array<const char*, 2> range = { "$F000", "$D000" };
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
<< ", address range = " << range[myCart.getBank()];
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ CartridgeMDMWidget::CartridgeMDMWidget(
|
|||
ypos = addBaseInformation(size, "Edwin Blink", info.str(), 15) + myLineHeight;
|
||||
|
||||
VariantList items;
|
||||
for(uInt32 i = 0x800; i < (0x800u + myCart.bankCount()); ++i)
|
||||
for(uInt32 i = 0x800; i < (0x800U + myCart.bankCount()); ++i)
|
||||
{
|
||||
info.str("");
|
||||
info << std::dec << (i & 0xFF) << " ($" << Common::Base::HEX4 << i << ")";
|
||||
|
|
|
@ -98,6 +98,8 @@ void CartridgeMNetworkWidget::handleCommand(CommandSender* sender,
|
|||
case kUpperChanged:
|
||||
myCart.bankRAM(myUpper256B->getSelected());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
myCart.lockBank();
|
||||
|
|
|
@ -110,8 +110,8 @@ CartRamWidget::InternalRamWidget::InternalRamWidget(GuiObject* boss,
|
|||
int x, int y, int w, int h,
|
||||
CartDebugWidget& dbg)
|
||||
: RamWidget(boss, lfont, nfont, x, y, w, h,
|
||||
dbg.internalRamSize(), std::min(dbg.internalRamSize() / 16, 16u),
|
||||
std::min(dbg.internalRamSize() / 16, 16u) * 16),
|
||||
dbg.internalRamSize(), std::min(dbg.internalRamSize() / 16, 16U),
|
||||
std::min(dbg.internalRamSize() / 16, 16U) * 16),
|
||||
myCart(dbg)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -96,9 +96,9 @@ string CartridgeUAWidget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const spot[] = { "$220, $2A0", "$240, $2C0" };
|
||||
static constexpr std::array<const char*, 2> spot = { "$220, $2A0", "$240, $2C0" };
|
||||
buf << "Bank = " << std::dec << myCart.getBank()
|
||||
<< ", hotspots = " << spot[myCart.getBank() ^ (mySwappedHotspots ? 1u : 0u)];
|
||||
<< ", hotspots = " << spot[myCart.getBank() ^ (mySwappedHotspots ? 1U : 0U)];
|
||||
|
||||
return buf.str();
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ string CartridgeWDWidget::bankState()
|
|||
{
|
||||
ostringstream& buf = buffer();
|
||||
|
||||
static const char* const segments[] = {
|
||||
static constexpr std::array<const char*, 8> segments = {
|
||||
"[0,0,1,3]", "[0,1,2,3]", "[4,5,6,7]", "[7,4,2,3]",
|
||||
"[0,0,6,7]", "[0,1,7,6]", "[2,3,4,5]", "[6,0,5,1]"
|
||||
};
|
||||
|
|
|
@ -108,4 +108,4 @@ void DrivingWidget::setValue(int idx)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 DrivingWidget::ourGrayTable[4] = { 0x03, 0x01, 0x00, 0x02 };
|
||||
const std::array<uInt8, 4> DrivingWidget::ourGrayTable = { 0x03, 0x01, 0x00, 0x02 };
|
||||
|
|
|
@ -44,7 +44,7 @@ class DrivingWidget : public ControllerWidget
|
|||
|
||||
int myGrayIndex;
|
||||
|
||||
static uInt8 ourGrayTable[4];
|
||||
static const std::array<uInt8, 4> ourGrayTable;
|
||||
|
||||
private:
|
||||
void loadConfig() override;
|
||||
|
|
|
@ -25,7 +25,7 @@ FlashWidget::FlashWidget(GuiObject* boss, const GUI::Font& font,
|
|||
: ControllerWidget(boss, font, x, y, controller),
|
||||
myEEPROMEraseCurrent(nullptr)
|
||||
{
|
||||
std::fill(myPage, myPage + MAX_PAGES, nullptr);
|
||||
myPage.fill(nullptr);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -38,7 +38,7 @@ class FlashWidget : public ControllerWidget
|
|||
enum { kEEPROMEraseCurrent = 'eeEC' };
|
||||
|
||||
static constexpr uInt32 MAX_PAGES = 5;
|
||||
StaticTextWidget* myPage[MAX_PAGES];
|
||||
std::array<StaticTextWidget*, MAX_PAGES> myPage;
|
||||
|
||||
private:
|
||||
void loadConfig() override;
|
||||
|
|
|
@ -46,7 +46,7 @@ class PointingDeviceWidget : public ControllerWidget
|
|||
CheckboxWidget* myFire;
|
||||
|
||||
private:
|
||||
virtual uInt8 getGrayCodeTable(const int index, const int direction) = 0;
|
||||
virtual uInt8 getGrayCodeTable(const int index, const int direction) const = 0;
|
||||
|
||||
void loadConfig() override;
|
||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||
|
|
|
@ -24,7 +24,7 @@ TrakBallWidget::TrakBallWidget(GuiObject* boss, const GUI::Font& font,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 TrakBallWidget::getGrayCodeTable(const int index, const int direction)
|
||||
uInt8 TrakBallWidget::getGrayCodeTable(const int index, const int direction) const
|
||||
{
|
||||
return myGrayCodeTable[(index & 0b1) + direction * 2];
|
||||
}
|
||||
|
|
|
@ -31,9 +31,9 @@ class TrakBallWidget : public PointingDeviceWidget
|
|||
virtual ~TrakBallWidget() = default;
|
||||
|
||||
private:
|
||||
uInt8 myGrayCodeTable[4] = { 0b00, 0b10, 0b01, 0b11 };
|
||||
const std::array<uInt8, 4> myGrayCodeTable = { 0b00, 0b10, 0b01, 0b11 };
|
||||
|
||||
uInt8 getGrayCodeTable(const int index, const int direction) override;
|
||||
uInt8 getGrayCodeTable(const int index, const int direction) const override;
|
||||
|
||||
// Following constructors and assignment operators not supported
|
||||
TrakBallWidget() = delete;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string Bankswitch::typeToName(Bankswitch::Type type)
|
||||
{
|
||||
return BSList[int(type)].name;
|
||||
return BSList[static_cast<int>(type)].name;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -36,7 +36,7 @@ Bankswitch::Type Bankswitch::nameToType(const string& name)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string Bankswitch::typeToDesc(Bankswitch::Type type)
|
||||
{
|
||||
return BSList[int(type)].desc;
|
||||
return BSList[static_cast<int>(type)].desc;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -92,7 +92,8 @@ bool Bankswitch::isValidRomName(const string& name)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Bankswitch::Description Bankswitch::BSList[int(Bankswitch::Type::NumSchemes)] = {
|
||||
const std::array<Bankswitch::Description, static_cast<int>(Bankswitch::Type::NumSchemes)>
|
||||
Bankswitch::BSList = {{
|
||||
{ "AUTO" , "Auto-detect" },
|
||||
{ "0840" , "0840 (8K ECONObank)" },
|
||||
{ "2IN1" , "2IN1 Multicart (4-32K)" },
|
||||
|
@ -149,7 +150,7 @@ Bankswitch::Description Bankswitch::BSList[int(Bankswitch::Type::NumSchemes)] =
|
|||
#if defined(CUSTOM_ARM)
|
||||
{ "CUSTOM" , "CUSTOM (ARM)" }
|
||||
#endif
|
||||
};
|
||||
}};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Bankswitch::ExtensionMap Bankswitch::ourExtensions = {
|
||||
|
|
|
@ -58,7 +58,7 @@ class Bankswitch
|
|||
const char* const name;
|
||||
const char* const desc;
|
||||
};
|
||||
static Description BSList[int(Type::NumSchemes)];
|
||||
static const std::array<Description, static_cast<int>(Type::NumSchemes)> BSList;
|
||||
|
||||
public:
|
||||
// Convert BSType enum to string
|
||||
|
@ -95,10 +95,10 @@ class Bankswitch
|
|||
return BSPF::compareIgnoreCase(a, b) < 0;
|
||||
}
|
||||
};
|
||||
using ExtensionMap = std::map<string, Bankswitch::Type, TypeComparator>;
|
||||
using ExtensionMap = const std::map<string, Bankswitch::Type, TypeComparator>;
|
||||
static ExtensionMap ourExtensions;
|
||||
|
||||
using NameToTypeMap = std::map<string, Bankswitch::Type, TypeComparator>;
|
||||
using NameToTypeMap = const std::map<string, Bankswitch::Type, TypeComparator>;
|
||||
static NameToTypeMap ourNameToTypes;
|
||||
|
||||
private:
|
||||
|
|
|
@ -336,7 +336,7 @@ class Cartridge : public Device
|
|||
bool myBankLocked;
|
||||
|
||||
// Semi-random values to use when a read from write port occurs
|
||||
uInt8 myRWPRandomValues[256];
|
||||
std::array<uInt8, 256> myRWPRandomValues;
|
||||
|
||||
// Contains various info about this cartridge
|
||||
// This needs to be stored separately from child classes, since
|
||||
|
|
|
@ -480,6 +480,9 @@ uInt32 CartridgeCDF::thumbCallback(uInt8 function, uInt32 value1, uInt32 value2)
|
|||
case 3:
|
||||
myMusicWaveformSize[value1] = value2;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -589,7 +589,7 @@ inline void CartridgeCTY::updateMusicModeDataFetchers()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const uInt32 CartridgeCTY::ourFrequencyTable[63] =
|
||||
const std::array<uInt32, 63> CartridgeCTY::ourFrequencyTable =
|
||||
{
|
||||
// this should really be referenced from within the ROM, but its part of
|
||||
// the Harmony/Melody CTY Driver, which does not appear to be in the ROM.
|
||||
|
|
|
@ -309,7 +309,7 @@ class CartridgeCTY : public Cartridge
|
|||
// Indicates the offset into the ROM image (aligns to current bank)
|
||||
uInt16 myBankOffset;
|
||||
|
||||
static const uInt32 ourFrequencyTable[63];
|
||||
static const std::array<uInt32, 63> ourFrequencyTable;
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
|
|
|
@ -145,7 +145,7 @@ inline void CartridgeDPCPlus::clockRandomNumberGenerator()
|
|||
inline void CartridgeDPCPlus::priorClockRandomNumberGenerator()
|
||||
{
|
||||
// Update random number generator (32-bit LFSR, reversed)
|
||||
myRandomNumber = ((myRandomNumber & (1u<<31)) ?
|
||||
myRandomNumber = ((myRandomNumber & (1U<<31)) ?
|
||||
((0x10adab1e^myRandomNumber) << 11) | ((0x10adab1e^myRandomNumber) >> 21) :
|
||||
(myRandomNumber << 11) | (myRandomNumber >> 21));
|
||||
}
|
||||
|
@ -288,6 +288,9 @@ uInt8 CartridgeDPCPlus::peek(uInt16 address)
|
|||
case 0x06: // reserved
|
||||
case 0x07: // reserved
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -57,15 +57,10 @@ uInt8 CartridgeFC::peek(uInt16 address)
|
|||
address &= 0x0FFF;
|
||||
|
||||
// Switch banks if necessary
|
||||
switch (address)
|
||||
if(address == 0x0FFC)
|
||||
{
|
||||
case 0x0FFC:
|
||||
// Trigger the bank switch
|
||||
bank(myTargetBank);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
// Trigger the bank switch
|
||||
bank(myTargetBank);
|
||||
}
|
||||
|
||||
return myImage[myBankOffset + address];
|
||||
|
|
|
@ -309,7 +309,7 @@ bool CartridgeWD::load(Serializer& in)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CartridgeWD::BankOrg CartridgeWD::ourBankOrg[8] = {
|
||||
const std::array<CartridgeWD::BankOrg, 8> CartridgeWD::ourBankOrg = {{
|
||||
// 0 1 2 3 4 5 6 7
|
||||
{ 0, 0, 1, 3 }, // Bank 0, 8 2 1 - 1 - - - -
|
||||
{ 0, 1, 2, 3 }, // Bank 1, 9 1 1 1 1 - - - -
|
||||
|
@ -320,4 +320,4 @@ CartridgeWD::BankOrg CartridgeWD::ourBankOrg[8] = {
|
|||
{ 2, 3, 4, 5 }, // Bank 6, 14 - - 1 1 1 1 - -
|
||||
{ 6, 0, 5, 1 } // Bank 7, 15 1 1 - - - 1 1 -
|
||||
// count 7 4 3 4 3 3 4 4
|
||||
};
|
||||
}};
|
||||
|
|
|
@ -231,7 +231,7 @@ class CartridgeWD : public Cartridge
|
|||
struct BankOrg {
|
||||
uInt8 zero, one, two, three;
|
||||
};
|
||||
static BankOrg ourBankOrg[8];
|
||||
static const std::array<BankOrg, 8> ourBankOrg;
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
|
|
|
@ -107,7 +107,7 @@ bool Controller::load(Serializer& in)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string Controller::getName(const Type type)
|
||||
{
|
||||
string NAMES[int(Controller::Type::LastType)] =
|
||||
static const std::array<string, int(Controller::Type::LastType)> NAMES =
|
||||
{
|
||||
"Unknown",
|
||||
"AmigaMouse", "AtariMouse", "AtariVox", "BoosterGrip", "CompuMate",
|
||||
|
@ -121,7 +121,7 @@ string Controller::getName(const Type type)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string Controller::getPropName(const Type type)
|
||||
{
|
||||
string PROP_NAMES[int(Controller::Type::LastType)] =
|
||||
static const std::array<string, int(Controller::Type::LastType)> PROP_NAMES =
|
||||
{
|
||||
"AUTO",
|
||||
"AMIGAMOUSE", "ATARIMOUSE", "ATARIVOX", "BOOSTERGRIP", "COMPUMATE",
|
||||
|
|
|
@ -469,7 +469,7 @@ class EventHandler
|
|||
;
|
||||
|
||||
// The event(s) assigned to each combination event
|
||||
Event::Type myComboTable[COMBO_SIZE][EVENTS_PER_COMBO];
|
||||
BSPF::array2D<Event::Type, COMBO_SIZE, EVENTS_PER_COMBO> myComboTable;
|
||||
|
||||
// Holds static strings for the remap menu (emulation and menu events)
|
||||
using EmulActionList = std::array<ActionList, EMUL_ACTIONLIST_SIZE>;
|
||||
|
|
|
@ -238,7 +238,7 @@ uInt32 FilesystemNode::read(ByteBuffer& image) const
|
|||
if (length == 0)
|
||||
throw runtime_error("Zero-byte file");
|
||||
|
||||
size = std::min(uInt32(length), 512u * 1024u);
|
||||
size = std::min<uInt32>(length, 512 * 1024);
|
||||
in.read(reinterpret_cast<char*>(image.get()), size);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -907,7 +907,7 @@ void FrameBuffer::setAvailableVidModes(uInt32 baseWidth, uInt32 baseHeight)
|
|||
for(auto& mode: myFullscreenModeLists)
|
||||
mode.clear();
|
||||
for(size_t i = myFullscreenModeLists.size(); i < myFullscreenDisplays.size(); ++i)
|
||||
myFullscreenModeLists.push_back(VideoModeList());
|
||||
myFullscreenModeLists.emplace_back(VideoModeList());
|
||||
|
||||
// Check if zooming is allowed for this state (currently only allowed
|
||||
// for TIA screens)
|
||||
|
|
|
@ -222,13 +222,13 @@ void Paddles::update()
|
|||
int sa_yaxis = myEvent.get(myP1AxisValue);
|
||||
int new_val;
|
||||
|
||||
const double bFac[MAX_DEJITTER - MIN_DEJITTER + 1] = {
|
||||
static constexpr std::array<double, MAX_DEJITTER - MIN_DEJITTER + 1> bFac = {
|
||||
// higher values mean more dejitter strength
|
||||
0, // off
|
||||
0.50, 0.59, 0.67, 0.74, 0.80,
|
||||
0.85, 0.89, 0.92, 0.94, 0.95
|
||||
};
|
||||
const double dFac[MAX_DEJITTER - MIN_DEJITTER + 1] = {
|
||||
static constexpr std::array<double, MAX_DEJITTER - MIN_DEJITTER + 1> dFac = {
|
||||
// lower values mean more dejitter strength
|
||||
1, // off
|
||||
1.0 / 181, 1.0 / 256, 1.0 / 362, 1.0 / 512, 1.0 / 724,
|
||||
|
@ -430,6 +430,4 @@ int Paddles::DEJITTER_BASE = 0;
|
|||
int Paddles::DEJITTER_DIFF = 0;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const Controller::DigitalPin Paddles::ourButtonPin[2] = {
|
||||
DigitalPin::Four, DigitalPin::Three
|
||||
};
|
||||
const std::array<Controller::DigitalPin, 2> Paddles::ourButtonPin;
|
||||
|
|
|
@ -48,7 +48,6 @@ class Paddles : public Controller
|
|||
virtual ~Paddles() = default;
|
||||
|
||||
public:
|
||||
|
||||
static constexpr int MAX_DIGITAL_SENSE = 20;
|
||||
static constexpr int MAX_MOUSE_SENSE = 20;
|
||||
static constexpr int MIN_DEJITTER = 0;
|
||||
|
@ -147,7 +146,7 @@ class Paddles : public Controller
|
|||
|
||||
bool myKeyRepeat0, myKeyRepeat1;
|
||||
int myPaddleRepeat0, myPaddleRepeat1;
|
||||
int myCharge[2], myLastCharge[2];
|
||||
std::array<int, 2> myCharge, myLastCharge;
|
||||
int myLastAxisX, myLastAxisY;
|
||||
int myAxisDigitalZero, myAxisDigitalOne;
|
||||
|
||||
|
@ -163,7 +162,9 @@ class Paddles : public Controller
|
|||
|
||||
// Lookup table for associating paddle buttons with controller pins
|
||||
// Yes, this is hideously complex
|
||||
static const Controller::DigitalPin ourButtonPin[2];
|
||||
static constexpr std::array<Controller::DigitalPin, 2> ourButtonPin = {
|
||||
DigitalPin::Four, DigitalPin::Three
|
||||
};
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
|
|
|
@ -58,7 +58,7 @@ Thumbulator::Thumbulator(const uInt16* rom_ptr, uInt16* ram_ptr, uInt16 rom_size
|
|||
Cartridge* cartridge)
|
||||
: rom(rom_ptr),
|
||||
romSize(rom_size),
|
||||
decodedRom(new Op[romSize / 2]),
|
||||
decodedRom(make_unique<Op[]>(romSize / 2)),
|
||||
ram(ram_ptr),
|
||||
T1TCR(0),
|
||||
T1TC(0),
|
||||
|
@ -994,7 +994,7 @@ int Thumbulator::execute()
|
|||
if(rc & 0x80000000)
|
||||
{
|
||||
do_cflag_bit(1);
|
||||
rc = ~0u;
|
||||
rc = ~0U;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1008,7 +1008,7 @@ int Thumbulator::execute()
|
|||
ra = rc & 0x80000000;
|
||||
rc >>= rb;
|
||||
if(ra) //asr, sign is shifted in
|
||||
rc |= (~0u) << (32-rb);
|
||||
rc |= (~0U) << (32-rb);
|
||||
}
|
||||
write_register(rd, rc);
|
||||
do_nflag(rc);
|
||||
|
@ -1034,7 +1034,7 @@ int Thumbulator::execute()
|
|||
rc >>= rb;
|
||||
if(ra) //asr, sign is shifted in
|
||||
{
|
||||
rc |= (~0u) << (32-rb);
|
||||
rc |= (~0U) << (32-rb);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1042,7 +1042,7 @@ int Thumbulator::execute()
|
|||
if(rc & 0x80000000)
|
||||
{
|
||||
do_cflag_bit(1);
|
||||
rc = (~0u);
|
||||
rc = (~0U);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1060,7 +1060,7 @@ int Thumbulator::execute()
|
|||
case Op::b1: {
|
||||
rb = (inst >> 0) & 0xFF;
|
||||
if(rb & 0x80)
|
||||
rb |= (~0u) << 8;
|
||||
rb |= (~0U) << 8;
|
||||
op=(inst >> 8) & 0xF;
|
||||
rb <<= 1;
|
||||
rb += pc;
|
||||
|
@ -1175,7 +1175,7 @@ int Thumbulator::execute()
|
|||
case Op::b2: {
|
||||
rb = (inst >> 0) & 0x7FF;
|
||||
if(rb & (1 << 10))
|
||||
rb |= (~0u) << 11;
|
||||
rb |= (~0U) << 11;
|
||||
rb <<= 1;
|
||||
rb += pc;
|
||||
rb += 2;
|
||||
|
@ -1771,7 +1771,7 @@ int Thumbulator::execute()
|
|||
}
|
||||
rc &= 0xFF;
|
||||
if(rc & 0x80)
|
||||
rc |= ((~0u) << 8);
|
||||
rc |= ((~0U) << 8);
|
||||
write_register(rd, rc);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1786,7 +1786,7 @@ int Thumbulator::execute()
|
|||
rc = read16(rb);
|
||||
rc &= 0xFFFF;
|
||||
if(rc & 0x8000)
|
||||
rc |= ((~0u) << 16);
|
||||
rc |= ((~0U) << 16);
|
||||
write_register(rd, rc);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2442,7 +2442,7 @@ int Thumbulator::execute()
|
|||
ra = read_register(rm);
|
||||
rc = ra & 0xFF;
|
||||
if(rc & 0x80)
|
||||
rc |= (~0u) << 8;
|
||||
rc |= (~0U) << 8;
|
||||
write_register(rd, rc);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2455,7 +2455,7 @@ int Thumbulator::execute()
|
|||
ra = read_register(rm);
|
||||
rc = ra & 0xFFFF;
|
||||
if(rc & 0x8000)
|
||||
rc |= (~0u) << 16;
|
||||
rc |= (~0U) << 16;
|
||||
write_register(rd, rc);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2513,7 +2513,7 @@ int Thumbulator::execute()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int Thumbulator::reset()
|
||||
{
|
||||
std::fill(reg_norm, reg_norm+12, 0);
|
||||
reg_norm.fill(0);
|
||||
reg_norm[13] = 0x40001FB4;
|
||||
|
||||
switch(configuration)
|
||||
|
|
|
@ -187,10 +187,10 @@ class Thumbulator
|
|||
private:
|
||||
const uInt16* rom;
|
||||
uInt16 romSize;
|
||||
const unique_ptr<Op[]> decodedRom;
|
||||
const unique_ptr<Op[]> decodedRom; // NOLINT
|
||||
uInt16* ram;
|
||||
|
||||
uInt32 reg_norm[16]; // normal execution mode, do not have a thread mode
|
||||
std::array<uInt32, 16> reg_norm; // normal execution mode, do not have a thread mode
|
||||
uInt32 cpsr, mamcr;
|
||||
bool handler_mode;
|
||||
uInt32 systick_ctrl, systick_reload, systick_count, systick_calibrate;
|
||||
|
|
|
@ -789,6 +789,9 @@ bool TIA::poke(uInt16 address, uInt8 value)
|
|||
myCollisionMask = 0;
|
||||
myShadowRegisters[address] = value;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -1670,6 +1673,9 @@ void TIA::delayedWrite(uInt8 address, uInt8 value)
|
|||
case ENAM1:
|
||||
myMissile1.enam(value);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -539,7 +539,7 @@ class TIA : public Device
|
|||
* Palette and indices for fixed debug colors.
|
||||
*/
|
||||
enum FixedObject { P0, M0, P1, M1, PF, BL, BK };
|
||||
FixedColor myFixedColorPalette[3][7];
|
||||
BSPF::array2D<FixedColor, 3, 7> myFixedColorPalette;
|
||||
std::array<string, 7> myFixedColorNames;
|
||||
|
||||
private:
|
||||
|
|
|
@ -138,11 +138,10 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
|
|||
wid.push_back(myRandomizeCPULabel);
|
||||
|
||||
int xpos = myRandomizeCPULabel->getRight() + 10;
|
||||
const char* const cpuregs[] = { "SP", "A", "X", "Y", "PS" };
|
||||
for(int i = 0; i < 5; ++i)
|
||||
{
|
||||
myRandomizeCPUWidget[i] = new CheckboxWidget(myTab, font, xpos, ypos + 1,
|
||||
cpuregs[i], kRandCPUID);
|
||||
ourCPUregs[i], kRandCPUID);
|
||||
wid.push_back(myRandomizeCPUWidget[i]);
|
||||
xpos += CheckboxWidget::boxSize() + font.getStringWidth("XX") + 20;
|
||||
}
|
||||
|
@ -331,7 +330,7 @@ void DeveloperDialog::addVideoTab(const GUI::Font& font)
|
|||
VarList::push_back(items, "Purple", "p");
|
||||
VarList::push_back(items, "Blue", "b");
|
||||
|
||||
static constexpr int dbg_cmds[DEBUG_COLORS] = {
|
||||
static constexpr std::array<int, DEBUG_COLORS> dbg_cmds = {
|
||||
kP0ColourChangedCmd, kM0ColourChangedCmd, kP1ColourChangedCmd,
|
||||
kM1ColourChangedCmd, kPFColourChangedCmd, kBLColourChangedCmd
|
||||
};
|
||||
|
@ -367,7 +366,7 @@ void DeveloperDialog::addVideoTab(const GUI::Font& font)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
|
||||
{
|
||||
const string INTERVALS[NUM_INTERVALS] = {
|
||||
const std::array<string, NUM_INTERVALS> INTERVALS = {
|
||||
" 1 frame",
|
||||
" 3 frames",
|
||||
"10 frames",
|
||||
|
@ -376,7 +375,7 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
|
|||
" 3 seconds",
|
||||
"10 seconds"
|
||||
};
|
||||
const string INT_SETTINGS[NUM_INTERVALS] = {
|
||||
const std::array<string, NUM_INTERVALS> INT_SETTINGS = {
|
||||
"1f",
|
||||
"3f",
|
||||
"10f",
|
||||
|
@ -385,7 +384,7 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
|
|||
"3s",
|
||||
"10s"
|
||||
};
|
||||
const string HORIZONS[NUM_HORIZONS] = {
|
||||
const std::array<string, NUM_HORIZONS> HORIZONS = {
|
||||
" 3 seconds",
|
||||
"10 seconds",
|
||||
"30 seconds",
|
||||
|
@ -395,7 +394,7 @@ void DeveloperDialog::addTimeMachineTab(const GUI::Font& font)
|
|||
"30 minutes",
|
||||
"60 minutes"
|
||||
};
|
||||
const string HOR_SETTINGS[NUM_HORIZONS] = {
|
||||
const std::array<string, NUM_HORIZONS> HOR_SETTINGS = {
|
||||
"3s",
|
||||
"10s",
|
||||
"30s",
|
||||
|
@ -724,10 +723,9 @@ void DeveloperDialog::getWidgetStates(SettingsSet set)
|
|||
myRandomBank[set] = myRandomBankWidget->getState();
|
||||
myRandomizeRAM[set] = myRandomizeRAMWidget->getState();
|
||||
string cpurandom;
|
||||
const char* const cpuregs[] = { "S", "A", "X", "Y", "P" };
|
||||
for(int i = 0; i < 5; ++i)
|
||||
if(myRandomizeCPUWidget[i]->getState())
|
||||
cpurandom += cpuregs[i];
|
||||
cpurandom += ourCPUregs[i];
|
||||
myRandomizeCPU[set] = cpurandom;
|
||||
// Undriven TIA pins
|
||||
myUndrivenPins[set] = myUndrivenPinsWidget->getState();
|
||||
|
@ -777,9 +775,8 @@ void DeveloperDialog::setWidgetStates(SettingsSet set)
|
|||
myRandomizeRAMWidget->setState(myRandomizeRAM[set]);
|
||||
|
||||
const string& cpurandom = myRandomizeCPU[set];
|
||||
const char* const cpuregs[] = { "S", "A", "X", "Y", "P" };
|
||||
for(int i = 0; i < 5; ++i)
|
||||
myRandomizeCPUWidget[i]->setState(BSPF::containsIgnoreCase(cpurandom, cpuregs[i]));
|
||||
myRandomizeCPUWidget[i]->setState(BSPF::containsIgnoreCase(cpurandom, ourCPUregs[i]));
|
||||
// Undriven TIA pins
|
||||
myUndrivenPinsWidget->setState(myUndrivenPins[set]);
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
|
@ -1387,7 +1384,7 @@ void DeveloperDialog::handleDebugColours(int idx, int color)
|
|||
return;
|
||||
}
|
||||
|
||||
static constexpr ColorId dbg_color[3][DEBUG_COLORS] = {
|
||||
static constexpr BSPF::array2D<ColorId, 3, DEBUG_COLORS> dbg_color = {{
|
||||
{
|
||||
TIA::FixedColor::NTSC_RED,
|
||||
TIA::FixedColor::NTSC_ORANGE,
|
||||
|
@ -1412,7 +1409,7 @@ void DeveloperDialog::handleDebugColours(int idx, int color)
|
|||
TIA::FixedColor::SECAM_PURPLE,
|
||||
TIA::FixedColor::SECAM_BLUE
|
||||
}
|
||||
};
|
||||
}};
|
||||
|
||||
int timing = instance().console().timing() == ConsoleTiming::ntsc ? 0
|
||||
: instance().console().timing() == ConsoleTiming::pal ? 1 : 2;
|
||||
|
@ -1421,7 +1418,7 @@ void DeveloperDialog::handleDebugColours(int idx, int color)
|
|||
myDbgColour[idx]->setSelectedIndex(color);
|
||||
|
||||
// make sure the selected debug colors are all different
|
||||
bool usedCol[DEBUG_COLORS];
|
||||
std::array<bool, DEBUG_COLORS> usedCol;
|
||||
|
||||
// identify used colors
|
||||
for(int i = 0; i < DEBUG_COLORS; ++i)
|
||||
|
@ -1507,3 +1504,8 @@ void DeveloperDialog::handleFontSize()
|
|||
myDebuggerHeightSlider->setValue(minH);
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const std::array<string, 5> DeveloperDialog::ourCPUregs = {
|
||||
"SP", "A", "X", "Y", "PS"
|
||||
};
|
||||
|
|
|
@ -95,8 +95,8 @@ class DeveloperDialog : public Dialog
|
|||
CheckboxWidget* myRandomBankWidget;
|
||||
CheckboxWidget* myRandomizeRAMWidget;
|
||||
StaticTextWidget* myRandomizeCPULabel;
|
||||
CheckboxWidget* myRandomizeCPUWidget[5];
|
||||
CheckboxWidget* myUndrivenPinsWidget;
|
||||
std::array<CheckboxWidget*, 5> myRandomizeCPUWidget;
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
CheckboxWidget* myRWPortBreakWidget;
|
||||
CheckboxWidget* myWRPortBreakWidget;
|
||||
|
@ -125,8 +125,8 @@ class DeveloperDialog : public Dialog
|
|||
StaticTextWidget* myTVJitterRecLabelWidget;
|
||||
CheckboxWidget* myColorLossWidget;
|
||||
CheckboxWidget* myDebugColorsWidget;
|
||||
PopUpWidget* myDbgColour[DEBUG_COLORS];
|
||||
ColorWidget* myDbgColourSwatch[DEBUG_COLORS];
|
||||
std::array<PopUpWidget*, DEBUG_COLORS> myDbgColour;
|
||||
std::array<ColorWidget*, DEBUG_COLORS> myDbgColourSwatch;
|
||||
|
||||
// States widgets
|
||||
RadioButtonGroup* mySettingsGroupTM;
|
||||
|
@ -148,37 +148,39 @@ class DeveloperDialog : public Dialog
|
|||
|
||||
bool mySettings;
|
||||
// Emulator sets
|
||||
bool myFrameStats[2];
|
||||
int myConsole[2];
|
||||
bool myRandomBank[2];
|
||||
bool myRandomizeRAM[2];
|
||||
string myRandomizeCPU[2];
|
||||
bool myColorLoss[2];
|
||||
bool myTVJitter[2];
|
||||
int myTVJitterRec[2];
|
||||
bool myDebugColors[2];
|
||||
bool myUndrivenPins[2];
|
||||
std::array<bool, 2> myFrameStats;
|
||||
std::array<int, 2> myConsole;
|
||||
std::array<bool, 2> myRandomBank;
|
||||
std::array<bool, 2> myRandomizeRAM;
|
||||
std::array<string, 2> myRandomizeCPU;
|
||||
std::array<bool, 2> myColorLoss;
|
||||
std::array<bool, 2> myTVJitter;
|
||||
std::array<int, 2> myTVJitterRec;
|
||||
std::array<bool, 2> myDebugColors;
|
||||
std::array<bool, 2> myUndrivenPins;
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
bool myRWPortBreak[2];
|
||||
bool myWRPortBreak[2];
|
||||
std::array<bool, 2> myRWPortBreak;
|
||||
std::array<bool, 2> myWRPortBreak;
|
||||
#endif
|
||||
bool myThumbException[2];
|
||||
bool myEEPROMAccess[2];
|
||||
std::array<bool, 2> myThumbException;
|
||||
std::array<bool, 2> myEEPROMAccess;
|
||||
// TIA sets
|
||||
string myTIAType[2];
|
||||
bool myPlInvPhase[2];
|
||||
bool myMsInvPhase[2];
|
||||
bool myBlInvPhase[2];
|
||||
bool myPFBits[2];
|
||||
bool myPFColor[2];
|
||||
bool myPlSwap[2];
|
||||
bool myBlSwap[2];
|
||||
std::array<string, 2> myTIAType;
|
||||
std::array<bool, 2> myPlInvPhase;
|
||||
std::array<bool, 2> myMsInvPhase;
|
||||
std::array<bool, 2> myBlInvPhase;
|
||||
std::array<bool, 2> myPFBits;
|
||||
std::array<bool, 2> myPFColor;
|
||||
std::array<bool, 2> myPlSwap;
|
||||
std::array<bool, 2> myBlSwap;
|
||||
// States sets
|
||||
bool myTimeMachine[2];
|
||||
int myStateSize[2];
|
||||
int myUncompressed[2];
|
||||
string myStateInterval[2];
|
||||
string myStateHorizon[2];
|
||||
std::array<bool, 2> myTimeMachine;
|
||||
std::array<int, 2> myStateSize;
|
||||
std::array<int, 2> myUncompressed;
|
||||
std::array<string, 2> myStateInterval;
|
||||
std::array<string, 2> myStateHorizon;
|
||||
|
||||
static const std::array<string, 5> ourCPUregs;
|
||||
|
||||
private:
|
||||
void addEmulationTab(const GUI::Font& font);
|
||||
|
|
|
@ -509,5 +509,8 @@ void EventMappingWidget::handleCommand(CommandSender* sender, int cmd,
|
|||
instance().eventHandler().eventAtIndex(myActionSelected, myEventGroup),
|
||||
instance().eventHandler().actionAtIndex(myActionSelected, myEventGroup));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ int GlobalPropsDialog::addHoldWidgets(const GUI::Font& font, int x, int y,
|
|||
ypos += myHoldSelect->getHeight() + VGAP;
|
||||
myHoldReset = new CheckboxWidget(this, font, xpos, ypos, "Reset");
|
||||
|
||||
const int TAB_ORDER[10] = {
|
||||
static constexpr std::array<int, 10> TAB_ORDER = {
|
||||
kJ0Up, kJ0Left, kJ0Right, kJ0Down, kJ0Fire,
|
||||
kJ1Up, kJ1Left, kJ1Right, kJ1Down, kJ1Fire
|
||||
};
|
||||
|
@ -292,6 +292,6 @@ void GlobalPropsDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const char* const GlobalPropsDialog::ourJoyState[10] = {
|
||||
const std::array<string, 10> GlobalPropsDialog::ourJoyState = {
|
||||
"U", "D", "L", "R", "F", "U", "D", "L", "R", "F"
|
||||
};
|
||||
|
|
|
@ -54,11 +54,11 @@ class GlobalPropsDialog : public Dialog, public CommandSender
|
|||
PopUpWidget* myTVType;
|
||||
PopUpWidget* myDebug;
|
||||
|
||||
CheckboxWidget* myJoy[10];
|
||||
std::array<CheckboxWidget*, 10> myJoy;
|
||||
CheckboxWidget* myHoldSelect;
|
||||
CheckboxWidget* myHoldReset;
|
||||
|
||||
static const char* const ourJoyState[10];
|
||||
static const std::array<string, 10> ourJoyState;
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
|
|
|
@ -166,6 +166,9 @@ void HelpDialog::updateStrings(uInt8 page, uInt8 lines, string& title)
|
|||
ADD_TEXT("'Options/Input" + ELLIPSIS + "' dialog for");
|
||||
ADD_TEXT("more information.");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
while(i < lines)
|
||||
|
|
|
@ -45,10 +45,10 @@ class HelpDialog : public Dialog
|
|||
ButtonWidget* myPrevButton;
|
||||
|
||||
StaticTextWidget* myTitle;
|
||||
StaticTextWidget* myKey[LINES_PER_PAGE];
|
||||
StaticTextWidget* myDesc[LINES_PER_PAGE];
|
||||
string myKeyStr[LINES_PER_PAGE];
|
||||
string myDescStr[LINES_PER_PAGE];
|
||||
std::array<StaticTextWidget*, LINES_PER_PAGE> myKey;
|
||||
std::array<StaticTextWidget*, LINES_PER_PAGE> myDesc;
|
||||
std::array<string, LINES_PER_PAGE> myKeyStr;
|
||||
std::array<string, LINES_PER_PAGE> myDescStr;
|
||||
|
||||
uInt8 myPage;
|
||||
uInt8 myNumPages;
|
||||
|
|
|
@ -388,18 +388,16 @@ void ListWidget::lostFocusWidget()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ListWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||
{
|
||||
switch (cmd)
|
||||
if (cmd == GuiObject::kSetPositionCmd)
|
||||
{
|
||||
case GuiObject::kSetPositionCmd:
|
||||
if (_currentPos != data)
|
||||
{
|
||||
_currentPos = data;
|
||||
setDirty();
|
||||
if (_currentPos != data)
|
||||
{
|
||||
_currentPos = data;
|
||||
setDirty();
|
||||
|
||||
// Let boss know the list has scrolled
|
||||
sendCommand(ListWidget::kScrolledCmd, _currentPos, _id);
|
||||
}
|
||||
break;
|
||||
// Let boss know the list has scrolled
|
||||
sendCommand(ListWidget::kScrolledCmd, _currentPos, _id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,24 +79,17 @@ void MessageBox::addText(const GUI::Font& font, const StringList& text)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void MessageBox::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||
{
|
||||
switch(cmd)
|
||||
if(cmd == GuiObject::kOKCmd)
|
||||
{
|
||||
case GuiObject::kOKCmd:
|
||||
{
|
||||
close();
|
||||
close();
|
||||
|
||||
// Send a signal to the calling class that 'OK' has been selected
|
||||
// Since we aren't derived from a widget, we don't have a 'data' or 'id'
|
||||
if(myCmd)
|
||||
sendCommand(myCmd, 0, 0);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
Dialog::handleCommand(sender, cmd, data, id);
|
||||
break;
|
||||
// Send a signal to the calling class that 'OK' has been selected
|
||||
// Since we aren't derived from a widget, we don't have a 'data' or 'id'
|
||||
if(myCmd)
|
||||
sendCommand(myCmd, 0, 0);
|
||||
}
|
||||
else
|
||||
Dialog::handleCommand(sender, cmd, data, id);
|
||||
}
|
||||
|
||||
} // namespace GUI
|
||||
|
|
|
@ -250,6 +250,9 @@ void MinUICommandDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
case kExitGameCmd:
|
||||
instance().eventHandler().handleEvent(Event::ExitMode);
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
// Console commands should be performed right away, after leaving the menu
|
||||
|
|
|
@ -23,18 +23,6 @@
|
|||
#include "DialogContainer.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
|
||||
// Little down arrow
|
||||
static uInt32 down_arrow[8] = {
|
||||
0b100000001,
|
||||
0b110000011,
|
||||
0b111000111,
|
||||
0b011101110,
|
||||
0b001111100,
|
||||
0b000111000,
|
||||
0b000010000,
|
||||
0b000000000
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PopUpWidget::PopUpWidget(GuiObject* boss, const GUI::Font& font,
|
||||
int x, int y, int w, int h, const VariantList& list,
|
||||
|
@ -192,6 +180,18 @@ void PopUpWidget::handleCommand(CommandSender* sender, int cmd, int data, int id
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void PopUpWidget::drawWidget(bool hilite)
|
||||
{
|
||||
// Little down arrow
|
||||
static constexpr std::array<uInt32, 8> down_arrow = {
|
||||
0b100000001,
|
||||
0b110000011,
|
||||
0b111000111,
|
||||
0b011101110,
|
||||
0b001111100,
|
||||
0b000111000,
|
||||
0b000010000,
|
||||
0b000000000
|
||||
};
|
||||
|
||||
//cerr << "PopUpWidget::drawWidget\n";
|
||||
FBSurface& s = dialog().surface();
|
||||
bool onTop = _boss->dialog().isOnTop();
|
||||
|
@ -212,7 +212,7 @@ void PopUpWidget::drawWidget(bool hilite)
|
|||
s.fillRect(x + 1, _y + 1, w - 17, _h - 2, onTop ? _changed ? kDbgChangedColor : kWidColor : kDlgColor);
|
||||
s.fillRect(x + w - 15, _y + 2, 13, _h - 4, onTop ? isEnabled() && hilite ? kWidColor : kBGColorHi : kBGColorLo);
|
||||
// Draw an arrow pointing down at the right end to signal this is a dropdown/popup
|
||||
s.drawBitmap(down_arrow, x + w - 13, _y + myArrowsY + 1,
|
||||
s.drawBitmap(down_arrow.data(), x + w - 13, _y + myArrowsY + 1,
|
||||
!(isEnabled() && onTop) ? kColor : kTextColor, 9U, 8U);
|
||||
|
||||
// Draw the selected entry, if any
|
||||
|
|
|
@ -161,6 +161,9 @@ void R77HelpDialog::updateStrings(uInt8 page, uInt8 lines, string& title)
|
|||
ADD_TEXT("and consult the 'Options/Input" + ELLIPSIS + "'");
|
||||
ADD_TEXT("dialog for more information.");
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
while (i < lines)
|
||||
|
|
|
@ -46,12 +46,12 @@ class R77HelpDialog : public Dialog
|
|||
ButtonWidget* myPrevButton;
|
||||
|
||||
StaticTextWidget* myTitle;
|
||||
StaticTextWidget* myJoy[LINES_PER_PAGE];
|
||||
StaticTextWidget* myBtn[LINES_PER_PAGE];
|
||||
StaticTextWidget* myDesc[LINES_PER_PAGE];
|
||||
string myJoyStr[LINES_PER_PAGE];
|
||||
string myBtnStr[LINES_PER_PAGE];
|
||||
string myDescStr[LINES_PER_PAGE];
|
||||
std::array<StaticTextWidget*, LINES_PER_PAGE> myJoy;
|
||||
std::array<StaticTextWidget*, LINES_PER_PAGE> myBtn;
|
||||
std::array<StaticTextWidget*, LINES_PER_PAGE> myDesc;
|
||||
std::array<string, LINES_PER_PAGE> myJoyStr;
|
||||
std::array<string, LINES_PER_PAGE> myBtnStr;
|
||||
std::array<string, LINES_PER_PAGE> myDescStr;
|
||||
|
||||
uInt8 myPage;
|
||||
uInt8 myNumPages;
|
||||
|
|
|
@ -21,66 +21,26 @@
|
|||
#include "RadioButtonWidget.hxx"
|
||||
|
||||
/* Radiobutton bitmaps */
|
||||
static uInt32 radio_img_outercircle[14] =
|
||||
{
|
||||
0b00001111110000,
|
||||
0b00110000001100,
|
||||
0b01000000000010,
|
||||
0b01000000000010,
|
||||
0b10000000000001,
|
||||
0b10000000000001,
|
||||
0b10000000000001,
|
||||
0b10000000000001,
|
||||
0b10000000000001,
|
||||
0b10000000000001,
|
||||
0b01000000000010,
|
||||
0b01000000000010,
|
||||
0b00110000001100,
|
||||
0b00001111110000
|
||||
static constexpr std::array<uInt32, 14> radio_img_outercircle = {
|
||||
0b00001111110000, 0b00110000001100, 0b01000000000010,
|
||||
0b01000000000010, 0b10000000000001, 0b10000000000001,
|
||||
0b10000000000001, 0b10000000000001, 0b10000000000001,
|
||||
0b10000000000001, 0b01000000000010, 0b01000000000010,
|
||||
0b00110000001100, 0b00001111110000
|
||||
};
|
||||
|
||||
static uInt32 radio_img_innercircle[12] =
|
||||
{
|
||||
0b000111111000,
|
||||
0b011111111110,
|
||||
0b011111111110,
|
||||
0b111111111111,
|
||||
0b111111111111,
|
||||
0b111111111111,
|
||||
0b111111111111,
|
||||
0b111111111111,
|
||||
0b111111111111,
|
||||
0b011111111110,
|
||||
0b011111111110,
|
||||
0b000111111000
|
||||
static constexpr std::array<uInt32, 12> radio_img_innercircle = {
|
||||
0b000111111000, 0b011111111110, 0b011111111110, 0b111111111111,
|
||||
0b111111111111, 0b111111111111, 0b111111111111, 0b111111111111,
|
||||
0b111111111111, 0b011111111110, 0b011111111110, 0b000111111000
|
||||
};
|
||||
|
||||
static uInt32 radio_img_active[10] =
|
||||
{
|
||||
0b0011111100,
|
||||
0b0111111110,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b0111111110,
|
||||
0b0011111100,
|
||||
static constexpr uInt32 RADIO_IMG_FILL_SIZE = 10;
|
||||
static constexpr std::array<uInt32, RADIO_IMG_FILL_SIZE> radio_img_active = {
|
||||
0b0011111100, 0b0111111110, 0b1111111111, 0b1111111111, 0b1111111111,
|
||||
0b1111111111, 0b1111111111, 0b1111111111, 0b0111111110, 0b0011111100,
|
||||
};
|
||||
|
||||
static uInt32 radio_img_inactive[10] =
|
||||
{
|
||||
0b0011111100,
|
||||
0b0111111110,
|
||||
0b1111001111,
|
||||
0b1110000111,
|
||||
0b1100000011,
|
||||
0b1100000011,
|
||||
0b1110000111,
|
||||
0b1111001111,
|
||||
0b0111111110,
|
||||
0b0011111100
|
||||
static constexpr std::array<uInt32, RADIO_IMG_FILL_SIZE> radio_img_inactive = {
|
||||
0b0011111100, 0b0111111110, 0b1111001111, 0b1110000111, 0b1100000011,
|
||||
0b1100000011, 0b1110000111, 0b1111001111, 0b0111111110, 0b0011111100
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -144,10 +104,10 @@ void RadioButtonWidget::setFill(FillType type)
|
|||
switch(type)
|
||||
{
|
||||
case CheckboxWidget::FillType::Normal:
|
||||
_img = radio_img_active;
|
||||
_img = radio_img_active.data();
|
||||
break;
|
||||
case CheckboxWidget::FillType::Inactive:
|
||||
_img = radio_img_inactive;
|
||||
_img = radio_img_inactive.data();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -160,17 +120,20 @@ void RadioButtonWidget::drawWidget(bool hilite)
|
|||
FBSurface& s = _boss->dialog().surface();
|
||||
|
||||
// Draw the outer bounding circle
|
||||
s.drawBitmap(radio_img_outercircle, _x, _y + _boxY, hilite ? kWidColorHi : kColor, 14, 14);
|
||||
s.drawBitmap(radio_img_outercircle.data(), _x, _y + _boxY,
|
||||
hilite ? kWidColorHi : kColor,
|
||||
radio_img_outercircle.size(), radio_img_outercircle.size());
|
||||
|
||||
// Draw the inner bounding circle with enabled color
|
||||
s.drawBitmap(radio_img_innercircle, _x + 1, _y + _boxY + 1, isEnabled()
|
||||
? _bgcolor : kColor, 12, 12);
|
||||
s.drawBitmap(radio_img_innercircle.data(), _x + 1, _y + _boxY + 1,
|
||||
isEnabled() ? _bgcolor : kColor,
|
||||
radio_img_innercircle.size(), radio_img_innercircle.size());
|
||||
|
||||
// draw state
|
||||
if(_state)
|
||||
s.drawBitmap(_img, _x + 2, _y + _boxY + 2, isEnabled()
|
||||
? hilite ? kWidColorHi : kCheckColor
|
||||
: kColor, 10);
|
||||
: kColor, RADIO_IMG_FILL_SIZE);
|
||||
|
||||
// Finally draw the label
|
||||
s.drawString(_font, _label, _x + 20, _y + _textY, _w,
|
||||
|
|
|
@ -30,30 +30,6 @@
|
|||
|
||||
#define UP_DOWN_BOX_HEIGHT 18
|
||||
|
||||
// Up arrow
|
||||
static uInt32 up_arrow[8] = {
|
||||
0b00000000,
|
||||
0b00010000,
|
||||
0b00111000,
|
||||
0b01111100,
|
||||
0b11101110,
|
||||
0b11000110,
|
||||
0b10000010,
|
||||
0b00000000
|
||||
};
|
||||
|
||||
// Down arrow
|
||||
static uInt32 down_arrow[8] = {
|
||||
0b00000000,
|
||||
0b10000010,
|
||||
0b11000110,
|
||||
0b11101110,
|
||||
0b01111100,
|
||||
0b00111000,
|
||||
0b00010000,
|
||||
0b00000000
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
ScrollBarWidget::ScrollBarWidget(GuiObject* boss, const GUI::Font& font,
|
||||
int x, int y, int w, int h)
|
||||
|
@ -247,6 +223,30 @@ void ScrollBarWidget::recalc()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ScrollBarWidget::drawWidget(bool hilite)
|
||||
{
|
||||
// Up arrow
|
||||
static constexpr std::array<uInt32, 8> up_arrow = {
|
||||
0b00000000,
|
||||
0b00010000,
|
||||
0b00111000,
|
||||
0b01111100,
|
||||
0b11101110,
|
||||
0b11000110,
|
||||
0b10000010,
|
||||
0b00000000
|
||||
};
|
||||
|
||||
// Down arrow
|
||||
static constexpr std::array<uInt32, 8> down_arrow = {
|
||||
0b00000000,
|
||||
0b10000010,
|
||||
0b11000110,
|
||||
0b11101110,
|
||||
0b01111100,
|
||||
0b00111000,
|
||||
0b00010000,
|
||||
0b00000000
|
||||
};
|
||||
|
||||
//cerr << "ScrollBarWidget::drawWidget\n";
|
||||
FBSurface& s = _boss->dialog().surface();
|
||||
bool onTop = _boss->dialog().isOnTop();
|
||||
|
@ -261,18 +261,16 @@ void ScrollBarWidget::drawWidget(bool hilite)
|
|||
// Up arrow
|
||||
if(hilite && _part == kUpArrowPart)
|
||||
s.fillRect(_x + 1, _y + 1, _w - 2, UP_DOWN_BOX_HEIGHT - 2, kScrollColor);
|
||||
s.drawBitmap(up_arrow, _x+4, _y+5,
|
||||
onTop
|
||||
? isSinglePage ? kColor : (hilite && _part == kUpArrowPart) ? kWidColor : kTextColor
|
||||
: kColor, 8);
|
||||
s.drawBitmap(up_arrow.data(), _x+4, _y+5,
|
||||
onTop ? isSinglePage ? kColor : (hilite && _part == kUpArrowPart) ? kWidColor
|
||||
: kTextColor : kColor, 8);
|
||||
|
||||
// Down arrow
|
||||
if(hilite && _part == kDownArrowPart)
|
||||
s.fillRect(_x + 1, bottomY - UP_DOWN_BOX_HEIGHT + 1, _w - 2, UP_DOWN_BOX_HEIGHT - 2, kScrollColor);
|
||||
s.drawBitmap(down_arrow, _x+4, bottomY - UP_DOWN_BOX_HEIGHT + 5,
|
||||
onTop
|
||||
? isSinglePage ? kColor : (hilite && _part == kDownArrowPart) ? kWidColor : kTextColor
|
||||
: kColor, 8);
|
||||
s.drawBitmap(down_arrow.data(), _x+4, bottomY - UP_DOWN_BOX_HEIGHT + 5,
|
||||
onTop ? isSinglePage ? kColor : (hilite && _part == kDownArrowPart) ?
|
||||
kWidColor : kTextColor : kColor, 8);
|
||||
|
||||
// Slider
|
||||
if(!isSinglePage)
|
||||
|
|
|
@ -465,8 +465,10 @@ void StellaSettingsDialog::loadControllerProperties(const Properties& props)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int StellaSettingsDialog::levelToValue(int level)
|
||||
{
|
||||
const int NUM_LEVELS = 11;
|
||||
uInt8 values[NUM_LEVELS] = { 0, 5, 11, 18, 26, 35, 45, 56, 68, 81, 95 };
|
||||
constexpr int NUM_LEVELS = 11;
|
||||
static constexpr std::array<uInt8, NUM_LEVELS> values = {
|
||||
0, 5, 11, 18, 26, 35, 45, 56, 68, 81, 95
|
||||
};
|
||||
|
||||
return values[std::min(level, NUM_LEVELS - 1)];
|
||||
}
|
||||
|
@ -474,10 +476,12 @@ int StellaSettingsDialog::levelToValue(int level)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int StellaSettingsDialog::valueToLevel(int value)
|
||||
{
|
||||
const int NUM_LEVELS = 11;
|
||||
uInt8 values[NUM_LEVELS] = { 0, 5, 11, 18, 26, 35, 45, 56, 68, 81, 95 };
|
||||
constexpr int NUM_LEVELS = 11;
|
||||
static constexpr std::array<uInt8, NUM_LEVELS> values = {
|
||||
0, 5, 11, 18, 26, 35, 45, 56, 68, 81, 95
|
||||
};
|
||||
|
||||
for (uInt32 i = NUM_LEVELS - 1; i > 0; --i)
|
||||
for (int i = NUM_LEVELS - 1; i > 0; --i)
|
||||
{
|
||||
if (value >= values[i])
|
||||
return i;
|
||||
|
|
|
@ -34,10 +34,9 @@
|
|||
#include "Base.hxx"
|
||||
using Common::Base;
|
||||
|
||||
const int BUTTON_W = 14, BUTTON_H = 14;
|
||||
static constexpr int BUTTON_W = 14, BUTTON_H = 14;
|
||||
|
||||
static uInt32 RECORD[BUTTON_H] =
|
||||
{
|
||||
static constexpr std::array<uInt32, BUTTON_H> RECORD = {
|
||||
0b00000111100000,
|
||||
0b00011111111000,
|
||||
0b00111111111100,
|
||||
|
@ -53,9 +52,7 @@ static uInt32 RECORD[BUTTON_H] =
|
|||
0b00011111111000,
|
||||
0b00000111100000
|
||||
};
|
||||
|
||||
static uInt32 STOP[BUTTON_H] =
|
||||
{
|
||||
static constexpr std::array<uInt32, BUTTON_H> STOP = {
|
||||
0b11111111111111,
|
||||
0b11111111111111,
|
||||
0b11111111111111,
|
||||
|
@ -71,9 +68,7 @@ static uInt32 STOP[BUTTON_H] =
|
|||
0b11111111111111,
|
||||
0b11111111111111
|
||||
};
|
||||
|
||||
static uInt32 PLAY[BUTTON_H] =
|
||||
{
|
||||
static constexpr std::array<uInt32, BUTTON_H> PLAY = {
|
||||
0b11000000000000,
|
||||
0b11110000000000,
|
||||
0b11111100000000,
|
||||
|
@ -89,8 +84,7 @@ static uInt32 PLAY[BUTTON_H] =
|
|||
0b11110000000000,
|
||||
0b11000000000000
|
||||
};
|
||||
static uInt32 REWIND_ALL[BUTTON_H] =
|
||||
{
|
||||
static constexpr std::array<uInt32, BUTTON_H> REWIND_ALL = {
|
||||
0,
|
||||
0b11000011000011,
|
||||
0b11000111000111,
|
||||
|
@ -106,8 +100,7 @@ static uInt32 REWIND_ALL[BUTTON_H] =
|
|||
0b11000011000011,
|
||||
0
|
||||
};
|
||||
static uInt32 REWIND_1[BUTTON_H] =
|
||||
{
|
||||
static constexpr std::array<uInt32, BUTTON_H> REWIND_1 = {
|
||||
0,
|
||||
0b00000110001110,
|
||||
0b00001110001110,
|
||||
|
@ -123,8 +116,7 @@ static uInt32 REWIND_1[BUTTON_H] =
|
|||
0b00000110001110,
|
||||
0
|
||||
};
|
||||
static uInt32 UNWIND_1[BUTTON_H] =
|
||||
{
|
||||
static constexpr std::array<uInt32, BUTTON_H> UNWIND_1 = {
|
||||
0,
|
||||
0b01110001100000,
|
||||
0b01110001110000,
|
||||
|
@ -140,8 +132,7 @@ static uInt32 UNWIND_1[BUTTON_H] =
|
|||
0b01110001100000,
|
||||
0
|
||||
};
|
||||
static uInt32 UNWIND_ALL[BUTTON_H] =
|
||||
{
|
||||
static constexpr std::array<uInt32, BUTTON_H> UNWIND_ALL = {
|
||||
0,
|
||||
0b11000011000011,
|
||||
0b11100011100011,
|
||||
|
@ -157,8 +148,7 @@ static uInt32 UNWIND_ALL[BUTTON_H] =
|
|||
0b11000011000011,
|
||||
0
|
||||
};
|
||||
static uInt32 SAVE_ALL[BUTTON_H] =
|
||||
{
|
||||
static constexpr std::array<uInt32, BUTTON_H> SAVE_ALL = {
|
||||
0b00000111100000,
|
||||
0b00000111100000,
|
||||
0b00000111100000,
|
||||
|
@ -174,8 +164,7 @@ static uInt32 SAVE_ALL[BUTTON_H] =
|
|||
0b11111111111111,
|
||||
0b11111111111111,
|
||||
};
|
||||
static uInt32 LOAD_ALL[BUTTON_H] =
|
||||
{
|
||||
static constexpr std::array<uInt32, BUTTON_H> LOAD_ALL = {
|
||||
0b00000011000000,
|
||||
0b00000111100000,
|
||||
0b00001111110000,
|
||||
|
@ -241,41 +230,41 @@ TimeMachineDialog::TimeMachineDialog(OSystem& osystem, DialogContainer& parent,
|
|||
xpos = myCurrentTimeWidget->getRight() + BUTTON_GAP * 4;
|
||||
|
||||
// Add buttons
|
||||
myToggleWidget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, STOP,
|
||||
BUTTON_W, BUTTON_H, kToggle);
|
||||
myToggleWidget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
|
||||
STOP.data(), BUTTON_W, BUTTON_H, kToggle);
|
||||
xpos += buttonWidth + BUTTON_GAP;
|
||||
|
||||
myPlayWidget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, PLAY,
|
||||
BUTTON_W, BUTTON_H, kPlay);
|
||||
myPlayWidget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
|
||||
PLAY.data(), BUTTON_W, BUTTON_H, kPlay);
|
||||
xpos += buttonWidth + BUTTON_GAP * 4;
|
||||
|
||||
myRewindAllWidget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, REWIND_ALL,
|
||||
BUTTON_W, BUTTON_H, kRewindAll);
|
||||
myRewindAllWidget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
|
||||
REWIND_ALL.data(), BUTTON_W, BUTTON_H, kRewindAll);
|
||||
xpos += buttonWidth + BUTTON_GAP;
|
||||
|
||||
myRewind1Widget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, REWIND_1,
|
||||
BUTTON_W, BUTTON_H, kRewind1, true);
|
||||
myRewind1Widget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
|
||||
REWIND_1.data(), BUTTON_W, BUTTON_H, kRewind1, true);
|
||||
xpos += buttonWidth + BUTTON_GAP;
|
||||
|
||||
myUnwind1Widget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, UNWIND_1,
|
||||
BUTTON_W, BUTTON_H, kUnwind1, true);
|
||||
myUnwind1Widget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
|
||||
UNWIND_1.data(), BUTTON_W, BUTTON_H, kUnwind1, true);
|
||||
xpos += buttonWidth + BUTTON_GAP;
|
||||
|
||||
myUnwindAllWidget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, UNWIND_ALL,
|
||||
BUTTON_W, BUTTON_H, kUnwindAll);
|
||||
myUnwindAllWidget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
|
||||
UNWIND_ALL.data(), BUTTON_W, BUTTON_H, kUnwindAll);
|
||||
xpos = myUnwindAllWidget->getRight() + BUTTON_GAP * 4;
|
||||
|
||||
mySaveAllWidget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, SAVE_ALL,
|
||||
BUTTON_W, BUTTON_H, kSaveAll);
|
||||
mySaveAllWidget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
|
||||
SAVE_ALL.data(), BUTTON_W, BUTTON_H, kSaveAll);
|
||||
xpos = mySaveAllWidget->getRight() + BUTTON_GAP;
|
||||
|
||||
myLoadAllWidget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight, LOAD_ALL,
|
||||
BUTTON_W, BUTTON_H, kLoadAll);
|
||||
myLoadAllWidget = new ButtonWidget(this, font, xpos, ypos, buttonWidth, buttonHeight,
|
||||
LOAD_ALL.data(), BUTTON_W, BUTTON_H, kLoadAll);
|
||||
xpos = myLoadAllWidget->getRight() + BUTTON_GAP * 4;
|
||||
|
||||
// Add message
|
||||
myMessageWidget = new StaticTextWidget(this, font, xpos, ypos + 3, " ",
|
||||
TextAlign::Left, kBGColor);
|
||||
myMessageWidget = new StaticTextWidget(this, font, xpos, ypos + 3,
|
||||
" ", TextAlign::Left, kBGColor);
|
||||
myMessageWidget->setTextColor(kColorInfo);
|
||||
}
|
||||
|
||||
|
@ -479,6 +468,6 @@ void TimeMachineDialog::handleWinds(Int32 numWinds)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TimeMachineDialog::handleToggle()
|
||||
{
|
||||
myToggleWidget->setBitmap(instance().state().mode() == StateManager::Mode::Off ? RECORD : STOP,
|
||||
BUTTON_W, BUTTON_H);
|
||||
myToggleWidget->setBitmap(instance().state().mode() == StateManager::Mode::Off ?
|
||||
RECORD.data() : STOP.data(), BUTTON_W, BUTTON_H);
|
||||
}
|
||||
|
|
|
@ -337,9 +337,7 @@ StaticTextWidget::StaticTextWidget(GuiObject* boss, const GUI::Font& font,
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StaticTextWidget::setValue(int value)
|
||||
{
|
||||
char buf[256];
|
||||
std::snprintf(buf, 255, "%d", value);
|
||||
_label = buf;
|
||||
_label = std::to_string(value);
|
||||
|
||||
setDirty();
|
||||
}
|
||||
|
@ -406,14 +404,14 @@ ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font,
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font,
|
||||
int x, int y, int w, int h,
|
||||
uInt32* bitmap, int bmw, int bmh,
|
||||
const uInt32* bitmap, int bmw, int bmh,
|
||||
int cmd, bool repeat)
|
||||
: ButtonWidget(boss, font, x, y, w, h, "", cmd, repeat)
|
||||
{
|
||||
_bitmap = bitmap;
|
||||
_bmh = bmh;
|
||||
_bmw = bmw;
|
||||
_useBitmap = true;
|
||||
_bitmap = bitmap;
|
||||
_bmw = bmw;
|
||||
_bmh = bmh;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -431,20 +429,15 @@ void ButtonWidget::handleMouseLeft()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool ButtonWidget::handleEvent(Event::Type e)
|
||||
{
|
||||
if(!isEnabled())
|
||||
if(!isEnabled() || e != Event::UISelect)
|
||||
return false;
|
||||
|
||||
switch(e)
|
||||
{
|
||||
case Event::UISelect:
|
||||
// Simulate mouse event
|
||||
handleMouseUp(0, 0, MouseButton::LEFT, 0);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
// Simulate mouse event
|
||||
handleMouseUp(0, 0, MouseButton::LEFT, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool ButtonWidget::handleMouseClicks(int x, int y, MouseButton b)
|
||||
{
|
||||
return _repeat;
|
||||
|
@ -471,12 +464,12 @@ void ButtonWidget::handleMouseUp(int x, int y, MouseButton b, int clickCount)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void ButtonWidget::setBitmap(uInt32* bitmap, int bmw, int bmh)
|
||||
void ButtonWidget::setBitmap(const uInt32* bitmap, int bmw, int bmh)
|
||||
{
|
||||
_useBitmap = true;
|
||||
_bitmap = bitmap;
|
||||
_bmh = bmh;
|
||||
_bmw = bmw;
|
||||
_useBitmap = true;
|
||||
|
||||
setDirty();
|
||||
}
|
||||
|
@ -502,50 +495,6 @@ void ButtonWidget::drawWidget(bool hilite)
|
|||
setDirty();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
/* 8x8 checkbox bitmap */
|
||||
static uInt32 checked_img_active[10] =
|
||||
{
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111
|
||||
};
|
||||
|
||||
static uInt32 checked_img_inactive[10] =
|
||||
{
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111001111,
|
||||
0b1110000111,
|
||||
0b1100000011,
|
||||
0b1100000011,
|
||||
0b1110000111,
|
||||
0b1111001111,
|
||||
0b1111111111,
|
||||
0b1111111111
|
||||
};
|
||||
|
||||
static uInt32 checked_img_circle[10] =
|
||||
{
|
||||
0b0001111000,
|
||||
0b0111111110,
|
||||
0b0111111110,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b1111111111,
|
||||
0b0111111110,
|
||||
0b0111111110,
|
||||
0b0001111000
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
CheckboxWidget::CheckboxWidget(GuiObject* boss, const GUI::Font& font,
|
||||
int x, int y, const string& label,
|
||||
|
@ -625,18 +574,34 @@ void CheckboxWidget::setEditable(bool editable)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CheckboxWidget::setFill(FillType type)
|
||||
{
|
||||
/* 8x8 checkbox bitmap */
|
||||
static constexpr std::array<uInt32, 10> checked_img_active = {
|
||||
0b1111111111, 0b1111111111, 0b1111111111, 0b1111111111, 0b1111111111,
|
||||
0b1111111111, 0b1111111111, 0b1111111111, 0b1111111111, 0b1111111111
|
||||
};
|
||||
|
||||
static constexpr std::array<uInt32, 10> checked_img_inactive = {
|
||||
0b1111111111, 0b1111111111, 0b1111001111, 0b1110000111, 0b1100000011,
|
||||
0b1100000011, 0b1110000111, 0b1111001111, 0b1111111111, 0b1111111111
|
||||
};
|
||||
|
||||
static constexpr std::array<uInt32, 10> checked_img_circle = {
|
||||
0b0001111000, 0b0111111110, 0b0111111110, 0b1111111111, 0b1111111111,
|
||||
0b1111111111, 0b1111111111, 0b0111111110, 0b0111111110, 0b0001111000
|
||||
};
|
||||
|
||||
switch(type)
|
||||
{
|
||||
case CheckboxWidget::FillType::Normal:
|
||||
_img = checked_img_active;
|
||||
_img = checked_img_active.data();
|
||||
_drawBox = true;
|
||||
break;
|
||||
case CheckboxWidget::FillType::Inactive:
|
||||
_img = checked_img_inactive;
|
||||
_img = checked_img_inactive.data();
|
||||
_drawBox = true;
|
||||
break;
|
||||
case CheckboxWidget::FillType::Circle:
|
||||
_img = checked_img_circle;
|
||||
_img = checked_img_circle.data();
|
||||
_drawBox = false;
|
||||
break;
|
||||
}
|
||||
|
@ -765,10 +730,7 @@ void SliderWidget::setValueLabel(const string& valueLabel)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void SliderWidget::setValueLabel(int value)
|
||||
{
|
||||
char buf[256];
|
||||
std::snprintf(buf, 255, "%d", value);
|
||||
_valueLabel = buf;
|
||||
|
||||
_valueLabel = std::to_string(value);
|
||||
setDirty();
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue