SCToolsfactory / SCJMapper-V2

SC Joystick Mapper (.Net 4; using sharpDX wrapper)
Other
137 stars 30 forks source link

Support for mouse and keyboard controls #19

Closed Teiwaz83 closed 9 years ago

Teiwaz83 commented 9 years ago

Due to the limitation on the number of joysticks detectable by Star Citizen, I've had to remap some controllers to give keyboard commands. Additionally, some controls on my joystick are interpreted as mouse controls (a mouse nub, and also a scroll wheel).

Since SCJMapper doesn't support keyboard and mouse commands, I've had to create my bindings for the keyboard and mouse controls in notepad, and then manually merge them with the control XML that SCJMapper creates. I then have to redo this every time I update any keyboard bindings using SCJMapper, since re-exporting the SCJMapper stuff wipes out all my keyboard and mouse bindings.

It'd be nice if SCJMapper supported mouse and keyboard bindings so that I could keep all my controls in once place and not have to deal with the manual merging headache.

bm98 commented 9 years ago

It is about to be working - target is V 2.8 (next release) Alpha is up now.

Teiwaz83 commented 9 years ago

Awesome. Tangentially related question, though: in your dealings with Star Citizen / Cry Engine, have you found any way to get the game to ignore certain joystick controllers? I don't think there's anything that can be done SCJMapper-side, but the damn game is still detecting my MFDs as joysticks even when all of the buttons are mapped to keyboard outputs, which means that it's not seeing my HOTAS at all due to the MFDs taking up a "slot."

bm98 commented 9 years ago

Seems that DirectInput enumerates the devices along the VID_PID in ascending order - at least this matches my setup with 3 devs and 2 virtual ones for testing. HKEY_CURRENT_USER\System\CurrentControlSet\Control\MediaProperties\PrivateProperties\Joystick\OEM lists USB devices and there the sequence of VID_PIDs of my controllers matches the Enum sequence that I find in my program - and this seems to match the one of AC. So CIG would have to enumerate more than 4 devices to get at the end of the chain. The keyboard mapping is not seen by DirectInput and therefore the devices are still listed as valid ones - only that driver diverts the input to keyboard if set so. Sorry - but this seems to be intrinsic.

Teiwaz83 commented 9 years ago

Thanks for the info. SC has to patch before I can check for sure, but I'm pretty sure my CH Products pedals were device #2 in AC, which isn't the order in which the devices appear in that list in that bit of the registry on my PC, which suggests something else may be determining the order. I've found three or four ways windows assigns device order to joysticks. I'm going to experiment to see if manually changing any of them affects the order in which SC sees the sticks. My hope is that CryEngine is using the alphabetical order of the VID_PIDs as a backup for some of the other methods just not having data set. I'll let you know if I figure anything out. Hard-linking device order to an unchangeable hardware ID in an engine that only sees the first 4 devices in that order is just catastrophically stupid.

Teiwaz83 commented 9 years ago

Well, I'm done for the night, I'll keep trying to figure this out tomorrow. Here's my data (sorted in the order SC orders them to make it easier to look for patterns in the other data):

Device Name Star Citizen Name Star Citizen ID VID/PID ID Registry Calibration # DirectInput.DLL order Device Manager Location Game Controllers Order
Left MFD F16 MFD 1 0 VID_044F&PID_B351 02 00 00 00 Joystick 3 0 1
Pedals CH PRO PEDALS USB 1 VID_068E&PID_00F2 05 00 00 00 Joystick 6 4 5
Right MFD F16 MFD 2 2 VID_044F&PID_B352 03 00 00 00 Joystick 4 0 2
Button Panel XK-12 Joystick 3 VID_05F3&PID_0429 00 00 00 00 / 04 00 00 00 Joystick 1 AND 5 0 4
HOTAS - - VID_06A3&PID_0B6A 00 00 00 00 - 0 6
Xbox controller - - VID_045E&PID_028E 01 00 00 00 Joystick 2 USB Input Device 3

I see no relationship between Star Citizen's ordering of these devices and any of the obvious ways they might be ordered from device manager or directinput registry keys. So... yeah. I dunno.

Teiwaz83 commented 9 years ago

I got some interesting info back from CIG about how they order the sticks. The weirdness in the ordering seems to be form an exception that forces throttles and pedals to me JS2 or 3:

This is all on us, but the change made is relatively minor. It still goes off the order in which windows lists the devices in the Game Controllers panel. However, if the device driver product name contains "throttle" or "pedals" it will try to relocate the device to js2 or js3. This is to fix an issue where the X55 HOTAS unit frequently appears before the flightstick device.

Updated data above with the control panel game controller window order, and it's entirely consistent with the SC ordering if you ignore the XBox controller (which CryEngine categorizes separately) and move the pedals to spot #2. Unfortunately, this also makes the ordering consistent with alphanumeric ordering of the VID/PID numbers, which can't be changed. So because Saitek has a higher vendor ID number than Thrustmaster, it's always going to stick the MFDs before the HOTAS and I'm probably screwed :/

bm98 commented 9 years ago

Or you can change the OEM Name in the registry i.e. add or remove the throttle/pedals part ... I did not checked it but it is the same as shown when I ask for the name.