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/Makefile.am | 26 ++++++- plugins/dfinput/cfg-gtk.c | 4 +- plugins/dfinput/dfinput.ui | 160 ++++++++++++++++++++------------------------ 3 files changed, 98 insertions(+), 92 deletions(-) (limited to 'plugins/dfinput') diff --git a/plugins/dfinput/Makefile.am b/plugins/dfinput/Makefile.am index 70f86fd1..11eee3eb 100644 --- a/plugins/dfinput/Makefile.am +++ b/plugins/dfinput/Makefile.am @@ -13,9 +13,29 @@ AM_CPPFLAGS = -DLOCALE_DIR=\"${datadir}/locale/\" \ -I../../include -I$(top_srcdir)/libpcsxcore $(SDL2_CFLAGS) $(SDL_CFLAGS) bin_PROGRAMS = cfgDFInput -cfgDFInput_SOURCES = cfg-gtk.c pad.h +cfgDFInput_SOURCES = cfg-gtk.c pad.h GtkResources.c GtkResources.h cfgDFInput_LDADD = $(GTK3_LIBS) $(SDL2_LIBS) $(SDL_LIBS) -lX11 -glade_DATA = dfinput.ui -gladedir = $(datadir)/psemu/ +# gresource.xml is dynamically generated in CMake. Mirror that here in a static way. +define gresource_xml = + + + + dfinput.ui + + +endef + +dfinput.gresource.xml: + $(file >$@,$(gresource_xml)) +dfinput_gresource: dfinput.gresource.xml + $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) --generate-dependencies $(srcdir)/$<) +GtkResources.c: dfinput.gresource.xml $(dfinput_gresource) + $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source --c-name dfinput $< +GtkResources.h: dfinput.gresource.xml $(dfinput_gresource) + $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-header --c-name dfinput $< + + +#glade_DATA = dfinput.ui +#gladedir = $(datadir)/psemu/ EXTRA_DIST = $(glade_DATA) diff --git a/plugins/dfinput/cfg-gtk.c b/plugins/dfinput/cfg-gtk.c index 5f26040f..61218cea 100755 --- a/plugins/dfinput/cfg-gtk.c +++ b/plugins/dfinput/cfg-gtk.c @@ -246,7 +246,6 @@ static void UpdateKeyList() { gtk_tree_view_set_model(GTK_TREE_VIEW(widget), GTK_TREE_MODEL(store)); g_object_unref(G_OBJECT(store)); - gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(widget), TRUE); gtk_widget_show(widget); } } @@ -655,7 +654,7 @@ long PADconfigure() { xml = gtk_builder_new(); - if (!gtk_builder_add_from_file(xml, DATADIR "dfinput.ui", NULL)) { + if (!gtk_builder_add_from_resource(xml, "/org/pcsxr/dfinput/dfinput.ui", NULL)) { g_warning("We could not load the interface!"); return -1; } @@ -837,6 +836,7 @@ void PADabout() { GtkWidget *widget; widget = gtk_about_dialog_new(); + gtk_about_dialog_set_logo_icon_name (GTK_ABOUT_DIALOG(widget), "help-about"); gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(widget), "Gamepad/Keyboard Input"); gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(widget), "1.2"); gtk_about_dialog_set_authors(GTK_ABOUT_DIALOG(widget), authors); 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 f48b5b2ac35ee69db0c0ffd3f411ffc21b7d5789 Mon Sep 17 00:00:00 2001 From: Stelios Tsampas Date: Mon, 17 Jul 2017 23:22:35 +0300 Subject: * Add configuration UI for PGXP. * Clean generated files with `make clean` --- gui/ConfDlg.c | 83 ++++++++++++ gui/Makefile.am | 2 + gui/data/pcsxr.ui | 294 +++++++++++++++++++++++++++++++++++++++++- plugins/bladesio1/Makefile.am | 3 + plugins/dfcdrom/Makefile.am | 3 + plugins/dfinput/Makefile.am | 2 + plugins/dfnet/Makefile.am | 2 + plugins/dfsound/Makefile.am | 3 + plugins/dfxvideo/Makefile.am | 3 + plugins/peopsxgl/Makefile.am | 3 + 10 files changed, 396 insertions(+), 2 deletions(-) (limited to 'plugins/dfinput') diff --git a/gui/ConfDlg.c b/gui/ConfDlg.c index 30d3df1f..529e2722 100755 --- a/gui/ConfDlg.c +++ b/gui/ConfDlg.c @@ -845,6 +845,7 @@ static void FindNetPlugin() { } GtkWidget *CpuDlg; +GtkWidget *PgxpDlg; GList *psxglist; char *psxtypes[] = { "NTSC", @@ -1033,5 +1034,87 @@ void OnConf_Cpu() { G_CALLBACK(OnCpu_Clicked), builder, (GClosureNotify)g_object_unref, G_CONNECT_AFTER); } +//When a different mode is selected, display some informational text +static void OnPgxp_ModeChanged(GtkWidget *widget, gpointer user_data) { + uint8_t mode; + + mode = gtk_combo_box_get_active(GTK_COMBO_BOX( + gtk_builder_get_object(builder, "PGXP_Mode"))); + + switch (mode) { + case 0: + gtk_label_set_text(GTK_LABEL(gtk_builder_get_object(builder, "PGXP_Mode_title")), + _("Disabled")); + gtk_label_set_text(GTK_LABEL(gtk_builder_get_object(builder, "PGXP_Mode_description")), + _("PGXP is not mirroring any functions currently.")); + break; + case 1: + gtk_label_set_text(GTK_LABEL(gtk_builder_get_object(builder, "PGXP_Mode_title")), + _("Memory operations only")); + gtk_label_set_text(GTK_LABEL(gtk_builder_get_object(builder, "PGXP_Mode_description")), + _("PGXP is mirroring load, store and processor transfer operations of the CPU and GTE.")); + break; + case 2: + gtk_label_set_text(GTK_LABEL(gtk_builder_get_object(builder, "PGXP_Mode_title")), + _("Memory and CPU arithmetic operations")); + gtk_label_set_text(GTK_LABEL(gtk_builder_get_object(builder, "PGXP_Mode_description")), + _("PGXP is mirroring load, store and transfer operations of the CPU and GTE and arithmetic/logic functions of the PSX CPU.\n(WARNING: This mode is currently unfinished and may cause incorrect behaviour in some games).")); + break; + default: + gtk_label_set_text(GTK_LABEL(gtk_builder_get_object(builder, "PGXP_Mode_title")), + _("Error")); + gtk_label_set_text(GTK_LABEL(gtk_builder_get_object(builder, "PGXP_Mode_description")), + _("Unknown mode.")); + } +} + +static void OnPgxp_Clicked(GtkDialog *dialog, gint arg1, gpointer user_data) { + + Config.PGXP_GTE = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON( + gtk_builder_get_object(builder, "PGXP_GTE"))); + Config.PGXP_Cache = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON( + gtk_builder_get_object(builder, "PGXP_Cache"))); + Config.PGXP_Texture = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON( + gtk_builder_get_object(builder, "PGXP_Texture"))); + + Config.PGXP_Mode = gtk_combo_box_get_active(GTK_COMBO_BOX( + gtk_builder_get_object(builder, "PGXP_Mode"))); + + EmuSetPGXPMode(Config.PGXP_Mode); + SaveConfig(); + + gtk_widget_destroy(PgxpDlg); + PgxpDlg = NULL; +} + void OnConf_Pgxp() { + GtkWidget *widget; + char buf[25]; + + builder = gtk_builder_new(); + + if (!gtk_builder_add_from_resource(builder, "/org/pcsxr/gui/pcsxr.ui", NULL)) { + g_warning("Error: interface could not be loaded!"); + return; + } + + PgxpDlg = GTK_WIDGET(gtk_builder_get_object(builder, "PgxpDlg")); + gtk_window_set_default_size(GTK_WINDOW(PgxpDlg), 320, 320); + gtk_widget_show (PgxpDlg); + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( + gtk_builder_get_object(builder, "PGXP_GTE")), Config.PGXP_GTE); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( + gtk_builder_get_object(builder, "PGXP_Cache")), Config.PGXP_Cache); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON( + gtk_builder_get_object(builder, "PGXP_Texture")), Config.PGXP_Texture); + + gtk_combo_box_set_active(GTK_COMBO_BOX( + gtk_builder_get_object(builder, "PGXP_Mode")), Config.PGXP_Mode); + OnPgxp_ModeChanged(NULL, NULL); + + g_signal_connect_data(G_OBJECT(gtk_builder_get_object(builder, "PGXP_Mode")), "changed", + G_CALLBACK(OnPgxp_ModeChanged), builder, NULL, G_CONNECT_AFTER); + g_signal_connect_data(G_OBJECT(PgxpDlg), "response", + G_CALLBACK(OnPgxp_Clicked), builder, (GClosureNotify)g_object_unref, G_CONNECT_AFTER); } diff --git a/gui/Makefile.am b/gui/Makefile.am index ebae1d48..7db62f01 100644 --- a/gui/Makefile.am +++ b/gui/Makefile.am @@ -77,3 +77,5 @@ GtkResources.h: pcsxr.gresource.xml $(pcsxr_gresource) pcsxr_LDADD = \ ../libpcsxcore/libpcsxcore.a \ $(GTK3_LIBS) -lpthread -lz -lm -lXext -lXtst + +CLEANFILES = pcsxr.gresource.xml GtkResources.c GtkResources.h diff --git a/gui/data/pcsxr.ui b/gui/data/pcsxr.ui index 6cc4b24f..35937bfb 100644 --- a/gui/data/pcsxr.ui +++ b/gui/data/pcsxr.ui @@ -1,5 +1,5 @@ - + @@ -32,6 +32,9 @@ + + + False @@ -214,6 +217,9 @@ closbutton1 + + + False @@ -919,6 +925,9 @@ btn_ConfClose + + + False @@ -1731,6 +1740,9 @@ McdClose + + + False @@ -2013,6 +2025,9 @@ memview_close + + + False @@ -2169,6 +2184,9 @@ closebutton2 + + + True @@ -2239,7 +2257,6 @@ True False - 0.49000000953674316 pcsxr-cd-open 1 @@ -2303,6 +2320,12 @@ pcsxr-plugin-sio1 1 + + True + False + pcsxr-pgxp + 1 + True False @@ -2835,6 +2858,23 @@ False + + + _PGXP... + True + False + True + image43 + False + + + + + + True + False + + _CPU... @@ -3128,6 +3168,9 @@ + + + @@ -3745,6 +3788,9 @@ closebutton + + + @@ -4417,5 +4463,249 @@ closebutton1 + + + + + + + + + + + + Disabled + + + Memory only + + + Memory + Cpu logic + + + + + False + Configure PGXP + False + True + center-on-parent + dialog + + + False + vertical + + + False + end + + + gtk-close + True + True + True + True + + + False + False + 0 + + + + + False + False + 1 + + + + + True + False + vertical + 5 + + + True + False + 0 + + + True + False + 12 + + + True + False + vertical + + + Enable PGXP GTE vertex creation + True + True + False + True + + + False + True + 0 + + + + + Enable vertex caching. + True + True + False + True + + + False + True + 1 + + + + + Enable perspective correct texturing. + True + True + False + True + + + False + True + 2 + + + + + + + + + True + False + Options + + + + + + + + False + True + 0 + + + + + True + False + 0 + + + True + False + 12 + + + True + False + vertical + top + + + True + False + 40 + 40 + liststore6 + + + + 0 + + + + + False + True + 0 + + + + + True + False + start + 4 + 4 + + + + + + False + True + 1 + + + + + True + False + 10 + True + 20 + + + True + True + 2 + + + + + + + + + True + False + Select PGXP Mode + + + + + + + + True + True + 1 + + + + + True + True + 0 + + + + + + PgxpDlg_close + + + + diff --git a/plugins/bladesio1/Makefile.am b/plugins/bladesio1/Makefile.am index 880aa647..badd57e5 100644 --- a/plugins/bladesio1/Makefile.am +++ b/plugins/bladesio1/Makefile.am @@ -38,3 +38,6 @@ GtkResources.h: bladesio1.gresource.xml $(bladesio1_gresource) #glade_DATA = sio1.ui #gladedir = $(datadir)/psemu/ EXTRA_DIST = $(glade_DATA) + +CLEANFILES = bladesio1.gresource.xml GtkResources.c GtkResources.h + diff --git a/plugins/dfcdrom/Makefile.am b/plugins/dfcdrom/Makefile.am index 4b3dec4b..1f87998b 100644 --- a/plugins/dfcdrom/Makefile.am +++ b/plugins/dfcdrom/Makefile.am @@ -53,3 +53,6 @@ GtkResources.h: dfcdrom.gresource.xml $(dfcdrom_gresource) #glade_DATA = cdrcfg-0.1df/dfcdrom.ui #gladedir = $(datadir)/psemu/ EXTRA_DIST = $(glade_DATA) + +CLEANFILES = dfcdrom.gresource.xml GtkResources.c GtkResources.h + diff --git a/plugins/dfinput/Makefile.am b/plugins/dfinput/Makefile.am index 11eee3eb..458259c5 100644 --- a/plugins/dfinput/Makefile.am +++ b/plugins/dfinput/Makefile.am @@ -39,3 +39,5 @@ GtkResources.h: dfinput.gresource.xml $(dfinput_gresource) #glade_DATA = dfinput.ui #gladedir = $(datadir)/psemu/ EXTRA_DIST = $(glade_DATA) + +CLEANFILES = dfinput.gresource.xml GtkResources.c GtkResources.h diff --git a/plugins/dfnet/Makefile.am b/plugins/dfnet/Makefile.am index 4000b8c4..f0a53ea0 100755 --- a/plugins/dfnet/Makefile.am +++ b/plugins/dfnet/Makefile.am @@ -38,3 +38,5 @@ GtkResources.h: dfnet.gresource.xml $(dfnet_gresource) #glade_DATA = dfnet.ui #gladedir = $(datadir)/psemu/ EXTRA_DIST = $(glade_DATA) + +CLEANFILES = dfnet.gresource.xml GtkResources.c GtkResources.h diff --git a/plugins/dfsound/Makefile.am b/plugins/dfsound/Makefile.am index b34f3267..9f8130a1 100755 --- a/plugins/dfsound/Makefile.am +++ b/plugins/dfsound/Makefile.am @@ -74,3 +74,6 @@ GtkResources.h: dfsound.gresource.xml $(dfsound_gresource) #glade_DATA = spucfg-0.1df/dfsound.ui #gladedir = $(datadir)/psemu/ EXTRA_DIST = $(glade_DATA) + +CLEANFILES = dfsound.gresource.xml GtkResources.c GtkResources.h + diff --git a/plugins/dfxvideo/Makefile.am b/plugins/dfxvideo/Makefile.am index 86e8ef3a..520749b2 100755 --- a/plugins/dfxvideo/Makefile.am +++ b/plugins/dfxvideo/Makefile.am @@ -52,3 +52,6 @@ GtkResources.h: dfxvideo.gresource.xml $(dfxvideo_gresource) #glade_DATA = gpucfg-0.1df/dfxvideo.ui #gladedir = $(datadir)/psemu/ EXTRA_DIST = $(glade_DATA) + +CLEANFILES = dfxvideo.gresource.xml GtkResources.c GtkResources.h + diff --git a/plugins/peopsxgl/Makefile.am b/plugins/peopsxgl/Makefile.am index a37643e6..576e140d 100755 --- a/plugins/peopsxgl/Makefile.am +++ b/plugins/peopsxgl/Makefile.am @@ -52,3 +52,6 @@ GtkResources.h: peopsxgl.gresource.xml $(peopsxgl_gresource) #glade_DATA = gpucfg/peopsxgl.ui #gladedir = $(datadir)/psemu/ EXTRA_DIST = $(glade_DATA) + +CLEANFILES = peopsxgl.gresource.xml GtkResources.c GtkResources.h + -- 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') 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 From db51fade6de9461e7a139da2bf5887a9a6569506 Mon Sep 17 00:00:00 2001 From: Stelios Tsampas Date: Thu, 20 Jul 2017 13:04:40 +0300 Subject: * dfinput: Fix possible buffer overflows in the ui. --- plugins/dfinput/cfg-gtk.c | 4 ++-- plugins/dfinput/pad.c | 18 ++++++++++++------ plugins/dfinput/sdljoy.c | 2 +- plugins/dfinput/xkb.c | 4 ++-- 4 files changed, 17 insertions(+), 11 deletions(-) (limited to 'plugins/dfinput') diff --git a/plugins/dfinput/cfg-gtk.c b/plugins/dfinput/cfg-gtk.c index 6d053af7..bcc733d1 100755 --- a/plugins/dfinput/cfg-gtk.c +++ b/plugins/dfinput/cfg-gtk.c @@ -624,9 +624,9 @@ static void PopulateDevList() { for (j = 0; j < n; j++) { #if SDL_VERSION_ATLEAST(2, 0, 0) SDL_Joystick *joystick = SDL_JoystickOpen(j); - sprintf(buf, "%d: %s", j + 1, SDL_JoystickName(joystick)); + snprintf(buf, sizeof(buf), "%d: %s", j + 1, SDL_JoystickName(joystick)); #else - sprintf(buf, "%d: %s", j + 1, SDL_JoystickName(j)); + snprintf(buf, sizeof(buf), "%d: %s", j + 1, SDL_JoystickName(j)); #endif gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, buf, -1); diff --git a/plugins/dfinput/pad.c b/plugins/dfinput/pad.c index bd3aef73..8861ec4d 100755 --- a/plugins/dfinput/pad.c +++ b/plugins/dfinput/pad.c @@ -17,11 +17,15 @@ */ #include "pad.h" -#if !SDL_VERSION_ATLEAST(2,0,0) && defined(__linux__) +#if defined(__linux__) +#include +#include +#if !SDL_VERSION_ATLEAST(2,0,0) #include #include #include #endif +#endif #if SDL_VERSION_ATLEAST(2,0,0) int has_haptic; @@ -121,11 +125,13 @@ long PADopen(unsigned long *Disp) { } #if SDL_VERSION_ATLEAST(2,0,0) - SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER); - - has_haptic = 0; - if (SDL_InitSubSystem(SDL_INIT_HAPTIC) == 0) - has_haptic = 1; + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); + if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == -1) + return PSE_PAD_ERR_FAILURE; + + has_haptic = 0; + if (SDL_InitSubSystem(SDL_INIT_HAPTIC) == 0) + has_haptic = 1; #endif InitSDLJoy(); diff --git a/plugins/dfinput/sdljoy.c b/plugins/dfinput/sdljoy.c index d9bc23a3..3e8cc993 100755 --- a/plugins/dfinput/sdljoy.c +++ b/plugins/dfinput/sdljoy.c @@ -74,7 +74,7 @@ int JoyHapticRumble(int pad, uint32_t low, uint32_t high) if(SDL_HapticRumblePlay(g.PadState[pad].haptic, mag, 500) != 0) { - printf("\nFailed to play rumble: %s\n", SDL_GetError()); + printf("\nFailed to play rumble on pad %d with error: %s\n", pad, SDL_GetError()); return 1; } } diff --git a/plugins/dfinput/xkb.c b/plugins/dfinput/xkb.c index 53fb90d4..47eac669 100755 --- a/plugins/dfinput/xkb.c +++ b/plugins/dfinput/xkb.c @@ -46,7 +46,7 @@ void InitKeyboard() { resumeScrSaver = 0; if (g.cfg.PreventScrSaver) { char buf[64]; - snprintf(buf, 64, "xdg-screensaver suspend 0x%x > /dev/null 2>&1", window); + snprintf(buf, sizeof(buf), "xdg-screensaver suspend 0x%x > /dev/null 2>&1", window); if (pclose(popen(buf, "r")) == 0) { resumeScrSaver = 1; printf("Suspending Window ID 0x%x of activating screensaver.\n", window); @@ -79,7 +79,7 @@ void DestroyKeyboard() { if (resumeScrSaver) { char buf[64]; printf("Resuming Window ID 0x%x to activate screensaver.\n", window); - snprintf(buf, 64, "xdg-screensaver resume 0x%x", window); + snprintf(buf, sizeof(buf), "xdg-screensaver resume 0x%x", window); FILE *phandle = popen(buf, "r"); pclose(phandle); } -- cgit v1.2.3 From b117a70fd03d780b5817c635d5c337c6ecc36d94 Mon Sep 17 00:00:00 2001 From: Stelios Tsampas Date: Fri, 28 Jul 2017 13:13:09 +0300 Subject: * Plugin.c: Add PGXP visual debug binding (F11) * GtkGui.c: Fix path saving in file selection dialog * LnxMain.c: Don't look for bios in data directory --- gui/GtkGui.c | 5 ++--- gui/LnxMain.c | 2 -- gui/Plugin.c | 5 +++++ plugins/dfinput/pad.c | 8 +++----- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'plugins/dfinput') diff --git a/gui/GtkGui.c b/gui/GtkGui.c index 970be43b..0fd6b65d 100755 --- a/gui/GtkGui.c +++ b/gui/GtkGui.c @@ -34,6 +34,7 @@ #include "../libpcsxcore/plugins.h" #include "../libpcsxcore/cheat.h" +#include "../libpcsxcore/cdrom.h" #include "MemcardDlg.h" #include "ConfDlg.h" @@ -775,11 +776,9 @@ static gchar *Open_Iso_Proc() { strncpy(current_folder, filename, strrchr(filename, '/') - filename); } - /* If ISO path is NULL save current path. */ - if (!S_ISDIR(sb.st_mode)) { + /* Save current path. */ strcpy(Config.IsoImgDir, current_folder); SaveConfig(); - } /* free useless data */ GSList * ll = l; diff --git a/gui/LnxMain.c b/gui/LnxMain.c index 716a3964..a7f934ae 100755 --- a/gui/LnxMain.c +++ b/gui/LnxMain.c @@ -232,9 +232,7 @@ static void ScanAllPlugins (void) { ScanBios("/usr/local/share/psemu/bios"); ScanBios("/usr/local/share/pcsxr"); ScanBios("/usr/local/share/pcsxr/bios"); - ScanBios(PACKAGE_DATA_DIR); ScanBios(PSEMU_DATA_DIR); - ScanBios(PACKAGE_DATA_DIR "/bios"); ScanBios(PSEMU_DATA_DIR "/bios"); currentdir = g_strconcat(getenv("HOME"), "/.psemu-plugins/", NULL); diff --git a/gui/Plugin.c b/gui/Plugin.c index 0adf3b5e..55068c31 100755 --- a/gui/Plugin.c +++ b/gui/Plugin.c @@ -30,6 +30,7 @@ #include "../libpcsxcore/plugins.h" #include "../libpcsxcore/spu.h" #include "../libpcsxcore/cdriso.h" +#include "../libpcsxcore/pgxp_mem.h" #include "nopic.h" @@ -241,6 +242,9 @@ void PADhandleKey(int key) { LidInterrupt(); break; + case XK_F11: + GPU_toggleDebug(); + break; case XK_F12: psxReset(); break; @@ -329,6 +333,7 @@ int _OpenPlugins() { SPU_registerCallback(SPUirq); ret = GPU_open(&gpuDisp, "PCSXR", NULL); if (ret < 0) { SysMessage(_("Error opening GPU plugin!")); return -1; } + GPU_pgxpMemory(0, PGXP_GetMem()); ret = PAD1_open(&gpuDisp); ret |= PAD1_init(1); // Allow setting to change during run if (ret < 0) { SysMessage(_("Error opening Controller 1 plugin!")); return -1; } diff --git a/plugins/dfinput/pad.c b/plugins/dfinput/pad.c index 8861ec4d..f413d0a4 100755 --- a/plugins/dfinput/pad.c +++ b/plugins/dfinput/pad.c @@ -125,9 +125,7 @@ long PADopen(unsigned long *Disp) { } #if SDL_VERSION_ATLEAST(2,0,0) - SDL_QuitSubSystem(SDL_INIT_JOYSTICK); - if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER) == -1) - return PSE_PAD_ERR_FAILURE; + SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER); has_haptic = 0; if (SDL_InitSubSystem(SDL_INIT_HAPTIC) == 0) @@ -497,7 +495,7 @@ unsigned char PADpoll(unsigned char value) { if (buf == NULL) { return 0; } - + switch (CurCmd) { case CMD_READ_DATA_AND_VIBRATE: if (g.cfg.PadDef[CurPad].Type == PSE_PAD_TYPE_ANALOGPAD) { @@ -516,7 +514,7 @@ unsigned char PADpoll(unsigned char value) { 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]); -- cgit v1.2.3