[RESOLVED] simconnect event KEY_STEERING_SET can't be assigned with a negative value

ppp333ddd_
Posts: 56
Joined: Fri Aug 18, 2017 1:04 am

[RESOLVED] simconnect event KEY_STEERING_SET can't be assigned with a negative value

Postby ppp333ddd_ » Sat Apr 28, 2018 1:22 am

Hi,

On the web, it says for the event KEY_STEERING_SET, sets the value of the nose wheel steering position. Zero is straight ahead (-16383, far left +16383, far right). But the definition of the API
public void TransmitClientEvent(uint ObjectID, Enum EventID, uint dwData, Enum GroupID, SIMCONNECT_EVENT_FLAG Flags);
requires the dwData to be uint type which does not allow a negative value, so I can only set half way for the steer. How to solve this? Thanks.

User avatar
Rob McCarthy
Lockheed Martin
Posts: 1518
Joined: Wed Aug 24, 2011 1:37 pm

Re: simconnect event KEY_STEERING_SET can't be assigned with a negative value

Postby Rob McCarthy » Tue May 01, 2018 2:43 pm

Hello,

You can cast the negative value to a DWORD and send it through. When this is received it is casted back to a signed value and will behave as expected.

Regards,
Rob McCarthy
Rob McCarthy
Prepar3D® Core Lead

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

Re: simconnect event KEY_STEERING_SET can't be assigned with a negative value

Postby JB3DG » Tue May 01, 2018 5:08 pm

If you were to look at the raw byte form of -1 in a signed int, and the raw byte form of 4294967295 in a DWORD, you will find they are identical. 0xFFFFFFFF. It is how the code interprets those bytes on the assembly level that makes the difference in behaviour.
Jonathan Bleeker
Milviz systems dev

Formerly known as Naruto-kun

ppp333ddd_
Posts: 56
Joined: Fri Aug 18, 2017 1:04 am

Re: simconnect event KEY_STEERING_SET can't be assigned with a negative value

Postby ppp333ddd_ » Mon May 14, 2018 5:12 am

Hi Rob and Jonathan,
yes you are right. a negative "value" can be converted to "4294967296-value" and for example -1 is 4294967295 which is 0xffffffff.


Return to “Software Development Kit (SDK) Questions”

Who is online

Users browsing this forum: No registered users and 3 guests