PadNull: A bit more work on the Windows side.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1244 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2009-05-23 06:50:10 +00:00
parent a180b105d3
commit fea158f392
3 changed files with 52 additions and 14 deletions

View File

@ -63,11 +63,7 @@ void _PadUpdate(int pad)
s32 _PADOpen(void *pDsp)
{
//XKeyboardState *settings;
GSdsp = *(Display**)pDsp;
//XGetKeyboardControl(GSdsp, settings);
//autoRepeatMode = settings->global_auto_repeat;
XAutoRepeatOff(GSdsp);
return 0;
@ -76,8 +72,4 @@ s32 _PADOpen(void *pDsp)
void _PADClose()
{
XAutoRepeatOn(GSdsp);
//XKeyboardControl *settings;
//settings->auto_repeat_mode = autoRepeatMode;
//XChangeKeyboardControl(GSdsp, KBAutoRepeatMode, settings);
}

View File

@ -106,8 +106,6 @@ EXPORT_C_(s32) PADopen(void *pDsp)
memset(&event, 0, sizeof(event));
return _PADOpen(pDsp);
return 0;
}
EXPORT_C_(void) PADclose()

View File

@ -16,18 +16,66 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "PadWin.h"
#include "PadWin.h"
LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
WNDPROC GSwndProc = NULL;
HWND GShwnd = NULL;
LRESULT WINAPI PADwndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_KEYDOWN:
if (lParam & 0x40000000)return TRUE;
event.evt = KEYPRESS;
event.key = wParam;
break;
case WM_KEYUP:
event.evt = KEYRELEASE;
event.key = wParam;
break;
case WM_DESTROY:
case WM_QUIT:
event.evt = KEYPRESS;
event.key = VK_ESCAPE;
return GSwndProc(hWnd, msg, wParam, lParam);
default:
return GSwndProc(hWnd, msg, wParam, lParam);
};
return TRUE;
}
void _PadUpdate(int pad)
{
}
s32 _PADOpen(void *pDsp)
{
{
GShwnd = (HWND)*(long*)pDsp;
if (GShwnd != NULL && GSwndProc != NULL)
{
// revert
SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(GSwndProc));
}
GSwndProc = (WNDPROC)GetWindowLongPtr(GShwnd, GWLP_WNDPROC);
GSwndProc = ((WNDPROC)SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(PADwndProc)));
return 0;
}
void _PADClose()
{
{
if (GShwnd != NULL && GSwndProc != NULL)
{
SetWindowLongPtr(GShwnd, GWLP_WNDPROC, (LPARAM)(WNDPROC)(GSwndProc));
GSwndProc = NULL;
GShwnd = NULL;
}
}