Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question About: Fixed a startup crash due to DirectInput controller enumeration being broken #2

Open
elishacloud opened this issue Nov 6, 2023 · 14 comments

Comments

@elishacloud
Copy link

I have had an issue open in dinputto8 for a while regarding an issue with NFS: Porsche Unleashed crashing when certain controllers are used.

I troubleshot the issue down to a failing call to the CreateEffect function. The game cannot handle the fail and tries to access the nullptr after the call fails.

But I don't have the controller to test with so I am not quite sure why it fails. If you have any ideas that could help here that would be great.

@CookiePLMonster
Copy link
Owner

Sounds like #1 could be related - however it doesn't break on my wheel. It probably has to do with the game assuming specific FFB capabilities that the wheel might not have, but I am not sure how to test it more - maybe you could dump the input parameters and the result - who knows, perhaps the error here is not DIERR_INVALIDPARAM but something else.

@elishacloud
Copy link
Author

Sounds like #1 could be related

Yes, that is the same issue.

however it doesn't break on my wheel.

Ok, that is good to know at least. So it is not all wheels, just that one.

perhaps the error here is not DIERR_INVALIDPARAM but something else.

I just checked the logs and it is returning error code 0x80070057.

maybe you could dump the input parameters and the result

I did that and everything looked good, as far I as I can tell.

Here is the function call:

11420 16:27:50.551 m_IDirectInputDeviceX::CreateEffect (06D0CB60) Failed! GUID_Spring { dwSize: 52, dwFlags: 0x22, dwDuration: 4294967295, dwSamplePeriod: 2000, dwGain: 10000, dwTriggerButton: 4294967295, dwTriggerRepeatInterval: 50, cAxes: 2, rgdwAxes: 0019FC58, rglDirection: 0069CD38, lpEnvelope: 00000000, cbTypeSpecificParams: 48, lpvTypeSpecificParams: 0069CCF4, 6B14E57F} null hr: -2147024809

I am also seeing these calls fail:

10204 23:20:56.695 m_IDirectInputDeviceX::CreateEffect (0B119838) Failed! GUID_ConstantForce { dwSize: 52, dwFlags: 0x22, dwDuration: 4294967295, dwSamplePeriod: 2000, dwGain: 5000, dwTriggerButton: 4294967295, dwTriggerRepeatInterval: 0, cAxes: 2, rgdwAxes: 0019FC88, rglDirection: 0069CB88, lpEnvelope: 00000000, cbTypeSpecificParams: 4, lpvTypeSpecificParams: 0069CB44 ,00000000} null hr: -2147024809
10204 23:20:56.701 m_IDirectInputDeviceX::CreateEffect (0B119838) Failed! GUID_Square { dwSize: 52, dwFlags: 0x22, dwDuration: 4294967295, dwSamplePeriod: 2000, dwGain: 5000, dwTriggerButton: 4294967295, dwTriggerRepeatInterval: 0, cAxes: 2, rgdwAxes: 0019FC78, rglDirection: 0069CC18, lpEnvelope: 00000000, cbTypeSpecificParams: 16, lpvTypeSpecificParams: 0069CBD4 ,00000000} null hr: -2147024809

I don't see anything wrong with these calls, so I am not sure what parameter is wrong.

@elishacloud
Copy link
Author

BTW: here is the raw data with all functions logging: dinput_log.zip

For this update I created an IDirectInputEffect class and returned a pointer to that class even if the CreateEffect failed so that the game would play without crashing. Then I tried to add the effect by calling IDirectInputEffect::SetParameters().

3724 18:22:42.350 m_IDirectInputDeviceX::CreateEffect (090AC490) Trying! GUID_ConstantForce null
3724 18:22:42.350 DIEFFECT { dwSize:,52, dwFlags:,0x22, dwDuration:,4294967295, dwSamplePeriod:,2000, dwGain:,9900, dwTriggerButton:,4294967295, dwTriggerRepeatInterval:,0, cAxes:,2, rgdwAxes:,0019FC88, rglDirection:,0069CB88, lpEnvelope:,00000000, cbTypeSpecificParams:,4, lpvTypeSpecificParams:,0069CB44, ,0, }
3724 18:22:42.350 DIEFFECT rgdwAxes 0: 0
3724 18:22:42.350 DIEFFECT rgdwAxes 1: 4
3724 18:22:42.350 DIEFFECT rglDirection 0: 0
3724 18:22:42.350 DIEFFECT rglDirection 1: 0
3724 18:22:42.350 DIEFFECT lpvTypeSpecificParams { lMagnitude: 10000 }
3724 18:22:42.350 DIEFFECT { dwSize:,56, dwFlags:,0x22, dwDuration:,4294967295, dwSamplePeriod:,2000, dwGain:,9900, dwTriggerButton:,4294967295, dwTriggerRepeatInterval:,0, cAxes:,2, rgdwAxes:,0019FC88, rglDirection:,0069CB88, lpEnvelope:,00000000, cbTypeSpecificParams:,4, lpvTypeSpecificParams:,0069CB44, dwStartDelay:,4294967295, }
3724 18:22:42.351 DIEFFECT rgdwAxes 0: 0
3724 18:22:42.351 DIEFFECT rgdwAxes 1: 4
3724 18:22:42.351 DIEFFECT rglDirection 0: 0
3724 18:22:42.351 DIEFFECT rglDirection 1: 0
3724 18:22:42.351 DIEFFECT lpvTypeSpecificParams { lMagnitude: 10000 }
3724 18:22:42.351 m_IDirectInputDeviceX::CreateEffect (090AC490) Failed! hr: DIERR_INVALIDPARAM Retrying!
3724 18:22:42.351 m_IDirectInputDeviceX::CreateEffect (090AC490) SetParameters Failed! 359 hr: DIERR_INVALIDPARAM
3724 18:22:42.351 Creating interface m_IDirectInputEffect::m_IDirectInputEffect (0B510EA8)
3724 18:22:42.351 m_IDirectInputEffect::Unload (0B510EA8)

@CookiePLMonster
Copy link
Owner

Yes, that is the same issue.

This issue states

No other DirectInput wrappers. Running Windows 10.

which makes me think it's just a game bug - maybe these wheels just don't support the type of Force Feedback the game expects - although it would be strange not to support the constant force...

I have no further ideas atm, but I'll let you know if I manage to reproduce it or gather any more info.

@elishacloud
Copy link
Author

which makes me think it's just a game bug - maybe these wheels just don't support the type of Force Feedback the game expects

That is what I thought also, but it works without dinputto8. So I guess something is changing between the v1 CreateEffect() call and the v8 CreateEffect() call. Or some other function needs to be setup first that is not quite setup for v8, but still works with v1.

Anyways, thanks for looking. If you think of anything let me know.

@CookiePLMonster
Copy link
Owner

Anyways, thanks for looking. If you think of anything let me know.

Next time I have my wheel setup, I will try Porsche with dinputto8 - I use dinput.dll as an ASI loader for the patch, but I can just move to use dinput8.dll instead and both wrappers will co-exist.

@elishacloud
Copy link
Author

Thanks!

@Goblan
Copy link

Goblan commented Nov 10, 2023

Anyways, thanks for looking. If you think of anything let me know.

Next time I have my wheel setup, I will try Porsche with dinputto8 - I use dinput.dll as an ASI loader for the patch, but I can just move to use dinput8.dll instead and both wrappers will co-exist.

This would allow for Xidi to be used too. I'd really appreciate that. Thanks!

@CookiePLMonster
Copy link
Owner

This would allow for Xidi to be used too. I'd really appreciate that. Thanks!

You can already do that since UAL is generic - just rename dinput.dll to dinput8.dll and it will work fine. Of course you then need another dinput wrapper that'd load dinput8 so UAL works.

@Goblan
Copy link

Goblan commented Nov 11, 2023

This would allow for Xidi to be used too. I'd really appreciate that. Thanks!

You can already do that since UAL is generic - just rename dinput.dll to dinput8.dll and it will work fine. Of course you then need another dinput wrapper that'd load dinput8 so UAL works.

I'm not sure I understand... What dinput.dll file should I rename to dinput8.dll, yours or Xidi's?

@CookiePLMonster
Copy link
Owner

I am not sure if Xidi can load another DLL - if it can use another DLL as a proxy, you should have Xidi as dinput.dll and then rename mine to whatever you set the Xidi's proxy to.

@Goblan
Copy link

Goblan commented Nov 11, 2023

Xidi brings a dinput.dll file and a dinput8.dll file, to use one or the other depending on the game. I've contacted the creator to see if a solution can be found.

@ThirteenAG
Copy link

Latest version of UAL allows to load original(or not original) dll by renaming it to <ualname>Hooked.dll.
vorbisFile.dll -> vorbisHooked.dll for example. It was previously reserved for specific names, now works for all.

@Goblan
Copy link

Goblan commented Nov 23, 2023

Sounds great. I guess that sorts it out once and for all. Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants