code cleanup and bug fixing

This commit is contained in:
thrust26 2020-05-11 10:47:43 +02:00
parent 5aa57decb5
commit 614e28375d
10 changed files with 193 additions and 159 deletions

View File

@ -491,8 +491,6 @@ PhysicalKeyboardHandler::EventMappingArray PhysicalKeyboardHandler::DefaultCommo
{Event::ToggleColorLoss, KBDK_L, KBDM_CTRL},
{Event::PaletteDecrease, KBDK_P, KBDM_SHIFT | KBDM_CTRL},
{Event::PaletteIncrease, KBDK_P, KBDM_CTRL},
{Event::ColorShiftDecrease, KBDK_9, KBDM_SHIFT | KBDM_CTRL},
{Event::ColorShiftIncrease, KBDK_9, KBDM_CTRL},
{Event::ToggleInter, KBDK_I, KBDM_CTRL},
{Event::ToggleTurbo, KBDK_T, KBDM_CTRL},
{Event::ToggleJitter, KBDK_J, MOD3},

View File

@ -54,19 +54,14 @@ string PaletteHandler::toPaletteName(PaletteType type) const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PaletteHandler::changePalette(bool increase)
void PaletteHandler::cyclePalette(bool next)
{
const string MESSAGES[PaletteType::NumTypes] = {
"Standard Stella", "Z26", "User-defined", "Custom"
};
string palette, message;
palette = myOSystem.settings().getString("palette");
int type = toPaletteType(myOSystem.settings().getString("palette"));
if(increase)
if(next)
{
if(type == PaletteType::MaxType)
type = PaletteType::Standard;
@ -87,8 +82,8 @@ void PaletteHandler::changePalette(bool increase)
type--;
}
palette = toPaletteName(PaletteType(type));
message = MESSAGES[type] + " palette";
const string palette = toPaletteName(PaletteType(type));
const string message = MESSAGES[type] + " palette";
myOSystem.frameBuffer().showMessage(message);
@ -96,9 +91,10 @@ void PaletteHandler::changePalette(bool increase)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PaletteHandler::selectAdjustable(bool next)
void PaletteHandler::cycleAdjustable(bool next)
{
const bool isCustomPalette = "custom" == myOSystem.settings().getString("palette");
const bool isCustomPalette = SETTING_CUSTOM == myOSystem.settings().getString("palette");
bool isPhaseShift;
do {
if(next)
@ -113,11 +109,19 @@ void PaletteHandler::selectAdjustable(bool next)
else
myCurrentAdjustable--;
}
} while(!isCustomPalette && myAdjustables[myCurrentAdjustable].value == nullptr);
isPhaseShift = myAdjustables[myCurrentAdjustable].value == nullptr;
// skip phase shift when 'Custom' palette is not selected
} while(isPhaseShift && !isCustomPalette);
ostringstream buf;
buf << "Palette adjustable '" << myAdjustables[myCurrentAdjustable].type
<< "' selected";
buf << "Palette adjustable '" << myAdjustables[myCurrentAdjustable].name
<< "' selected (";
if(isPhaseShift)
buf << (myOSystem.console().timing() == ConsoleTiming::pal ? myPhasePAL : myPhaseNTSC)
<< DEGREE << ")";
else
buf << scaleTo100(*myAdjustables[myCurrentAdjustable].value) << "%)";
myOSystem.frameBuffer().showMessage(buf.str());
}
@ -129,25 +133,19 @@ void PaletteHandler::changeAdjustable(bool increase)
changeColorPhaseShift(increase);
else
{
float newVal = (*myAdjustables[myCurrentAdjustable].value);
int newVal = scaleTo100(*myAdjustables[myCurrentAdjustable].value);
if(increase)
{
newVal += 0.05F;
if(newVal > 1.0F)
newVal = 1.0F;
}
newVal += 2; // += 2%
else
{
newVal -= 0.05F;
if(newVal < -1.0F)
newVal = -1.0F;
}
*myAdjustables[myCurrentAdjustable].value = newVal;
newVal -= 2; // -= 2%
newVal = BSPF::clamp(newVal, 0, 100);
*myAdjustables[myCurrentAdjustable].value = scaleFrom100(newVal);
ostringstream buf;
buf << "Custom '" << myAdjustables[myCurrentAdjustable].type
<< "' set to " << int((newVal + 1.0F) * 100.0F + 0.5F) << "%";
buf << "Custom '" << myAdjustables[myCurrentAdjustable].name
<< "' set to " << newVal << "%";
myOSystem.frameBuffer().showMessage(buf.str());
setPalette();
@ -162,32 +160,27 @@ void PaletteHandler::changeColorPhaseShift(bool increase)
// SECAM is not supported
if(timing != ConsoleTiming::secam)
{
constexpr char DEGREE = 0x1c;
const bool isNTSC = timing == ConsoleTiming::ntsc;
const float shift = isNTSC ? DEF_NTSC_SHIFT : DEF_PAL_SHIFT;
float phase = isNTSC ? myPhaseNTSC : myPhasePAL;
float newPhase = isNTSC ? myPhaseNTSC : myPhasePAL;
if(increase) // increase color phase shift
{
phase += 0.3F;
phase = std::min(phase, shift + MAX_SHIFT);
}
newPhase += 0.3F;
else // decrease color phase shift
{
phase -= 0.3F;
phase = std::max(phase, shift - MAX_SHIFT);
}
newPhase -= 0.3F;
newPhase = BSPF::clamp(newPhase, shift - MAX_SHIFT, shift + MAX_SHIFT);
if(isNTSC)
myPhaseNTSC = phase;
myPhaseNTSC = newPhase;
else
myPhasePAL = phase;
myPhasePAL = newPhase;
generateCustomPalette(timing);
setPalette("custom");
setPalette(SETTING_CUSTOM);
ostringstream ss;
ss << "Color phase shift at "
<< std::fixed << std::setprecision(1) << phase << DEGREE;
<< std::fixed << std::setprecision(1) << newPhase << DEGREE;
myOSystem.frameBuffer().showMessage(ss.str());
}
@ -260,30 +253,33 @@ void PaletteHandler::setPalette(const string& name)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PaletteHandler::setPalette()
{
const string& name = myOSystem.settings().getString("palette");
if(myOSystem.hasConsole())
{
const string& name = myOSystem.settings().getString("palette");
// Look at all the palettes, since we don't know which one is
// currently active
static constexpr BSPF::array2D<const PaletteArray*, PaletteType::NumTypes, int(ConsoleTiming::numTimings)> palettes = {{
{ &ourNTSCPalette, &ourPALPalette, &ourSECAMPalette },
{ &ourNTSCPaletteZ26, &ourPALPaletteZ26, &ourSECAMPaletteZ26 },
{ &ourUserNTSCPalette, &ourUserPALPalette, &ourUserSECAMPalette },
{ &ourCustomNTSCPalette, &ourCustomPALPalette, &ourSECAMPalette }
}};
// See which format we should be using
const ConsoleTiming timing = myOSystem.console().timing();
const PaletteType paletteType = toPaletteType(name);
// Now consider the current display format
const PaletteArray* palette = palettes[paletteType][int(timing)];
// Look at all the palettes, since we don't know which one is
// currently active
static constexpr BSPF::array2D<const PaletteArray*, PaletteType::NumTypes, int(ConsoleTiming::numTimings)> palettes = {{
{ &ourNTSCPalette, &ourPALPalette, &ourSECAMPalette },
{ &ourNTSCPaletteZ26, &ourPALPaletteZ26, &ourSECAMPaletteZ26 },
{ &ourUserNTSCPalette, &ourUserPALPalette, &ourUserSECAMPalette },
{ &ourCustomNTSCPalette, &ourCustomPALPalette, &ourSECAMPalette }
}};
// See which format we should be using
const ConsoleTiming timing = myOSystem.console().timing();
const PaletteType paletteType = toPaletteType(name);
// Now consider the current display format
const PaletteArray* palette = palettes[paletteType][int(timing)];
if(paletteType == PaletteType::Custom)
generateCustomPalette(timing);
if(paletteType == PaletteType::Custom)
generateCustomPalette(timing);
myOSystem.frameBuffer().setTIAPalette(adjustPalette(*palette));
myOSystem.frameBuffer().setTIAPalette(adjustedPalette(*palette));
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PaletteArray PaletteHandler::adjustPalette(const PaletteArray& palette)
PaletteArray PaletteHandler::adjustedPalette(const PaletteArray& palette)
{
PaletteArray destPalette;
// Constants for saturation and gray scale calculation
@ -387,15 +383,15 @@ void PaletteHandler::generateCustomPalette(ConsoleTiming timing)
{
constexpr int NUM_CHROMA = 16;
constexpr int NUM_LUMA = 8;
constexpr float SATURATION = 0.25F;
constexpr float SATURATION = 0.25F; // default saturation
float color[NUM_CHROMA][2] = {{0.0F}};
if(timing == ConsoleTiming::ntsc)
{
// YIQ is YUV shifted by 33°
constexpr float offset = 33 * (2 * BSPF::PI_f / 360);
const float shift = myPhaseNTSC * (2 * BSPF::PI_f / 360);
constexpr float offset = 33 * BSPF::PI_f / 180;
const float shift = myPhaseNTSC * BSPF::PI_f / 180;
// color 0 is grayscale
for(int chroma = 1; chroma < NUM_CHROMA; chroma++)
@ -425,13 +421,9 @@ void PaletteHandler::generateCustomPalette(ConsoleTiming timing)
G = powf(G, 0.9F);
B = powf(B, 0.9F);
if(R > 1) R = 1;
if(G > 1) G = 1;
if(B > 1) B = 1;
int r = R * 255.F;
int g = G * 255.F;
int b = B * 255.F;
int r = BSPF::clamp(R * 255.F, 0.F, 255.F);
int g = BSPF::clamp(G * 255.F, 0.F, 255.F);
int b = BSPF::clamp(B * 255.F, 0.F, 255.F);
ourCustomNTSCPalette[(chroma * NUM_LUMA + luma) << 1] = (r << 16) + (g << 8) + b;
}
@ -439,9 +431,9 @@ void PaletteHandler::generateCustomPalette(ConsoleTiming timing)
}
else if(timing == ConsoleTiming::pal)
{
constexpr float offset = 180 * (2 * BSPF::PI_f / 360);
const float shift = myPhasePAL * (2 * BSPF::PI_f / 360);
constexpr float fixedShift = 22.5F * (2 * BSPF::PI_f / 360);
constexpr float offset = BSPF::PI_f;
const float shift = myPhasePAL * BSPF::PI_f / 180;
constexpr float fixedShift = 22.5F * BSPF::PI_f / 180;
// colors 0, 1, 14 and 15 are grayscale
for(int chroma = 2; chroma < NUM_CHROMA - 2; chroma++)
@ -470,7 +462,7 @@ void PaletteHandler::generateCustomPalette(ConsoleTiming timing)
// German Wikipedia, huh???
//float B = Y + 1 / 0.493 * U;
//float R = Y + 1 / 0.877 * V;
//float G = 1.704 * Y - 0.590 * R - 0.194 * B;
//float G = 1.704 * Y - 0.590 * R - 0.194 * B;
if(R < 0) R = 0.0;
if(G < 0) G = 0.0;
@ -480,13 +472,9 @@ void PaletteHandler::generateCustomPalette(ConsoleTiming timing)
G = powf(G, 1.2F);
B = powf(B, 1.2F);
if(R > 1) R = 1;
if(G > 1) G = 1;
if(B > 1) B = 1;
int r = R * 255.F;
int g = G * 255.F;
int b = B * 255.F;
int r = BSPF::clamp(R * 255.F, 0.F, 255.F);
int g = BSPF::clamp(G * 255.F, 0.F, 255.F);
int b = BSPF::clamp(B * 255.F, 0.F, 255.F);
ourCustomPALPalette[(chroma * NUM_LUMA + luma) << 1] = (r << 16) + (g << 8) + b;
}

View File

@ -25,22 +25,18 @@
class PaletteHandler
{
public:
// Setting names of palette types
static constexpr const char* SETTING_STANDARD = "standard";
static constexpr const char* SETTING_Z26 = "z26";
static constexpr const char* SETTING_USER = "user";
static constexpr const char* SETTING_CUSTOM = "custom";
// Phase shift default and limits
static constexpr float DEF_NTSC_SHIFT = 26.2F;
static constexpr float DEF_PAL_SHIFT = 31.3F; // 360 / 11.5
static constexpr float DEF_PAL_SHIFT = 31.3F; // ~= 360 / 11.5
static constexpr float MAX_SHIFT = 4.5F;
enum DisplayType {
NTSC,
PAL,
SECAM,
NumDisplayTypes
};
// Externally used adjustment parameters
struct Adjustable {
float phaseNtsc, phasePal;
uInt32 hue, saturation, contrast, brightness, gamma;
@ -51,28 +47,38 @@ class PaletteHandler
virtual ~PaletteHandler() = default;
/**
Switch between the available palettes.
*/
void changePalette(bool increase = true);
Cycle through available palettes.
void selectAdjustable(bool next = true);
@param next Select next palette, else previous one
*/
void cyclePalette(bool next = true);
/*
Cycle through each palette adjustable
@param next Select next adjustable, else previous one
*/
void cycleAdjustable(bool next = true);
/*
Increase or decrease current palette adjustable
@param increase Increase adjustable if true, else decrease
*/
void changeAdjustable(bool increase = true);
// Load adjustables from settings
void loadConfig(const Settings& settings);
// Save adjustables to settings
void saveConfig(Settings& settings) const;
// Set adjustables
void setAdjustables(const Adjustable& adjustable);
// Retrieve current adjustables
void getAdjustables(Adjustable& adjustable) const;
/**
Change the "phase shift" variable.
Note that there are two of these (NTSC and PAL). The currently
active mode will determine which one is used.
@param increase increase if true, else decrease.
*/
void changeColorPhaseShift(bool increase = true);
/**
Sets the palette according to the given palette name.
@ -80,18 +86,14 @@ class PaletteHandler
*/
void setPalette(const string& name);
/**
Sets the palette from current settings.
*/
void setPalette();
/**
Generates a custom palette, based on user defined phase shifts.
*/
void generateCustomPalette(ConsoleTiming timing);
private:
static constexpr char DEGREE = 0x1c;
enum PaletteType {
Standard,
Z26,
@ -102,14 +104,64 @@ class PaletteHandler
MaxType = Custom
};
/**
Convert adjustables from/to 100% scale
*/
float scaleFrom100(float x) const { return (x / 50.F) - 1.F; }
uInt32 scaleTo100(float x) const { return uInt32(50 * (x + 1.F)); }
/**
Convert palette settings name to enumeration
@param name The given palette's settings name
@return The palette type
*/
PaletteType toPaletteType(const string& name) const;
/**
Convert enumeration to palette settings name
@param type The given palette type
@return The palette's settings name
*/
string toPaletteName(PaletteType type) const;
PaletteArray adjustPalette(const PaletteArray& source);
/**
Change the "phase shift" variable.
Note that there are two of these (NTSC and PAL). The currently
active mode will determine which one is used.
@param increase Increase if true, else decrease.
*/
void changeColorPhaseShift(bool increase = true);
/**
Generates a custom palette, based on user defined phase shifts.
@param timing Use NTSC or PAL phase shift and generate according palette
*/
void generateCustomPalette(ConsoleTiming timing);
/**
Create new palette by applying palette adjustments on given palette
@param type The palette which should be adjusted
@return An adjusted palette
*/
PaletteArray adjustedPalette(const PaletteArray& source);
/**
Adjust hue and saturation for given RGB values
@param R The red value to adjust
@param G The green value to adjust
@param B The blue value to adjust
@param H The hue adjustment value
@param S The saturation
*/
void adjustHueSaturation(int& R, int& G, int& B, float H, float S);
/**
@ -118,15 +170,16 @@ class PaletteHandler
*/
void loadUserPalette();
private:
static constexpr int NUM_ADJUSTABLES = 6;
OSystem& myOSystem;
// The currently selected adjustable
uInt32 myCurrentAdjustable{0};
struct AdjustableTag {
const char* const type{nullptr};
const char* const name{nullptr};
float* value{nullptr};
};
const std::array<AdjustableTag, NUM_ADJUSTABLES> myAdjustables =
@ -139,8 +192,9 @@ class PaletteHandler
{ "gamma", &myGamma },
} };
float myPhaseNTSC{0.0F};
float myPhasePAL{0.0F};
// NTSC and PAL color phase shifts
float myPhaseNTSC{DEF_NTSC_SHIFT};
float myPhasePAL{DEF_PAL_SHIFT};
// range -1.0 to +1.0 (as in AtariNTSC)
// Basic parameters
float myHue{0.0F}; // -1 = -180 degrees +1 = +180 degrees
@ -169,7 +223,7 @@ class PaletteHandler
static PaletteArray ourUserPALPalette;
static PaletteArray ourUserSECAMPalette;
// Table of RGB values for NTSC, PAL - custom-defined
// Table of RGB values for NTSC, PAL - custom-defined and generated
static PaletteArray ourCustomNTSCPalette;
static PaletteArray ourCustomPALPalette;

View File

@ -74,8 +74,8 @@ string NTSCFilter::getPreset() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string NTSCFilter::setNextAdjustable()
{
if(myPreset != Preset::CUSTOM)
return "'Custom' TV mode not selected";
//if(myPreset != Preset::CUSTOM)
// return "'Custom' TV mode not selected";
#ifdef BLARGG_PALETTE
myCurrentAdjustable = (myCurrentAdjustable + 1) % 10;
@ -85,7 +85,8 @@ string NTSCFilter::setNextAdjustable()
ostringstream buf;
buf << "Custom adjustable '" << ourCustomAdjustables[myCurrentAdjustable].type
<< "' selected";
<< "' selected ("
<< scaleTo100(*ourCustomAdjustables[myCurrentAdjustable].value) << "%)";
return buf.str();
}
@ -93,8 +94,8 @@ string NTSCFilter::setNextAdjustable()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string NTSCFilter::setPreviousAdjustable()
{
if(myPreset != Preset::CUSTOM)
return "'Custom' TV mode not selected";
//if(myPreset != Preset::CUSTOM)
// return "'Custom' TV mode not selected";
#ifdef BLARGG_PALETTE
if(myCurrentAdjustable == 0) myCurrentAdjustable = 9;
@ -104,7 +105,8 @@ string NTSCFilter::setPreviousAdjustable()
else --myCurrentAdjustable;
ostringstream buf;
buf << "Custom adjustable '" << ourCustomAdjustables[myCurrentAdjustable].type
<< "' selected";
<< "' selected ("
<< scaleTo100(*ourCustomAdjustables[myCurrentAdjustable].value) << "%)";
return buf.str();
}
@ -112,8 +114,8 @@ string NTSCFilter::setPreviousAdjustable()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string NTSCFilter::increaseAdjustable()
{
if(myPreset != Preset::CUSTOM)
return "'Custom' TV mode not selected";
//if(myPreset != Preset::CUSTOM)
// return "'Custom' TV mode not selected";
uInt32 newval = scaleTo100(*ourCustomAdjustables[myCurrentAdjustable].value);
newval += 2; if(newval > 100) newval = 100;
@ -121,7 +123,7 @@ string NTSCFilter::increaseAdjustable()
ostringstream buf;
buf << "Custom '" << ourCustomAdjustables[myCurrentAdjustable].type
<< "' set to " << newval;
<< "' set to " << newval << "%";
setPreset(myPreset);
return buf.str();
@ -130,8 +132,8 @@ string NTSCFilter::increaseAdjustable()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string NTSCFilter::decreaseAdjustable()
{
if(myPreset != Preset::CUSTOM)
return "'Custom' TV mode not selected";
//if(myPreset != Preset::CUSTOM)
// return "'Custom' TV mode not selected";
uInt32 newval = scaleTo100(*ourCustomAdjustables[myCurrentAdjustable].value);
if(newval < 2) newval = 0;
@ -140,7 +142,7 @@ string NTSCFilter::decreaseAdjustable()
ostringstream buf;
buf << "Custom '" << ourCustomAdjustables[myCurrentAdjustable].type
<< "' set to " << newval;
<< "' set to " << newval << "%";
setPreset(myPreset);
return buf.str();

View File

@ -101,7 +101,6 @@ class Event
RewindPause, UnwindPause,
FormatDecrease, FormatIncrease, PaletteDecrease, PaletteIncrease, ToggleColorLoss,
ColorShiftDecrease, ColorShiftIncrease,
PreviousPaletteAttribute, NextPaletteAttribute,
PaletteAttributeDecrease, PaletteAttributeIncrease,
ToggleFullScreen, VidmodeDecrease, VidmodeIncrease,

View File

@ -437,11 +437,11 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::PreviousPaletteAttribute:
if (pressed) myOSystem.frameBuffer().tiaSurface().paletteHandler().selectAdjustable(false);
if (pressed) myOSystem.frameBuffer().tiaSurface().paletteHandler().cycleAdjustable(false);
return;
case Event::NextPaletteAttribute:
if (pressed) myOSystem.frameBuffer().tiaSurface().paletteHandler().selectAdjustable(true);
if (pressed) myOSystem.frameBuffer().tiaSurface().paletteHandler().cycleAdjustable(true);
return;
case Event::PaletteAttributeDecrease:
@ -452,14 +452,6 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
if (pressed) myOSystem.frameBuffer().tiaSurface().paletteHandler().changeAdjustable(true);
return;
case Event::ColorShiftDecrease:
if (pressed) myOSystem.frameBuffer().tiaSurface().paletteHandler().changeColorPhaseShift(false);
return;
case Event::ColorShiftIncrease:
if (pressed) myOSystem.frameBuffer().tiaSurface().paletteHandler().changeColorPhaseShift(true);
return;
case Event::ToggleFullScreen:
if (pressed && !repeated) myOSystem.frameBuffer().toggleFullscreen();
return;
@ -565,11 +557,11 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
return;
case Event::PaletteDecrease:
if (pressed && !repeated) myOSystem.frameBuffer().tiaSurface().paletteHandler().changePalette(false);
if (pressed && !repeated) myOSystem.frameBuffer().tiaSurface().paletteHandler().cyclePalette(false);
return;
case Event::PaletteIncrease:
if (pressed && !repeated) myOSystem.frameBuffer().tiaSurface().paletteHandler().changePalette(true);
if (pressed && !repeated) myOSystem.frameBuffer().tiaSurface().paletteHandler().cyclePalette(true);
return;
case Event::ToggleInter:
@ -1965,8 +1957,6 @@ EventHandler::EmulActionList EventHandler::ourEmulActionList = { {
{ Event::NextPaletteAttribute, "Select next palette attribute", "" },
{ Event::PaletteAttributeDecrease,"Decrease selected palette attribute", "" },
{ Event::PaletteAttributeIncrease,"Increase selected palette attribute", "" },
{ Event::ColorShiftDecrease, "Decrease custom palette phase shift", "" },
{ Event::ColorShiftIncrease, "Increase custom palette phase shift", "" },
{ Event::ToggleInter, "Toggle display interpolation", "" },
// Blargg TV effects:
{ Event::VidmodeStd, "Disable TV effects", "" },
@ -2097,7 +2087,6 @@ const Event::EventSet EventHandler::AudioVideoEvents = {
Event::ScanlineAdjustDecrease, Event::ScanlineAdjustIncrease,
Event::OverscanDecrease, Event::OverscanIncrease,
Event::PaletteDecrease, Event::PaletteIncrease,
Event::ColorShiftDecrease, Event::ColorShiftIncrease,
Event::PreviousVideoMode, Event::NextVideoMode,
Event::PreviousPaletteAttribute, Event::NextPaletteAttribute,
Event::PaletteAttributeDecrease, Event::PaletteAttributeIncrease,

View File

@ -468,7 +468,7 @@ class EventHandler
#else
PNG_SIZE = 0,
#endif
EMUL_ACTIONLIST_SIZE = 154 + PNG_SIZE + COMBO_SIZE,
EMUL_ACTIONLIST_SIZE = 152 + PNG_SIZE + COMBO_SIZE,
MENU_ACTIONLIST_SIZE = 18
;

View File

@ -21,6 +21,7 @@
#include "Version.hxx"
#include "Logger.hxx"
#include "AudioSettings.hxx"
#include "PaletteHandler.hxx"
#include "Paddles.hxx"
#ifdef DEBUGGER_SUPPORT
@ -45,7 +46,7 @@ Settings::Settings()
setPermanent("center", "true");
setPermanent("windowedpos", Common::Point(50, 50));
setPermanent("display", 0);
setPermanent("palette", "standard");
setPermanent("palette", PaletteHandler::SETTING_STANDARD);
setPermanent("uimessages", "true");
// TIA specific options
@ -358,8 +359,11 @@ void Settings::validate()
else if(i > 10) setValue("ssinterval", "10");
s = getString("palette");
if(s != "standard" && s != "z26" && s != "user" && s != "custom")
setValue("palette", "standard");
if(s != PaletteHandler::SETTING_STANDARD
&& s != PaletteHandler::SETTING_Z26
&& s != PaletteHandler::SETTING_USER
&& s != PaletteHandler::SETTING_CUSTOM)
setValue("palette", PaletteHandler::SETTING_STANDARD);
s = getString("launcherfont");
if(s != "small" && s != "low_medium" && s != "medium" && s != "large"

View File

@ -204,7 +204,7 @@ void CommandDialog::handleCommand(CommandSender* sender, int cmd,
break;
case kPaletteCmd:
instance().frameBuffer().tiaSurface().paletteHandler().changePalette();
instance().frameBuffer().tiaSurface().paletteHandler().cyclePalette();
updatePalette();
break;
@ -270,11 +270,11 @@ void CommandDialog::updatePalette()
string palette, label;
palette = instance().settings().getString("palette");
if(BSPF::equalsIgnoreCase(palette, "standard"))
if(BSPF::equalsIgnoreCase(palette, PaletteHandler::SETTING_STANDARD))
label = "Stella Palette";
else if(BSPF::equalsIgnoreCase(palette, "z26"))
else if(BSPF::equalsIgnoreCase(palette, PaletteHandler::SETTING_Z26))
label = "Z26 Palette";
else if(BSPF::equalsIgnoreCase(palette, "user"))
else if(BSPF::equalsIgnoreCase(palette, PaletteHandler::SETTING_USER))
label = "User Palette";
else
label = "Custom Palette";

View File

@ -269,11 +269,11 @@ void VideoDialog::addPaletteTab()
// TIA Palette
items.clear();
VarList::push_back(items, "Standard", "standard");
VarList::push_back(items, "z26", "z26");
VarList::push_back(items, "Standard", PaletteHandler::SETTING_STANDARD);
VarList::push_back(items, "z26", PaletteHandler::SETTING_Z26);
if (instance().checkUserPalette())
VarList::push_back(items, "User", "user");
VarList::push_back(items, "Custom", "custom");
VarList::push_back(items, "User", PaletteHandler::SETTING_USER);
VarList::push_back(items, "Custom", PaletteHandler::SETTING_CUSTOM);
myTIAPalette = new PopUpWidget(myTab, _font, xpos, ypos, pwidth,
lineHeight, items, "Palette ", lwidth, kPaletteChanged);
wid.push_back(myTIAPalette);
@ -421,7 +421,7 @@ void VideoDialog::loadConfig()
// TIA Palette
myPalette = instance().settings().getString("palette");
myTIAPalette->setSelected(myPalette, "standard");
myTIAPalette->setSelected(myPalette, PaletteHandler::SETTING_STANDARD);
// Palette adjustables
instance().frameBuffer().tiaSurface().paletteHandler().getAdjustables(myPaletteAdj);
@ -610,7 +610,7 @@ void VideoDialog::setDefaults()
}
case 1: // Palettes
myTIAPalette->setSelected("standard", "");
myTIAPalette->setSelected(PaletteHandler::SETTING_STANDARD);
myPhaseShiftNtsc->setValue(PaletteHandler::DEF_NTSC_SHIFT * 10);
myPhaseShiftPal->setValue(PaletteHandler::DEF_PAL_SHIFT * 10);
myTVHue->setValue(50);