Peter Ganten wrote:
>
> Hello,
>
> there is an interesting problem with the pacman trial version, which
> is part of win95 (pacdemo.exe) When the game runs, about every second
> keyboard message is not delivered to the game, but to the multimedia
> thread.
>
> I don't understand most parts of the message and queue stuff, but to
> me, the scenario looks as follows:
>
> After a key has been pressed, a message is generated inside the
> hardware_event() function in windows/queue.c. The function then calls
> QUEUE_WakeSomeone(). QUEUE_WakeSomeone() determines (correctly?) the right
> thread and calls QUEUE_SetWakeBit to let the thread
> continue. QUEUE_SetWakeBit, however, will only wake the thread, if the
> wakeMask of its message queue is not zero. The wakeMask, on the other
> side, is set to zero in this function. So if the thread has been woken
> up before, perhaps because of an other key press, it will not become
> resumed again. Maybe this is not necessary, because it is allready
> running?
>
> The multimedia thread, on the other side is in a PeekMessage() loop
> (in dlls/winmm/wineoss/audio.c, function wodPlayer()). This
> PeekMessage() call goes down to MSG_PeekHardwareMsg() in
> windows/message.c, from where MSG_TranslateKbdMsg is called. In
> this function, a destination window for the keyboard message is not
> found (both GetFocus() and GetActiveWindow() return zero), if the
> function is called from the multimedia thread. The result is, that
> MSG_TranslateKbdMsg() returns SYSQ_MSG_ACCEPT, in that case and the
> multimedia thread will receive the keyboard message. That thread of
> course does not understand keyboard messages, so we'll get a lot of
> "unknown message" fixmes.
>
> A "guess-work" fix is to insert the following line in
> MSG_TranslateKbdMsg():
well, since the audio playback thread shall not process the keyboard messages,
another (preferable) fix would be to filter the messages to be retrieved by
PeekMessage.
Could you check that PeekMessage(&msg, 0, WM_USER, WM_USER+5, PM_REMOVE); instead
of PeekMessage(&msg, 0, 0, 0, PM_REMOVE); in audio.c does solve your trouble ?
A+
--
---------------
Eric Pouech (http://perso.wanadoo.fr/eric.pouech/)
"The future will be better tomorrow", Vice President Dan Quayle