diff options
| author | SND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2011-11-03 20:54:08 +0000 |
|---|---|---|
| committer | SND\edgbla_cp <SND\edgbla_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2011-11-03 20:54:08 +0000 |
| commit | 536e7601cb2068e415ea1632e27d76aa8b6353c8 (patch) | |
| tree | f8585650813f8048b71958c452ca2d43aac76410 /plugins | |
| parent | 363e63c11d97a4370d81ad48befdeaa0599ac888 (diff) | |
| download | pcsxr-536e7601cb2068e415ea1632e27d76aa8b6353c8.tar.gz | |
dfinput: visual vibration option.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@71989 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/dfinput/cfg-gtk2.c | 19 | ||||
| -rw-r--r-- | plugins/dfinput/cfg.c | 8 | ||||
| -rw-r--r-- | plugins/dfinput/dfinput.ui | 34 | ||||
| -rw-r--r-- | plugins/dfinput/pad.c | 42 | ||||
| -rw-r--r-- | plugins/dfinput/pad.h | 1 |
5 files changed, 84 insertions, 20 deletions
diff --git a/plugins/dfinput/cfg-gtk2.c b/plugins/dfinput/cfg-gtk2.c index 5328401f..aff5de65 100644 --- a/plugins/dfinput/cfg-gtk2.c +++ b/plugins/dfinput/cfg-gtk2.c @@ -322,6 +322,14 @@ static void OnThreadedToggled(GtkWidget *widget, gpointer user_data) { g.cfg.Threaded = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
}
+static void OnVisualVibration1Toggled(GtkWidget *widget, gpointer user_data) {
+ g.cfg.PadDef[0].VisualVibration = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+}
+
+static void OnVisualVibration2Toggled(GtkWidget *widget, gpointer user_data) {
+ g.cfg.PadDef[1].VisualVibration = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+}
+
static void OnHideCursorToggled(GtkWidget *widget, gpointer user_data) {
g.cfg.HideCursor = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
}
@@ -658,6 +666,7 @@ long PADconfigure() { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), g.cfg.Threaded);
g_signal_connect_data(GTK_OBJECT(widget), "toggled",
G_CALLBACK(OnThreadedToggled), NULL, NULL, G_CONNECT_AFTER);
+
/*
widget = gtk_builder_get_object(xml, "checkcg");
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), g.cfg.HideCursor);
@@ -694,7 +703,17 @@ long PADconfigure() { padTypeList[g.cfg.PadDef[1].Type]);
g_signal_connect_data(GTK_OBJECT(widget), "changed",
G_CALLBACK(OnTypeChanged), (gpointer)1, NULL, G_CONNECT_AFTER);
+
+ widget = gtk_builder_get_object(xml, "checkvv1");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), g.cfg.PadDef[0].VisualVibration);
+ g_signal_connect_data(GTK_OBJECT(widget), "toggled",
+ G_CALLBACK(OnVisualVibration1Toggled), NULL, NULL, G_CONNECT_AFTER);
+ widget = gtk_builder_get_object(xml, "checkvv2");
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), g.cfg.PadDef[1].VisualVibration);
+ g_signal_connect_data(GTK_OBJECT(widget), "toggled",
+ G_CALLBACK(OnVisualVibration2Toggled), NULL, NULL, G_CONNECT_AFTER);
+
widget = gtk_builder_get_object(xml, "btnchange1");
gtk_widget_set_sensitive(widget, FALSE);
g_signal_connect_data(GTK_OBJECT(widget), "clicked",
diff --git a/plugins/dfinput/cfg.c b/plugins/dfinput/cfg.c index 3ac9dfa8..058dbdf5 100644 --- a/plugins/dfinput/cfg.c +++ b/plugins/dfinput/cfg.c @@ -34,6 +34,9 @@ static void SetDefaultConfig() { g.cfg.PadDef[0].Type = PSE_PAD_TYPE_STANDARD; g.cfg.PadDef[1].Type = PSE_PAD_TYPE_STANDARD; + g.cfg.PadDef[0].VisualVibration = 0; + g.cfg.PadDef[1].VisualVibration = 0; + // Pad1 keyboard g.cfg.PadDef[0].KeyDef[DKEY_SELECT].Key = XK_c; g.cfg.PadDef[0].KeyDef[DKEY_START].Key = XK_v; @@ -142,6 +145,8 @@ void LoadPADConfig() { g.cfg.PadDef[current].DevNum = atoi(&buf[7]); } else if (strncmp(buf, "Type=", 5) == 0) { g.cfg.PadDef[current].Type = atoi(&buf[5]); + } else if (strncmp(buf, "VisualVibration=", 16) == 0) { + g.cfg.PadDef[current].VisualVibration = atoi(&buf[16]); } else if (strncmp(buf, "Select=", 7) == 0) { sscanf(buf, "Select=%d,%d,%d", &a, &b, &c); g.cfg.PadDef[current].KeyDef[DKEY_SELECT].Key = a; @@ -291,7 +296,8 @@ void SavePADConfig() { fprintf(fp, "[PAD%d]\n", i + 1); fprintf(fp, "DevNum=%d\n", g.cfg.PadDef[i].DevNum); fprintf(fp, "Type=%d\n", g.cfg.PadDef[i].Type); - + fprintf(fp, "VisualVibration=%d\n", g.cfg.PadDef[i].VisualVibration); + fprintf(fp, "Select=%d,%d,%d\n", g.cfg.PadDef[i].KeyDef[DKEY_SELECT].Key, g.cfg.PadDef[i].KeyDef[DKEY_SELECT].JoyEvType, g.cfg.PadDef[i].KeyDef[DKEY_SELECT].J.d); fprintf(fp, "L3=%d,%d,%d\n", g.cfg.PadDef[i].KeyDef[DKEY_L3].Key, diff --git a/plugins/dfinput/dfinput.ui b/plugins/dfinput/dfinput.ui index e76898a5..26f7e84d 100644 --- a/plugins/dfinput/dfinput.ui +++ b/plugins/dfinput/dfinput.ui @@ -137,6 +137,19 @@ </packing> </child> <child> + <object class="GtkCheckButton" id="checkvv1"> + <property name="label" translatable="yes">Visual vibration</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="position">1</property> + </packing> + </child> + <child> <object class="GtkScrolledWindow" id="scrolledwindow1"> <property name="visible">True</property> <property name="can_focus">True</property> @@ -155,7 +168,7 @@ </child> </object> <packing> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> <child> @@ -237,7 +250,7 @@ </child> </object> <packing> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> </object> @@ -338,6 +351,19 @@ </packing> </child> <child> + <object class="GtkCheckButton" id="checkvv2"> + <property name="label" translatable="yes">Visual vibration</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="position">1</property> + </packing> + </child> + <child> <object class="GtkScrolledWindow" id="scrolledwindow2"> <property name="visible">True</property> <property name="can_focus">True</property> @@ -356,7 +382,7 @@ </child> </object> <packing> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> <child> @@ -440,7 +466,7 @@ <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">2</property> + <property name="position">3</property> </packing> </child> </object> diff --git a/plugins/dfinput/pad.c b/plugins/dfinput/pad.c index 501ba008..3900f0c4 100644 --- a/plugins/dfinput/pad.c +++ b/plugins/dfinput/pad.c @@ -460,15 +460,21 @@ unsigned char PADpoll(unsigned char value) { if (g.PadState[CurPad].VibF[0] != 0 || g.PadState[CurPad].VibF[1] != 0) {
#if !SDL_VERSION_ATLEAST(1,3,0) && defined(__linux__)
- if (g.PadState[CurPad].VibrateDev == -1 &&
- g.PadState[CurPad].JoyDev != NULL) {
- linux_set_vibrate(CurPad);
- }
- if (!linux_vibrate(&g.PadState[CurPad]))
- /* only do visual if joy fails */
+ if (g.PadState[CurPad].VibrateDev == -1 &&
+ g.PadState[CurPad].JoyDev != NULL) {
+ linux_set_vibrate(CurPad);
+ }
+ if (!linux_vibrate(&g.PadState[CurPad]))
+ /* only do visual if joy fails */
#endif
- if (!JoyHapticRumble(CurPad, g.PadState[CurPad].VibF[0], g.PadState[CurPad].VibF[1]) && gpuVisualVibration != NULL)
- gpuVisualVibration(g.PadState[CurPad].VibF[0], g.PadState[CurPad].VibF[1]);
+ if (!JoyHapticRumble(CurPad, g.PadState[CurPad].VibF[0], g.PadState[CurPad].VibF[1])) {
+ //gpuVisualVibration(g.PadState[CurPad].VibF[0], g.PadState[CurPad].VibF[1]);
+ }
+
+ if(gpuVisualVibration != NULL &&
+ g.cfg.PadDef[CurPad].VisualVibration) {
+ gpuVisualVibration(g.PadState[CurPad].VibF[0], g.PadState[CurPad].VibF[1]);
+ }
}
}
@@ -477,15 +483,21 @@ unsigned char PADpoll(unsigned char value) { if (g.PadState[CurPad].VibF[0] != 0 || g.PadState[CurPad].VibF[1] != 0) {
#if !SDL_VERSION_ATLEAST(1,3,0) && defined(__linux__)
- if (g.PadState[CurPad].VibrateDev == -1 &&
- g.PadState[CurPad].JoyDev != NULL) {
- linux_set_vibrate(CurPad);
- }
- if (!linux_vibrate(&g.PadState[CurPad]))
+ if (g.PadState[CurPad].VibrateDev == -1 &&
+ g.PadState[CurPad].JoyDev != NULL) {
+ linux_set_vibrate(CurPad);
+ }
+ if (!linux_vibrate(&g.PadState[CurPad]))
/* only do visual if joy fails */
#endif
- if (!JoyHapticRumble(CurPad, g.PadState[CurPad].VibF[0], g.PadState[CurPad].VibF[1]) && gpuVisualVibration != NULL)
- gpuVisualVibration(g.PadState[CurPad].VibF[0], g.PadState[CurPad].VibF[1]);
+ if (!JoyHapticRumble(CurPad, g.PadState[CurPad].VibF[0], g.PadState[CurPad].VibF[1])) {
+ //gpuVisualVibration(g.PadState[CurPad].VibF[0], g.PadState[CurPad].VibF[1]);
+ }
+
+ if(gpuVisualVibration != NULL &&
+ g.cfg.PadDef[CurPad].VisualVibration) {
+ gpuVisualVibration(g.PadState[CurPad].VibF[0], g.PadState[CurPad].VibF[1]);
+ }
}
}
}
diff --git a/plugins/dfinput/pad.h b/plugins/dfinput/pad.h index 06913c4c..f39e231e 100644 --- a/plugins/dfinput/pad.h +++ b/plugins/dfinput/pad.h @@ -115,6 +115,7 @@ enum { ANALOG_XP = 0, ANALOG_XM, ANALOG_YP, ANALOG_YM }; typedef struct tagPadDef {
int8_t DevNum;
uint16_t Type;
+ uint8_t VisualVibration;
KEYDEF KeyDef[DKEY_TOTAL];
KEYDEF AnalogDef[ANALOG_TOTAL][4];
} PADDEF;
|
