Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

68 lines
2.1 KiB

/*****************************************************************************
*
* diqdevj.c
*
* Acquire an IDirectInputDevice8 as if it were a joystick.
*
*****************************************************************************/
#include "diquick.h"
/*****************************************************************************
*
* Devj_UpdateStatus
*
*****************************************************************************/
STDMETHODIMP
Devj_UpdateStatus(PDEVDLGINFO pddi, LPTSTR ptszBuf)
{
HRESULT hres;
DIJOYSTATE2 js;
IDirectInputDevice8 *pdid = pddi->pdid;
hres = IDirectInputDevice8_GetDeviceState(pdid, sizeof(js), &js);
if (SUCCEEDED(hres)) {
UINT ib;
ptszBuf += wsprintf(ptszBuf,
TEXT("X = %d\r\n")
TEXT("Y = %d\r\n")
TEXT("Z = %d\r\n")
TEXT("Rx = %d\r\n")
TEXT("Ry = %d\r\n")
TEXT("Rz = %d\r\n")
TEXT("S0 = %d\r\n")
TEXT("S1 = %d\r\n")
TEXT("POV = %d %d %d %d\r\n"),
js.lX, js.lY, js.lZ,
js.lRx, js.lRy, js.lRz,
js.rglSlider[0], js.rglSlider[1],
js.rgdwPOV[0],
js.rgdwPOV[1],
js.rgdwPOV[2],
js.rgdwPOV[3]);
for (ib = 0; ib < 128; ib++) {
if (js.rgbButtons[ib] & 0x80) {
ptszBuf += wsprintf(ptszBuf, TEXT(" %d"), ib);
}
}
}
return hres;
}
/*****************************************************************************
*
* c_acqvtblDevJoy
*
*****************************************************************************/
#pragma BEGIN_CONST_DATA
ACQVTBL c_acqvtblDevJoy = {
Devj_UpdateStatus,
Common_AcqSetDataFormat,
Common_AcqDestroy,
&c_dfDIJoystick2,
};
#pragma END_CONST_DATA