Direct Input problem
-
I don't know if this is correct forum..? I'm writing a plugin to an application to support force feedback. The original application doesn't use dinput, but windows winmm.lib functions to read the joystick. Here's the problem: How can I "match" a joystick ID from Winmm to use the same with DInput? If I in the original application call
joyGetPosEx(JOYSTICKID1, ...)
to poll it, then I want to call my plugin to create a force feedback effect on the same joystick. Now I do something like:// Enumerate all joysticks using windows MM and add to a list ... if (joyGetDevCaps(i, &jc, sizeof(JOYCAPS)) == JOYERR_NOERROR) { dwJoystickList[i] = MAKELONG(jc.wMid, jc.wPid); // Save product ID } ...
and when enumerating using direct input:... if (pJoysticks[i] == pdidInstance->guidProduct.Data1) { (*it) = tJI; // Save the interface at same position } ...
This works if all joysticks are different, i.e. product ID is different. Then I can call my functionCreateFFEffect(joystick number 1, ...)
. But how to solve the problem to separate many joysticks of same brand? Direct input has an instance ID, but is there any way to get the same from windows multimedia functions? Thanks for any tips!