Identify joysticks for SimConnect_MapInputEventToClientEvent

Chrisoft
Posts: 51
Joined: Tue Jul 31, 2012 7:29 pm

Identify joysticks for SimConnect_MapInputEventToClientEvent

Postby Chrisoft » Mon Jul 29, 2019 6:42 am

Hi developers,

For my cockpit in C++, I use several joysticks (throttles, sticks, pedals, 200 buttons, etc...)
The problem, I don't know how number of joystick is for throttle, for CPT stick, for FO stick etc...
Code :

Code: Select all

hr = SimConnect_MapInputEventToClientEvent(hSimConnect, INPUT_XAXIS, "joystick:0:XAxis", EVENT_XAXIS);
Also, sometime number in "joystick:x" of 2 throttles could changed after restart Prepar3D.

So how to identify number of joystick for each correct device?

Regards,

Chris.

JB3DG
Posts: 454
Joined: Mon Jan 09, 2012 6:44 pm

Re: Identify joysticks for SimConnect_MapInputEventToClientEvent

Postby JB3DG » Mon Jul 29, 2019 9:06 am

Set your control input method in P3D to DirectInput (Controls menu->Other), then use the DirectInput SDK to enumerate your devices. The sequence will match.
Jonathan Bleeker
Milviz systems dev

Formerly known as Naruto-kun

Chrisoft
Posts: 51
Joined: Tue Jul 31, 2012 7:29 pm

Re: Identify joysticks for SimConnect_MapInputEventToClientEvent

Postby Chrisoft » Mon Jul 29, 2019 4:20 pm

Okay I note, I'll try to make a c++ sample using directinput.

Before, I used hidapi.dll easily for my c++ program.
It worked on older PC with windows 10.
But with new PC, I can't use module hidapi.dll. It doesn't work.

Maybe you have some tips to enable hid on windows 10 ?

Regards,

Chris.

JB3DG
Posts: 454
Joined: Mon Jan 09, 2012 6:44 pm

Re: Identify joysticks for SimConnect_MapInputEventToClientEvent

Postby JB3DG » Mon Jul 29, 2019 5:44 pm

Nope. But the only reason I use SimConnect_MapInputEventToClientEvent is in order to mask joystick hardware inputs from the sim to prevent conflicts. I wrote my own class for using DirectInput on its own to handle everything from axes, buttons, POV hats, keyboard inputs, event based or status on demand, whatever I need. I would recommend writing your own DirectInput system as it allows far more flexibility than retrieving hardware states through SimConnect.
Jonathan Bleeker
Milviz systems dev

Formerly known as Naruto-kun


Return to “SimConnect Interface Questions”

Who is online

Users browsing this forum: No registered users and 4 guests