Jump to content
Sign in to follow this  
Guest schwudde

Joystick control in a Gauge.dll

Recommended Posts

Guest schwudde

I've make my Gauge.dll working with SimConnect. The first Thing i made was receiving the "SITUATION_SAVED" Event so i'm able to write my Configfile for the Panelstats if Users save a Flight. Now i want to tkae "Control over the Joystickinputs. Can read (intercept?) the Inputs with SimConnect succesfully but FSX is still responsing to the Inputs (what he should'nt do in the Moment). Have read about this "maskable" InputGroups but nothing helps. So, I post some Code here how it works at the Moment.GAUGE_CALLBACK sys_gauge_cb;HANDLE hSimConnect = NULL;static enum GROUP_ID { GROUP0,};static enum EVENT_ID { EVENT_FLIGHT_SAVE, EVENT_XAXIS,};static enum INPUT_ID { INPUT_XAXIS,};static enum DATA_DEFINE_ID { FLIGHTCONTROLS,};case PANEL_SERVICE_PRE_INSTALL:{{HRESULT hr;if (SUCCEEDED(SimConnect_Open(&hSimConnect, "Gauge", NULL, 0, 0, 0))){hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_FLIGHT_SAVE, "SITUATION_SAVE");hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_XAXIS);hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, GROUP0, EVENT_FLIGHT_SAVE);hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, GROUP0, EVENT_XAXIS, TRUE);hr = SimConnect_SetNotificationGroupPriority(hSimConnect, GROUP0, SIMCONNECT_GROUP_PRIORITY_DEFAULT); hr = SimConnect_MapInputEventToClientEvent(hSimConnect, INPUT_XAXIS, "joystick:0:XAxis", EVENT_XAXIS);hr = SimConnect_SetInputGroupPriority(hSimConnect, INPUT_XAXIS, SIMCONNECT_GROUP_PRIORITY_HIGHEST_MASKABLE);hr = SimConnect_SetInputGroupState(hSimConnect, INPUT_XAXIS, SIMCONNECT_STATE_ON);hr = SimConnect_AddToDataDefinition(hSimConnect, FLIGHTCONTROLS, "AILERON POSITION", NULL, SIMCONNECT_DATATYPE_INT32); hr = SimConnect_CallDispatch(hSimConnect, MyDispatchProc, NULL);}else{MessageBox(NULL, L"Failed connecting Flight Simulator", L"SimConnect Error", MB_OK | MB_ICONERROR);exit (-1);}}Thanks for any Help.Regards,Sven

Share this post


Link to post
Share on other sites

I have been able to do what you're looking for. I think what you need to do is to set the event as maskable in MapInputEventToClientEvent(). Try using something along the lines of:hr = SimConnect_MapInputEventToClientEvent(hSimConnect, INPUT_XAXIS, "joystick:0:XAxis", EVENT_XAXIS, 0, (SIMCONNECT_CLIENT_EVENT_ID)SIMCONNECT_UNUSED, 0, true);I hope that will help you.Klas

Share this post


Link to post
Share on other sites
Guest schwudde

Thanks for your help, works fine now :-)Regards,Sven

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...