KoKuToru / koku-xinput-wine

Adds xinput support to wine, without changing the source of wine.
BSD 2-Clause "Simplified" License
69 stars 21 forks source link

Tales of Zestiria not working, using SDL2.dll for gamepad #5

Closed DistantThunder closed 8 years ago

DistantThunder commented 8 years ago

Compiled on Arch Linux with SDL2, loaded it with Wine 1.55 on Tales of Zestiria, xinput_1.3 overriden to "native" in winecfg, clean profile. The config file isn't even created. Stacktraces confirm the library is being loaded but I can't see it in action.

KoKuToru commented 8 years ago

did you try it without "x_input1.3"-overriden ? what is the output of the library with export KOKU_XINPUT_DEBUG=1 ?

DistantThunder commented 8 years ago

Thank you for answering.

This is my output, without "x_input1.3" overridden (nor installed as a DLL).

> env LD_PRELOAD=/usr/lib32/koku-xinput-wine.so KOKU_XINPUT_DEBUG=1 WINENOPULSE=1 WINEARCH=win32  WINEPREFIX=$HOME/.wine_32_steam wine Tales\ of\ Zestiria.exe 
koku-xinput-wine: wine_dll_load("kernel32.dll", ...);
koku-xinput-wine: wine_dll_load("bink2w32.dll", ...);
koku-xinput-wine: wine_dll_load("user32.dll", ...);
koku-xinput-wine: wine_dll_load("gdi32.dll", ...);
koku-xinput-wine: wine_dll_load("advapi32.dll", ...);
koku-xinput-wine: wine_dll_load("version.dll", ...);
koku-xinput-wine: wine_dll_load("winmm.dll", ...);
koku-xinput-wine: wine_dll_load("ole32.dll", ...);
koku-xinput-wine: wine_dll_load("rpcrt4.dll", ...);
koku-xinput-wine: search for `CoSetProxyBlanket`, found, redirect it
koku-xinput-wine: wine_dll_load("shell32.dll", ...);
koku-xinput-wine: wine_dll_load("shlwapi.dll", ...);
koku-xinput-wine: wine_dll_load("sdl2.dll", ...);
koku-xinput-wine: wine_dll_load("imm32.dll", ...);
koku-xinput-wine: wine_dll_load("msvcrt.dll", ...);
koku-xinput-wine: wine_dll_load("oleaut32.dll", ...);
koku-xinput-wine: wine_dll_load("ws2_32.dll", ...);
koku-xinput-wine: wine_dll_load("d3d9.dll", ...);
koku-xinput-wine: wine_dll_load("wined3d.dll", ...);
koku-xinput-wine: wine_dll_load("opengl32.dll", ...);
koku-xinput-wine: wine_dll_load("xinput1_3.dll", ...);
koku-xinput-wine: search for `XInputEnable`, found, redirect it
koku-xinput-wine: search for `XInputGetAudioDeviceIds`
koku-xinput-wine: search for `XInputGetBatteryInformation`, found, redirect it
koku-xinput-wine: search for `XInputGetCapabilities`, found, redirect it
koku-xinput-wine: search for `XInputGetDSoundAudioDeviceGuids`, found, redirect it
koku-xinput-wine: search for `XInputGetKeystroke`, found, redirect it
koku-xinput-wine: search for `XInputGetState`, found, redirect it
koku-xinput-wine: search for `XInputSetState`, found, redirect it
koku-xinput-wine: wine_dll_load("steam_api.dll", ...);
koku-xinput-wine: wine_dll_load("winhttp.dll", ...);
koku-xinput-wine: wine_dll_load("jsproxy.dll", ...);
koku-xinput-wine: wine_dll_load("psapi.dll", ...);
koku-xinput-wine: wine_dll_load("comdlg32.dll", ...);
koku-xinput-wine: wine_dll_load("comctl32.dll", ...);
koku-xinput-wine: wine_dll_load("winspool.drv", ...);
koku-xinput-wine: wine_dll_load("winex11.drv", ...);
koku-xinput-wine: wine_dll_load("language.dll", ...);
koku-xinput-wine: wine_dll_load("steam_ceg.dll", ...);
koku-xinput-wine: wine_dll_load("steamclient.dll", ...);
koku-xinput-wine: wine_dll_load("uxtheme.dll", ...);
koku-xinput-wine: wine_dll_load("thegfw.dll", ...);
koku-xinput-wine: wine_dll_load("steamclient.dll", ...);
koku-xinput-wine: wine_dll_load("crypt32.dll", ...);
koku-xinput-wine: wine_dll_load("iphlpapi.dll", ...);
koku-xinput-wine: wine_dll_load("imagehlp.dll", ...);
koku-xinput-wine: wine_dll_load("dbghelp.dll", ...);
koku-xinput-wine: wine_dll_load("setupapi.dll", ...);
koku-xinput-wine: wine_dll_load("tier0_s.dll", ...);
koku-xinput-wine: wine_dll_load("vstdlib_s.dll", ...);
koku-xinput-wine: wine_dll_load("secur32.dll", ...);
koku-xinput-wine: wine_dll_load("netapi32.dll", ...);
fixme:advapi:EventRegister {47a9201e-73b0-42ce-9821-7e134361bc6f}, 0x3f006980, 0x3f040ce8, 0x3f040ce0
fixme:advapi:EventRegister {58a9201e-73b0-42ce-9821-7e134361bc70}, 0x3f006980, 0x3f040d20, 0x3f040d18
fixme:advapi:EventRegister {3fa9201e-73b0-43fe-9821-7e145359bc6f}, 0x3f006980, 0x3f040cb0, 0x3f040ca8
fixme:advapi:EventRegister {1432afee-73b0-42ce-9821-7e134361b433}, 0x3f006980, 0x3f040d58, 0x3f040d50
fixme:advapi:EventRegister {4372afee-73b0-42ce-9821-7e134361b519}, 0x3f006980, 0x3f040d90, 0x3f040d88
err:winediag:SECUR32_initNTLMSP ntlm_auth was not found or is outdated. Make sure that ntlm_auth >= 3.0.25 is in your path. Usually, you can find it in the winbind package of your distribution.
fixme:ver:GetCurrentPackageId (0x38e080 (nil)): stub
fixme:heap:RtlSetHeapInformation (nil) 1 (nil) 0 stub
koku-xinput-wine: wine_dll_load("thegfw.dll", ...);
koku-xinput-wine: wine_dll_load("dinput8.dll", ...);
koku-xinput-wine: wine_dll_load("dinput.dll", ...);
koku-xinput-wine: wine_dll_load("xinput1_4.dll", ...);
fixme:win:RegisterDeviceNotificationW (hwnd=0x500c0, filter=0x731e93c,flags=0x00000000) returns a fake device notification handle!
koku-xinput-wine: wine_dll_load("xinput1_4.dll", ...);
fixme:win:RegisterTouchWindow (0x3015a 00000003): stub
fixme:d3d9:D3DPERF_SetOptions (0x1) : stub
koku-xinput-wine: wine_dll_load("msctf.dll", ...);
fixme:imm:ImmReleaseContext (0x3015a, 0x191a50): stub
fixme:msctf:ThreadMgr_ActivateEx Unimplemented flags 0x4
fixme:msctf:ThreadMgrSource_AdviseSink (0x18be08) Unhandled Sink: {ea1ea136-19df-11d7-a6d2-00065b84435c}
fixme:imm:NotifyIME NI_CLOSECANDIDATE
fixme:msctf:ThreadMgrSource_AdviseSink (0x18be08) Unhandled Sink: {ea1ea136-19df-11d7-a6d2-00065b84435c}
err:ole:CoInitializeEx Attempt to change threading model of this apartment from apartment threaded to multi-threaded
koku-xinput-wine: wine_dll_load("mmdevapi.dll", ...);
koku-xinput-wine: wine_dll_load("winealsa.drv", ...);
koku-xinput-wine: wine_dll_load("libatrac9.dll", ...);
fixme:dinput:joy_polldev joystick cannot handle type 21 event (code 97)
fixme:dinput:joy_polldev joystick cannot handle type 21 event (code 96)
fixme:dinput:joy_polldev joystick cannot handle type 21 event (code 97)
fixme:dinput:joy_polldev joystick cannot handle type 21 event (code 96)
fixme:dinput:joy_polldev joystick cannot handle type 21 event (code 97)
fixme:dinput:joy_polldev joystick cannot handle type 21 event (code 96)
koku-xinput-wine: wine_dll_load("dsound.dll", ...);
fixme:thread:SetThreadIdealProcessor (0x35c): stub
fixme:thread:SetThreadIdealProcessor (0x368): stub
fixme:thread:SetThreadIdealProcessor (0x35c): stub
fixme:thread:SetThreadIdealProcessor (0x368): stub
err:ole:CoInitializeEx Attempt to change threading model of this apartment from apartment threaded to multi-threaded
fixme:imm:NotifyIME NI_CLOSECANDIDATE
fixme:advapi:EventUnregister deadbeef: stub
fixme:advapi:EventUnregister deadbeef: stub
fixme:advapi:EventUnregister deadbeef: stub
fixme:advapi:EventUnregister deadbeef: stub
fixme:advapi:EventUnregister deadbeef: stub

The auto-generated config file is still missing and I'm still having the same problem of the pad not being correctly detected (Shows "Microsofts X-box 360 pad (js)" and "Microsoft X-box 360 pad (even)" but actually detects them as random gamepad with buttons mismapped and some not working -RB notably).

KoKuToru commented 8 years ago

well it does loading dinput, xinput1_3 and xinput1_4

my library right now only overrides xinput1_3, I will create a little update for xinput1_4. Maybe it will work then... I will let you know when the update is ready

KoKuToru commented 8 years ago

Please try again with the xinput-test-branch.

DistantThunder commented 8 years ago

Just pulled, compiled and tested. Won't cut it :/

> env LD_PRELOAD=/usr/lib32/koku-xinput-wine.so KOKU_XINPUT_DEBUG=1 WINENOPULSE=1 WINEARCH=win32  WINEPREFIX=$HOME/.wine_32_steam wine Tales\ of\ Zestiria.exe 
koku-xinput-wine: wine_dll_load("kernel32.dll", ...);
koku-xinput-wine: wine_dll_load("bink2w32.dll", ...);
koku-xinput-wine: wine_dll_load("user32.dll", ...);
koku-xinput-wine: wine_dll_load("gdi32.dll", ...);
koku-xinput-wine: wine_dll_load("advapi32.dll", ...);
koku-xinput-wine: wine_dll_load("version.dll", ...);
koku-xinput-wine: wine_dll_load("winmm.dll", ...);
koku-xinput-wine: wine_dll_load("ole32.dll", ...);
koku-xinput-wine: wine_dll_load("rpcrt4.dll", ...);
koku-xinput-wine: search for `CoSetProxyBlanket`, found, redirect it
koku-xinput-wine: wine_dll_load("shell32.dll", ...);
koku-xinput-wine: wine_dll_load("shlwapi.dll", ...);
koku-xinput-wine: wine_dll_load("sdl2.dll", ...);
koku-xinput-wine: wine_dll_load("imm32.dll", ...);
koku-xinput-wine: wine_dll_load("msvcrt.dll", ...);
koku-xinput-wine: wine_dll_load("oleaut32.dll", ...);
koku-xinput-wine: wine_dll_load("ws2_32.dll", ...);
koku-xinput-wine: wine_dll_load("d3d9.dll", ...);
koku-xinput-wine: wine_dll_load("wined3d.dll", ...);
koku-xinput-wine: wine_dll_load("opengl32.dll", ...);
koku-xinput-wine: wine_dll_load("xinput1_3.dll", ...);
koku-xinput-wine: search for `XInputEnable`, found, redirect it
koku-xinput-wine: search for `XInputGetAudioDeviceIds`
koku-xinput-wine: search for `XInputGetBatteryInformation`, found, redirect it
koku-xinput-wine: search for `XInputGetCapabilities`, found, redirect it
koku-xinput-wine: search for `XInputGetDSoundAudioDeviceGuids`, found, redirect it
koku-xinput-wine: search for `XInputGetKeystroke`, found, redirect it
koku-xinput-wine: search for `XInputGetState`, found, redirect it
koku-xinput-wine: search for `XInputSetState`, found, redirect it
koku-xinput-wine: wine_dll_load("steam_api.dll", ...);
koku-xinput-wine: wine_dll_load("winhttp.dll", ...);
koku-xinput-wine: wine_dll_load("jsproxy.dll", ...);
koku-xinput-wine: wine_dll_load("psapi.dll", ...);
koku-xinput-wine: wine_dll_load("comdlg32.dll", ...);
koku-xinput-wine: wine_dll_load("comctl32.dll", ...);
koku-xinput-wine: wine_dll_load("winspool.drv", ...);
koku-xinput-wine: wine_dll_load("winex11.drv", ...);
koku-xinput-wine: wine_dll_load("language.dll", ...);
koku-xinput-wine: wine_dll_load("steam_ceg.dll", ...);
koku-xinput-wine: wine_dll_load("steamclient.dll", ...);
koku-xinput-wine: wine_dll_load("uxtheme.dll", ...);
koku-xinput-wine: wine_dll_load("thegfw.dll", ...);
koku-xinput-wine: wine_dll_load("steamclient.dll", ...);
koku-xinput-wine: wine_dll_load("crypt32.dll", ...);
koku-xinput-wine: wine_dll_load("iphlpapi.dll", ...);
koku-xinput-wine: wine_dll_load("imagehlp.dll", ...);
koku-xinput-wine: wine_dll_load("dbghelp.dll", ...);
koku-xinput-wine: wine_dll_load("setupapi.dll", ...);
koku-xinput-wine: wine_dll_load("tier0_s.dll", ...);
koku-xinput-wine: wine_dll_load("vstdlib_s.dll", ...);
koku-xinput-wine: wine_dll_load("secur32.dll", ...);
koku-xinput-wine: wine_dll_load("netapi32.dll", ...);
fixme:advapi:EventRegister {47a9201e-73b0-42ce-9821-7e134361bc6f}, 0x3f006ba0, 0x3f040ce8, 0x3f040ce0
fixme:advapi:EventRegister {58a9201e-73b0-42ce-9821-7e134361bc70}, 0x3f006ba0, 0x3f040d20, 0x3f040d18
fixme:advapi:EventRegister {3fa9201e-73b0-43fe-9821-7e145359bc6f}, 0x3f006ba0, 0x3f040cb0, 0x3f040ca8
fixme:advapi:EventRegister {1432afee-73b0-42ce-9821-7e134361b433}, 0x3f006ba0, 0x3f040d58, 0x3f040d50
fixme:advapi:EventRegister {4372afee-73b0-42ce-9821-7e134361b519}, 0x3f006ba0, 0x3f040d90, 0x3f040d88
err:winediag:SECUR32_initNTLMSP ntlm_auth was not found or is outdated. Make sure that ntlm_auth >= 3.0.25 is in your path. Usually, you can find it in the winbind package of your distribution.
fixme:ver:GetCurrentPackageId (0x38e080 (nil)): stub
koku-xinput-wine: wine_dll_load("rsaenh.dll", ...);
fixme:heap:RtlSetHeapInformation (nil) 1 (nil) 0 stub
koku-xinput-wine: wine_dll_load("thegfw.dll", ...);
koku-xinput-wine: wine_dll_load("dinput8.dll", ...);
koku-xinput-wine: wine_dll_load("dinput.dll", ...);
koku-xinput-wine: wine_dll_load("xinput1_4.dll", ...);
koku-xinput-wine: search for `XInputEnable`
koku-xinput-wine: search for `XInputGetAudioDeviceIds`
koku-xinput-wine: search for `XInputGetBatteryInformation`
koku-xinput-wine: search for `XInputGetCapabilities`
koku-xinput-wine: search for `XInputGetDSoundAudioDeviceGuids`
koku-xinput-wine: search for `XInputGetKeystroke`
koku-xinput-wine: search for `XInputGetState`
koku-xinput-wine: search for `XInputSetState`
fixme:win:RegisterDeviceNotificationW (hwnd=0x20154, filter=0x731e93c,flags=0x00000000) returns a fake device notification handle!
koku-xinput-wine: wine_dll_load("xinput1_4.dll", ...);
koku-xinput-wine: search for `XInputEnable`
koku-xinput-wine: search for `XInputGetAudioDeviceIds`
koku-xinput-wine: search for `XInputGetBatteryInformation`
koku-xinput-wine: search for `XInputGetCapabilities`
koku-xinput-wine: search for `XInputGetDSoundAudioDeviceGuids`
koku-xinput-wine: search for `XInputGetKeystroke`
koku-xinput-wine: search for `XInputGetState`
koku-xinput-wine: search for `XInputSetState`
fixme:win:RegisterTouchWindow (0x1017e 00000003): stub
fixme:d3d9:D3DPERF_SetOptions (0x1) : stub
koku-xinput-wine: wine_dll_load("msctf.dll", ...);
fixme:imm:ImmReleaseContext (0x1017e, 0x1880d8): stub
fixme:msctf:ThreadMgr_ActivateEx Unimplemented flags 0x4
fixme:msctf:ThreadMgrSource_AdviseSink (0x18abf0) Unhandled Sink: {ea1ea136-19df-11d7-a6d2-00065b84435c}
fixme:imm:NotifyIME NI_CLOSECANDIDATE
fixme:msctf:ThreadMgrSource_AdviseSink (0x18abf0) Unhandled Sink: {ea1ea136-19df-11d7-a6d2-00065b84435c}
err:ole:CoInitializeEx Attempt to change threading model of this apartment from apartment threaded to multi-threaded
koku-xinput-wine: wine_dll_load("mmdevapi.dll", ...);
koku-xinput-wine: wine_dll_load("winealsa.drv", ...);
koku-xinput-wine: wine_dll_load("libatrac9.dll", ...);
fixme:dinput:joy_polldev joystick cannot handle type 21 event (code 96)
fixme:dinput:joy_polldev joystick cannot handle type 21 event (code 97)
fixme:dinput:joy_polldev joystick cannot handle type 21 event (code 96)
fixme:dinput:joy_polldev joystick cannot handle type 21 event (code 97)
fixme:dinput:joy_polldev joystick cannot handle type 21 event (code 96)
koku-xinput-wine: wine_dll_load("dsound.dll", ...);
fixme:thread:SetThreadIdealProcessor (0x35c): stub
fixme:thread:SetThreadIdealProcessor (0x368): stub
fixme:thread:SetThreadIdealProcessor (0x35c): stub
fixme:thread:SetThreadIdealProcessor (0x368): stub
fixme:thread:SetThreadIdealProcessor (0x35c): stub
fixme:thread:SetThreadIdealProcessor (0x368): stub
fixme:thread:SetThreadIdealProcessor (0x35c): stub
fixme:thread:SetThreadIdealProcessor (0x368): stub
err:ole:CoInitializeEx Attempt to change threading model of this apartment from apartment threaded to multi-threaded
fixme:imm:NotifyIME NI_CLOSECANDIDATE
fixme:advapi:EventUnregister deadbeef: stub
fixme:advapi:EventUnregister deadbeef: stub
fixme:advapi:EventUnregister deadbeef: stub
fixme:advapi:EventUnregister deadbeef: stub
fixme:advapi:EventUnregister deadbeef: stub

Tested with both SDL1.2 and SDL2. I confirm my pad works perfectly outside of Wine.

KoKuToru commented 8 years ago
koku-xinput-wine: wine_dll_load("xinput1_4.dll", ...);
koku-xinput-wine: search for `XInputEnable`
koku-xinput-wine: search for `XInputGetAudioDeviceIds`
koku-xinput-wine: search for `XInputGetBatteryInformation`
koku-xinput-wine: search for `XInputGetCapabilities`
koku-xinput-wine: search for `XInputGetDSoundAudioDeviceGuids`
koku-xinput-wine: search for `XInputGetKeystroke`
koku-xinput-wine: search for `XInputGetState`
koku-xinput-wine: search for `XInputSetState`

it doesn't find the functions with dlsym.. I just added a kernel32.dll-route in xinput-test-branch, now it should find the functions. That said, it doesn't call CoSetProxyBlanket, which is normally used while searching gamepads. But some games just try to use the first gamepad, so maybe it will work now.

DistantThunder commented 8 years ago

It seems you fixed part of the problem since this time around, the functions are found but unfortunately, gamepad and buttons detection is still flawed. RB still doesn't work, and the pad isn't detected as a true X360 pad, just a gameplad with the "X360" name (I can tell because unlike on Windows, where you have X360 buttons icons during assignment, the game is showing up regular number icons).

> env LD_PRELOAD=/usr/lib32/koku-xinput-wine.so KOKU_XINPUT_DEBUG=1 WINENOPULSE=1 WINEARCH=win32  WINEPREFIX=$HOME/.wine_32_steam wine Tales\ of\ Zestiria.exe 
koku-xinput-wine: [kernel32.dll] wine_dll_load("kernel32.dll", ...);
koku-xinput-wine: [bink2w32.dll] wine_dll_load("bink2w32.dll", ...);
koku-xinput-wine: [user32.dll] wine_dll_load("user32.dll", ...);
 koku-xinput-wine: [gdi32.dll] wine_dll_load("gdi32.dll", ...);
  koku-xinput-wine: [advapi32.dll] wine_dll_load("advapi32.dll", ...);
 koku-xinput-wine: [version.dll] wine_dll_load("version.dll", ...);
koku-xinput-wine: [winmm.dll] wine_dll_load("winmm.dll", ...);
koku-xinput-wine: [ole32.dll] wine_dll_load("ole32.dll", ...);
 koku-xinput-wine: [rpcrt4.dll] wine_dll_load("rpcrt4.dll", ...);
koku-xinput-wine: search for `CoSetProxyBlanket`, found, redirect it
koku-xinput-wine: [shell32.dll] wine_dll_load("shell32.dll", ...);
 koku-xinput-wine: [shlwapi.dll] wine_dll_load("shlwapi.dll", ...);
koku-xinput-wine: [sdl2.dll] wine_dll_load("sdl2.dll", ...);
koku-xinput-wine: [imm32.dll] wine_dll_load("imm32.dll", ...);
koku-xinput-wine: [msvcrt.dll] wine_dll_load("msvcrt.dll", ...);
koku-xinput-wine: [oleaut32.dll] wine_dll_load("oleaut32.dll", ...);
koku-xinput-wine: [ws2_32.dll] wine_dll_load("ws2_32.dll", ...);
koku-xinput-wine: [d3d9.dll] wine_dll_load("d3d9.dll", ...);
 koku-xinput-wine: [wined3d.dll] wine_dll_load("wined3d.dll", ...);
  koku-xinput-wine: [opengl32.dll] wine_dll_load("opengl32.dll", ...);
koku-xinput-wine: [xinput1_3.dll] wine_dll_load("xinput1_3.dll", ...);
 koku-xinput-wine: found `kernel32.dll`
 koku-xinput-wine: found `LoadLibrary` in `kernel32.dll`
 koku-xinput-wine: found `GetProcAddress` in `kernel32.dll`
 koku-xinput-wine: [xinput1_3.dll] search for `XInputEnable`
 koku-xinput-wine: [xinput1_3.dll] found `XInputEnable`, redirect it
 koku-xinput-wine: [xinput1_3.dll] search for `XInputGetAudioDeviceIds`
 koku-xinput-wine: [xinput1_3.dll] search for `XInputGetAudioDeviceIds` with `kernel32.dll`
 koku-xinput-wine: [xinput1_3.dll] search for `XInputGetBatteryInformation`
 koku-xinput-wine: [xinput1_3.dll] found `XInputGetBatteryInformation`, redirect it
 koku-xinput-wine: [xinput1_3.dll] search for `XInputGetCapabilities`
 koku-xinput-wine: [xinput1_3.dll] found `XInputGetCapabilities`, redirect it
 koku-xinput-wine: [xinput1_3.dll] search for `XInputGetDSoundAudioDeviceGuids`
 koku-xinput-wine: [xinput1_3.dll] found `XInputGetDSoundAudioDeviceGuids`, redirect it
 koku-xinput-wine: [xinput1_3.dll] search for `XInputGetKeystroke`
 koku-xinput-wine: [xinput1_3.dll] found `XInputGetKeystroke`, redirect it
 koku-xinput-wine: [xinput1_3.dll] search for `XInputGetState`
 koku-xinput-wine: [xinput1_3.dll] found `XInputGetState`, redirect it
 koku-xinput-wine: [xinput1_3.dll] search for `XInputSetState`
 koku-xinput-wine: [xinput1_3.dll] found `XInputSetState`, redirect it
koku-xinput-wine: [steam_api.dll] wine_dll_load("steam_api.dll", ...);
koku-xinput-wine: [winhttp.dll] wine_dll_load("winhttp.dll", ...);
 koku-xinput-wine: [jsproxy.dll] wine_dll_load("jsproxy.dll", ...);
koku-xinput-wine: [psapi.dll] wine_dll_load("psapi.dll", ...);
koku-xinput-wine: [comdlg32.dll] wine_dll_load("comdlg32.dll", ...);
 koku-xinput-wine: [comctl32.dll] wine_dll_load("comctl32.dll", ...);
 koku-xinput-wine: [winspool.drv] wine_dll_load("winspool.drv", ...);
koku-xinput-wine: [winex11.drv] wine_dll_load("winex11.drv", ...);
koku-xinput-wine: [language.dll] wine_dll_load("language.dll", ...);
koku-xinput-wine: [steam_ceg.dll] wine_dll_load("steam_ceg.dll", ...);
koku-xinput-wine: [steamclient.dll] wine_dll_load("steamclient.dll", ...);
koku-xinput-wine: [uxtheme.dll] wine_dll_load("uxtheme.dll", ...);
koku-xinput-wine: [thegfw.dll] wine_dll_load("thegfw.dll", ...);
koku-xinput-wine: [steamclient.dll] wine_dll_load("steamclient.dll", ...);
koku-xinput-wine: [crypt32.dll] wine_dll_load("crypt32.dll", ...);
koku-xinput-wine: [iphlpapi.dll] wine_dll_load("iphlpapi.dll", ...);
koku-xinput-wine: [imagehlp.dll] wine_dll_load("imagehlp.dll", ...);
 koku-xinput-wine: [dbghelp.dll] wine_dll_load("dbghelp.dll", ...);
koku-xinput-wine: [setupapi.dll] wine_dll_load("setupapi.dll", ...);
koku-xinput-wine: [tier0_s.dll] wine_dll_load("tier0_s.dll", ...);
koku-xinput-wine: [vstdlib_s.dll] wine_dll_load("vstdlib_s.dll", ...);
koku-xinput-wine: [secur32.dll] wine_dll_load("secur32.dll", ...);
 koku-xinput-wine: [netapi32.dll] wine_dll_load("netapi32.dll", ...);
fixme:advapi:EventRegister {47a9201e-73b0-42ce-9821-7e134361bc6f}, 0x3f006ba0, 0x3f040ce8, 0x3f040ce0
fixme:advapi:EventRegister {58a9201e-73b0-42ce-9821-7e134361bc70}, 0x3f006ba0, 0x3f040d20, 0x3f040d18
fixme:advapi:EventRegister {3fa9201e-73b0-43fe-9821-7e145359bc6f}, 0x3f006ba0, 0x3f040cb0, 0x3f040ca8
fixme:advapi:EventRegister {1432afee-73b0-42ce-9821-7e134361b433}, 0x3f006ba0, 0x3f040d58, 0x3f040d50
fixme:advapi:EventRegister {4372afee-73b0-42ce-9821-7e134361b519}, 0x3f006ba0, 0x3f040d90, 0x3f040d88
err:winediag:SECUR32_initNTLMSP ntlm_auth was not found or is outdated. Make sure that ntlm_auth >= 3.0.25 is in your path. Usually, you can find it in the winbind package of your distribution.
fixme:ver:GetCurrentPackageId (0x38e080 (nil)): stub
koku-xinput-wine: [rsaenh.dll] wine_dll_load("rsaenh.dll", ...);
fixme:heap:RtlSetHeapInformation (nil) 1 (nil) 0 stub
koku-xinput-wine: [thegfw.dll] wine_dll_load("thegfw.dll", ...);
koku-xinput-wine: [dinput8.dll] wine_dll_load("dinput8.dll", ...);
koku-xinput-wine: [dinput.dll] wine_dll_load("dinput.dll", ...);
koku-xinput-wine: [xinput1_4.dll] wine_dll_load("xinput1_4.dll", ...);
 koku-xinput-wine: [xinput1_4.dll] search for `XInputEnable`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputEnable` with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] found `XInputEnable`, redirect it with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetAudioDeviceIds`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetAudioDeviceIds` with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] found `XInputGetAudioDeviceIds`, redirect it with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetBatteryInformation`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetBatteryInformation` with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] found `XInputGetBatteryInformation`, redirect it with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetCapabilities`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetCapabilities` with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] found `XInputGetCapabilities`, redirect it with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetDSoundAudioDeviceGuids`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetDSoundAudioDeviceGuids` with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] found `XInputGetDSoundAudioDeviceGuids`, redirect it with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetKeystroke`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetKeystroke` with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] found `XInputGetKeystroke`, redirect it with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetState`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetState` with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] found `XInputGetState`, redirect it with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputSetState`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputSetState` with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] found `XInputSetState`, redirect it with `kernel32.dll`
fixme:win:RegisterDeviceNotificationW (hwnd=0x50148, filter=0x71fe93c,flags=0x00000000) returns a fake device notification handle!
koku-xinput-wine: [xinput1_4.dll] wine_dll_load("xinput1_4.dll", ...);
 koku-xinput-wine: [xinput1_4.dll] search for `XInputEnable`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputEnable` with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] found `XInputEnable`, redirect it with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetAudioDeviceIds`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetAudioDeviceIds` with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] found `XInputGetAudioDeviceIds`, redirect it with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetBatteryInformation`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetBatteryInformation` with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] found `XInputGetBatteryInformation`, redirect it with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetCapabilities`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetCapabilities` with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] found `XInputGetCapabilities`, redirect it with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetDSoundAudioDeviceGuids`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetDSoundAudioDeviceGuids` with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] found `XInputGetDSoundAudioDeviceGuids`, redirect it with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetKeystroke`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetKeystroke` with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] found `XInputGetKeystroke`, redirect it with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetState`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputGetState` with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] found `XInputGetState`, redirect it with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputSetState`
 koku-xinput-wine: [xinput1_4.dll] search for `XInputSetState` with `kernel32.dll`
 koku-xinput-wine: [xinput1_4.dll] found `XInputSetState`, redirect it with `kernel32.dll`
fixme:win:RegisterTouchWindow (0x1018c 00000003): stub
fixme:d3d9:D3DPERF_SetOptions (0x1) : stub
koku-xinput-wine: [msctf.dll] wine_dll_load("msctf.dll", ...);
fixme:imm:ImmReleaseContext (0x1018c, 0x18d4f8): stub
fixme:msctf:ThreadMgr_ActivateEx Unimplemented flags 0x4
fixme:msctf:ThreadMgrSource_AdviseSink (0x18d370) Unhandled Sink: {ea1ea136-19df-11d7-a6d2-00065b84435c}
fixme:imm:NotifyIME NI_CLOSECANDIDATE
fixme:msctf:ThreadMgrSource_AdviseSink (0x18d370) Unhandled Sink: {ea1ea136-19df-11d7-a6d2-00065b84435c}
err:ole:CoInitializeEx Attempt to change threading model of this apartment from apartment threaded to multi-threaded
koku-xinput-wine: [mmdevapi.dll] wine_dll_load("mmdevapi.dll", ...);
koku-xinput-wine: [winealsa.drv] wine_dll_load("winealsa.drv", ...);
koku-xinput-wine: [libatrac9.dll] wine_dll_load("libatrac9.dll", ...);
koku-xinput-wine: [dsound.dll] wine_dll_load("dsound.dll", ...);
fixme:thread:SetThreadIdealProcessor (0x35c): stub
fixme:thread:SetThreadIdealProcessor (0x368): stub
fixme:thread:SetThreadIdealProcessor (0x35c): stub
fixme:thread:SetThreadIdealProcessor (0x368): stub
err:ole:CoInitializeEx Attempt to change threading model of this apartment from apartment threaded to multi-threaded
fixme:imm:NotifyIME NI_CLOSECANDIDATE
fixme:advapi:EventUnregister deadbeef: stub
fixme:advapi:EventUnregister deadbeef: stub
fixme:advapi:EventUnregister deadbeef: stub
fixme:advapi:EventUnregister deadbeef: stub
fixme:advapi:EventUnregister deadbeef: stub
KoKuToru commented 8 years ago

From the log it still doesn't use the xinput.

it must detect the gamepad different then how msdn does it ... CoSetProxyBlanket never gets called.

Without owning the game and/or having the executable I can't check how the game searches for the gamepad sorry :(

DistantThunder commented 8 years ago

Ah that's unfortunate. I'm no programmer or anything close but is there anyway I can help you find out about that?

I have tested at least one other game, that is Sora no Kiseki FC and indeed, the CoSetProxyBlanket line appeared and even though I couldn't remap the buttons in the configuration, they showed up as regular X360 pad (A,B, etc.) buttons and RB was working.

KoKuToru commented 8 years ago

sure if you could somehow send me your Tales of Zestiria.exe...

DistantThunder commented 8 years ago

http://dl.free.fr/i3qnjvGdl

KoKuToru commented 8 years ago

Hehe thanks a lot..

that's really funny.. :) the game uses SDL2 for gamepad. I just downloaded the SDL2 source and looked into the joystick code for windows.

And indeed it doesn't use CoSetProxyBlanket for joystick/gamepad detection. Give me some time (next week or so / depends on how much time I have), and koku-xinput-wine will work for SDL2 (windows-version) :dancer:

TODOs

Some Notes:

How SDL2 finds gamepad

static void
EnumXInputDevices(JoyStick_DeviceData **pContext)
{
    if (s_bXInputEnabled) {
        int iuserid;
        /* iterate in reverse, so these are in the final list in ascending numeric order. */
        for (iuserid = SDL_XINPUT_MAX_DEVICES-1; iuserid >= 0; iuserid--) {
            const Uint8 userid = (Uint8) iuserid;
            XINPUT_CAPABILITIES capabilities;
            if (XINPUTGETCAPABILITIES(userid, XINPUT_FLAG_GAMEPAD, &capabilities) == ERROR_SUCCESS) {
                /* Current version of XInput mistakenly returns 0 as the Type. Ignore it and ensure the subtype is a gamepad. */
                /* !!! FIXME: we might want to support steering wheels or guitars or whatever later. */
                if (capabilities.SubType == XINPUT_DEVSUBTYPE_GAMEPAD) {
                    AddXInputDevice(userid, pContext);
                }
            }
        }
    }
}

How SDL2 checks if dinput is a xinput controller

static SDL_bool
SDL_IsXInputDevice( const GUID* pGuidProductFromDirectInput )
{
    static const GUID *s_XInputProductGUID[] = {
        &IID_ValveStreamingGamepad,
        &IID_X360WiredGamepad,   /* Microsoft's wired X360 controller for Windows. */
        &IID_X360WirelessGamepad /* Microsoft's wireless X360 controller for Windows. */
    };

    size_t iDevice;
    UINT i;

    if (!s_bXInputEnabled) {
        return SDL_FALSE;
    }

    /* Check for well known XInput device GUIDs */
    /* This lets us skip RAWINPUT for popular devices. Also, we need to do this for the Valve Streaming Gamepad because it's virtualized and doesn't show up in the device list. */
    for ( iDevice = 0; iDevice < SDL_arraysize(s_XInputProductGUID); ++iDevice ) {
        if (SDL_memcmp(pGuidProductFromDirectInput, s_XInputProductGUID[iDevice], sizeof(GUID)) == 0) {
            return SDL_TRUE;
        }
    }

    /* Go through RAWINPUT (WinXP and later) to find HID devices. */
    /* Cache this if we end up using it. */
    if (SDL_RawDevList == NULL) {
        if ((GetRawInputDeviceList(NULL, &SDL_RawDevListCount, sizeof (RAWINPUTDEVICELIST)) == -1) || (!SDL_RawDevListCount)) {
            return SDL_FALSE;  /* oh well. */
        }

        SDL_RawDevList = (PRAWINPUTDEVICELIST) SDL_malloc(sizeof (RAWINPUTDEVICELIST) * SDL_RawDevListCount);
        if (SDL_RawDevList == NULL) {
            SDL_OutOfMemory();
            return SDL_FALSE;
        }

        if (GetRawInputDeviceList(SDL_RawDevList, &SDL_RawDevListCount, sizeof (RAWINPUTDEVICELIST)) == -1) {
             SDL_free(SDL_RawDevList);
             SDL_RawDevList = NULL;
             return SDL_FALSE;  /* oh well. */
        }
    }

    for (i = 0; i < SDL_RawDevListCount; i++) {
        RID_DEVICE_INFO rdi;
        char devName[128];
        UINT rdiSize = sizeof (rdi);
        UINT nameSize = SDL_arraysize(devName);

        rdi.cbSize = sizeof (rdi);
        if ( (SDL_RawDevList[i].dwType == RIM_TYPEHID) &&
             (GetRawInputDeviceInfoA(SDL_RawDevList[i].hDevice, RIDI_DEVICEINFO, &rdi, &rdiSize) != ((UINT)-1)) &&
             (MAKELONG(rdi.hid.dwVendorId, rdi.hid.dwProductId) == ((LONG)pGuidProductFromDirectInput->Data1)) &&
             (GetRawInputDeviceInfoA(SDL_RawDevList[i].hDevice, RIDI_DEVICENAME, devName, &nameSize) != ((UINT)-1)) &&
             (SDL_strstr(devName, "IG_") != NULL) ) {
             return SDL_TRUE;
        }
    }

    return SDL_FALSE;
}
KoKuToru commented 8 years ago

or I could forward all sdl2.dll (windows-version) gamepad/joystick functions to sdl2.so (linux-version) ... but it wouldn't fit the koku-xinput-wine name..

DistantThunder commented 8 years ago

Glad it could help. I hope this will benefit other games too thanks!

KoKuToru commented 8 years ago

If you have time, please test the my new wine-branch. If you can even compile it... it's a little more complex now (read #6).

But I tested it with a SDL2 program and it worked :dancer: So it should work for your game.

27thLiz commented 8 years ago

Nice work ;) I think I'll do some research regarding the GetRawInputDeviceList thing. Sounds like it could help with a bug I have on another project, then maybe I can help you with that ^^

If only microsoft didn't fuck this up so badly... :P

DistantThunder commented 8 years ago

Just tested the wine branch. IT WORKS!!

After compiling the dlls and placing them within the folder where the executable is, I confirm among the controlers exposed by the kernel driver (js & event), I was able to select a third gamepad which appeared as an official Xbox 360 Gamepad with all the mappings correctly detected.

Tested on:

Tales of Zestiria, Legend of Heroes: Trails in the Sky FC, Metal Gear Rising.

I also confirm that I didn't need the config file since the default mapping exposed by the dll is the correct Xbox 360 gamepad mapping.

There may just be a problem with the Rumble functionality though.

On a slightly less enthusiastic note, I was hoping this project would definitely mean the end of .dll centric solutions like this one (https://steamcommunity.com/app/221410/discussions/0/828938354860178892/) that made me go for Koku-xinput-wine in the first place.

Still Koku-xinput is still way less convoluted and I'm glad you got this working this far. Thank you for your work.

KoKuToru commented 8 years ago

Don't let .dllfool you.. it's a dll.so renamed to a .dll so that wine loads it first, instead of the wine built-in .dll.so.

builtin dlls follow a different library search path :(

.... you also could directly overwrite wines xinput_?.dll.so

And the Rumble, yeah looks like I disabled it..

It's now default disabled, old version used default enabled.. will need to update this (Games can enable/disable Rumble with XInputEnable)

DistantThunder commented 8 years ago

Forgot to close this one.