From 4fffce2b75d721c3765d04cfbd5443083addc5b1 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Fri, 4 Sep 2009 18:42:40 +0200 Subject: [PATCH] display framerate GUI option Also, minor cleanup in hgw and set snesadvance.dat to current rom dirname. --- debian/changelog | 9 +++++++++ gui/plugin.c | 20 +++++++++++--------- platform/hgw.cpp | 8 ++++++-- platform/hgw.h | 5 +++++ 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index 63491e5..8103995 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +drnoksnes (1.0.0) unstable; urgency=low + + * First stable release. + * Display framerate in GUI. + * For now, search for snesadvance.dat file in ROM dirname when + launched from GUI. + + -- Javier S. Pedro Fri, 4 Sep 2009 18:41:45 +0200 + drnoksnes (0.9.5) unstable; urgency=low * Icon in packaging diff --git a/gui/plugin.c b/gui/plugin.c index 61b1ec5..e065818 100644 --- a/gui/plugin.c +++ b/gui/plugin.c @@ -66,6 +66,7 @@ static GtkCheckButton* turbo_check; static GtkSpinButton* frameskip_spin; static GtkCheckButton* auto_framerate_check; static GtkCheckButton* trans_check; +static GtkCheckButton* framerate_check; static GtkComboBox* speedhacks_combo; static void set_rom(const char * rom_file) @@ -161,10 +162,9 @@ static GtkWidget * load_plugin(void) GtkWidget* selectRomBtn = gtk_button_new_with_label("Select ROM..."); rom_label = GTK_LABEL(gtk_label_new(NULL)); - GtkContainer* audio_cont = - GTK_CONTAINER(gtk_alignment_new(0.0, 0.0, 0.0, 0.0)); audio_check = GTK_CHECK_BUTTON(gtk_check_button_new_with_label("Enable audio")); + gtk_misc_set_alignment(GTK_MISC(audio_check), 0.0f, 0.5f); GtkWidget* framerate_label = gtk_label_new("Frameskip:"); frameskip_spin = GTK_SPIN_BUTTON(gtk_spin_button_new_with_range(0.0, 10.0, 1.0)); @@ -172,10 +172,11 @@ static GtkWidget * load_plugin(void) GTK_CHECK_BUTTON(gtk_check_button_new_with_label("Auto")); turbo_check = GTK_CHECK_BUTTON(gtk_check_button_new_with_label("Turbo mode")); - GtkContainer* trans_cont = - GTK_CONTAINER(gtk_alignment_new(0.0, 0.0, 0.0, 0.0)); trans_check = GTK_CHECK_BUTTON(gtk_check_button_new_with_label("Accurate graphics")); + framerate_check = + GTK_CHECK_BUTTON(gtk_check_button_new_with_label("Display framerate")); + gtk_misc_set_alignment(GTK_MISC(framerate_check), 0.0f, 0.5f); speedhacks_combo = GTK_COMBO_BOX(gtk_combo_box_new_text()); @@ -189,16 +190,15 @@ static GtkWidget * load_plugin(void) gtk_box_pack_start(GTK_BOX(rom_hbox), selectRomBtn, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(rom_hbox), GTK_WIDGET(rom_label), TRUE, TRUE, 0); - gtk_container_add(audio_cont, GTK_WIDGET(audio_check)); - gtk_box_pack_start(GTK_BOX(opt_hbox), GTK_WIDGET(audio_cont), TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(opt_hbox), GTK_WIDGET(audio_check), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(opt_hbox), framerate_label, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(opt_hbox), GTK_WIDGET(frameskip_spin), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(opt_hbox), GTK_WIDGET(auto_framerate_check), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(opt_hbox), GTK_WIDGET(turbo_check), FALSE, FALSE, 0); - gtk_container_add(trans_cont, GTK_WIDGET(trans_check)); - gtk_box_pack_start(GTK_BOX(opt2_hbox), GTK_WIDGET(trans_cont), TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(opt2_hbox), GTK_WIDGET(speedhacks_combo), FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(opt2_hbox), GTK_WIDGET(trans_check), TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(opt2_hbox), GTK_WIDGET(framerate_check), TRUE, TRUE, 0); + gtk_box_pack_end(GTK_BOX(opt2_hbox), GTK_WIDGET(speedhacks_combo), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(parent), rom_hbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(parent), opt_hbox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(parent), opt2_hbox, FALSE, FALSE, 0); @@ -263,6 +263,8 @@ static void write_config(void) } gconf_client_set_bool(gcc, kGConfTransparency, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(trans_check)), NULL); + gconf_client_set_bool(gcc, kGConfDisplayFramerate, + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(framerate_check)), NULL); gconf_client_set_int(gcc, kGConfSpeedhacks, gtk_combo_box_get_active(speedhacks_combo), NULL); diff --git a/platform/hgw.cpp b/platform/hgw.cpp index 11dafd9..29a2cd2 100644 --- a/platform/hgw.cpp +++ b/platform/hgw.cpp @@ -1,4 +1,5 @@ #include +#include #include #include "platform.h" @@ -84,12 +85,10 @@ void HgwConfig() Settings.Transparency = transparency ? TRUE : FALSE; } -#if 0 char displayFramerate = FALSE; if (hgw_conf_request_bool(hgw, kGConfDisplayFramerate, &displayFramerate) == HGW_ERR_NONE) { Settings.DisplayFrameRate = displayFramerate ? TRUE : FALSE; } -#endif int speedhacks = 0; if (hgw_conf_request_int(hgw, kGConfFrameskip, &speedhacks) == HGW_ERR_NONE) { @@ -104,6 +103,11 @@ void HgwConfig() Settings.HacksFilter = FALSE; } } + if (Settings.HacksEnabled && !Config.hacksFile) { + // Provide a default speedhacks file + Config.hacksFile = asprintf("%s/snesadvance.dat", dirname(romFile)); + // romFile[] is garbled from now on. + } int mappings = 0; if (hgw_conf_request_int(hgw, kGConfMapping, &mappings) == HGW_ERR_NONE) { diff --git a/platform/hgw.h b/platform/hgw.h index 21832f9..6c5ea56 100644 --- a/platform/hgw.h +++ b/platform/hgw.h @@ -2,11 +2,16 @@ #define _PLATFORM_HGW_H_ #ifdef __cplusplus +/** True if we were launched from GUI. */ extern bool hgwLaunched; +/** Called from main() before loading config; connects to DBus. */ void HgwInit(); +/** Called from main() before closing. */ void HgwDeinit(); +/** Called from main() after loading user config; loads GUI settings. */ void HgwConfig(); +/** Called from main() in the event loop; polls DBus. */ void HgwPollEvents(); #endif -- 1.7.9.5