Thursday, April 29, 2010

Two Stupid Bugs

It's been a long time since I've looked at the input code, what with other things taking my attention. I had however been aware that on my Windows 2000 test VM I had some issues with the non-DirectInput code, but I was assuming that it was the fault of the VM mouse driver as last time I had run through it things worked fine.

Recently however I've started getting reports from Actual Real Other People Out There that the same things were happening to them. Firstly you point at the sky and spin in circles, and secondly mouse buttons don't send key-up events. This is only if DirectInput fails to start or if you have it disabled (using m_directinput 0).

So I switched off DirectInput on my main Windows 7 machine. Bang. Fully reproducible.

OK, it's my fault, I screwed up the input code and you weren't going mad.

The spinning in circles bug was easily fixed - I had a pair of minus signs where I should have had plus signs.

I haven't yet figured why key-up events don't get through for the mouse buttons; but I'm working on it. (Update: got it. They weren't getting through because I wasn't sending them through. Of course. Now, we start off at a weird angle and the cursor is visible when you enter a map. Time to fix those too...)

Once I have this fixed I'm going to release an update (1.8.3c) containing these fixes as well as a few others that are needed, but not badly enough to warrant a patch on their own. I may also roll some of the 1.8.4 code into it; I think either of the non-HLSL warp code or the MDL vertex optimization would be a nice present (so long as backporting doesn't create a mess elsewhere).

Unfortunately I haven't yet been able to track down why DirectInput may not be starting up on some machines; this one is not reproducible (so far). The best advice I can give is the usual - you may have a downlevel version of the DirectInput DLLs (especially if you have Vista or Windows 7) and you should update your DirectX.

0 comments: