mirror of https://github.com/stella-emu/stella.git
Fixes for warnings in latest g++ and clang, and update libretro port to latest changes.
This commit is contained in:
parent
c078bf135d
commit
5ddaea992d
|
@ -15,6 +15,8 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#include "OSystem.hxx"
|
||||
#include "Console.hxx"
|
||||
#include "EventHandler.hxx"
|
||||
#include "PKeyboardHandler.hxx"
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "Console.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
|
@ -303,7 +304,7 @@ PaletteArray PaletteHandler::adjustedPalette(const PaletteArray& palette)
|
|||
adjust[i] = powf(i * toFloat, gamma) * contrast + brightness;
|
||||
|
||||
// Transform original palette into destination palette
|
||||
for(int i = 0; i < destPalette.size(); i += 2)
|
||||
for(size_t i = 0; i < destPalette.size(); i += 2)
|
||||
{
|
||||
const uInt32 pixel = palette[i];
|
||||
int r = (pixel >> 16) & 0xff;
|
||||
|
@ -396,8 +397,8 @@ void PaletteHandler::generateCustomPalette(ConsoleTiming timing)
|
|||
// color 0 is grayscale
|
||||
for(int chroma = 1; chroma < NUM_CHROMA; chroma++)
|
||||
{
|
||||
color[chroma][0] = SATURATION * sin(offset + shift * (chroma - 1));
|
||||
color[chroma][1] = SATURATION * sin(offset + shift * (chroma - 1 - BSPF::PI_f));
|
||||
color[chroma][0] = SATURATION * sinf(offset + shift * (chroma - 1));
|
||||
color[chroma][1] = SATURATION * sinf(offset + shift * (chroma - 1 - BSPF::PI_f));
|
||||
}
|
||||
|
||||
for(int chroma = 0; chroma < NUM_CHROMA; chroma++)
|
||||
|
@ -488,17 +489,17 @@ void PaletteHandler::adjustHueSaturation(int& R, int& G, int& B, float H, float
|
|||
// Adapted from http://beesbuzz.biz/code/16-hsv-color-transforms
|
||||
// (C) J. “Fluffy” Shagam
|
||||
// License: CC BY-SA 4.0
|
||||
const float su = S * cos(-H * BSPF::PI_f);
|
||||
const float sw = S * sin(-H * BSPF::PI_f);
|
||||
const float r = (.299 + .701 * su + .168 * sw) * R
|
||||
+ (.587 - .587 * su + .330 * sw) * G
|
||||
+ (.114 - .114 * su - .497 * sw) * B;
|
||||
const float g = (.299 - .299 * su - .328 * sw) * R
|
||||
+ (.587 + .413 * su + .035 * sw) * G
|
||||
+ (.114 - .114 * su + .292 * sw) * B;
|
||||
const float b = (.299 - .300 * su + 1.25 * sw) * R
|
||||
+ (.587 - .588 * su - 1.05 * sw) * G
|
||||
+ (.114 + .886 * su - .203 * sw) * B;
|
||||
const float su = S * cosf(-H * BSPF::PI_f);
|
||||
const float sw = S * sinf(-H * BSPF::PI_f);
|
||||
const float r = (.299F + .701F * su + .168F * sw) * R
|
||||
+ (.587F - .587F * su + .330F * sw) * G
|
||||
+ (.114F - .114F * su - .497F * sw) * B;
|
||||
const float g = (.299F - .299F * su - .328F * sw) * R
|
||||
+ (.587F + .413F * su + .035F * sw) * G
|
||||
+ (.114F - .114F * su + .292F * sw) * B;
|
||||
const float b = (.299F - .300F * su + 1.25F * sw) * R
|
||||
+ (.587F - .588F * su - 1.05F * sw) * G
|
||||
+ (.114F + .886F * su - .203F * sw) * B;
|
||||
|
||||
R = BSPF::clamp(r, 0.F, 255.F);
|
||||
G = BSPF::clamp(g, 0.F, 255.F);
|
||||
|
@ -724,14 +725,14 @@ const PaletteArray PaletteHandler::ourSECAMPaletteZ26 = {
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PaletteArray PaletteHandler::ourUserNTSCPalette = { 0 }; // filled from external file
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PaletteArray PaletteHandler::ourUserPALPalette = { 0 }; // filled from external file
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PaletteArray PaletteHandler::ourUserSECAMPalette = { 0 }; // filled from external file
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PaletteArray PaletteHandler::ourCustomNTSCPalette = { 0 }; // filled by function
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
PaletteArray PaletteHandler::ourCustomPALPalette = { 0 }; // filled by function
|
||||
|
|
|
@ -38,8 +38,8 @@ class PaletteHandler
|
|||
|
||||
// Externally used adjustment parameters
|
||||
struct Adjustable {
|
||||
float phaseNtsc, phasePal;
|
||||
uInt32 hue, saturation, contrast, brightness, gamma;
|
||||
float phaseNtsc{0.F}, phasePal{0.F};
|
||||
uInt32 hue{0}, saturation{0}, contrast{0}, brightness{0}, gamma{0};
|
||||
};
|
||||
|
||||
public:
|
||||
|
@ -54,14 +54,14 @@ class PaletteHandler
|
|||
void cyclePalette(bool next = true);
|
||||
|
||||
/*
|
||||
Cycle through each palette adjustable
|
||||
Cycle through each palette adjustable.
|
||||
|
||||
@param next Select next adjustable, else previous one
|
||||
*/
|
||||
void cycleAdjustable(bool next = true);
|
||||
|
||||
/*
|
||||
Increase or decrease current palette adjustable
|
||||
Increase or decrease current palette adjustable.
|
||||
|
||||
@param increase Increase adjustable if true, else decrease
|
||||
*/
|
||||
|
@ -82,7 +82,7 @@ class PaletteHandler
|
|||
/**
|
||||
Sets the palette according to the given palette name.
|
||||
|
||||
@param palette The palette to switch to.
|
||||
@param name The palette to switch to
|
||||
*/
|
||||
void setPalette(const string& name);
|
||||
|
||||
|
@ -107,11 +107,11 @@ class PaletteHandler
|
|||
/**
|
||||
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)); }
|
||||
constexpr float scaleFrom100(float x) const { return (x / 50.F) - 1.F; }
|
||||
constexpr uInt32 scaleTo100(float x) const { return uInt32(50 * (x + 1.F)); }
|
||||
|
||||
/**
|
||||
Convert palette settings name to enumeration
|
||||
Convert palette settings name to enumeration.
|
||||
|
||||
@param name The given palette's settings name
|
||||
|
||||
|
@ -120,7 +120,7 @@ class PaletteHandler
|
|||
PaletteType toPaletteType(const string& name) const;
|
||||
|
||||
/**
|
||||
Convert enumeration to palette settings name
|
||||
Convert enumeration to palette settings name.
|
||||
|
||||
@param type The given palette type
|
||||
|
||||
|
@ -133,7 +133,7 @@ class PaletteHandler
|
|||
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.
|
||||
@param increase Increase if true, else decrease
|
||||
*/
|
||||
void changeColorPhaseShift(bool increase = true);
|
||||
|
||||
|
@ -145,16 +145,16 @@ class PaletteHandler
|
|||
void generateCustomPalette(ConsoleTiming timing);
|
||||
|
||||
/**
|
||||
Create new palette by applying palette adjustments on given palette
|
||||
Create new palette by applying palette adjustments on given palette.
|
||||
|
||||
@param type The palette which should be adjusted
|
||||
@param source The palette which should be adjusted
|
||||
|
||||
@return An adjusted palette
|
||||
*/
|
||||
PaletteArray adjustedPalette(const PaletteArray& source);
|
||||
|
||||
/**
|
||||
Adjust hue and saturation for given RGB values
|
||||
Adjust hue and saturation for given RGB values.
|
||||
|
||||
@param R The red value to adjust
|
||||
@param G The green value to adjust
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
//============================================================================
|
||||
|
||||
#include "CartAR.hxx"
|
||||
#include "Debugger.hxx"
|
||||
#include "CartDebug.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "CartARWidget.hxx"
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ string CartridgeE0Widget::romDescription()
|
|||
|
||||
info << "Segment #" << seg << " accessible @ $"
|
||||
<< Common::Base::HEX4 << (ADDR_BASE | segmentOffset)
|
||||
<< " - $" << (ADDR_BASE | segmentOffset + /*myCart.myBankSize - 1*/ 0x3FF) << ",\n";
|
||||
<< " - $" << (ADDR_BASE | (segmentOffset + /*myCart.myBankSize - 1*/ 0x3FF)) << ",\n";
|
||||
if (seg < 3)
|
||||
info << " Hotspots " << hotspotStr(0, seg, true) << " - " << hotspotStr(7, seg, true) << "\n";
|
||||
else
|
||||
|
|
|
@ -33,7 +33,6 @@ class TiaOutputWidget;
|
|||
class TiaZoomWidget;
|
||||
class CartDebugWidget;
|
||||
class CartRamWidget;
|
||||
class OptionsDialog;
|
||||
|
||||
namespace Common {
|
||||
struct Rect;
|
||||
|
@ -41,6 +40,7 @@ namespace Common {
|
|||
|
||||
#include "Dialog.hxx"
|
||||
#include "MessageBox.hxx"
|
||||
#include "OptionsDialog.hxx"
|
||||
|
||||
class DebuggerDialog : public Dialog
|
||||
{
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//============================================================================
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "Control.hxx"
|
||||
#include "Event.hxx"
|
||||
#include "System.hxx"
|
||||
|
|
|
@ -22,13 +22,13 @@ class TIA;
|
|||
class Console;
|
||||
class OSystem;
|
||||
class FBSurface;
|
||||
class PaletteHandler;
|
||||
|
||||
#include <thread>
|
||||
|
||||
#include "Rect.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
#include "NTSCFilter.hxx"
|
||||
#include "PaletteHandler.hxx"
|
||||
#include "PhosphorHandler.hxx"
|
||||
#include "bspf.hxx"
|
||||
#include "TIAConstants.hxx"
|
||||
|
|
|
@ -108,6 +108,7 @@ void Thumbulator::setConsoleTiming(ConsoleTiming timing)
|
|||
case ConsoleTiming::ntsc: timing_factor = NTSC; break;
|
||||
case ConsoleTiming::secam: timing_factor = SECAM; break;
|
||||
case ConsoleTiming::pal: timing_factor = PAL; break;
|
||||
default: break; // satisfy compiler
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ ColorWidget::ColorWidget(GuiObject* boss, const GUI::Font& font,
|
|||
int x, int y, int w, int h, int cmd, bool framed)
|
||||
: Widget(boss, font, x, y, w, h),
|
||||
CommandSender(boss),
|
||||
_cmd(cmd),
|
||||
_framed(framed)
|
||||
_framed(framed),
|
||||
_cmd(cmd)
|
||||
{
|
||||
_flags = Widget::FLAG_ENABLED | Widget::FLAG_CLEARBG | Widget::FLAG_RETAIN_FOCUS;
|
||||
}
|
||||
|
|
|
@ -384,4 +384,3 @@ void DialogContainer::reset()
|
|||
uInt64 DialogContainer::_DOUBLE_CLICK_DELAY = 500;
|
||||
uInt64 DialogContainer::_REPEAT_INITIAL_DELAY = 400;
|
||||
uInt64 DialogContainer::_REPEAT_SUSTAIN_DELAY = 50;
|
||||
|
||||
|
|
|
@ -280,4 +280,4 @@ void EmulationDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
Dialog::handleCommand(sender, cmd, data, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,8 +112,7 @@ void VideoAudioDialog::addDisplayTab()
|
|||
{
|
||||
const int lineHeight = _font.getLineHeight(),
|
||||
fontHeight = _font.getFontHeight(),
|
||||
fontWidth = _font.getMaxCharWidth(),
|
||||
buttonHeight = _font.getLineHeight() * 1.25;
|
||||
fontWidth = _font.getMaxCharWidth();
|
||||
const int VGAP = fontHeight / 4;
|
||||
const int VBORDER = fontHeight / 2;
|
||||
const int HBORDER = fontWidth * 1.25;
|
||||
|
@ -186,8 +185,7 @@ void VideoAudioDialog::addPaletteTab()
|
|||
{
|
||||
const int lineHeight = _font.getLineHeight(),
|
||||
fontHeight = _font.getFontHeight(),
|
||||
fontWidth = _font.getMaxCharWidth(),
|
||||
buttonHeight = _font.getLineHeight() * 1.25;
|
||||
fontWidth = _font.getMaxCharWidth();
|
||||
const int VBORDER = fontHeight / 2;
|
||||
const int HBORDER = fontWidth * 1.25;
|
||||
const int INDENT = fontWidth * 2;
|
||||
|
|
|
@ -110,7 +110,7 @@ class VideoAudioDialog : public Dialog
|
|||
SliderWidget* myTVContrast{nullptr};
|
||||
SliderWidget* myTVGamma{nullptr};
|
||||
std::array<StaticTextWidget*, 16> myColorLbl{nullptr};
|
||||
ColorWidget* myColor[16][8]{nullptr};
|
||||
ColorWidget* myColor[16][8]{{nullptr}};
|
||||
|
||||
// Audio
|
||||
CheckboxWidget* mySoundEnableCheckbox{nullptr};
|
||||
|
@ -125,7 +125,7 @@ class VideoAudioDialog : public Dialog
|
|||
SliderWidget* myDpcPitch{nullptr};
|
||||
|
||||
string myPalette;
|
||||
PaletteHandler::Adjustable myPaletteAdj{0.0F};
|
||||
PaletteHandler::Adjustable myPaletteAdj;
|
||||
|
||||
enum {
|
||||
kZoomChanged = 'VDZo',
|
||||
|
|
|
@ -23,6 +23,7 @@ SOURCES_CXX := \
|
|||
$(CORE_DIR)/common/KeyMap.cxx \
|
||||
$(CORE_DIR)/common/Logger.cxx \
|
||||
$(CORE_DIR)/common/MouseControl.cxx \
|
||||
$(CORE_DIR)/common/PaletteHandler.cxx \
|
||||
$(CORE_DIR)/common/PhosphorHandler.cxx \
|
||||
$(CORE_DIR)/common/PhysicalJoystick.cxx \
|
||||
$(CORE_DIR)/common/PJoystickHandler.cxx \
|
||||
|
|
|
@ -40,7 +40,7 @@ StellaLIBRETRO::StellaLIBRETRO()
|
|||
video_aspect_ntsc = 0;
|
||||
video_aspect_pal = 0;
|
||||
|
||||
video_palette = "standard";
|
||||
video_palette = PaletteHandler::SETTING_STANDARD;
|
||||
video_filter = NTSCFilter::Preset::OFF;
|
||||
video_ready = false;
|
||||
|
||||
|
@ -374,19 +374,12 @@ void StellaLIBRETRO::setVideoFilter(NTSCFilter::Preset mode)
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void StellaLIBRETRO::setVideoPalette(uInt32 mode)
|
||||
void StellaLIBRETRO::setVideoPalette(const string& mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case 0: video_palette = "standard"; break;
|
||||
case 1: video_palette = "z26"; break;
|
||||
case 2: video_palette = "user"; break;
|
||||
}
|
||||
|
||||
if (system_ready)
|
||||
{
|
||||
myOSystem->settings().setValue("palette", video_palette);
|
||||
myOSystem->console().setPalette(video_palette);
|
||||
myOSystem->frameBuffer().tiaSurface().paletteHandler().setPalette(video_palette);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ class StellaLIBRETRO
|
|||
void setVideoAspectPAL(uInt32 value) { video_aspect_pal = value; };
|
||||
|
||||
void setVideoFilter(NTSCFilter::Preset mode);
|
||||
void setVideoPalette(uInt32 mode);
|
||||
void setVideoPalette(const string& mode);
|
||||
void setVideoPhosphor(uInt32 mode, uInt32 blend);
|
||||
|
||||
void setAudioStereo(int mode);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "StellaLIBRETRO.hxx"
|
||||
#include "Event.hxx"
|
||||
#include "NTSCFilter.hxx"
|
||||
#include "PaletteHandler.hxx"
|
||||
#include "Version.hxx"
|
||||
|
||||
|
||||
|
@ -30,11 +31,12 @@ static retro_audio_sample_batch_t audio_batch_cb;
|
|||
|
||||
// libretro UI settings
|
||||
static int setting_ntsc, setting_pal;
|
||||
static int setting_stereo, setting_palette;
|
||||
static int setting_stereo;
|
||||
static int setting_phosphor, setting_console, setting_phosphor_blend;
|
||||
static int stella_paddle_joypad_sensitivity;
|
||||
static int setting_crop_hoverscan, crop_left;
|
||||
static NTSCFilter::Preset setting_filter;
|
||||
static const char* setting_palette;
|
||||
|
||||
static bool system_reset;
|
||||
|
||||
|
@ -275,17 +277,11 @@ static void update_variables(bool init = false)
|
|||
|
||||
RETRO_GET("stella_palette")
|
||||
{
|
||||
int value = 0;
|
||||
|
||||
if(!strcmp(var.value, "standard")) value = 0;
|
||||
else if(!strcmp(var.value, "z26")) value = 1;
|
||||
else if(!strcmp(var.value, "user")) value = 2;
|
||||
|
||||
if(setting_palette != value)
|
||||
if(setting_palette != var.value)
|
||||
{
|
||||
stella.setVideoPalette(value);
|
||||
stella.setVideoPalette(var.value);
|
||||
|
||||
setting_palette = value;
|
||||
setting_palette = var.value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -494,7 +490,7 @@ void retro_set_environment(retro_environment_t cb)
|
|||
static struct retro_variable variables[] = {
|
||||
// Adding more variables and rearranging them is safe.
|
||||
{ "stella_console", "Console display; auto|ntsc|pal|secam|ntsc50|pal60|secam60" },
|
||||
{ "stella_palette", "Palette colors; standard|z26|user" },
|
||||
{ "stella_palette", "Palette colors; standard|z26|user|custom" },
|
||||
{ "stella_filter", "TV effects; disabled|composite|s-video|rgb|badly adjusted" },
|
||||
{ "stella_ntsc_aspect", "NTSC aspect %; par|100|101|102|103|104|105|106|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|50|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99" },
|
||||
{ "stella_pal_aspect", "PAL aspect %; par|100|101|102|103|104|105|106|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|50|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99" },
|
||||
|
|
Loading…
Reference in New Issue