mirror of https://github.com/PCSX2/pcsx2.git
Onepad: Added a clear all button, and did some work on the backend.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1481 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
2d8ae979b3
commit
cae05180f5
|
@ -67,15 +67,7 @@ OnConf_Key (GtkButton *button,
|
|||
|
||||
|
||||
void
|
||||
on_checkbutton_reversery_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
on_checkbutton_reverserx_toggled (GtkToggleButton *togglebutton,
|
||||
on_checkbutton_reverselx_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
|
@ -91,7 +83,15 @@ on_forcefeedback_toggled (GtkToggleButton *togglebutton,
|
|||
|
||||
|
||||
void
|
||||
on_checkbutton_reverselx_toggled (GtkToggleButton *togglebutton,
|
||||
on_checkbutton_reverserx_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
on_checkbutton_reversery_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
|
@ -106,6 +106,22 @@ on_checkbutton_reversely_toggled (GtkToggleButton *togglebutton,
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
on_Remove (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
on_Clear (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OnConf_Ok (GtkButton *button,
|
||||
gpointer user_data)
|
||||
|
@ -121,11 +137,3 @@ OnConf_Cancel (GtkButton *button,
|
|||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
on_Remove (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -31,11 +31,7 @@ OnConf_Key (GtkButton *button,
|
|||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_checkbutton_reversery_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_checkbutton_reverserx_toggled (GtkToggleButton *togglebutton,
|
||||
on_checkbutton_reverselx_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
|
@ -43,13 +39,25 @@ on_forcefeedback_toggled (GtkToggleButton *togglebutton,
|
|||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_checkbutton_reverselx_toggled (GtkToggleButton *togglebutton,
|
||||
on_checkbutton_reverserx_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_checkbutton_reversery_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_checkbutton_reversely_toggled (GtkToggleButton *togglebutton,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_Remove (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_Clear (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
OnConf_Ok (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
@ -57,7 +65,3 @@ OnConf_Ok (GtkButton *button,
|
|||
void
|
||||
OnConf_Cancel (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
on_Remove (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
|
|
@ -360,6 +360,12 @@ void SysMessage(char *fmt, ...)
|
|||
gtk_main();
|
||||
}
|
||||
|
||||
void on_Clear(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
clearPAD();
|
||||
init_tree_view();
|
||||
}
|
||||
|
||||
void on_Remove(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
GtkTreeSelection *selection;
|
||||
|
|
|
@ -104,14 +104,12 @@ create_Conf (void)
|
|||
GtkWidget *R1;
|
||||
GtkWidget *label3;
|
||||
GtkWidget *label6;
|
||||
GtkWidget *L_Up;
|
||||
GtkWidget *L_Left;
|
||||
GtkWidget *Lx;
|
||||
GtkWidget *Ly;
|
||||
GtkWidget *L_Down;
|
||||
GtkWidget *L_Right;
|
||||
GtkWidget *checkbutton_reverselx;
|
||||
GtkWidget *checkbutton_reversely;
|
||||
GtkWidget *R_Up;
|
||||
GtkWidget *R_Left;
|
||||
GtkWidget *Rx;
|
||||
|
@ -126,6 +124,9 @@ create_Conf (void)
|
|||
GtkWidget *scrolledwindow2;
|
||||
GtkWidget *padtreeview;
|
||||
GtkWidget *label7;
|
||||
GtkWidget *checkbutton_reversely;
|
||||
GtkWidget *L_Up;
|
||||
GtkWidget *clear_button;
|
||||
GtkWidget *remove_button;
|
||||
GtkWidget *dialog_action_area1;
|
||||
GtkWidget *okbutton1;
|
||||
|
@ -355,12 +356,6 @@ create_Conf (void)
|
|||
gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_CENTER);
|
||||
gtk_label_set_line_wrap (GTK_LABEL (label6), TRUE);
|
||||
|
||||
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, 384, 240);
|
||||
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);
|
||||
|
@ -397,12 +392,6 @@ create_Conf (void)
|
|||
gtk_fixed_put (GTK_FIXED (fixed1), checkbutton_reverselx, 360, 344);
|
||||
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, 360, 368);
|
||||
gtk_widget_set_size_request (checkbutton_reversely, 111, 22);
|
||||
|
||||
R_Up = gtk_button_new_with_mnemonic (_("Up"));
|
||||
gtk_widget_set_name (R_Up, "R_Up");
|
||||
gtk_widget_show (R_Up);
|
||||
|
@ -489,11 +478,29 @@ create_Conf (void)
|
|||
gtk_widget_show (label7);
|
||||
gtk_frame_set_label_widget (GTK_FRAME (frame2), label7);
|
||||
|
||||
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, 360, 368);
|
||||
gtk_widget_set_size_request (checkbutton_reversely, 111, 22);
|
||||
|
||||
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, 384, 240);
|
||||
gtk_widget_set_size_request (L_Up, 64, 24);
|
||||
|
||||
clear_button = gtk_button_new_with_mnemonic (_("Clear All"));
|
||||
gtk_widget_set_name (clear_button, "clear_button");
|
||||
gtk_widget_show (clear_button);
|
||||
gtk_fixed_put (GTK_FIXED (fixed1), clear_button, 168, 352);
|
||||
gtk_widget_set_size_request (clear_button, 70, 24);
|
||||
|
||||
remove_button = gtk_button_new_with_mnemonic (_("Remove"));
|
||||
gtk_widget_set_name (remove_button, "remove_button");
|
||||
gtk_widget_show (remove_button);
|
||||
gtk_fixed_put (GTK_FIXED (fixed1), remove_button, 248, 352);
|
||||
gtk_widget_set_size_request (remove_button, 0, 0);
|
||||
gtk_fixed_put (GTK_FIXED (fixed1), remove_button, 240, 352);
|
||||
gtk_widget_set_size_request (remove_button, 70, 24);
|
||||
|
||||
dialog_action_area1 = GTK_DIALOG (Conf)->action_area;
|
||||
gtk_widget_set_name (dialog_action_area1, "dialog_action_area1");
|
||||
|
@ -578,9 +585,6 @@ create_Conf (void)
|
|||
g_signal_connect ((gpointer) R1, "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);
|
||||
|
@ -599,9 +603,6 @@ create_Conf (void)
|
|||
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) R_Up, "clicked",
|
||||
G_CALLBACK (OnConf_Key),
|
||||
NULL);
|
||||
|
@ -629,6 +630,15 @@ create_Conf (void)
|
|||
g_signal_connect ((gpointer) checkbutton_reversery, "toggled",
|
||||
G_CALLBACK (on_checkbutton_reversery_toggled),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) checkbutton_reversely, "toggled",
|
||||
G_CALLBACK (on_checkbutton_reversely_toggled),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) L_Up, "clicked",
|
||||
G_CALLBACK (OnConf_Key),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) clear_button, "clicked",
|
||||
G_CALLBACK (on_Clear),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) remove_button, "clicked",
|
||||
G_CALLBACK (on_Remove),
|
||||
NULL);
|
||||
|
@ -678,14 +688,12 @@ create_Conf (void)
|
|||
GLADE_HOOKUP_OBJECT (Conf, R1, "R1");
|
||||
GLADE_HOOKUP_OBJECT (Conf, label3, "label3");
|
||||
GLADE_HOOKUP_OBJECT (Conf, label6, "label6");
|
||||
GLADE_HOOKUP_OBJECT (Conf, L_Up, "L_Up");
|
||||
GLADE_HOOKUP_OBJECT (Conf, L_Left, "L_Left");
|
||||
GLADE_HOOKUP_OBJECT (Conf, Lx, "Lx");
|
||||
GLADE_HOOKUP_OBJECT (Conf, Ly, "Ly");
|
||||
GLADE_HOOKUP_OBJECT (Conf, L_Down, "L_Down");
|
||||
GLADE_HOOKUP_OBJECT (Conf, L_Right, "L_Right");
|
||||
GLADE_HOOKUP_OBJECT (Conf, checkbutton_reverselx, "checkbutton_reverselx");
|
||||
GLADE_HOOKUP_OBJECT (Conf, checkbutton_reversely, "checkbutton_reversely");
|
||||
GLADE_HOOKUP_OBJECT (Conf, R_Up, "R_Up");
|
||||
GLADE_HOOKUP_OBJECT (Conf, R_Left, "R_Left");
|
||||
GLADE_HOOKUP_OBJECT (Conf, Rx, "Rx");
|
||||
|
@ -700,6 +708,9 @@ create_Conf (void)
|
|||
GLADE_HOOKUP_OBJECT (Conf, scrolledwindow2, "scrolledwindow2");
|
||||
GLADE_HOOKUP_OBJECT (Conf, padtreeview, "padtreeview");
|
||||
GLADE_HOOKUP_OBJECT (Conf, label7, "label7");
|
||||
GLADE_HOOKUP_OBJECT (Conf, checkbutton_reversely, "checkbutton_reversely");
|
||||
GLADE_HOOKUP_OBJECT (Conf, L_Up, "L_Up");
|
||||
GLADE_HOOKUP_OBJECT (Conf, clear_button, "clear_button");
|
||||
GLADE_HOOKUP_OBJECT (Conf, remove_button, "remove_button");
|
||||
GLADE_HOOKUP_OBJECT_NO_REF (Conf, dialog_action_area1, "dialog_action_area1");
|
||||
GLADE_HOOKUP_OBJECT (Conf, okbutton1, "okbutton1");
|
||||
|
|
|
@ -67,12 +67,11 @@ int _GetJoystickIdFromPAD(int pad)
|
|||
{
|
||||
for (int i = 0; i < PADKEYS; ++i)
|
||||
{
|
||||
u32 temp = get_key(PadEnum[pad][p],i);
|
||||
KeyType k = type_of_key(temp);
|
||||
KeyType k = type_of_key(PadEnum[pad][p],i);
|
||||
|
||||
if (k == PAD_JOYSTICK || k == PAD_JOYBUTTONS)
|
||||
{
|
||||
joyid = key_to_joystick_id(temp);
|
||||
joyid = key_to_joystick_id(PadEnum[pad][p],i);
|
||||
return joyid;
|
||||
}
|
||||
}
|
||||
|
@ -100,19 +99,18 @@ EXPORT_C_(void) PADupdate(int pad)
|
|||
|
||||
for (int i = 0; i < PADKEYS; i++)
|
||||
{
|
||||
int key = get_key(PadEnum[pad][0], i);
|
||||
int cpad = PadEnum[pad][0];
|
||||
|
||||
if (JoystickIdWithinBounds(key_to_joystick_id(key)))
|
||||
if (JoystickIdWithinBounds(key_to_joystick_id(cpad, i)))
|
||||
{
|
||||
JoystickInfo* pjoy = s_vjoysticks[key_to_joystick_id(key)];
|
||||
JoystickInfo* pjoy = s_vjoysticks[key_to_joystick_id(cpad, i)];
|
||||
int pad = (pjoy)->GetPAD();
|
||||
KeyType k = type_of_key(key);
|
||||
|
||||
switch (k)
|
||||
switch (type_of_key(cpad, i))
|
||||
{
|
||||
case PAD_JOYBUTTONS:
|
||||
{
|
||||
int value = SDL_JoystickGetButton((pjoy)->GetJoy(), key_to_button(key));
|
||||
int value = SDL_JoystickGetButton((pjoy)->GetJoy(), key_to_button(cpad, i));
|
||||
|
||||
if (value)
|
||||
clear_bit(status[pad], i); // released
|
||||
|
@ -122,7 +120,7 @@ EXPORT_C_(void) PADupdate(int pad)
|
|||
}
|
||||
case PAD_JOYSTICK:
|
||||
{
|
||||
int value = SDL_JoystickGetAxis((pjoy)->GetJoy(), key_to_axis(key));
|
||||
int value = SDL_JoystickGetAxis((pjoy)->GetJoy(), key_to_axis(cpad, i));
|
||||
|
||||
switch (i)
|
||||
{
|
||||
|
@ -141,12 +139,14 @@ EXPORT_C_(void) PADupdate(int pad)
|
|||
#ifdef EXPERIMENTAL_POV_CODE
|
||||
case PAD_HAT:
|
||||
{
|
||||
int value = SDL_JoystickGetHat((pjoy)->GetJoy(), key_to_axis(key));
|
||||
int value = SDL_JoystickGetHat((pjoy)->GetJoy(), key_to_axis(cpad, i));
|
||||
|
||||
//PAD_LOG("Hat = %d for key %d\n", key_to_hat_dir(key), key);
|
||||
if ((value != SDL_HAT_CENTERED) && (key_to_hat_dir(key) == value))
|
||||
if ((value != SDL_HAT_CENTERED) && (key_to_hat_dir(cpad, i) == value))
|
||||
{
|
||||
if ((value == SDL_HAT_UP) || (value == SDL_HAT_RIGHT) || (value == SDL_HAT_DOWN) ||(value == SDL_HAT_LEFT))
|
||||
if ((value == SDL_HAT_UP) ||
|
||||
(value == SDL_HAT_RIGHT) ||
|
||||
(value == SDL_HAT_DOWN) ||
|
||||
(value == SDL_HAT_LEFT))
|
||||
{
|
||||
set_bit(status[pad], i);
|
||||
PAD_LOG("Registered %s. Set (%d)\n", HatName(value), i);
|
||||
|
@ -165,11 +165,11 @@ EXPORT_C_(void) PADupdate(int pad)
|
|||
#endif
|
||||
case PAD_POV:
|
||||
{
|
||||
int value = SDL_JoystickGetAxis((pjoy)->GetJoy(), key_to_axis(key));
|
||||
int value = SDL_JoystickGetAxis((pjoy)->GetJoy(), key_to_axis(cpad, i));
|
||||
|
||||
if (key_to_pov_sign(key) && (value < -2048))
|
||||
if (key_to_pov_sign(cpad, i) && (value < -2048))
|
||||
clear_bit(status[pad], i);
|
||||
else if (!key_to_pov_sign(key) && (value > 2048))
|
||||
else if (!key_to_pov_sign(cpad, i) && (value > 2048))
|
||||
clear_bit(status[pad], i);
|
||||
else
|
||||
set_bit(status[pad], i);
|
||||
|
@ -184,19 +184,19 @@ EXPORT_C_(void) PADupdate(int pad)
|
|||
string KeyName(int pad, int key)
|
||||
{
|
||||
string tmp;
|
||||
KeyType k = type_of_key(get_key(pad, key));
|
||||
KeyType k = type_of_key(pad, key);
|
||||
|
||||
switch (k)
|
||||
{
|
||||
case PAD_KEYBOARD:
|
||||
{
|
||||
char* pstr = KeysymToChar(pad_to_key(get_key(pad, key)));
|
||||
char* pstr = KeysymToChar(pad_to_key(pad, key));
|
||||
if (pstr != NULL) tmp = pstr;
|
||||
break;
|
||||
}
|
||||
case PAD_JOYBUTTONS:
|
||||
{
|
||||
int button = key_to_button(get_key(pad, key));
|
||||
int button = key_to_button(pad, key);
|
||||
tmp.resize(28);
|
||||
|
||||
sprintf(&tmp[0], "JBut %d", button);
|
||||
|
@ -204,7 +204,7 @@ string KeyName(int pad, int key)
|
|||
}
|
||||
case PAD_JOYSTICK:
|
||||
{
|
||||
int axis = key_to_axis(get_key(pad, key));
|
||||
int axis = key_to_axis(pad, key);
|
||||
tmp.resize(28);
|
||||
|
||||
sprintf(&tmp[0], "JAxis %d", axis);
|
||||
|
@ -213,10 +213,10 @@ string KeyName(int pad, int key)
|
|||
#ifdef EXPERIMENTAL_POV_CODE
|
||||
case PAD_HAT:
|
||||
{
|
||||
int axis = key_to_axis(get_key(pad, key));
|
||||
int axis = key_to_axis(pad, key);
|
||||
tmp.resize(28);
|
||||
|
||||
switch(key_to_hat_dir(get_key(pad, key)))
|
||||
switch(key_to_hat_dir(pad, key))
|
||||
{
|
||||
case SDL_HAT_UP:
|
||||
sprintf(&tmp[0], "JPOVU-%d", axis);
|
||||
|
@ -240,7 +240,7 @@ string KeyName(int pad, int key)
|
|||
case PAD_POV:
|
||||
{
|
||||
tmp.resize(28);
|
||||
sprintf(&tmp[0], "JPOV %d%s", key_to_axis(get_key(pad, key)), key_to_pov_sign(get_key(pad, key)) ? "-" : "+");
|
||||
sprintf(&tmp[0], "JPOV %d%s", key_to_axis(pad, key), key_to_pov_sign(pad, key) ? "-" : "+");
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
|
|
|
@ -698,24 +698,6 @@ and SSSPSXPad, TwinPad authors</property>
|
|||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="L_Up">
|
||||
<property name="width_request">64</property>
|
||||
<property name="height_request">24</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Up</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="OnConf_Key" last_modification_time="Sun, 10 May 2009 02:09:18 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="x">384</property>
|
||||
<property name="y">240</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="L_Left">
|
||||
<property name="width_request">64</property>
|
||||
|
@ -827,27 +809,6 @@ and SSSPSXPad, TwinPad authors</property>
|
|||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="checkbutton_reversely">
|
||||
<property name="width_request">111</property>
|
||||
<property name="height_request">22</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Reverse LY</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>
|
||||
<signal name="toggled" handler="on_checkbutton_reversely_toggled" last_modification_time="Wed, 12 Dec 2007 11:28:39 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="x">360</property>
|
||||
<property name="y">368</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="R_Up">
|
||||
<property name="width_request">64</property>
|
||||
|
@ -1098,10 +1059,67 @@ Feedback</property>
|
|||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="checkbutton_reversely">
|
||||
<property name="width_request">111</property>
|
||||
<property name="height_request">22</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Reverse LY</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>
|
||||
<signal name="toggled" handler="on_checkbutton_reversely_toggled" last_modification_time="Wed, 12 Dec 2007 11:28:39 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="x">360</property>
|
||||
<property name="y">368</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="L_Up">
|
||||
<property name="width_request">64</property>
|
||||
<property name="height_request">24</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Up</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="OnConf_Key" last_modification_time="Sun, 10 May 2009 02:09:18 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="x">384</property>
|
||||
<property name="y">240</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="clear_button">
|
||||
<property name="width_request">70</property>
|
||||
<property name="height_request">24</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Clear All</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="on_Clear" last_modification_time="Thu, 09 Jul 2009 23:32:22 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="x">168</property>
|
||||
<property name="y">352</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="remove_button">
|
||||
<property name="width_request">0</property>
|
||||
<property name="height_request">0</property>
|
||||
<property name="width_request">70</property>
|
||||
<property name="height_request">24</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Remove</property>
|
||||
|
@ -1111,7 +1129,7 @@ Feedback</property>
|
|||
<signal name="clicked" handler="on_Remove" last_modification_time="Fri, 03 Jul 2009 08:36:59 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="x">248</property>
|
||||
<property name="x">240</property>
|
||||
<property name="y">352</property>
|
||||
</packing>
|
||||
</child>
|
|
@ -32,8 +32,10 @@ __forceinline int get_key(int pad, int index)
|
|||
return conf.keys[pad][index];
|
||||
}
|
||||
|
||||
__forceinline KeyType type_of_key(int key)
|
||||
__forceinline KeyType type_of_key(int pad, int index)
|
||||
{
|
||||
int key = conf.keys[pad][index];
|
||||
|
||||
if (key < 0x10000) return PAD_KEYBOARD;
|
||||
else if (key >= 0x10000 && key < 0x20000) return PAD_JOYBUTTONS;
|
||||
else if (key >= 0x20000 && key < 0x30000) return PAD_JOYSTICK;
|
||||
|
@ -42,24 +44,24 @@ __forceinline KeyType type_of_key(int key)
|
|||
else return PAD_NULL;
|
||||
}
|
||||
|
||||
__forceinline int pad_to_key(int key)
|
||||
__forceinline int pad_to_key(int pad, int index)
|
||||
{
|
||||
return ((key) & 0xffff);
|
||||
return ((conf.keys[pad][index]) & 0xffff);
|
||||
}
|
||||
|
||||
__forceinline int key_to_joystick_id(int key)
|
||||
__forceinline int key_to_joystick_id(int pad, int index)
|
||||
{
|
||||
return (((key) & 0xf000) >> 12);
|
||||
return (((conf.keys[pad][index]) & 0xf000) >> 12);
|
||||
}
|
||||
|
||||
__forceinline int key_to_button(int key)
|
||||
__forceinline int key_to_button(int pad, int index)
|
||||
{
|
||||
return ((key) & 0xff);
|
||||
return ((conf.keys[pad][index]) & 0xff);
|
||||
}
|
||||
|
||||
__forceinline int key_to_axis(int key)
|
||||
__forceinline int key_to_axis(int pad, int index)
|
||||
{
|
||||
return ((key) & 0xff);
|
||||
return ((conf.keys[pad][index]) & 0xff);
|
||||
}
|
||||
|
||||
__forceinline int button_to_key(int joy_id, int button_id)
|
||||
|
@ -82,12 +84,12 @@ __forceinline int hat_to_key(int joy_id, int dir, int axis_id)
|
|||
return (0x40000 | ((joy_id) << 12) | ((dir) << 8) | (axis_id));
|
||||
}
|
||||
|
||||
__forceinline int key_to_pov_sign(int key)
|
||||
__forceinline int key_to_pov_sign(int pad, int index)
|
||||
{
|
||||
return (((key) & 0x100) >> 8);
|
||||
return (((conf.keys[pad][index]) & 0x100) >> 8);
|
||||
}
|
||||
|
||||
__forceinline int key_to_hat_dir(int key)
|
||||
__forceinline int key_to_hat_dir(int pad, int index)
|
||||
{
|
||||
return (((key) & ~ 0x40000) >> 8);
|
||||
}
|
||||
return (((conf.keys[pad][index]) & ~ 0x40000) >> 8);
|
||||
}
|
||||
|
|
|
@ -44,21 +44,21 @@ enum KeyType
|
|||
PAD_NULL = -1
|
||||
};
|
||||
|
||||
|
||||
extern int set_key(int pad, int index, int value);
|
||||
extern int get_key(int pad, int index);
|
||||
|
||||
extern KeyType type_of_key(int key);
|
||||
extern int pad_to_key(int key);
|
||||
extern int key_to_joystick_id(int key);
|
||||
extern int key_to_button(int key);
|
||||
extern int key_to_axis(int key);
|
||||
extern KeyType type_of_key(int pad, int index);
|
||||
extern int pad_to_key(int pad, int index);
|
||||
extern int key_to_joystick_id(int pad, int index);
|
||||
extern int key_to_button(int pad, int index);
|
||||
extern int key_to_axis(int pad, int index);
|
||||
extern int key_to_pov_sign(int pad, int index);
|
||||
extern int key_to_hat_dir(int pad, int index);
|
||||
|
||||
extern int button_to_key(int joy_id, int button_id);
|
||||
extern int joystick_to_key(int joy_id, int axis_id);
|
||||
extern int pov_to_key(int joy_id, int sign, int axis_id);
|
||||
extern int hat_to_key(int joy_id, int dir, int axis_id);
|
||||
extern int key_to_pov_sign(int key);
|
||||
extern int key_to_hat_dir(int key);
|
||||
|
||||
//#define EXPERIMENTAL_POV_CODE
|
||||
extern int PadEnum[2][2];
|
||||
|
@ -70,7 +70,6 @@ typedef struct
|
|||
u32 options; // upper 16 bits are for pad2
|
||||
} PADconf;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 x, y;
|
||||
|
|
|
@ -102,10 +102,10 @@ void JoystickInfo::EnumerateJoysticks(vector<JoystickInfo*>& vjoysticks)
|
|||
|
||||
for (int i = 0; i < PADKEYS; ++i)
|
||||
{
|
||||
KeyType k = type_of_key(get_key(pad,i));
|
||||
KeyType k = type_of_key(pad,i);
|
||||
if (k == PAD_JOYSTICK || k == PAD_JOYBUTTONS)
|
||||
{
|
||||
joyid = key_to_joystick_id(get_key(pad,i));
|
||||
joyid = key_to_joystick_id(pad,i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -169,15 +169,15 @@ void JoystickInfo::Assign(int newpad)
|
|||
{
|
||||
for (int i = 0; i < PADKEYS; ++i)
|
||||
{
|
||||
KeyType k = type_of_key(get_key(pad,i));
|
||||
KeyType k = type_of_key(pad,i);
|
||||
|
||||
if (k == PAD_JOYBUTTONS)
|
||||
{
|
||||
set_key(pad, i, button_to_key(_id, key_to_button(get_key(pad,i))));
|
||||
set_key(pad, i, button_to_key(_id, key_to_button(pad,i)));
|
||||
}
|
||||
else if (k == PAD_JOYSTICK)
|
||||
{
|
||||
set_key(pad, i, joystick_to_key(_id, key_to_button(get_key(pad,i))));
|
||||
set_key(pad, i, joystick_to_key(_id, key_to_button(pad,i)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,6 +227,17 @@ void initLogging()
|
|||
#endif
|
||||
}
|
||||
|
||||
void clearPAD()
|
||||
{
|
||||
for (int pad = 0; pad < PADSUBKEYS; pad++)
|
||||
{
|
||||
for (int key= 0; key < PADKEYS; ++key)
|
||||
{
|
||||
set_key(pad, key, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT_C_(s32) PADinit(u32 flags)
|
||||
{
|
||||
initLogging();
|
||||
|
|
|
@ -129,6 +129,7 @@ extern keyEvent event;
|
|||
extern u16 status[2];
|
||||
extern u32 pads;
|
||||
|
||||
void clearPAD();
|
||||
int POV(u32 direction, u32 angle);
|
||||
s32 _PADopen(void *pDsp);
|
||||
void _PADclose();
|
||||
|
|
Loading…
Reference in New Issue