https://bugs.winehq.org/show_bug.cgi?id=46142
Kimmo Myllyvirta kimmo.myllyvirta@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |kimmo.myllyvirta@gmail.com
--- Comment #12 from Kimmo Myllyvirta kimmo.myllyvirta@gmail.com --- Created attachment 62801 --> https://bugs.winehq.org/attachment.cgi?id=62801 fix for xinput1_3
Did some debugging;
<repeats thousands of times> 009e:009f:trace:xinput:XInputGetState (index 0, state 0x1434d0)! 009e:009f:trace:xinput:XInputGetState (index 0, state 0x143350)! 009e:009f:trace:xinput:XInputGetState (index 0, state 0x1431d0)! 009e:009f:trace:xinput:XInputGetState (index 0, state 0x143050)! 009e:009f:trace:xinput:XInputGetState (index 0, state 0x142ed0)! 009e:009f:trace:xinput:XInputGetState (index 0, state 0x142d50)! 009e:009f:trace:xinput:XInputGetState (index 0, state 0x142bd0)! 009e:009f:err:seh:setup_exception stack overflow 1728 bytes in thread 009f eip 00007fcaf508e5ea esp 0000000000140f50 stack 0x140000-0x141000-0x2140000
Notice that XInputGetState calls XInputGetStateEx unconditionally, but its trace is missing. XInputGetStateEx is hooked, and the hook eventually calls XInputGetState -> infinite recursion.
For example, with Witcher 3; Stopped on breakpoint 1 at 0x00007efc917d0929 XInputGetState+0x82 [/home/des/projects/wine-git-staging/dlls/xinput1_3/xinput_main.c:94] in xinput1_3 94 ret = XInputGetStateEx(index, state); 0x00007efc917d073a XInputGetStateEx in xinput1_3: jmp 0x00007efc8ed6070d 0x00007efc8ed6070d: jmpl *(%rip) -> gameoverlayrenderer64 0x000000000299cb10: movq %rdx,%r8 .... 0x000000000299b8d7: calll *%r8d 00da:fixme:winedbg:be_x86_64_is_func_call Unsupported yet call insn (rex=0x01 0xFF 0xd0) at 0x299b8d8 0x00007efc8ed606c0: leaq (%rsp),%rsp 0x00007efc8ed606c8: jmp 0x00007efc917d08a7 XInputGetState -> and here we go again 0x00007efc917d08a7 XInputGetState [/home/des/projects/wine-git-staging/dlls/xinput1_3/xinput_main.c:89] in xinput1_3: pushq %rbp ...
So, XInputGetState must not call XInputGetStateEx. Here's a quick fix, tested with Witcher 3 and Sprintires Mudrunner.