diff --git a/plugins/zerospu2/Linux.cpp b/plugins/zerospu2/Linux.cpp index 2e67ebe5ef..fb909af235 100644 --- a/plugins/zerospu2/Linux.cpp +++ b/plugins/zerospu2/Linux.cpp @@ -15,6 +15,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + + // Modified by arcum42@gmail.com + #include "zerospu2.h" #include @@ -25,110 +28,124 @@ #include #include +#include + +extern "C" { +#include "interface.h" +#include "support.h" +#include "callbacks.h" +} + +#define is_checked(main_widget, widget_name) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)))) +#define set_checked(main_widget,widget_name, state) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)), state) + +GtkWidget *MsgDlg, *ConfDlg; + #ifdef ZEROSPU2_OSS static int oss_audio_fd = -1; extern int errno; + #define OSS_MODE_STEREO 1 // use OSS for sound int SetupSound() { - int pspeed=48000; - int pstereo; - int format; - int fragsize = 0; - int myfrag; - int oss_speed, oss_stereo; + int pspeed=48000; + int pstereo; + int format; + int fragsize = 0; + int myfrag; + int oss_speed, oss_stereo; - pstereo=OSS_MODE_STEREO; + pstereo=OSS_MODE_STEREO; - oss_speed = pspeed; - oss_stereo = pstereo; + oss_speed = pspeed; + oss_stereo = pstereo; - if((oss_audio_fd=open("/dev/dsp",O_WRONLY,0))==-1) { - printf("Sound device not available!\n"); - return -1; - } + if((oss_audio_fd=open("/dev/dsp",O_WRONLY,0))==-1) { + printf("Sound device not available!\n"); + return -1; + } - if(ioctl(oss_audio_fd,SNDCTL_DSP_RESET,0)==-1) { - printf("Sound reset failed\n"); - return -1; - } + if(ioctl(oss_audio_fd,SNDCTL_DSP_RESET,0)==-1) { + printf("Sound reset failed\n"); + return -1; + } - // we use 64 fragments with 1024 bytes each - fragsize=10; - myfrag=(63<<16)|fragsize; + // we use 64 fragments with 1024 bytes each + fragsize=10; + myfrag=(63<<16)|fragsize; - if(ioctl(oss_audio_fd,SNDCTL_DSP_SETFRAGMENT,&myfrag)==-1) { - printf("Sound set fragment failed!\n"); - return -1; - } + if(ioctl(oss_audio_fd,SNDCTL_DSP_SETFRAGMENT,&myfrag)==-1) { + printf("Sound set fragment failed!\n"); + return -1; + } - format = AFMT_S16_LE; + format = AFMT_S16_LE; - if(ioctl(oss_audio_fd,SNDCTL_DSP_SETFMT,&format) == -1) { - printf("Sound format not supported!\n"); - return -1; - } + if(ioctl(oss_audio_fd,SNDCTL_DSP_SETFMT,&format) == -1) { + printf("Sound format not supported!\n"); + return -1; + } - if(format!=AFMT_S16_LE) { - printf("Sound format not supported!\n"); - return -1; - } + if(format!=AFMT_S16_LE) { + printf("Sound format not supported!\n"); + return -1; + } - if(ioctl(oss_audio_fd,SNDCTL_DSP_STEREO,&oss_stereo)==-1) { - printf("Stereo mode not supported!\n"); - return -1; - } + if(ioctl(oss_audio_fd,SNDCTL_DSP_STEREO,&oss_stereo)==-1) { + printf("Stereo mode not supported!\n"); + return -1; + } - if(ioctl(oss_audio_fd,SNDCTL_DSP_SPEED,&oss_speed)==-1) { - printf("Sound frequency not supported\n"); - return -1; - } + if(ioctl(oss_audio_fd,SNDCTL_DSP_SPEED,&oss_speed)==-1) { + printf("Sound frequency not supported\n"); + return -1; + } - if(oss_speed!=pspeed) { - printf("Sound frequency not supported\n"); - return -1; - } + if(oss_speed!=pspeed) { + printf("Sound frequency not supported\n"); + return -1; + } - return 0; + return 0; } // REMOVE SOUND void RemoveSound() { - if(oss_audio_fd != -1 ) { - close(oss_audio_fd); - oss_audio_fd = -1; - } + if(oss_audio_fd != -1 ) { + close(oss_audio_fd); + oss_audio_fd = -1; + } } #define SOUNDSIZE 76800 int SoundGetBytesBuffered() { - audio_buf_info info; - unsigned long l; + audio_buf_info info; + unsigned long l; - if(oss_audio_fd == -1) - return SOUNDSIZE; - if(ioctl(oss_audio_fd,SNDCTL_DSP_GETOSPACE,&info)==-1) - return 0; - else { + if(oss_audio_fd == -1) + return SOUNDSIZE; + if(ioctl(oss_audio_fd,SNDCTL_DSP_GETOSPACE,&info)==-1) + return 0; + else { // can we write in at least the half of fragments? - if(info.fragments<(info.fragstotal>>1)) - return SOUNDSIZE; - } + if(info.fragments<(info.fragstotal>>1)) + return SOUNDSIZE; + } - return 0; + return 0; } // FEED SOUND DATA void SoundFeedVoiceData(unsigned char* pSound,long lBytes) { - if(oss_audio_fd == -1) return; - write(oss_audio_fd,pSound,lBytes); + if(oss_audio_fd == -1) return; + write(oss_audio_fd,pSound,lBytes); } #else @@ -152,123 +169,120 @@ static snd_pcm_uframes_t buffer_size; int SetupSound(void) { - snd_pcm_hw_params_t *hwparams; - snd_pcm_sw_params_t *swparams; - snd_pcm_status_t *status; - unsigned int pspeed; - int pchannels; - snd_pcm_format_t format; - unsigned int buffer_time, period_time; - int err; + snd_pcm_hw_params_t *hwparams; + snd_pcm_sw_params_t *swparams; + snd_pcm_status_t *status; + unsigned int pspeed; + int pchannels; + snd_pcm_format_t format; + unsigned int buffer_time, period_time; + int err; - pchannels=2; + pchannels=2; - pspeed=48000; - format=SND_PCM_FORMAT_S16_LE; - buffer_time=SOUNDSIZE; - period_time=buffer_time/4; + pspeed=48000; + format=SND_PCM_FORMAT_S16_LE; + buffer_time=SOUNDSIZE; + period_time=buffer_time/4; - if((err=snd_pcm_open(&handle, "default", - SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK))<0) { - printf("Audio open error: %s\n", snd_strerror(err)); - return -1; - } + if((err=snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK))<0) { + printf("Audio open error: %s\n", snd_strerror(err)); + return -1; + } - if((err=snd_pcm_nonblock(handle, 0))<0) { - printf("Can't set blocking moded: %s\n", snd_strerror(err)); - return -1; - } + if((err=snd_pcm_nonblock(handle, 0))<0) { + printf("Can't set blocking moded: %s\n", snd_strerror(err)); + return -1; + } - snd_pcm_hw_params_alloca(&hwparams); - snd_pcm_sw_params_alloca(&swparams); - if((err=snd_pcm_hw_params_any(handle, hwparams))<0) { - printf("Broken configuration for this PCM: %s\n", snd_strerror(err)); - return -1; - } + snd_pcm_hw_params_alloca(&hwparams); + snd_pcm_sw_params_alloca(&swparams); + if((err=snd_pcm_hw_params_any(handle, hwparams))<0) { + printf("Broken configuration for this PCM: %s\n", snd_strerror(err)); + return -1; + } - if((err=snd_pcm_hw_params_set_access(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED))<0) { - printf("Access type not available: %s\n", snd_strerror(err)); - return -1; - } + if((err=snd_pcm_hw_params_set_access(handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED))<0) { + printf("Access type not available: %s\n", snd_strerror(err)); + return -1; + } - if((err=snd_pcm_hw_params_set_format(handle, hwparams, format))<0) { - printf("Sample format not available: %s\n", snd_strerror(err)); - return -1; - } + if((err=snd_pcm_hw_params_set_format(handle, hwparams, format))<0) { + printf("Sample format not available: %s\n", snd_strerror(err)); + return -1; + } - if((err=snd_pcm_hw_params_set_channels(handle, hwparams, pchannels))<0) { - printf("Channels count not available: %s\n", snd_strerror(err)); - return -1; - } + if((err=snd_pcm_hw_params_set_channels(handle, hwparams, pchannels))<0) { + printf("Channels count not available: %s\n", snd_strerror(err)); + return -1; + } - if((err=snd_pcm_hw_params_set_rate_near(handle, hwparams, &pspeed, 0))<0) { - printf("Rate not available: %s\n", snd_strerror(err)); - return -1; - } + if((err=snd_pcm_hw_params_set_rate_near(handle, hwparams, &pspeed, 0))<0) { + printf("Rate not available: %s\n", snd_strerror(err)); + return -1; + } if((err=snd_pcm_hw_params_set_buffer_time_near(handle, hwparams, &buffer_time, 0))<0) { printf("Buffer time error: %s\n", snd_strerror(err)); return -1; } - if((err=snd_pcm_hw_params_set_period_time_near(handle, hwparams, &period_time, 0))<0) { - printf("Period time error: %s\n", snd_strerror(err)); - return -1; + if((err=snd_pcm_hw_params_set_period_time_near(handle, hwparams, &period_time, 0))<0) { + printf("Period time error: %s\n", snd_strerror(err)); + return -1; } - if((err=snd_pcm_hw_params(handle, hwparams))<0) { - printf("Unable to install hw params: %s\n", snd_strerror(err)); - return -1; + if((err=snd_pcm_hw_params(handle, hwparams))<0) { + printf("Unable to install hw params: %s\n", snd_strerror(err)); + return -1; } - snd_pcm_status_alloca(&status); - if((err=snd_pcm_status(handle, status))<0) { - printf("Unable to get status: %s\n", snd_strerror(err)); - return -1; - } + snd_pcm_status_alloca(&status); + if((err=snd_pcm_status(handle, status))<0) { + printf("Unable to get status: %s\n", snd_strerror(err)); + return -1; + } - buffer_size=snd_pcm_status_get_avail(status); + buffer_size=snd_pcm_status_get_avail(status); - return 0; + return 0; } void RemoveSound() { - if(handle != NULL) { - snd_pcm_drop(handle); - snd_pcm_close(handle); - handle = NULL; - } + if(handle != NULL) { + snd_pcm_drop(handle); + snd_pcm_close(handle); + handle = NULL; + } } int SoundGetBytesBuffered() { - int l; + int l; - if(handle == NULL) // failed to open? - return SOUNDSIZE; - l = snd_pcm_avail_update(handle); - if(l<0) return 0; - if(l no? wait - else l=0; // -> else go on + if(handle == NULL) // failed to open? + return SOUNDSIZE; + l = snd_pcm_avail_update(handle); + if(l<0) return 0; + if(l no? wait + else l=0; // -> else go on - return l; + return l; } void SoundFeedVoiceData(unsigned char* pSound,long lBytes) { - if(handle == NULL) return; + if(handle == NULL) return; - if(snd_pcm_state(handle) == SND_PCM_STATE_XRUN) - snd_pcm_prepare(handle); - snd_pcm_writei(handle,pSound, lBytes/4); + if(snd_pcm_state(handle) == SND_PCM_STATE_XRUN) + snd_pcm_prepare(handle); + snd_pcm_writei(handle,pSound, lBytes/4); } #endif -GtkWidget *MsgDlg; - void OnMsg_Ok() { gtk_widget_destroy(MsgDlg); gtk_main_quit(); @@ -316,7 +330,43 @@ void SysMessage(char *fmt, ...) { } void CALLBACK SPU2configure() { - SysMessage("Nothing to Configure"); + ConfDlg = create_Config(); + LoadConfig(); + set_checked(ConfDlg, "timescalingbutton", (conf.options & OPTION_TIMESTRETCH)); + set_checked(ConfDlg, "realtimebutton", (conf.options & OPTION_REALTIME)); + set_checked(ConfDlg, "recordingbutton", (conf.options & OPTION_RECORDING)); + set_checked(ConfDlg, "mutebutton", (conf.options & OPTION_MUTE)); + set_checked(ConfDlg, "loggingbutton", (conf.Log)); + + gtk_widget_show_all(ConfDlg); + gtk_main(); +} + + +void on_Conf_Ok (GtkButton *button, gpointer user_data) +{ + conf.options = 0; + + if (is_checked(ConfDlg, "realtimebutton")) + conf.options |= OPTION_REALTIME; + if (is_checked(ConfDlg, "timescalingbutton")) + conf.options |= OPTION_TIMESTRETCH; + if (is_checked(ConfDlg, "recordingbutton")) + conf.options |= OPTION_RECORDING; + if (is_checked(ConfDlg, "mutebutton")) + conf.options |= OPTION_MUTE; + conf.Log = is_checked(ConfDlg, "loggingbutton"); + SaveConfig(); + gtk_widget_destroy(ConfDlg); + gtk_main_quit(); +} + + +void on_Conf_Cancel (GtkButton *button, gpointer user_data) +{ + gtk_widget_destroy(ConfDlg); + gtk_main_quit(); + } extern char* libraryName; @@ -327,36 +377,36 @@ void CALLBACK SPU2about() { } void SaveConfig() { - FILE *f; - char cfg[255]; + FILE *f; + char cfg[255]; - strcpy(cfg, s_strIniPath.c_str()); - f = fopen(cfg,"w"); - if (f == NULL) { - printf("Failed to open %s\n", s_strIniPath.c_str()); - return; - } - fprintf(f, "log = %d\n", conf.Log); - fprintf(f, "options = %d\n", conf.options); - fclose(f); + strcpy(cfg, s_strIniPath.c_str()); + f = fopen(cfg,"w"); + if (f == NULL) { + printf("Failed to open %s\n", s_strIniPath.c_str()); + return; + } + fprintf(f, "log = %d\n", conf.Log); + fprintf(f, "options = %d\n", conf.options); + fclose(f); } void LoadConfig() { - FILE *f; - char cfg[255]; + FILE *f; + char cfg[255]; - memset(&conf, 0, sizeof(conf)); + memset(&conf, 0, sizeof(conf)); - strcpy(cfg, s_strIniPath.c_str()); - f = fopen(cfg, "r"); - if (f == NULL) { - printf("Failed to open %s\n", s_strIniPath.c_str()); - conf.Log = 0;//default value - conf.options = 0;//OPTION_TIMESTRETCH; - SaveConfig();//save and return - return; - } + strcpy(cfg, s_strIniPath.c_str()); + f = fopen(cfg, "r"); + if (f == NULL) { + printf("Failed to open %s\n", s_strIniPath.c_str()); + conf.Log = 0;//default value + conf.options = 0;//OPTION_TIMESTRETCH; + SaveConfig();//save and return + return; + } fscanf(f, "log = %d\n", &conf.Log); - fscanf(f, "options = %d\n", &conf.options); - fclose(f); + fscanf(f, "options = %d\n", &conf.options); + fclose(f); } diff --git a/plugins/zerospu2/Makefile.am b/plugins/zerospu2/Makefile.am index c75066e224..4f95d439d1 100644 --- a/plugins/zerospu2/Makefile.am +++ b/plugins/zerospu2/Makefile.am @@ -26,6 +26,6 @@ libZeroSPU2_LDFLAGS= @SHARED_LDFLAGS@ libZeroSPU2_LDFLAGS+=-Wl,-soname,@ZEROSPU2_SONAME@ libZeroSPU2_LDADD=$(libZeroSPU2_a_OBJECTS) SoundTouch/libSoundTouch.a -libZeroSPU2_a_SOURCES = zerospu2.cpp Linux.cpp +libZeroSPU2_a_SOURCES = zerospu2.cpp interface.c Linux.cpp support.c -SUBDIRS = SoundTouch . \ No newline at end of file +SUBDIRS = SoundTouch diff --git a/plugins/zerospu2/buildgui.sh b/plugins/zerospu2/buildgui.sh new file mode 100644 index 0000000000..f7627e9d8a --- /dev/null +++ b/plugins/zerospu2/buildgui.sh @@ -0,0 +1,9 @@ +# builds the GUI C classes +mkdir temp +cp zerospu2.glade temp/ +cd temp +glade-2 --write-source zerospu2.glade +rm src/main.c +cp src/*.h src/*.c ../ +cd .. +/bin/rm -rf temp diff --git a/plugins/zerospu2/callbacks.c b/plugins/zerospu2/callbacks.c new file mode 100644 index 0000000000..1404beee8b --- /dev/null +++ b/plugins/zerospu2/callbacks.c @@ -0,0 +1,26 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "callbacks.h" +#include "interface.h" +#include "support.h" + + +void +on_Conf_Ok (GtkButton *button, + gpointer user_data) +{ + +} + + +void +on_Conf_Cancel (GtkButton *button, + gpointer user_data) +{ + +} + diff --git a/plugins/zerospu2/callbacks.h b/plugins/zerospu2/callbacks.h new file mode 100644 index 0000000000..31d1ca7051 --- /dev/null +++ b/plugins/zerospu2/callbacks.h @@ -0,0 +1,10 @@ +#include + + +void +on_Conf_Ok (GtkButton *button, + gpointer user_data); + +void +on_Conf_Cancel (GtkButton *button, + gpointer user_data); diff --git a/plugins/zerospu2/interface.c b/plugins/zerospu2/interface.c new file mode 100644 index 0000000000..451d7e3846 --- /dev/null +++ b/plugins/zerospu2/interface.c @@ -0,0 +1,130 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include +#include + +#include "callbacks.h" +#include "interface.h" +#include "support.h" + +#define GLADE_HOOKUP_OBJECT(component,widget,name) \ + g_object_set_data_full (G_OBJECT (component), name, \ + gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref) + +#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \ + g_object_set_data (G_OBJECT (component), name, widget) + +GtkWidget* +create_About (void) +{ + GtkWidget *About; + /* TRANSLATORS: Replace this string with your names, one name per line. */ + gchar *translators = _("translator-credits"); + + About = gtk_about_dialog_new (); + gtk_container_set_border_width (GTK_CONTAINER (About), 5); + gtk_about_dialog_set_version (GTK_ABOUT_DIALOG (About), VERSION); + gtk_about_dialog_set_name (GTK_ABOUT_DIALOG (About), _("ZeroSPU2")); + gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG (About), translators); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (About, About, "About"); + + return About; +} + +GtkWidget* +create_Config (void) +{ + GtkWidget *Config; + GtkWidget *dialog_vbox1; + GtkWidget *vbox1; + GtkWidget *timescalingbutton; + GtkWidget *realtimebutton; + GtkWidget *recordingbutton; + GtkWidget *mutebutton; + GtkWidget *loggingbutton; + GtkWidget *dialog_action_area1; + GtkWidget *Conf_Ok; + GtkWidget *Conf_Cancel; + + Config = gtk_dialog_new (); + gtk_window_set_title (GTK_WINDOW (Config), _("ZeroSPU2 Config")); + gtk_window_set_type_hint (GTK_WINDOW (Config), GDK_WINDOW_TYPE_HINT_DIALOG); + + dialog_vbox1 = GTK_DIALOG (Config)->vbox; + gtk_widget_show (dialog_vbox1); + + vbox1 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox1); + gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0); + + timescalingbutton = gtk_check_button_new_with_mnemonic (_("Time Scaling (recommended) \nSlows down or speeds up sound with respect to game's real speed. \nEnabling this produces higher quality sound with less cracking, but can reduce speed.")); + gtk_widget_show (timescalingbutton); + gtk_box_pack_start (GTK_BOX (vbox1), timescalingbutton, FALSE, FALSE, 0); + + realtimebutton = gtk_check_button_new_with_mnemonic (_("Real Time mode \nTries to reduce delays in music as much possible. \nUse when game is already fast and need sound tightly synchronized.\n(like in DDR, Guitar Hero, Guitaroo Man)")); + gtk_widget_show (realtimebutton); + gtk_box_pack_start (GTK_BOX (vbox1), realtimebutton, FALSE, FALSE, 0); + + recordingbutton = gtk_check_button_new_with_mnemonic (_("Recording - Saves the raw 16bit stereo wav data to zerospu2.wav. Timed to ps2 time.")); + gtk_widget_show (recordingbutton); + gtk_box_pack_start (GTK_BOX (vbox1), recordingbutton, FALSE, FALSE, 0); + + mutebutton = gtk_check_button_new_with_mnemonic (_("Mute - ZeroSPU2 will not output any sound (fast).")); + gtk_widget_show (mutebutton); + gtk_box_pack_start (GTK_BOX (vbox1), mutebutton, FALSE, FALSE, 0); + + loggingbutton = gtk_check_button_new_with_mnemonic (_("Enable logging(for development use only)")); + gtk_widget_show (loggingbutton); + gtk_box_pack_start (GTK_BOX (vbox1), loggingbutton, FALSE, FALSE, 0); + + dialog_action_area1 = GTK_DIALOG (Config)->action_area; + gtk_widget_show (dialog_action_area1); + gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END); + + Conf_Ok = gtk_button_new_from_stock ("gtk-ok"); + gtk_widget_show (Conf_Ok); + gtk_dialog_add_action_widget (GTK_DIALOG (Config), Conf_Ok, GTK_RESPONSE_OK); + GTK_WIDGET_SET_FLAGS (Conf_Ok, GTK_CAN_DEFAULT); + + Conf_Cancel = gtk_button_new_from_stock ("gtk-cancel"); + gtk_widget_show (Conf_Cancel); + gtk_dialog_add_action_widget (GTK_DIALOG (Config), Conf_Cancel, GTK_RESPONSE_CANCEL); + GTK_WIDGET_SET_FLAGS (Conf_Cancel, GTK_CAN_DEFAULT); + + g_signal_connect ((gpointer) Conf_Ok, "clicked", + G_CALLBACK (on_Conf_Ok), + NULL); + g_signal_connect ((gpointer) Conf_Cancel, "clicked", + G_CALLBACK (on_Conf_Cancel), + NULL); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (Config, Config, "Config"); + GLADE_HOOKUP_OBJECT_NO_REF (Config, dialog_vbox1, "dialog_vbox1"); + GLADE_HOOKUP_OBJECT (Config, vbox1, "vbox1"); + GLADE_HOOKUP_OBJECT (Config, timescalingbutton, "timescalingbutton"); + GLADE_HOOKUP_OBJECT (Config, realtimebutton, "realtimebutton"); + GLADE_HOOKUP_OBJECT (Config, recordingbutton, "recordingbutton"); + GLADE_HOOKUP_OBJECT (Config, mutebutton, "mutebutton"); + GLADE_HOOKUP_OBJECT (Config, loggingbutton, "loggingbutton"); + GLADE_HOOKUP_OBJECT_NO_REF (Config, dialog_action_area1, "dialog_action_area1"); + GLADE_HOOKUP_OBJECT (Config, Conf_Ok, "Conf_Ok"); + GLADE_HOOKUP_OBJECT (Config, Conf_Cancel, "Conf_Cancel"); + + return Config; +} + diff --git a/plugins/zerospu2/interface.h b/plugins/zerospu2/interface.h new file mode 100644 index 0000000000..cd7bb62f7d --- /dev/null +++ b/plugins/zerospu2/interface.h @@ -0,0 +1,6 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +GtkWidget* create_About (void); +GtkWidget* create_Config (void); diff --git a/plugins/zerospu2/support.c b/plugins/zerospu2/support.c new file mode 100644 index 0000000000..00aff29822 --- /dev/null +++ b/plugins/zerospu2/support.c @@ -0,0 +1,144 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#include + +#include "support.h" + +GtkWidget* +lookup_widget (GtkWidget *widget, + const gchar *widget_name) +{ + GtkWidget *parent, *found_widget; + + for (;;) + { + if (GTK_IS_MENU (widget)) + parent = gtk_menu_get_attach_widget (GTK_MENU (widget)); + else + parent = widget->parent; + if (!parent) + parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey"); + if (parent == NULL) + break; + widget = parent; + } + + found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget), + widget_name); + if (!found_widget) + g_warning ("Widget not found: %s", widget_name); + return found_widget; +} + +static GList *pixmaps_directories = NULL; + +/* Use this function to set the directory containing installed pixmaps. */ +void +add_pixmap_directory (const gchar *directory) +{ + pixmaps_directories = g_list_prepend (pixmaps_directories, + g_strdup (directory)); +} + +/* This is an internally used function to find pixmap files. */ +static gchar* +find_pixmap_file (const gchar *filename) +{ + GList *elem; + + /* We step through each of the pixmaps directory to find it. */ + elem = pixmaps_directories; + while (elem) + { + gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data, + G_DIR_SEPARATOR_S, filename); + if (g_file_test (pathname, G_FILE_TEST_EXISTS)) + return pathname; + g_free (pathname); + elem = elem->next; + } + return NULL; +} + +/* This is an internally used function to create pixmaps. */ +GtkWidget* +create_pixmap (GtkWidget *widget, + const gchar *filename) +{ + gchar *pathname = NULL; + GtkWidget *pixmap; + + if (!filename || !filename[0]) + return gtk_image_new (); + + pathname = find_pixmap_file (filename); + + if (!pathname) + { + g_warning (_("Couldn't find pixmap file: %s"), filename); + return gtk_image_new (); + } + + pixmap = gtk_image_new_from_file (pathname); + g_free (pathname); + return pixmap; +} + +/* This is an internally used function to create pixmaps. */ +GdkPixbuf* +create_pixbuf (const gchar *filename) +{ + gchar *pathname = NULL; + GdkPixbuf *pixbuf; + GError *error = NULL; + + if (!filename || !filename[0]) + return NULL; + + pathname = find_pixmap_file (filename); + + if (!pathname) + { + g_warning (_("Couldn't find pixmap file: %s"), filename); + return NULL; + } + + pixbuf = gdk_pixbuf_new_from_file (pathname, &error); + if (!pixbuf) + { + fprintf (stderr, "Failed to load pixbuf file: %s: %s\n", + pathname, error->message); + g_error_free (error); + } + g_free (pathname); + return pixbuf; +} + +/* This is used to set ATK action descriptions. */ +void +glade_set_atk_action_description (AtkAction *action, + const gchar *action_name, + const gchar *description) +{ + gint n_actions, i; + + n_actions = atk_action_get_n_actions (action); + for (i = 0; i < n_actions; i++) + { + if (!strcmp (atk_action_get_name (action, i), action_name)) + atk_action_set_description (action, i, description); + } +} + diff --git a/plugins/zerospu2/support.h b/plugins/zerospu2/support.h new file mode 100644 index 0000000000..a32649e53c --- /dev/null +++ b/plugins/zerospu2/support.h @@ -0,0 +1,69 @@ +/* + * DO NOT EDIT THIS FILE - it is generated by Glade. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +/* + * Standard gettext macros. + */ +#ifdef ENABLE_NLS +# include +# undef _ +# define _(String) dgettext (PACKAGE, String) +# define Q_(String) g_strip_context ((String), gettext (String)) +# ifdef gettext_noop +# define N_(String) gettext_noop (String) +# else +# define N_(String) (String) +# endif +#else +# define textdomain(String) (String) +# define gettext(String) (String) +# define dgettext(Domain,Message) (Message) +# define dcgettext(Domain,Message,Type) (Message) +# define bindtextdomain(Domain,Directory) (Domain) +# define _(String) (String) +# define Q_(String) g_strip_context ((String), (String)) +# define N_(String) (String) +#endif + + +/* + * Public Functions. + */ + +/* + * This function returns a widget in a component created by Glade. + * Call it with the toplevel widget in the component (i.e. a window/dialog), + * or alternatively any widget in the component, and the name of the widget + * you want returned. + */ +GtkWidget* lookup_widget (GtkWidget *widget, + const gchar *widget_name); + + +/* Use this function to set the directory containing installed pixmaps. */ +void add_pixmap_directory (const gchar *directory); + + +/* + * Private Functions. + */ + +/* This is used to create the pixmaps used in the interface. */ +GtkWidget* create_pixmap (GtkWidget *widget, + const gchar *filename); + +/* This is used to create the pixbufs used in the interface. */ +GdkPixbuf* create_pixbuf (const gchar *filename); + +/* This is used to set ATK action descriptions. */ +void glade_set_atk_action_description (AtkAction *action, + const gchar *action_name, + const gchar *description); + diff --git a/plugins/zerospu2/zerospu2.glade b/plugins/zerospu2/zerospu2.glade new file mode 100644 index 0000000000..ea14cc62a3 --- /dev/null +++ b/plugins/zerospu2/zerospu2.glade @@ -0,0 +1,195 @@ + + + + + + + 5 + True + False + ZeroSPU2 + False + translator-credits + + + + True + ZeroSPU2 Config + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + True + -5 + + + + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + True + -6 + + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + False + 0 + + + + True + True + Time Scaling (recommended) +Slows down or speeds up sound with respect to game's real speed. +Enabling this produces higher quality sound with less cracking, but can reduce speed. + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + Real Time mode +Tries to reduce delays in music as much possible. +Use when game is already fast and need sound tightly synchronized. +(like in DDR, Guitar Hero, Guitaroo Man) + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + Recording - Saves the raw 16bit stereo wav data to zerospu2.wav. Timed to ps2 time. + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + Mute - ZeroSPU2 will not output any sound (fast). + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + + True + True + Enable logging(for development use only) + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 0 + False + False + + + + + 0 + True + True + + + + + + +