diff --git a/desmume/src/gtk-glade/callbacks_IO.c b/desmume/src/gtk-glade/callbacks_IO.c index 2e45a2070..c27e52458 100755 --- a/desmume/src/gtk-glade/callbacks_IO.c +++ b/desmume/src/gtk-glade/callbacks_IO.c @@ -358,24 +358,6 @@ void ask(GtkButton*b, int key) { gtk_widget_hide((GtkWidget*)dlg); } -void on_button_Left_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_LEFT); } -void on_button_Up_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_UP); } -void on_button_Right_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_RIGHT); } -void on_button_Down_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_DOWN); } - -void on_button_L_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_L); } -void on_button_R_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_R); } - -void on_button_Y_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_Y); } -void on_button_X_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_X); } -void on_button_A_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_A); } -void on_button_B_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_B); } - -void on_button_Start_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_START); } -void on_button_Select_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_SELECT); } -void on_button_Debug_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_DEBUG); } -void on_button_Boost_clicked (GtkButton *b, gpointer user_data) { ask(b,KEY_BOOST); } - /* Joystick configuration / Key definition */ void ask_joy_key(GtkButton*b, int key) { @@ -424,31 +406,23 @@ void ask_joy_axis(GtkButton*b, u8 key, u8 opposite_key) gtk_widget_hide((GtkWidget*)dlg); } -void on_button_joy_Left_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_axis(b,KEY_LEFT,KEY_RIGHT); } -void on_button_joy_Up_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_axis(b,KEY_UP,KEY_DOWN); } -void on_button_joy_Right_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_axis(b,KEY_RIGHT,KEY_LEFT); } -void on_button_joy_Down_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_axis(b,KEY_DOWN,KEY_UP); } -void on_button_joy_A_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_A); } -void on_button_joy_B_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_B); } -void on_button_joy_X_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_X); } -void on_button_joy_Y_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_Y); } -void on_button_joy_L_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_L); } -void on_button_joy_R_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_R); } -void on_button_joy_Select_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_SELECT); } -void on_button_joy_Start_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_START); } -void on_button_joy_Boost_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_BOOST); } -void on_button_joy_Debug_clicked (GtkButton *b, gpointer user_data) -{ ask_joy_key(b,KEY_DEBUG); } +/* Bind a keyboard key to a keypad key */ +void on_button_kb_key_clicked (GtkButton *b, gpointer user_data) +{ + int key = dyn_CAST( int, user_data ); + ask( b, key ); +} + +/* Bind a joystick axis to a keypad directionnal pad */ +void on_button_joy_axis_clicked (GtkButton *b, gpointer user_data) +{ + int key = dyn_CAST( int, user_data ); + ask_joy_axis( b, key, key+1 ); +} + +/* Bind a joystick button to a keypad key */ +void on_button_joy_key_clicked (GtkButton *b, gpointer user_data) +{ + int key = dyn_CAST( int, user_data ); + ask_joy_key( b, key ); +} diff --git a/desmume/src/gtk-glade/callbacks_IO.h b/desmume/src/gtk-glade/callbacks_IO.h index dc37a6a06..4a045c55b 100755 --- a/desmume/src/gtk-glade/callbacks_IO.h +++ b/desmume/src/gtk-glade/callbacks_IO.h @@ -37,44 +37,11 @@ G_MODULE_EXPORT gboolean on_wDrawScreen_button_release_event(GtkWidget *widget, G_MODULE_EXPORT gboolean on_wDrawScreen_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data); G_MODULE_EXPORT gboolean on_wDrawScreen_scroll_event (GtkWidget *widget, GdkEvent *event, gpointer user_data); - - - /* KEYBOARD CONFIG / KEY DEFINITION */ - G_MODULE_EXPORT gboolean on_wKeyDlg_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data); G_MODULE_EXPORT void on_wKeybConfDlg_response (GtkDialog *dialog, gint arg1, gpointer user_data); - -G_MODULE_EXPORT void on_button_Left_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_Up_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_Right_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_Down_clicked (GtkButton *button, gpointer user_data); - -G_MODULE_EXPORT void on_button_L_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_R_clicked (GtkButton *button, gpointer user_data); - -G_MODULE_EXPORT void on_button_Y_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_X_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_A_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_B_clicked (GtkButton *button, gpointer user_data); - -G_MODULE_EXPORT void on_button_Start_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_Select_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_Debug_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_Boost_clicked (GtkButton *button, gpointer user_data); +G_MODULE_EXPORT void on_button_kb_key_clicked (GtkButton *button, gpointer user_data); /* Joystick configuration / Key definition */ -G_MODULE_EXPORT void on_button_joy_Left_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_Up_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_Right_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_Down_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_Y_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_X_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_A_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_B_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_Select_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_L_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_R_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_Debug_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_Start_clicked (GtkButton *button, gpointer user_data); -G_MODULE_EXPORT void on_button_joy_Boost_clicked (GtkButton *button, gpointer user_data); +G_MODULE_EXPORT void on_button_joy_axis_clicked (GtkButton *button, gpointer user_data); +G_MODULE_EXPORT void on_button_joy_key_clicked (GtkButton *button, gpointer user_data); diff --git a/desmume/src/gtk-glade/glade/DeSmuMe.glade b/desmume/src/gtk-glade/glade/DeSmuMe.glade index d6282651f..f90579b64 100755 --- a/desmume/src/gtk-glade/glade/DeSmuMe.glade +++ b/desmume/src/gtk-glade/glade/DeSmuMe.glade @@ -841,7 +841,6 @@ - @@ -1409,7 +1408,7 @@ True GTK_RELIEF_NORMAL True - + 0 @@ -1429,7 +1428,7 @@ True GTK_RELIEF_NORMAL True - + 1 @@ -1449,7 +1448,7 @@ True GTK_RELIEF_NORMAL True - + 2 @@ -1469,7 +1468,7 @@ True GTK_RELIEF_NORMAL True - + 4 @@ -1489,7 +1488,7 @@ True GTK_RELIEF_NORMAL True - + 5 @@ -1509,7 +1508,7 @@ True GTK_RELIEF_NORMAL True - + 6 @@ -1529,7 +1528,7 @@ True GTK_RELIEF_NORMAL True - + 1 @@ -1549,7 +1548,7 @@ True GTK_RELIEF_NORMAL True - + 5 @@ -1569,7 +1568,7 @@ True GTK_RELIEF_NORMAL True - + 3 @@ -1589,7 +1588,7 @@ True GTK_RELIEF_NORMAL True - + 0 @@ -1609,7 +1608,7 @@ True GTK_RELIEF_NORMAL True - + 5 @@ -1629,7 +1628,7 @@ True GTK_RELIEF_NORMAL True - + 2 @@ -1649,7 +1648,7 @@ True GTK_RELIEF_NORMAL True - + 3 @@ -1669,7 +1668,7 @@ True GTK_RELIEF_NORMAL True - + 4 @@ -1885,7 +1884,7 @@ True GTK_RELIEF_NORMAL True - + 4 @@ -1905,7 +1904,7 @@ True GTK_RELIEF_NORMAL True - + 5 @@ -1925,7 +1924,7 @@ True GTK_RELIEF_NORMAL True - + 6 @@ -1945,7 +1944,7 @@ True GTK_RELIEF_NORMAL True - + 5 @@ -1965,7 +1964,7 @@ True GTK_RELIEF_NORMAL True - + 3 @@ -1985,7 +1984,7 @@ True GTK_RELIEF_NORMAL True - + 0 @@ -2005,7 +2004,7 @@ True GTK_RELIEF_NORMAL True - + 5 @@ -2025,7 +2024,7 @@ True GTK_RELIEF_NORMAL True - + 2 @@ -2045,7 +2044,7 @@ True GTK_RELIEF_NORMAL True - + 3 @@ -2065,7 +2064,7 @@ True GTK_RELIEF_NORMAL True - + 4 @@ -2085,7 +2084,7 @@ True GTK_RELIEF_NORMAL True - + 1 @@ -2105,7 +2104,7 @@ True GTK_RELIEF_NORMAL True - + 1 @@ -2125,7 +2124,7 @@ True GTK_RELIEF_NORMAL True - + 0 @@ -2145,7 +2144,7 @@ True GTK_RELIEF_NORMAL True - + 2