Dinput keyboard delays in Win2000

Started by
1 comment, last by Rock2000 20 years ago
I''m having lots of trouble with the directInput keyboard API under Win2000. Its only an issue in fullscreen ddraw apps. If I run in a ddraw window, its OK. And it runs fine in fullscreen on Win95/98 and XP. I''m using immediate mode for the keyboard. The problem seems to be that the GetDeviceState() isn''t giving me an accurate state all the time. It seems to be more of a problem when the game first starts, and works OK after some amount of time running. But initially, there are times when I tap a button and it isn''t reported, and times when I tap a button and DX reports that its held down for longer then it is. Normally I''m calling GetDeviceState() at 60fps. If I set the game to not wait for the vertical retrace, it updates MUCH faster, and seems to work OK all the time. But surely 60hz is plenty fast. Unfortunately its very tough to get any concrete results, since I have to tap the key and try to guess if DX reported it right or not (not to mention the carpal tunnel). And its only quick taps that have trouble. If I hold a key down, it will eventually be reported. Its most noticable because in my main menu, I have the input wrapped with toggle logic, and if you tap down several times quickly, the ''sample and hold'' of the key states make the toggle think the button was held down continuously, and so the game doesn''t register enough key presses. So what''s the deal with this? I just recently added OpenGL support, and everything works fine with a fullscreen OpenGL display. Its just fullscreen DDraw that is causing the keyboard to be screwed up, and only on Win2000. I''ve played with it for two days now, and I give up. I just can''t get it work.
Advertisement
Try to set the SetCooperativeLevel with DISCL_FOREGROUND | DISCL_EXCLUSIVE. But this means that normal keyboard call with the WinProc procedure wont work. Its all in DirectInputs hands now
I''ve tried all the co-op combinations with no effect.

I did run across a blurb in the DX9 documentation about Dinput keyboard and mouse delays under Win2000 while debugging. Its not 100% clear whether its only while running through the debugger, or when running a debug build, or when using the debug DX install. They give a registry hack to fix it, but assuming I did it right that didn''t fix my problem. Plus I''m using the DInput calls from DX5, not DX8 (although I''ve tried DX7 calls with no help), and it isn''t clear whether the registry trick works for the older calls.

I tried running the Release version of my app with no fix, and I should be using the DX9b Release binaries, not Debug. Supposedly there should be checkboxes in the DX control panel, but I don''t have a DX icon in my Control Panel. Any idea on how I get that option? I so badly just want to believe this is the problem since there''s nothing else I can imagine it could be, but I want a more concrete indicator before I blow it off.

This topic is closed to new replies.

Advertisement