Hi caiom,
I'm very interested in your project as I have been trying to do the same with a vive tracker. I tried to do it with Python code however I wasn't able to fully resolve the maths for orientation.
I ended up using someone elses project in the meantime, vive_mouse by Olli Moisio. There are several versions hosted here
http://olli.wtf/vive/ but no source code. It may give you some ideas though or a way of testing.
I've found that it uses USER32.DLL to do the controlling of the mouse pointer. This won't work with some programs that need DirectX mouse control or for other reasons.
You may find some other information on the project here -
https://github.com/agardony/vive_mouseI've tried it with two games, Virtual Cop and Time Crisis and I believe time crisis is running on MAME but I'm using a frontend package to launch it.
I can't see the windows cursor when playing them however but they seem to line up with the gun well.
I believe Gun4IR uses an arduino board in the gun and connects via USB and I think this emulates a USB HID device and acts like a mouse to the OS. Sinden may be doing something like that too.
In some of my other lightgun testing I've used a Leonardo Arduino USB to do the same thing. It can be plugged in via the one USB cable and can receive COM Port communication and then send back mouse commands.
Ideally though a OS level driver would be installed to do the mouse emulation, ideally again would be a signed driver but an unsigned driver can be installed with a little mucking about.
If you would like someone to help test your program I would be glad to help.
Cheers,
greymatr