sdl: changed pal checkbox to 'Region' combo including dendy

This commit is contained in:
punkrockguy318 2015-06-24 00:16:57 +00:00
parent fc74c4fd16
commit 4c0b8d9ce8
3 changed files with 61 additions and 30 deletions

View File

@ -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) int setXscale(GtkWidget* w, gpointer p)
{ {
@ -885,7 +894,9 @@ void openVideoConfig()
GtkWidget* glChk; GtkWidget* glChk;
GtkWidget* linearChk; GtkWidget* linearChk;
GtkWidget* dbChk; GtkWidget* dbChk;
GtkWidget* palChk; GtkWidget* palHbox;
GtkWidget* palLbl;
GtkWidget* palCombo;
GtkWidget* ppuChk; GtkWidget* ppuChk;
GtkWidget* spriteLimitChk; GtkWidget* spriteLimitChk;
GtkWidget* frameskipChk; GtkWidget* frameskipChk;
@ -968,18 +979,23 @@ void openVideoConfig()
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dbChk), 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dbChk), 0);
#endif #endif
// 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");
// PAL check // sync with cfg
palChk = gtk_check_button_new_with_label("Enable PAL mode");
g_signal_connect(palChk, "clicked", G_CALLBACK(toggleOption), (gpointer)"SDL.PAL");
// sync with config
buf = 0; buf = 0;
g_config->getOption("SDL.PAL", &buf); g_config->getOption("SDL.PAL", &buf);
if(buf) gtk_combo_box_set_active(GTK_COMBO_BOX(palCombo), buf);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(palChk), 1);
else g_signal_connect(palCombo, "changed", G_CALLBACK(setRegion), NULL);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(palChk), 0); 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 // New PPU check
ppuChk = gtk_check_button_new_with_label("Enable new PPU"); ppuChk = gtk_check_button_new_with_label("Enable new PPU");
@ -1074,7 +1090,7 @@ void openVideoConfig()
gtk_box_pack_start(GTK_BOX(vbox), linearChk, FALSE, FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), linearChk, FALSE, FALSE, 5);
gtk_box_pack_start(GTK_BOX(vbox), dbChk, FALSE, FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), dbChk, FALSE, FALSE, 5);
#endif #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); gtk_box_pack_start(GTK_BOX(vbox), ppuChk, FALSE, FALSE, 5);
#ifdef FRAMESKIP #ifdef FRAMESKIP
gtk_box_pack_start(GTK_BOX(vbox), frameskipChk, FALSE, FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), frameskipChk, FALSE, FALSE, 5);

View File

@ -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 * Loads a game, given a full path/filename. The driver code must be
* initialized after the game is loaded, because the emulator code * initialized after the game is loaded, because the emulator code
@ -218,23 +248,7 @@ int LoadGame(const char *path)
// set pal/ntsc // set pal/ntsc
int id; int id;
g_config->getOption("SDL.PAL", &id); g_config->getOption("SDL.PAL", &id);
switch(id) SetRegion(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;
}
std::string filename; std::string filename;
g_config->getOption("SDL.Sound.RecordFile", &filename); g_config->getOption("SDL.Sound.RecordFile", &filename);

View File

@ -23,6 +23,7 @@ extern int isloaded;
extern int dendy; extern int dendy;
extern int pal_emulation; extern int pal_emulation;
void SetRegion(int region);
int LoadGame(const char *path); int LoadGame(const char *path);
int CloseGame(void); int CloseGame(void);
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count); void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);