From a96eefdf0f10a9a051e65f6e88a24dc3abe40fc5 Mon Sep 17 00:00:00 2001 From: Stelios Tsampas Date: Mon, 17 Jul 2017 17:32:35 +0300 Subject: * Bring pluing Linux(gtk) interfaces up to date. --- plugins/dfinput/dfinput.ui | 160 +++++++++++++++++++++------------------------ 1 file changed, 73 insertions(+), 87 deletions(-) (limited to 'plugins/dfinput/dfinput.ui') diff --git a/plugins/dfinput/dfinput.ui b/plugins/dfinput/dfinput.ui index 17dfbdb9..f189d8b3 100644 --- a/plugins/dfinput/dfinput.ui +++ b/plugins/dfinput/dfinput.ui @@ -1,23 +1,58 @@ + - + + + + + + + + + Digital Pad + + + Analog Pad + + + Mouse + + + + + + + + + + + Digital Pad + + + Analog Pad + + + Mouse + + + False - + True False 5 - 2 True True - + True False 5 + vertical 2 @@ -29,14 +64,12 @@ True False - 0 Device: + 0 0 0 - 1 - 1 @@ -47,22 +80,18 @@ 1 0 - 1 - 1 True False - 0 Type: + 0 0 1 - 1 - 1 @@ -80,8 +109,6 @@ 1 1 - 1 - 1 @@ -113,7 +140,6 @@ True True 5 - True etched-in @@ -132,7 +158,7 @@ - + True False 20 @@ -143,7 +169,7 @@ True True - + True False @@ -151,7 +177,7 @@ True False gtk-edit - 1 + 1 True @@ -186,7 +212,7 @@ True True - + True False @@ -194,7 +220,7 @@ True False gtk-undo - 1 + 1 True @@ -243,10 +269,11 @@ - + True False 5 + vertical 2 @@ -258,14 +285,12 @@ True False - 0 Device: + 0 0 0 - 1 - 1 @@ -276,22 +301,18 @@ 1 0 - 1 - 1 True False - 0 Type: + 0 0 1 - 1 - 1 @@ -309,8 +330,6 @@ 1 1 - 1 - 1 @@ -342,7 +361,6 @@ True True 5 - True etched-in @@ -361,7 +379,7 @@ - + True False 20 @@ -372,7 +390,7 @@ True True - + True False @@ -380,7 +398,7 @@ True False gtk-edit - 1 + 1 True @@ -415,7 +433,7 @@ True True - + True False @@ -423,7 +441,7 @@ True False gtk-undo - 1 + 1 True @@ -471,14 +489,16 @@ Controller 2 + 1 False - + True False 5 + vertical 2 @@ -490,14 +510,12 @@ True False - 0 Device: + 0 0 0 - 1 - 1 @@ -508,8 +526,6 @@ 1 0 - 1 - 1 @@ -526,7 +542,6 @@ True True 5 - True etched-in @@ -545,7 +560,7 @@ - + True False 20 @@ -556,7 +571,7 @@ True True - + True False @@ -564,7 +579,7 @@ True False gtk-edit - 1 + 1 True @@ -599,7 +614,7 @@ True True - + True False @@ -607,7 +622,7 @@ True False gtk-undo - 1 + 1 True @@ -655,14 +670,16 @@ Emulator keys + 2 False - + True False 5 + vertical 5 @@ -726,9 +743,13 @@ + + 0 + 0 + - + True False end @@ -748,46 +769,11 @@ + 0 1 - 2 - GTK_FILL - - - - - - - - Digital Pad - - - Analog Pad - - - Mouse - - - - - - - - - - - Digital Pad - - - Analog Pad - - - Mouse - - - -- cgit v1.2.3 From b6129143f75cf4480883e467d52627de949466fb Mon Sep 17 00:00:00 2001 From: Stelios Tsampas Date: Tue, 18 Jul 2017 23:23:47 +0300 Subject: * Add setting to disable physical gamepad vibration. --- plugins/dfinput/cfg-gtk.c | 25 +++++++++++++ plugins/dfinput/cfg.c | 5 +++ plugins/dfinput/dfinput.ui | 87 ++++++++++++++++++++++++++++++++++------------ plugins/dfinput/pad.h | 1 + plugins/dfinput/sdljoy.c | 2 +- 5 files changed, 97 insertions(+), 23 deletions(-) (limited to 'plugins/dfinput/dfinput.ui') diff --git a/plugins/dfinput/cfg-gtk.c b/plugins/dfinput/cfg-gtk.c index 61218cea..6d053af7 100755 --- a/plugins/dfinput/cfg-gtk.c +++ b/plugins/dfinput/cfg-gtk.c @@ -326,6 +326,7 @@ static void OnDeviceChanged(GtkWidget *widget, gpointer user_data) { static void OnTypeChanged(GtkWidget *widget, gpointer user_data) { uint n = GPOINTER_TO_UINT(user_data), current = gtk_combo_box_get_active(GTK_COMBO_BOX(widget)); + char checkbtn[9]; int padTypeList[] = { PSE_PAD_TYPE_STANDARD, @@ -335,6 +336,10 @@ static void OnTypeChanged(GtkWidget *widget, gpointer user_data) { g.cfg.PadDef[n].Type = padTypeList[current]; + snprintf(checkbtn, sizeof(checkbtn), "checkpv%d", n+1); + gtk_widget_set_sensitive(GTK_WIDGET( + gtk_builder_get_object(xml, checkbtn)), (g.cfg.PadDef[n].Type == PSE_PAD_TYPE_ANALOGPAD)); + UpdateKeyList(); } @@ -350,6 +355,14 @@ static void OnVisualVibration2Toggled(GtkWidget *widget, gpointer user_data) { g.cfg.PadDef[1].VisualVibration = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); } +static void OnPhysicalVibration1Toggled(GtkWidget *widget, gpointer user_data) { + g.cfg.PadDef[0].PhysicalVibration = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); +} + +static void OnPhysicalVibration2Toggled(GtkWidget *widget, gpointer user_data) { + g.cfg.PadDef[1].PhysicalVibration = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); +} + static void OnHideCursorToggled(GtkWidget *widget, gpointer user_data) { (void)user_data; // unused g.cfg.HideCursor = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); @@ -747,12 +760,14 @@ long PADconfigure() { widget = GTK_WIDGET(gtk_builder_get_object(xml, "combotype1")); gtk_combo_box_set_active(GTK_COMBO_BOX(widget), padTypeList[g.cfg.PadDef[0].Type]); + OnTypeChanged(widget, GUINT_TO_POINTER(0u)); g_signal_connect_data(G_OBJECT(widget), "changed", G_CALLBACK(OnTypeChanged), GUINT_TO_POINTER(0u), NULL, G_CONNECT_AFTER); widget = GTK_WIDGET(gtk_builder_get_object(xml, "combotype2")); gtk_combo_box_set_active(GTK_COMBO_BOX(widget), padTypeList[g.cfg.PadDef[1].Type]); + OnTypeChanged(widget, GUINT_TO_POINTER(1u)); g_signal_connect_data(G_OBJECT(widget), "changed", G_CALLBACK(OnTypeChanged), GUINT_TO_POINTER(1u), NULL, G_CONNECT_AFTER); @@ -766,6 +781,16 @@ long PADconfigure() { g_signal_connect_data(G_OBJECT(widget), "toggled", G_CALLBACK(OnVisualVibration2Toggled), NULL, NULL, G_CONNECT_AFTER); + widget = GTK_WIDGET(gtk_builder_get_object(xml, "checkpv1")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), g.cfg.PadDef[0].PhysicalVibration); + g_signal_connect_data(G_OBJECT(widget), "toggled", + G_CALLBACK(OnPhysicalVibration1Toggled), NULL, NULL, G_CONNECT_AFTER); + + widget = GTK_WIDGET(gtk_builder_get_object(xml, "checkpv2")); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), g.cfg.PadDef[1].PhysicalVibration); + g_signal_connect_data(G_OBJECT(widget), "toggled", + G_CALLBACK(OnPhysicalVibration2Toggled), NULL, NULL, G_CONNECT_AFTER); + widget = GTK_WIDGET(gtk_builder_get_object(xml, widgetname_change[1])); gtk_widget_set_sensitive(widget, FALSE); g_signal_connect_data(G_OBJECT(widget), "clicked", diff --git a/plugins/dfinput/cfg.c b/plugins/dfinput/cfg.c index f1d16673..622c3c34 100755 --- a/plugins/dfinput/cfg.c +++ b/plugins/dfinput/cfg.c @@ -37,6 +37,8 @@ static void SetDefaultConfig() { g.cfg.PadDef[0].VisualVibration = 0; g.cfg.PadDef[1].VisualVibration = 0; + g.cfg.PadDef[0].PhysicalVibration = 1; + g.cfg.PadDef[1].PhysicalVibration = 1; // Pad1 keyboard g.cfg.PadDef[0].KeyDef[DKEY_SELECT].Key = XK_c; @@ -164,6 +166,8 @@ void LoadPADConfig() { 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, "PhysicalVibration=", 18) == 0) { + g.cfg.PadDef[current].PhysicalVibration = atoi(&buf[18]); } else if (strncmp(buf, "EmuDev=", 7) == 0) { g.cfg.E.DevNum = atoi(&buf[5]); } else if (strncmp(buf, "EMU_FASTFORWARDS=", 17) == 0) { @@ -362,6 +366,7 @@ void SavePADConfig() { 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, "PhysicalVibration=%d\n", g.cfg.PadDef[i].PhysicalVibration); 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); diff --git a/plugins/dfinput/dfinput.ui b/plugins/dfinput/dfinput.ui index f189d8b3..2d291e22 100644 --- a/plugins/dfinput/dfinput.ui +++ b/plugins/dfinput/dfinput.ui @@ -1,7 +1,7 @@ - + - + @@ -65,7 +65,6 @@ True False Device: - 0 0 @@ -87,7 +86,6 @@ True False Type: - 0 0 @@ -119,13 +117,37 @@ - - Visual vibration + True - True - False - 0 - True + False + + + Visual vibration + True + True + False + True + + + False + True + 0 + + + + + Physical vibration + True + True + False + True + + + False + True + 1 + + False @@ -286,7 +308,6 @@ True False Device: - 0 0 @@ -308,7 +329,6 @@ True False Type: - 0 0 @@ -340,13 +360,37 @@ - - Visual vibration + True - True - False - 0 - True + False + + + Visual vibration + True + True + False + True + + + False + True + 0 + + + + + Physical vibration + True + True + False + True + + + False + True + 1 + + False @@ -511,7 +555,6 @@ True False Device: - 0 0 @@ -687,7 +730,6 @@ True True False - 0 True @@ -702,7 +744,6 @@ True True False - 0 True @@ -717,7 +758,6 @@ True True False - 0 True @@ -775,5 +815,8 @@ + + + diff --git a/plugins/dfinput/pad.h b/plugins/dfinput/pad.h index 7cd8eefe..3051e6ad 100755 --- a/plugins/dfinput/pad.h +++ b/plugins/dfinput/pad.h @@ -158,6 +158,7 @@ typedef struct tagPadDef { int8_t DevNum; uint16_t Type; uint8_t VisualVibration; + uint8_t PhysicalVibration; KEYDEF KeyDef[DKEY_TOTAL]; KEYDEF AnalogDef[ANALOG_TOTAL][4]; #if SDL_VERSION_ATLEAST(2,0,0) diff --git a/plugins/dfinput/sdljoy.c b/plugins/dfinput/sdljoy.c index ee139517..d9bc23a3 100755 --- a/plugins/dfinput/sdljoy.c +++ b/plugins/dfinput/sdljoy.c @@ -64,7 +64,7 @@ int JoyHapticRumble(int pad, uint32_t low, uint32_t high) #if SDL_VERSION_ATLEAST(2,0,0) float mag; - if (g.PadState[pad].haptic) { + if (g.PadState[pad].haptic && g.cfg.PadDef[pad].PhysicalVibration) { /* Stop the effect if it was playing. */ SDL_HapticRumbleStop(g.PadState[pad].haptic); -- cgit v1.2.3