dinput/mouse handing

Michael Schlüter michael at johalla.de
Mon Sep 1 17:41:21 CDT 2003


Hi,

I still have a problem with mouse handling in the demo of "Star Trek
Elite Force II". It looks like the game initializes the mouse with:

0009:trace:dinput:SysMouseAImpl_SetCooperativeLevel (this=0x40403e00,0x00000000,0x00000005)
0009:trace:dinput:SysMouseAImpl_SetCooperativeLevel  cooperative level : DISCL_EXCLUSIVE DISCL_FOREGROUND

but then didn't call GetDeviceState to get the input. So the game is
waiting for an event? If that is a correct behaviour of a windows
program with a cooperative level of "DISCL_EXCLUSIVE" then we have to
change that in dinput/mouse/main.c:

/* low-level mouse hook */
static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam,
LPARAM lparam )
{
...
  if (dwCoop & DISCL_NONEXCLUSIVE)
  { /* pass the events down to previous handlers (e.g. win32 input) */
      ret = CallNextHookEx( This->hook, code, wparam, lparam );
  }
  else ret = 1;  /* ignore message */
  return ret;
}

to always call "CallNextHookEx". After fixing this here the game works
properly. Following a part of the trace after the fix:

0009:trace:dinput:dinput_mouse_hook  queueing 244 at offset 0 (queue head 0 / size 16)
0009:trace:dinput:dinput_mouse_hook  queueing -42 at offset 4 (queue head 1 / size 16)
0009:trace:dinput:dinput_mouse_hook  msg 200 pt 844 470 (W=0)
0009:trace:dinput:dinput_mouse_hook (X: 244 - Y: -42   L: 00 M: 00 R: 00)
0009:Call ntdll.RtlLeaveCriticalSection(40403e80) ret=4a71e424
0009:Ret  ntdll.RtlLeaveCriticalSection() retval=00000000 ret=4a71e424
0009:Call user32.CallNextHookEx(00010027,00000000,00000200,40de24ec) ret=4a71e43f
0009:Call ntdll.GlobalLock16(00000197) ret=40fce87a
0009:Ret  ntdll.GlobalLock16() retval=403ec850 ret=40fce87a
0009: get_next_hook( handle=0x10027 )
0009: get_next_hook() = 0 { next=(nil), id=0, pid=0000, tid=0000, proc=(nil), prev_unicode=0,
next_unicode=0, module=L"" }
0009:Ret  user32.CallNextHookEx() retval=00000000 ret=4a71e43f
0009:Ret  hook proc 0x4a71e290 (id=WH_MOUSE_LL,code=0,wp=00000200,lp=40de24ec) retval=000000000009: finish_hook_chain( id=14 )
0009: finish_hook_chain() = 0
0009: send_message( id=0009, type=7, flags=0, win=0x10021, msg=00000200, wparam=00000000, lparam=00000000, x=844, y=470, time=a398f331, info=00010021, timeout=-1, callback=(nil), data={} )0009: send_message() = 0
0009:Ret  user32.SendInput() retval=00000001 ret=41429a43

Bye, Michael 




More information about the wine-devel mailing list