On Sat, Jan 17, 2009 at 6:01 AM, Vincent Pelletier plr.vincent@gmail.com wrote:
Note: The code generating "discrete" values uses raw numbers istead of defined values, because they exist only for 4 directions and (on the contrary of what is advertised by MSDN) JOY_RETURNPOV also reports diagonal angles (verified on vista 32 bits, with joytester.exe). I believe it's easier to see the correlations between values this way.
TODO: JOYCAPS_POVCTS support, requiring some trigonometry functions and a joystick reporting "analog" POV coordinates. -- Vincent Pelletier
+ case 16: /* Hat 0 X */ + case 17: /* Y */ + lpCaps->wCaps |= JOYCAPS_HASPOV | JOYCAPS_POV4DIR; + /* TODO: JOYCAPS_POVCTS handling */ + break;
Minor, but shouldn't that be 'case 17: /* Hat 0 Y */'
On Sun, Jan 18, 2009 at 5:01 AM, Austin English austinenglish@gmail.com wrote:
Minor, but shouldn't that be 'case 17: /* Hat 0 Y */'
Right. Actualy, I originally "stacked" all 4 supported hat definitions (times 2 axes, so 8 "case" lines), so I chose to only write what changed of previous line (makes the pattern more visible, I think). I removed the 6 other lines since windows API supports just one POV per joystick, and it would probably be more confusing thant anything else.
Also, I realised after sending the patch that there is a very similar code to translate 2 axes to POV angles in dinput code, but with fewer C lines. Should I resend my patch with that code instead ?
On another side note, I localy solved a force-feedback problem in dinput code: linux kernel checks, when modifying/deleting a force feedback effect, that it was uploaded using the same file descriptor. But, at least for MS Flight Sim 2000, the controler can be released after an effect has been sent, and before it gets updated again. My local fix is just to never close the descriptor (and also prevent opening it when it's already opened), but that's too bad to be sent. I gave a quick think at making the close conditional to the number of registered FF effects, but there doesn't seem to be any code to empty the FF list, so it does not look to be a good solution. Has anyone a better idea ?