FFB dev. thread

Official forum for open source FreePIE discussion and development.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

FFB dev. thread

Post by CyberVillain »

Lets continue our discussion about implementing routing of FFB data from vjoy to SlimDX joystick devices
https://github.com/AndersMalmgren/FreePIE/issues/48

The script global(s) must be able to

Forward data from vjoy to slimdx
Intercept data from vjoy (event driven?) and repurpose it and send to slimdx
Send data directly to a slimdx device from script
MarijnS95
One Eyed Hopeful
Posts: 34
Joined: Tue Dec 22, 2015 12:52 pm

Re: FFB dev. thread

Post by MarijnS95 »

Hi,

Let me first do a quick little introduction of myself on this forum: I'm Marijn, 20 years old, Game Technology student in Utrecht. I've written a tutorial on how to use FreePIE to combine their expensive, multipart simracing setups for a game that supports only one controller. Many people wanted their FFB support as well, that's why I'm working on it now, even though I don't even own an FFB device (testing is really hard :P).

I was thinking about the exact same implementations: one to directly forward FFB data from vJoy to a SlimDX device (usecase when controllers are simply combined and the user doesn't need to worry about FFB data), and the other to separately read-out/receive FFB data in FreePIE, do something with it and send FFB commands to a SlimDX device (this can also be used entirely separated).

I'll start off with the SlimDX part, my next post will contain the vJoy section.

Effect
So, the SlimDX implementation is fairly simple. There's an Effect object that combines a SlimDX device, GUID of the effect and it's EffectParameters, and exposes methods to control it (start, stop, loop etc). Calling the constructor will automatically tell the device to create a new effect, and eventually send the EffectParameters (these can be passed in later on).

Global Gain
This is a simple multiplier to control the overal strength of every effect on the device, whereas 10.000 is the maximum and actually means no scaling (iow: multiplying the force from an effect by 1)

EffectParameters
These are global settings for an effect. They contain the following basic parameters:

Code: Select all

EffectParams[blockIndex] = new EffectParameters()
{
	Duration = -1, //-1 is infinite, I haven't yet found on which scale this is (in C++ examples it's multiplied by DI_SECONDS)
	Flags = EffectFlags.Cartesian | EffectFlags.ObjectIds, //Contains info about the effect: whether the direction is given in Polar, Cartesian or Spherical coordinates. ObjectIds is to tell what type will be used to determine the axis when 
	Gain = 10000, //multiplier over this single effect. Works the same as Gain explained above
	SamplePeriod = 0, //default sample period
	StartDelay = 0, //self explanatory
	TriggerButton = -1, //a button can be specified to trigger an effect
	TriggerRepeatInterval = 0, //probably how many times you can press the button to trigger the effect?
	Envelope = null //to apply a Gain based on time (can use this to a ramping up or down force with a single effect). I can explain more on this if you wish
};
Axes
Obviously you have to define in what direction the force is. This has to be done by specifying the direction the effect comes from. So if I specify a cartesian vector [1,0], which is a vector pointing to the right, the effect will come from the right side and push the stick/wheel to the left (in case of a wheel, going left on the X axis means turning counterclockwise).

The Polar variant is a little confusing as well. A Polar system is defined as a vector pointing to the right and rotating it counterclockwise (example: 90 degrees means that the vector pointing to the right will be rotated 90 degrees counterclockwise). However, for some weird reason Polar coordinates in FFB start with a vector pointing to the top which is rotated clockwise. So, an FFB effect of 90 degrees Polar means a source vector pointing to the right, thus again an effect that'll turn your wheel counterclockwise or move your stick to the left. The polar angle should be specified in the first element of the dirs array

DX wants to know the actuators that you are using for this effect, so we first have to get that data. In the above piece of code I specified DX will receive ObjectIds, so let's get these:

Code: Select all

List<int> ax = new List<int>();
foreach (DeviceObjectInstance deviceObject in joystick.GetObjects())
{
	if ((deviceObject.ObjectType & ObjectDeviceType.ForceFeedbackActuator) != 0)
	{
		ax.Add((int)deviceObject.ObjectType); //change this to .Offset in case you've specified EffectFlags.Offsets instead
	}
}
Axes = ax.ToArray();
(this should be executed when the device is initialized, values won't change over time)

Now, we can simply set the axes on our efffect:

Code: Select all

EffectParams[blockIndex].SetAxes(Axes, dirs); //dirs in this case either is the cartesian vector, or it contains the Polar angle in the first element (lengths of Axes and dirs should be the same)
TypeSpecificParameters
Parameters specific to a certain effect. Each effect has it's own type. For now, we'll only discuss the easiest one: ConstantForce.
Because we want to modify this effect on the fly is actually the only reason we cache EffectParams in an array. In the past I haven't been able to get the following piece of code to work, but I might need to revisit it and retry:

Code: Select all

EffectParameters ep = Effects[blockIndex].GetParameters(EffectParameterFlags.TypeSpecificParameters);
(I'll explain EffectParameterFlags in a minute)

Anyway, TypeSpecificParameters are 'stored' in the Parameter property from an EffectParameter, so in case we want to use a constant force, we simply do the following:

Code: Select all

EffectParams[blockIndex].Parameters = new ConstantForce();
Now, if we want to modify the Magnitude (which is actually the only parameter of a constant force), we can use the built-in casting methods (it's obviously also possible to do the cast yourself):

Code: Select all

EffectParams[blockIndex].Parameters.AsConstantForce().Magnitude = magnitude;
The only thing that's left is telling our Effect (remember, the object that links a joystick with EffectParameters?) that something has changed in the EffectParameters. This is done by passing our EffectParameters object to the SetParameters method, as well as EffectParameterFlags - which is used to define something so that only that specific piece of data needs to be re-uploaded to the device. In this case, we only modified the TypeSpecificParameters, so:

Code: Select all

Effects[blockIndex].SetParameters(EffectParams[blockIndex], EffectParameterFlags.TypeSpecificParameters);
(EffectParameterFlags are also used in GetParameters to only download a specific part of the EffectParameters. I'm pretty sure, though not a 100% because there's no documentation this, it's also possible to just create new EffectParameters, only modify the TypeSpecificParameters and upload it with EffectParameterFlags.TypeSpecificParameters, which shouldn't affect anything else)

Sidenote on BlockIndex
BlockIndex is simply used to tell the FFB device which effect the current packet is about (because an FFB device can keep track of (and probably play) multiple effects simultaneously). We don't need it in DX (since that's all managed for us in the background), however it's important when working with vJoy (because you actually only receive bare packets with it)

Disposing effects and the device
This is something that I'm still discovering in. There's some really weird behaviour when used in combination with vJoy. Sadly because I don't own an FFB device I can hardly test it.

Well that's it actually. It isn't hard to modify this data from FreePIE either, as you can see I already exposed the required methods to Python, however it's probably better to return an object instead of using a blockIndex alike mechanism.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

Hi and welcome Marijn.
I will try to look at the code during the course of this week and correct potential stuff I find that is not very FreePIE'ish in the code.
MarijnS95
One Eyed Hopeful
Posts: 34
Joined: Tue Dec 22, 2015 12:52 pm

Re: FFB dev. thread

Post by MarijnS95 »

Thanks.

I've fixed the indentation and squashed all the commits to remove superfluous changes to files. Looks good now.

I'll write the vJoy part soon, which is a little more complicated, especially the integration with FreePIE (due to all the different packets).

I've read an article (even though from 2008) about the speed with Marshal and IntPtr vs going unsafe and using C++ alike dereferencers: http://www.codeproject.com/Articles/258 ... Structures
What do you think? Should we use an unsafe context with our own (properly named) structs, which is the fastest (I see it's used in trackIR so we're compiling with /unsafe anyway), use the C++ calls from vJoy (which actually doesn't dereference the pointer but creates an entirely new struct, fills it with data and returns it), or keep using (slow) Marshal?

As you might've seen the only method the vJoy FFB code is using is the one to register a packet callback method (not even from the wrapper but a direct P/Invoke). It returns a pointer and I'm manually reading the data 'at' that pointer. Why do things in C++ when they can be done from C# as well? Besides, this'll mean that I either have to use the wrapper or define structs myself (all the methods, structs and enums related to FFB have C++-ish names which definitely don't suit FreePIE, and the Python available enums obviously need the correct Attribute). That said, I'm planning on contributing a completely new C# wrapper to the vJoy github, adhering more to naming how I usually see it in C#, and probably including an object per vJoy device, which internally calls to the interface DLL with correct device ID.

I'll soon push to a new branch with an example of using unsafe...
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

Ouch, I just started to try a merge. Maybe its better i merge, take what I want and we work from there. There are alot of code thats strange, for example

Code: Select all

                //prevent a new device from being created (by the second indexer)
                var device = devices.SingleOrDefault(dev => dev.InstanceGuid == d.InstanceGuid);
                if (device != null)
                    return device.global;
SingleOrDefault will never return anything because right before this code you do

Code: Select all

devices = new List<Device>();
Can you give me a few days to make it more in a standard I like then we can start looking at getting it to actually work for people with FFB devices :D
MarijnS95
One Eyed Hopeful
Posts: 34
Joined: Tue Dec 22, 2015 12:52 pm

Re: FFB dev. thread

Post by MarijnS95 »

CyberVillain wrote:SingleOrDefault will never return anything because right before this code you do
You know that that line is inside the Func right?? ;)

The only thing it does is preventing the device and global from being created twice if both indexers (int and string) are used. But it's true that you should actually find a way to implement that inside the GlobalIndexer.

And sorry for the mess, I just wish I had an FFB wheel so I could write some proper, working code before uploading it to git...
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

Ah sorry, it was the change to static that made me confused. There is no need for it to be static though
MarijnS95
One Eyed Hopeful
Posts: 34
Joined: Tue Dec 22, 2015 12:52 pm

Re: FFB dev. thread

Post by MarijnS95 »

CyberVillain wrote:Ah sorry, it was the change to static that made me confused. There is no need for it to be static though
Yep, I wondered why I did that, removed it in the unsafe experimental branch already.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

Another problem

Code: Select all

public void CreateEffect(int blockIndex, EffectType effectType, int duration, IronPython.Runtime.List dirs)
The plugin assembly cant know about the script runtime. Too tight coupling. Cant we use standard arrays?
MarijnS95
One Eyed Hopeful
Posts: 34
Joined: Tue Dec 22, 2015 12:52 pm

Re: FFB dev. thread

Post by MarijnS95 »

CyberVillain wrote:Another problem

Code: Select all

public void CreateEffect(int blockIndex, EffectType effectType, int duration, IronPython.Runtime.List dirs)
The plugin assembly cant know about the script runtime. Too tight coupling. Cant we use standard arrays?
Not sure how you'd use standard arrays in Python. I just only checked what Python would pass on if I specify a [1,0] and apparently it's such a list. If in the end it'll be an int[] everything is fine. Otherwise we could even force users to work with the 'polar' coordinates? Or pass in all the array elements as parameters? (dunno if params int[] would work nicely with IronPython). But I'm pretty sure you can come up with something to make it do the conversion in the Core assembly :)
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

More strange stuff :D

if (lastTask == null)
lastTask = Task.Factory.StartNew(() => WrappedCallback(ffbDataPtr));
lastTask = lastTask.ContinueWith((tas) => WrappedCallback(ffbDataPtr));

That will spawn alot of overhead like threads and stuff... Will keep as is for now
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

Ok did a push to a new branch called Ffb
MarijnS95
One Eyed Hopeful
Posts: 34
Joined: Tue Dec 22, 2015 12:52 pm

Re: FFB dev. thread

Post by MarijnS95 »

CyberVillain wrote:More strange stuff :D

if (lastTask == null)
lastTask = Task.Factory.StartNew(() => WrappedCallback(ffbDataPtr));
lastTask = lastTask.ContinueWith((tas) => WrappedCallback(ffbDataPtr));

That will spawn alot of overhead like threads and stuff... Will keep as is for now
There is a comment directly above, explaining why, and that I still haven't figured how to easily start one thread and give it some work each time the FFB callback is triggered.

Basically the FFB callback is blocking, and that causes strange stuff when I'm testing it, but that might be due to forwarding from one vJoy device to oneother.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

Maybe ThreadPool.QueueWork is better, then it will atleast reuse thread if it can. Or have one thread that looks against a queue
MarijnS95
One Eyed Hopeful
Posts: 34
Joined: Tue Dec 22, 2015 12:52 pm

Re: FFB dev. thread

Post by MarijnS95 »

CyberVillain wrote:Maybe ThreadPool.QueueWork is better, then it will atleast reuse thread if it can. Or have one thread that looks against a queue
Hmm looks like I removed some stuff from my post, since that's exactly what I wanted to do: use a queue, since it still needs to run in the correct order. Or I just have to fix the freezing issue. (which is a bit hard to know if it actually exists or is just because of my setup that's not even supposed to be used like that).

Btw with the cahnge to int[] now, the following doesn't work anymore:

Code: Select all

joystick[jID].createEffect(1, EffectType.ConstantForce, -1, [1, 0])
Exception shown in FreePIE console is: expected Array[int], got list. So we still need to look at that.

I see yu 'removed' Count as well from GlobalIndexer, which I used for this:

Code: Select all

def listDevices():
	diagnostics.debug("You have {0} devices connected:", joystick.Count)
	for i in range(joystick.Count):
		diagnostics.debug("Device {0}: {1}", i, joystick[i].Name)
(actually it's superfluous now that we can index devices by name, but it was quite useful back when we had to get the indexes)
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

Yeah, i noticed that, will have to research arrays and IronPython somewhat. I really do not want IronPython types in the plugin project.
Yeah, the indexer is used from plugins that do not know about Count or Length so adding it to all Globals that uses that INdexer class is wrong. And yeah, its now built into FreePIE anyway.

Is it correct behaviour that it calls the Callback twice first time around?

Code: Select all

if (lastTask == null)
   lastTask = Task.Factory.StartNew(() => WrappedCallback(ffbDataPtr));
lastTask = lastTask.ContinueWith((tas) => WrappedCallback(ffbDataPtr));
MarijnS95
One Eyed Hopeful
Posts: 34
Joined: Tue Dec 22, 2015 12:52 pm

Re: FFB dev. thread

Post by MarijnS95 »

I'll see if I can find something useful in IronPython as well.

There should be an else in there, forgot it accidentally (luckily it doesn't matter that much for now).
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

This works

Code: Select all

public void createEffect(int blockIndex, EffectType effectType, int duration, params int[] dirs)
Wich means you pass array like

Code: Select all

joystick[0].createEffect(...., 1,0);
Or

Code: Select all

public void createEffect(int blockIndex, EffectType effectType, int duration, IList dirs)
which translate to

Code: Select all

joystick[0].createEffect(...., [1,0]);
The first is type safe in C# the second is not.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

I changerd to IList for now, you can pull latest from origin

btw: I have a Logitech Rumblepad 2 which has Ffb in the form of vibration, didnt get it to vibrate though
edit: Tried constant force with a program called ForceTest.exe it makes the control vibrate

edit. No worries, got it to work :D Will now try to forward force

edit: Forwading does not work

this script

Code: Select all

if starting:
	vJoy[0].RegisterFFBDevice(joystick[1])
gives error in ForceTest.exe
Creating effects for vJoy Device
Error creating Spring Effect. Your joystick may not support this effect. :
REGDB_E_CLASSNOTREG :
Class not registered
And nothing happens when I try constant foce from within ForceTest.exe (works if i use actual gamepad directly)
MarijnS95
One Eyed Hopeful
Posts: 34
Joined: Tue Dec 22, 2015 12:52 pm

Re: FFB dev. thread

Post by MarijnS95 »

Yay, didn't expect params to work out of the box with IronPython :)

Seems like you're doing a lot of good stuff to the structure already (which I didn't even take the time to do, and my Resharper trial voided so I should look for a student license). I hope to have the extensive vJoy post ready tomorrow so we can start thinking about a possible implementation (because it's quite a hassle with all the different packets, effect types and parameters).

Anyway, I recommend you to first check if the direct effect generation works, and thereafter forwarding. Perhaps step through and make sure all the necessary steps are executed (creating an effect with correct EffectParams and TypeSpecificParams and starting it).

The reason your current example doesn't work is because only ConstantForce is forwarded, not SpringForce. However, it shouldn't throw that exception if your device supports it, so there might be an issue in the EffectTypeGuidMap method (which I'd hardly believe since it simply is a switch block returning the GUID from a SlimDX object).
From the top of my head I'm thinking the following to check if the device actually supports the current effect:

Code: Select all

Guid effectGuid = EffectTypeGuidMap(et); //get the GUID for the current effect
joystick.GetEffects().Single(effectInfo => effectInfo.Guid == effectGuid); //should throw an exception when the item doesn't exist, but I think there's a better way of doing this.
return effectGuid;
(the SlimDX EffectType enum (which could be passed to GetEffects) and the vJoy one are completely different from eachother).

Perhaps this code could be rewritten to get the GUID from that list instead of the static EffectGuid object. However, it'll not be that easy to match a vJoy EffectType to "whatever EffectInfo uses".

Regarding Constant Force, I still expect there's some acquire/dispose issues. Aubade found a way around it (for the time being), he posted it in the issue tracker.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

Just to be clear, I can write data to the gamepad using your script

Code: Select all

if starting:
    jID = 1;#ID of your FFB device
    joystick[jID].CreateEffect(1, EffectType.ConstantForce, -1, [1, 0])
    joystick[jID].OperateEffect(1, EffectOperation.Start, 0)
    force = 0

diagnostics.watch(force)
if(force < 10000):
    force += 1
if(force % 100 == 0):
    joystick[jID].SetConstantForce(1, force)
This will make the gamepad vibrate. Forwarding from vjoy does not. Oh well, off to bed :D
MarijnS95
One Eyed Hopeful
Posts: 34
Joined: Tue Dec 22, 2015 12:52 pm

Re: FFB dev. thread

Post by MarijnS95 »

CyberVillain wrote: This will make the gamepad vibrate. Forwarding from vjoy does not. Oh well, off to bed :D
I'll see if I can look at it tomorrow (might need to look at the log it generates, check if at least all the correct methods are called with correct data). But for now, off to bed as well. Alarm clock set for over 6 hours, at 6AM Tom Clancys The Division is released :D
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

Cool, just make sure to pull frequently since we are working in the same branch
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

Nothin new to report when it comes to the code itself, but I wrote a test so that we can easy can run a test against teh forward code, FfbTests.cs

It requires a joystick to be connected, it then uses the joystickplugin to send ffb data to the vjoy virtual stick and then it should forward to teh real joystick but it does not.

strange thing is, I get different output from in console depeding on if i run in debug or not.

Debug:

Code: Select all

----------------------
DataSize: 26, CMD: 0x000B000F
110101FFFF00000000FFFF043F00000000000000000000000000
Device ID: 1
Packet type: Effect
BlockIndex: 1
	BlockIndex: 1
	EffectType: ConstantForce
	Duration: -256
	TriggerRepeatInterval: 0
	SamplePeriod: 0
	Gain: 255
	TriggerBtn (?): 255
	Polar: True
	Angle: 88

----------------------
DataSize: 12, CMD: 0x000B000F
1A0101000000000000000000
Device ID: 1
Packet type: EffectOperation
BlockIndex: 1
EffectOperation: Start
----------------------
DataSize: 12, CMD: 0x000B000F
1A0101000000000000000000
Device ID: 1
Packet type: EffectOperation
BlockIndex: 1
EffectOperation: Start
----------------------
DataSize: 12, CMD: 0x000B000F
1A0101000000000000000000
Device ID: 1
Packet type: EffectOperation
BlockIndex: 1
EffectOperation: Start
----------------------
DataSize: 12, CMD: 0x000B000F
1A0101000000000000000000
Device ID: 1
Packet type: EffectOperation
BlockIndex: 1
EffectOperation: Start
----------------------
DataSize: 12, CMD: 0x000B000F
1A0101000000000000000000
Device ID: 1
Packet type: EffectOperation
BlockIndex: 1
EffectOperation: Start
----------------------
DataSize: 12, CMD: 0x000B000F
1A0103000000000000000000
Device ID: 1
Packet type: EffectOperation
BlockIndex: 1
EffectOperation: Stop
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
Joystick vJoy Device has 1 active effects. Disposing...
----------------------
DataSize: 10, CMD: 0x000B000F
1C040000000000000000
Device ID: 1
Packet type: PidDeviceControl
BlockIndex: 4
PIDDeviceControl: DeviceReset
Joystick Logitech RumblePad 2 USB has 1 active effects. Disposing...

None debug

Code: Select all

----------------------
DataSize: 26, CMD: 0x000B000F
15018813FF00000000FFFF043F00000000000000000000000000
Device ID: 1
Packet type: ConstantForce
BlockIndex: 1
Magnitude: 1
----------------------
DataSize: 12, CMD: 0x000B000F
1A0101000000000000000000
Device ID: 1
Packet type: EffectOperation
BlockIndex: 1
EffectOperation: Start
----------------------
DataSize: 12, CMD: 0x000B000F
1A0101000000000000000000
Device ID: 1
Packet type: EffectOperation
BlockIndex: 1
EffectOperation: Start
----------------------
DataSize: 12, CMD: 0x000B000F
1A0101000000000000000000
Device ID: 1
Packet type: EffectOperation
BlockIndex: 1
EffectOperation: Start
----------------------
DataSize: 12, CMD: 0x000B000F
1A0101000000000000000000
Device ID: 1
Packet type: EffectOperation
BlockIndex: 1
EffectOperation: Start
----------------------
DataSize: 12, CMD: 0x000B000F
1A0101000000000000000000
Device ID: 1
Packet type: EffectOperation
BlockIndex: 1
EffectOperation: Start
----------------------
DataSize: 12, CMD: 0x000B000F
1A0103000000000000000000
Device ID: 1
Packet type: EffectOperation
BlockIndex: 1
EffectOperation: Stop
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
Joystick vJoy Device has 1 active effects. Disposing...
----------------------
DataSize: 10, CMD: 0x000B000F
1C040000000000000000
Device ID: 1
Packet type: PidDeviceControl
BlockIndex: 4
PIDDeviceControl: DeviceReset
Joystick Logitech RumblePad 2 USB has 0 active effects. Disposing...

CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

USing ForceTest.exe - Create constant force

Code: Select all

----------------------
DataSize: 12, CMD: 0x000B0191
110100000000000000000000
Device ID: 1
Packet type: CreateNewEffect
BlockIndex: 1
WARNING!!!!!! PACKET NOT HANDLED: CreateNewEffect
----------------------
DataSize: 12, CMD: 0x000B000F
150110270000000000000000
Device ID: 1
Packet type: ConstantForce
BlockIndex: 1
Magnitude: -255
----------------------
DataSize: 26, CMD: 0x000B000F
110101FFFF00000100FFFF043F00000000000000000000000000
Device ID: 1
Packet type: Effect
BlockIndex: 1
	BlockIndex: 1
	EffectType: ConstantForce
	Duration: -1
	TriggerRepeatInterval: 0
	SamplePeriod: 1
	Gain: 255
	TriggerBtn (?): 255
	Polar: True
	Angle: 88

----------------------
DataSize: 12, CMD: 0x000B000F
1A0101FF0000000000000000
Device ID: 1
Packet type: EffectOperation
BlockIndex: 1
EffectOperation: Start
----------------------
DataSize: 26, CMD: 0x000B000F
110101FFFF00000100FFFF043F00000000000000000000000000
Device ID: 1
Packet type: Effect
BlockIndex: 1
	BlockIndex: 1
	EffectType: ConstantForce
	Duration: -1
	TriggerRepeatInterval: 0
	SamplePeriod: 1
	Gain: 255
	TriggerBtn (?): 255
	Polar: True
	Angle: 88

----------------------
DataSize: 12, CMD: 0x000B000F
1A0103000000000000000000
Device ID: 1
Packet type: EffectOperation
BlockIndex: 1
EffectOperation: Stop
----------------------
DataSize: 12, CMD: 0x000B000F
1A0103000000000000000000
Device ID: 1
Packet type: EffectOperation
BlockIndex: 1
EffectOperation: Stop
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
MarijnS95
One Eyed Hopeful
Posts: 34
Joined: Tue Dec 22, 2015 12:52 pm

Re: FFB dev. thread

Post by MarijnS95 »

In debug mode I see the first time no actual constant force is set (even tho it should), and in no-debug not even an effect is created.... (you can see that both packets are sent from the ForceTest application. Creation is done at PacketType.Effect, and setting it is done at PacketType.ConstantForce.

Perhaps reboot your PC, until I figure out how disposing works as that's probably causing problems as well.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

This is after restart running FreePIE as normal with script

Code: Select all

if starting:	
	vJoy[0].registerFfbDevice(joystick[0])

And then forcetest

Code: Select all

----------------------
DataSize: 10, CMD: 0x000B000F
1DFF0000000000000000
Device ID: 1
Packet type: DeviceGain
BlockIndex: 255
WARNING!!!!!! PACKET NOT HANDLED: DeviceGain
----------------------
DataSize: 10, CMD: 0x000B000F
1DFF0000000000000000
Device ID: 1
Packet type: DeviceGain
BlockIndex: 255
WARNING!!!!!! PACKET NOT HANDLED: DeviceGain
----------------------
DataSize: 10, CMD: 0x000B000F
1DFF0000000000000000
Device ID: 1
Packet type: DeviceGain
BlockIndex: 255
WARNING!!!!!! PACKET NOT HANDLED: DeviceGain
----------------------
DataSize: 10, CMD: 0x000B000F
1DFF0000000000000000
Device ID: 1
Packet type: DeviceGain
BlockIndex: 255
WARNING!!!!!! PACKET NOT HANDLED: DeviceGain
----------------------
DataSize: 12, CMD: 0x000B0191
110B00000000000000000000
Device ID: 1
Packet type: CreateNewEffect
BlockIndex: 1
WARNING!!!!!! PACKET NOT HANDLED: CreateNewEffect
----------------------
DataSize: 23, CMD: 0x000B000F
1301010000000000001027102700000000000000000000
Device ID: 1
Packet type: Condition
BlockIndex: 1
WARNING!!!!!! PACKET NOT HANDLED: Condition
----------------------
DataSize: 23, CMD: 0x000B000F
1301010000000000001027102700000000000000000000
Device ID: 1
Packet type: Condition
BlockIndex: 1
WARNING!!!!!! PACKET NOT HANDLED: Condition
----------------------
DataSize: 26, CMD: 0x000B000F
11010BFFFF00000100FFFF040000000000000000000000000000
Device ID: 1
Packet type: Effect
BlockIndex: 1
	BlockIndex: 1
	EffectType: Friction
	Duration: -1
	TriggerRepeatInterval: 0
	SamplePeriod: 1
	Gain: 255
	TriggerBtn (?): 255
	Polar: True
	Angle: 0

----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 12, CMD: 0x000B0191
110100000000000000000000
Device ID: 1
Packet type: CreateNewEffect
BlockIndex: 1
WARNING!!!!!! PACKET NOT HANDLED: CreateNewEffect
----------------------
DataSize: 12, CMD: 0x000B000F
150110270000000000000000
Device ID: 1
Packet type: ConstantForce
BlockIndex: 1
Magnitude: -255
----------------------
DataSize: 12, CMD: 0x000B000F
1A0101FF0000000000000000
Device ID: 1
Packet type: EffectOperation
BlockIndex: 1
EffectOperation: Start
----------------------
DataSize: 26, CMD: 0x000B000F
110101FFFF00000100FFFF043F00000000000000000000000000
Device ID: 1
Packet type: Effect
BlockIndex: 1
	BlockIndex: 1
	EffectType: ConstantForce
	Duration: -1
	TriggerRepeatInterval: 0
	SamplePeriod: 1
	Gain: 255
	TriggerBtn (?): 255
	Polar: True
	Angle: 88

----------------------
DataSize: 26, CMD: 0x000B000F
110101FFFF00000100FFFF043F00000000000000000000000000
Device ID: 1
Packet type: Effect
BlockIndex: 1
	BlockIndex: 1
	EffectType: ConstantForce
	Duration: -1
	TriggerRepeatInterval: 0
	SamplePeriod: 1
	Gain: 255
	TriggerBtn (?): 255
	Polar: True
	Angle: 88

----------------------
DataSize: 12, CMD: 0x000B000F
1A0103000000000000000000
Device ID: 1
Packet type: EffectOperation
BlockIndex: 1
EffectOperation: Stop
----------------------
DataSize: 12, CMD: 0x000B000F
1A0103000000000000000000
Device ID: 1
Packet type: EffectOperation
BlockIndex: 1
EffectOperation: Stop
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block 1
----------------------
DataSize: 10, CMD: 0x000B000F
1C040000000000000000
Device ID: 1
Packet type: PidDeviceControl
BlockIndex: 4
PIDDeviceControl: DeviceReset
Joystick Logitech RumblePad 2 USB has 0 active effects. Disposing...
MarijnS95
One Eyed Hopeful
Posts: 34
Joined: Tue Dec 22, 2015 12:52 pm

Re: FFB dev. thread

Post by MarijnS95 »

Looks like I do need to modify the code in such a way that CreateNewEffect is used. Otherwise the EfffectOperation.Start is completely ignored...

Edit:
Modified the code to do that, however using the Python code to create an effect on a vJoy joystick doesn't cause it to send a CreateNewEffect packet :?

Btw I don't have push rights for the FFB branch, can you fix that?
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

Push to your own clone and i can pull
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

MarijnS95 wrote:Looks like I do need to modify the code in such a way that CreateNewEffect is used. Otherwise the EfffectOperation.Start is completely ignored...

Edit:

Code: Select all

Modified the code to do that, however using the Python code to create an effect on a vJoy joystick doesn't cause it to send a CreateNewEffect packet  :?
Btw I don't have push rights for the FFB branch, can you fix that?

Yes I noticed that ForceTest.exe and the joystick plugin way will output different debug data from the callback method. However, I can get my gamepad to vibrate using both ForceTest.exe and joystick plugin.
MarijnS95
One Eyed Hopeful
Posts: 34
Joined: Tue Dec 22, 2015 12:52 pm

Re: FFB dev. thread

Post by MarijnS95 »

Done, pull request submitted.

Edit:
I see there's still a formatting issue with spaces inbetween ifs/switches and their brackets...
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

There is no need to create pull requests, I can pull anyway
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

Been away over the weekend, tried quickly with the latest code, didnt work, didnt have time to investigate if the output have changed though.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

Tried some more, using this script.

Code: Select all

if starting:
	vJoy[0].registerFfbDevice(joystick["Logitech RumblePad 2 USB"])
First i start the script

Then I start ForceTest.exe Directly this is outputet in FreePIE console (No effect sent yet)

Code: Select all

----------------------
DataSize: 10, CMD: 0x000B000F
1DFF0000000000000000
Device ID: 1
Packet type: DeviceGain
BlockIndex: 255
WARNING!!!!!! PACKET NOT HANDLED: DeviceGain
----------------------
DataSize: 10, CMD: 0x000B000F
1DFF0000000000000000
Device ID: 1
Packet type: DeviceGain
BlockIndex: 255
WARNING!!!!!! PACKET NOT HANDLED: DeviceGain
----------------------
DataSize: 10, CMD: 0x000B000F
1DFF0000000000000000
Device ID: 1
Packet type: DeviceGain
BlockIndex: 255
WARNING!!!!!! PACKET NOT HANDLED: DeviceGain
----------------------
DataSize: 23, CMD: 0x000B000F
1301000000000000001027102700000000000000000000
Device ID: 1
Packet type: Condition
BlockIndex: 1
WARNING!!!!!! PACKET NOT HANDLED: Condition
----------------------
DataSize: 23, CMD: 0x000B000F
1301010000000000001027102700000000000000000000
Device ID: 1
Packet type: Condition
BlockIndex: 1
WARNING!!!!!! PACKET NOT HANDLED: Condition
----------------------
DataSize: 26, CMD: 0x000B000F
11010BFFFF00000100FFFF040000000000000000000000000000
Device ID: 1
Packet type: Effect
BlockIndex: 1
	BlockIndex: 1
	EffectType: Friction
	Duration: -1
	TriggerRepeatInterval: 0
	SamplePeriod: 1
	Gain: 255
	TriggerBtn (?): 255
	Polar: True
	Angle: 0

----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
This is in the ForceTest console

Code: Select all

Enumerated Joystick : vJoy Device
Supported Effects : 
   - Constant
   - Ramp Force
   - Square Wave
   - Sine Wave
   - Triangle Wave
   - Sawtooth Up Wave
   - Sawtooth Down Wave
   - Damper
   - Inertia
   - Friction
   - CustomForce
Enumerated Joystick : Logitech RumblePad 2 USB
Supported Effects : 
   - Constant
   - Ramp Force
   - Square Wave
   - Sine Wave
   - Triangle Wave
   - Sawtooth Up Wave
   - Sawtooth Down Wave
   - Spring
   - Damper
   - Inertia
   - Friction
   - CustomForce

Creating effects for vJoy Device
Error creating Spring Effect. Your joystick may not support this effect.  : 
REGDB_E_CLASSNOTREG : 
Class not registered

Creating effects for Logitech RumblePad 2 USB
Then I send a constant force effect using ForceTest.exe

Code: Select all

----------------------
DataSize: 12, CMD: 0x000B0191
110100000000000000000000
Device ID: 1
Packet type: CreateNewEffect
BlockIndex: 1
Creating new effect ConstantForce
----------------------
DataSize: 26, CMD: 0x000B000F
110101FFFF00000100FFFF043F00000000000000000000000000
Device ID: 1
Packet type: Effect
BlockIndex: 1
	BlockIndex: 1
	EffectType: ConstantForce
	Duration: -1
	TriggerRepeatInterval: 0
	SamplePeriod: 1
	Gain: 255
	TriggerBtn (?): 255
	Polar: True
	Angle: 88

----------------------
DataSize: 26, CMD: 0x000B000F
110101FFFF00000100FFFF043F00000000000000000000000000
Device ID: 1
Packet type: Effect
BlockIndex: 1
	BlockIndex: 1
	EffectType: ConstantForce
	Duration: -1
	TriggerRepeatInterval: 0
	SamplePeriod: 1
	Gain: 255
	TriggerBtn (?): 255
	Polar: True
	Angle: 88

----------------------
DataSize: 26, CMD: 0x000B000F
110101FFFF00000100FFFF043F00000000000000000000000000
Device ID: 1
Packet type: Effect
BlockIndex: 1
	BlockIndex: 1
	EffectType: ConstantForce
	Duration: -1
	TriggerRepeatInterval: 0
	SamplePeriod: 1
	Gain: 255
	TriggerBtn (?): 255
	Polar: True
	Angle: 88

----------------------
DataSize: 26, CMD: 0x000B000F
110101FFFF00000100FFFF043F00000000000000000000000000
Device ID: 1
Packet type: Effect
BlockIndex: 1
	BlockIndex: 1
	EffectType: ConstantForce
	Duration: -1
	TriggerRepeatInterval: 0
	SamplePeriod: 1
	Gain: 255
	TriggerBtn (?): 255
	Polar: True
	Angle: 88
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

Added some more logging (its pushed to github).

Seems there is a problem in the OnFfbCallback method when we try to forward the effect packet.

This is the output when sending force constant usgin ForceTest.exe

Code: Select all

----------------------
DataSize: 12, CMD: 0x000B0191
110100000000000000000000
Device ID: 1
Packet type: CreateNewEffect
BlockIndex: 1
Creating new effect ConstantForce
----------------------
DataSize: 26, CMD: 0x000B000F
110101FFFF00000100FFFF043F00000000000000000000000000
Device ID: 1
Packet type: Effect
BlockIndex: 1
	BlockIndex: 1
	EffectType: ConstantForce
	Duration: -1
	TriggerRepeatInterval: 0
	SamplePeriod: 1
	Gain: 255
	TriggerBtn (?): 255
	Polar: True
	Angle: 88

Excecption when trying to forward ffb packetType Effect

Unable to create effect: DIERR_NOTEXCLUSIVEACQUIRED & VFW_E_FILTER_ACTIVE & DMO_E_TYPE_NOT_ACCEPTED: The operation cannot be performed unless the device is acquired in DISCL_EXCLUSIVE mode. & This operation cannot be performed because the filter is active. (-2147220987)
----------------------
DataSize: 26, CMD: 0x000B000F
110101FFFF00000100FFFF043F00000000000000000000000000
Device ID: 1
Packet type: Effect
BlockIndex: 1
	BlockIndex: 1
	EffectType: ConstantForce
	Duration: -1
	TriggerRepeatInterval: 0
	SamplePeriod: 1
	Gain: 255
	TriggerBtn (?): 255
	Polar: True
	Angle: 88

Excecption when trying to forward ffb packetType Effect

Unable to create effect: DIERR_NOTEXCLUSIVEACQUIRED & VFW_E_FILTER_ACTIVE & DMO_E_TYPE_NOT_ACCEPTED: The operation cannot be performed unless the device is acquired in DISCL_EXCLUSIVE mode. & This operation cannot be performed because the filter is active. (-2147220987)
----------------------
DataSize: 12, CMD: 0x000B000F
1A0101FF0000000000000000
Device ID: 1
Packet type: EffectOperation
BlockIndex: 1
EffectOperation: Start
Excecption when trying to forward ffb packetType EffectOperation

DIERR_INCOMPLETEEFFECT & VFW_E_NO_TYPES & DMO_E_NO_MORE_ITEMS: The effect could not be downloaded because essential information is missing.  For example, no axes have been associated with the effect, or no type-specific information has been created. & One of the specified pins supports no media types. (-2147220986)
----------------------
DataSize: 26, CMD: 0x000B000F
110101FFFF00000100FFFF043F00000000000000000000000000
Device ID: 1
Packet type: Effect
BlockIndex: 1
	BlockIndex: 1
	EffectType: ConstantForce
	Duration: -1
	TriggerRepeatInterval: 0
	SamplePeriod: 1
	Gain: 255
	TriggerBtn (?): 255
	Polar: True
	Angle: 88

Excecption when trying to forward ffb packetType Effect

Unable to create effect: DIERR_NOTEXCLUSIVEACQUIRED & VFW_E_FILTER_ACTIVE & DMO_E_TYPE_NOT_ACCEPTED: The operation cannot be performed unless the device is acquired in DISCL_EXCLUSIVE mode. & This operation cannot be performed because the filter is active. (-2147220987)
MarijnS95
One Eyed Hopeful
Posts: 34
Joined: Tue Dec 22, 2015 12:52 pm

Re: FFB dev. thread

Post by MarijnS95 »

Hmm, having a SamplePeriod of 1 doesn't really look correct (I've yet to find documentation on that). However we know that the default 0 works, so might try that.

I think I've fixed previous errors about active filters etc by unplugging the device (to unload everything), because again I think there's some rememnants of earlier tries.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

True, will check the output after a clean reboot tonight and paste the result here
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

After a fresh reboot I get this when starting Forcetest

Code: Select all

----------------------
DataSize: 10, CMD: 0x000B000F
1DFF0000000000000000
Device ID: 1
Packet type: DeviceGain
BlockIndex: 255
WARNING!!!!!! PACKET NOT HANDLED: DeviceGain
----------------------
DataSize: 10, CMD: 0x000B000F
1DFF0000000000000000
Device ID: 1
Packet type: DeviceGain
BlockIndex: 255
WARNING!!!!!! PACKET NOT HANDLED: DeviceGain
----------------------
DataSize: 10, CMD: 0x000B000F
1DFF0000000000000000
Device ID: 1
Packet type: DeviceGain
BlockIndex: 255
WARNING!!!!!! PACKET NOT HANDLED: DeviceGain
----------------------
DataSize: 12, CMD: 0x000B0191
110B00000000000000000000
Device ID: 1
Packet type: CreateNewEffect
BlockIndex: 11
Creating new effect Friction
Excecption when trying to forward ffb packetType CreateNewEffect

Unable to create effect: Index was outside the bounds of the array.
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
----------------------
DataSize: 10, CMD: 0x000B000F
1B010000000000000000
Device ID: 1
Packet type: PidBlockFree
BlockIndex: 1
PID: Freeing block
And this when sending constant force from Forcetest

Code: Select all

----------------------
DataSize: 12, CMD: 0x000B0191
110100000000000000000000
Device ID: 1
Packet type: CreateNewEffect
BlockIndex: 1
Creating new effect ConstantForce
----------------------
DataSize: 26, CMD: 0x000B000F
110101FFFF00000100FFFF040000000000000000000000000000
Device ID: 1
Packet type: Effect
BlockIndex: 1
	BlockIndex: 1
	EffectType: ConstantForce
	Duration: -1
	TriggerRepeatInterval: 0
	SamplePeriod: 1
	Gain: 255
	TriggerBtn (?): 255
	Polar: True
	Angle: 0

Excecption when trying to forward ffb packetType Effect

Unable to create effect: DIERR_NOTEXCLUSIVEACQUIRED & VFW_E_FILTER_ACTIVE & DMO_E_TYPE_NOT_ACCEPTED: The operation cannot be performed unless the device is acquired in DISCL_EXCLUSIVE mode. & This operation cannot be performed because the filter is active. (-2147220987)
----------------------
DataSize: 26, CMD: 0x000B000F
110101FFFF00000100FFFF043F00000000000000000000000000
Device ID: 1
Packet type: Effect
BlockIndex: 1
	BlockIndex: 1
	EffectType: ConstantForce
	Duration: -1
	TriggerRepeatInterval: 0
	SamplePeriod: 1
	Gain: 255
	TriggerBtn (?): 255
	Polar: True
	Angle: 88

Excecption when trying to forward ffb packetType Effect

Unable to create effect: DIERR_NOTEXCLUSIVEACQUIRED & VFW_E_FILTER_ACTIVE & DMO_E_TYPE_NOT_ACCEPTED: The operation cannot be performed unless the device is acquired in DISCL_EXCLUSIVE mode. & This operation cannot be performed because the filter is active. (-2147220987)
----------------------
DataSize: 26, CMD: 0x000B000F
110101FFFF00000100FFFF043F00000000000000000000000000
Device ID: 1
Packet type: Effect
BlockIndex: 1
	BlockIndex: 1
	EffectType: ConstantForce
	Duration: -1
	TriggerRepeatInterval: 0
	SamplePeriod: 1
	Gain: 255
	TriggerBtn (?): 255
	Polar: True
	Angle: 88

Excecption when trying to forward ffb packetType Effect

Unable to create effect: DIERR_NOTEXCLUSIVEACQUIRED & VFW_E_FILTER_ACTIVE & DMO_E_TYPE_NOT_ACCEPTED: The operation cannot be performed unless the device is acquired in DISCL_EXCLUSIVE mode. & This operation cannot be performed because the filter is active. (-2147220987)
----------------------
DataSize: 26, CMD: 0x000B000F
110101FFFF00000100FFFF043F00000000000000000000000000
Device ID: 1
Packet type: Effect
BlockIndex: 1
	BlockIndex: 1
	EffectType: ConstantForce
	Duration: -1
	TriggerRepeatInterval: 0
	SamplePeriod: 1
	Gain: 255
	TriggerBtn (?): 255
	Polar: True
	Angle: 88

Excecption when trying to forward ffb packetType Effect

Unable to create effect: DIERR_NOTEXCLUSIVEACQUIRED & VFW_E_FILTER_ACTIVE & DMO_E_TYPE_NOT_ACCEPTED: The operation cannot be performed unless the device is acquired in DISCL_EXCLUSIVE mode. & This operation cannot be performed because the filter is active. (-2147220987)
MarijnS95
One Eyed Hopeful
Posts: 34
Joined: Tue Dec 22, 2015 12:52 pm

Re: FFB dev. thread

Post by MarijnS95 »

Maybe we have to look at the function that acquires the device. Though afaik that's called with correct enum parameters already...
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: FFB dev. thread

Post by CyberVillain »

I was experimenting with the enum values didnt help :/
Post Reply

Return to “FreePIE”