From e762f5eda86e74831d226aed08d111e29f5824e0 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Sun, 10 Apr 2011 00:09:17 +0000 Subject: [PATCH] onepad: various minor cleanups. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4565 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/onepad/Linux/dialog.cpp | 18 ++------------- plugins/onepad/Linux/linux.cpp | 2 +- plugins/onepad/joystick.cpp | 14 ++--------- plugins/onepad/joystick.h | 13 ++++++----- plugins/onepad/keyboard.cpp | 41 --------------------------------- 5 files changed, 12 insertions(+), 76 deletions(-) diff --git a/plugins/onepad/Linux/dialog.cpp b/plugins/onepad/Linux/dialog.cpp index 787754ddf4..d90cb96870 100644 --- a/plugins/onepad/Linux/dialog.cpp +++ b/plugins/onepad/Linux/dialog.cpp @@ -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 diff --git a/plugins/onepad/Linux/linux.cpp b/plugins/onepad/Linux/linux.cpp index 58a04e12ca..b21effb719 100644 --- a/plugins/onepad/Linux/linux.cpp +++ b/plugins/onepad/Linux/linux.cpp @@ -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); diff --git a/plugins/onepad/joystick.cpp b/plugins/onepad/joystick.cpp index 9ad0b1c3f2..6471e7a5fd 100644 --- a/plugins/onepad/joystick.cpp +++ b/plugins/onepad/joystick.cpp @@ -100,7 +100,7 @@ void JoystickInfo::EnumerateJoysticks(vector& 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& 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; diff --git a/plugins/onepad/joystick.h b/plugins/onepad/joystick.h index 904494e626..e62fd44530 100644 --- a/plugins/onepad/joystick.h +++ b/plugins/onepad/joystick.h @@ -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& 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; } diff --git a/plugins/onepad/keyboard.cpp b/plugins/onepad/keyboard.cpp index 879db6544b..c0454ff1db 100644 --- a/plugins/onepad/keyboard.cpp +++ b/plugins/onepad/keyboard.cpp @@ -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;