diff --git a/src/libretro/StellaLIBRETRO.cxx b/src/libretro/StellaLIBRETRO.cxx index ac6ea49ac..87dbfaa9f 100644 --- a/src/libretro/StellaLIBRETRO.cxx +++ b/src/libretro/StellaLIBRETRO.cxx @@ -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(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(mode)); + myOSystem->settings().setValue("tv.filter", static_cast(mode)); + myOSystem->frameBuffer().tiaSurface().setNTSC(mode); } } diff --git a/src/libretro/StellaLIBRETRO.hxx b/src/libretro/StellaLIBRETRO.hxx index c57a18344..48e1db9b9 100644 --- a/src/libretro/StellaLIBRETRO.hxx +++ b/src/libretro/StellaLIBRETRO.hxx @@ -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; diff --git a/src/libretro/libretro.cxx b/src/libretro/libretro.cxx index 276368374..490df61c3 100644 --- a/src/libretro/libretro.cxx +++ b/src/libretro/libretro.cxx @@ -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) {