TransmitClientEvent on masked events broken since SU10?

I have noticed a change in transmitting masked events, now resulting in a
SimConnect Exception, since the release of SU10 / SDK 0.9.3. My application
allows for axes calibration on values both before being sent to the FS and
also on axes events received from the FS, using masking. No problems with the
former, but the latter is no longer working since SU10. The way this works is
as follows: - all events are requested (for logging purposes) in group 1,
priority SIMCONNECT_GROUP_PRIORITY_STANDARD - 1 - axes events are also
requested in group 2, originally unmasked, priority
SIMCONNECT_GROUP_PRIORITY_HIGHEST_MASKABLE - an axis event is first
transmitted with groupId=1 and priority
SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY - the axes event is received, and
the first time received it is detected that calibration is required and so it
is removed from notification group 2 and then added back with the masking flag
set - the axis parameter is adjusted/calibrated and re-transmitted with
groupId=2 and flag=0 - event received back in group1 and logged - exception
received on the TransmitClientEvent call: exception is 1 (Error) on index
parameter 2, which is the ObjectID and is the User Object (0), and so the
error doesn’t make sense. Note that the same code has been working in FSX, P3D
(all versions) and was working in MSFS2020 until the SU10 / SDK 0.9.3.0
release. What has changed in either the event masking or in the re-
transmission of masked events? Why does the exception indicate the problem is
on index parameter 2 (object ID, which is always
SIMCONNECT_SIMOBJECT_TYPE_USER)? Thanks in advance for any light that you can
shed on this issue, John

Hi, For SU10, we change the way SimConnect cleans its inputs event/groups/…
Indeed, there were some issues with removing a group but its dependencies
remain, closing simConnect but having some input still registered… But It is
possible that we clear “too much”. The only way to get Exception = 1 and
parameter = 2 using TransmitClientEvent is if there is no “User event” linked
to a Event Id (SubscribeToSystemEvent, MapClientEventToSimEvent). Here is a
list of function that light remove one of this link:

  • UnsubscribeFromSystemEvent
  • RemoveClientEvent
  • ClearNotificationGroup (every events attached to this group will be removed)

RemoveClientEvent and ClearNotificationGroup have changed in SU10 (we clear
more stuff), so the problem might come from them. With those information, can
you please check your code to see if there is something you might do wrong?
Otherwise, please provide us with a simple code which repro your problem os we
can investigate. Best Regards Maxime / Asobo

Thank you for your response. The code is quiet complex, but I will see if I
can reproduce in a simple sample. Obviously I cannot test this with MSFS
before SU10, but I can check the behavior in FSX/P3D. I will look into this
next week and report back when I have further information and/or a sample for
you. Regards, John

The only way to get Exception = 1 and parameter = 2 using TransmitClientEvent is if there is no "User event" linked to a Event Id (SubscribeToSystemEvent, MapClientEventToSimEvent).
...
RemoveClientEvent and ClearNotificationGroup have changed in SU10 (we clear more stuff), so the problem might come from them.

This is the issue. When you now call RemoveClientEvent, which should only
remove the client event from the notification group (as documented), it now
also removes the mapping of the client event to the sim event. Adding a new
call to MapClientEventToSimEvent after using RemoveClientEvent fixes this
issue. Therefore your assumption seems correct and you are clearing too much
stuff. I can correct for this for now, but hopefully this can be addressed in
a future update. Thanks - and regards, John