Skip to content

Refactor input event handling to improve payload extraction and update struct documentation to prevent test crash#1

Merged
bstudtma merged 2 commits intobstudtma:add-simvar-subscriptionfrom
stopbars:add-simvar-subscription
Sep 15, 2025
Merged

Refactor input event handling to improve payload extraction and update struct documentation to prevent test crash#1
bstudtma merged 2 commits intobstudtma:add-simvar-subscriptionfrom
stopbars:add-simvar-subscription

Conversation

@AussieScorcher
Copy link

This pull request refactors how subscribed input event notifications are processed and represented in memory. The main change is to treat the event structure as a header, with the value payload directly following it, improving compatibility and correctness when extracting event values.

Improvements to event value extraction:

  • In ProcessSubscribeInputEvent, the code now computes the payload pointer and size based on the header, then extracts the value according to the event type, handling doubles and strings more robustly and safely.

Struct definition and memory layout:

  • Added [StructLayout(LayoutKind.Sequential)] to SimConnectRecvSubscribeInputEvent to ensure correct memory layout for interop.
  • Removed the Value field from SimConnectRecvSubscribeInputEvent, making it a pure header and clarifying that the value payload follows the header in memory.

…e struct documentation to prevent test crash
@AussieScorcher AussieScorcher marked this pull request as ready for review September 15, 2025 07:15
@AussieScorcher
Copy link
Author

@bstudtma Fixed a bug with tests, and added a changelog for your main PR on SimConnect.NET :)

@bstudtma bstudtma merged commit 752adba into bstudtma:add-simvar-subscription Sep 15, 2025
@AussieScorcher AussieScorcher deleted the add-simvar-subscription branch September 16, 2025 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants