dinput: Move keyboard to using new GetObjectInfo.
This commit is contained in:
parent
0edc6e26a7
commit
20ba784aac
|
@ -415,33 +415,18 @@ SysKeyboardAImpl_GetObjectInfo(
|
|||
DWORD dwObj,
|
||||
DWORD dwHow)
|
||||
{
|
||||
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
||||
DIDEVICEOBJECTINSTANCEA ddoi;
|
||||
DWORD dwSize = pdidoi->dwSize;
|
||||
HRESULT res;
|
||||
|
||||
TRACE("(this=%p,%p,%d,0x%08x)\n", This, pdidoi, dwObj, dwHow);
|
||||
res = IDirectInputDevice2AImpl_GetObjectInfo(iface, pdidoi, dwObj, dwHow);
|
||||
if (res != DI_OK) return res;
|
||||
|
||||
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;
|
||||
if (!GetKeyNameTextA(((dwObj & 0x7f) << 16) | ((dwObj & 0x80) << 17), ddoi.tszName, sizeof(ddoi.tszName)))
|
||||
if (!GetKeyNameTextA((DIDFT_GETINSTANCE(pdidoi->dwType) & 0x80) << 17 |
|
||||
(DIDFT_GETINSTANCE(pdidoi->dwType) & 0x7f) << 16,
|
||||
pdidoi->tszName, sizeof(pdidoi->tszName)))
|
||||
return DIERR_OBJECTNOTFOUND;
|
||||
|
||||
/* And return our just filled device object instance structure */
|
||||
memcpy(pdidoi, &ddoi, (dwSize < sizeof(ddoi) ? dwSize : sizeof(ddoi)));
|
||||
|
||||
_dump_OBJECTINSTANCEA(pdidoi);
|
||||
|
||||
return DI_OK;
|
||||
return res;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI SysKeyboardWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
|
||||
|
@ -449,33 +434,18 @@ static HRESULT WINAPI SysKeyboardWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface
|
|||
DWORD dwObj,
|
||||
DWORD dwHow)
|
||||
{
|
||||
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
||||
DIDEVICEOBJECTINSTANCEW ddoi;
|
||||
DWORD dwSize = pdidoi->dwSize;
|
||||
HRESULT res;
|
||||
|
||||
TRACE("(this=%p,%p,%d,0x%08x)\n", This, pdidoi, dwObj, dwHow);
|
||||
res = IDirectInputDevice2WImpl_GetObjectInfo(iface, pdidoi, dwObj, dwHow);
|
||||
if (res != DI_OK) return res;
|
||||
|
||||
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;
|
||||
if (!GetKeyNameTextW(((dwObj & 0x7f) << 16) | ((dwObj & 0x80) << 17), ddoi.tszName, sizeof(ddoi.tszName)))
|
||||
if (!GetKeyNameTextW((DIDFT_GETINSTANCE(pdidoi->dwType) & 0x80) << 17 |
|
||||
(DIDFT_GETINSTANCE(pdidoi->dwType) & 0x7f) << 16,
|
||||
pdidoi->tszName, sizeof(pdidoi->tszName)))
|
||||
return DIERR_OBJECTNOTFOUND;
|
||||
|
||||
/* And return our just filled device object instance structure */
|
||||
memcpy(pdidoi, &ddoi, (dwSize < sizeof(ddoi) ? dwSize : sizeof(ddoi)));
|
||||
|
||||
_dump_OBJECTINSTANCEW(pdidoi);
|
||||
|
||||
return DI_OK;
|
||||
return res;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
Loading…
Reference in New Issue