samuelgr/Xidi

Silent Hill 4 - Force Feedback/Vibration not working

Closed this issue · 10 comments

r2rX commented

Hey @samuelgr ,

After getting Silent Hill 4 working, I started a play-through and it seems that force feedback isn't working. This applies to both the retail and GOG version. Additionally, I also tried incorporating Hookshot but it didn't make a difference.

I also installed both versions of the game in a Win XP VM and used a Logitech Rumblepad 2 (w/ LGS 4.60 driver) and that did work...so vibration isn't inherently broken with the game. Silent Hill 2 and 3 work perfectly with Xidi dinput8, both with fully registered inputs and force feedback.

r2rX commented

Here's a log, verbose level 4, in case it can help debug/troubleshoot:

Xidi_DInput8_SILENT HILL 4.exe_308.log

Thank you, the log is very helpful.

[10/10/2022 17:02:36] [I] Invoked Xidi::VirtualDirectInputEffect<0>::SetParameters() on force feedback effect with identifier 0 associated with Xidi virtual controller 1, result = 0x00000003.

This doesn't appear to be a problem for Silent Hill 4, but it could potentially indicate issues in other games. 1d0102b should take care of it.

[10/10/2022 17:02:36] [D] Begin dump of effect parameters.
[10/10/2022 17:02:36] [D]   Control:
[10/10/2022 17:02:36] [D]     flags = 0x20000140 (DIEP_START | DIEP_DIRECTION | DIEP_TYPESPECIFICPARAMS)
[10/10/2022 17:02:36] [D]   Basics:
[10/10/2022 17:02:36] [D]     dwSize = 56 (sizeof(DIEFFECT))
[10/10/2022 17:02:36] [D]     dwFlags = 0x00000012 (DIEFF_CARTESIAN | DIEFF_OBJECTOFFSETS)
[10/10/2022 17:02:36] [D]   Direction:
[10/10/2022 17:02:36] [D]     cAxes = 1
[10/10/2022 17:02:36] [D]     rglDirection[ 0] = 10000
[10/10/2022 17:02:36] [D]   Type-Specific:
[10/10/2022 17:02:36] [D]     cbTypeSpecificParams = 4 (sizeof(DICONSTANTFORCE))
[10/10/2022 17:02:36] [D]     lpvTypeSpecificParams->lMagnitude = 14142
[10/10/2022 17:02:36] [D] End dump of effect parameters.
[10/10/2022 17:02:36] [I] Invoked Xidi::VirtualDirectInputEffect<0>::SetParameters() on force feedback effect with identifier 0 associated with Xidi virtual controller 1, result = 0x80070057.

This is the problem. The game uses a single effect and switches it between magnitude 0 and magnitude non-zero (14142 in this case). Technically the magnitude is only supposed to be from -10,000 to +10,000 but this game is sending in something that is out of range, and Xidi is rejecting it as an invalid parameter. Since it appears that the game works with DirectInput vibration, Xidi will need to be more flexible about force magnitudes in order to get games like this working.

r2rX commented

Really happy you determined the issue. I compiled the latest snapshot of Xidi and tested dinput8.dll. Unfortunately, it's still not working. Maybe the log will indicate something?

Xidi_DInput8_SILENT HILL 4.exe_304.log

I haven't fixed the main issue yet. Once I do that I will upload a development build for you to test.

r2rX commented

Hehe.....seems I jumped the gun when I saw 1d0102b was added. 😄 . Ready when you are. 👍

I think this should be fixed with c400519. Please give the attached development build a try.

Xidi-v4.0.3-dev.5.0+c4005193.zip

r2rX commented

Alrighty. Just tested it and, unfortunately, not working.

Xidi_DInput8_SILENT HILL 4.exe_304.log

Looks like the fix wasn't entirely complete. There was another spot in the code that was still being strict. I removed that and centralized all the logic in a5da917, revised development build is attached. Please give it a try.

Xidi-v4.0.3-dev.8.0+a5da9177.zip

r2rX commented

@samuelgr , you're a star! Force feedback works with 4.0.3-dev.8.0! Good stuff and thank you. :)

Great to hear. The fix is officially released as v4.0.3.