aboutsummaryrefslogtreecommitdiff
path: root/plugins/dfsound/spucfg-0.1df
diff options
context:
space:
mode:
authorPCSX* teams2010-11-16 14:15:22 +0200
committerGrazvydas Ignotas2010-11-16 14:15:22 +0200
commitef79bbde537d6b9c745a7d86cb9df1d04c35590d (patch)
treeef8d2520dbb9e1e345b41b12c9959f300ca8fd10 /plugins/dfsound/spucfg-0.1df
downloadpcsx_rearmed-ef79bbde537d6b9c745a7d86cb9df1d04c35590d.tar.gz
pcsx_rearmed-ef79bbde537d6b9c745a7d86cb9df1d04c35590d.tar.bz2
pcsx_rearmed-ef79bbde537d6b9c745a7d86cb9df1d04c35590d.zip
pcsxr-1.9.92
Diffstat (limited to 'plugins/dfsound/spucfg-0.1df')
-rw-r--r--plugins/dfsound/spucfg-0.1df/dfsound.glade2308
-rw-r--r--plugins/dfsound/spucfg-0.1df/main.c258
2 files changed, 566 insertions, 0 deletions
diff --git a/plugins/dfsound/spucfg-0.1df/dfsound.glade2 b/plugins/dfsound/spucfg-0.1df/dfsound.glade2
new file mode 100644
index 0000000..c071a09
--- /dev/null
+++ b/plugins/dfsound/spucfg-0.1df/dfsound.glade2
@@ -0,0 +1,308 @@
+<?xml version="1.0"?>
+<glade-interface>
+ <!-- interface-requires gtk+ 2.8 -->
+ <!-- interface-naming-policy project-wide -->
+ <widget class="GtkWindow" id="CfgWnd">
+ <property name="visible">True</property>
+ <property name="border_width">10</property>
+ <property name="title" translatable="yes">Configure Sound</property>
+ <property name="resizable">False</property>
+ <property name="modal">True</property>
+ <property name="window_position">center</property>
+ <property name="type_hint">dialog</property>
+ <signal name="destroy" handler="on_CfgWnd_destroy"/>
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment4">
+ <property name="visible">True</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">12</property>
+ <child>
+ <widget class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="border_width">6</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label1v">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Volume:</property>
+ <property name="justify">right</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label9">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Interpolation:</property>
+ <property name="justify">right</property>
+ </widget>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label8">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Reverb:</property>
+ <property name="justify">right</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="cbVolume2">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Low
+Medium
+Loud
+Loudest</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="cbReverb2">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">Off
+Simple
+Playstation</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkComboBox" id="cbInterpolation2">
+ <property name="visible">True</property>
+ <property name="items" translatable="yes">None
+Simple
+Gaussian
+Cubic</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label10">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;General&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFrame" id="frame2">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">12</property>
+ <child>
+ <widget class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="border_width">6</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkCheckButton" id="chkXASpeed">
+ <property name="label" translatable="yes">Adjust XA speed</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip" translatable="yes">Choose this if XA music is played too quickly.</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label11">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;XA Music&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFrame" id="frame3">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment3">
+ <property name="visible">True</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">6</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">12</property>
+ <child>
+ <widget class="GtkVBox" id="vbox4">
+ <property name="visible">True</property>
+ <property name="border_width">6</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkCheckButton" id="chkHiCompat">
+ <property name="label" translatable="yes">High compatibility mode</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip" translatable="yes">Use the asynchronous SPU interface.</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="chkIRQWait">
+ <property name="label" translatable="yes">SPU IRQ Wait</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip" translatable="yes">Wait for CPU; only useful for some games.</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton" id="chkDisStereo">
+ <property name="label" translatable="yes">Single channel sound</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip" translatable="yes">Play only one channel for a performance boost.</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label12">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Compatibility&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHButtonBox" id="hbuttonbox1">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <property name="layout_style">end</property>
+ <child>
+ <widget class="GtkButton" id="btn_close">
+ <property name="label">gtk-close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+</glade-interface>
diff --git a/plugins/dfsound/spucfg-0.1df/main.c b/plugins/dfsound/spucfg-0.1df/main.c
new file mode 100644
index 0000000..dd38645
--- /dev/null
+++ b/plugins/dfsound/spucfg-0.1df/main.c
@@ -0,0 +1,258 @@
+#include "config.h"
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include <glade/glade.h>
+#include <gtk/gtk.h>
+
+#ifdef ENABLE_NLS
+#include <libintl.h>
+#include <locale.h>
+#endif
+
+#define READBINARY "rb"
+#define WRITEBINARY "wb"
+#define CONFIG_FILENAME "dfsound.cfg"
+
+void SaveConfig(GtkWidget *widget, gpointer user_datal);
+
+/* This function checks for the value being outside the accepted range,
+ and returns the appropriate boundary value */
+int set_limit (char *p, int len, int lower, int upper)
+{
+ int val = 0;
+
+ if (p)
+ val = atoi(p + len);
+
+ if (val < lower)
+ val = lower;
+ if (val > upper)
+ val = upper;
+
+ return val;
+}
+
+void on_about_clicked (GtkWidget *widget, gpointer user_data)
+{
+ gtk_widget_destroy (widget);
+ exit (0);
+}
+
+void OnConfigClose(GtkWidget *widget, gpointer user_data)
+{
+ GladeXML *xml = (GladeXML *)user_data;
+
+ gtk_widget_destroy(glade_xml_get_widget(xml, "CfgWnd"));
+ gtk_exit(0);
+}
+
+int main(int argc, char *argv[])
+{
+ GtkWidget *widget;
+ GladeXML *xml;
+ FILE *in;
+ char t[256];
+ int len, val = 0;
+ char *pB, *p;
+ char cfg[255];
+
+#ifdef ENABLE_NLS
+ setlocale (LC_ALL, "");
+ bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+#endif
+
+ if (argc != 2) {
+ printf ("Usage: cfgDFSound {ABOUT | CFG}\n");
+ return 0;
+ }
+
+ if (strcmp(argv[1], "CFG") != 0 && strcmp(argv[1], "ABOUT") != 0) {
+ printf ("Usage: cfgDFSound {ABOUT | CFG}\n");
+ return 0;
+ }
+
+ gtk_set_locale();
+ gtk_init(&argc, &argv);
+
+ if (strcmp(argv[1], "ABOUT") == 0) {
+ const char *authors[]= {"Pete Bernert and the P.E.Op.S. team", "Ryan Schultz", "Andrew Burton", NULL};
+ widget = gtk_about_dialog_new ();
+ gtk_about_dialog_set_name (GTK_ABOUT_DIALOG (widget), "dfsound PCSX Sound Plugin");
+ gtk_about_dialog_set_version (GTK_ABOUT_DIALOG (widget), "1.6");
+ gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG (widget), authors);
+ gtk_about_dialog_set_website (GTK_ABOUT_DIALOG (widget), "http://pcsx-df.sourceforge.net/");
+
+ g_signal_connect_data(GTK_OBJECT(widget), "response",
+ GTK_SIGNAL_FUNC(on_about_clicked), NULL, NULL, G_CONNECT_AFTER);
+
+ gtk_widget_show (widget);
+ gtk_main();
+
+ return 0;
+ }
+
+ xml = glade_xml_new(DATADIR "dfsound.glade2", "CfgWnd", NULL);
+ if (!xml) {
+ g_warning("We could not load the interface!");
+ return 255;
+ }
+
+ strcpy(cfg, CONFIG_FILENAME);
+
+ in = fopen(cfg, READBINARY);
+ if (in) {
+ pB = (char *)malloc(32767);
+ memset(pB, 0, 32767);
+ len = fread(pB, 1, 32767, in);
+ fclose(in);
+ } else {
+ pB = 0;
+ printf ("Error - no configuration file\n");
+ /* TODO Raise error - no configuration file */
+ }
+
+ /* ADB TODO Replace a lot of the following with common functions */
+ if (pB) {
+ strcpy(t, "\nVolume");
+ p = strstr(pB, t);
+ if (p) {
+ p = strstr(p, "=");
+ len = 1;
+ }
+ val = set_limit (p, len, 0, 4);
+ } else val = 2;
+
+ gtk_combo_box_set_active(GTK_COMBO_BOX (glade_xml_get_widget(xml, "cbVolume2")), val);
+
+ if (pB) {
+ strcpy(t, "\nUseInterpolation");
+ p = strstr(pB, t);
+ if (p) {
+ p = strstr(p, "=");
+ len = 1;
+ }
+ val = set_limit (p, len, 0, 3);
+ } else val = 2;
+
+ gtk_combo_box_set_active(GTK_COMBO_BOX (glade_xml_get_widget(xml, "cbInterpolation2")), val);
+
+ if (pB) {
+ strcpy(t, "\nXAPitch");
+ p = strstr(pB, t);
+ if (p) {
+ p = strstr(p, "=");
+ len = 1;
+ }
+ val = set_limit (p, len, 0, 1);
+ } else val = 0;
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (glade_xml_get_widget(xml, "chkXASpeed")), val);
+
+ if (pB) {
+ strcpy(t, "\nHighCompMode");
+ p = strstr(pB, t);
+ if (p) {
+ p = strstr(p, "=");
+ len = 1;
+ }
+ val = set_limit (p, len, 0, 1);
+ } else val = 0;
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (glade_xml_get_widget(xml, "chkHiCompat")), val);
+
+ if (pB) {
+ strcpy(t, "\nSPUIRQWait");
+ p = strstr(pB, t);
+ if (p) {
+ p = strstr(p, "=");
+ len = 1;
+ }
+
+ val = set_limit (p, len, 0, 1);
+ } else val = 1;
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (glade_xml_get_widget(xml, "chkIRQWait")), val);
+
+ if (pB) {
+ strcpy(t, "\nDisStereo");
+ p = strstr(pB, t);
+ if (p) {
+ p = strstr(p, "=");
+ len = 1;
+ }
+
+ val = set_limit (p, len, 0, 1);
+ } else val = 0;
+
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (glade_xml_get_widget(xml, "chkDisStereo")), val);
+
+ if (pB) {
+ strcpy(t, "\nUseReverb");
+ p = strstr(pB, t);
+ if (p) {
+ p = strstr(p, "=");
+ len = 1;
+ }
+ val = set_limit (p, len, 0, 2);
+ } else val = 2;
+
+ gtk_combo_box_set_active(GTK_COMBO_BOX(glade_xml_get_widget(xml, "cbReverb2")), val);
+
+ if (pB)
+ free(pB);
+
+ widget = glade_xml_get_widget(xml, "CfgWnd");
+ g_signal_connect_data(GTK_OBJECT(widget), "destroy",
+ GTK_SIGNAL_FUNC(SaveConfig), xml, NULL, 0);
+
+ widget = glade_xml_get_widget(xml, "btn_close");
+ g_signal_connect_data(GTK_OBJECT(widget), "clicked",
+ GTK_SIGNAL_FUNC(OnConfigClose), xml, NULL, G_CONNECT_AFTER);
+
+ gtk_main();
+ return 0;
+}
+
+void SaveConfig(GtkWidget *widget, gpointer user_data)
+{
+ GladeXML *xml = (GladeXML *)user_data;
+ FILE *fp;
+ int val;
+
+ fp = fopen(CONFIG_FILENAME, WRITEBINARY);
+ if (fp == NULL) {
+ fprintf(stderr, "Unable to write to configuration file %s!\n", CONFIG_FILENAME);
+ gtk_exit(0);
+ }
+
+ val = gtk_combo_box_get_active(GTK_COMBO_BOX(glade_xml_get_widget(xml, "cbVolume2")));
+ fprintf(fp, "\nVolume = %d\n", val);
+
+ val = gtk_combo_box_get_active(GTK_COMBO_BOX(glade_xml_get_widget(xml, "cbInterpolation2")));
+ fprintf(fp, "\nUseInterpolation = %d\n", val);
+
+ val = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "chkXASpeed")));
+ fprintf(fp, "\nXAPitch = %d\n", val);
+
+ val = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "chkHiCompat")));
+ fprintf(fp, "\nHighCompMode = %d\n", val);
+
+ val = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "chkIRQWait")));
+ fprintf(fp, "\nSPUIRQWait = %d\n", val);
+
+ val = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(xml, "chkDisStereo")));
+ fprintf(fp, "\nDisStereo = %d\n", val);
+
+ val = gtk_combo_box_get_active(GTK_COMBO_BOX(glade_xml_get_widget(xml, "cbReverb2")));
+ fprintf(fp, "\nUseReverb = %d\n", val);
+
+ fclose(fp);
+ gtk_exit(0);
+}