2000-11-05 20:25:02 +00:00
|
|
|
/* DirectInput Keyboard device
|
|
|
|
*
|
|
|
|
* Copyright 1998 Marcus Meissner
|
|
|
|
* Copyright 1998,1999 Lionel Ulmer
|
2002-06-14 00:39:44 +00:00
|
|
|
* Copyright 2000-2001 TransGaming Technologies Inc.
|
2000-11-05 20:25:02 +00:00
|
|
|
*
|
2002-03-09 23:29:33 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2000-11-05 20:25:02 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
2002-07-22 21:53:32 +00:00
|
|
|
#include "wine/port.h"
|
|
|
|
|
2003-09-05 23:08:26 +00:00
|
|
|
#include <stdarg.h>
|
2000-11-05 20:25:02 +00:00
|
|
|
#include <string.h>
|
2003-09-05 23:08:26 +00:00
|
|
|
#include "windef.h"
|
2001-10-18 21:30:06 +00:00
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
2000-11-05 20:25:02 +00:00
|
|
|
#include "winerror.h"
|
|
|
|
#include "dinput.h"
|
|
|
|
|
|
|
|
#include "dinput_private.h"
|
|
|
|
#include "device_private.h"
|
2002-03-09 23:29:33 +00:00
|
|
|
#include "wine/debug.h"
|
2003-06-16 20:22:13 +00:00
|
|
|
#include "wine/unicode.h"
|
2000-11-05 20:25:02 +00:00
|
|
|
|
2002-03-09 23:29:33 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
|
2000-11-05 20:25:02 +00:00
|
|
|
|
2004-08-12 23:00:51 +00:00
|
|
|
static IDirectInputDevice8AVtbl SysKeyboardAvt;
|
|
|
|
static IDirectInputDevice8WVtbl SysKeyboardWvt;
|
2002-05-07 01:49:19 +00:00
|
|
|
|
2003-06-16 20:22:13 +00:00
|
|
|
typedef struct SysKeyboardImpl SysKeyboardImpl;
|
|
|
|
struct SysKeyboardImpl
|
2000-11-05 20:25:02 +00:00
|
|
|
{
|
2002-06-14 00:39:44 +00:00
|
|
|
LPVOID lpVtbl;
|
2000-11-05 20:25:02 +00:00
|
|
|
DWORD ref;
|
|
|
|
GUID guid;
|
|
|
|
|
2003-06-16 20:22:13 +00:00
|
|
|
IDirectInputImpl* dinput;
|
2002-05-31 23:06:46 +00:00
|
|
|
|
|
|
|
HANDLE hEvent;
|
2000-11-05 20:25:02 +00:00
|
|
|
/* SysKeyboardAImpl */
|
|
|
|
int acquired;
|
2002-05-19 22:26:16 +00:00
|
|
|
int buffersize; /* set in 'SetProperty' */
|
|
|
|
LPDIDEVICEOBJECTDATA buffer; /* buffer for 'GetDeviceData'.
|
|
|
|
Alloc at 'Acquire', Free at
|
|
|
|
'Unacquire' */
|
|
|
|
int count; /* number of objects in use in
|
|
|
|
'buffer' */
|
|
|
|
int start; /* 'buffer' rotates. This is the
|
|
|
|
first in use (if count > 0) */
|
|
|
|
BOOL overflow; /* return DI_BUFFEROVERFLOW in
|
|
|
|
'GetDeviceData' */
|
|
|
|
CRITICAL_SECTION crit;
|
2000-11-05 20:25:02 +00:00
|
|
|
};
|
|
|
|
|
2003-06-16 20:22:13 +00:00
|
|
|
SysKeyboardImpl *current; /* Today's acquired device
|
2002-05-19 22:26:16 +00:00
|
|
|
FIXME: currently this can be only one.
|
|
|
|
Maybe this should be a linked list or st.
|
2002-05-31 23:06:46 +00:00
|
|
|
I don't know what the rules are for multiple acquired keyboards,
|
2002-05-19 22:26:16 +00:00
|
|
|
but 'DI_LOSTFOCUS' and 'DI_UNACQUIRED' exist for a reason.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static BYTE DInputKeyState[256]; /* array for 'GetDeviceState' */
|
|
|
|
|
2003-08-12 23:50:54 +00:00
|
|
|
static CRITICAL_SECTION keyboard_crit;
|
|
|
|
static CRITICAL_SECTION_DEBUG critsect_debug =
|
|
|
|
{
|
|
|
|
0, 0, &keyboard_crit,
|
|
|
|
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
|
|
|
|
0, 0, { 0, (DWORD)(__FILE__ ": keyboard_crit") }
|
|
|
|
};
|
|
|
|
static CRITICAL_SECTION keyboard_crit = { &critsect_debug, -1, 0, 0, 0, 0 };
|
|
|
|
|
2003-02-11 22:10:11 +00:00
|
|
|
static DWORD keyboard_users;
|
|
|
|
static HHOOK keyboard_hook;
|
2002-05-19 22:26:16 +00:00
|
|
|
|
|
|
|
LRESULT CALLBACK KeyboardCallback( int code, WPARAM wparam, LPARAM lparam )
|
|
|
|
{
|
2002-08-06 23:49:12 +00:00
|
|
|
TRACE("(%d,%d,%ld)\n", code, wparam, lparam);
|
|
|
|
|
2002-05-19 22:26:16 +00:00
|
|
|
if (code == HC_ACTION)
|
|
|
|
{
|
|
|
|
BYTE dik_code;
|
|
|
|
BOOL down;
|
|
|
|
DWORD timestamp;
|
2003-02-24 20:41:28 +00:00
|
|
|
|
2002-05-19 22:26:16 +00:00
|
|
|
{
|
|
|
|
KBDLLHOOKSTRUCT *hook = (KBDLLHOOKSTRUCT *)lparam;
|
|
|
|
dik_code = hook->scanCode;
|
|
|
|
if (hook->flags & LLKHF_EXTENDED) dik_code |= 0x80;
|
|
|
|
down = !(hook->flags & LLKHF_UP);
|
|
|
|
timestamp = hook->time;
|
|
|
|
}
|
|
|
|
|
|
|
|
DInputKeyState[dik_code] = (down ? 0x80 : 0);
|
2004-04-12 22:07:12 +00:00
|
|
|
TRACE(" setting %02X to %02X\n", dik_code, DInputKeyState[dik_code]);
|
|
|
|
|
2002-05-19 22:26:16 +00:00
|
|
|
if (current != NULL)
|
|
|
|
{
|
|
|
|
if (current->hEvent)
|
|
|
|
SetEvent(current->hEvent);
|
|
|
|
|
|
|
|
if (current->buffer != NULL)
|
|
|
|
{
|
|
|
|
int n;
|
|
|
|
|
|
|
|
EnterCriticalSection(&(current->crit));
|
|
|
|
|
|
|
|
n = (current->start + current->count) % current->buffersize;
|
|
|
|
|
|
|
|
current->buffer[n].dwOfs = dik_code;
|
|
|
|
current->buffer[n].dwData = down ? 0x80 : 0;
|
|
|
|
current->buffer[n].dwTimeStamp = timestamp;
|
|
|
|
current->buffer[n].dwSequence = current->dinput->evsequence++;
|
|
|
|
|
2002-08-06 23:49:12 +00:00
|
|
|
TRACE("Adding event at offset %d : %ld - %ld - %ld - %ld\n", n,
|
|
|
|
current->buffer[n].dwOfs, current->buffer[n].dwData, current->buffer[n].dwTimeStamp, current->buffer[n].dwSequence);
|
|
|
|
|
2002-05-19 22:26:16 +00:00
|
|
|
if (current->count == current->buffersize)
|
|
|
|
{
|
2003-06-13 18:55:41 +00:00
|
|
|
current->start = ++current->start % current->buffersize;
|
2002-05-19 22:26:16 +00:00
|
|
|
current->overflow = TRUE;
|
|
|
|
}
|
2002-05-31 23:06:46 +00:00
|
|
|
else
|
2002-05-19 22:26:16 +00:00
|
|
|
current->count++;
|
|
|
|
|
|
|
|
LeaveCriticalSection(&(current->crit));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallNextHookEx(keyboard_hook, code, wparam, lparam);
|
|
|
|
}
|
2002-05-07 01:49:19 +00:00
|
|
|
|
2000-11-05 20:25:02 +00:00
|
|
|
static GUID DInput_Wine_Keyboard_GUID = { /* 0ab8648a-7735-11d2-8c73-71df54a96441 */
|
|
|
|
0x0ab8648a,
|
|
|
|
0x7735,
|
|
|
|
0x11d2,
|
|
|
|
{0x8c, 0x73, 0x71, 0xdf, 0x54, 0xa9, 0x64, 0x41}
|
|
|
|
};
|
|
|
|
|
2003-06-16 20:22:13 +00:00
|
|
|
static void fill_keyboard_dideviceinstanceA(LPDIDEVICEINSTANCEA lpddi, int version) {
|
2003-02-24 20:41:28 +00:00
|
|
|
DWORD dwSize;
|
|
|
|
DIDEVICEINSTANCEA ddi;
|
|
|
|
|
|
|
|
dwSize = lpddi->dwSize;
|
|
|
|
|
|
|
|
TRACE("%ld %p\n", dwSize, lpddi);
|
|
|
|
|
|
|
|
memset(lpddi, 0, dwSize);
|
|
|
|
memset(&ddi, 0, sizeof(ddi));
|
|
|
|
|
|
|
|
ddi.dwSize = dwSize;
|
|
|
|
ddi.guidInstance = GUID_SysKeyboard;/* DInput's GUID */
|
|
|
|
ddi.guidProduct = DInput_Wine_Keyboard_GUID; /* Vendor's GUID */
|
2003-06-13 18:55:41 +00:00
|
|
|
if (version >= 8)
|
|
|
|
ddi.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8);
|
|
|
|
else
|
|
|
|
ddi.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8);
|
2003-02-24 20:41:28 +00:00
|
|
|
strcpy(ddi.tszInstanceName, "Keyboard");
|
|
|
|
strcpy(ddi.tszProductName, "Wine Keyboard");
|
|
|
|
|
|
|
|
memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
|
|
|
|
}
|
|
|
|
|
2003-06-16 20:22:13 +00:00
|
|
|
static void fill_keyboard_dideviceinstanceW(LPDIDEVICEINSTANCEW lpddi, int version) {
|
|
|
|
DWORD dwSize;
|
|
|
|
DIDEVICEINSTANCEW ddi;
|
|
|
|
|
|
|
|
dwSize = lpddi->dwSize;
|
|
|
|
|
|
|
|
TRACE("%ld %p\n", dwSize, lpddi);
|
|
|
|
|
|
|
|
memset(lpddi, 0, dwSize);
|
|
|
|
memset(&ddi, 0, sizeof(ddi));
|
|
|
|
|
|
|
|
ddi.dwSize = dwSize;
|
|
|
|
ddi.guidInstance = GUID_SysKeyboard;/* DInput's GUID */
|
|
|
|
ddi.guidProduct = DInput_Wine_Keyboard_GUID; /* Vendor's GUID */
|
|
|
|
if (version >= 8)
|
|
|
|
ddi.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8);
|
|
|
|
else
|
|
|
|
ddi.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8);
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, "Keyboard", -1, ddi.tszInstanceName, MAX_PATH);
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, "Wine Keyboard", -1, ddi.tszProductName, MAX_PATH);
|
|
|
|
|
|
|
|
memcpy(lpddi, &ddi, (dwSize < sizeof(ddi) ? dwSize : sizeof(ddi)));
|
|
|
|
}
|
|
|
|
|
2004-09-13 19:16:47 +00:00
|
|
|
static BOOL keyboarddev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version, int id)
|
2003-06-16 20:22:13 +00:00
|
|
|
{
|
2004-09-13 19:16:47 +00:00
|
|
|
if (id != 0)
|
|
|
|
return FALSE;
|
|
|
|
|
2003-06-16 20:22:13 +00:00
|
|
|
if ((dwDevType == 0) ||
|
|
|
|
((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 8)) ||
|
2004-12-13 13:17:03 +00:00
|
|
|
(((dwDevType == DI8DEVCLASS_KEYBOARD) || (dwDevType == DI8DEVTYPE_KEYBOARD)) && (version >= 8))) {
|
2003-06-16 20:22:13 +00:00
|
|
|
TRACE("Enumerating the Keyboard device\n");
|
|
|
|
|
|
|
|
fill_keyboard_dideviceinstanceA(lpddi, version);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-09-13 19:16:47 +00:00
|
|
|
static BOOL keyboarddev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, int version, int id)
|
2000-11-05 20:25:02 +00:00
|
|
|
{
|
2004-09-13 19:16:47 +00:00
|
|
|
if (id != 0)
|
|
|
|
return FALSE;
|
|
|
|
|
2003-06-13 18:55:41 +00:00
|
|
|
if ((dwDevType == 0) ||
|
|
|
|
((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 8)) ||
|
2004-12-13 13:17:03 +00:00
|
|
|
(((dwDevType == DI8DEVCLASS_KEYBOARD) || (dwDevType == DI8DEVTYPE_KEYBOARD)) && (version >= 8))) {
|
2000-11-05 20:25:02 +00:00
|
|
|
TRACE("Enumerating the Keyboard device\n");
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2003-06-16 20:22:13 +00:00
|
|
|
fill_keyboard_dideviceinstanceW(lpddi, version);
|
2003-02-24 20:41:28 +00:00
|
|
|
|
2000-11-05 20:25:02 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2003-06-16 20:22:13 +00:00
|
|
|
static SysKeyboardImpl *alloc_device(REFGUID rguid, LPVOID kvt, IDirectInputImpl *dinput)
|
2000-11-05 20:25:02 +00:00
|
|
|
{
|
2003-06-16 20:22:13 +00:00
|
|
|
SysKeyboardImpl* newDevice;
|
|
|
|
newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysKeyboardImpl));
|
2002-06-14 00:39:44 +00:00
|
|
|
newDevice->lpVtbl = kvt;
|
2000-11-05 20:25:02 +00:00
|
|
|
newDevice->ref = 1;
|
|
|
|
memcpy(&(newDevice->guid),rguid,sizeof(*rguid));
|
|
|
|
newDevice->dinput = dinput;
|
|
|
|
|
2003-02-11 22:10:11 +00:00
|
|
|
EnterCriticalSection(&keyboard_crit);
|
|
|
|
if (!keyboard_users++)
|
2003-02-12 21:27:00 +00:00
|
|
|
keyboard_hook = SetWindowsHookExW( WH_KEYBOARD_LL, KeyboardCallback, DINPUT_instance, 0 );
|
2003-02-11 22:10:11 +00:00
|
|
|
LeaveCriticalSection(&keyboard_crit);
|
|
|
|
|
2000-11-05 20:25:02 +00:00
|
|
|
return newDevice;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-06-16 20:22:13 +00:00
|
|
|
static HRESULT keyboarddev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev)
|
2000-11-05 20:25:02 +00:00
|
|
|
{
|
|
|
|
if ((IsEqualGUID(&GUID_SysKeyboard,rguid)) || /* Generic Keyboard */
|
|
|
|
(IsEqualGUID(&DInput_Wine_Keyboard_GUID,rguid))) { /* Wine Keyboard */
|
2002-06-14 00:39:44 +00:00
|
|
|
if ((riid == NULL) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDeviceA,riid) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDevice2A,riid) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDevice7A,riid) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDevice8A,riid)) {
|
2003-06-16 20:22:13 +00:00
|
|
|
*pdev = (IDirectInputDeviceA*) alloc_device(rguid, &SysKeyboardAvt, dinput);
|
2000-11-05 20:25:02 +00:00
|
|
|
TRACE("Creating a Keyboard device (%p)\n", *pdev);
|
|
|
|
return DI_OK;
|
|
|
|
} else
|
|
|
|
return DIERR_NOINTERFACE;
|
|
|
|
}
|
2003-06-16 20:22:13 +00:00
|
|
|
return DIERR_DEVICENOTREG;
|
|
|
|
}
|
2000-11-05 20:25:02 +00:00
|
|
|
|
2003-06-16 20:22:13 +00:00
|
|
|
static HRESULT keyboarddev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev)
|
|
|
|
{
|
|
|
|
if ((IsEqualGUID(&GUID_SysKeyboard,rguid)) || /* Generic Keyboard */
|
|
|
|
(IsEqualGUID(&DInput_Wine_Keyboard_GUID,rguid))) { /* Wine Keyboard */
|
|
|
|
if ((riid == NULL) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDeviceW,riid) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDevice2W,riid) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDevice7W,riid) ||
|
|
|
|
IsEqualGUID(&IID_IDirectInputDevice8W,riid)) {
|
|
|
|
*pdev = (IDirectInputDeviceW*) alloc_device(rguid, &SysKeyboardWvt, dinput);
|
|
|
|
TRACE("Creating a Keyboard device (%p)\n", *pdev);
|
|
|
|
return DI_OK;
|
|
|
|
} else
|
|
|
|
return DIERR_NOINTERFACE;
|
|
|
|
}
|
2000-11-05 20:25:02 +00:00
|
|
|
return DIERR_DEVICENOTREG;
|
|
|
|
}
|
|
|
|
|
|
|
|
static dinput_device keyboarddev = {
|
2000-12-12 00:38:58 +00:00
|
|
|
100,
|
2004-06-04 18:06:37 +00:00
|
|
|
"Wine keyboard driver",
|
2003-06-16 20:22:13 +00:00
|
|
|
keyboarddev_enum_deviceA,
|
|
|
|
keyboarddev_enum_deviceW,
|
|
|
|
keyboarddev_create_deviceA,
|
|
|
|
keyboarddev_create_deviceW
|
2000-11-05 20:25:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
DECL_GLOBAL_CONSTRUCTOR(keyboarddev_register) { dinput_register_device(&keyboarddev); }
|
|
|
|
|
2003-02-11 22:10:11 +00:00
|
|
|
static ULONG WINAPI SysKeyboardAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
|
|
|
|
{
|
2004-09-09 20:17:07 +00:00
|
|
|
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
2004-09-17 18:10:41 +00:00
|
|
|
ULONG ref;
|
2003-02-11 22:10:11 +00:00
|
|
|
|
2004-09-17 18:10:41 +00:00
|
|
|
ref = InterlockedDecrement(&(This->ref));
|
|
|
|
if (ref)
|
|
|
|
return ref;
|
2003-02-11 22:10:11 +00:00
|
|
|
|
|
|
|
EnterCriticalSection(&keyboard_crit);
|
|
|
|
if (!--keyboard_users) {
|
|
|
|
UnhookWindowsHookEx( keyboard_hook );
|
|
|
|
keyboard_hook = 0;
|
|
|
|
}
|
|
|
|
LeaveCriticalSection(&keyboard_crit);
|
|
|
|
|
|
|
|
/* Free the data queue */
|
2004-12-23 17:06:43 +00:00
|
|
|
HeapFree(GetProcessHeap(),0,This->buffer);
|
2003-02-11 22:10:11 +00:00
|
|
|
|
|
|
|
DeleteCriticalSection(&(This->crit));
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(),0,This);
|
2003-06-13 18:55:41 +00:00
|
|
|
return DI_OK;
|
2003-02-11 22:10:11 +00:00
|
|
|
}
|
|
|
|
|
2000-11-05 20:25:02 +00:00
|
|
|
static HRESULT WINAPI SysKeyboardAImpl_SetProperty(
|
2002-06-14 00:39:44 +00:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,REFGUID rguid,LPCDIPROPHEADER ph
|
2000-11-05 20:25:02 +00:00
|
|
|
)
|
|
|
|
{
|
2004-09-09 20:17:07 +00:00
|
|
|
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
2000-11-05 20:25:02 +00:00
|
|
|
|
|
|
|
TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph);
|
|
|
|
TRACE("(size=%ld,headersize=%ld,obj=%ld,how=%ld\n",
|
|
|
|
ph->dwSize,ph->dwHeaderSize,ph->dwObj,ph->dwHow);
|
|
|
|
if (!HIWORD(rguid)) {
|
|
|
|
switch ((DWORD)rguid) {
|
|
|
|
case (DWORD) DIPROP_BUFFERSIZE: {
|
|
|
|
LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
|
|
|
|
|
|
|
|
TRACE("(buffersize=%ld)\n",pd->dwData);
|
2002-05-19 22:26:16 +00:00
|
|
|
|
|
|
|
if (This->acquired)
|
|
|
|
return DIERR_INVALIDPARAM;
|
|
|
|
|
|
|
|
This->buffersize = pd->dwData;
|
|
|
|
|
2000-11-05 20:25:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
WARN("Unknown type %ld\n",(DWORD)rguid);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2003-06-13 18:55:41 +00:00
|
|
|
return DI_OK;
|
2000-11-05 20:25:02 +00:00
|
|
|
}
|
|
|
|
|
2005-02-15 15:03:03 +00:00
|
|
|
static HRESULT WINAPI SysKeyboardAImpl_GetProperty(
|
|
|
|
LPDIRECTINPUTDEVICE8A iface,REFGUID rguid,LPDIPROPHEADER ph
|
|
|
|
)
|
|
|
|
{
|
|
|
|
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
|
|
|
|
|
|
|
TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph);
|
|
|
|
TRACE("(size=%ld,headersize=%ld,obj=%ld,how=%ld\n",
|
|
|
|
ph->dwSize,ph->dwHeaderSize,ph->dwObj,ph->dwHow);
|
|
|
|
if (!HIWORD(rguid)) {
|
|
|
|
switch ((DWORD)rguid) {
|
|
|
|
case (DWORD) DIPROP_BUFFERSIZE: {
|
|
|
|
LPDIPROPDWORD pd = (LPDIPROPDWORD)ph;
|
|
|
|
|
|
|
|
TRACE("(buffersize=%ld)\n",pd->dwData);
|
|
|
|
|
|
|
|
if (This->acquired)
|
|
|
|
return DIERR_INVALIDPARAM;
|
|
|
|
|
|
|
|
pd->dwData = This->buffersize;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
WARN("Unknown type %ld\n",(DWORD)rguid);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
2000-11-05 20:25:02 +00:00
|
|
|
static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(
|
2002-06-14 00:39:44 +00:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr
|
2000-11-05 20:25:02 +00:00
|
|
|
)
|
|
|
|
{
|
2003-06-13 18:55:41 +00:00
|
|
|
TRACE("(%p)->(%ld,%p)\n", iface, len, ptr);
|
|
|
|
|
2002-05-19 22:26:16 +00:00
|
|
|
/* Note: device does not need to be acquired */
|
2001-10-18 21:30:06 +00:00
|
|
|
if (len != 256)
|
2002-05-19 22:26:16 +00:00
|
|
|
return DIERR_INVALIDPARAM;
|
|
|
|
|
2003-06-04 20:11:56 +00:00
|
|
|
MsgWaitForMultipleObjectsEx(0, NULL, 0, 0, 0);
|
|
|
|
|
2004-04-12 22:07:12 +00:00
|
|
|
if (TRACE_ON(dinput)) {
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < 256; i++) {
|
|
|
|
if (DInputKeyState[i] != 0x00) {
|
|
|
|
TRACE(" - %02X: %02x\n", i, DInputKeyState[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-19 22:26:16 +00:00
|
|
|
memcpy(ptr, DInputKeyState, 256);
|
2001-10-18 21:30:06 +00:00
|
|
|
return DI_OK;
|
2000-11-05 20:25:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI SysKeyboardAImpl_GetDeviceData(
|
2002-06-14 00:39:44 +00:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,DWORD dodsize,LPDIDEVICEOBJECTDATA dod,
|
2000-11-05 20:25:02 +00:00
|
|
|
LPDWORD entries,DWORD flags
|
|
|
|
)
|
|
|
|
{
|
2004-09-09 20:17:07 +00:00
|
|
|
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
2002-05-19 22:26:16 +00:00
|
|
|
int ret = DI_OK, i = 0;
|
2000-11-05 20:25:02 +00:00
|
|
|
|
|
|
|
TRACE("(this=%p,%ld,%p,%p(%ld)),0x%08lx)\n",
|
|
|
|
This,dodsize,dod,entries,entries?*entries:0,flags);
|
|
|
|
|
2002-08-06 23:49:12 +00:00
|
|
|
if (This->acquired == 0)
|
|
|
|
return DIERR_NOTACQUIRED;
|
|
|
|
|
2002-05-19 22:26:16 +00:00
|
|
|
if (This->buffer == NULL)
|
|
|
|
return DIERR_NOTBUFFERED;
|
|
|
|
|
2004-10-28 21:01:44 +00:00
|
|
|
if (dodsize < sizeof(DIDEVICEOBJECTDATA_DX3))
|
2002-05-19 22:26:16 +00:00
|
|
|
return DIERR_INVALIDPARAM;
|
|
|
|
|
2003-06-04 20:11:56 +00:00
|
|
|
MsgWaitForMultipleObjectsEx(0, NULL, 0, 0, 0);
|
|
|
|
|
2002-05-19 22:26:16 +00:00
|
|
|
EnterCriticalSection(&(This->crit));
|
|
|
|
|
|
|
|
/* Copy item at a time for the case dodsize > sizeof(buffer[n]) */
|
|
|
|
while ((i < *entries || *entries == INFINITE) && i < This->count)
|
|
|
|
{
|
|
|
|
if (dod != NULL)
|
|
|
|
{
|
|
|
|
int n = (This->start + i) % This->buffersize;
|
|
|
|
LPDIDEVICEOBJECTDATA pd
|
|
|
|
= (LPDIDEVICEOBJECTDATA)((BYTE *)dod + dodsize * i);
|
|
|
|
pd->dwOfs = This->buffer[n].dwOfs;
|
|
|
|
pd->dwData = This->buffer[n].dwData;
|
|
|
|
pd->dwTimeStamp = This->buffer[n].dwTimeStamp;
|
|
|
|
pd->dwSequence = This->buffer[n].dwSequence;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
*entries = i;
|
|
|
|
|
|
|
|
if (This->overflow)
|
|
|
|
ret = DI_BUFFEROVERFLOW;
|
|
|
|
|
|
|
|
if (!(flags & DIGDD_PEEK))
|
|
|
|
{
|
|
|
|
/* Empty buffer */
|
|
|
|
This->count -= i;
|
|
|
|
This->start = (This->start + i) % This->buffersize;
|
|
|
|
This->overflow = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
LeaveCriticalSection(&(This->crit));
|
|
|
|
|
2002-08-06 23:49:12 +00:00
|
|
|
TRACE("Returning %ld events queued\n", *entries);
|
|
|
|
|
2002-05-19 22:26:16 +00:00
|
|
|
return ret;
|
2000-11-05 20:25:02 +00:00
|
|
|
}
|
|
|
|
|
2003-02-12 21:27:00 +00:00
|
|
|
static HRESULT WINAPI SysKeyboardAImpl_EnumObjects(
|
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
LPDIENUMDEVICEOBJECTSCALLBACKA lpCallback,
|
|
|
|
LPVOID lpvRef,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2004-09-09 20:17:07 +00:00
|
|
|
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
2003-02-12 21:27:00 +00:00
|
|
|
DIDEVICEOBJECTINSTANCEA ddoi;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
TRACE("(this=%p,%p,%p,%08lx)\n", This, lpCallback, lpvRef, dwFlags);
|
|
|
|
if (TRACE_ON(dinput)) {
|
2003-03-15 00:12:42 +00:00
|
|
|
TRACE(" - flags = ");
|
2003-02-12 21:27:00 +00:00
|
|
|
_dump_EnumObjects_flags(dwFlags);
|
2003-03-15 00:12:42 +00:00
|
|
|
TRACE("\n");
|
2003-02-12 21:27:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Only the fields till dwFFMaxForce are relevant */
|
|
|
|
memset(&ddoi, 0, sizeof(ddoi));
|
|
|
|
ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce);
|
|
|
|
|
|
|
|
for (i = 0; i < 256; i++) {
|
|
|
|
/* Report 255 keys :-) */
|
|
|
|
ddoi.guidType = GUID_Key;
|
|
|
|
ddoi.dwOfs = i;
|
|
|
|
ddoi.dwType = DIDFT_MAKEINSTANCE(i) | DIDFT_BUTTON;
|
2003-02-24 20:41:28 +00:00
|
|
|
GetKeyNameTextA(((i & 0x7f) << 16) | ((i & 0x80) << 17), ddoi.tszName, sizeof(ddoi.tszName));
|
2003-02-12 21:27:00 +00:00
|
|
|
_dump_OBJECTINSTANCEA(&ddoi);
|
|
|
|
if (lpCallback(&ddoi, lpvRef) != DIENUM_CONTINUE) return DI_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
2003-06-16 20:22:13 +00:00
|
|
|
static HRESULT WINAPI SysKeyboardWImpl_EnumObjects(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIENUMDEVICEOBJECTSCALLBACKW lpCallback,
|
|
|
|
LPVOID lpvRef,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
2004-09-09 20:17:07 +00:00
|
|
|
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
2003-06-16 20:22:13 +00:00
|
|
|
|
|
|
|
device_enumobjects_AtoWcb_data data;
|
|
|
|
|
|
|
|
data.lpCallBack = lpCallback;
|
|
|
|
data.lpvRef = lpvRef;
|
|
|
|
|
|
|
|
return SysKeyboardAImpl_EnumObjects((LPDIRECTINPUTDEVICE8A) This, (LPDIENUMDEVICEOBJECTSCALLBACKA) DIEnumDevicesCallbackAtoW, (LPVOID) &data, dwFlags);
|
|
|
|
}
|
|
|
|
|
2002-06-14 00:39:44 +00:00
|
|
|
static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface);
|
2002-05-07 01:49:19 +00:00
|
|
|
|
2002-06-14 00:39:44 +00:00
|
|
|
static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
|
2000-11-05 20:25:02 +00:00
|
|
|
{
|
2004-09-09 20:17:07 +00:00
|
|
|
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2000-11-05 20:25:02 +00:00
|
|
|
TRACE("(this=%p)\n",This);
|
2002-05-31 23:06:46 +00:00
|
|
|
|
2002-05-19 22:26:16 +00:00
|
|
|
if (This->acquired)
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
This->acquired = 1;
|
|
|
|
|
2002-05-31 23:06:46 +00:00
|
|
|
if (current != NULL)
|
2002-05-19 22:26:16 +00:00
|
|
|
{
|
2002-05-24 21:17:59 +00:00
|
|
|
FIXME("Not more than one keyboard can be acquired at the same time.\n");
|
2002-05-19 22:26:16 +00:00
|
|
|
SysKeyboardAImpl_Unacquire(iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
current = This;
|
|
|
|
|
|
|
|
if (This->buffersize > 0)
|
|
|
|
{
|
|
|
|
This->buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
|
|
This->buffersize * sizeof(*(This->buffer)));
|
|
|
|
This->start = 0;
|
|
|
|
This->count = 0;
|
|
|
|
This->overflow = FALSE;
|
|
|
|
InitializeCriticalSection(&(This->crit));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
This->buffer = NULL;
|
|
|
|
|
2000-11-05 20:25:02 +00:00
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
2002-06-14 00:39:44 +00:00
|
|
|
static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
|
2000-11-05 20:25:02 +00:00
|
|
|
{
|
2004-09-09 20:17:07 +00:00
|
|
|
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
2000-11-05 20:25:02 +00:00
|
|
|
TRACE("(this=%p)\n",This);
|
|
|
|
|
2002-05-19 22:26:16 +00:00
|
|
|
if (This->acquired == 0)
|
|
|
|
return DI_NOEFFECT;
|
|
|
|
|
|
|
|
if (current == This)
|
|
|
|
current = NULL;
|
|
|
|
else
|
2002-05-24 21:17:59 +00:00
|
|
|
ERR("this != current\n");
|
2002-05-19 22:26:16 +00:00
|
|
|
|
|
|
|
This->acquired = 0;
|
|
|
|
|
|
|
|
if (This->buffersize >= 0)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, This->buffer);
|
|
|
|
This->buffer = NULL;
|
|
|
|
DeleteCriticalSection(&(This->crit));
|
|
|
|
}
|
2000-11-05 20:25:02 +00:00
|
|
|
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
2002-06-14 00:39:44 +00:00
|
|
|
static HRESULT WINAPI SysKeyboardAImpl_SetEventNotification(LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
HANDLE hnd) {
|
2004-09-09 20:17:07 +00:00
|
|
|
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
2002-05-07 01:49:19 +00:00
|
|
|
|
|
|
|
TRACE("(this=%p,0x%08lx)\n",This,(DWORD)hnd);
|
|
|
|
|
|
|
|
This->hEvent = hnd;
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
2002-05-19 22:26:16 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* GetCapabilities : get the device capablitites
|
|
|
|
*/
|
2000-11-05 20:25:02 +00:00
|
|
|
static HRESULT WINAPI SysKeyboardAImpl_GetCapabilities(
|
2002-06-14 00:39:44 +00:00
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
2000-11-05 20:25:02 +00:00
|
|
|
LPDIDEVCAPS lpDIDevCaps)
|
|
|
|
{
|
2004-12-13 13:17:03 +00:00
|
|
|
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
|
|
|
DIDEVCAPS devcaps;
|
2000-11-05 20:25:02 +00:00
|
|
|
|
2004-12-13 13:17:03 +00:00
|
|
|
TRACE("(this=%p,%p)\n",This,lpDIDevCaps);
|
2000-11-05 20:25:02 +00:00
|
|
|
|
2004-12-13 13:17:03 +00:00
|
|
|
if ((lpDIDevCaps->dwSize != sizeof(DIDEVCAPS)) && (lpDIDevCaps->dwSize != sizeof(DIDEVCAPS_DX3))) {
|
|
|
|
WARN("invalid parameter\n");
|
|
|
|
return DIERR_INVALIDPARAM;
|
|
|
|
}
|
|
|
|
|
|
|
|
devcaps.dwSize = lpDIDevCaps->dwSize;
|
|
|
|
devcaps.dwFlags = DIDC_ATTACHED;
|
2003-06-13 18:55:41 +00:00
|
|
|
if (This->dinput->version >= 8)
|
2004-12-13 13:17:03 +00:00
|
|
|
devcaps.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8);
|
2003-06-13 18:55:41 +00:00
|
|
|
else
|
2004-12-13 13:17:03 +00:00
|
|
|
devcaps.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8);
|
|
|
|
devcaps.dwAxes = 0;
|
|
|
|
devcaps.dwButtons = 256;
|
|
|
|
devcaps.dwPOVs = 0;
|
|
|
|
devcaps.dwFFSamplePeriod = 0;
|
|
|
|
devcaps.dwFFMinTimeResolution = 0;
|
|
|
|
devcaps.dwFirmwareRevision = 100;
|
|
|
|
devcaps.dwHardwareRevision = 100;
|
|
|
|
devcaps.dwFFDriverVersion = 0;
|
|
|
|
|
|
|
|
memcpy(lpDIDevCaps, &devcaps, lpDIDevCaps->dwSize);
|
|
|
|
|
|
|
|
return DI_OK;
|
2000-11-05 20:25:02 +00:00
|
|
|
}
|
|
|
|
|
2003-02-24 20:41:28 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* GetObjectInfo : get information about a device object such as a button
|
|
|
|
* or axis
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI
|
|
|
|
SysKeyboardAImpl_GetObjectInfo(
|
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
LPDIDEVICEOBJECTINSTANCEA pdidoi,
|
|
|
|
DWORD dwObj,
|
|
|
|
DWORD dwHow)
|
|
|
|
{
|
2004-09-09 20:17:07 +00:00
|
|
|
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
2003-02-24 20:41:28 +00:00
|
|
|
DIDEVICEOBJECTINSTANCEA ddoi;
|
|
|
|
DWORD dwSize = pdidoi->dwSize;
|
|
|
|
|
|
|
|
TRACE("(this=%p,%p,%ld,0x%08lx)\n", This, pdidoi, dwObj, dwHow);
|
|
|
|
|
|
|
|
if (dwHow == DIPH_BYID) {
|
|
|
|
WARN(" querying by id not supported yet...\n");
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(pdidoi, 0, dwSize);
|
|
|
|
memset(&ddoi, 0, sizeof(ddoi));
|
|
|
|
|
|
|
|
ddoi.dwSize = dwSize;
|
|
|
|
ddoi.guidType = GUID_Key;
|
|
|
|
ddoi.dwOfs = dwObj;
|
|
|
|
ddoi.dwType = DIDFT_MAKEINSTANCE(dwObj) | DIDFT_BUTTON;
|
|
|
|
GetKeyNameTextA(((dwObj & 0x7f) << 16) | ((dwObj & 0x80) << 17), ddoi.tszName, sizeof(ddoi.tszName));
|
|
|
|
|
|
|
|
/* And return our just filled device object instance structure */
|
|
|
|
memcpy(pdidoi, &ddoi, (dwSize < sizeof(ddoi) ? dwSize : sizeof(ddoi)));
|
|
|
|
|
|
|
|
_dump_OBJECTINSTANCEA(pdidoi);
|
|
|
|
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
2003-06-16 20:22:13 +00:00
|
|
|
static HRESULT WINAPI SysKeyboardWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
|
|
|
|
LPDIDEVICEOBJECTINSTANCEW pdidoi,
|
|
|
|
DWORD dwObj,
|
|
|
|
DWORD dwHow)
|
|
|
|
{
|
2004-09-09 20:17:07 +00:00
|
|
|
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
2003-06-16 20:22:13 +00:00
|
|
|
DIDEVICEOBJECTINSTANCEW ddoi;
|
|
|
|
DWORD dwSize = pdidoi->dwSize;
|
|
|
|
|
|
|
|
TRACE("(this=%p,%p,%ld,0x%08lx)\n", This, pdidoi, dwObj, dwHow);
|
|
|
|
|
|
|
|
if (dwHow == DIPH_BYID) {
|
|
|
|
WARN(" querying by id not supported yet...\n");
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(pdidoi, 0, dwSize);
|
|
|
|
memset(&ddoi, 0, sizeof(ddoi));
|
|
|
|
|
|
|
|
ddoi.dwSize = dwSize;
|
|
|
|
ddoi.guidType = GUID_Key;
|
|
|
|
ddoi.dwOfs = dwObj;
|
|
|
|
ddoi.dwType = DIDFT_MAKEINSTANCE(dwObj) | DIDFT_BUTTON;
|
|
|
|
GetKeyNameTextW(((dwObj & 0x7f) << 16) | ((dwObj & 0x80) << 17), ddoi.tszName, sizeof(ddoi.tszName));
|
|
|
|
|
|
|
|
/* And return our just filled device object instance structure */
|
|
|
|
memcpy(pdidoi, &ddoi, (dwSize < sizeof(ddoi) ? dwSize : sizeof(ddoi)));
|
|
|
|
|
|
|
|
_dump_OBJECTINSTANCEW(pdidoi);
|
|
|
|
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
2003-02-24 20:41:28 +00:00
|
|
|
/******************************************************************************
|
|
|
|
* GetDeviceInfo : get information about a device's identity
|
|
|
|
*/
|
|
|
|
static HRESULT WINAPI SysKeyboardAImpl_GetDeviceInfo(
|
|
|
|
LPDIRECTINPUTDEVICE8A iface,
|
|
|
|
LPDIDEVICEINSTANCEA pdidi)
|
|
|
|
{
|
2004-09-09 20:17:07 +00:00
|
|
|
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
2003-02-24 20:41:28 +00:00
|
|
|
TRACE("(this=%p,%p)\n", This, pdidi);
|
|
|
|
|
|
|
|
if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEA)) {
|
|
|
|
WARN(" dinput3 not supporte yet...\n");
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
2003-06-16 20:22:13 +00:00
|
|
|
fill_keyboard_dideviceinstanceA(pdidi, This->dinput->version);
|
2003-02-24 20:41:28 +00:00
|
|
|
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
2003-06-16 20:22:13 +00:00
|
|
|
static HRESULT WINAPI SysKeyboardWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface, LPDIDEVICEINSTANCEW pdidi)
|
|
|
|
{
|
2004-09-09 20:17:07 +00:00
|
|
|
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
2003-06-16 20:22:13 +00:00
|
|
|
TRACE("(this=%p,%p)\n", This, pdidi);
|
|
|
|
|
|
|
|
if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEW)) {
|
|
|
|
WARN(" dinput3 not supporte yet...\n");
|
|
|
|
return DI_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
fill_keyboard_dideviceinstanceW(pdidi, This->dinput->version);
|
|
|
|
|
|
|
|
return DI_OK;
|
|
|
|
}
|
2003-02-24 20:41:28 +00:00
|
|
|
|
2004-08-12 23:00:51 +00:00
|
|
|
static IDirectInputDevice8AVtbl SysKeyboardAvt =
|
2000-11-05 20:25:02 +00:00
|
|
|
{
|
|
|
|
IDirectInputDevice2AImpl_QueryInterface,
|
|
|
|
IDirectInputDevice2AImpl_AddRef,
|
2003-02-11 22:10:11 +00:00
|
|
|
SysKeyboardAImpl_Release,
|
2000-11-05 20:25:02 +00:00
|
|
|
SysKeyboardAImpl_GetCapabilities,
|
2003-02-12 21:27:00 +00:00
|
|
|
SysKeyboardAImpl_EnumObjects,
|
2005-02-15 15:03:03 +00:00
|
|
|
SysKeyboardAImpl_GetProperty,
|
2000-11-05 20:25:02 +00:00
|
|
|
SysKeyboardAImpl_SetProperty,
|
|
|
|
SysKeyboardAImpl_Acquire,
|
|
|
|
SysKeyboardAImpl_Unacquire,
|
|
|
|
SysKeyboardAImpl_GetDeviceState,
|
|
|
|
SysKeyboardAImpl_GetDeviceData,
|
|
|
|
IDirectInputDevice2AImpl_SetDataFormat,
|
2002-05-07 01:49:19 +00:00
|
|
|
SysKeyboardAImpl_SetEventNotification,
|
2000-11-05 20:25:02 +00:00
|
|
|
IDirectInputDevice2AImpl_SetCooperativeLevel,
|
2003-02-24 20:41:28 +00:00
|
|
|
SysKeyboardAImpl_GetObjectInfo,
|
|
|
|
SysKeyboardAImpl_GetDeviceInfo,
|
2000-11-05 20:25:02 +00:00
|
|
|
IDirectInputDevice2AImpl_RunControlPanel,
|
|
|
|
IDirectInputDevice2AImpl_Initialize,
|
|
|
|
IDirectInputDevice2AImpl_CreateEffect,
|
|
|
|
IDirectInputDevice2AImpl_EnumEffects,
|
|
|
|
IDirectInputDevice2AImpl_GetEffectInfo,
|
|
|
|
IDirectInputDevice2AImpl_GetForceFeedbackState,
|
|
|
|
IDirectInputDevice2AImpl_SendForceFeedbackCommand,
|
|
|
|
IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
|
|
|
|
IDirectInputDevice2AImpl_Escape,
|
|
|
|
IDirectInputDevice2AImpl_Poll,
|
2002-06-14 00:39:44 +00:00
|
|
|
IDirectInputDevice2AImpl_SendDeviceData,
|
|
|
|
IDirectInputDevice7AImpl_EnumEffectsInFile,
|
|
|
|
IDirectInputDevice7AImpl_WriteEffectToFile,
|
|
|
|
IDirectInputDevice8AImpl_BuildActionMap,
|
|
|
|
IDirectInputDevice8AImpl_SetActionMap,
|
|
|
|
IDirectInputDevice8AImpl_GetImageInfo
|
2000-11-05 20:25:02 +00:00
|
|
|
};
|
2003-06-16 20:22:13 +00:00
|
|
|
|
|
|
|
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
|
|
|
|
# define XCAST(fun) (typeof(SysKeyboardWvt.fun))
|
|
|
|
#else
|
|
|
|
# define XCAST(fun) (void*)
|
|
|
|
#endif
|
|
|
|
|
2004-08-12 23:00:51 +00:00
|
|
|
static IDirectInputDevice8WVtbl SysKeyboardWvt =
|
2003-06-16 20:22:13 +00:00
|
|
|
{
|
|
|
|
IDirectInputDevice2WImpl_QueryInterface,
|
|
|
|
XCAST(AddRef)IDirectInputDevice2AImpl_AddRef,
|
|
|
|
XCAST(Release)SysKeyboardAImpl_Release,
|
|
|
|
XCAST(GetCapabilities)SysKeyboardAImpl_GetCapabilities,
|
|
|
|
SysKeyboardWImpl_EnumObjects,
|
2005-02-15 15:03:03 +00:00
|
|
|
XCAST(GetProperty)SysKeyboardAImpl_GetProperty,
|
2003-06-16 20:22:13 +00:00
|
|
|
XCAST(SetProperty)SysKeyboardAImpl_SetProperty,
|
|
|
|
XCAST(Acquire)SysKeyboardAImpl_Acquire,
|
|
|
|
XCAST(Unacquire)SysKeyboardAImpl_Unacquire,
|
|
|
|
XCAST(GetDeviceState)SysKeyboardAImpl_GetDeviceState,
|
|
|
|
XCAST(GetDeviceData)SysKeyboardAImpl_GetDeviceData,
|
|
|
|
XCAST(SetDataFormat)IDirectInputDevice2AImpl_SetDataFormat,
|
|
|
|
XCAST(SetEventNotification)SysKeyboardAImpl_SetEventNotification,
|
|
|
|
XCAST(SetCooperativeLevel)IDirectInputDevice2AImpl_SetCooperativeLevel,
|
|
|
|
SysKeyboardWImpl_GetObjectInfo,
|
|
|
|
SysKeyboardWImpl_GetDeviceInfo,
|
|
|
|
XCAST(RunControlPanel)IDirectInputDevice2AImpl_RunControlPanel,
|
|
|
|
XCAST(Initialize)IDirectInputDevice2AImpl_Initialize,
|
|
|
|
XCAST(CreateEffect)IDirectInputDevice2AImpl_CreateEffect,
|
|
|
|
IDirectInputDevice2WImpl_EnumEffects,
|
|
|
|
IDirectInputDevice2WImpl_GetEffectInfo,
|
|
|
|
XCAST(GetForceFeedbackState)IDirectInputDevice2AImpl_GetForceFeedbackState,
|
|
|
|
XCAST(SendForceFeedbackCommand)IDirectInputDevice2AImpl_SendForceFeedbackCommand,
|
|
|
|
XCAST(EnumCreatedEffectObjects)IDirectInputDevice2AImpl_EnumCreatedEffectObjects,
|
|
|
|
XCAST(Escape)IDirectInputDevice2AImpl_Escape,
|
|
|
|
XCAST(Poll)IDirectInputDevice2AImpl_Poll,
|
|
|
|
XCAST(SendDeviceData)IDirectInputDevice2AImpl_SendDeviceData,
|
|
|
|
IDirectInputDevice7WImpl_EnumEffectsInFile,
|
|
|
|
IDirectInputDevice7WImpl_WriteEffectToFile,
|
|
|
|
IDirectInputDevice8WImpl_BuildActionMap,
|
|
|
|
IDirectInputDevice8WImpl_SetActionMap,
|
|
|
|
IDirectInputDevice8WImpl_GetImageInfo
|
|
|
|
};
|
|
|
|
#undef XCAST
|