mirror of https://github.com/PCSX2/pcsx2.git
onepad:
* test the reading of the configuration file (will be safer with the previous configuration format). * bump the version git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4748 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
f60012a209
commit
d726be3364
|
@ -63,7 +63,7 @@ string KeyName(int pad, int key, int keysym)
|
|||
case PAD_AXIS:
|
||||
{
|
||||
if (key_to_axis_type(pad,key))
|
||||
sprintf(&tmp[0], "JAxis %d Full", key_to_axis(pad, key), key_to_axis_sign(pad, key) ? "-" : "+");
|
||||
sprintf(&tmp[0], "JAxis %d Full", key_to_axis(pad, key));
|
||||
else
|
||||
sprintf(&tmp[0], "JAxis %d Half%s", key_to_axis(pad, key), key_to_axis_sign(pad, key) ? "-" : "+");
|
||||
break;
|
||||
|
@ -169,12 +169,17 @@ void LoadConfig()
|
|||
return;
|
||||
}
|
||||
|
||||
fscanf(f, "log = %d\n", &conf->log);
|
||||
fscanf(f, "options = %d\n", &conf->options);
|
||||
fscanf(f, "mouse_sensibility = %d\n", &conf->sensibility);
|
||||
fscanf(f, "joy_pad_map = %d\n", &conf->joyid_map);
|
||||
for (int pad = 0; pad < 2; pad++)
|
||||
u32 value;
|
||||
if (fscanf(f, "log = %d\n", &value) == 0) return;
|
||||
conf->log = value;
|
||||
if (fscanf(f, "options = %d\n", &value) == 0) return;
|
||||
conf->options = value;
|
||||
if (fscanf(f, "mouse_sensibility = %d\n", &value) == 0) return;
|
||||
conf->sensibility = value;
|
||||
if (fscanf(f, "joy_pad_map = %d\n", &value) == 0) return;
|
||||
conf->joyid_map = value;
|
||||
|
||||
for (int pad = 0; pad < 2; pad++)
|
||||
{
|
||||
for (int key = 0; key < MAX_KEYS; key++)
|
||||
{
|
||||
|
|
|
@ -281,17 +281,12 @@ bool JoystickInfo::PollButtons(u32 &pkey)
|
|||
{
|
||||
continue;
|
||||
}
|
||||
// Pressure sensitive button are detected as both button (digital) and axe (analog). So better
|
||||
// drop the button to emulate the pressure sensiblity of the ds2 :) -- Gregory
|
||||
for (int j = 0; j < GetNumAxes(); ++j) {
|
||||
int value = SDL_JoystickGetAxis(GetJoy(), j);
|
||||
int old_value = GetAxisState(j);
|
||||
bool full_axis = (old_value < -0x3FFF) ? true : false;
|
||||
if (value != old_value && ((full_axis && value > -0x6FFF ) || (!full_axis && abs(value) > old_value))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
// Pressure sensitive button are detected as both button (digital) and axes (analog). So better
|
||||
// drop the button to emulate the pressure sensiblity of the ds2 :) -- Gregory
|
||||
u32 pkey_dummy;
|
||||
if (PollAxes(pkey_dummy))
|
||||
return false;
|
||||
|
||||
pkey = button_to_key(i);
|
||||
return true;
|
||||
|
@ -315,19 +310,23 @@ bool JoystickInfo::PollAxes(u32 &pkey)
|
|||
// Half+: 0 (release) -> 32768
|
||||
// Half-: 0 (release) -> -32768
|
||||
// Full (like dualshock 3): -32768 (release) ->32768
|
||||
bool full_axis = (old_value < -0x2FFF) ? true : false;
|
||||
const s32 full_axis_ceil = -0x6FFF;
|
||||
const s32 half_axis_ceil = 0x1FFF;
|
||||
|
||||
if ((!full_axis && abs(value) <= 0x1FFF)
|
||||
|| (full_axis && value <= -0x6FFF)) // we don't want this
|
||||
// Normally, old_value contains the release state so it can be used to detect the types of axis.
|
||||
bool is_full_axis = (old_value < full_axis_ceil) ? true : false;
|
||||
|
||||
if ((!is_full_axis && abs(value) <= half_axis_ceil)
|
||||
|| (is_full_axis && value <= full_axis_ceil)) // we don't want this
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((!full_axis && abs(value) > 0x3FFF)
|
||||
|| (full_axis && value > -0x6FFF))
|
||||
if ((!is_full_axis && abs(value) > half_axis_ceil)
|
||||
|| (is_full_axis && value > full_axis_ceil))
|
||||
{
|
||||
bool sign = (value < 0);
|
||||
pkey = axis_to_key(full_axis, sign, i);
|
||||
pkey = axis_to_key(is_full_axis, sign, i);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ class JoystickInfo
|
|||
{
|
||||
public:
|
||||
JoystickInfo() : devname(""), _id(-1), numbuttons(0), numaxes(0), numhats(0), axisrange(0x7fff),
|
||||
deadzone(2000), pad(-1), joy(NULL) {
|
||||
deadzone(1500), pad(-1), joy(NULL) {
|
||||
vbuttonstate.clear();
|
||||
vaxisstate.clear();
|
||||
vhatstate.clear();
|
||||
|
@ -94,7 +94,7 @@ class JoystickInfo
|
|||
return pad;
|
||||
}
|
||||
|
||||
int GetDeadzone(/*int axis*/)
|
||||
int GetDeadzone()
|
||||
{
|
||||
return deadzone;
|
||||
}
|
||||
|
@ -141,7 +141,6 @@ class JoystickInfo
|
|||
}
|
||||
int GetAxisFromKey(int pad, int index);
|
||||
private:
|
||||
|
||||
string devname; // pretty device name
|
||||
int _id;
|
||||
int numbuttons, numaxes, numhats;
|
||||
|
|
|
@ -47,7 +47,7 @@ std::string s_strLogPath("logs/");
|
|||
bool toggleAutoRepeat = true;
|
||||
|
||||
const u32 version = PS2E_PAD_VERSION;
|
||||
const u32 revision = 0;
|
||||
const u32 revision = 1;
|
||||
const u32 build = 1; // increase that with each version
|
||||
|
||||
int PadEnum[2][2] = {{0, 2}, {1, 3}};
|
||||
|
|
Loading…
Reference in New Issue