FreePIE icon indicating copy to clipboard operation
FreePIE copied to clipboard

How i can get force feedback data

Open nosazik opened this issue 2 years ago • 18 comments

I want to take data to converting pwm arduino with freepie and vjoy

nosazik avatar Jan 29 '22 20:01 nosazik

We never got forcefeedbackdata working with vjoy sadly. If someone wants to have a go at fixing this i gladly pull the code

AndersMalmgren avatar Jan 30 '22 11:01 AndersMalmgren

We never got forcefeedbackdata working with vjoy sadly. If someone wants to have a go at fixing this i gladly pull the code

Did u try the new version of vjoy 2.2.1 njz3/vjoy or njz3/vJoyIOFeederWithFFB? I think they implement this Had to update Dll of new version of vjoy on freepie to get work

nosazik avatar Jan 30 '22 17:01 nosazik

No, i haven't been active in freepie for a while now

AndersMalmgren avatar Jan 30 '22 17:01 AndersMalmgren

No, i haven't been active in freepie for a while now

sad

nosazik avatar Jan 30 '22 18:01 nosazik

It's not very hard to setup freepie with visual studio if you want to have a go at it. Basicly just load it up and hit f5

AndersMalmgren avatar Jan 30 '22 19:01 AndersMalmgren

I worked on this terribly long ago, one of the FFB branches on my fork: https://github.com/MarijnS95/FreePIE/branches/yours

I didn't have FFB hardware back then so relied on others to try random builds which never worked out, but I'm pretty sure I managed to successfully test and get this working with minimal trivial changes when I eventually owned one. Probably never got to cleaning/pushing/PR'ing it.

I'll look around on my old harddisk and see what I can still find and push to that branch!

MarijnS95 avatar Jan 31 '22 09:01 MarijnS95

I worked on this terribly long ago, one of the FFB branches on my fork: https://github.com/MarijnS95/FreePIE/branches/yours

I didn't have FFB hardware back then so relied on others to try random builds which never worked out, but I'm pretty sure I managed to successfully test and get this working with minimal trivial changes when I eventually owned one. Probably never got to cleaning/pushing/PR'ing it.

I'll look around on my old harddisk and see what I can still find and push to that branch!

I think he wants to take the data and transform it out to his Arduino rather than a forcefeedback device if I'm not mistaken

AndersMalmgren avatar Jan 31 '22 09:01 AndersMalmgren

Being a bit more clear (now that I remember again...), this is perhaps mostly irrelevant for you since extracting data from vJoy is only part of the problem: that branch also passes the data back into an XInput device (it was used back then to have multiple input devices, among which an FFB-driven wheel, feed a single unified vJoy device for games that didn't support this).

However, that branch should also contain some code/fixes to expose vJoy FFB data to Python, if it wasn't already there.

Also noticed just now that https://github.com/AndersMalmgren/FreePIE/commits/Ffb contains many such changes too.

MarijnS95 avatar Jan 31 '22 09:01 MarijnS95

Hey guys, i merged ftb into a new branch with current master. Was a few conflcits. I tested with a joystick and it can still read values off the plugin. didnt try vjoy since I dont have vjoy driver installed etc. Be ny guest to take it from there :D

https://github.com/AndersMalmgren/FreePIE/tree/ftb_merge_master

AndersMalmgren avatar Jan 31 '22 15:01 AndersMalmgren

I tried above branch with this test software,.

https://www.fs-force.com/support.php#ForceTest

And that do triggers stuff in freepie

AndersMalmgren avatar Jan 31 '22 22:01 AndersMalmgren

image

Doesnt matter though what I send, FreePIE reads it all as DeviceGain.

AndersMalmgren avatar Jan 31 '22 22:01 AndersMalmgren

image

nosazik avatar Feb 01 '22 00:02 nosazik

I don't have a joystick that supports force feedback xD Can I get force feedback data without supported device?

nosazik avatar Feb 01 '22 00:02 nosazik

i saw a lot of DIY steering wheel, but depends on program like EMC utility lite or another pay program. I think with freepie can do better than

nosazik avatar Feb 01 '22 01:02 nosazik

I don't have a joystick that supports force feedback xD Can I get force feedback data without supported device?

You need to forward the callback to python and handle the incoming stream of data yourself. The code in that branch only exposes a method to forward ffb to a ffb device. I would try with a real game and see what data it catches

AndersMalmgren avatar Feb 01 '22 07:02 AndersMalmgren

You need to register to VJoyFfbWrap.OnFfbCallback to start getting ffb data. Its exposed today only through vJoy[0].registerFfbDevice which indeed requires a ffb device. But you can easy add yoru method to start getting all packets in the console.

        public void RegisterFfbCallback(Action callback)
        {
            if (!FfbEnabled) throw new NotSupportedException("This VJoy device does not have FFB enabled");
            VJoyFfbWrap.OnFfbCallback += (id, type, data) => callback();
        }
        public void registerFfbCallback(Action callback)
        {
            holder.RegisterFfbCallback(callback);
        }
if starting:
	vJoy[0].registerFfbCallback(lambda : diagnostics.debug("called"))

You should start seing data packets in the freepie console now.

AndersMalmgren avatar Feb 01 '22 07:02 AndersMalmgren

@nosazik I have some update:

  1. njz3/vJoyIOFeederWithFFB does not contain integration with DirectInput. It only forwards packets to PWM (Arduino / Teensy) providing support for Sega Model 3 and other arcade machines.

  2. njz3/vjoy is recommended and provides some FFB fixes, be sure to update VJoyInterface.dll and VJoyInterfaceWrap.dll in your FreePIE directory

I made some progress with FFB and also have working SlimDX (Direct Input) implementation: https://github.com/AndersMalmgren/FreePIE/issues/48

I have further forked njz3/vjoy and provided a refactored API that is faster for C# (because of nested pointers used in original vjoy, which even C++ guys do not like).

Now I'm on Win XP machine with VS2008 and fixing Ramp Effect in SlimDX FFB...will fork it as well. Hopefully they'll accept pull requests.

cyberluke avatar Aug 30 '22 20:08 cyberluke

You can use vJoyIOFeederWithFFB without FreePIE and send PWM to your Arduino.

That's what it is for.

If you want to use it inside FreePIE, you need to download source codes, Visual Studio (I'm using VS2015). Then write plugin interfacing vJoyIOFeederWithFFB. You can use just BackForceFeeder, which is console app: https://github.com/njz3/vJoyIOFeederWithFFB/tree/master/BackForceFeeder ...that should be simple to integrate. Or just use additional VJoy device and sent it to BackForceFeeder, which will send it to Arduino.

cyberluke avatar Aug 30 '22 21:08 cyberluke