[PATCH v2 0/3] MR3330: xinput: Fix WRC9 crashing on start
This MR fixes WRC9 crashing on start with builtin xinput, since the game uses UWP xinput the ordinal numbers don't match up, so I decided to put these new exports with `@ stdcall` instead. When running winedump on the windows native dll, they don't have these exports at all :/ -- v2: xinput1_3: Add stub for XInputDestroy. xinput1_3: Add semi-stub for XInputSetStateEx. https://gitlab.winehq.org/wine/wine/-/merge_requests/3330
From: Etaash Mathamsetty <etaash.mathamsetty(a)gmail.com> --- dlls/xinput1_3/main.c | 7 +++++++ dlls/xinput1_3/xinput1_3.spec | 1 + 2 files changed, 8 insertions(+) diff --git a/dlls/xinput1_3/main.c b/dlls/xinput1_3/main.c index 2abf33a8d45..237ace77a82 100644 --- a/dlls/xinput1_3/main.c +++ b/dlls/xinput1_3/main.c @@ -1153,3 +1153,10 @@ DWORD WINAPI DECLSPEC_HOTPATCH XInputGetBatteryInformation(DWORD index, BYTE typ return ERROR_NOT_SUPPORTED; } + +DWORD WINAPI DECLSPEC_HOTPATCH XInputInit(void) +{ + FIXME("stub!\n"); + + return ERROR_SUCCESS; +} diff --git a/dlls/xinput1_3/xinput1_3.spec b/dlls/xinput1_3/xinput1_3.spec index 0023016afde..dd193a5a4ec 100644 --- a/dlls/xinput1_3/xinput1_3.spec +++ b/dlls/xinput1_3/xinput1_3.spec @@ -7,3 +7,4 @@ 7 stdcall XInputGetBatteryInformation(long long ptr) 8 stdcall XInputGetKeystroke(long long ptr) 100 stdcall XInputGetStateEx(long ptr) +@ stdcall XInputInit() -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3330
From: Etaash Mathamsetty <etaash.mathamsetty(a)gmail.com> --- dlls/xinput1_3/main.c | 13 +++++++++++++ dlls/xinput1_3/xinput1_3.spec | 1 + include/xinput.h | 8 ++++++++ 3 files changed, 22 insertions(+) diff --git a/dlls/xinput1_3/main.c b/dlls/xinput1_3/main.c index 237ace77a82..dcdc17598d0 100644 --- a/dlls/xinput1_3/main.c +++ b/dlls/xinput1_3/main.c @@ -858,6 +858,19 @@ DWORD WINAPI DECLSPEC_HOTPATCH XInputSetState(DWORD index, XINPUT_VIBRATION *vib return ret; } +DWORD WINAPI DECLSPEC_HOTPATCH XInputSetStateEx(DWORD index, XINPUT_VIBRATION_EX *vibration_ex) +{ + XINPUT_VIBRATION vibration; + static int once; + + if (!once++) FIXME("(%lu, %p) semi-stub\n", index, vibration_ex); + + vibration.wLeftMotorSpeed = vibration_ex->wLeftMotorSpeed; + vibration.wRightMotorSpeed = vibration_ex->wRightMotorSpeed; + + return XInputSetState(index, &vibration); +} + /* Some versions of SteamOverlayRenderer hot-patch XInputGetStateEx() and call * XInputGetState() in the hook, so we need a wrapper. */ static DWORD xinput_get_state(DWORD index, XINPUT_STATE *state) diff --git a/dlls/xinput1_3/xinput1_3.spec b/dlls/xinput1_3/xinput1_3.spec index dd193a5a4ec..300702db7f1 100644 --- a/dlls/xinput1_3/xinput1_3.spec +++ b/dlls/xinput1_3/xinput1_3.spec @@ -8,3 +8,4 @@ 8 stdcall XInputGetKeystroke(long long ptr) 100 stdcall XInputGetStateEx(long ptr) @ stdcall XInputInit() +@ stdcall XInputSetStateEx(long ptr) diff --git a/include/xinput.h b/include/xinput.h index f7c291630cb..74f9ffa4a89 100644 --- a/include/xinput.h +++ b/include/xinput.h @@ -194,6 +194,13 @@ typedef struct _XINPUT_VIBRATION { WORD wRightMotorSpeed; } XINPUT_VIBRATION, *PXINPUT_VIBRATION; +typedef struct XINPUT_VIBRATION_EX { + WORD wLeftMotorSpeed; + WORD wRightMotorSpeed; + WORD wLeftTriggerSpeed; + WORD wRightTriggerSpeed; +} XINPUT_VIBRATION_EX; + /* * Defines the structure for what kind of abilities the joystick has * such abilities are things such as if the joystick has the ability @@ -241,6 +248,7 @@ DWORD WINAPI XInputGetDSoundAudioDeviceGuids(DWORD, GUID*, GUID*); DWORD WINAPI XInputGetBatteryInformation(DWORD, BYTE, XINPUT_BATTERY_INFORMATION*); DWORD WINAPI XInputGetStateEx(DWORD, XINPUT_STATE*); +DWORD WINAPI XInputSetStateEx(DWORD, XINPUT_VIBRATION_EX*); #ifdef __cplusplus } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3330
From: Etaash Mathamsetty <etaash.mathamsetty(a)gmail.com> --- dlls/xinput1_3/main.c | 5 +++++ dlls/xinput1_3/xinput1_3.spec | 1 + 2 files changed, 6 insertions(+) diff --git a/dlls/xinput1_3/main.c b/dlls/xinput1_3/main.c index dcdc17598d0..2071c814ec4 100644 --- a/dlls/xinput1_3/main.c +++ b/dlls/xinput1_3/main.c @@ -1173,3 +1173,8 @@ DWORD WINAPI DECLSPEC_HOTPATCH XInputInit(void) return ERROR_SUCCESS; } + +void WINAPI DECLSPEC_HOTPATCH XInputDestroy(void) +{ + FIXME("stub!\n"); +} diff --git a/dlls/xinput1_3/xinput1_3.spec b/dlls/xinput1_3/xinput1_3.spec index 300702db7f1..1240070ea13 100644 --- a/dlls/xinput1_3/xinput1_3.spec +++ b/dlls/xinput1_3/xinput1_3.spec @@ -9,3 +9,4 @@ 100 stdcall XInputGetStateEx(long ptr) @ stdcall XInputInit() @ stdcall XInputSetStateEx(long ptr) +@ stdcall XInputDestroy() -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3330
When running winedump on the windows native dll, they don't have these exports at all :/
Then this is the wrong fix; it'll need more debugging. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3330#note_38960
I seem to remember that this game (or maybe it was a previous version) includes a file called `xinput1_3.dll` which is not a Windows DLL, it exports function names very similar to the real system `xinput1_3.dll` but then bridges to the UWP windows.gaming.input APIs. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3330#note_38961
On Fri Jul 14 14:37:24 2023 +0000, Zebediah Figura wrote:
When running winedump on the windows native dll, they don't have these exports at all :/ Then this is the wrong fix; it'll need more debugging. but XInputGetStateEx is not there either in the windows dll
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3330#note_38986
On Fri Jul 14 14:39:34 2023 +0000, Brendan Shanks wrote:
I seem to remember that this game (or maybe it was a previous version) includes a file called `xinput1_3.dll` which is not a Windows DLL, it exports function names very similar to the real system `xinput1_3.dll` but then bridges to the UWP windows.gaming.input APIs. yes, but wine loads the builtin xinput it seems like
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3330#note_38987
On Fri Jul 14 14:39:34 2023 +0000, Etaash Mathamsetty wrote:
yes, but wine loads the builtin xinput it seems like Yes, that's a long-standing Wine issue when an application includes a DLL that has the same name as a builtin but is not compatible. There are WineHQ bugs for the issue, like [48275](https://bugs.winehq.org/show_bug.cgi?id=48275) and [43472](https://bugs.winehq.org/show_bug.cgi?id=43472).
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3330#note_39507
On Wed Jul 19 18:05:45 2023 +0000, Brendan Shanks wrote:
Yes, that's a long-standing Wine issue when an application includes a DLL that has the same name as a builtin but is not compatible. There are WineHQ bugs for the issue, like [48275](https://bugs.winehq.org/show_bug.cgi?id=48275) and [43472](https://bugs.winehq.org/show_bug.cgi?id=43472). I wonder if we can just make the default override for specific DLLs as n,b
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3330#note_39634
I wonder if we can just make the default override for specific DLLs as n,b
This has been rejected before: https://www.winehq.org/mailman3/hyperkitty/list/wine-devel(a)winehq.org/thre... -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3330#note_39643
This merge request was closed by Rémi Bernon. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3330
If there's something to fix it's probably in the loader, though it's not clear how it can be done. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3330#note_39906
participants (5)
-
Brendan Shanks (@bshanks) -
Etaash Mathamsetty -
Etaash Mathamsetty (@etaash.mathamsetty) -
Rémi Bernon -
Zebediah Figura (@zfigura)