XInput and userlib problem...

Blitz3D Forums/Blitz3D Userlibs/XInput and userlib problem...

SLotman(Posted 2008) [#1]
I just got XInput working with B3D... but now I have an awfull problem: If the user dont have XInput installed, the program just crashes with "userlib not found".

Is there anyway I can check to see if a userlib is installed, or even trap this error on my b3d program?

Another way could be someway to check if there is a X360 joy installed, without using XInput.dll?

I'm completly lost here, any help appreciated!


SLotman(Posted 2008) [#2]
I just tried this but it doesnt return anything... at all. If at least it could read the MID and PID values from the joystick, it would work...

Seeing that this goes trought a VXD from joy game port (and not USB) probably it wont work at all - scratch that, I just tried the same program, this time written in VB and it works and detect the x360 controler PID/MID, so there's some problem with that code archive entry :(

Still, if anyone has any idea on how to overcome the "userlib not found" problem (anyway to detect dx version installed?) - I'll be happy to hear :)


VIP3R(Posted 2008) [#3]

Is there anyway I can check to see if a userlib is installed, or even trap this error on my b3d program?


No and no unfortunately, Blitz checks for the existence of the userlib DLL before the first line of your code is executed.

You could check it's installed from a separate program, then launch your main program if successful.


SLotman(Posted 2008) [#4]

No and no unfortunately, Blitz checks for the existence of the userlib DLL before the first line of your code is executed.


Actually, thatīs not true... I just tested, and it only gives userlib not found when I actually call one of the userlibīs function.

And I just found a solution... I read the dx version from the registry, and if itīs not dx 9.0c or higher, I just return an error from the initialization routine.

Iīll post on another thread a test program to people try out, and see if it works for multiple controllers, if correct detect dx versions and so on :)


VIP3R(Posted 2008) [#5]

Actually, thatīs not true... I just tested, and it only gives userlib not found when I actually call one of the userlibīs function.


Well, yes and no :)

If you call the userlib functions anywhere in your code unconditionally, Blitz will check for the existence of the DLL before your code is executed making it impossible to check it yourself and trap the error.

It will only work in your case if you make every single userlib call conditional, which I thought would be highly unlikely. It certainly wouldn't be a viable solution with JV-ODE for example.

Your solution sounds good if you're only using a few DLL calls though ;)