FFB dev. thread

Official forum for open source FreePIE discussion and development.
MarijnS95
One Eyed Hopeful
Posts: 34
Joined: Tue Dec 22, 2015 12:52 pm

Re: FFB dev. thread

Post by MarijnS95 »

Hi,

I've been working on this project again (it's late and I'm tired, so I'll keep this post short). Mostly refactored the vJoy packethandling side of things, and squashed some bugs/cleaned up the DIDevice FFB part. Afterwards I added an actual async queue to handle the packets because AFAIK these can't be dealt with in the blocking vJoyFFBPacketCallback. That's still a part of which I'm not entirely happy with, since I use a 'map' that gives me a generic packet 'converter' based on PacketType; then it converts the packet-data to that generic type; which in turn needs to be added to this queue; and then once the item is dequeued, it needs to be used as parameter for that generic packet converter again, which keeps track of an action that is called on each device, and takes this generic packet-data type. (like I said it's late so I don't really want to go completely in-depth, link to the corresponding pieces of code and such. Might do that tomorrow though. If someone is interested, see the commits on my branch. Sorry in advance, they're way too bulky and not really descriptive)

Anyway, I hope someone is able to pull/build from my FFB branch, because I still don't have an FFB device :woot. No one has helped me out yet on the other forum I usually roam around (the place which started this all ;)).

That said, I know you're short on time Anders. Good luck with the game, looks like it's coming together nicely already 8-)
MarijnS95
One Eyed Hopeful
Posts: 34
Joined: Tue Dec 22, 2015 12:52 pm

Re: FFB dev. thread

Post by MarijnS95 »

I've done some more work on it and actually reworked the threads/asynchronous handling of packets. The FFB packet callback is already called on a different thread, so the packets are read out here, put onto a queue, and then processed in the main script thread. I haven't had any InvalidMemoryOperationExceptions since \0/ (which were thrown by SlimDX on certain operations when called from the FFB-packet-callback-thread instead of the script thread that created the DI Devices in the first place). I already expected SlimDX/DirectX to not be thread-safe here, so this should've been done way earlier. Hopefully this change resolves the the forwarding issues (or actually, lack thereof).

All that's left now is wait for confirmation that it really works (in the meantime I'm searching for a 2nd hand Fanatec wheel), before proceeding to the next step - implementing forwarding for all the remaining force types, envelopes and other control packets.
JJLKewL69
One Eyed Hopeful
Posts: 2
Joined: Wed Feb 01, 2017 7:06 pm

Re: FFB dev. thread

Post by JJLKewL69 »

Hi MarijnS95

I know you've been working on this project in the past and for a long time (i've read all you post about this subject on many forums)

I had an idea today

will it work if you simply pass the received data from vjoy to device.escape from slimdx library?

vjoy give size, cmd, data and escape take size, cmd and data as parameter. I don't know if its the same kind of parameters.

I'm not really a programmer but I understand many things.

I've never programmed in c++ or c#

Anyay just an idea!
MarijnS95
One Eyed Hopeful
Posts: 34
Joined: Tue Dec 22, 2015 12:52 pm

Re: FFB dev. thread

Post by MarijnS95 »

Hi JJLKewL69,

Well, according to the spec, that function is only used for hardware(/driver)-specific commands. A device manufacturer can specify extra functionality which a program can access this way. I'm sure DirectInput communicates with the driver in a similar fashion, but I doubt it happens through this "channel". Even if it does, I have no idea if the data formats match up, but as far as I know vJoy exposes the raw packets that were sent to it's virtual driver. Meaning it should be possible to pass those packets on to a similar (probably hidden) function.

Anyway, the idea is to (besides plainly forwarding data) expose this functionality to the script so it has full control and can be used for any purpose one can think of (capturing the data, generating FFB based on other factors, modifying the commands to ones liking, etc...).

I've still not bought the right wheel though, and no-one has chimed in to help testing so far.

Also, "many forums"? There's only one other forum where I really discussed this ;)

Marijn
JJLKewL69
One Eyed Hopeful
Posts: 2
Joined: Wed Feb 01, 2017 7:06 pm

Re: FFB dev. thread

Post by JJLKewL69 »

I've installed VS 2015 yesterday and I'll try your code tonight

I've never worked with VS and I'm new to Freepie (installed 3 days ago) so I don't know if I'll really help....

and this forum + spintire forum = many ;) (I didn't remember exacly where I did see your name)
CyberLuke
One Eyed Hopeful
Posts: 2
Joined: Sat Sep 17, 2022 12:04 pm

Re: FFB dev. thread

Post by CyberLuke »

If anyone still reading this, you can test FFB here: https://github.com/cyberluke/FreePIE/tree/Ffb

It is currently working on Windows 10, including Ramp effect.
Post Reply

Return to “FreePIE”