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

View File

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

View File

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