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

NFS: Porsche Unleashed crashes on race load #15

Open
sdether opened this issue Jan 2, 2021 · 50 comments
Open

NFS: Porsche Unleashed crashes on race load #15

sdether opened this issue Jan 2, 2021 · 50 comments

Comments

@sdether
Copy link

sdether commented Jan 2, 2021

Following instructions from PCGamingWiki I installed dinputto8 v1.0.39.0 and devreorder to try to add support for my Fanatec CSL Elite Wheel.

However this combination crashes the game once you try to start a race. I did some experimentation to try to narrow down what causes this:

  • without either dinputto8 and devreorder
    • can map buttons and analog controls of the Fanatec wheel in options menu
    • The race does not crash
    • The mapped buttons work, but the analog controls do not (this is what devreorder is supposed to fix)
    • Force feedback is working (can feel the forces and road in the wheel even if steering is unresponsive)
  • with only devreorder
    • behaves like the previous case
  • with only inputto8
    • can map buttons and analog controls of the Fanatec wheel in options menu
    • Race crashes on load
  • with both dinputto8 and devreorder
    • the device list is filtered properly
    • can map buttons and analog controls of the wheel in options menu
    • if the mapped device is the Xbox 360 controller, race runs and controls work
    • if any button or analog control on the Fanatec wheel is mapped, race crashes on load

My guess is that there's something in the way the Fanatec uses Direct Input that is not compatible with the API mapping that dinputto8 does. If there is anything I can do on my end to provide a more useful bug report or diagnostic data, please let me know.

@sdether
Copy link
Author

sdether commented Jan 2, 2021

Tried installing dinput_debug for v1.0.39.0 to get logging, however that complains about a bunch of missing DLLs (including VCRUNTIME140.DLL). Seemed to track back to missing Visual C++ Redistributable for Visual Studio 2015, however I already have a redistributable called Visual C++ Redistributable for Visual Studio 2015-2019 which prevents the install of the former, so not sure what I'm missing to get the debug version working

@sdether
Copy link
Author

sdether commented Jan 2, 2021

Also tired dinput_debug v1.0.30.0 since that still had logging enabled. That one, however crashes NFS:PU on launch even when only XBox360 controller is configured which works with v1.0.39.0. Just in case this is the log it writes:

12592 10:25:32.439 Starting dinputto8 v1.0.30.0
12592 10:25:32.439 ASUSTeK COMPUTER INC. TUF H310-PLUS GAMING Rev X.0x (Desktop)
12592 10:25:32.440 Windows 10 64-bit (10.0.19041)
12592 10:25:32.440 "nfs5.exe" (PID:7788)
12592 10:25:32.444 Redirecting 'DirectInputCreate' IID_IDirectInputA version 0x500 to --> 'DirectInput8Create'
12592 10:25:32.508 Creating device m_IDirectInputX::m_IDirectInputX(04D33650) converting device from v1 to v8 using ANSI
12592 10:25:32.509 Creating device m_IDirectInputDeviceX::m_IDirectInputDeviceX(04CE6558) converting device from v1 to v8 using ANSI
12592 10:25:32.509 Creating device m_IDirectInputDeviceX::m_IDirectInputDeviceX(04CE64C8) converting device from v2 to v8 using ANSI
12592 10:25:32.509 m_IDirectInputDeviceX::~m_IDirectInputDeviceX(04CE6558) deleting device!
12592 10:25:32.509 m_IDirectInputDeviceX::~m_IDirectInputDeviceX(04CE64C8) deleting device!
12592 10:25:32.509 m_IDirectInputX::~m_IDirectInputX(04D33650) deleting device!
12592 10:25:32.509 DirectInputCreateW
12592 10:25:32.509 Redirecting 'DirectInputCreate' IID_IDirectInputW version 0x50a to --> 'DirectInput8Create'
12592 10:25:32.526 Creating device m_IDirectInputX::m_IDirectInputX(04D33608) converting device from v1 to v8 using UNICODE
12592 10:25:32.526 Redirecting 'DirectInputCreate' IID_IDirectInputA version 0x500 to --> 'DirectInput8Create'
12592 10:25:32.526 Creating device m_IDirectInputX::m_IDirectInputX(04D3AA88) converting device from v1 to v8 using ANSI
12592 10:25:32.527 Creating device m_IDirectInputDeviceX::m_IDirectInputDeviceX(04CE65E8) converting device from v1 to v8 using ANSI
12592 10:25:32.527 m_IDirectInputDeviceX::~m_IDirectInputDeviceX(04CE65E8) deleting device!
12592 10:25:36.370 m_IDirectInputX::~m_IDirectInputX(04D33608) deleting device!
12592 10:25:36.370 m_IDirectInputX::~m_IDirectInputX(04D3AA88) deleting device!

@elishacloud
Copy link
Owner

Here is the latest debug file. Go ahead and try this one, attaching the logs.

dinput.zip

@sdether
Copy link
Author

sdether commented Jan 2, 2021

Tried to keep the test cases as minimal as possible:
xbox360_dinput.log - only Xbox controller were mapped prior to this run. Game is launched, race is started. Shortly after it loads properly I exit

fanatec_dinput.log - Steering on the Fanatec wheel was mapped prior to this run, while the other Xbox bindings remained. Game is launched, race is started. Crashes on completion of load.

Didn't see anything obvious in the logs, except that the fanatec case had a couple of cases of two threads writing log lines at the same time, messing up line feeds, but doubt that's related to crashes. Hope the logs shed more light for you.

thanks!

@elishacloud
Copy link
Owner

Thanks for the help here. Am I correct in saying that the Xbox controller works fine?

I can see that Fanatec wheel calls the CreateEffect function and it looks like it is failing on this function. There may be something I need to convert to DirectInput8. I am not sure if this is why it is crashing.

I created an update with more logging here. Can you test this one and upload the logs: dinput.zip

@sdether
Copy link
Author

sdether commented Jan 2, 2021

Yes, when just using the Xbox controller everything works. And it does look like the Fanatec controller is failing on CreateEffect. There's a bunch of Trying followed by Failed entries in the logs now.
dinput.log

Not sure if this is helpful or related, but in case CreateEffect is related to Force Feedback, I should note that when running the game without dinput and mapping the Fanatec wheel the wheel is definitely receiving Force Feedback. It's just that the analog controls are not bound. But the game starts going straight on full throttle and you can feel the FFB pushing against turning the wheel and you can feel the texture of the road as its going down the road, so in principle the wheels FFB and what NFS:PU is sending seem to be compatible.

@elishacloud
Copy link
Owner

It looks like it is sending 0x80070057 which means a parameter is incorrect. I created an update to fix some of the parameter issues.

Can you test this one and upload the logs: dinput.zip

@sdether
Copy link
Author

sdether commented Jan 3, 2021

Took a little longer to crash. Usually it crashes as soon as it the loading bar gets to the end. This time it just hung there, making me think it had locked up. But a couple of seconds later it did crash. I see more debug information on the CreateEffect calls, but otherwise it seems like it's the same calls that are failing.
dinput.log

Really appreciating you working on this, btw. Pretty awesome that a game from 2000 can still be tweaked independently of the original developer.

@elishacloud
Copy link
Owner

There is still a bad parameter, but I don't know which one. I added more logging and tried a slightly different way of creating the effect.

Here is one more try: dinput.zip

@sdether
Copy link
Author

sdether commented Jan 3, 2021

Alright this is fantastic. Does not crash, mapping works, and it works in race.

dinput.log

That solves the main problem. I did come across two other issues:

  • When in the controller mapping screens, the UI crawls for a couple of frames per second and inputs lag. Maybe that's just the logging I/O and it goes away with a logging disabled DLL?
  • Force Feedback is gone. Since it was there before any of this patching, I know that NFS:PU does send the proper FFB info to the wheel. Of course that was before mapping worked, so maybe its just something that is lost in the API mapping you have to do?

@elishacloud
Copy link
Owner

It looks like the crash was coming from the failed CreateEffect function. The new way I am creating the effects is not a permanent solution, and it does not solve the core issue of invalid parameter, as seen by this log:

10204 23:20:56.703 m_IDirectInputDeviceX::CreateEffect (0B119838) tying 'SetParameters' hr = DIERR_INVALIDPARAM

For this update I hard coded some of the parameters based on Microsoft's SDK. This will help isolate the issue: dinput.zip

@sdether
Copy link
Author

sdether commented Jan 3, 2021

Back to crashing. Hope there's enough info in this one
dinput.log

@elishacloud
Copy link
Owner

@sdether, thanks for your continued help here! I have no other way to test this.

It looks like the issue with the parameters may be caused by a previous call to SetDataFormat. I added more logs there. I hope this will give me all the data I need.

Here is another test build: dinput.zip

@sdether
Copy link
Author

sdether commented Jan 4, 2021

This one works again. Input in configuration screen still super laggy and still no forcefeedback in-race, but otherwise the controls work as they should.

dinput.log

And I should be the one thanking you. I'm the one with the odd combination of old game and new hardware that's crashing after all. Gladly provide all the debugging support I can since my C++ is atrocious. I've sworn off all languages that require manual memory management, since the only thing I ever effectively managed to create was memory leaks and crashes :)

@elishacloud
Copy link
Owner

Input in configuration screen still super laggy

This could just because the wrapper is running in debug mode. Here is a release build to test with to see if it is still slow with the release build: dinput.zip

still no forcefeedback in-race

There are no errors and the functions seem to be passing, so I am not sure what is happening here. I added logs when the game tries to start the force feedback to see if it is getting any errors.

I should be the one thanking you. I'm the one with the odd combination of old game and new hardware that's crashing after all.

I would like to fix this if possible, since I have had reports of similar issues and I think they are related.

I've sworn off all languages that require manual memory management, since the only thing I ever effectively managed to create was memory leaks and crashes :)

I am afraid the maker of this game maybe should have done the same thing. The game fails to check the Effect interface address and uses it blindly, thus the crash. I fixed this by creating the interface with no parameters and then adding the parameters later. This way when the game uses the interface it does not crash.

Here is another debug test build. It just has additional logs: dinput.zip

@sdether
Copy link
Author

sdether commented Jan 4, 2021

Input in configuration screen still super laggy

This could just because the wrapper is running in debug mode. Here is a release build to test with to see if it is still slow with the release build: dinput.zip

That fixed it. Makes sense.

still no forcefeedback in-race

There are no errors and the functions seem to be passing, so I am not sure what is happening here. I added logs when the game tries to start the force feedback to see if it is getting any errors.

Here's the latest debug output. Hope it sheds more light on things:
dinput.log

@elishacloud
Copy link
Owner

It is possible some other functions may be causing the failure in CreateEffect so I added logging for other functions that may affect it. I also made one change to SetDataFormat, which may have been the issue.

Can you try this update: dinput.zip

@sdether
Copy link
Author

sdether commented Jan 17, 2021

Crashes on race start. Log attached. Not seeing anything obvious.
dinput.log

@elishacloud
Copy link
Owner

Ok, looks like I had a bug in my code. This one should no longer crash, but it still does not get us closer to solving the force feedback issue.

New update: dinput.zip

I did see one entry in the log:

2716 15:25:02.559 m_IDirectInputDeviceX::SetCooperativeLevel (0081F740) Trying! 0x6
2716 15:25:02.559 m_IDirectInputDeviceX::SetCooperativeLevel (0081F740) Failed! E_HANDLE

But this may be normal for the game and it shouldn't have any impact on the force feedback issue.

@sdether
Copy link
Author

sdether commented Jan 18, 2021

Alright. No crashes and this one looks like it's got some useful info. Plenty of failures around CreateEffect, and GetEffectGUID along the lines of

908 18:02:04.302 m_IDirectInputEffect::SetParameters (104112B8) Failed! hr: DIERR_INVALIDPARAM
908 18:02:04.302 m_IDirectInputEffect::Start (104112B8) Trying! 1 0x0
908 18:02:04.302 m_IDirectInputEffect::Start (104112B8) Failed! hr: DIERR_INCOMPLETEEFFECT

etc.
dinput.log

@BloodDeath
Copy link

Hello, I have similiar issue with crashing in the end of race oad when I use Logitech Driving Force GT or Logitech Formula Force EX.
My Xbox one controller works fine.
I've tried to use different versions of dinput posted here with no luck.
I'm attaching my latest dinput.log

@elishacloud
Copy link
Owner

Can you try with the attached update? I made a few changes that might solve the issue and enabled full logging.

Here is the update: dinput.zip

@BloodDeath
Copy link

Thank you very much, loading works and I can drive, but just like above case, Force Feedback is not working.
dinput.zip

@elishacloud
Copy link
Owner

Attached is another debug log. This probably won't solve the issue, but will give me a bit more debug info. Since I don't have the correct hardware I need to get some logs from you.

Here is the new update: dinput.zip

@BloodDeath
Copy link

Ok, nothing changed in gameplay. Here is log:
dinput.zip

@pierre313
Copy link

Hi. I had exact same problem with a Logitech G27 and was ready to give up trying to play this old game but in last moment found this thread.
I'm using the Release build that was posted here on Jan 4 which working good for me.
It's no force feedback but I'm still happy to be able to play this game with a steering wheel.

@MythTW
Copy link

MythTW commented Nov 9, 2021

wow this thread saves me...I have an old wheel Logitech Winman Forumla Force, and after a long tedious process it finally works in windows 10 but NFS Prosche just keep getting other USB device even I changed the controller to the wheel.
So I came here from https://www.pcgamingwiki.com/wiki/Need_for_Speed:_Porsche_Unleashed
However, the game crashes after loading the track, I then found this thread.
And the build from Jan 4 works for me though without force feedback. But I'm happy that I can finally play the game. Much thanks to your work!

@hjalmberi
Copy link

Jan 4 build also works with Logitech G923 (without force feedback). The only issue I have is the inability to adjust how heavy the steering is. Logitech G Hub has a separate setting for non force feedback games where I can make steering easier, but it doesn't apply in NFS Porsche probably because it is still counted as a force feedback game. Is there some setting I'm missing here?

@thorr2
Copy link

thorr2 commented May 22, 2022

I also am experiencing the same issues with my Logitech G25. I spent hours getting everything working today on my old-school CRT TV, and this is the last hurdle. I hope this can get fully fixed. As the original poster said, Force Feedback was working with devreorder without dinputto8, but the analog controls did nothing. The latest released version of dinputto8 crashes the game. The January version in this thread breaks force feedback and fixes the analog controls. This is my favorite NFS game, so I hope this can be worked on again. Thanks for all of your efforts.

@thorr2
Copy link

thorr2 commented May 30, 2022

Ok, sort of good news! I got my Logitech G25 to work with Force Feedback. It is not ideal, but it works. The trick is to completely not use devreorder or dinputto8 (get rid of those files) and to remove all the other devices including USB hubs. I unplugged anything and everything USB except the keyboard and mouse dongle and the USB wheel. Then I went into the Device Manager in Windows and Showed Hidden Devices, just for good measure, and I removed everything under Human Interface Devices except the Logitech G25 items and the keyboard/mouse dongle. It is unknown which one of these is the keyboard and mouse dongle, so when I figured out which one, I had to unplug and reinsert the USB dongle and I think I scanned for new devices and deleted everything again (this may not be necessary).

Then inside the game, the Logitech was showing up as the default controller and the extra devices were gone. It still didn't work right, so when I started the race, while it was loading, I unplugged the keyboard and mouse dongle. Then the wheel worked with force feedback. Then I plugged the keyboard and mouse dongle back in and the wheel stayed in first place and worked together with the keyboard and mouse.

The only issue I still have is I can physically turn the wheel past the 200 degrees points, and I haven't figured out how to get the Logitech software to stop that from happening yet. You can see the behavior of everything in the Deadzone section in the game. Edit: I fixed this by reducing the centering spring strength to around 50% or slightly higher in the Logitech app. At 100%, you can't feel the edge very well.

Here are my current in game settings:
Stick volume 75
Road effects 40
Collision 99
Engine 20
Road grip 70

And in the Logitech app:
Overall 100
Spring 100
Damper 100
Centering Spring 50
Do not report combined pedals
Rotation 200 degrees
Allow game to adjust settings

@rock5917
Copy link

rock5917 commented Sep 2, 2022

Attached is another debug log. This probably won't solve the issue, but will give me a bit more debug info. Since I don't have the correct hardware I need to get some logs from you.

Here is the new update: dinput.zip

I'm in the same boat as BloodDeath. Only Force Feedback is not working.
Log:
dinput.zip

@amagony98
Copy link

I wish the force feedback would work... everything else works fine with Logitech G29+Thrustmaster th8a shifter.

@thorr2
Copy link

thorr2 commented Sep 12, 2022 via email

@amagony98
Copy link

Yeah, I read that, but I have so many virtual devices from various softwares that this is just not an option for me. :( And doing this every single time I launch the game is just too much.

Years ago, I was using a Logitech Momo wheel. With that everything worked perfectly. Although, I think that was with Windows 7, and not with dinput8.

@hjalmberi
Copy link

I can't physically unplug everything either as I only have access to a laptop at the moment :/

@thorr2
Copy link

thorr2 commented Sep 14, 2022 via email

@TheRealDadbeard
Copy link

Anything on the horizon with force feedback?

@elishacloud
Copy link
Owner

Currently, I have put this on hold since I don't have the means to troubleshoot this remotely and I don't have a way, at this time, to reproduce this. The issue is that the Input Effect fails on creation. I'm not quite sure why it fails or what changes would be needed for it to succeed.

@itais
Copy link

itais commented Sep 24, 2023

I was excited to see a new release but the game still crashes on load (no log created). I'm back to this version:

Can you try with the attached update? I made a few changes that might solve the issue and enabled full logging.

Here is the update: dinput.zip

which works except for the force feedback, as also noted above.
I'm attaching my log from this version. Hope it'll help.
dinput_log.zip
.

@TheRealDadbeard
Copy link

I was excited to see a new release but the game still crashes on load (no log created). I'm back to this version:

Can you try with the attached update? I made a few changes that might solve the issue and enabled full logging.
Here is the update: dinput.zip

which works except for the force feedback, as also noted above. I'm attaching my log from this version. Hope it'll help. dinput_log.zip .

OMG this makes it work! https://cookieplmonster.github.io/2023/09/24/silentpatch-need-for-speed-classics/

Just remove dinputtto8 and i had instant force feedback it's amazing! just be sure to tweak the ff settings or you steering wheel will rumble everyhting of your desk LOL

@itais
Copy link

itais commented Nov 6, 2023

I was excited to see a new release but the game still crashes on load (no log created). I'm back to this version:

Can you try with the attached update? I made a few changes that might solve the issue and enabled full logging.
Here is the update: dinput.zip

which works except for the force feedback, as also noted above. I'm attaching my log from this version. Hope it'll help. dinput_log.zip .

OMG this makes it work! https://cookieplmonster.github.io/2023/09/24/silentpatch-need-for-speed-classics/

Just remove dinputtto8 and i had instant force feedback it's amazing! just be sure to tweak the ff settings or you steering wheel will rumble everyhting of your desk LOL

It doesn't work for me unfortunately - the game crashes at the end of the loading screen.

@TheRealDadbeard
Copy link

I was excited to see a new release but the game still crashes on load (no log created). I'm back to this version:

Can you try with the attached update? I made a few changes that might solve the issue and enabled full logging.
Here is the update: dinput.zip

which works except for the force feedback, as also noted above. I'm attaching my log from this version. Hope it'll help. dinput_log.zip .

OMG this makes it work! https://cookieplmonster.github.io/2023/09/24/silentpatch-need-for-speed-classics/
Just remove dinputtto8 and i had instant force feedback it's amazing! just be sure to tweak the ff settings or you steering wheel will rumble everyhting of your desk LOL

It doesn't work for me unfortunately - the game crashes at the end of the loading screen.

Bummer. I am using a version from the RRP Discord with Veroks Patch running opengl. Maybe try a clean install?

@elishacloud
Copy link
Owner

@TheRealDadbeard, can you see if this update works? I changed one of the parameters to see if that helps: dinput.zip

@itais
Copy link

itais commented Nov 8, 2023

@TheRealDadbeard, can you see if this update works? I changed one of the parameters to see if that helps: dinput.zip

For me it doesn't work. the game still crashes after the loading screen.

@TheRealDadbeard
Copy link

@TheRealDadbeard, can you see if this update works? I changed one of the parameters to see if that helps: dinput.zip

I think you tagged the wrong one as for me it just works with only silent patch and without dinputto8

@itais
Copy link

itais commented Jun 27, 2024

Release v1.0.75.0 fixed the crash after the loading screen for me, thank you! Still no force feedback, though.

@elishacloud
Copy link
Owner

Yes, I put in a fix to return an effect interface even if CreateEffect() failed. This should prevent crashing in games that are not coded correctly. But it does not solve the core issue of why CreateEffect() failed in the first place. So the effect (in this case force feedback) doesn't work.

@elishacloud
Copy link
Owner

Ok, just for a test can you try this build: dinput.zip

@itais
Copy link

itais commented Jun 27, 2024

Ok, just for a test can you try this build: dinput.zip

With this version the game again crashes after the loading screen.

@elishacloud
Copy link
Owner

Ok, that is what I thought. The game just ignores the return code and value. Thanks for testing! I will look into the force feedback issue when I have the right setup.

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