libretro: TV effects setting wasn't loading proper effect.

Note: raw ints are bad, enums are good.  Whenever Stella uses enums, libretro should use them too.
This commit is contained in:
Stephen Anthony 2019-06-29 23:35:10 -02:30
parent fe464c2521
commit 8e425e7297
3 changed files with 46 additions and 44 deletions

View File

@ -41,7 +41,7 @@ StellaLIBRETRO::StellaLIBRETRO()
video_aspect_pal = 0;
video_palette = "standard";
video_filter = 0;
video_filter = NTSCFilter::Preset::OFF;
video_ready = false;
audio_samples = 0;
@ -92,7 +92,7 @@ bool StellaLIBRETRO::create(bool logging)
//fastscbios
// Fast loading of Supercharger BIOS
settings.setValue("tv.filter", video_filter);
settings.setValue("tv.filter", static_cast<int>(video_filter));
settings.setValue("tv.phosphor", video_phosphor);
settings.setValue("tv.phosblend", video_phosphor_blend);
@ -250,39 +250,39 @@ float StellaLIBRETRO::getVideoAspectPar()
if (getVideoNTSC())
{
if (!video_aspect_ntsc)
{
if (!video_filter)
{
// non-interlace square pixel clock -- 1.0 pixel @ color burst -- double-width pixels
par = (6.1363635f / 3.579545454f) / 2.0;
}
else
{
// blargg filter
par = 1.0;
}
}
else
par = video_aspect_ntsc / 100.0;
if (!video_aspect_ntsc)
{
if (video_filter != NTSCFilter::Preset::OFF)
{
// non-interlace square pixel clock -- 1.0 pixel @ color burst -- double-width pixels
par = (6.1363635f / 3.579545454f) / 2.0;
}
else
{
// blargg filter
par = 1.0;
}
}
else
par = video_aspect_ntsc / 100.0;
}
else
{
if (!video_aspect_pal)
{
if (!video_filter)
{
// non-interlace square pixel clock -- 0.8 pixel @ color burst -- double-width pixels
par = (7.3750000f / (4.43361875f * 4.0f / 5.0f)) / 2.0f;
}
else
{
// blargg filter
par = 1.0;
}
}
else
par = video_aspect_pal / 100.0;
if (!video_aspect_pal)
{
if (video_filter != NTSCFilter::Preset::OFF)
{
// non-interlace square pixel clock -- 0.8 pixel @ color burst -- double-width pixels
par = (7.3750000f / (4.43361875f * 4.0f / 5.0f)) / 2.0f;
}
else
{
// blargg filter
par = 1.0;
}
}
else
par = video_aspect_pal / 100.0;
}
return par;
@ -357,14 +357,14 @@ void StellaLIBRETRO::setConsoleFormat(uInt32 mode)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaLIBRETRO::setVideoFilter(uInt32 mode)
void StellaLIBRETRO::setVideoFilter(NTSCFilter::Preset mode)
{
video_filter = mode;
if (system_ready)
{
myOSystem->settings().setValue("tv.filter", mode);
myOSystem->frameBuffer().tiaSurface().setNTSC(static_cast<NTSCFilter::Preset>(mode));
myOSystem->settings().setValue("tv.filter", static_cast<int>(mode));
myOSystem->frameBuffer().tiaSurface().setNTSC(mode);
}
}

View File

@ -103,7 +103,7 @@ class StellaLIBRETRO
void setVideoAspectNTSC(uInt32 value) { video_aspect_ntsc = value; };
void setVideoAspectPAL(uInt32 value) { video_aspect_pal = value; };
void setVideoFilter(uInt32 mode);
void setVideoFilter(NTSCFilter::Preset mode);
void setVideoPalette(uInt32 mode);
void setVideoPhosphor(uInt32 mode, uInt32 blend);
@ -162,7 +162,7 @@ class StellaLIBRETRO
uInt32 video_aspect_ntsc;
uInt32 video_aspect_pal;
uInt32 video_filter;
NTSCFilter::Preset video_filter;
string audio_mode;

View File

@ -14,6 +14,7 @@
#include "StellaLIBRETRO.hxx"
#include "Event.hxx"
#include "NTSCFilter.hxx"
#include "Version.hxx"
@ -29,10 +30,11 @@ static retro_audio_sample_batch_t audio_batch_cb;
// libretro UI settings
static int setting_ntsc, setting_pal;
static int setting_stereo, setting_filter, setting_palette;
static int setting_stereo, setting_palette;
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 bool system_reset;
@ -215,13 +217,13 @@ static void update_variables(bool init = false)
RETRO_GET("stella_filter")
{
int value = 0;
NTSCFilter::Preset value = NTSCFilter::Preset::OFF;
if(!strcmp(var.value, "disabled")) value = 0;
else if(!strcmp(var.value, "composite")) value = 1;
else if(!strcmp(var.value, "s-video")) value = 2;
else if(!strcmp(var.value, "rgb")) value = 3;
else if(!strcmp(var.value, "badly adjusted")) value = 4;
if(!strcmp(var.value, "disabled")) value = NTSCFilter::Preset::OFF;
else if(!strcmp(var.value, "composite")) value = NTSCFilter::Preset::COMPOSITE;
else if(!strcmp(var.value, "s-video")) value = NTSCFilter::Preset::SVIDEO;
else if(!strcmp(var.value, "rgb")) value = NTSCFilter::Preset::RGB;
else if(!strcmp(var.value, "badly adjusted")) value = NTSCFilter::Preset::BAD;
if(setting_filter != value)
{