onepad: various minor cleanups.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4565 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2011-04-10 00:09:17 +00:00
parent 80e540c70b
commit e762f5eda8
5 changed files with 12 additions and 76 deletions

View File

@ -200,25 +200,11 @@ class keys_tree
};
keys_tree *fir;
int _GetJoystickIdFromPAD(int pad)
int _GetJoystickId()
{
// select the right joystick id
u32 joyid = -1;
// for (int p = 0; p < MAX_SUB_KEYS; p++)
// {
// for (int i = 0; i < MAX_KEYS; ++i)
// {
// KeyType k = type_of_key(PadEnum[pad][p],i);
//
// if (k == PAD_JOYSTICK || k == PAD_JOYBUTTONS)
// {
// joyid = key_to_joystick_id(PadEnum[pad][p],i);
// return joyid;
// }
// }
// }
if (!JoystickIdWithinBounds(joyid))
{
// get first unused joystick
@ -234,7 +220,7 @@ int _GetJoystickIdFromPAD(int pad)
int Get_Current_Joystick()
{
// check bounds
int joyid = _GetJoystickIdFromPAD(0);
int joyid = _GetJoystickId();
if (JoystickIdWithinBounds(joyid))
return joyid + 1; // select the combo

View File

@ -180,7 +180,7 @@ EXPORT_C_(void) PADupdate(int pad)
case PAD_LY:
case PAD_RX:
case PAD_RY:
if (abs(value) > (pjoy)->GetDeadzone(value))
if (abs(value) > (pjoy)->GetDeadzone(/*value*/))
Analog::ConfigurePad(pad, i, value);
else
Analog::ResetPad(pad, i);

View File

@ -100,7 +100,7 @@ void JoystickInfo::EnumerateJoysticks(vector<JoystickInfo*>& vjoysticks)
for (int i = 0; i < (int)vjoysticks.size(); ++i)
{
vjoysticks[i] = new JoystickInfo();
vjoysticks[i]->Init(i, true);
vjoysticks[i]->Init(i);
}
// set the pads
@ -124,16 +124,6 @@ void JoystickInfo::EnumerateJoysticks(vector<JoystickInfo*>& vjoysticks)
}
JoystickInfo::JoystickInfo()
{
joy = NULL;
_id = -1;
pad = -1;
axisrange = 0x7fff;
deadzone = 2000;
}
void JoystickInfo::Destroy()
{
if (joy != NULL)
@ -143,7 +133,7 @@ void JoystickInfo::Destroy()
}
}
bool JoystickInfo::Init(int id, bool bStartThread)
bool JoystickInfo::Init(int id)
{
Destroy();
_id = id;

View File

@ -35,27 +35,28 @@
class JoystickInfo
{
public:
JoystickInfo();
JoystickInfo() : devname(""), _id(-1), numbuttons(0), numaxes(0), numhats(0), axisrange(0x7fff),
deadzone(2000), pad(-1), vbuttonstate(NULL), vaxisstate(NULL), vhatstate(NULL), joy(NULL) {}
~JoystickInfo()
{
Destroy();
}
JoystickInfo(const JoystickInfo&); // copy constructor
JoystickInfo& operator=(const JoystickInfo&); // assignment
void Destroy();
// opens handles to all possible joysticks
static void EnumerateJoysticks(vector<JoystickInfo*>& vjoysticks);
bool Init(int id, bool bStartThread = true); // opens a handle and gets information
bool Init(int id); // opens a handle and gets information
void Assign(int pad); // assigns a joystick to a pad
void TestForce();
bool PollButtons(int &jbutton, u32 &pkey);
bool PollAxes(int &axis_id, u32 &pkey);
bool PollHats(int &jbutton, int &dir, u32 &pkey);
bool PollPOV(int &axis_id, bool &sign, u32 &pkey);
const string& GetName()
@ -88,7 +89,7 @@ class JoystickInfo
return pad;
}
int GetDeadzone(int axis)
int GetDeadzone(/*int axis*/)
{
return deadzone;
}

View File

@ -227,47 +227,6 @@ LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
event.key = wParam;
break;
/*case WM_LBUTTONDOWN:
lbutton = true;
break;
case WM_LBUTTONUP:
g_lanalog[0].x = 0x80;
g_lanalog[0].y = 0x80;
g_lanalog[1].x = 0x80;
g_lanalog[1].y = 0x80;
lbutton = false;
break;
case WM_RBUTTONDOWN:
rbutton = true;
break;
case WM_RBUTTONUP:
g_ranalog[0].x = 0x80;
g_ranalog[0].y = 0x80;
g_ranalog[1].x = 0x80;
g_ranalog[1].y = 0x80;
rbutton = false;
break;
case WM_MOUSEMOVE:
if (lbutton)
{
g_lanalog[0].x = LOWORD(lParam) & 254;
g_lanalog[0].y = HIWORD(lParam) & 254;
g_lanalog[1].x = LOWORD(lParam) & 254;
g_lanalog[1].y = HIWORD(lParam) & 254;
}
if (rbutton)
{
g_ranalog[0].x = LOWORD(lParam) & 254;
g_ranalog[0].y = HIWORD(lParam) & 254;
g_ranalog[1].x = LOWORD(lParam) & 254;
g_ranalog[1].y = HIWORD(lParam) & 254;
}
break;*/
case WM_DESTROY:
case WM_QUIT:
event.evt = KEYPRESS;