ikt32 / GTAVManualTransmission

Manual Transmission for GTA V
https://www.gta5-mods.com/scripts/manual-transmission-ikt
187 stars 44 forks source link

Crashes with a Logitech G920 and ScriptHookVDotNet v2. #17

Closed jcostamagna closed 3 years ago

jcostamagna commented 7 years ago

For me it would be very usefull to have it working. What is the exception that throws here? Perhaps we can get help.

Cheers.

ikt32 commented 7 years ago

This is a known issue as indicated in the readme and the mod description over at GTA5-Mods.com

If you have some experience debugging mods for this game, try finding the line(s) where it throws the exception. (Attach with Visual Studio after building a debug version with symbols)

Alternatively try an automated build, maybe some other changes fixed it.

jcostamagna commented 7 years ago

@E66666666 I don't have experience but i was trying to attach it and crashes before now. I try to catch the exception from your mod but i couldn't. You have more experience? Any ideas?

ikt32 commented 7 years ago

@jcostamagna Disable all ScriptHookVDotNet scripts (simply rename the scripts folder) and try again. Somehow it doesn't throw exceptions with no .NET scripts. If you mean during loading, don't attach yet.

Try going in-game first (and not in a vehicle) and then attach VS.

jcostamagna commented 7 years ago

@E66666666 When I get out of the game to attach it, crash it self :/

So i can't try that.

Should be another way to debbug this. Any tool?

ikt32 commented 7 years ago

@jcostamagna VS should work fine, or x64dbg. I'd look around the DiJoyStick class and WheelDirectInput classes specifically and just put breaks there.

Also just enable the script reloading thing for SHV, remove all scripts from SHVDN and then see where it goes wrong.

Or simply put log statements everywhere in the code and run it normally :p

ikt32 commented 7 years ago

I made a build to test when things go wrong. It dumps the stack trace to the log file, and might help me with fixing this.

If anybody could please help. @jcostamagna ?

ikt32 commented 7 years ago

It crashes at GetCapabilities in DiJoystick.h and CreateEffect in WheelDirectInput.cpp.

Commenting out the GetCapabilities stops the crashing on start, but can't get around needing to set up an effect.

Please help, somebody. Why is the G920 so weird when using ScriptHookVDotNet?

ikt32 commented 7 years ago

Here's a mirror of the driver Logitech made for BeamNG. LGS_ForceFeedback_Fix_01022007.zip

ikt32 commented 7 years ago

When preparing for CreateEffect, the Logitech example does this:

Only difference now is that I don't do the Xinput branch, but my code's been working fine with using an Xbox 360 controller as wheel/DirectInput device... Only XInput API call it does is XInputGetState anyway and only uses the result to ID them. Nothing even with the return state, no setting stuff either.

Also doesn't explain why it only crashes and burns when ScriptHookVDotNet is also active.

ikt32 commented 5 years ago

As of a few months ago, somebody on 5mods discovered that everything works fine if the game is launched via the RAGEPluginHook launcher.

For me this is still not an acceptable solution, but it is a feasible workaround.

ikt32 commented 4 years ago

As for the latest releases, it seems that the issue somehow has disappeared. I'm closing this issue now, but if you have repeatable crashes with a G920 + ScriptHookVDotNet, please let me know again.

ikt32 commented 3 years ago

Issue reared its ugly head again after/since... 5.0.0?

Anyway, problem seems to also affect G29's when G Hub is used - after the most recent update, 2021.5.9841, released on May 27th.

Got no clue what it could be, but signs point to initializing the FFB once again - so I guess it's CreateEffect acting up again.

Bluscream commented 3 years ago

I have this issue on FiveM currently on my own server

ikt32 commented 3 years ago

An update on the situation:

I've rewritten the directinput initialization part, to get rid of the need of reinitializing the wheel constantly. This might solve the issue, but I haven't heard back from any users yet.

As for the source of the problem, it seems like creating an effect for a device twice, causes a simple access violation somewhere - as G29/G Hub users don't seem to use SHVDN.

ikt32 commented 3 years ago

Seem to have solved this in e54976a.