ZeroPad: Apply the multiple key patch in issue 197 to ZeroPad. Currently Linux only.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1125 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-05-03 11:09:15 +00:00
parent 8504f4e9bd
commit 94c006efd2
7 changed files with 258 additions and 113 deletions

View File

@ -10,21 +10,21 @@ OnConf_Pad2 (GtkButton *button,
gpointer user_data);
void
OnConf_Key (GtkButton *button,
OnConf_Pad3 (GtkButton *button,
gpointer user_data);
void
OnConf_Cancel (GtkButton *button,
gpointer user_data);
void
OnConf_Ok (GtkButton *button,
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);
@ -44,3 +44,11 @@ on_checkbutton_reversery_toggled (GtkToggleButton *togglebutton,
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);

View File

@ -42,6 +42,8 @@ create_About (void)
gchar *translators = _("translator-credits");
About = gtk_about_dialog_new ();
gtk_widget_set_name (About, "About");
gtk_container_set_border_width (GTK_CONTAINER (About), 5);
gtk_about_dialog_set_version (GTK_ABOUT_DIALOG (About), VERSION);
gtk_about_dialog_set_name (GTK_ABOUT_DIALOG (About), _("ZeroPAD"));
gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG (About), authors);
@ -65,6 +67,8 @@ create_Conf (void)
GtkWidget *PAD1;
GSList *PAD1_group = NULL;
GtkWidget *PAD2;
GtkWidget *PAD3;
GtkWidget *PAD4;
GtkWidget *label2;
GtkWidget *vbox2;
GtkWidget *label5;
@ -123,30 +127,37 @@ create_Conf (void)
GtkWidget *okbutton1;
Conf = gtk_dialog_new ();
gtk_widget_set_name (Conf, "Conf");
gtk_window_set_title (GTK_WINDOW (Conf), _("ZeroPAD Configuration Dialog"));
gtk_window_set_type_hint (GTK_WINDOW (Conf), GDK_WINDOW_TYPE_HINT_DIALOG);
dialog_vbox1 = GTK_DIALOG (Conf)->vbox;
gtk_widget_set_name (dialog_vbox1, "dialog_vbox1");
gtk_widget_show (dialog_vbox1);
vbox1 = gtk_vbox_new (FALSE, 0);
gtk_widget_set_name (vbox1, "vbox1");
gtk_widget_show (vbox1);
gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);
frame1 = gtk_frame_new (NULL);
gtk_widget_set_name (frame1, "frame1");
gtk_widget_show (frame1);
gtk_box_pack_start (GTK_BOX (vbox1), frame1, FALSE, FALSE, 0);
alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
gtk_widget_set_name (alignment1, "alignment1");
gtk_widget_show (alignment1);
gtk_container_add (GTK_CONTAINER (frame1), alignment1);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 12, 0);
hbox1 = gtk_hbox_new (FALSE, 0);
gtk_widget_set_name (hbox1, "hbox1");
gtk_widget_show (hbox1);
gtk_container_add (GTK_CONTAINER (alignment1), hbox1);
PAD1 = gtk_radio_button_new_with_mnemonic (NULL, _("PAD1"));
gtk_widget_set_name (PAD1, "PAD1");
gtk_widget_show (PAD1);
gtk_box_pack_start (GTK_BOX (hbox1), PAD1, FALSE, FALSE, 0);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (PAD1), PAD1_group);
@ -154,33 +165,54 @@ create_Conf (void)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (PAD1), TRUE);
PAD2 = gtk_radio_button_new_with_mnemonic (NULL, _("PAD2"));
gtk_widget_set_name (PAD2, "PAD2");
gtk_widget_show (PAD2);
gtk_box_pack_start (GTK_BOX (hbox1), PAD2, FALSE, FALSE, 0);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (PAD2), PAD1_group);
PAD1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (PAD2));
PAD3 = gtk_radio_button_new_with_mnemonic (NULL, _("PAD1 alt."));
gtk_widget_set_name (PAD3, "PAD3");
gtk_widget_show (PAD3);
gtk_box_pack_start (GTK_BOX (hbox1), PAD3, FALSE, FALSE, 0);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (PAD3), PAD1_group);
PAD1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (PAD3));
PAD4 = gtk_radio_button_new_with_mnemonic (NULL, _("PAD2 alt."));
gtk_widget_set_name (PAD4, "PAD4");
gtk_widget_show (PAD4);
gtk_box_pack_start (GTK_BOX (hbox1), PAD4, FALSE, FALSE, 0);
gtk_radio_button_set_group (GTK_RADIO_BUTTON (PAD4), PAD1_group);
PAD1_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (PAD4));
label2 = gtk_label_new (_("<b>Choose PAD to modify</b>"));
gtk_widget_set_name (label2, "label2");
gtk_widget_show (label2);
gtk_frame_set_label_widget (GTK_FRAME (frame1), label2);
gtk_label_set_use_markup (GTK_LABEL (label2), TRUE);
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);
label5 = gtk_label_new (_("Joystick to use for this PAD"));
gtk_widget_set_name (label5, "label5");
gtk_widget_show (label5);
gtk_box_pack_start (GTK_BOX (vbox2), label5, FALSE, FALSE, 0);
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);
fixed1 = gtk_fixed_new ();
gtk_widget_set_name (fixed1, "fixed1");
gtk_widget_show (fixed1);
gtk_box_pack_start (GTK_BOX (vbox1), fixed1, TRUE, TRUE, 0);
eL2 = gtk_entry_new ();
gtk_widget_set_name (eL2, "eL2");
gtk_widget_show (eL2);
gtk_fixed_put (GTK_FIXED (fixed1), eL2, 64, 40);
gtk_widget_set_size_request (eL2, 64, 24);
@ -188,12 +220,14 @@ create_Conf (void)
gtk_entry_set_invisible_char (GTK_ENTRY (eL2), 8226);
eL1 = gtk_entry_new ();
gtk_widget_set_name (eL1, "eL1");
gtk_widget_show (eL1);
gtk_fixed_put (GTK_FIXED (fixed1), eL1, 64, 104);
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_widget_set_size_request (eSelect, 64, 24);
@ -201,6 +235,7 @@ create_Conf (void)
gtk_entry_set_invisible_char (GTK_ENTRY (eSelect), 8226);
eStart = gtk_entry_new ();
gtk_widget_set_name (eStart, "eStart");
gtk_widget_show (eStart);
gtk_fixed_put (GTK_FIXED (fixed1), eStart, 280, 64);
gtk_widget_set_size_request (eStart, 64, 24);
@ -208,12 +243,14 @@ create_Conf (void)
gtk_entry_set_invisible_char (GTK_ENTRY (eStart), 8226);
eUp = gtk_entry_new ();
gtk_widget_set_name (eUp, "eUp");
gtk_widget_show (eUp);
gtk_fixed_put (GTK_FIXED (fixed1), eUp, 64, 168);
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_widget_set_size_request (eRight, 64, 24);
@ -221,6 +258,7 @@ create_Conf (void)
gtk_entry_set_invisible_char (GTK_ENTRY (eRight), 8226);
eLeft = gtk_entry_new ();
gtk_widget_set_name (eLeft, "eLeft");
gtk_widget_show (eLeft);
gtk_fixed_put (GTK_FIXED (fixed1), eLeft, 0, 208);
gtk_widget_set_size_request (eLeft, 64, 24);
@ -228,6 +266,7 @@ create_Conf (void)
gtk_entry_set_invisible_char (GTK_ENTRY (eLeft), 8226);
eDown = gtk_entry_new ();
gtk_widget_set_name (eDown, "eDown");
gtk_widget_show (eDown);
gtk_fixed_put (GTK_FIXED (fixed1), eDown, 64, 256);
gtk_widget_set_size_request (eDown, 64, 24);
@ -235,6 +274,7 @@ create_Conf (void)
gtk_entry_set_invisible_char (GTK_ENTRY (eDown), 8226);
eR2 = gtk_entry_new ();
gtk_widget_set_name (eR2, "eR2");
gtk_widget_show (eR2);
gtk_fixed_put (GTK_FIXED (fixed1), eR2, 368, 32);
gtk_widget_set_size_request (eR2, 64, 24);
@ -242,6 +282,7 @@ create_Conf (void)
gtk_entry_set_invisible_char (GTK_ENTRY (eR2), 8226);
eR1 = gtk_entry_new ();
gtk_widget_set_name (eR1, "eR1");
gtk_widget_show (eR1);
gtk_fixed_put (GTK_FIXED (fixed1), eR1, 368, 104);
gtk_widget_set_size_request (eR1, 64, 24);
@ -249,6 +290,7 @@ create_Conf (void)
gtk_entry_set_invisible_char (GTK_ENTRY (eR1), 8226);
eAnalog = gtk_entry_new ();
gtk_widget_set_name (eAnalog, "eAnalog");
gtk_widget_show (eAnalog);
gtk_fixed_put (GTK_FIXED (fixed1), eAnalog, 224, 128);
gtk_widget_set_size_request (eAnalog, 64, 24);
@ -256,6 +298,7 @@ create_Conf (void)
gtk_entry_set_invisible_char (GTK_ENTRY (eAnalog), 8226);
eSquare = gtk_entry_new ();
gtk_widget_set_name (eSquare, "eSquare");
gtk_widget_show (eSquare);
gtk_fixed_put (GTK_FIXED (fixed1), eSquare, 304, 208);
gtk_widget_set_size_request (eSquare, 64, 24);
@ -263,6 +306,7 @@ create_Conf (void)
gtk_entry_set_invisible_char (GTK_ENTRY (eSquare), 8226);
eTriangle = gtk_entry_new ();
gtk_widget_set_name (eTriangle, "eTriangle");
gtk_widget_show (eTriangle);
gtk_fixed_put (GTK_FIXED (fixed1), eTriangle, 368, 168);
gtk_widget_set_size_request (eTriangle, 64, 24);
@ -270,6 +314,7 @@ create_Conf (void)
gtk_entry_set_invisible_char (GTK_ENTRY (eTriangle), 8226);
eCircle = gtk_entry_new ();
gtk_widget_set_name (eCircle, "eCircle");
gtk_widget_show (eCircle);
gtk_fixed_put (GTK_FIXED (fixed1), eCircle, 432, 208);
gtk_widget_set_size_request (eCircle, 64, 24);
@ -277,6 +322,7 @@ create_Conf (void)
gtk_entry_set_invisible_char (GTK_ENTRY (eCircle), 8226);
eCross = gtk_entry_new ();
gtk_widget_set_name (eCross, "eCross");
gtk_widget_show (eCross);
gtk_fixed_put (GTK_FIXED (fixed1), eCross, 368, 256);
gtk_widget_set_size_request (eCross, 64, 24);
@ -284,6 +330,7 @@ create_Conf (void)
gtk_entry_set_invisible_char (GTK_ENTRY (eCross), 8226);
eR3 = gtk_entry_new ();
gtk_widget_set_name (eR3, "eR3");
gtk_widget_show (eR3);
gtk_fixed_put (GTK_FIXED (fixed1), eR3, 272, 272);
gtk_widget_set_size_request (eR3, 64, 24);
@ -291,6 +338,7 @@ create_Conf (void)
gtk_entry_set_invisible_char (GTK_ENTRY (eR3), 8226);
eL3 = gtk_entry_new ();
gtk_widget_set_name (eL3, "eL3");
gtk_widget_show (eL3);
gtk_fixed_put (GTK_FIXED (fixed1), eL3, 176, 272);
gtk_widget_set_size_request (eL3, 64, 24);
@ -298,6 +346,7 @@ create_Conf (void)
gtk_entry_set_invisible_char (GTK_ENTRY (eL3), 8226);
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);
@ -305,6 +354,7 @@ create_Conf (void)
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);
@ -312,6 +362,7 @@ create_Conf (void)
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);
@ -319,6 +370,7 @@ create_Conf (void)
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);
@ -326,151 +378,181 @@ create_Conf (void)
gtk_entry_set_invisible_char (GTK_ENTRY (eLy), 8226);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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_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_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);
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);
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);
dialog_action_area1 = GTK_DIALOG (Conf)->action_area;
gtk_widget_set_name (dialog_action_area1, "dialog_action_area1");
gtk_widget_show (dialog_action_area1);
gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
gtk_widget_set_name (cancelbutton1, "cancelbutton1");
gtk_widget_show (cancelbutton1);
gtk_dialog_add_action_widget (GTK_DIALOG (Conf), cancelbutton1, GTK_RESPONSE_CANCEL);
GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);
okbutton1 = gtk_button_new_from_stock ("gtk-ok");
gtk_widget_set_name (okbutton1, "okbutton1");
gtk_widget_show (okbutton1);
gtk_dialog_add_action_widget (GTK_DIALOG (Conf), okbutton1, GTK_RESPONSE_OK);
GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);
@ -481,6 +563,12 @@ create_Conf (void)
g_signal_connect ((gpointer) PAD2, "clicked",
G_CALLBACK (OnConf_Pad2),
NULL);
g_signal_connect ((gpointer) PAD3, "clicked",
G_CALLBACK (OnConf_Pad3),
NULL);
g_signal_connect ((gpointer) PAD4, "clicked",
G_CALLBACK (OnConf_Pad4),
NULL);
g_signal_connect ((gpointer) joydevicescombo, "changed",
G_CALLBACK (on_joydevicescombo_changed),
NULL);
@ -578,6 +666,8 @@ create_Conf (void)
GLADE_HOOKUP_OBJECT (Conf, hbox1, "hbox1");
GLADE_HOOKUP_OBJECT (Conf, PAD1, "PAD1");
GLADE_HOOKUP_OBJECT (Conf, PAD2, "PAD2");
GLADE_HOOKUP_OBJECT (Conf, PAD3, "PAD3");
GLADE_HOOKUP_OBJECT (Conf, PAD4, "PAD4");
GLADE_HOOKUP_OBJECT (Conf, label2, "label2");
GLADE_HOOKUP_OBJECT (Conf, vbox2, "vbox2");
GLADE_HOOKUP_OBJECT (Conf, label5, "label5");

View File

@ -103,7 +103,7 @@ void SaveConfig()
return;
}
for (j=0; j<2; j++) {
for (j=0; j<2 * PADSUBKEYS; j++) {
for (i=0; i<PADKEYS; i++) {
fprintf(f, "[%d][%d] = 0x%lx\n", j, i, conf.keys[j][i]);
}
@ -127,12 +127,12 @@ string GetLabelFromButton(const char* buttonname)
}
void LoadConfig() {
FILE *f;
FILE *f;
char str[256];
char cfg[255];
char cfg[255];
int i, j;
memset(&conf, 0, sizeof(conf));
memset(&conf, 0, sizeof(conf));
conf.keys[0][0] = XK_a; // L2
conf.keys[0][1] = XK_semicolon; // R2
conf.keys[0][2] = XK_w; // L1
@ -149,23 +149,24 @@ void LoadConfig() {
conf.keys[0][15] = XK_s; // LEFT
conf.log = 0;
strcpy(cfg, s_strIniPath.c_str());
f = fopen(cfg, "r");
if (f == NULL) {
printf("ZeroPAD: failed to load ini %s\n", s_strIniPath.c_str());
SaveConfig();//save and return
return;
}
strcpy(cfg, s_strIniPath.c_str());
f = fopen(cfg, "r");
if (f == NULL) {
printf("ZeroPAD: failed to load ini %s\n", s_strIniPath.c_str());
SaveConfig();//save and return
return;
}
for (j=0; j<2; j++) {
for (j=0; j < 2 * PADSUBKEYS; j++) {
for (i=0; i<PADKEYS; i++) {
sprintf(str, "[%d][%d] = 0x%%x\n", j, i);
fscanf(f, str, &conf.keys[j][i]);
if (fscanf(f, str, &conf.keys[j][i]) == 0)
conf.keys[j][i] = 0;
}
}
fscanf(f, "log = %d\n", &conf.log);
fscanf(f, "options = %d\n", &conf.options);
fclose(f);
fscanf(f, "log = %d\n", &conf.log);
fscanf(f, "options = %d\n", &conf.options);
fclose(f);
}
GtkWidget *MsgDlg;
@ -251,16 +252,16 @@ void _PADupdate(int pad)
int _GetJoystickIdFromPAD(int pad)
{
// select the right joystick id
int joyid = -1;
for(int i = 0; i < PADKEYS; ++i) {
if( IS_JOYSTICK(conf.keys[pad][i]) || IS_JOYBUTTONS(conf.keys[pad][i]) ) {
joyid = PAD_GETJOYID(conf.keys[pad][i]);
break;
}
}
return joyid;
// select the right joystick id
int joyid = -1;
for (int p = 0; p < PADSUBKEYS; p++) {
for(int i = 0; i < PADKEYS; ++i) {
if (IS_JOYSTICK(conf.keys[(PadEnum[pad][p])][i]) || IS_JOYBUTTONS(conf.keys[(PadEnum[pad][p])][i])) {
joyid = PAD_GETJOYID(conf.keys[(PadEnum[pad][p])][i]);
return joyid;
}
}
}
}
void CALLBACK PADupdate(int pad)
@ -275,30 +276,20 @@ void CALLBACK PADupdate(int pad)
XNextEvent(GSdsp, &E);
switch (E.type) {
case KeyPress:
//_KeyPress(pad, XLookupKeysym((XKeyEvent *)&E, 0)); break;
key = XLookupKeysym((XKeyEvent *)&E, 0);
for (i=0; i<PADKEYS; i++) {
if (key == conf.keys[pad][i]) {
keyPress|=(1<<i);
keyRelease&=~(1<<i);
break;
}
}
i = FindKey(key, pad);
keyPress |= (1 << i);
keyRelease &= ~(1 << i);
event.evt = KEYPRESS;
event.key = key;
break;
case KeyRelease:
key = XLookupKeysym((XKeyEvent *)&E, 0);
//_KeyRelease(pad, XLookupKeysym((XKeyEvent *)&E, 0));
for (i=0; i<PADKEYS; i++) {
if (key == conf.keys[pad][i]) {
keyPress&=~(1<<i);
keyRelease|= (1<<i);
break;
}
}
i = FindKey(key, pad);
keyPress &= ~(1<<i);
keyRelease |= (1<<i);
event.evt = KEYRELEASE;
event.key = key;
break;
@ -316,24 +307,24 @@ void CALLBACK PADupdate(int pad)
// joystick info
#ifdef JOYSTICK_SUPPORT
SDL_JoystickUpdate();
for (int i=0; i<PADKEYS; i++) {
int key = conf.keys[pad][i];
JoystickInfo* pjoy = NULL;
SDL_JoystickUpdate();
for (int i=0; i<PADKEYS; i++) {
int key = conf.keys[PadEnum[pad][0]][i];
JoystickInfo* pjoy = NULL;
if( IS_JOYBUTTONS(key) ) {
int joyid = PAD_GETJOYID(key);
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
}
else
status[(pjoy)->GetPAD()] |= (1<<i); // pressed
}
}
else if( IS_JOYSTICK(key) ) {
int joyid = PAD_GETJOYID(key);
if( IS_JOYBUTTONS(key) ) {
int joyid = PAD_GETJOYID(key);
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
}
else
status[(pjoy)->GetPAD()] |= (1<<i); // pressed
}
}
else if( IS_JOYSTICK(key) ) {
int joyid = PAD_GETJOYID(key);
if( joyid >= 0 && joyid < (int)s_vjoysticks.size()) {
pjoy = s_vjoysticks[joyid];
@ -411,10 +402,10 @@ static int s_selectedpad = 0;
void UpdateConf(int pad)
{
s_selectedpad = pad;
s_selectedpad = pad;
int i;
GtkWidget *Btn;
GtkWidget *Btn;
for (i=0; i<ArraySize(s_pGuiKeyMap); i++) {
if( s_pGuiKeyMap[i] == NULL )
@ -585,6 +576,18 @@ void OnConf_Pad2(GtkButton *button, gpointer user_data)
UpdateConf(1);
}
void OnConf_Pad3(GtkButton *button, gpointer user_data)
{
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);
}
void OnConf_Ok(GtkButton *button, gpointer user_data)
{
// conf.analog = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(Analog));

View File

@ -4,6 +4,7 @@
<glade-interface>
<widget class="GtkAboutDialog" id="About">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="destroy_with_parent">False</property>
<property name="name" translatable="yes">ZeroPAD</property>
@ -151,6 +152,48 @@ and SSSPSXPad, TwinPad authors</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="PAD3">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">PAD1 alt.</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">PAD1</property>
<signal name="clicked" handler="OnConf_Pad3" last_modification_time="Sat, 31 Mar 2007 21:46:03 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkRadioButton" id="PAD4">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">PAD2 alt.</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">PAD1</property>
<signal name="clicked" handler="OnConf_Pad4" last_modification_time="Sat, 31 Mar 2007 21:46:18 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>

View File

@ -54,7 +54,7 @@ void SaveConfig()
if(!szTemp) return;
strcpy(szTemp, "\\inis\\zeropad.ini");
for (j=0; j<2; j++) {
for (j=0; j<2 * PADSUBKEYS; j++) {
for (i=0; i<PADKEYS; i++) {
sprintf(szProf, "%d_%d", j, i);
sprintf(szValue, "%d", conf.keys[j][i]);
@ -105,7 +105,7 @@ void LoadConfig()
}
fclose(fp);
for (j=0; j<2; j++) {
for (j=0; j<2 * PADSUBKEYS; j++) {
for (i=0; i<PADKEYS; i++) {
sprintf(szProf, "%d_%d", j, i);
GetPrivateProfileString("Interface", szProf, NULL, szValue, 20, szIniFile);
@ -181,33 +181,19 @@ LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
if (lParam & 0x40000000)
return TRUE;
for(pad = 0; pad < 2; ++pad ) {
for (i=0; i<PADKEYS; i++) {
if (wParam == conf.keys[pad][i]) {
i = FindKey(wparam, pad);
keyPress[pad] |=(1<<i);
keyRelease[pad] &=~(1<<i);
break;
}
}
}
event.evt = KEYPRESS;
event.key = wParam;
event.evt = KEYPRESS;
event.key = wParam;
break;
case WM_KEYUP:
for(pad = 0; pad < 2; ++pad ) {
for (i=0; i<PADKEYS; i++) {
if (wParam == conf.keys[pad][i]) {
i = FindKey(wparam, pad);
keyPress[pad] &=~(1<<i);
keyRelease[pad] |= (1<<i);
break;
}
}
}
event.evt = KEYRELEASE;
event.key = wParam;
event.evt = KEYRELEASE;
event.key = wParam;
break;
case WM_LBUTTONDOWN:

View File

@ -46,6 +46,7 @@ const unsigned char version = PS2E_PAD_VERSION;
const unsigned char revision = 0;
const unsigned char build = 2; // increase that with each version
int PadEnum[2][2] = {{0, 2}, {1, 3}};
u32 pads=0;
u8 stdpar[2][20] = { {0xff, 0x5a, 0xff, 0xff, 0x80, 0x80, 0x80, 0x80,
@ -108,14 +109,16 @@ int POV(u32 direction, u32 angle){
void _KeyPress(int pad, u32 key)
{
int i;
int i;
for (i=0; i<PADKEYS; i++) {
if (key == conf.keys[pad][i]) {
status[pad]&=~(1<<i);
return;
}
}
for (int p=0; p <PADSUBKEYS; p++) {
for (i=0; i<PADKEYS; i++) {
if (key == conf.keys[PadEnum[pad][p]][i]) {
status[pad]&=~(1<<i);
return;
}
}
}
event.evt = KEYPRESS;
event.key = key;
@ -123,12 +126,14 @@ void _KeyPress(int pad, u32 key)
void _KeyRelease(int pad, u32 key)
{
int i;
int i;
for (i=0; i<PADKEYS; i++) {
if (key == conf.keys[pad][i]) {
status[pad]|= (1<<i);
return;
for (int p=0; p <PADSUBKEYS; p++) {
for (i=0; i<PADKEYS; i++) {
if (key == conf.keys[PadEnum[pad][p]][i]) {
status[pad]|= (1<<i);
return;
}
}
}
@ -139,39 +144,39 @@ void _KeyRelease(int pad, u32 key)
static void InitLibraryName()
{
#ifdef _WIN32
#ifdef PUBLIC
# ifdef PUBLIC
// Public Release!
// Output a simplified string that's just our name:
strcpy( libraryName, "ZeroPAD" );
#elif defined( SVN_REV_UNKNOWN )
# elif defined( SVN_REV_UNKNOWN )
// Unknown revision.
// Output a name that includes devbuild status but not
// subversion revision tags:
strcpy( libraryName, "ZeroPAD"
# ifdef _DEBUG
# ifdef _DEBUG
"-Debug"
# endif
# endif
);
#else
# else
// Use TortoiseSVN's SubWCRev utility's output
// to label the specific revision:
sprintf_s( libraryName, "ZeroPAD r%d%s"
# ifdef _DEBUG
# ifdef _DEBUG
"-Debug"
# else
# else
"-Dev"
# endif
# endif
,SVN_REV,
SVN_MODS ? "m" : ""
);
#endif
# endif
#else
// I'll fix up SVN support later. --arcum42

View File

@ -71,8 +71,11 @@ extern char libraryName[256];
#define PADOPTION_REVERTRX 0x8
#define PADOPTION_REVERTRY 0x10
#define PADSUBKEYS 2
extern int PadEnum[2][2];
typedef struct {
unsigned long keys[2][PADKEYS];
unsigned long keys[2 * PADSUBKEYS][PADKEYS];
int log;
int options; // upper 16 bits are for pad2
} PADconf;
@ -129,6 +132,13 @@ void SaveConfig();
void SysMessage(char *fmt, ...);
inline int FindKey(int key, int pad) {
for (int p=0; p < PADSUBKEYS; p++)
for (int i=0; i<PADKEYS; i++)
if (key == conf.keys[(PadEnum[pad][p])][i])
return i;
}
#endif