Jump to content

Title: Bugs in ControlsJoystick


photo

Recommended Posts

The first is connected with getting window handle for DirectX joystick device. controls_joystick_windows_callback (ControlsJoystick.cpp, line 139) function doesn't care what window of current process it found. It may be window with 3D graphics but may be system console window (and any other windows belong to this process if they exist). Together with cooperative level DISCL_FOREGROUND it leads to bad consequences: sometimes joystick works only when system console window is focused (NOT 3D graphics window). Our fix of this problem: change cooperative level to DISCL_BACKGROUND. But it is interim solution because it doesn't eliminate root of the problem.

 

I didn't see the second bug but it may appear in future. ControlsJoystick is identified by integer index. Function controls_joystick_devices_callback (ControlsJoystick.cpp, line 67) counts devices until counter reaches this integer index and after it stops enumeration and creates device.

BUT!

 

from DirectX SDK documentation (IDirectInput8::EnumDevices function):

Note The order in which devices are enumerated by DirectInput is not guaranteed

Together with frequent joystick device recreation (after poll fail) it may lead to situation when the same real joystick correspond to different indicies in different times. And one ControlsJoystick instance will get data form diffrent devices.

Link to comment

Petr,

Could you post here or send small part of your script code which can reproduce the first bug?

I tried with my sample but this error did not appear.

 

Hello, Sergey.

 

It can be easy reproduced but you need two joysticks :) It is diffucult to catch this bug with one device

and it seems to me that our extensions and build options can influence on this bug frequence.

 

There is modified file from ambient sample, Unigine release form 1st of November 2010. Simply copy it to data/demos/ambient.

I get wrong application behaviour approximately one time per 5 launches.

ambient.cpp

Link to comment

I have the following behavior:

I connected the two joystick. When I start application only one joystick works.

After I switch on any other window and return to my window with 3D graphics. After it the second joystick starts to work.

Do you have the same behavior?

Link to comment

I have the following behavior:

I connected the two joystick. When I start application only one joystick works.

After I switch on any other window and return to my window with 3D graphics. After it the second joystick starts to work.

Do you have the same behavior?

 

No. More frequently two joysticks works porperly immediately after start. But sometimes (as I wrote approximately 1 per 5 launches) second joystick doesn't work at all (switching to other window doesn't affect).

Link to comment
×
×
  • Create New...