Xbox Controller plugin help request

Hello All.

I’ve been learning the ropes for a little while (btw, kudos on the great community you have here), and decided to try my hand at this plugin stuff when I found that the HID approach would not work very well for a xbox 360 controller (basically, for some reason the thumbstick clicks were not reporting, and the trigger information was imposible to use)

While I know a little bit of c#, I am by no means a expert programmer, so I took the cowards way out and decided to take velcrome’s space navigator plugin and implement on top of it a wrapper I found for slimDX.XInput, and start erasing all the space navigator code until I only got the xbox stuff. Not the most elegant way, true, but was fast and easy.

It compiled and is running in vvvv – it is by no means done; I still need to check the naming conventions and clean up the code, and to put input pins for the device selection (right now it only works on the controller 0) and for the vibration motors, but it does the job.

However, every time I delete the node on a vvvv patch, it makes vvvv crash, and same thing if I close the patch containing the node. I know just enough c# that to know that probably I am not disposing something right, but not enough to really understand what I need to do.

Can anyone check the code and give me a hint?

r.

edit: sorry, I uploaded the zip file with the compiled code and was a little big. fixed that

Xbox360Controller.zip (27.7 kB)

The problems is generated when I try to write the debug message when destructing:
{CODE(ln=>1)}FHost.Log(TLogType.Debug, “Xbox360Controller is being deleted”);^

I just commented the line and it is working, but I guess thst is not a good idea, right?

Below is the latest version of the code (it can vibrate the controller now!)

r.

Xbox360Controller (Code).rar (32.8 kB)

And below here is just the dll and the help file if anyone wants to try it out but doest’n want to compile.

r.

Xbox360Controller (DLL and Help patch).rar (6.9 kB)

hi r.arcaya :)
i’m not a programmer, but the controller work vvery well ;))) really cool plugin, hope it will be inserted in the next addons pack, thx ;)