onepad: drop hacks/options for DualShock3

SDL2 will take care of correct detection
This commit is contained in:
Gregory Hainaut 2017-04-11 18:48:56 +02:00
parent 5c537fdbe3
commit 61182249f0
5 changed files with 6 additions and 63 deletions

View File

@ -48,20 +48,6 @@ GamepadConfiguration::GamepadConfiguration(int pad, wxWindow *parent)
wxPoint(20, 20) // Position
);
m_cb_hack_sixaxis_usb = new wxCheckBox(
m_pan_gamepad_config, // Parent
wxID_ANY, // ID
_T("&Hack: Sixaxis/DS3 plugged in USB"), // Label
wxPoint(20, 40) // Position
);
m_cb_hack_sixaxis_pressure = new wxCheckBox(
m_pan_gamepad_config, // Parent
wxID_ANY, // ID
_T("&Hack: Sixaxis/DS3 pressure"), // Label
wxPoint(20, 60) // Position
);
wxString txt_rumble = wxT("Rumble intensity");
m_lbl_rumble_intensity = new wxStaticText(
m_pan_gamepad_config, // Parent
@ -225,10 +211,6 @@ void GamepadConfiguration::OnCheckboxChange(wxCommandEvent &event)
} else {
m_sl_rumble_intensity->Disable();
}
} else if (cb_id == m_cb_hack_sixaxis_usb->GetId()) {
conf->pad_options[m_pad_id].sixaxis_usb = (m_cb_hack_sixaxis_usb->GetValue()) ? (u32)1 : (u32)0;
} else if (cb_id == m_cb_hack_sixaxis_pressure->GetId()) {
conf->pad_options[m_pad_id].sixaxis_pressure = (m_cb_hack_sixaxis_pressure->GetValue()) ? (u32)1 : (u32)0;
}
}
@ -240,8 +222,6 @@ void GamepadConfiguration::OnCheckboxChange(wxCommandEvent &event)
void GamepadConfiguration::reset()
{
m_cb_rumble->SetValue(m_init_rumble);
m_cb_hack_sixaxis_usb->SetValue(m_init_hack_sixaxis);
m_cb_hack_sixaxis_pressure->SetValue(m_init_hack_sixaxis_pressure);
m_sl_rumble_intensity->SetValue(m_init_rumble_intensity);
m_sl_joystick_sensibility->SetValue(m_init_joystick_sensibility);
}
@ -252,15 +232,11 @@ void GamepadConfiguration::repopulate()
bool val = conf->pad_options[m_pad_id].forcefeedback;
m_init_rumble = val;
m_cb_rumble->SetValue(val);
val = conf->pad_options[m_pad_id].sixaxis_usb;
m_init_hack_sixaxis = val;
m_cb_hack_sixaxis_usb->SetValue(val);
val = conf->pad_options[m_pad_id].sixaxis_pressure;
m_init_hack_sixaxis_pressure = val;
m_cb_hack_sixaxis_pressure->SetValue(val);
int tmp = conf->get_ff_intensity();
m_sl_rumble_intensity->SetValue(tmp);
m_init_rumble_intensity = tmp;
tmp = conf->get_sensibility();
m_sl_joystick_sensibility->SetValue(tmp);
m_init_joystick_sensibility = tmp;

View File

@ -35,14 +35,14 @@
class GamepadConfiguration : public wxDialog
{
wxPanel *m_pan_gamepad_config;
wxCheckBox *m_cb_rumble, *m_cb_hack_sixaxis_usb, *m_cb_hack_sixaxis_pressure;
wxCheckBox *m_cb_rumble;
wxSlider *m_sl_rumble_intensity, *m_sl_joystick_sensibility;
wxButton *m_bt_ok, *m_bt_cancel;
wxStaticText *m_lbl_rumble_intensity;
u32 m_pad_id;
u32 m_init_rumble_intensity, m_init_joystick_sensibility;
bool m_init_rumble, m_init_hack_sixaxis, m_init_hack_sixaxis_pressure;
bool m_init_rumble;
// methods
void repopulate();

View File

@ -161,20 +161,6 @@ bool JoystickInfo::Init(int id)
vbuttonstate.resize(numbuttons);
vhatstate.resize(numhats);
// Sixaxis, dualshock3 hack
// Most buttons are actually axes due to analog pressure support. Only the first 4 buttons
// are digital (select, start, l3, r3). To avoid conflict just forget the others.
// Keep the 4 hat buttons too (usb driver). (left pressure does not work with recent kernel). Moreover the pressure
// work sometime on half axis neg others time in fulll axis. So better keep them as button for the moment
auto found_hack = devname.find("PLAYSTATION(R)3");
// FIXME: people need to restart the plugin to take the option into account.
bool hack_enabled = (conf->pad_options[0].sixaxis_pressure) || (conf->pad_options[1].sixaxis_pressure);
if (found_hack != string::npos && numaxes > 4 && hack_enabled) {
numbuttons = 4; // (select, start, l3, r3)
// Enable this hack in bluetooth too. It avoid to restart the onepad gui
numbuttons += 4; // the 4 hat buttons
}
if (haptic == NULL) {
if (!SDL_JoystickIsHaptic(joy)) {
PAD_LOG("Haptic devices not supported!\n");
@ -239,20 +225,7 @@ bool JoystickInfo::PollButtons(u32 &pkey)
bool JoystickInfo::PollAxes(u32 &pkey)
{
auto found_hack = devname.find("PLAYSTATION(R)3");
for (int i = 0; i < GetNumAxes(); ++i) {
// Sixaxis, dualshock3 hack
if (found_hack != string::npos) {
// The analog mode of the hat button is quite erratic. Values can be in half- axis
// or full axis... So better keep them as button for the moment -- gregory
if (i >= 8 && i <= 11 && (conf->pad_options[pad].sixaxis_usb))
continue;
// Disable accelerometer
if ((i >= 4 && i <= 6))
continue;
}
for (int i = 0; i < numaxes; ++i) {
s32 value = SDL_JoystickGetAxis(GetJoy(), i);
s32 old_value = GetAxisState(i);

View File

@ -47,8 +47,6 @@ extern int button_to_key(int button_id);
extern int axis_to_key(int full_axis, int sign, int axis_id);
extern int hat_to_key(int dir, int axis_id);
//extern int PadEnum[2][2]; // never used
class PADconf
{
u32 ff_intensity;
@ -66,9 +64,7 @@ public:
u16 reverse_ry : 1;
u16 mouse_l : 1;
u16 mouse_r : 1;
u16 sixaxis_usb : 1;
u16 sixaxis_pressure : 1;
u16 _free : 7; // The 8 remaining bits are unused, do what you wish with them ;)
u16 _free : 9; // The 9 remaining bits are unused, do what you wish with them ;)
} pad_options[GAMEPAD_NUMBER]; // One for each pads
u32 packed_options; // Only first 8 bits of each 16 bits series are really used, rest is padding
};

View File

@ -71,8 +71,6 @@ enum PadOptions {
PADOPTION_REVERSERY = 0x10,
PADOPTION_MOUSE_L = 0x20,
PADOPTION_MOUSE_R = 0x40,
PADOPTION_SIXAXIS_USB = 0x80,
PADOPTION_SIXAXIS_PRESSURE = 0x100
};
extern FILE *padLog;