Jump to content
The simFlight Network Forums

Trouble with 0x88C offset in C#


Recommended Posts

Hi all,

I'm in trouble with the 0x88C offset, which is very odd because I've been using it for a long time in my external A/T in c/c++. However, as I'm now working with c# it turns out that weird things are happening. In this case I'm designing an A/T system for a HELICOPTER. To illustrate such thing, to write a determined throttle lever position (a value between -16384 to +16384) in Borland c++ Builder I simply input the following command:

FSUIPC_Write(0x88C, 2, &throttle_pos, &dwResult);

FSUIPC_Process(&dwResult);

and all works simply fine. Perfect.

In the other hand, in c# (MS Visual C#) I'm supposed to write the following command to achieve the same effect:

fsuipc.FSUIPC_Write(0x88C, throttle_1, ref token, ref dwResult);

fsuipc.FSUIPC_Process(ref dwResult);

and guess what happens. The Helicopter lever position works fine but the Helicopter just gains power for a brief instant (1 second) and then it looses power. I notice that N1 rotation (in this case) decreases as I the throttle lever position increases. At least to me it is extremely nonsense.

Observation #1: It perfectly works for aircraft, not to helicopters (in C#).

Observation #2: It perfectly works for all aircrafts in FS (in C++)

Observation #3: I tested the command line to many other offsets and they worked fine also. It seems to be a bug in 0x88C offset for c# applications (??)

Pete/people, can you give me a clue about what is happening to it?

Link to comment
Share on other sites

In the other hand, in c# (MS Visual C#) I'm supposed to write the following command to achieve the same effect:

fsuipc.FSUIPC_Write(0x88C, throttle_1, ref token, ref dwResult);

fsuipc.FSUIPC_Process(ref dwResult);

and guess what happens. The Helicopter lever position works fine but the Helicopter just gains power for a brief instant (1 second) and then it looses power. I notice that N1 rotation (in this case) decreases as I the throttle lever position increases. At least to me it is extremely nonsense.

Observation #1: It perfectly works for aircraft, not to helicopters (in C#).

Observation #2: It perfectly works for all aircrafts in FS (in C++)

Observation #3: I tested the command line to many other offsets and they worked fine also. It seems to be a bug in 0x88C offset for c# applications (??)

The most likely cause of your problem is that throttle_1 is declared and 'int' (4 bytes) and not 'short' 2 bytes. Therefore, at the same time you're writing to 0x088C you are also trampling over 0x88E which is the 'prop lever'. Could this possibly be the collective in helicopters? Changing the collective on a helicopter would certainly account for a change in N1.

Paul

Link to comment
Share on other sites

Paul,

Thank you. I was working with INT instead of SHORT. Sounds like we need to be more specific when working with C# than with C++. Indeed, the last to bytes of my INT went to 0x88E address. However, I still cannot understand how it worked fine with Jet Aircrafts (737 for instance), since the N1 value increased as the throttle position also increased.

Best Regards

Rafael

Link to comment
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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.