Hey, sorry to bother you, but in
this thread I showed some trouble I was having getting more than 2
joysticks to work, and it has garnered very little interest and no assistance.
I don't use any of the engine's built-in joystick functions. I use joyGetPosEx to get all the information I need. It has been working great for the first two
joysticks, and I assumed it'd work for the rest since I release and capture all
joysticks in a loop. Having purchased a third joystick yesterday and tested it independently of the others, I know it works on its own, but my game still only detects 2
joysticks.
Is there something I'm missing? A limit imposed by the engine? Or am I just capturing them incorrectly?
I considered that joyGetPosEx might be working fine because the engine captures 2
joysticks anyway, and maybe it's my capture function that's failing, but I changed the code to release all
joysticks first and then attempt to capture them all manually, and it still works fine.
Here's the loop I use in the main function to get the
joysticks:
for (i=0; i<MAX_JOYSTICKS; i++) {
joyReleaseCapture(i);
hasJoystick[i] = (var)joySetCapture(hWnd, i, POLLING_PERIOD, JOYSTICKS_CHANGED);
joystick[0] = JOYSTICK_SIZE;
joystick[1] = JOY_CAL_READ5;
if (hasJoystick[i] == 0)
joyGetPosEx(i, (void*)joystick);
}
I use the same loop in a separate function to recapture
joysticks if the player needs to (for example if they connect a joystick after the game has started), and all that seems to successfully do is release them.
POLLING_PERIOD is #defined as NULL and JOYSTICKS_CHANGED as 1, but I've tried it with POLLING_PERIOD as 10 and JOYSTICKS_CHANGED as 0.
The fact that the recapture fails using the same code leads me to believe that the first capture fails as well, but the engine automatically captures 2
joysticks for me, since it uses 2 anyway. But surely that would happen in the first frame? And my first capture attempt occurs after a wait(1); in the main function.
Any help would really be appreciated.
Jibb