Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik > Daidalos Team discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 10-15-2011, 11:55 PM
EvilJoven
Guest
 
Posts: n/a
Default Fixing the way IL2 assigns Joystick IDs

I finally discovered how IL2 and a few other games assign joystick IDs. Now that this is known, is it fixable?

Currently, IL2 assigns IDs to joysticks alphabetically via the Vendor/Device ID. In my case, the list is as follows:

VID_044F&PID_0402 - Thrustmaster Warthog Stick
VID_044F&PID_0404 - Thrustmaster Warthog Throttle
VID_046D&PID_C215 - Logitech Extreme 3D Pro
VID_046D&PID_C216 - Logitech Dual Action Gamepad
VID_068E&PID_C0F2 - CH Pro Pedals USB
VID_068E&PID_00FA - CH THROTTLE QUADRANT

Because of this you have to remap all of your controls whenever something is removed/replaced.

The proper method is to assign joysticks ID's based on the list found in the following registry key: HKEY_CURRENT_USER\System\CurrentControlSet\Control \MediaResources\Joystick\DINPUT.DLL\CurrentJoystic kSettings

Devices are assigned IDs here as they're installed. It adds to better usability as devices retain their IDs, even as they're unplugged and plugged back in. The order of devices can even be changed by editing the values in this key or by using utilities that do it for you.

Is there any way TD can change the way IL2 enumerates joysticks to use this registry key? That way people like me who use a lot of different hardware won't have to remap our controls simply because we don't want to have everything plugged in permanently.
Reply With Quote
  #2  
Old 10-16-2011, 04:40 PM
Artist's Avatar
Artist Artist is offline
Approved Member
 
Join Date: Jan 2010
Posts: 362
Default

I second that motion!

I had to write YaDeLi just because I was unable to get the needed device into the first four devices that IL-2 supports

Artist
Reply With Quote
  #3  
Old 10-17-2011, 12:48 PM
RegRag1977 RegRag1977 is offline
Approved Member
 
Join Date: Oct 2007
Posts: 139
Default

I'm with too
Reply With Quote
  #4  
Old 10-19-2011, 05:02 PM
EvilJoven
Guest
 
Posts: n/a
Default

EDIT: Here's what I posted on the 777 Forums as well as in the IL2-CoD subforum. It seems that they use the same method of assigning joystick IDs for Rise of Flight that the IL2 games use. This should better outline what is happening and what should be happening:

Rise of flight isn't assigning joystick ID's properly.

Currently, the game does something like this:

When the game is launched, it scans the list of game controllers, probably from here: HKEY_CURRENT_USER\System\CurrentControlSet\Control \MediaProperties\PrivateProperties\Joystick\OEM

And then the game goes down the list and assigns joystick IDs 1 to whatever to each device, if it's currently plugged in.

So, here's the list of ALL the controllers I use on my PC:

VID_044F&PID_0402 - Thrustmaster Warthog Stick
VID_044F&PID_0404 - Thrustmaster Warthog Throttle
VID_044F&PID_FFFF - Thrustmaster Virtual Game Controller (root) - THIS ONLY SHOWS UP IF THE TARGET PROFILER IS ACTIVE AND REPLACES THE ABOVE 2 STICKS
VID_046D&PID_C215 - Logitech Extreme 3D Pro
VID_046D&PID_C216 - Logitech Dual Action Gamepad
VID_068E&PID_C0F2 - CH Pro Pedals USB
VID_068E&PID_00FA - CH Throttle Quadrant USB


Normally I use this stuff without the Thrustmaster TARGET profiler running and with the Logitech stuff unplugged as I only use these for console ports and games with simplified flight models like the Battlefield games and ARMA, so most of the time when I launch Rise of flight, it sees these controllers.

VID_044F&PID_0402 - Thrustmaster Warthog Stick
VID_044F&PID_0404 - Thrustmaster Warthog Throttle
VID_068E&PID_C0F2 - CH Pro Pedals USB
VID_068E&PID_00FA - CH Throttle Quadrant USB

And these controllers are assigned 1-4 in game.

Here's where the problem comes in. Let's say, for instance, I try to use TARGET. If I do, all of a sudden my list looks like this:

VID_044F&PID_FFFF - Thrustmaster Virtual Game Controller (root)
VID_068E&PID_C0F2 - CH Pro Pedals USB
VID_068E&PID_00FA - CH Throttle Quadrant USB

So now the Pedals aren't ID3 and the Quadrant isn't ID4, they've both been moved up a spot because the Warthog sticks were replaced by the virtual game controller.

Now I have to remap EVERYTHING that I had mapped to the pedals as well as the quadrant.

And if I didn't run target but forget to unplug my gamepad...

VID_044F&PID_0402 - Thrustmaster Warthog Stick
VID_044F&PID_0404 - Thrustmaster Warthog Throttle
VID_046D&PID_C216 - Logitech Dual Action Gamepad
VID_068E&PID_C0F2 - CH Pro Pedals USB
VID_068E&PID_00FA - CH Throttle Quadrant USB

If I had this, the gamepad axis would be controlling my rudder inputs and my pedals would have throttle inputs mapped to it.

So basically, by assigning joystick IDs this way, it means that once I create a key mapping I need to have only those controllers plugged in. Any variation will cause problems unless I luck out and the controllers I do want to use happen to fall in the same spot, alphabetically.


THIS IS HOW YOU FIX THIS

The proper way a game should be assigning joystick IDs based on the registry key HKEY_CURRENT_USER\System\CurrentControlSet\Control \MediaResources\Joystick\DINPUT.DLL\CurrentJoystic kSettings

When a controller is plugged in to the PC for the first time it's assigned an ID which generally don't change, even if the device is unplugged and plugged back in, unless a piece of software does it deliberately.

Here's an example. This is how my joysticks are currently set up when everything is plugged in (this software, which allows me to change the joystick IDs around, can be found at http://www.wingmanteam.com/latest_software/gadgets.htm ):



Now, here's what happens when I unplug the Logitech Extreme 3D Pro and run the profiler, which essentially detaches both the Warthog stick and throttle and attaches a virtual joystick which the software assigns as ID 1



Notice how this doesn't cause any problems with the rudders, throttle quadrant and gamepad. They have retained their ID.

So, with this change, people won't have nearly as much trouble with their joysticks.

I've already posted this on the 1C forums as both IL-2 games seem to also use this improper method of assigning joystick IDs.

Fortunately, the DCS games, MS FSX, the FSX FSUIPC addon and a lot of other games are using the proper method.
Reply With Quote
  #5  
Old 10-20-2011, 09:42 AM
Artist's Avatar
Artist Artist is offline
Approved Member
 
Join Date: Jan 2010
Posts: 362
Default

Hi EvilJoven,

I wish it were as simple as that. From my experiences with developing YaDeLi: The IDs you've mentioned (and which can be changed with Joystick ID' Swapper) exist only in the old Win32 API which is almost deprecated. They are not, I repeat not, used or accessible in/from DirectInput, which is used IL-2. DirectInput uses a GUID-system to identify and re-recognize devices.

@Daidalos Team: I've used this mechanism in YaDeLi to reliably connect devices to a IL-2 DeviceLink channel and would gladly supply source code, help, and support - if you decide to do somthing in this direction.

Artist
Reply With Quote
  #6  
Old 10-20-2011, 02:28 PM
EvilJoven
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Artist View Post
Hi EvilJoven,

I wish it were as simple as that. From my experiences with developing YaDeLi: The IDs you've mentioned (and which can be changed with Joystick ID' Swapper) exist only in the old Win32 API which is almost deprecated. They are not, I repeat not, used or accessible in/from DirectInput, which is used IL-2. DirectInput uses a GUID-system to identify and re-recognize devices.

@Daidalos Team: I've used this mechanism in YaDeLi to reliably connect devices to a IL-2 DeviceLink channel and would gladly supply source code, help, and support - if you decide to do somthing in this direction.

Artist
I think we both might be wrong on this one. You're right that the registry keys and values I was working with earlier don't seem to have any bearing on the joystick ID.

Fortunately, I found out what does.

When I worked on this some more to confirm whether or not you were correct, I discovered that when you change the joystick ID in either that joystick ID utility I use or by setting the primary controller from within the Game Controller Settings (in the control panel in XP or brought up by right clicking on a joystick in the Devices and Printers window) you're changing the Joystick ID binary value key for the associated controller, located here:

HKEY_CURRENT_USER\System\CurrentControlSet\Control \MediaProperties\PrivateProperties\DirectInput\<VE NDOR AND DEVICE ID>\Calibration\0

This seems to be what sets the joystick ID.

The end result is the same. If IL-2 can be modified so that it assigns joystick IDs by reading from THAT key it should sort things out nicely.
Reply With Quote
  #7  
Old 10-20-2011, 02:46 PM
Artist's Avatar
Artist Artist is offline
Approved Member
 
Join Date: Jan 2010
Posts: 362
Default

Great discovery, EvilJoven! I just relied on the DirectInput-documentation from Microsoft and that never ever hinted at what you've found out...

Reverse Engineering scores a point over RTFM!

Now the question is: Is TD prepared to rely on an undocumented feature (mixing DirectInput with Win32 API) in order to solve a serious inconvenience for all those having more that 4 controllers...

I surely hope so! TD, please?

Artist

Edit, PS: You're sure that it is "HKEY_CURRENT_USER\System\..."? I find all you've written about under "HKEY_LOCAL_MACHINE\System\..."

Last edited by Artist; 10-20-2011 at 02:48 PM.
Reply With Quote
  #8  
Old 10-20-2011, 04:11 PM
EvilJoven
Guest
 
Posts: n/a
Default

On my win7x64 pc it all the stuff relating to the Directinput joystick ID settings is stored under HKCU. Unless I missed something in process monitor, when changing IDs around this is the only place it's done.
Reply With Quote
  #9  
Old 10-20-2011, 05:22 PM
Artist's Avatar
Artist Artist is offline
Approved Member
 
Join Date: Jan 2010
Posts: 362
Default

Secrets of Windows: It's Xp SP3 here and there's no "\System" under HKCU - only within HKLM. Could it be the shadowing of Win7? Wonder what a software API call would find...

Good to know, though.

Artist
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:58 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.