From 4c0b8d9ce895ab1df8754a14f7b2c706d5efcc1e Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Wed, 24 Jun 2015 00:16:57 +0000 Subject: [PATCH] sdl: changed pal checkbox to 'Region' combo including dendy --- trunk/src/drivers/sdl/gui.cpp | 42 ++++++++++++++++++++---------- trunk/src/drivers/sdl/sdl.cpp | 48 ++++++++++++++++++++++------------- trunk/src/drivers/sdl/sdl.h | 1 + 3 files changed, 61 insertions(+), 30 deletions(-) diff --git a/trunk/src/drivers/sdl/gui.cpp b/trunk/src/drivers/sdl/gui.cpp index 42619ec7..22a4af98 100644 --- a/trunk/src/drivers/sdl/gui.cpp +++ b/trunk/src/drivers/sdl/gui.cpp @@ -835,6 +835,15 @@ void setScaler(GtkWidget* w, gpointer p) } +void setRegion(GtkWidget* w, gpointer p) +{ + int region = gtk_combo_box_get_active(GTK_COMBO_BOX(w)); + g_config->setOption("SDL.PAL", region); + SetRegion(region); + + g_config->save(); + +} int setXscale(GtkWidget* w, gpointer p) { @@ -885,7 +894,9 @@ void openVideoConfig() GtkWidget* glChk; GtkWidget* linearChk; GtkWidget* dbChk; - GtkWidget* palChk; + GtkWidget* palHbox; + GtkWidget* palLbl; + GtkWidget* palCombo; GtkWidget* ppuChk; GtkWidget* spriteLimitChk; GtkWidget* frameskipChk; @@ -968,19 +979,24 @@ void openVideoConfig() gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dbChk), 0); #endif - - // PAL check - palChk = gtk_check_button_new_with_label("Enable PAL mode"); - g_signal_connect(palChk, "clicked", G_CALLBACK(toggleOption), (gpointer)"SDL.PAL"); - - // sync with config + // Region (NTSC/PAL/Dendy) + palHbox = gtk_hbox_new(FALSE, 3); + palLbl = gtk_label_new("Region: "); + palCombo = gtk_combo_box_text_new(); + // -Video Modes Tag- + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(palCombo), "NTSC"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(palCombo), "PAL"); + gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(palCombo), "Dendy"); + + // sync with cfg buf = 0; 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_combo_box_set_active(GTK_COMBO_BOX(palCombo), buf); + + g_signal_connect(palCombo, "changed", G_CALLBACK(setRegion), NULL); + gtk_box_pack_start(GTK_BOX(palHbox), palLbl, FALSE, FALSE, 5); + gtk_box_pack_start(GTK_BOX(palHbox), palCombo, FALSE, FALSE, 5); + // New PPU check ppuChk = gtk_check_button_new_with_label("Enable new PPU"); g_signal_connect(ppuChk, "clicked", G_CALLBACK(toggleOption), (gpointer)"SDL.NewPPU"); @@ -1074,7 +1090,7 @@ void openVideoConfig() gtk_box_pack_start(GTK_BOX(vbox), linearChk, FALSE, FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), dbChk, FALSE, FALSE, 5); #endif - gtk_box_pack_start(GTK_BOX(vbox), palChk, FALSE, FALSE,5); + gtk_box_pack_start(GTK_BOX(vbox), palHbox, FALSE, FALSE,5); gtk_box_pack_start(GTK_BOX(vbox), ppuChk, FALSE, FALSE, 5); #ifdef FRAMESKIP gtk_box_pack_start(GTK_BOX(vbox), frameskipChk, FALSE, FALSE, 5); diff --git a/trunk/src/drivers/sdl/sdl.cpp b/trunk/src/drivers/sdl/sdl.cpp index 3985158f..0a51324d 100644 --- a/trunk/src/drivers/sdl/sdl.cpp +++ b/trunk/src/drivers/sdl/sdl.cpp @@ -186,6 +186,36 @@ static void ShowUsage(char *prog) } +/** + * Sets the region emulation mode. + * Region 0: NTSC + * Region 1: PAL + * Region 2: Dendy + */ +void SetRegion(int region) +{ + switch(region) + { + case 0: + pal_emulation = 0; + dendy = 0; + FCEUI_SetVidSystem(0); + break; + case 1: + pal_emulation = 1; + dendy = 0; + FCEUI_SetVidSystem(1); + break; + case 2: + pal_emulation = 0; + dendy = 1; + FCEUI_SetVidSystem(0); + break; + } + return; +} + + /** * Loads a game, given a full path/filename. The driver code must be * initialized after the game is loaded, because the emulator code @@ -218,23 +248,7 @@ int LoadGame(const char *path) // set pal/ntsc int id; g_config->getOption("SDL.PAL", &id); - switch(id) - { - case 0: - FCEUI_SetVidSystem(0); - pal_emulation = 0; - dendy = 0; - break; - case 1: - FCEUI_SetVidSystem(1); - pal_emulation = 1; - dendy = 0; - break; - case 2: - FCEUI_SetVidSystem(0); - pal_emulation = 0; - dendy = 1; - } + SetRegion(id); std::string filename; g_config->getOption("SDL.Sound.RecordFile", &filename); diff --git a/trunk/src/drivers/sdl/sdl.h b/trunk/src/drivers/sdl/sdl.h index 04fa6f01..57ef6b74 100644 --- a/trunk/src/drivers/sdl/sdl.h +++ b/trunk/src/drivers/sdl/sdl.h @@ -23,6 +23,7 @@ extern int isloaded; extern int dendy; extern int pal_emulation; +void SetRegion(int region); int LoadGame(const char *path); int CloseGame(void); void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);