superdave56
Posts: 22
Joined: 4/17/2005 Status: offline
|
Sorry, I wasn't thinking that explanation through very well. I was kind of in a hurry. I was originally thinking about some window message was not being processed correctly and kind of jamming things up, but the explanation is probably much simpler than that. Windows receive most events in order otherwise you could receive the mouseup event before the mousedown event for instance. I haven't been in the Win32 world for a long time, but if memory serves the program is responsible for getting its events off the queue. Usually a Win32 program sits in a message loop calling GetMessage(), DispatchMessage(), and calling appropriate event handlers, etc. So what might be happenning is that opart3.exe is looping calling the GetAsyncKeyState over and over again in an infinite loop. So it never calls GetMessage(), so the mouseup event which is sitting on the queue is never processed. Since the mouseup event isn't processed, wine doesn't update the key_state table to reflect the mouse button being up. Really, though, it doesn't matter because the implementation of GetAsyncKeyState is just plain wrong in wine. I did some research on MSDN and it seems pretty clear to me that GetAsyncKeyState should be querying the actual physical state of the keyboard/mouse at this very moment, regardless of windows messages and all that. It shouldn't consult some key_state table, it should actually ask the mouse 'is your left mouse button up or down right this second?'. There's another function GetKeyState which is supposed to check what keys are up/down within a particular window taking into account what messages have been processed. It's so you can see if the user was holding down the shift key while pressing the mouse button for instance - so you want to know if the shift key was down at the time the mouse event was processed, not necessarily a few milliseconds later when you make the function call. The way wine works now GetKeyState/GetAsyncKeyState do the exact same thing and I believe that's wrong. GetAsyncKeyState, IMHO should be written so that it queries the actual, physical state of the keyboard/mouse. So I'm going to try and rewrite the function to do that and submit it as a patch and see how it goes. That should fix TOAW and some other games that depend on GetAsyncKeyState working as it does in Windows.
|