From 640f292d86dd6d8ac4c952eb07ce9dae106900cd Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Sun, 28 Jun 2015 04:13:54 +0000 Subject: [PATCH] sdl: added support for prescale2x/3x/4x --- trunk/src/drivers/sdl/gui.cpp | 39 ++++++++++++++++++----------- trunk/src/drivers/sdl/sdl-video.cpp | 34 ++++++++++++++----------- trunk/src/drivers/sdl/sdl.cpp | 4 +-- 3 files changed, 46 insertions(+), 31 deletions(-) diff --git a/trunk/src/drivers/sdl/gui.cpp b/trunk/src/drivers/sdl/gui.cpp index 397cd3c4..51dfac2b 100644 --- a/trunk/src/drivers/sdl/gui.cpp +++ b/trunk/src/drivers/sdl/gui.cpp @@ -832,24 +832,31 @@ void resizeGtkWindow() void setScaler(GtkWidget* w, gpointer p) { - int x = gtk_combo_box_get_active(GTK_COMBO_BOX(w)); - g_config->setOption("SDL.SpecialFilter", x); + int scaler = gtk_combo_box_get_active(GTK_COMBO_BOX(w)); + g_config->setOption("SDL.SpecialFilter", scaler); - // 1 - hq2x 2 - Scale2x 3 - NTSC2x 4 - hq3x 5 - Scale3x - if (x >= 1 && x <= 3) + // 1=hq2x 2=Scale2x 3=NTSC2x 4=hq3x 5=Scale3x 6=Prescale2x 7=Prescale3x 8=Prescale4x 9=pal + switch(scaler) { - g_config->setOption("SDL.XScale", 2.0); - g_config->setOption("SDL.YScale", 2.0); - resizeGtkWindow(); - } - if (x >= 4 && x < 6) - { - g_config->setOption("SDL.XScale", 3.0); - g_config->setOption("SDL.YScale", 3.0); - resizeGtkWindow(); + case 4: // hq3x + case 5: // scale3x + case 7: // prescale3x + g_config->setOption("SDL.XScale", 3.0); + g_config->setOption("SDL.YScale", 3.0); + resizeGtkWindow(); + break; + case 8: // prescale4x + g_config->setOption("SDL.XScale", 4.0); + g_config->setOption("SDL.YScale", 4.0); + break; + default: + g_config->setOption("SDL.XScale", 2.0); + g_config->setOption("SDL.YScale", 2.0); + resizeGtkWindow(); + break; } + g_config->save(); - } void setRegion(GtkWidget* w, gpointer p) @@ -949,6 +956,10 @@ void openVideoConfig() gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(scalerCombo), "NTSC 2x"); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(scalerCombo), "hq3x"); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(scalerCombo), "scale3x"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(scalerCombo), "prescale2x"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(scalerCombo), "prescale3x"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(scalerCombo), "prescale4x"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(scalerCombo), "pal"); // sync with cfg int buf; diff --git a/trunk/src/drivers/sdl/sdl-video.cpp b/trunk/src/drivers/sdl/sdl-video.cpp index 88aacd3f..18656827 100644 --- a/trunk/src/drivers/sdl/sdl-video.cpp +++ b/trunk/src/drivers/sdl/sdl-video.cpp @@ -305,18 +305,6 @@ InitVideo(FCEUGI *gi) desbpp = 0; } - // -Video Modes Tag- - if(s_sponge) { - if(s_sponge == 4 || s_sponge == 5) { - s_exs = s_eys = 3; - } else { - s_exs = s_eys = 2; - } - s_eefx = 0; - if(s_sponge == 1 || s_sponge == 4) { - desbpp = 32; - } - } if((s_useOpenGL && !xstretch) || !s_useOpenGL) #endif @@ -357,12 +345,28 @@ InitVideo(FCEUGI *gi) // -Video Modes Tag- if(s_sponge) { - if(s_sponge >= 4) { - s_exs = s_eys = 3; - } else { + if(s_sponge <= 3 && s_sponge >= 1) + { s_exs = s_eys = 2; + } else if (s_sponge >=4 && s_sponge <= 5) + { + s_exs = s_eys = 3; + } else if (s_sponge >= 6 && s_sponge <= 8) + { + s_exs = s_eys = s_sponge - 4; + } + else if(s_sponge == 9) + { + s_exs = s_eys = 3; + } + else + { + s_exs = s_eys = 1; } s_eefx = 0; + if(s_sponge == 1 || s_sponge == 4) { + desbpp = 32; + } } #ifdef OPENGL diff --git a/trunk/src/drivers/sdl/sdl.cpp b/trunk/src/drivers/sdl/sdl.cpp index 1fc28cfd..6211b133 100644 --- a/trunk/src/drivers/sdl/sdl.cpp +++ b/trunk/src/drivers/sdl/sdl.cpp @@ -104,8 +104,8 @@ static const char *DriverUsage= "--fullscreen {0|1} Enable full screen mode.\n" "--noframe {0|1} Hide title bar and window decorations.\n" "--special {1-4} Use special video scaling filters\n" -" (1 = hq2x 2 = Scale2x 3 = NTSC 2x 4 = hq3x\n" -" 5 = Scale3x)\n" +" (1 = hq2x; 2 = Scale2x; 3 = NTSC 2x; 4 = hq3x;\n" +" 5 = Scale3x; 6 = Prescale2x; 7 = Prescale3x; 8=Precale4x; 9=PAL)\n" "--palette f Load custom global palette from file f.\n" "--sound {0|1} Enable sound.\n" "--soundrate x Set sound playback rate to x Hz.\n"