ikt Posted February 26, 2016 Share Posted February 26, 2016 (edited) Hello there, I've got a super specific crash but it's annoying as hell. Normal users won't ever come into contact with it, I think, but I'd rather be sure anyway. I've put Xinput support into my mod to stop relying on the game's control readouts, which works awesome. However, the game just crashes if I reload it with the ScriptHookV.dev CTRL+R reload method. It's the game that crashes, not my .asi. If the game is stopped normally, it won't crash. It will neither crash if there's no Xbox controller plugged in. If it's re-plugged though, it will crash. I've tried this on a 617 build. Strangely, it won't crash on a 350 build with the same method. It will also not crash if I don't use any methods from the XboxController class even if there's a XboxController object. I've tried a clean install, with just ScriptHookV, but it just crashes. My script and the ScriptHookV log both confirm that my mod exited succesfully. I've narrowed it down to xinput1_4.dll crashing from the Windows Event Log. The up-to-date source code is here and the class that matters is this one: XboxController.hpp XboxController.cpp The script.cpp might be a bit long, but just this should be equivalent for this purpose. It crashes with just this, regarding the XboxController thing. #include "script.h"#include "XboxController.hpp" XboxController controller(1); void update() { if (controller.IsConnected()) { //bla }}//bla I thought it could've been a memory leak or something, but I wasn't using any dynamic objects anyway. If it was leaking memory, it would crash upon exit too, or at unplugging and reloading, right? I'm completely lost here. Also, a crash report: Faulting application name: GTA5.exe, version: 1.0.617.1, time stamp: 0x56a0f7f2Faulting module name: XINPUT1_4.dll_unloaded, version: 10.0.10586.0, time stamp: 0x5632d83fException code: 0xc0000005Fault offset: 0x0000000000001557Faulting process id: 0x8f4Faulting application start time: 0x01d170dccbbb6543Faulting application path: D:\Games\Steam\steamapps\common\Grand Theft Auto V\GTA5.exeFaulting module path: XINPUT1_4.dllReport Id: f0642610-32f0-4dfd-8c33-9aa565c1f4ccFaulting package full name:Faulting package-relative application ID: I'm on Windows 10 (and I don't have machines running other versions) to check against. Edited February 26, 2016 by ikt Link to comment Share on other sites More sharing options...
Silent Posted February 26, 2016 Share Posted February 26, 2016 From what I know, the game relies on xinput1_3.dll - so maybe the DLLs somehow conflict? Link to comment Share on other sites More sharing options...
ikt Posted February 26, 2016 Author Share Posted February 26, 2016 (edited) From what I know, the game relies on xinput1_3.dll - so maybe the DLLs somehow conflict? Hmm, I tried putting an xinput1_3.dll in the game folder but the game still uses the xinput1_4.dll from Windows? I built my asi by just adding XInput.lib to the linker additional options. Shouldn't it crash on load if it conflicted? Edit - Also tried to link against Xinput_9_1_0.lib but it didn't change anything. Curiously, application still crashes with XInput 1.4 being the culprit: Faulting application name: GTA5.exe, version: 1.0.617.1, time stamp: 0x56a0f7f2Faulting module name: XInput1_4.dll_unloaded, version: 10.0.10586.0, time stamp: 0x5632d83fException code: 0xc0000005Fault offset: 0x0000000000001557Faulting process id: 0x1370Faulting application start time: 0x01d170eb44c64bf2Faulting application path: D:\Games\Steam\steamapps\common\Grand Theft Auto V\GTA5.exeFaulting module path: XInput1_4.dllReport Id: e287b702-e8e9-4c4f-a988-492ca87d4955Faulting package full name:Faulting package-relative application ID: So I think it's definitely the game crashing, but now how do I get rid of this conflict? Edited February 26, 2016 by ikt Link to comment Share on other sites More sharing options...
Silent Posted February 26, 2016 Share Posted February 26, 2016 You probably should link against DirectX SDK. ikt 1 Link to comment Share on other sites More sharing options...
ikt Posted February 26, 2016 Author Share Posted February 26, 2016 (edited) Okay, I'll try that. Thanks! In any case, the Xinput.h I was using was from Windows and used xinput1_4.dll Edit - Linking it against the XInput.lib from DirectX SDK (2010) didn't work as it didn't have XInputGetState . Linking it against XInput9_1_0.lib make the game not even load. Apparently the Windows SDK is the one people should work with now? Trying Windows 10 SDK now. Edit - Same sh*t happens. Edited February 27, 2016 by ikt Link to comment Share on other sites More sharing options...
alex8b Posted February 27, 2016 Share Posted February 27, 2016 For .NET mods you can use SharpDx.XInput and everything will work fine. Link to comment Share on other sites More sharing options...
ikt Posted February 27, 2016 Author Share Posted February 27, 2016 (edited) For .NET mods you can use SharpDx.XInput and everything will work fine. Sadly, this is an .ASI mod and I don't feel like rewriting it for DotNet Also, the DirectX SDK did compile with linking against XInput1.3, but it still crashes in the same way. The event viewer still puts XInput 1.4 as the crashing module though? I'm pretty sure I'm linking the 1.3 one - got the DirectX SDK as highest priority include/library folders and VS opens the DirectX SDK headers. Edited February 27, 2016 by ikt Link to comment Share on other sites More sharing options...
Silent Posted February 27, 2016 Share Posted February 27, 2016 What really matters is the lib you're linking - you might have to include it as $(DXSDK_DIR)\lib\xinput.lib or so (not sure of the exact path). ikt 1 Link to comment Share on other sites More sharing options...
ikt Posted February 27, 2016 Author Share Posted February 27, 2016 That fixed it, thank you! Apparently I don't really understand the order Visual Studio grabs these libraries. Silent 1 Link to comment Share on other sites More sharing options...
thedeuceII Posted February 28, 2016 Share Posted February 28, 2016 Op -- I am running into this same issue trying to compile my code against ScriptHookV. What did you do to differently to utilize the DirectX XInput vs Win10 XInput? Did you need to install the DirectX SDK and manually modify the pointer to use it, or are you doing something different, entirely? Thanks for any insight -- reloading the whole game to validate compiled ASI is killing productivity :-/. Link to comment Share on other sites More sharing options...
ikt Posted February 28, 2016 Author Share Posted February 28, 2016 Op -- I am running into this same issue trying to compile my code against ScriptHookV. What did you do to differently to utilize the DirectX XInput vs Win10 XInput? Did you need to install the DirectX SDK and manually modify the pointer to use it, or are you doing something different, entirely? Thanks for any insight -- reloading the whole game to validate compiled ASI is killing productivity :-/. You'll need to install it: DirectX SDK (June 2010). Then, in your Project Properties, go to Linker -> Input. In the Additional Dependencies page, just add this specific library: "$(DXSDK_DIR)\Lib\x64\XInput.lib" You'll need the quotes since VS doesn't like spaces in path names. Link to comment Share on other sites More sharing options...
thedeuceII Posted February 28, 2016 Share Posted February 28, 2016 (edited) You're a rockstar, ikt! Thanks! - Edit: that 100% solved my problem. If there were kudos on GTAF, I'd give you and Silent all of them. Thanks again! Edited February 28, 2016 by thedeuceII ikt 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now