Menu

'Correct MOUSEHOOK callback', how does it work?

2026-04-10
2026-04-11
  • hidefromkgb

    hidefromkgb - 2026-04-10

    I've got an obscure Win32 game I'd like to play under WINE 10.14-268. The issue is that it warps the cursor to the center of the screen all the time, so I tried using dxWnd to mitigate that.
    The only option that seems to help is 'Correct MOUSEHOOK callback' — but whereas the cursor starts moving normally, the game ceases to react to mouse clicks or any keypresses.
    To try and replicate the behavior of that option I looked at the sources (v2_06_13_src) but failed to find where m_FixMouseHook or flags8 & FIXMOUSEHOOK are actually used.
    Furthermore, judging by the logs it doesn't seem like the hook even does anything, since the log only contains a battery of PeekMessage's — with warp-to-center WM_MOUSEMOVE's without 'Correct MOUSEHOOK callback' and without them when the hook is active, but no output from the hook despite maximum verbosity (log severity = Debug + Print all errors).
    I'm stumped. How does this option work?

     
    • gho

      gho - 2026-04-10

      When a game keeps the cursor fixed at the center of the screen, very likely it is trying to use the mouse relative position. The fix depends on whether the game is using DirectInput, SDL or just GDI. You can look at the game dependencies to find an entry for DirectInput or DirectInput8. Better yet, you could name the game so that I could try it and provide a tested solution.

       
      • hidefromkgb

        hidefromkgb - 2026-04-10

        The game is Zanzarah The Hidden Portal, and on real Windows (7, at least) I haven't seen it behave like that. There must be some complex interplay between the game code and WINE that wasn't there 10 years ago when I first got it running on Linux despite its 'Garbage' status on WineHQ.
        My theory is that the game considers itself to be in first-person mode where it shouldn't, and the 'correct' approach would be to fix its code, but I wanted an easier solution first.

         
  • hidefromkgb

    hidefromkgb - 2026-04-11

    After a debugging session, I am positive that the component at fault is DirectInput. When I prohibit relative movement in IDirectInputDevice7::SetDataFormat() the cursor starts moving as it should — but still swallows all mouse clicks.

    UPDATE: HKCR/Software/Wine/DirectInput/MouseWarpOverride = "force" was the culprit; removing this key solved my problem.

    This topic can be closed.

     
    👍
    1

    Last edit: hidefromkgb 2026-04-11
    • gho

      gho - 2026-04-11

      Thanks. I'll try to remember this in case I could get the same problem elsewhere.

       

Log in to post a comment.

MongoDB Logo MongoDB