From d1bab4ef09cd1e4b7e763284961ecc253dd51605 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Sat, 20 Feb 2010 03:33:26 +0000 Subject: [PATCH] GTK: added PAL option SDL: fixed PAL sf2842769 --- src/drivers/sdl/gui.cpp | 28 ++++++++++++++++++++++++++++ src/drivers/sdl/sdl-video.cpp | 10 +++++++++- src/drivers/sdl/sdl.cpp | 16 ++++++++++++++-- 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/drivers/sdl/gui.cpp b/src/drivers/sdl/gui.cpp index ec36a25e..ba8b4101 100644 --- a/src/drivers/sdl/gui.cpp +++ b/src/drivers/sdl/gui.cpp @@ -157,6 +157,21 @@ void setScaler(GtkWidget* w, gpointer p) g_config->setOption("SDL.SpecialFilter", x); } +void setPal(GtkWidget* w, gpointer p) +{ + if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) + { + g_config->setOption("SDL.PAL", 1); + FCEUI_SetVidSystem(1); + } + else + { + g_config->setOption("SDL.PAL", 0); + FCEUI_SetVidSystem(0); + } + return; +} + void setGL(GtkWidget* w, gpointer p) { if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) @@ -174,6 +189,7 @@ void openVideoConfig() GtkWidget* scalerLbl; GtkWidget* scalerCombo; GtkWidget* glChk; + GtkWidget* palChk; win = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(win), "Video Prefernces"); @@ -212,11 +228,23 @@ void openVideoConfig() gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(glChk), 1); else gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(glChk), 0); + + // PAL check + palChk = gtk_check_button_new_with_label("Enable PAL mode"); + g_signal_connect(GTK_OBJECT(palChk), "clicked", G_CALLBACK(setPal), NULL); + + // sync with config + g_config->getOption("SDL.PAL", &buf); + if(buf) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(palChk), 1); + else + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(palChk), 0); gtk_box_pack_start(GTK_BOX(vbox), lbl, FALSE, FALSE, 2); gtk_box_pack_start(GTK_BOX(vbox), hbox1, FALSE, FALSE, 2); gtk_box_pack_start(GTK_BOX(vbox), glChk, FALSE, FALSE, 2); + gtk_box_pack_start(GTK_BOX(vbox), palChk, FALSE, FALSE, 2); gtk_container_add(GTK_CONTAINER(win), vbox); diff --git a/src/drivers/sdl/sdl-video.cpp b/src/drivers/sdl/sdl-video.cpp index 08bdd60e..8953394e 100644 --- a/src/drivers/sdl/sdl-video.cpp +++ b/src/drivers/sdl/sdl-video.cpp @@ -133,7 +133,15 @@ inline double GetYScale(int yres) { return ((double)yres) / s_tlines; } - +void FCEUD_VideoChanged() +{ + int buf; + g_config->getOption("SDL.PAL", &buf); + if(buf) + PAL = 1; + else + PAL = 0; +} /** * Attempts to initialize the graphical video display. Returns 0 on * success, -1 on failure. diff --git a/src/drivers/sdl/sdl.cpp b/src/drivers/sdl/sdl.cpp index 93b42099..fad5ff9e 100644 --- a/src/drivers/sdl/sdl.cpp +++ b/src/drivers/sdl/sdl.cpp @@ -190,6 +190,15 @@ int LoadGame(const char *path) if(!DriverInitialize(GameInfo)) { return(0); } + + // set pal/ntsc + int buf; + g_config->getOption("SDL.PAL", &buf); + if(buf) + FCEUI_SetVidSystem(1); + else + FCEUI_SetVidSystem(0); + g_config->getOption("SDL.SoundRecordFile", &filename); if(filename.size()) { @@ -519,6 +528,7 @@ SDL_GL_LoadLibrary(0); // Initialize the configuration system g_config = InitConfig(); + if(!g_config) { SDL_Quit(); @@ -532,7 +542,7 @@ SDL_GL_LoadLibrary(0); SDL_Quit(); return -1; } - + int romIndex = g_config->parse(argc, argv); //mbg 8/23/2008 - this is also here so that the inputcfg routines can have a chance to dump the new inputcfg to the fceux.cfg @@ -543,11 +553,14 @@ SDL_GL_LoadLibrary(0); g_config->getOption("SDL.NoConfig", &noconfig); if (!noconfig) g_config->save(); + std::string s; g_config->getOption("SDL.InputCfg", &s); // update the input devices UpdateInput(g_config); + + // check for a .fcm file to convert to .fm2 g_config->getOption ("SDL.FCMConvert", &s); @@ -831,7 +844,6 @@ DUMMY(FCEUD_MovieReplayFrom) DUMMY(FCEUD_ToggleStatusIcon) DUMMY(FCEUD_AviRecordTo) DUMMY(FCEUD_AviStop) -DUMMY(FCEUD_VideoChanged); void FCEUI_AviVideoUpdate(const unsigned char* buffer) { } int FCEUD_ShowStatusIcon(void) {return 0;} bool FCEUI_AviIsRecording(void) {return false;}