   Direct Input delay [solved]
  EDIT: The below information is useless, unless you're curious to know the symptoms of a virus.I'm noticing some strange behavior with Direct Input during low frame rate situations. I use the Sleep() method in my debug build to simulate my game running on slower computers, so I can deal with associated problems. When I slow it down to about 10 FPS, there's some serious lag time before input devices send any data to me. I'm using GetDeviceData(), and the "LPDWORD pdwInOut" member comes back as zero, sometimes for over 2-5 seconds, after I press a button or move the mouse. After the 2-5 seconds, the data comes in for the actions I took far in the past. My game updates and calls GetDeviceData() hundreds or thousands of times during those seconds. I think I've checked for errors everywhere. There are no buffer overflows or acquire problems.This isn't just happening for one device. All of them are doing it. I'm running Direct Input release runtime. I tried debug runtime to see if it would bring anything up, but it mentions nothing.Does anyone know what could cause this? Is there some type of thread priority setting, or other customizable data that I may have accidentally set wrong?There is something strange worth mentioning, but I'm not sure if it will help narrow this down. I use the windows function GetCursorPos() to set my game cursor location, in order to sync it with the hardware cursor. It continues to move around my software-drawn cursor while I wait for GetDeviceData() to send something back.If anyone can help, it would be very appreciated.[Edited by - Kest on May 5, 2009 11:58:22 AM]
Quote:Original post by KestThere is something strange worth mentioning, but I'm not sure if it will help narrow this down. I use the windows function GetCursorPos() to set my game cursor location, in order to sync it with the hardware cursor. It continues to move around my software-drawn cursor while I wait for GetDeviceData() to send something back.This doesn't really answer the main question unfortunately, but you really don't want to be using DirectInput for keyboard or mouse input.For the main problem; does this happen on other PCs, or just the one you're testing on? Are you using any threading? Can we see some code (Your main GetDeviceData loop mainly)?   ;  Sorry for the confusion. This was being caused by a virus.The virus was also causing my system to freeze up when I used breakpoints, so I checked HijackThis, and sure enough, there was something disguising itself as MSN messenger on there.It apparently caused the Direct Input delay all by itself. After removing it (manually and painstakingly), the delay is now no worse than the frame rate.Sorry, Steve. And I really appreciate your help.   