dantarion / SF5DInput

DirectInput support for Street Fighter 5 PC
MIT License
65 stars 6 forks source link

Startup crash - dereferencing a -1 valued pointer #5

Closed WydD closed 8 years ago

WydD commented 8 years ago

Reported by Heven666 on twitter https://twitter.com/Heven666/status/744292603537960960 What is really weird is: this happens even without any sticks connected.

This may be the same problem https://www.reddit.com/r/StreetFighter/comments/4oqpap/dantarions_dinput_plugin_for_sfv_alpha_002_feat/d4fgo1u

Kuraperunat commented 8 years ago

I'm not familiar with windows .dll stuff, but my friend had this same issue and I decided to take a look at the source. Opened the project in VS2015, changed the project to x64 release and compiled.

To my surprise the default resulting .dll was only 35kb in size but worked flawlessly for me. Sent it to my friend and it worked for him too, no crashes and hotswaps work and everything.

I imagine there's a compiler setting that's causing this, but I should be on default settings. I'll attach the compiled dll here if it helps.

xinput1_3.zip

WydD commented 8 years ago

Erm... I'm not familiar with windows AT ALL :) It seems that my build environment does not resolve the issue. Let me check with Heven666 if it works for him.

WydD commented 8 years ago

The user is still getting the same error so it's not the compiler.

Kuraperunat commented 8 years ago

Sounds like there might be multiple issues causing this. It fixed a "Memory could not be read" startup error for my friend who's using Win10 + hrap4.

WydD commented 8 years ago

I've got two testers and this is a list of stuff that happens:

WydD commented 8 years ago

This could be related to antivirus and windows defender. If that's so I dont know how to work around this aside asking people to put exceptions. Actually SFV does that as well as stated in their official bug reporting policy https://steamcommunity.com/app/310950/discussions/1/405691491125674277/

michaelmarcuccio commented 8 years ago

This problem still persists, and I have tried Kuraperunat's xinput1_3.dll. I get "the instruction at 0x00007FFE625EE06E referenced memory at 0xFFFFFFFFFFFFF, when starting SFV and it fails to launch. I am using windows 10, and had windows defender turned off. I tried running as administrator and compatibility modes, but it didn't help at all. Running on a gtx1080, i7 2600k, and a really really old motherboard. Happens with sticks plugged in and without them plugged in as well.

WydD commented 8 years ago

So the weirdest thing happened. Heven666 told me that if he launched the game via a shortcut created on his desktop. If he launched the game with the steam library then the game would work. And when he re-created his shortcut, everything worked fine. So for him, everything works fine now and he cant reproduce the bug!

WydD commented 8 years ago

But @TeranXVII on twitter launches the game via steam library and still has problems.

WydD commented 8 years ago

New weird problem: for some users (@TCZElliott on twitter), 0.0.2 works but 0.0.3 does not.

WydD commented 8 years ago

And for @Los_Rogiv none works (even 0.0.1), same error everytime

HalfAWalrus commented 8 years ago

I've also been having the crash happen every time no matter what version I use.

My error looks like this: http://puu.sh/q7puV/b0ab761728.png no matter what version I use, or how I launch it(exe, steam, shortcut).

Hope this can help!

WydD commented 8 years ago

Alright I've worked on it and I may have found something interesting. This is in relation of DllMain which is a bit sensitive on a lot of stuff. So I rewrote the whole injection in a lazy loading mode (like x360ce actually). I've prepared a custom build http://petitl.fr/dl/sf5dinput-snapshot-dllmain-rewrite.zip (cc @HalfAWalrus or @sesq92 you can try it) This one does not need ori_xinput1_3.dll, you just need the dll in the usual directory

HalfAWalrus commented 8 years ago

The new build still causes the same error.

michaelmarcuccio commented 8 years ago

Same results as Walrus, immediate error

WydD commented 8 years ago

Apparently this build has solved the issue for two testers. Could you confirm this? https://petitl.fr/dl/sf5dinput-snapshot-mt-linking.zip

This build has cleaner headers, provides resource data (for trustiness purposes) and most importantly it embeds the CRT (linking option /MT) making the DLL more resistant against the heterogeneity of the users environment.

WydD commented 8 years ago

Another tester has confirmed it working (@TeranXVII). cc @sesq92 @HalfAWalrus

WydD commented 8 years ago

I'm up to date on my master branch. I'll create the PR if other tests are alright. I pinged the reddit users who could not start the game (no error message though) and see if that fixed it.

michaelmarcuccio commented 8 years ago

YO! Great work, it works fully for me now. Thanks so much for your efforts.

Edit: My stick all the sudden stopped working mid-match. it was t.e.2 on ps3 mode. i set it to ps4 mode and I guess ill see if it happens again.

WydD commented 8 years ago

It seems to have fixed all startup issues. The reddit user who could not start the game without error messages can now with the custom build https://www.reddit.com/r/StreetFighter/comments/4oqpap/dantarions_dinput_plugin_for_sfv_alpha_002_feat/d5o9pdl?context=3

michaelmarcuccio commented 8 years ago

oh no. Warning: this new version fixed my game starting problem, but after about 2 hours straight gametime, the controller all the sudden stops working and i have to restart the game. I just ragequit on a guy cause my controller was stuck, hehe. There might be an issue somewhere, let me know if I can help log the problem, but for now I am swapping back to x360ce.

Edit: this happened twice btw; started playing at 6:00, stopped working at 8:00 then again at 10:00

WydD commented 8 years ago

I'm very sorry to hear that. I'm opening a new ticket because this is not related to this bug. https://github.com/dantarion/SF5DInput/issues/8 Could you take a look and answer the question ?

HalfAWalrus commented 8 years ago

Working great for me so far! Only problem I have is that my qanba q4raf has really weird translations to the 360 controller for SFV. This issue is only in games with direct input, so I assume it's my pcb which I'm replacing anyways. Thank you so much for this fix.