diff --git a/plugins/zeropad/Linux/callbacks.c b/plugins/zeropad/Linux/callbacks.c new file mode 100644 index 0000000000..e3a92ed51e --- /dev/null +++ b/plugins/zeropad/Linux/callbacks.c @@ -0,0 +1,114 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "callbacks.h" +#include "interface.h" +#include "support.h" + + +void +OnConf_Pad1 (GtkButton *button, + gpointer user_data) +{ + +} + + +void +OnConf_Pad2 (GtkButton *button, + gpointer user_data) +{ + +} + + +void +OnConf_Pad3 (GtkButton *button, + gpointer user_data) +{ + +} + + +void +OnConf_Pad4 (GtkButton *button, + gpointer user_data) +{ + +} + + +void +on_joydevicescombo_changed (GtkComboBox *combobox, + gpointer user_data) +{ + +} + + +void +OnConf_Key (GtkButton *button, + gpointer user_data) +{ + +} + + +void +on_checkbutton_reverselx_toggled (GtkToggleButton *togglebutton, + gpointer user_data) +{ + +} + + +void +on_checkbutton_reversely_toggled (GtkToggleButton *togglebutton, + gpointer user_data) +{ + +} + + +void +on_checkbutton_reverserx_toggled (GtkToggleButton *togglebutton, + gpointer user_data) +{ + +} + + +void +on_checkbutton_reversery_toggled (GtkToggleButton *togglebutton, + gpointer user_data) +{ + +} + + +void +on_forcefeedback_toggled (GtkToggleButton *togglebutton, + gpointer user_data) +{ + +} + + +void +OnConf_Cancel (GtkButton *button, + gpointer user_data) +{ + +} + + +void +OnConf_Ok (GtkButton *button, + gpointer user_data) +{ + +} + diff --git a/plugins/zeropad/Linux/gui.cpp b/plugins/zeropad/Linux/gui.cpp index 06a8c06bc2..3c075e778a 100644 --- a/plugins/zeropad/Linux/gui.cpp +++ b/plugins/zeropad/Linux/gui.cpp @@ -26,6 +26,7 @@ #endif #include "zeropad.h" +#include "linux.h" extern "C" { @@ -119,7 +120,7 @@ void OnMsg_Ok() } // GUI event handlers -void on_joydevicescombo_changed(GtkComboBox *combobox, gpointer user_data) +void on_joydevicescombo_changed(GtkComboBox *combobox, gpointer user_data) { int joyid = gtk_combo_box_get_active(combobox); @@ -132,7 +133,7 @@ void on_joydevicescombo_changed(GtkComboBox *combobox, gpointer user if (joyid >= 0 && joyid < (int)s_vjoysticks.size()) s_vjoysticks[joyid]->Assign(s_selectedpad); } -void on_checkbutton_reverselx_toggled(GtkToggleButton *togglebutton, gpointer user_data) +void on_checkbutton_reverselx_toggled(GtkToggleButton *togglebutton, gpointer user_data) { int mask = PADOPTION_REVERTLX << (16 * s_selectedpad); if (gtk_toggle_button_get_active(togglebutton)) @@ -141,7 +142,7 @@ void on_checkbutton_reverselx_toggled(GtkToggleButton *togglebutton, gpointer conf.options &= ~mask; } -void on_checkbutton_reversely_toggled(GtkToggleButton *togglebutton, gpointer user_data) +void on_checkbutton_reversely_toggled(GtkToggleButton *togglebutton, gpointer user_data) { int mask = PADOPTION_REVERTLY << (16 * s_selectedpad); if (gtk_toggle_button_get_active(togglebutton)) @@ -150,7 +151,7 @@ void on_checkbutton_reversely_toggled(GtkToggleButton *togglebutton, gpointer conf.options &= ~mask; } -void on_checkbutton_reverserx_toggled(GtkToggleButton *togglebutton, gpointer user_data) +void on_checkbutton_reverserx_toggled(GtkToggleButton *togglebutton, gpointer user_data) { int mask = PADOPTION_REVERTRX << (16 * s_selectedpad); if (gtk_toggle_button_get_active(togglebutton)) @@ -159,7 +160,7 @@ void on_checkbutton_reverserx_toggled(GtkToggleButton *togglebutton, gpointer conf.options &= ~mask; } -void on_checkbutton_reversery_toggled(GtkToggleButton *togglebutton, gpointer user_data) +void on_checkbutton_reversery_toggled(GtkToggleButton *togglebutton, gpointer user_data) { int mask = PADOPTION_REVERTRY << (16 * s_selectedpad); if (gtk_toggle_button_get_active(togglebutton)) @@ -228,26 +229,22 @@ void SysMessage(char *fmt, ...) void OnConf_Pad1(GtkButton *button, gpointer user_data) { - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) - UpdateConf(0); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) UpdateConf(0); } void OnConf_Pad2(GtkButton *button, gpointer user_data) { - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) - UpdateConf(1); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) UpdateConf(1); } void OnConf_Pad3(GtkButton *button, gpointer user_data) { - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) - UpdateConf(2); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) UpdateConf(2); } void OnConf_Pad4(GtkButton *button, gpointer user_data) { - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) - UpdateConf(3); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) UpdateConf(3); } void OnConf_Ok(GtkButton *button, gpointer user_data) diff --git a/plugins/zeropad/Linux/interface.c b/plugins/zeropad/Linux/interface.c index 7b32fe1606..808afbc3e6 100644 --- a/plugins/zeropad/Linux/interface.c +++ b/plugins/zeropad/Linux/interface.c @@ -95,33 +95,50 @@ create_Conf (void) GtkWidget *eLx; GtkWidget *eRy; GtkWidget *eLy; - GtkWidget *Select; - GtkWidget *L1; - GtkWidget *Left; - GtkWidget *Down; - GtkWidget *Analog; - GtkWidget *R2; - GtkWidget *Start; - GtkWidget *R1; - GtkWidget *Cross; - GtkWidget *Triangle; - GtkWidget *Circle; - GtkWidget *Square; - GtkWidget *L3; - GtkWidget *Up; - GtkWidget *L2; - GtkWidget *Lx; - GtkWidget *Ly; - GtkWidget *Rx; - GtkWidget *Ry; - GtkWidget *Right; - GtkWidget *label3; + GtkWidget *eL_Up; + GtkWidget *eL_Left; + GtkWidget *eL_Right; + GtkWidget *eL_Down; + GtkWidget *eR_Up; + GtkWidget *eR_Left; + GtkWidget *eR_Right; + GtkWidget *eR_Down; GtkWidget *R3; + GtkWidget *Select; + GtkWidget *Start; + GtkWidget *Square; + GtkWidget *Circle; + GtkWidget *L2; + GtkWidget *L1; + GtkWidget *Down; + GtkWidget *Up; + GtkWidget *Left; + GtkWidget *Right; + GtkWidget *R1; + GtkWidget *R2; + GtkWidget *Triangle; + GtkWidget *Cross; + GtkWidget *L3; + GtkWidget *checkbutton_reversery; + GtkWidget *checkbutton_reverserx; + GtkWidget *R_Down; + GtkWidget *Ry; + GtkWidget *Rx; + GtkWidget *R_Up; + GtkWidget *R_Right; + GtkWidget *R_Left; + GtkWidget *forcefeedback; GtkWidget *checkbutton_reverselx; GtkWidget *checkbutton_reversely; - GtkWidget *checkbutton_reverserx; - GtkWidget *checkbutton_reversery; - GtkWidget *forcefeedback; + GtkWidget *L_Down; + GtkWidget *Ly; + GtkWidget *Lx; + GtkWidget *L_Up; + GtkWidget *L_Left; + GtkWidget *L_Right; + GtkWidget *label3; + GtkWidget *Analog; + GtkWidget *label6; GtkWidget *dialog_action_area1; GtkWidget *cancelbutton1; GtkWidget *okbutton1; @@ -194,7 +211,7 @@ create_Conf (void) vbox2 = gtk_vbox_new (FALSE, 0); gtk_widget_set_name (vbox2, "vbox2"); gtk_widget_show (vbox2); - gtk_box_pack_start (GTK_BOX (vbox1), vbox2, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, TRUE, 0); label5 = gtk_label_new (_("Joystick to use for this PAD")); gtk_widget_set_name (label5, "label5"); @@ -204,7 +221,7 @@ create_Conf (void) joydevicescombo = gtk_combo_box_entry_new_text (); gtk_widget_set_name (joydevicescombo, "joydevicescombo"); gtk_widget_show (joydevicescombo); - gtk_box_pack_start (GTK_BOX (vbox2), joydevicescombo, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (vbox2), joydevicescombo, FALSE, TRUE, 0); fixed1 = gtk_fixed_new (); gtk_widget_set_name (fixed1, "fixed1"); @@ -214,7 +231,7 @@ create_Conf (void) eL2 = gtk_entry_new (); gtk_widget_set_name (eL2, "eL2"); gtk_widget_show (eL2); - gtk_fixed_put (GTK_FIXED (fixed1), eL2, 64, 40); + gtk_fixed_put (GTK_FIXED (fixed1), eL2, 64, 32); gtk_widget_set_size_request (eL2, 64, 24); gtk_editable_set_editable (GTK_EDITABLE (eL2), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (eL2), 8226); @@ -222,14 +239,14 @@ create_Conf (void) eL1 = gtk_entry_new (); gtk_widget_set_name (eL1, "eL1"); gtk_widget_show (eL1); - gtk_fixed_put (GTK_FIXED (fixed1), eL1, 64, 104); + gtk_fixed_put (GTK_FIXED (fixed1), eL1, 64, 80); gtk_widget_set_size_request (eL1, 64, 24); gtk_entry_set_invisible_char (GTK_ENTRY (eL1), 8226); eSelect = gtk_entry_new (); gtk_widget_set_name (eSelect, "eSelect"); gtk_widget_show (eSelect); - gtk_fixed_put (GTK_FIXED (fixed1), eSelect, 168, 64); + gtk_fixed_put (GTK_FIXED (fixed1), eSelect, 200, 184); gtk_widget_set_size_request (eSelect, 64, 24); gtk_editable_set_editable (GTK_EDITABLE (eSelect), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (eSelect), 8226); @@ -237,7 +254,7 @@ create_Conf (void) eStart = gtk_entry_new (); gtk_widget_set_name (eStart, "eStart"); gtk_widget_show (eStart); - gtk_fixed_put (GTK_FIXED (fixed1), eStart, 280, 64); + gtk_fixed_put (GTK_FIXED (fixed1), eStart, 272, 184); gtk_widget_set_size_request (eStart, 64, 24); gtk_editable_set_editable (GTK_EDITABLE (eStart), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (eStart), 8226); @@ -245,14 +262,14 @@ create_Conf (void) eUp = gtk_entry_new (); gtk_widget_set_name (eUp, "eUp"); gtk_widget_show (eUp); - gtk_fixed_put (GTK_FIXED (fixed1), eUp, 64, 168); + gtk_fixed_put (GTK_FIXED (fixed1), eUp, 64, 136); gtk_widget_set_size_request (eUp, 64, 24); gtk_entry_set_invisible_char (GTK_ENTRY (eUp), 8226); eRight = gtk_entry_new (); gtk_widget_set_name (eRight, "eRight"); gtk_widget_show (eRight); - gtk_fixed_put (GTK_FIXED (fixed1), eRight, 128, 208); + gtk_fixed_put (GTK_FIXED (fixed1), eRight, 128, 184); gtk_widget_set_size_request (eRight, 64, 24); gtk_editable_set_editable (GTK_EDITABLE (eRight), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (eRight), 8226); @@ -260,7 +277,7 @@ create_Conf (void) eLeft = gtk_entry_new (); gtk_widget_set_name (eLeft, "eLeft"); gtk_widget_show (eLeft); - gtk_fixed_put (GTK_FIXED (fixed1), eLeft, 0, 208); + gtk_fixed_put (GTK_FIXED (fixed1), eLeft, 0, 184); gtk_widget_set_size_request (eLeft, 64, 24); gtk_editable_set_editable (GTK_EDITABLE (eLeft), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (eLeft), 8226); @@ -268,7 +285,7 @@ create_Conf (void) eDown = gtk_entry_new (); gtk_widget_set_name (eDown, "eDown"); gtk_widget_show (eDown); - gtk_fixed_put (GTK_FIXED (fixed1), eDown, 64, 256); + gtk_fixed_put (GTK_FIXED (fixed1), eDown, 64, 232); gtk_widget_set_size_request (eDown, 64, 24); gtk_editable_set_editable (GTK_EDITABLE (eDown), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (eDown), 8226); @@ -276,7 +293,7 @@ create_Conf (void) eR2 = gtk_entry_new (); gtk_widget_set_name (eR2, "eR2"); gtk_widget_show (eR2); - gtk_fixed_put (GTK_FIXED (fixed1), eR2, 368, 32); + gtk_fixed_put (GTK_FIXED (fixed1), eR2, 408, 32); gtk_widget_set_size_request (eR2, 64, 24); gtk_editable_set_editable (GTK_EDITABLE (eR2), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (eR2), 8226); @@ -284,7 +301,7 @@ create_Conf (void) eR1 = gtk_entry_new (); gtk_widget_set_name (eR1, "eR1"); gtk_widget_show (eR1); - gtk_fixed_put (GTK_FIXED (fixed1), eR1, 368, 104); + gtk_fixed_put (GTK_FIXED (fixed1), eR1, 408, 80); gtk_widget_set_size_request (eR1, 64, 24); gtk_editable_set_editable (GTK_EDITABLE (eR1), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (eR1), 8226); @@ -292,7 +309,7 @@ create_Conf (void) eAnalog = gtk_entry_new (); gtk_widget_set_name (eAnalog, "eAnalog"); gtk_widget_show (eAnalog); - gtk_fixed_put (GTK_FIXED (fixed1), eAnalog, 224, 128); + gtk_fixed_put (GTK_FIXED (fixed1), eAnalog, 240, 232); gtk_widget_set_size_request (eAnalog, 64, 24); gtk_editable_set_editable (GTK_EDITABLE (eAnalog), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (eAnalog), 8226); @@ -300,7 +317,7 @@ create_Conf (void) eSquare = gtk_entry_new (); gtk_widget_set_name (eSquare, "eSquare"); gtk_widget_show (eSquare); - gtk_fixed_put (GTK_FIXED (fixed1), eSquare, 304, 208); + gtk_fixed_put (GTK_FIXED (fixed1), eSquare, 344, 184); gtk_widget_set_size_request (eSquare, 64, 24); gtk_editable_set_editable (GTK_EDITABLE (eSquare), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (eSquare), 8226); @@ -308,7 +325,7 @@ create_Conf (void) eTriangle = gtk_entry_new (); gtk_widget_set_name (eTriangle, "eTriangle"); gtk_widget_show (eTriangle); - gtk_fixed_put (GTK_FIXED (fixed1), eTriangle, 368, 168); + gtk_fixed_put (GTK_FIXED (fixed1), eTriangle, 408, 136); gtk_widget_set_size_request (eTriangle, 64, 24); gtk_editable_set_editable (GTK_EDITABLE (eTriangle), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (eTriangle), 8226); @@ -316,7 +333,7 @@ create_Conf (void) eCircle = gtk_entry_new (); gtk_widget_set_name (eCircle, "eCircle"); gtk_widget_show (eCircle); - gtk_fixed_put (GTK_FIXED (fixed1), eCircle, 432, 208); + gtk_fixed_put (GTK_FIXED (fixed1), eCircle, 472, 184); gtk_widget_set_size_request (eCircle, 64, 24); gtk_editable_set_editable (GTK_EDITABLE (eCircle), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (eCircle), 8226); @@ -324,7 +341,7 @@ create_Conf (void) eCross = gtk_entry_new (); gtk_widget_set_name (eCross, "eCross"); gtk_widget_show (eCross); - gtk_fixed_put (GTK_FIXED (fixed1), eCross, 368, 256); + gtk_fixed_put (GTK_FIXED (fixed1), eCross, 408, 232); gtk_widget_set_size_request (eCross, 64, 24); gtk_editable_set_editable (GTK_EDITABLE (eCross), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (eCross), 8226); @@ -332,7 +349,7 @@ create_Conf (void) eR3 = gtk_entry_new (); gtk_widget_set_name (eR3, "eR3"); gtk_widget_show (eR3); - gtk_fixed_put (GTK_FIXED (fixed1), eR3, 272, 272); + gtk_fixed_put (GTK_FIXED (fixed1), eR3, 272, 56); gtk_widget_set_size_request (eR3, 64, 24); gtk_editable_set_editable (GTK_EDITABLE (eR3), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (eR3), 8226); @@ -340,7 +357,7 @@ create_Conf (void) eL3 = gtk_entry_new (); gtk_widget_set_name (eL3, "eL3"); gtk_widget_show (eL3); - gtk_fixed_put (GTK_FIXED (fixed1), eL3, 176, 272); + gtk_fixed_put (GTK_FIXED (fixed1), eL3, 200, 56); gtk_widget_set_size_request (eL3, 64, 24); gtk_editable_set_editable (GTK_EDITABLE (eL3), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (eL3), 8226); @@ -348,197 +365,302 @@ create_Conf (void) eRx = gtk_entry_new (); gtk_widget_set_name (eRx, "eRx"); gtk_widget_show (eRx); - gtk_fixed_put (GTK_FIXED (fixed1), eRx, 272, 352); - gtk_widget_set_size_request (eRx, 80, 24); + gtk_fixed_put (GTK_FIXED (fixed1), eRx, 408, 384); + gtk_widget_set_size_request (eRx, 64, 24); gtk_editable_set_editable (GTK_EDITABLE (eRx), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (eRx), 8226); eLx = gtk_entry_new (); gtk_widget_set_name (eLx, "eLx"); gtk_widget_show (eLx); - gtk_fixed_put (GTK_FIXED (fixed1), eLx, 160, 352); - gtk_widget_set_size_request (eLx, 80, 24); + gtk_fixed_put (GTK_FIXED (fixed1), eLx, 64, 384); + gtk_widget_set_size_request (eLx, 64, 24); gtk_editable_set_editable (GTK_EDITABLE (eLx), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (eLx), 8226); eRy = gtk_entry_new (); gtk_widget_set_name (eRy, "eRy"); gtk_widget_show (eRy); - gtk_fixed_put (GTK_FIXED (fixed1), eRy, 272, 416); - gtk_widget_set_size_request (eRy, 80, 24); + gtk_fixed_put (GTK_FIXED (fixed1), eRy, 408, 432); + gtk_widget_set_size_request (eRy, 64, 24); gtk_editable_set_editable (GTK_EDITABLE (eRy), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (eRy), 8226); eLy = gtk_entry_new (); gtk_widget_set_name (eLy, "eLy"); gtk_widget_show (eLy); - gtk_fixed_put (GTK_FIXED (fixed1), eLy, 160, 416); - gtk_widget_set_size_request (eLy, 80, 24); + gtk_fixed_put (GTK_FIXED (fixed1), eLy, 64, 432); + gtk_widget_set_size_request (eLy, 64, 24); gtk_editable_set_editable (GTK_EDITABLE (eLy), FALSE); gtk_entry_set_invisible_char (GTK_ENTRY (eLy), 8226); + eL_Up = gtk_entry_new (); + gtk_widget_set_name (eL_Up, "eL_Up"); + gtk_widget_show (eL_Up); + gtk_fixed_put (GTK_FIXED (fixed1), eL_Up, 64, 336); + gtk_widget_set_size_request (eL_Up, 64, 24); + + eL_Left = gtk_entry_new (); + gtk_widget_set_name (eL_Left, "eL_Left"); + gtk_widget_show (eL_Left); + gtk_fixed_put (GTK_FIXED (fixed1), eL_Left, 0, 408); + gtk_widget_set_size_request (eL_Left, 64, 24); + + eL_Right = gtk_entry_new (); + gtk_widget_set_name (eL_Right, "eL_Right"); + gtk_widget_show (eL_Right); + gtk_fixed_put (GTK_FIXED (fixed1), eL_Right, 128, 408); + gtk_widget_set_size_request (eL_Right, 64, 24); + + eL_Down = gtk_entry_new (); + gtk_widget_set_name (eL_Down, "eL_Down"); + gtk_widget_show (eL_Down); + gtk_fixed_put (GTK_FIXED (fixed1), eL_Down, 64, 480); + gtk_widget_set_size_request (eL_Down, 64, 24); + + eR_Up = gtk_entry_new (); + gtk_widget_set_name (eR_Up, "eR_Up"); + gtk_widget_show (eR_Up); + gtk_fixed_put (GTK_FIXED (fixed1), eR_Up, 408, 336); + gtk_widget_set_size_request (eR_Up, 64, 24); + + eR_Left = gtk_entry_new (); + gtk_widget_set_name (eR_Left, "eR_Left"); + gtk_widget_show (eR_Left); + gtk_fixed_put (GTK_FIXED (fixed1), eR_Left, 344, 408); + gtk_widget_set_size_request (eR_Left, 64, 24); + + eR_Right = gtk_entry_new (); + gtk_widget_set_name (eR_Right, "eR_Right"); + gtk_widget_show (eR_Right); + gtk_fixed_put (GTK_FIXED (fixed1), eR_Right, 472, 408); + gtk_widget_set_size_request (eR_Right, 64, 24); + + eR_Down = gtk_entry_new (); + gtk_widget_set_name (eR_Down, "eR_Down"); + gtk_widget_show (eR_Down); + gtk_fixed_put (GTK_FIXED (fixed1), eR_Down, 408, 480); + gtk_widget_set_size_request (eR_Down, 64, 24); + + R3 = gtk_button_new_with_mnemonic (_("R3")); + gtk_widget_set_name (R3, "R3"); + gtk_widget_show (R3); + gtk_fixed_put (GTK_FIXED (fixed1), R3, 272, 32); + gtk_widget_set_size_request (R3, 64, 24); + Select = gtk_button_new_with_mnemonic (_("Select")); gtk_widget_set_name (Select, "Select"); gtk_widget_show (Select); - gtk_fixed_put (GTK_FIXED (fixed1), Select, 168, 32); - gtk_widget_set_size_request (Select, 64, 32); - - L1 = gtk_button_new_with_mnemonic (_("L1")); - gtk_widget_set_name (L1, "L1"); - gtk_widget_show (L1); - gtk_fixed_put (GTK_FIXED (fixed1), L1, 64, 72); - gtk_widget_set_size_request (L1, 64, 32); - - Left = gtk_button_new_with_mnemonic (_("Left")); - gtk_widget_set_name (Left, "Left"); - gtk_widget_show (Left); - gtk_fixed_put (GTK_FIXED (fixed1), Left, 0, 176); - gtk_widget_set_size_request (Left, 64, 32); - - Down = gtk_button_new_with_mnemonic (_("Down")); - gtk_widget_set_name (Down, "Down"); - gtk_widget_show (Down); - gtk_fixed_put (GTK_FIXED (fixed1), Down, 64, 224); - gtk_widget_set_size_request (Down, 64, 32); - - Analog = gtk_button_new_with_mnemonic (_("Analog")); - gtk_widget_set_name (Analog, "Analog"); - gtk_widget_show (Analog); - gtk_fixed_put (GTK_FIXED (fixed1), Analog, 224, 96); - gtk_widget_set_size_request (Analog, 64, 32); - - R2 = gtk_button_new_with_mnemonic (_("R2")); - gtk_widget_set_name (R2, "R2"); - gtk_widget_show (R2); - gtk_fixed_put (GTK_FIXED (fixed1), R2, 368, 0); - gtk_widget_set_size_request (R2, 64, 32); + gtk_fixed_put (GTK_FIXED (fixed1), Select, 200, 160); + gtk_widget_set_size_request (Select, 64, 24); Start = gtk_button_new_with_mnemonic (_("Start")); gtk_widget_set_name (Start, "Start"); gtk_widget_show (Start); - gtk_fixed_put (GTK_FIXED (fixed1), Start, 280, 32); - gtk_widget_set_size_request (Start, 64, 32); - - R1 = gtk_button_new_with_mnemonic (_("R1")); - gtk_widget_set_name (R1, "R1"); - gtk_widget_show (R1); - gtk_fixed_put (GTK_FIXED (fixed1), R1, 368, 72); - gtk_widget_set_size_request (R1, 64, 32); - - Cross = gtk_button_new_with_mnemonic (_("Cross")); - gtk_widget_set_name (Cross, "Cross"); - gtk_widget_show (Cross); - gtk_fixed_put (GTK_FIXED (fixed1), Cross, 368, 224); - gtk_widget_set_size_request (Cross, 64, 32); - - Triangle = gtk_button_new_with_mnemonic (_("Triangle")); - gtk_widget_set_name (Triangle, "Triangle"); - gtk_widget_show (Triangle); - gtk_fixed_put (GTK_FIXED (fixed1), Triangle, 368, 136); - gtk_widget_set_size_request (Triangle, 64, 32); - - Circle = gtk_button_new_with_mnemonic (_("Circle")); - gtk_widget_set_name (Circle, "Circle"); - gtk_widget_show (Circle); - gtk_fixed_put (GTK_FIXED (fixed1), Circle, 432, 176); - gtk_widget_set_size_request (Circle, 64, 32); + gtk_fixed_put (GTK_FIXED (fixed1), Start, 272, 160); + gtk_widget_set_size_request (Start, 64, 24); Square = gtk_button_new_with_mnemonic (_("Square")); gtk_widget_set_name (Square, "Square"); gtk_widget_show (Square); - gtk_fixed_put (GTK_FIXED (fixed1), Square, 304, 176); - gtk_widget_set_size_request (Square, 64, 32); + gtk_fixed_put (GTK_FIXED (fixed1), Square, 344, 160); + gtk_widget_set_size_request (Square, 64, 24); - L3 = gtk_button_new_with_mnemonic (_("L3")); - gtk_widget_set_name (L3, "L3"); - gtk_widget_show (L3); - gtk_fixed_put (GTK_FIXED (fixed1), L3, 176, 240); - gtk_widget_set_size_request (L3, 64, 32); - - Up = gtk_button_new_with_mnemonic (_("Up")); - gtk_widget_set_name (Up, "Up"); - gtk_widget_show (Up); - gtk_fixed_put (GTK_FIXED (fixed1), Up, 64, 136); - gtk_widget_set_size_request (Up, 64, 32); + Circle = gtk_button_new_with_mnemonic (_("Circle")); + gtk_widget_set_name (Circle, "Circle"); + gtk_widget_show (Circle); + gtk_fixed_put (GTK_FIXED (fixed1), Circle, 472, 160); + gtk_widget_set_size_request (Circle, 64, 24); L2 = gtk_button_new_with_mnemonic (_("L2")); gtk_widget_set_name (L2, "L2"); gtk_widget_show (L2); gtk_fixed_put (GTK_FIXED (fixed1), L2, 64, 8); - gtk_widget_set_size_request (L2, 64, 32); + gtk_widget_set_size_request (L2, 64, 24); - Lx = gtk_button_new_with_mnemonic (_("Lx")); - gtk_widget_set_name (Lx, "Lx"); - gtk_widget_show (Lx); - gtk_fixed_put (GTK_FIXED (fixed1), Lx, 160, 320); - gtk_widget_set_size_request (Lx, 80, 32); + L1 = gtk_button_new_with_mnemonic (_("L1")); + gtk_widget_set_name (L1, "L1"); + gtk_widget_show (L1); + gtk_fixed_put (GTK_FIXED (fixed1), L1, 64, 56); + gtk_widget_set_size_request (L1, 64, 24); - Ly = gtk_button_new_with_mnemonic (_("Ly")); - gtk_widget_set_name (Ly, "Ly"); - gtk_widget_show (Ly); - gtk_fixed_put (GTK_FIXED (fixed1), Ly, 160, 384); - gtk_widget_set_size_request (Ly, 80, 32); + Down = gtk_button_new_with_mnemonic (_("Down")); + gtk_widget_set_name (Down, "Down"); + gtk_widget_show (Down); + gtk_fixed_put (GTK_FIXED (fixed1), Down, 64, 208); + gtk_widget_set_size_request (Down, 64, 24); - Rx = gtk_button_new_with_mnemonic (_("Rx")); - gtk_widget_set_name (Rx, "Rx"); - gtk_widget_show (Rx); - gtk_fixed_put (GTK_FIXED (fixed1), Rx, 272, 320); - gtk_widget_set_size_request (Rx, 80, 32); + Up = gtk_button_new_with_mnemonic (_("Up")); + gtk_widget_set_name (Up, "Up"); + gtk_widget_show (Up); + gtk_fixed_put (GTK_FIXED (fixed1), Up, 64, 112); + gtk_widget_set_size_request (Up, 64, 24); - Ry = gtk_button_new_with_mnemonic (_("Ry")); - gtk_widget_set_name (Ry, "Ry"); - gtk_widget_show (Ry); - gtk_fixed_put (GTK_FIXED (fixed1), Ry, 272, 384); - gtk_widget_set_size_request (Ry, 80, 32); + Left = gtk_button_new_with_mnemonic (_("Left")); + gtk_widget_set_name (Left, "Left"); + gtk_widget_show (Left); + gtk_fixed_put (GTK_FIXED (fixed1), Left, 0, 160); + gtk_widget_set_size_request (Left, 64, 24); Right = gtk_button_new_with_mnemonic (_("Right")); gtk_widget_set_name (Right, "Right"); gtk_widget_show (Right); - gtk_fixed_put (GTK_FIXED (fixed1), Right, 128, 176); - gtk_widget_set_size_request (Right, 64, 32); + gtk_fixed_put (GTK_FIXED (fixed1), Right, 128, 160); + gtk_widget_set_size_request (Right, 64, 24); - label3 = gtk_label_new (_("Analog Controls (move mouse or analog joystick to select)")); - gtk_widget_set_name (label3, "label3"); - gtk_widget_show (label3); - gtk_fixed_put (GTK_FIXED (fixed1), label3, 48, 296); - gtk_widget_set_size_request (label3, 408, 16); - gtk_label_set_single_line_mode (GTK_LABEL (label3), TRUE); + R1 = gtk_button_new_with_mnemonic (_("R1")); + gtk_widget_set_name (R1, "R1"); + gtk_widget_show (R1); + gtk_fixed_put (GTK_FIXED (fixed1), R1, 408, 56); + gtk_widget_set_size_request (R1, 64, 24); - R3 = gtk_button_new_with_mnemonic (_("R3")); - gtk_widget_set_name (R3, "R3"); - gtk_widget_show (R3); - gtk_fixed_put (GTK_FIXED (fixed1), R3, 272, 240); - gtk_widget_set_size_request (R3, 64, 32); + R2 = gtk_button_new_with_mnemonic (_("R2")); + gtk_widget_set_name (R2, "R2"); + gtk_widget_show (R2); + gtk_fixed_put (GTK_FIXED (fixed1), R2, 408, 8); + gtk_widget_set_size_request (R2, 64, 24); + + Triangle = gtk_button_new_with_mnemonic (_("Triangle")); + gtk_widget_set_name (Triangle, "Triangle"); + gtk_widget_show (Triangle); + gtk_fixed_put (GTK_FIXED (fixed1), Triangle, 408, 112); + gtk_widget_set_size_request (Triangle, 64, 24); + + Cross = gtk_button_new_with_mnemonic (_("Cross")); + gtk_widget_set_name (Cross, "Cross"); + gtk_widget_show (Cross); + gtk_fixed_put (GTK_FIXED (fixed1), Cross, 408, 208); + gtk_widget_set_size_request (Cross, 64, 24); + + L3 = gtk_button_new_with_mnemonic (_("L3")); + gtk_widget_set_name (L3, "L3"); + gtk_widget_show (L3); + gtk_fixed_put (GTK_FIXED (fixed1), L3, 200, 32); + gtk_widget_set_size_request (L3, 64, 24); + + checkbutton_reversery = gtk_check_button_new_with_mnemonic (_("Reverse RY")); + gtk_widget_set_name (checkbutton_reversery, "checkbutton_reversery"); + gtk_widget_show (checkbutton_reversery); + gtk_fixed_put (GTK_FIXED (fixed1), checkbutton_reversery, 384, 536); + gtk_widget_set_size_request (checkbutton_reversery, 111, 22); + + checkbutton_reverserx = gtk_check_button_new_with_mnemonic (_("Reverse RX")); + gtk_widget_set_name (checkbutton_reverserx, "checkbutton_reverserx"); + gtk_widget_show (checkbutton_reverserx); + gtk_fixed_put (GTK_FIXED (fixed1), checkbutton_reverserx, 384, 512); + gtk_widget_set_size_request (checkbutton_reverserx, 111, 22); + + R_Down = gtk_button_new_with_mnemonic (_("Down")); + gtk_widget_set_name (R_Down, "R_Down"); + gtk_widget_show (R_Down); + gtk_fixed_put (GTK_FIXED (fixed1), R_Down, 408, 456); + gtk_widget_set_size_request (R_Down, 64, 24); + + Ry = gtk_button_new_with_mnemonic (_("Ry")); + gtk_widget_set_name (Ry, "Ry"); + gtk_widget_show (Ry); + gtk_fixed_put (GTK_FIXED (fixed1), Ry, 408, 408); + gtk_widget_set_size_request (Ry, 64, 24); + + Rx = gtk_button_new_with_mnemonic (_("Rx")); + gtk_widget_set_name (Rx, "Rx"); + gtk_widget_show (Rx); + gtk_fixed_put (GTK_FIXED (fixed1), Rx, 408, 360); + gtk_widget_set_size_request (Rx, 64, 24); + + R_Up = gtk_button_new_with_mnemonic (_("Up")); + gtk_widget_set_name (R_Up, "R_Up"); + gtk_widget_show (R_Up); + gtk_fixed_put (GTK_FIXED (fixed1), R_Up, 408, 312); + gtk_widget_set_size_request (R_Up, 64, 24); + + R_Right = gtk_button_new_with_mnemonic (_("Right")); + gtk_widget_set_name (R_Right, "R_Right"); + gtk_widget_show (R_Right); + gtk_fixed_put (GTK_FIXED (fixed1), R_Right, 472, 384); + gtk_widget_set_size_request (R_Right, 64, 24); + + R_Left = gtk_button_new_with_mnemonic (_("Left")); + gtk_widget_set_name (R_Left, "R_Left"); + gtk_widget_show (R_Left); + gtk_fixed_put (GTK_FIXED (fixed1), R_Left, 344, 384); + gtk_widget_set_size_request (R_Left, 64, 24); + + forcefeedback = gtk_check_button_new_with_mnemonic (_("Enable Force\nFeedback")); + gtk_widget_set_name (forcefeedback, "forcefeedback"); + gtk_widget_show (forcefeedback); + gtk_fixed_put (GTK_FIXED (fixed1), forcefeedback, 216, 512); + gtk_widget_set_size_request (forcefeedback, 112, 48); checkbutton_reverselx = gtk_check_button_new_with_mnemonic (_("Reverse LX")); gtk_widget_set_name (checkbutton_reverselx, "checkbutton_reverselx"); gtk_widget_show (checkbutton_reverselx); - gtk_fixed_put (GTK_FIXED (fixed1), checkbutton_reverselx, 16, 328); + gtk_fixed_put (GTK_FIXED (fixed1), checkbutton_reverselx, 48, 512); gtk_widget_set_size_request (checkbutton_reverselx, 111, 22); checkbutton_reversely = gtk_check_button_new_with_mnemonic (_("Reverse LY")); gtk_widget_set_name (checkbutton_reversely, "checkbutton_reversely"); gtk_widget_show (checkbutton_reversely); - gtk_fixed_put (GTK_FIXED (fixed1), checkbutton_reversely, 16, 352); + gtk_fixed_put (GTK_FIXED (fixed1), checkbutton_reversely, 48, 536); gtk_widget_set_size_request (checkbutton_reversely, 111, 22); - checkbutton_reverserx = gtk_check_button_new_with_mnemonic (_("Reverse RX")); - gtk_widget_set_name (checkbutton_reverserx, "checkbutton_reverserx"); - gtk_widget_show (checkbutton_reverserx); - gtk_fixed_put (GTK_FIXED (fixed1), checkbutton_reverserx, 16, 376); - gtk_widget_set_size_request (checkbutton_reverserx, 111, 22); + L_Down = gtk_button_new_with_mnemonic (_("Down")); + gtk_widget_set_name (L_Down, "L_Down"); + gtk_widget_show (L_Down); + gtk_fixed_put (GTK_FIXED (fixed1), L_Down, 64, 456); + gtk_widget_set_size_request (L_Down, 64, 24); - checkbutton_reversery = gtk_check_button_new_with_mnemonic (_("Reverse RY")); - gtk_widget_set_name (checkbutton_reversery, "checkbutton_reversery"); - gtk_widget_show (checkbutton_reversery); - gtk_fixed_put (GTK_FIXED (fixed1), checkbutton_reversery, 16, 400); - gtk_widget_set_size_request (checkbutton_reversery, 111, 22); + Ly = gtk_button_new_with_mnemonic (_("Ly")); + gtk_widget_set_name (Ly, "Ly"); + gtk_widget_show (Ly); + gtk_fixed_put (GTK_FIXED (fixed1), Ly, 64, 408); + gtk_widget_set_size_request (Ly, 64, 24); - forcefeedback = gtk_check_button_new_with_mnemonic (_("Enable Force\nFeedback")); - gtk_widget_set_name (forcefeedback, "forcefeedback"); - gtk_widget_show (forcefeedback); - gtk_fixed_put (GTK_FIXED (fixed1), forcefeedback, 384, 320); - gtk_widget_set_size_request (forcefeedback, 112, 48); + Lx = gtk_button_new_with_mnemonic (_("Lx")); + gtk_widget_set_name (Lx, "Lx"); + gtk_widget_show (Lx); + gtk_fixed_put (GTK_FIXED (fixed1), Lx, 64, 360); + gtk_widget_set_size_request (Lx, 64, 24); + + L_Up = gtk_button_new_with_mnemonic (_("Up")); + gtk_widget_set_name (L_Up, "L_Up"); + gtk_widget_show (L_Up); + gtk_fixed_put (GTK_FIXED (fixed1), L_Up, 64, 312); + gtk_widget_set_size_request (L_Up, 64, 24); + + L_Left = gtk_button_new_with_mnemonic (_("Left")); + gtk_widget_set_name (L_Left, "L_Left"); + gtk_widget_show (L_Left); + gtk_fixed_put (GTK_FIXED (fixed1), L_Left, 0, 384); + gtk_widget_set_size_request (L_Left, 64, 24); + + L_Right = gtk_button_new_with_mnemonic (_("Right")); + gtk_widget_set_name (L_Right, "L_Right"); + gtk_widget_show (L_Right); + gtk_fixed_put (GTK_FIXED (fixed1), L_Right, 128, 384); + gtk_widget_set_size_request (L_Right, 64, 24); + + label3 = gtk_label_new (_("Analog Controls (move mouse or analog joystick to select)")); + gtk_widget_set_name (label3, "label3"); + gtk_widget_show (label3); + gtk_fixed_put (GTK_FIXED (fixed1), label3, 72, 256); + gtk_widget_set_size_request (label3, 400, 24); + gtk_label_set_line_wrap (GTK_LABEL (label3), TRUE); + gtk_label_set_single_line_mode (GTK_LABEL (label3), TRUE); + + Analog = gtk_button_new_with_mnemonic (_("Analog")); + gtk_widget_set_name (Analog, "Analog"); + gtk_widget_show (Analog); + gtk_fixed_put (GTK_FIXED (fixed1), Analog, 240, 208); + gtk_widget_set_size_request (Analog, 64, 24); + + label6 = gtk_label_new (_("(Note: The analog key controls and joystick controls do not work well together currently, and should not be mixed. )")); + gtk_widget_set_name (label6, "label6"); + gtk_widget_show (label6); + gtk_fixed_put (GTK_FIXED (fixed1), label6, 56, 280); + gtk_widget_set_size_request (label6, 448, 32); + gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_CENTER); + gtk_label_set_line_wrap (GTK_LABEL (label6), TRUE); dialog_action_area1 = GTK_DIALOG (Conf)->action_area; gtk_widget_set_name (dialog_action_area1, "dialog_action_area1"); @@ -572,83 +694,107 @@ create_Conf (void) g_signal_connect ((gpointer) joydevicescombo, "changed", G_CALLBACK (on_joydevicescombo_changed), NULL); + g_signal_connect ((gpointer) R3, "clicked", + G_CALLBACK (OnConf_Key), + NULL); g_signal_connect ((gpointer) Select, "clicked", G_CALLBACK (OnConf_Key), NULL); - g_signal_connect ((gpointer) L1, "clicked", - G_CALLBACK (OnConf_Key), - NULL); - g_signal_connect ((gpointer) Left, "clicked", - G_CALLBACK (OnConf_Key), - NULL); - g_signal_connect ((gpointer) Down, "clicked", - G_CALLBACK (OnConf_Key), - NULL); - g_signal_connect ((gpointer) Analog, "clicked", - G_CALLBACK (OnConf_Key), - NULL); - g_signal_connect ((gpointer) R2, "clicked", - G_CALLBACK (OnConf_Key), - NULL); g_signal_connect ((gpointer) Start, "clicked", G_CALLBACK (OnConf_Key), NULL); - g_signal_connect ((gpointer) R1, "clicked", - G_CALLBACK (OnConf_Key), - NULL); - g_signal_connect ((gpointer) Cross, "clicked", - G_CALLBACK (OnConf_Key), - NULL); - g_signal_connect ((gpointer) Triangle, "clicked", + g_signal_connect ((gpointer) Square, "clicked", G_CALLBACK (OnConf_Key), NULL); g_signal_connect ((gpointer) Circle, "clicked", G_CALLBACK (OnConf_Key), NULL); - g_signal_connect ((gpointer) Square, "clicked", + g_signal_connect ((gpointer) L2, "clicked", G_CALLBACK (OnConf_Key), NULL); - g_signal_connect ((gpointer) L3, "clicked", + g_signal_connect ((gpointer) L1, "clicked", + G_CALLBACK (OnConf_Key), + NULL); + g_signal_connect ((gpointer) Down, "clicked", G_CALLBACK (OnConf_Key), NULL); g_signal_connect ((gpointer) Up, "clicked", G_CALLBACK (OnConf_Key), NULL); - g_signal_connect ((gpointer) L2, "clicked", - G_CALLBACK (OnConf_Key), - NULL); - g_signal_connect ((gpointer) Lx, "clicked", - G_CALLBACK (OnConf_Key), - NULL); - g_signal_connect ((gpointer) Ly, "clicked", - G_CALLBACK (OnConf_Key), - NULL); - g_signal_connect ((gpointer) Rx, "clicked", - G_CALLBACK (OnConf_Key), - NULL); - g_signal_connect ((gpointer) Ry, "clicked", + g_signal_connect ((gpointer) Left, "clicked", G_CALLBACK (OnConf_Key), NULL); g_signal_connect ((gpointer) Right, "clicked", G_CALLBACK (OnConf_Key), NULL); - g_signal_connect ((gpointer) R3, "clicked", + g_signal_connect ((gpointer) R1, "clicked", G_CALLBACK (OnConf_Key), NULL); + g_signal_connect ((gpointer) R2, "clicked", + G_CALLBACK (OnConf_Key), + NULL); + g_signal_connect ((gpointer) Triangle, "clicked", + G_CALLBACK (OnConf_Key), + NULL); + g_signal_connect ((gpointer) Cross, "clicked", + G_CALLBACK (OnConf_Key), + NULL); + g_signal_connect ((gpointer) L3, "clicked", + G_CALLBACK (OnConf_Key), + NULL); + g_signal_connect ((gpointer) checkbutton_reversery, "toggled", + G_CALLBACK (on_checkbutton_reversery_toggled), + NULL); + g_signal_connect ((gpointer) checkbutton_reverserx, "toggled", + G_CALLBACK (on_checkbutton_reverserx_toggled), + NULL); + g_signal_connect ((gpointer) R_Down, "clicked", + G_CALLBACK (OnConf_Key), + NULL); + g_signal_connect ((gpointer) Ry, "clicked", + G_CALLBACK (OnConf_Key), + NULL); + g_signal_connect ((gpointer) Rx, "clicked", + G_CALLBACK (OnConf_Key), + NULL); + g_signal_connect ((gpointer) R_Up, "clicked", + G_CALLBACK (OnConf_Key), + NULL); + g_signal_connect ((gpointer) R_Right, "clicked", + G_CALLBACK (OnConf_Key), + NULL); + g_signal_connect ((gpointer) R_Left, "clicked", + G_CALLBACK (OnConf_Key), + NULL); + g_signal_connect ((gpointer) forcefeedback, "toggled", + G_CALLBACK (on_forcefeedback_toggled), + NULL); g_signal_connect ((gpointer) checkbutton_reverselx, "toggled", G_CALLBACK (on_checkbutton_reverselx_toggled), NULL); g_signal_connect ((gpointer) checkbutton_reversely, "toggled", G_CALLBACK (on_checkbutton_reversely_toggled), NULL); - g_signal_connect ((gpointer) checkbutton_reverserx, "toggled", - G_CALLBACK (on_checkbutton_reverserx_toggled), + g_signal_connect ((gpointer) L_Down, "clicked", + G_CALLBACK (OnConf_Key), NULL); - g_signal_connect ((gpointer) checkbutton_reversery, "toggled", - G_CALLBACK (on_checkbutton_reversery_toggled), + g_signal_connect ((gpointer) Ly, "clicked", + G_CALLBACK (OnConf_Key), NULL); - g_signal_connect ((gpointer) forcefeedback, "toggled", - G_CALLBACK (on_forcefeedback_toggled), + g_signal_connect ((gpointer) Lx, "clicked", + G_CALLBACK (OnConf_Key), + NULL); + g_signal_connect ((gpointer) L_Up, "clicked", + G_CALLBACK (OnConf_Key), + NULL); + g_signal_connect ((gpointer) L_Left, "clicked", + G_CALLBACK (OnConf_Key), + NULL); + g_signal_connect ((gpointer) L_Right, "clicked", + G_CALLBACK (OnConf_Key), + NULL); + g_signal_connect ((gpointer) Analog, "clicked", + G_CALLBACK (OnConf_Key), NULL); g_signal_connect ((gpointer) cancelbutton1, "clicked", G_CALLBACK (OnConf_Cancel), @@ -694,33 +840,50 @@ create_Conf (void) GLADE_HOOKUP_OBJECT (Conf, eLx, "eLx"); GLADE_HOOKUP_OBJECT (Conf, eRy, "eRy"); GLADE_HOOKUP_OBJECT (Conf, eLy, "eLy"); - GLADE_HOOKUP_OBJECT (Conf, Select, "Select"); - GLADE_HOOKUP_OBJECT (Conf, L1, "L1"); - GLADE_HOOKUP_OBJECT (Conf, Left, "Left"); - GLADE_HOOKUP_OBJECT (Conf, Down, "Down"); - GLADE_HOOKUP_OBJECT (Conf, Analog, "Analog"); - GLADE_HOOKUP_OBJECT (Conf, R2, "R2"); - GLADE_HOOKUP_OBJECT (Conf, Start, "Start"); - GLADE_HOOKUP_OBJECT (Conf, R1, "R1"); - GLADE_HOOKUP_OBJECT (Conf, Cross, "Cross"); - GLADE_HOOKUP_OBJECT (Conf, Triangle, "Triangle"); - GLADE_HOOKUP_OBJECT (Conf, Circle, "Circle"); - GLADE_HOOKUP_OBJECT (Conf, Square, "Square"); - GLADE_HOOKUP_OBJECT (Conf, L3, "L3"); - GLADE_HOOKUP_OBJECT (Conf, Up, "Up"); - GLADE_HOOKUP_OBJECT (Conf, L2, "L2"); - GLADE_HOOKUP_OBJECT (Conf, Lx, "Lx"); - GLADE_HOOKUP_OBJECT (Conf, Ly, "Ly"); - GLADE_HOOKUP_OBJECT (Conf, Rx, "Rx"); - GLADE_HOOKUP_OBJECT (Conf, Ry, "Ry"); - GLADE_HOOKUP_OBJECT (Conf, Right, "Right"); - GLADE_HOOKUP_OBJECT (Conf, label3, "label3"); + GLADE_HOOKUP_OBJECT (Conf, eL_Up, "eL_Up"); + GLADE_HOOKUP_OBJECT (Conf, eL_Left, "eL_Left"); + GLADE_HOOKUP_OBJECT (Conf, eL_Right, "eL_Right"); + GLADE_HOOKUP_OBJECT (Conf, eL_Down, "eL_Down"); + GLADE_HOOKUP_OBJECT (Conf, eR_Up, "eR_Up"); + GLADE_HOOKUP_OBJECT (Conf, eR_Left, "eR_Left"); + GLADE_HOOKUP_OBJECT (Conf, eR_Right, "eR_Right"); + GLADE_HOOKUP_OBJECT (Conf, eR_Down, "eR_Down"); GLADE_HOOKUP_OBJECT (Conf, R3, "R3"); + GLADE_HOOKUP_OBJECT (Conf, Select, "Select"); + GLADE_HOOKUP_OBJECT (Conf, Start, "Start"); + GLADE_HOOKUP_OBJECT (Conf, Square, "Square"); + GLADE_HOOKUP_OBJECT (Conf, Circle, "Circle"); + GLADE_HOOKUP_OBJECT (Conf, L2, "L2"); + GLADE_HOOKUP_OBJECT (Conf, L1, "L1"); + GLADE_HOOKUP_OBJECT (Conf, Down, "Down"); + GLADE_HOOKUP_OBJECT (Conf, Up, "Up"); + GLADE_HOOKUP_OBJECT (Conf, Left, "Left"); + GLADE_HOOKUP_OBJECT (Conf, Right, "Right"); + GLADE_HOOKUP_OBJECT (Conf, R1, "R1"); + GLADE_HOOKUP_OBJECT (Conf, R2, "R2"); + GLADE_HOOKUP_OBJECT (Conf, Triangle, "Triangle"); + GLADE_HOOKUP_OBJECT (Conf, Cross, "Cross"); + GLADE_HOOKUP_OBJECT (Conf, L3, "L3"); + GLADE_HOOKUP_OBJECT (Conf, checkbutton_reversery, "checkbutton_reversery"); + GLADE_HOOKUP_OBJECT (Conf, checkbutton_reverserx, "checkbutton_reverserx"); + GLADE_HOOKUP_OBJECT (Conf, R_Down, "R_Down"); + GLADE_HOOKUP_OBJECT (Conf, Ry, "Ry"); + GLADE_HOOKUP_OBJECT (Conf, Rx, "Rx"); + GLADE_HOOKUP_OBJECT (Conf, R_Up, "R_Up"); + GLADE_HOOKUP_OBJECT (Conf, R_Right, "R_Right"); + GLADE_HOOKUP_OBJECT (Conf, R_Left, "R_Left"); + GLADE_HOOKUP_OBJECT (Conf, forcefeedback, "forcefeedback"); GLADE_HOOKUP_OBJECT (Conf, checkbutton_reverselx, "checkbutton_reverselx"); GLADE_HOOKUP_OBJECT (Conf, checkbutton_reversely, "checkbutton_reversely"); - GLADE_HOOKUP_OBJECT (Conf, checkbutton_reverserx, "checkbutton_reverserx"); - GLADE_HOOKUP_OBJECT (Conf, checkbutton_reversery, "checkbutton_reversery"); - GLADE_HOOKUP_OBJECT (Conf, forcefeedback, "forcefeedback"); + GLADE_HOOKUP_OBJECT (Conf, L_Down, "L_Down"); + GLADE_HOOKUP_OBJECT (Conf, Ly, "Ly"); + GLADE_HOOKUP_OBJECT (Conf, Lx, "Lx"); + GLADE_HOOKUP_OBJECT (Conf, L_Up, "L_Up"); + GLADE_HOOKUP_OBJECT (Conf, L_Left, "L_Left"); + GLADE_HOOKUP_OBJECT (Conf, L_Right, "L_Right"); + GLADE_HOOKUP_OBJECT (Conf, label3, "label3"); + GLADE_HOOKUP_OBJECT (Conf, Analog, "Analog"); + GLADE_HOOKUP_OBJECT (Conf, label6, "label6"); GLADE_HOOKUP_OBJECT_NO_REF (Conf, dialog_action_area1, "dialog_action_area1"); GLADE_HOOKUP_OBJECT (Conf, cancelbutton1, "cancelbutton1"); GLADE_HOOKUP_OBJECT (Conf, okbutton1, "okbutton1"); diff --git a/plugins/zeropad/Linux/joystick.h b/plugins/zeropad/Linux/joystick.h index 35a2be6057..43cbce9f90 100644 --- a/plugins/zeropad/Linux/joystick.h +++ b/plugins/zeropad/Linux/joystick.h @@ -16,6 +16,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #ifndef __JOYSTICK_H__ + #define __JOYSTICK_H__ + #include #include "zeropad.h" @@ -128,3 +131,4 @@ class JoystickInfo extern int s_selectedpad; extern vector s_vjoysticks; +#endif diff --git a/plugins/zeropad/Linux/linux.cpp b/plugins/zeropad/Linux/linux.cpp index a49d99c1af..4bbaaf62c2 100644 --- a/plugins/zeropad/Linux/linux.cpp +++ b/plugins/zeropad/Linux/linux.cpp @@ -16,38 +16,21 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include - -#define JOYSTICK_SUPPORT -#ifdef JOYSTICK_SUPPORT -#include "joystick.h" -#endif - -#include "zeropad.h" - -extern "C" -{ -#include "interface.h" -#include "support.h" -#include "callbacks.h" -} +#include "linux.h" Display *GSdsp; static pthread_spinlock_t s_mutexStatus; static u32 s_keyPress[2], s_keyRelease[2]; // thread safe -extern GtkWidget *Conf, *s_devicecombo; -extern string s_strIniPath; - static const char* s_pGuiKeyMap[] = { "L2", "R2", "L1", "R1", "Triangle", "Circle", "Cross", "Square", "Select", "L3", "R3", "Start", "Up", "Right", "Down", "Left", - "Lx", "Rx", "Ly", "Ry" + "Lx", "Rx", "Ly", "Ry", + "L_Up", "L_Right", "L_Down", "L_Left", + "R_Up", "R_Right", "R_Down", "R_Left" }; string GetLabelFromButton(const char* buttonname) @@ -108,9 +91,11 @@ int _GetJoystickIdFromPAD(int pad) { for (int i = 0; i < PADKEYS; ++i) { - if (IS_JOYSTICK(conf.keys[(PadEnum[pad][p])][i]) || IS_JOYBUTTONS(conf.keys[(PadEnum[pad][p])][i])) + u32 temp = conf.keys[(PadEnum[pad][p])][i]; + + if (IS_JOYSTICK( temp) || IS_JOYBUTTONS(temp)) { - joyid = PAD_GETJOYID(conf.keys[(PadEnum[pad][p])][i]); + joyid = PAD_GETJOYID(temp); return joyid; } } @@ -134,30 +119,47 @@ void CALLBACK PADupdate(int pad) case KeyPress: key = XLookupKeysym((XKeyEvent *) & E, 0); + i = FindKey(key, pad); #ifdef ANALOG_CONTROLS_HACK - switch (key) + if ((i > PAD_RY) && (i <= PAD_R_LEFT)) { - case KEY_PAD_LX_LEFT: - case KEY_PAD_LY_UP: - case KEY_PAD_RX_LEFT: - case KEY_PAD_RY_UP: - Analog::ConfigurePad(KeypadToPad(key), pad, DEF_VALUE); + switch (i) + { + case PAD_R_LEFT: + Analog::ConfigurePad(PAD_RX, pad, DEF_VALUE); break; - case KEY_PAD_LX_RIGHT: - case KEY_PAD_LY_DOWN: - case KEY_PAD_RX_RIGHT: - case KEY_PAD_RY_DOWN: - Analog::ConfigurePad(KeypadToPad(key), pad, -DEF_VALUE); + case PAD_R_UP: + Analog::ConfigurePad(PAD_RY, pad, DEF_VALUE); + break; + case PAD_L_LEFT: + Analog::ConfigurePad(PAD_LX, pad, DEF_VALUE); + break; + case PAD_L_UP: + Analog::ConfigurePad(PAD_LY, pad, DEF_VALUE); + break; + case PAD_R_DOWN: + Analog::ConfigurePad(PAD_RY, pad, -DEF_VALUE); + break; + case PAD_R_RIGHT: + Analog::ConfigurePad(PAD_RX, pad, -DEF_VALUE); + break; + case PAD_L_DOWN: + Analog::ConfigurePad(PAD_LY, pad, -DEF_VALUE); + break; + case PAD_L_RIGHT: + Analog::ConfigurePad(PAD_LX, pad, -DEF_VALUE); break; } + i += 0xff00; + } #endif - - i = FindKey(key, pad); if (i != -1) { keyPress |= (1 << i); keyRelease &= ~(1 << i); } + //PAD_LOG("Key pressed:%d\n", i); + event.evt = KEYPRESS; event.key = key; break; @@ -165,28 +167,47 @@ void CALLBACK PADupdate(int pad) case KeyRelease: key = XLookupKeysym((XKeyEvent *) & E, 0); + i = FindKey(key, pad); #ifdef ANALOG_CONTROLS_HACK - switch (key) + + if ((i > PAD_RY) && (i <= PAD_R_LEFT)) { - case KEY_PAD_LX_LEFT: - case KEY_PAD_LX_RIGHT: - case KEY_PAD_LY_UP: - case KEY_PAD_LY_DOWN: - case KEY_PAD_RX_LEFT: - case KEY_PAD_RX_RIGHT: - case KEY_PAD_RY_UP: - case KEY_PAD_RY_DOWN: - Analog::ResetPad(KeypadToPad(key)); + switch (i) + { + case PAD_R_LEFT: + Analog::ResetPad(PAD_RX, pad); + break; + case PAD_R_UP: + Analog::ResetPad(PAD_RY, pad); + break; + case PAD_L_LEFT: + Analog::ResetPad(PAD_LX, pad); + break; + case PAD_L_UP: + Analog::ResetPad(PAD_LY, pad); + break; + case PAD_R_DOWN: + Analog::ResetPad(PAD_RY, pad); + break; + case PAD_R_RIGHT: + Analog::ResetPad(PAD_RX, pad); + break; + case PAD_L_DOWN: + Analog::ResetPad(PAD_LY, pad); + break; + case PAD_L_RIGHT: + Analog::ResetPad(PAD_LX, pad); break; } + i += 0xff00; + } #endif - - i = FindKey(key, pad); if (i != -1) { - keyPress &= ~(1 << i); - keyRelease |= (1 << i); + clear_bit(keyPress, i); + set_bit(keyRelease, i); } + event.evt = KEYRELEASE; event.key = key; break; @@ -215,20 +236,20 @@ void CALLBACK PADupdate(int pad) { int joyid = PAD_GETJOYID(key); - if (joyid >= 0 && joyid < (int)s_vjoysticks.size()) + if ((joyid >= 0) && (joyid < (int)s_vjoysticks.size())) { pjoy = s_vjoysticks[joyid]; if (SDL_JoystickGetButton((pjoy)->GetJoy(), PAD_GETJOYBUTTON(key))) - status[(pjoy)->GetPAD()] &= ~(1 << i); // pressed + clear_bit(status[(pjoy)->GetPAD()], i); // pressed else - status[(pjoy)->GetPAD()] |= (1 << i); // pressed + set_bit(status[(pjoy)->GetPAD()], i); // pressed } } else if (IS_JOYSTICK(key)) { int joyid = PAD_GETJOYID(key); - if (joyid >= 0 && joyid < (int)s_vjoysticks.size()) + if ((joyid >= 0) && (joyid < (int)s_vjoysticks.size())) { pjoy = s_vjoysticks[joyid]; @@ -248,10 +269,29 @@ void CALLBACK PADupdate(int pad) } } } +#ifdef EXPERAMENTAL_POV_CODE else if (IS_POV(key)) { int joyid = PAD_GETJOYID(key); - if (joyid >= 0 && joyid < (int)s_vjoysticks.size()) + if ((joyid >= 0) && (joyid < (int)s_vjoysticks.size())) + { + pjoy = s_vjoysticks[joyid]; + + int value = SDL_JoystickGetHat((pjoy)->GetJoy(), PAD_GETJOYSTICK_AXIS(key)); + int pad = (pjoy)->GetPAD(); + + //PAD_LOG("Hat = %d for key %d\n", PAD_GETPOVSIGN(key), key); + if PAD_GETPOVSIGN(key) + set_bit(status[pad], i); + else + clear_bit(status[pad], i); + } + } +#else + else if (IS_POV(key)) + { + int joyid = PAD_GETJOYID(key); + if (joyid >= 0 && (joyid < (int)s_vjoysticks.size())) { pjoy = s_vjoysticks[joyid]; @@ -259,20 +299,20 @@ void CALLBACK PADupdate(int pad) int pad = (pjoy)->GetPAD(); if (PAD_GETPOVSIGN(key) && (value < -2048)) - status[pad] &= ~(1 << i); + clear_bit(status[pad], i); else if (!PAD_GETPOVSIGN(key) && (value > 2048)) - status[pad] &= ~(1 << i); + clear_bit(status[pad], i); else - status[pad] |= (1 << i); + set_bit(status[pad], i); } } - // Need to add in new POV code here, to match the new configuration pov code. +#endif } #endif pthread_spin_lock(&s_mutexStatus); s_keyPress[pad] |= keyPress; - s_keyPress[pad] &= ~keyRelease; + s_keyPress[pad] &= ~keyRelease; s_keyRelease[pad] |= keyRelease; s_keyRelease[pad] &= ~keyPress; pthread_spin_unlock(&s_mutexStatus); @@ -288,8 +328,7 @@ void UpdateConf(int pad) for (i = 0; i < ArraySize(s_pGuiKeyMap); i++) { - if (s_pGuiKeyMap[i] == NULL) - continue; + if (s_pGuiKeyMap[i] == NULL) continue; Btn = lookup_widget(Conf, GetLabelFromButton(s_pGuiKeyMap[i]).c_str()); if (Btn == NULL) @@ -306,19 +345,43 @@ void UpdateConf(int pad) } else if (IS_JOYBUTTONS(conf.keys[pad][i])) { - tmp.resize(20); + tmp.resize(28); sprintf(&tmp[0], "JBut %d", PAD_GETJOYBUTTON(conf.keys[pad][i])); } else if (IS_JOYSTICK(conf.keys[pad][i])) { - tmp.resize(20); + tmp.resize(28); sprintf(&tmp[0], "JAxis %d", PAD_GETJOYSTICK_AXIS(conf.keys[pad][i])); } else if (IS_POV(conf.keys[pad][i])) +#ifdef EXPERAMENTAL_POV_CODE { - tmp.resize(20); + tmp.resize(28); + switch(PAD_GETPOVSIGN(conf.keys[pad][i])) + { + case SDL_HAT_UP: + sprintf(&tmp[0], "JPOVU-%d", PAD_GETJOYSTICK_AXIS(conf.keys[pad][i])); + break; + + case SDL_HAT_RIGHT: + sprintf(&tmp[0], "JPOVR-%d", PAD_GETJOYSTICK_AXIS(conf.keys[pad][i])); + break; + + case SDL_HAT_DOWN: + sprintf(&tmp[0], "JPOVD-%d", PAD_GETJOYSTICK_AXIS(conf.keys[pad][i])); + break; + + case SDL_HAT_LEFT: + sprintf(&tmp[0], "JPOVL-%d", PAD_GETJOYSTICK_AXIS(conf.keys[pad][i])); + break; + } + } +#else + { + tmp.resize(28); sprintf(&tmp[0], "JPOV %d%s", PAD_GETJOYSTICK_AXIS(conf.keys[pad][i]), PAD_GETPOVSIGN(conf.keys[pad][i]) ? "-" : "+"); } +#endif if (tmp.size() > 0) { @@ -327,13 +390,13 @@ void UpdateConf(int pad) else gtk_entry_set_text(GTK_ENTRY(Btn), "Unknown"); - gtk_object_set_user_data(GTK_OBJECT(Btn), (void*)(PADKEYS*pad + i)); + gtk_object_set_user_data(GTK_OBJECT(Btn), (void*)(PADKEYS * pad + i)); } // check bounds int joyid = _GetJoystickIdFromPAD(pad); - if (joyid < 0 || joyid >= (int)s_vjoysticks.size()) + if ((joyid < 0) || (joyid >= (int)s_vjoysticks.size())) { // get first unused joystick for (joyid = 0; joyid < s_vjoysticks.size(); ++joyid) @@ -348,17 +411,20 @@ void UpdateConf(int pad) gtk_combo_box_set_active(GTK_COMBO_BOX(s_devicecombo), s_vjoysticks.size()); // no gamepad int padopts = conf.options >> (16 * pad); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkbutton_reverselx")), padopts&PADOPTION_REVERTLX); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkbutton_reversely")), padopts&PADOPTION_REVERTLY); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkbutton_reverserx")), padopts&PADOPTION_REVERTRX); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkbutton_reversery")), padopts&PADOPTION_REVERTRY); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "forcefeedback")), padopts&PADOPTION_FORCEFEEDBACK); + + set_checked(Conf, "checkbutton_reverselx", padopts & PADOPTION_REVERTLX); + set_checked(Conf, "checkbutton_reversely", padopts & PADOPTION_REVERTLY); + set_checked(Conf, "checkbutton_reverserx", padopts & PADOPTION_REVERTRX); + set_checked(Conf, "checkbutton_reversery", padopts & PADOPTION_REVERTRY); + set_checked(Conf, "forcefeedback", padopts & PADOPTION_FORCEFEEDBACK); } void OnConf_Key(GtkButton *button, gpointer user_data) { GdkEvent *ev; - GtkWidget* label = lookup_widget(Conf, GetLabelFromButton(gtk_button_get_label(button)).c_str()); + const char* buttonname = gtk_widget_get_name(GTK_WIDGET(button));//gtk_button_get_label(button); + const char* labelname = GetLabelFromButton(buttonname).c_str(); + GtkWidget* label = lookup_widget(Conf, labelname); if (label == NULL) { PAD_LOG("couldn't find correct label\n"); @@ -368,7 +434,8 @@ void OnConf_Key(GtkButton *button, gpointer user_data) int id = (int)(uptr)gtk_object_get_user_data(GTK_OBJECT(label)); int pad = id / PADKEYS; int key = id % PADKEYS; - unsigned long *pkey = &conf.keys[pad][key]; + PAD_LOG("Button = '%s', Label = '%s', id = %d, pad = %d, key = %d\n", buttonname, labelname, id, pad, key); + u32 *pkey = &conf.keys[pad][key]; // save the states #ifdef JOYSTICK_SUPPORT @@ -478,23 +545,23 @@ void OnConf_Key(GtkButton *button, gpointer user_data) char str[32]; case SDL_HAT_UP: - *pkey = PAD_POV((*itjoy)->GetId(), value < 0, i); - sprintf(str, "JPOV%d%s", i, "U"); + *pkey = PAD_POV((*itjoy)->GetId(), value, i); + sprintf(str, "JPOVU-%d", i); gtk_entry_set_text(GTK_ENTRY(label), str); return; case SDL_HAT_RIGHT: - *pkey = PAD_POV((*itjoy)->GetId(), value < 0, i); - sprintf(str, "JPOV%d%s", i, "R"); + *pkey = PAD_POV((*itjoy)->GetId(), value, i); + sprintf(str, "JPOVR-%d", i); gtk_entry_set_text(GTK_ENTRY(label), str); return; case SDL_HAT_DOWN: - *pkey = PAD_POV((*itjoy)->GetId(), value < 0, i); - sprintf(str, "JPOV%d%s", i, "D"); + *pkey = PAD_POV((*itjoy)->GetId(), value, i); + sprintf(str, "JPOVD-%d", i); gtk_entry_set_text(GTK_ENTRY(label), str); return; case SDL_HAT_LEFT: - *pkey = PAD_POV((*itjoy)->GetId(), value < 0, i); - sprintf(str, "JPOV%d%s", i, "L"); + *pkey = PAD_POV((*itjoy)->GetId(), value, i); + sprintf(str, "JPOVL-%d", i); gtk_entry_set_text(GTK_ENTRY(label), str); return; // Not handling SDL_HAT_RIGHTUP, SDL_HAT_RIGHTDOWN, diff --git a/plugins/zeropad/Linux/linux.h b/plugins/zeropad/Linux/linux.h new file mode 100644 index 0000000000..e121503a1d --- /dev/null +++ b/plugins/zeropad/Linux/linux.h @@ -0,0 +1,42 @@ +/* ZeroPAD - author: zerofrog(@gmail.com) + * Copyright (C) 2006-2007 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include + +#define JOYSTICK_SUPPORT +#ifdef JOYSTICK_SUPPORT +#include "joystick.h" +#endif + +#include "zeropad.h" + +extern "C" +{ +#include "interface.h" +#include "support.h" +#include "callbacks.h" +} + +extern GtkWidget *Conf, *s_devicecombo; +extern string s_strIniPath; + + +#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) diff --git a/plugins/zeropad/Linux/zeropad.glade b/plugins/zeropad/Linux/zeropad.glade index 4b1b936296..c8fc069ca7 100644 --- a/plugins/zeropad/Linux/zeropad.glade +++ b/plugins/zeropad/Linux/zeropad.glade @@ -271,14 +271,14 @@ and SSSPSXPad, TwinPad authors 0 - True + False True 0 - True + False True @@ -303,7 +303,7 @@ and SSSPSXPad, TwinPad authors 64 - 40 + 32 @@ -323,7 +323,7 @@ and SSSPSXPad, TwinPad authors 64 - 104 + 80 @@ -342,8 +342,8 @@ and SSSPSXPad, TwinPad authors False - 168 - 64 + 200 + 184 @@ -362,8 +362,8 @@ and SSSPSXPad, TwinPad authors False - 280 - 64 + 272 + 184 @@ -383,7 +383,7 @@ and SSSPSXPad, TwinPad authors 64 - 168 + 136 @@ -403,7 +403,7 @@ and SSSPSXPad, TwinPad authors 128 - 208 + 184 @@ -423,7 +423,7 @@ and SSSPSXPad, TwinPad authors 0 - 208 + 184 @@ -443,7 +443,7 @@ and SSSPSXPad, TwinPad authors 64 - 256 + 232 @@ -462,7 +462,7 @@ and SSSPSXPad, TwinPad authors False - 368 + 408 32 @@ -482,8 +482,8 @@ and SSSPSXPad, TwinPad authors False - 368 - 104 + 408 + 80 @@ -502,8 +502,8 @@ and SSSPSXPad, TwinPad authors False - 224 - 128 + 240 + 232 @@ -522,8 +522,8 @@ and SSSPSXPad, TwinPad authors False - 304 - 208 + 344 + 184 @@ -542,8 +542,8 @@ and SSSPSXPad, TwinPad authors False - 368 - 168 + 408 + 136 @@ -562,8 +562,8 @@ and SSSPSXPad, TwinPad authors False - 432 - 208 + 472 + 184 @@ -582,8 +582,8 @@ and SSSPSXPad, TwinPad authors False - 368 - 256 + 408 + 232 @@ -603,7 +603,7 @@ and SSSPSXPad, TwinPad authors 272 - 272 + 56 @@ -622,14 +622,14 @@ and SSSPSXPad, TwinPad authors False - 176 - 272 + 200 + 56 - 80 + 64 24 True True @@ -642,14 +642,14 @@ and SSSPSXPad, TwinPad authors False - 272 - 352 + 408 + 384 - 80 + 64 24 True True @@ -662,14 +662,14 @@ and SSSPSXPad, TwinPad authors False - 160 - 352 + 64 + 384 - 80 + 64 24 True True @@ -682,14 +682,14 @@ and SSSPSXPad, TwinPad authors False - 272 - 416 + 408 + 432 - 80 + 64 24 True True @@ -702,15 +702,193 @@ and SSSPSXPad, TwinPad authors False - 160 - 416 + 64 + 432 + + + + + + 64 + 24 + True + True + True + True + 0 + + True + * + False + + + 64 + 336 + + + + + + 64 + 24 + True + True + True + True + 0 + + True + * + False + + + 0 + 408 + + + + + + 64 + 24 + True + True + True + True + 0 + + True + * + False + + + 128 + 408 + + + + + + 64 + 24 + True + True + True + True + 0 + + True + * + False + + + 64 + 480 + + + + + + 64 + 24 + True + True + True + True + 0 + + True + * + False + + + 408 + 336 + + + + + + 64 + 24 + True + True + True + True + 0 + + True + * + False + + + 344 + 408 + + + + + + 64 + 24 + True + True + True + True + 0 + + True + * + False + + + 472 + 408 + + + + + + 64 + 24 + True + True + True + True + 0 + + True + * + False + + + 408 + 480 + + + + + + 64 + 24 + True + True + R3 + True + GTK_RELIEF_NORMAL + True + + + + 272 + 32 64 - 32 + 24 True True Select @@ -720,105 +898,15 @@ and SSSPSXPad, TwinPad authors - 168 - 32 - - - - - - 64 - 32 - True - True - L1 - True - GTK_RELIEF_NORMAL - True - - - - 64 - 72 - - - - - - 64 - 32 - True - True - Left - True - GTK_RELIEF_NORMAL - True - - - - 0 - 176 - - - - - - 64 - 32 - True - True - Down - True - GTK_RELIEF_NORMAL - True - - - - 64 - 224 - - - - - - 64 - 32 - True - True - Analog - True - GTK_RELIEF_NORMAL - True - - - - 224 - 96 - - - - - - 64 - 32 - True - True - R2 - True - GTK_RELIEF_NORMAL - True - - - - 368 - 0 + 200 + 160 64 - 32 + 24 True True Start @@ -828,87 +916,15 @@ and SSSPSXPad, TwinPad authors - 280 - 32 - - - - - - 64 - 32 - True - True - R1 - True - GTK_RELIEF_NORMAL - True - - - - 368 - 72 - - - - - - 64 - 32 - True - True - Cross - True - GTK_RELIEF_NORMAL - True - - - - 368 - 224 - - - - - - 64 - 32 - True - True - Triangle - True - GTK_RELIEF_NORMAL - True - - - - 368 - 136 - - - - - - 64 - 32 - True - True - Circle - True - GTK_RELIEF_NORMAL - True - - - - 432 - 176 + 272 + 160 64 - 32 + 24 True True Square @@ -918,51 +934,33 @@ and SSSPSXPad, TwinPad authors - 304 - 176 + 344 + 160 - + 64 - 32 + 24 True True - L3 + Circle True GTK_RELIEF_NORMAL True - + - 176 - 240 - - - - - - 64 - 32 - True - True - Up - True - GTK_RELIEF_NORMAL - True - - - - 64 - 136 + 472 + 160 64 - 32 + 24 True True L2 @@ -978,81 +976,81 @@ and SSSPSXPad, TwinPad authors - - 80 - 32 + + 64 + 24 True True - Lx + L1 True GTK_RELIEF_NORMAL True - + - 160 - 320 + 64 + 56 - - 80 - 32 + + 64 + 24 True True - Ly + Down True GTK_RELIEF_NORMAL True - + - 160 - 384 + 64 + 208 - - 80 - 32 + + 64 + 24 True True - Rx + Up True GTK_RELIEF_NORMAL True - + - 272 - 320 + 64 + 112 - - 80 - 32 + + 64 + 24 True True - Ry + Left True GTK_RELIEF_NORMAL True - + - 272 - 384 + 0 + 160 64 - 32 + 24 True True Right @@ -1063,114 +1061,97 @@ and SSSPSXPad, TwinPad authors 128 - 176 + 160 - - 408 - 16 - True - Analog Controls (move mouse or analog joystick to select) - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - True - 0 - - - 48 - 296 - - - - - + 64 - 32 + 24 True True - R3 + R1 True GTK_RELIEF_NORMAL True - + - 272 - 240 + 408 + 56 - - 111 - 22 + + 64 + 24 True True - Reverse LX + R2 True GTK_RELIEF_NORMAL True - False - False - True - + - 16 - 328 + 408 + 8 - - 111 - 22 + + 64 + 24 True True - Reverse LY + Triangle True GTK_RELIEF_NORMAL True - False - False - True - + - 16 - 352 + 408 + 112 - - 111 - 22 + + 64 + 24 True True - Reverse RX + Cross True GTK_RELIEF_NORMAL True - False - False - True - + - 16 - 376 + 408 + 208 + + + + + + 64 + 24 + True + True + L3 + True + GTK_RELIEF_NORMAL + True + + + + 200 + 32 @@ -1190,8 +1171,137 @@ and SSSPSXPad, TwinPad authors - 16 - 400 + 384 + 536 + + + + + + 111 + 22 + True + True + Reverse RX + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 384 + 512 + + + + + + 64 + 24 + True + True + Down + True + GTK_RELIEF_NORMAL + True + + + + 408 + 456 + + + + + + 64 + 24 + True + True + Ry + True + GTK_RELIEF_NORMAL + True + + + + 408 + 408 + + + + + + 64 + 24 + True + True + Rx + True + GTK_RELIEF_NORMAL + True + + + + 408 + 360 + + + + + + 64 + 24 + True + True + Up + True + GTK_RELIEF_NORMAL + True + + + + 408 + 312 + + + + + + 64 + 24 + True + True + Right + True + GTK_RELIEF_NORMAL + True + + + + 472 + 384 + + + + + + 64 + 24 + True + True + Left + True + GTK_RELIEF_NORMAL + True + + + + 344 + 384 @@ -1212,8 +1322,228 @@ Feedback - 384 - 320 + 216 + 512 + + + + + + 111 + 22 + True + True + Reverse LX + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 48 + 512 + + + + + + 111 + 22 + True + True + Reverse LY + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + 48 + 536 + + + + + + 64 + 24 + True + True + Down + True + GTK_RELIEF_NORMAL + True + + + + 64 + 456 + + + + + + 64 + 24 + True + True + Ly + True + GTK_RELIEF_NORMAL + True + + + + 64 + 408 + + + + + + 64 + 24 + True + True + Lx + True + GTK_RELIEF_NORMAL + True + + + + 64 + 360 + + + + + + 64 + 24 + True + True + Up + True + GTK_RELIEF_NORMAL + True + + + + 64 + 312 + + + + + + 64 + 24 + True + True + Left + True + GTK_RELIEF_NORMAL + True + + + + 0 + 384 + + + + + + 64 + 24 + True + True + Right + True + GTK_RELIEF_NORMAL + True + + + + 128 + 384 + + + + + + 400 + 24 + True + Analog Controls (move mouse or analog joystick to select) + False + False + GTK_JUSTIFY_LEFT + True + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + True + 0 + + + 72 + 256 + + + + + + 64 + 24 + True + True + Analog + True + GTK_RELIEF_NORMAL + True + + + + 240 + 208 + + + + + + 448 + 32 + True + (Note: The analog key controls and joystick controls do not work well together currently, and should not be mixed. ) + False + False + GTK_JUSTIFY_CENTER + True + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 56 + 280 diff --git a/plugins/zeropad/Windows/ZeroPAD_2008.vcproj b/plugins/zeropad/Windows/ZeroPAD_2008.vcproj index 957161cb48..d5927633ca 100644 --- a/plugins/zeropad/Windows/ZeroPAD_2008.vcproj +++ b/plugins/zeropad/Windows/ZeroPAD_2008.vcproj @@ -280,6 +280,10 @@ RelativePath="..\analog.h" > + + + static void __forceinline set_bit(T &value, int bit) + { + value |= (1 << bit); + } + + template + static void __forceinline clear_bit(T &value, int bit) + { + value &= ~(1 << bit); + } + + template + static void __forceinline toggle_bit(T &value, int bit) + { + value ^= (1 << bit); + } + + template + static bool __forceinline test_bit(T &value, int bit) + { + return (value & (1 << bit)); + } \ No newline at end of file diff --git a/plugins/zeropad/zeropad.cpp b/plugins/zeropad/zeropad.cpp index 454ae40495..b67549fc54 100644 --- a/plugins/zeropad/zeropad.cpp +++ b/plugins/zeropad/zeropad.cpp @@ -39,11 +39,12 @@ keyEvent event; u16 status[2]; int pressure; +static keyEvent s_event; string s_strIniPath = "inis/zeropad.ini"; -const unsigned char version = PS2E_PAD_VERSION; -const unsigned char revision = 0; -const unsigned char build = 3; // increase that with each version +const u32 version = PS2E_PAD_VERSION; +const u32 revision = 0; +const u32 build = 3; // increase that with each version int PadEnum[2][2] = {{0, 2}, {1, 3}}; @@ -121,73 +122,6 @@ int cmdLen; int ds2mode = 0; // DS Mode at start FILE *padLog = NULL; -int POV(u32 direction, u32 angle) -{ - if ((direction == 0) && (angle >= 0) && (angle < 4500)) return 1;//forward - if ((direction == 2) && (angle >= 4500) && (angle < 13500)) return 1;//right - if ((direction == 1) && (angle >= 13500) && (angle < 22500)) return 1;//backward - if ((direction == 3) && (angle >= 22500) && (angle < 31500)) return 1;//left - if ((direction == 0) && (angle >= 31500) && (angle < 36000)) return 1;//forward - return 0; -} - -void _KeyPress(int pad, u32 key) -{ - int i; - -#ifdef _WIN32 - for (i=0; i> 8) +#ifdef __LINUX__ +#define PADKEYS 28 +#else #define PADKEYS 20 +#endif #define PADOPTION_FORCEFEEDBACK 1 #define PADOPTION_REVERTLX 0x2 @@ -79,13 +84,14 @@ extern char libraryName[256]; #define PADSUBKEYS 2 #endif +//#define EXPERAMENTAL_POV_CODE extern int PadEnum[2][2]; typedef struct { - unsigned long keys[2 * PADSUBKEYS][PADKEYS]; - int log; - int options; // upper 16 bits are for pad2 + u32 keys[2 * PADSUBKEYS][PADKEYS]; + u32 log; + u32 options; // upper 16 bits are for pad2 } PADconf; typedef struct @@ -117,6 +123,14 @@ enum PadCommands enum gamePadValues { + PAD_R_LEFT = 27, + PAD_R_DOWN = 26, + PAD_R_RIGHT = 25, + PAD_R_UP = 24, + PAD_L_LEFT = 23, + PAD_L_DOWN = 22, + PAD_L_RIGHT = 21, + PAD_L_UP = 20, PAD_RY = 19, PAD_LY = 18, PAD_RX = 17, @@ -141,20 +155,11 @@ enum gamePadValues // Put in the code for bolche's analog contols hack, ifdeffed out, so I don't forget to // add a gui some day and activate it. -//#define ANALOG_CONTROLS_HACK -// The various KEY_PAD_xxx definitions are defined as the value of whatever key is pressed. +#define ANALOG_CONTROLS_HACK // DEF_VALUE is the strength you press the control. // Code taken from http://forums.pcsx2.net/thread-4699.html #ifdef ANALOG_CONTROLS_HACK -#define KEY_PAD_RY_UP 0xff50 -#define KEY_PAD_RY_DOWN 0xff57 -#define KEY_PAD_LY_UP 0xff52 -#define KEY_PAD_LY_DOWN 0xff54 -#define KEY_PAD_RX_LEFT 0xffff -#define KEY_PAD_RX_RIGHT 0xff56 -#define KEY_PAD_LX_LEFT 0xff51 -#define KEY_PAD_LX_RIGHT 0xff53 #define DEF_VALUE 32766 #endif