MapInputEventToClientEvent issues

jpearson
Posts: 41
Joined: Fri Dec 03, 2010 6:52 pm

Postby jpearson » Mon Jan 24, 2011 3:37 pm

i am trying to use 'MapInputEventToClientEvent' to get joystick input events (in this instance using a button as a push-to-talk switch). when i press the joystick button down that i have mapped i get the expected "button down" event response, however, when i release the button i receive the same "button down" event response and not the "button up" event response i expect based on how the event mapping parameters are setup.



My question is this...are joystick button events not treated the same as keyboard button events? in other words, are there no button down/button up events sent for when a joystick button is pressed but only one event message that is sent when the pressed-state of the joystick button changes?

jpearson
Posts: 41
Joined: Fri Dec 03, 2010 6:52 pm

Postby jpearson » Tue Jan 25, 2011 1:52 pm

until someone can prove otherwise, i'm going to operate on the assumption that only a "joystick button toggle"-type event is sent when joystick buttons are pressed and that the state of the joystick buttons must be monitored internally, assuming an initial position of "not pressed". some more experimenting with the joystick events seems to indicate this is the case.



i seem to be experiencing a new issue, however, of the Standard.XML file not reflecting the new mappings made using simconnect. the SDK states "The file is written out again when the simulation is exited, obviously containing any new mappings." I am not seeing this happen. I can map and receive the appropriate input events correctly, but the event that is mapped to the button i want to use (leftover from the default mapping prior to my remapping) still occurs alongside the input events i have mapped.



for example, i am using a Logitech Extreme 3D joystick. i want to map button #2 to be a push-to-talk switch, so that when it's pressed i receive the event indicating it was triggered and pipe this information out to some external voice comm stuff. my default entry for this button in the Standard.XML file reads:



<Entry>

<Index>1</Index>

<Down>VIEW_MODE</Down>

</Entry>



so i get the KEY_VIEW_MODE event triggered whenever i press this button as well. (after Prepar3D has exited) i can manually edit this entry in the file to read:



<Entry>

<Index>1</Index>

<Down></Down>

</Entry>



once i've done this, i no longer get the KEY_VIEW_MODE event triggering alongside my input event, however, my manual editing does not seem to persist and gets overwritten to the default mapping mentioned above once i exit Prepar3D again.



what i am missing here? i need the mappings to reliably persist in the file so i dont get unnecessary default events triggering with my input events whenever i quit and restart Prepar3D.

cjtallman
Posts: 3
Joined: Wed Sep 15, 2010 5:04 am

Postby cjtallman » Wed Jan 26, 2011 1:15 pm

I've recently been working in the control code, so hopefully I can answer your questions. There were indeed several bugs with the old control handling code that I have fixed since launch version (I'm not sure how far back they were introduced). I'll try to figure out what's going on in your case and offer some help.



The joystick button events actually are treated the same as keyboard events in most cases. The are handled differently in code, but at runtime they should work the same. I think you might have found a bug that I fixed after initial launch (sorry it doesn't help you right now). This bug was present when assigning mappings and checking for conflicts/collisions; It would consider up/down events to be conflicts if both were present. You should be able to get around it with manually editing the file, like you have been. If I remember correctly how the old control screen worked, you may run into this bug by simply opening the control screen after you manually edit your config. I will do more testing on this and hopefully have a better strategy for you to try. The next version/update of Prepar3D will have this (and other bugs) fixed, but until then I'll do my best to get you running smoothly.



If you want to remove an assignment manually for a button completely, you will need to delete everything between and including the <Entry> and </Entry> tags for that index. I suspect it was replacing yours with a default mapping because it had problems parsing the data (it saw the <Down></Down> tag and expected something in between). So just remove that <Entry> and try that.



For what it's worth, here's a couple examples I made while testing.

Code:

<Entry>
<Index>6</Index>
<Down>MP_VOICE_CAPTURE_START</Down>
<Up>MP_VOICE_CAPTURE_STOP</Up>
</Entry>
<Entry>
<Index>7</Index>
<Down>VIDEO_RECORD_TOGGLE</Down>
<Up>VIDEO_RECORD_TOGGLE</Up>
</Entry>




I hope this helps. Please let me know if you make any progress or run into any more problems.

jpearson
Posts: 41
Joined: Fri Dec 03, 2010 6:52 pm

Postby jpearson » Thu Jan 27, 2011 2:04 am

thank you! that was very helpful. if the joystick button events' behavior we discussed is indeed a bug, i can work around it for the time being. i will attempt to modify the Standard.xml file according to your recommendations and see if that solves my problem and let you know my results. thanks again for your help, it is much appreciated.

jpearson
Posts: 41
Joined: Fri Dec 03, 2010 6:52 pm

Postby jpearson » Thu Jan 27, 2011 1:01 pm

thanks for your help, cjtallman. your recommendation to manually remove the button entry entirely seems to have cleared up the issue i was experiencing.

cjtallman
Posts: 3
Joined: Wed Sep 15, 2010 5:04 am

Postby cjtallman » Thu Jan 27, 2011 2:18 pm

You're welcome. Sorry for the troubles you had with it. We're working on getting these annoyances fixed for the next version. Good luck!


Return to “SimConnect Interface Questions”

Who is online

Users browsing this forum: No registered users and 28 guests