Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hello all,

I have a C# program which interacts with FS and I was wondering what would be the offset to use, in order to display TEXT within FS's display? I want to show the pilot some information while he is flying. Thanks for any help.

Posted

I have a C# program which interacts with FS and I was wondering what would be the offset to use, in order to display TEXT within FS's display? I want to show the pilot some information while he is flying. Thanks for any help.

Check the appropriate offsets list for your version of FS. They are all listed in the documents supplied in the FSUIPC SDK. Look initially at 32FA, the control word.

Regards

Pete

Posted

Check the appropriate offsets list for your version of FS. They are all listed in the documents supplied in the FSUIPC SDK. Look initially at 32FA, the control word.

Regards

Pete

Hi Pete!

Ok, I found the offset which is 3380 and the control is 32FA. Would the following work in C#:

Offset<string> displaytext = new Offset<string>(0x3380);

Offset<int> displaytexttimer = new Offset<int>(0x32FA);

I placed the following inside a button click action just to test things out:

displaytext.Value = (string) "THIS IS A TEST0";

displaytexttimer.Value = 5;

When I try to debug the prgram, Visual Studio is giving a compile error like this:

$exception {"Must set a size set for ArrayOrStringLength for Byte[], BitArray or String."} System.Exception

Any ideas? It's been 3 years since I coded in C# and I am super rusty. Thanks for the help.

UPDATE: Nevermind, Pete... I figured it out. Just had to add the BYTE LENGTH to the string (0x3380, 128) and now it works. Thanks!

Posted

When I try to debug the prgram, Visual Studio is giving a compile error like this:

$exception {"Must set a size set for ArrayOrStringLength for Byte[], BitArray or String."} System.Exception

Any ideas? It's been 3 years since I coded in C# and I am super rusty. Thanks for the help.

Sorry I know nothing at all about C#. It doesn't look anything like C to me! I hope some other C# programmer can help you.

Regards

Pete

Posted

Sorry I know nothing at all about C#. It doesn't look anything like C to me! I hope some other C# programmer can help you.

Regards

Pete

Pete,

This code:

Offset&lt;int&gt; displaytextcolor = new Offset&lt;int&gt;(0x3302);

Will allow me to write to the offset. So by doing the following:

displaytextcolor.Value = 0;

allow me to change the text from RED to WHITE?

I know you said you don't know C# but I just want to make sure that by writing a 0 to that offset, forces the display text to be white instead of the typical red.

UPDATE: Just tried it and the display still shows up as RED on a green, translucent background. Any ideas? Thanks.

Posted

UPDATE: Just tried it and the display still shows up as RED on a green, translucent background. Any ideas? Thanks.

It sounds like you are using FSUIPC4 and FSX? As documented in the FSUIPC4 Offsets Status dicument, which should be the reference you are using, thast facility isn't implemented for FSX. I have no way to implement it.

Regards

Pete

Posted

It sounds like you are using FSUIPC4 and FSX? As documented in the FSUIPC4 Offsets Status dicument, which should be the reference you are using, thast facility isn't implemented for FSX. I have no way to implement it.

Regards

Pete

Sorry Pete, I am using FSUIPC 3.99 and FS9... Should've told you that from the beginning.

Posted

This won't solve your problem, but you need to take care with your offset sizing. Both 0x3302 and 0x32FA are marked a 2 Bytes in the FSUIPC documentation. You have declared them as 'int' which is 4 bytes. When you write to these offsets you are also writing data (0) into the adjacent offsets. Many times you won't notice, but such mistakes could have very bad effects.

See my User Guide supplied with the FSUIPC Client DLL for an explanation and table of what .NET types to use for each type of FSUIPC offset.

For 2 bytes integer data you need to declare the offset as 'short' or 'ushort', not 'int'.

BTW, The FSUIPC docs seems to suggest that 0x3302 is readonly:

Assorted FSUIPC options, set by user parameters: read-only via

the IPC.

Paul

Posted

This won't solve your problem, but you need to take care with your offset sizing. Both 0x3302 and 0x32FA are marked a 2 Bytes in the FSUIPC documentation. You have declared them as 'int' which is 4 bytes. When you write to these offsets you are also writing data (0) into the adjacent offsets. Many times you won't notice, but such mistakes could have very bad effects.

See my User Guide supplied with the FSUIPC Client DLL for an explanation and table of what .NET types to use for each type of FSUIPC offset.

For 2 bytes integer data you need to declare the offset as 'short' or 'ushort', not 'int'.

BTW, The FSUIPC docs seems to suggest that 0x3302 is readonly:

Paul

Gotcha Paul! I will change those offsets from INT to SHORT. One thing I have noticed is that the text will ONLY appear when FS is in windowed mode. It will NOT display when in FULL-SCREEN mode. Could this be caused by the offset being set as INT and not SHORT? Or is this problem something else? Another thing... Docs say that the text string has to be terminated by a 0. How does one go about doing this? I figured that whatever text I send, the last character would be 0 but when I do this, the text itself shows a 0 on the text being displayed.

Posted

Gotcha Paul! I will change those offsets from INT to SHORT. One thing I have noticed is that the text will ONLY appear when FS is in windowed mode. It will NOT display when in FULL-SCREEN mode. Could this be caused by the offset being set as INT and not SHORT?

I'm pretty certain it's not because of getting the offset size wrong. I can't say why it doesn't show in full screen though - Pete will have to address that.

Another thing... Docs say that the text string has to be terminated by a 0. How does one go about doing this? I figured that whatever text I send, the last character would be 0 but when I do this, the text itself shows a 0 on the text being displayed.

Yes, it doesn't mean place a character '0' at the end, it means the last byte in the character array (string) must have the value 0. In any case, you don't need to worry about such things as my DLL takes care of all the string processing for you.

Paul

Posted

I'm pretty certain it's not because of getting the offset size wrong. I can't say why it doesn't show in full screen though - Pete will have to address that.

Yes, it doesn't mean place a character '0' at the end, it means the last byte in the character array (string) must have the value 0. In any case, you don't need to worry about such things as my DLL takes care of all the string processing for you.

Paul

Oh ok, thanks for that info, Paul. I am all set, the text display works BUT only in windowed screen. Now I just need to figure out why it won't display in full screen. :-( Hopefully Pete will have a solution.

Posted

Oh ok, thanks for that info, Paul. I am all set, the text display works BUT only in windowed screen. Now I just need to figure out why it won't display in full screen. :-( Hopefully Pete will have a solution.

It's always worked okay in either mode. Are you sure it isn't there but sized wrongly or off-screen? FS keeps a record of the window size and position in the FLT files, so it could be different for each saved flight. See the section like

[Message Window]

Undocked=False

ScreenUniCoords=64, 200, 8064, 435

UndocCoords=0, 0, 0, 0

Note that you can't normally have an Undocked window in full screen mode -- maybe that's your problem?

Pete

Posted

It's always worked okay in either mode. Are you sure it isn't there but sized wrongly or off-screen? FS keeps a record of the window size and position in the FLT files, so it could be different for each saved flight. See the section like

[Message Window]

Undocked=False

ScreenUniCoords=64, 200, 8064, 435

UndocCoords=0, 0, 0, 0

Note that you can't normally have an Undocked window in full screen mode -- maybe that's your problem?

Pete

Ok Pete,

I am using the PMDG 737 for FS9 and when I check the FLT file for the previous flight, it shows this entry:

[Message Window]

Undocked=False

ScreenUniCoords=64, 200, 8064, 100

UndocCoords=0, 0, 0, 0

Any thoughts?

Posted

I am using the PMDG 737 for FS9 and when I check the FLT file for the previous flight, it shows this entry:

[Message Window]

Undocked=False

ScreenUniCoords=64, 200, 8064, 100

UndocCoords=0, 0, 0, 0

Any thoughts?

No, other than the strange coincidence that it is almost identical to the one I found. Weird.

Try deleting that section altogether so it gets a default size and position.

The window used is the same one as used by FS's own ATIS and other notifications. Do you not see those either?

That is, unless you are using a mult-line message? I think that might mbe a different one. are there any more similar sections?

Pete

Posted

No, other than the strange coincidence that it is almost identical to the one I found. Weird.

Try deleting that section altogether so it gets a default size and position.

The window used is the same one as used by FS's own ATIS and other notifications. Do you not see those either?

That is, unless you are using a mult-line message? I think that might mbe a different one. are there any more similar sections?

Pete

I deleted ALL FLT files and let FS rebuild one when I booted it up. Still the same issue. It will display the text when in windowed mode. But when it's in full-screen mode, it will not display the text. This is really weird. Don't know what else to check or do. And no, I'm not using a multi-line message. It's just a small text about 30 characters long. I even made sure the show ATC messages is ENABLED in the FS settings.

Posted

I deleted ALL FLT files and let FS rebuild one when I booted it up. Still the same issue. It will display the text when in windowed mode. But when it's in full-screen mode, it will not display the text. This is really weird. Don't know what else to check or do. And no, I'm not using a multi-line message. It's just a small text about 30 characters long. I even made sure the show ATC messages is ENABLED in the FS settings.

Strange. Can you please detail exactly what you are writing to where and i'll check again here. There are lots of add-ons using this facility, so if anything had happened to it I would have expected to hear by now. I haven't used FS9 for many years now, but i can still run it on one machine.

I can't look at it further till tomorrow (Friday) now, though.

Pete

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.