GetMessage related Jagged Alliance 2 regression

Alexander Dorofeyev alexd4 at inbox.lv
Thu Dec 6 22:49:26 CST 2007


Hello.

I get freezes in Jagged Alliance 2 (seems to be tied to moving the mouse). It
used to work in older versions. The game doesn't lock up totally (the music and
sounds continue to play normally, for example), but the screen doesn't redraw
and it doesn't respond to input. Activating some other window than the game
window (if it's not full screen) usually unfreezes it.

Bisect pointed to this change:

http://source.winehq.org/git/wine.git/?a=commitdiff;h=2896540a34a18b8aff848d728308c5811cdd122a

server: Set the queue mask directly in get_message to avoid an extra server call.

I did a bit of debugging and it looks like the game is getting stuck within a
GetMessageW call. It stays in that while loop in GetMessage, mostly in
MsgWaitForMultipleObjectsEx. If the mouse is moved, then it awakes, gets to
PeekMessageW, from there it goes to peek_message which returns false and so
PeekMessageW returns false and the game goes back to waiting within GetMessageW.

peek_message returns false, because in a first call to server it gets a 
MSG_HARDWARE (mouse) message which it drops for some reason, then it clears 
PM_QS_ flags and so in a next call to server it can't get a WM_TIMER message 
despite an expired timer seems to be ready in the queue.

I'm not sure what would be a proper fix, although I did find out that commenting 
out this line in peek_message()

if (HIWORD(flags)) flags = PM_QS_SENDMESSAGE | LOWORD(flags);

makes the game playable. Maybe this clearing of PM_QS_* flags shouldn't be done 
in case when the message gets dropped? Before that commit nothing was passed in 
flags high word, which is probably why this problem wasn't happening.



More information about the wine-devel mailing list