Some questions concerning the generic joystick pluign

Official forum for open source FreePIE discussion and development.
Post Reply
Jabberwock
Cross Eyed!
Posts: 197
Joined: Mon Mar 02, 2015 3:58 pm

Some questions concerning the generic joystick pluign

Post by Jabberwock »

Is there any specific reason why the generic joystick plugin reports the raw data instead of DX ones? This not only makes setting up tedious, but also does not allow to use calibration and deadzone settings done in the system. Practically any game or program using game controllers assumes that they are properly calibrated and set up in the system...

Also, would it be possible to address the controllers by their names as seen in the Game Controllers window and not by number? Due to various reasons I often rearrange my controller connections, which makes it difficult to trace the numbering used in the scripts...
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Some questions concerning the generic joystick pluign

Post by CyberVillain »

It uses the DirectX api to access the data, to my knowledge it shuld read the data like any other game or software would.

https://github.com/AndersMalmgren/FreeP ... gin.cs#L16

It could be possible with a rewrite,but the name is not unique, if you have two controllers of the same type they will get same name (I think)
Jabberwock
Cross Eyed!
Posts: 197
Joined: Mon Mar 02, 2015 3:58 pm

Re: Some questions concerning the generic joystick pluign

Post by Jabberwock »

CyberVillain wrote:It uses the DirectX api to access the data, to my knowledge it shuld read the data like any other game or software would.
No, it does not seem to be true. If you use a program like DXTweak2:

Image

you can see two kinds of values: DX and raw ones. The raw ones may have very different values, they might get jitter on older analog hardware, etc. Beside you see DX values: they are normalized between +-32767 for each axis, they have applied deadzone and the have applied response curve. These are the data that are used by games, so that any calibration done in the system is actually applied in the games.
It could be possible with a rewrite,but the name is not unique, if you have two controllers of the same type they will get same name (I think)
That is true. Still, I think it would be easier to reference the first controller with the name (and just grab the other one(s) if the first is not working) than modify the code each time the configuration changes. This would be an alternate way to reference the controllers anyway.
Jabberwock
Cross Eyed!
Posts: 197
Joined: Mon Mar 02, 2015 3:58 pm

Re: Some questions concerning the generic joystick pluign

Post by Jabberwock »

I see now that the values are ranged between -1000 and 1000. I am not sure why, though.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Some questions concerning the generic joystick pluign

Post by CyberVillain »

We read Direct input data not raw data. I cant see in the API that you can read raw data from the Dircect input interface
Jabberwock
Cross Eyed!
Posts: 197
Joined: Mon Mar 02, 2015 3:58 pm

Re: Some questions concerning the generic joystick pluign

Post by Jabberwock »

CyberVillain wrote:We read Direct input data not raw data. I cant see in the API that you can read raw data from the Dircect input interface
I know that now, I did not notice that it gets reconverted to -1000,1000 range. I was asking about this as I need to rerange it again for all axes for vjoy. I mean it would make more sense for me to write:

vJoy[0].x = joystick[0].x

than

vJoy[0].x = map_range(joystick[0].x, -1000, 1000, -32767, 32767)

but I can live with that.
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Some questions concerning the generic joystick pluign

Post by CyberVillain »

You can also use setRange(int lowerRange, int upperRange) on the joystick
Post Reply

Return to “FreePIE”