Original Post
Anyone ever tryed using force feedback with directinput? I wrote my code using the DXSDK tutorial and checked ou other exemples. I am using a ConstantForce effect. All function return DI_OK even Start() but when I call Start() it just don't do anything. Still my gamepad is active and acquired (it work in-game for reading button and direction). Here is the mehod of interest:
bool InputDevice_Joystick::initEffect()
{
DWORD dwAxes[2] = {DIJOFS_X, DIJOFS_Y};
LONG lDirection[2] = {0, 0};
DICONSTANTFORCE cf = { 0 };
DIEFFECT diEffect; // general parameters
diEffect.dwSize = sizeof(DIEFFECT);
diEffect.dwFlags = DIEFF_POLAR | DIEFF_OBJECTOFFSETS;
diEffect.dwDuration = (DWORD)(2 * DI_SECONDS);
diEffect.dwSamplePeriod = 0;
diEffect.dwGain = DI_FFNOMINALMAX;
diEffect.dwTriggerButton = DIEB_NOTRIGGER;
diEffect.dwTriggerRepeatInterval = 0;
diEffect.cAxes = 2;
diEffect.rgdwAxes = dwAxes;
diEffect.rglDirection = &lDirection[0];
diEffect.lpEnvelope = NULL;
diEffect.cbTypeSpecificParams = sizeof(DICONSTANTFORCE);
diEffect.lpvTypeSpecificParams = &cf
if(FAILED(device->CreateEffect(GUID_ConstantForce, &diEffect, &effect, NULL)))
return 0;
else
return 1;
}
oh and yeah I got a gamepad supporting force feedback. I tried using EnumEffects but it return GUID_ConstantForce so I guesss it's ok..