Even92LN Posted January 13, 2014 Report Posted January 13, 2014 One of my beta testers that are using FS9 get some very trange begaviour from the aircraft type offset 3D00. Using this code: int typeToken = 0; byte[] type = new byte[256]; fsuipc.FSUIPC_Read(0x3D00, 256, ref typeToken, ref dwResult); fsuipc.FSUIPC_Process(ref dwResult); fsuipc.FSUIPC_Get(ref typeToken, 256, ref type); "New aircraft" is written each time the aircraft type changes, and the tester has been using the same aircraft during the entire flight. This is the log: [18:39] Aircraft: Nor738anawk 172SP[18:39] New aircraft: Nor738D (BERGEN)SP[18:39] New aircraft: Nor738BERGEN)N)SP[18:43] New aircraft: Nor738 AEN)N)SP[18:43] New aircraft: Nor738D (BERGEN)SP[18:47] New aircraft: Nor738BERGEN)N)SP[18:51] New aircraft: Nor738anEN)N)SP[18:51] New aircraft: Nor738BERGEN)N)SP[18:51] New aircraft: Nor738 AEN)N)SP[18:51] New aircraft: Nor738D (BERGEN)SP[18:51] New aircraft: Nor738BERGEN)N)SP[18:55] New aircraft: Nor738 AEN)N)SP[18:55] New aircraft: Nor738D (BERGEN)SP[18:56] New aircraft: Nor738anERGEN)SP[18:56] New aircraft: Nor738D (BERGEN)SP[18:59] New aircraft: Nor738BERGEN)N)SP[19:02] New aircraft: Nor738anEN)N)SP[19:02] New aircraft: Nor738BERGEN)N)SP[19:03] New aircraft: Nor738 AEN)N)SP[19:03] New aircraft: Nor738D (BERGEN)SP[19:03] New aircraft: Nor738BERGEN)N)SP[19:05] New aircraft: Nor738anEN)N)SP[19:05] New aircraft: Nor738BERGEN)N)SP[19:07] New aircraft: Nor738 AEN)N)SP[19:07] New aircraft: Nor738D (BERGEN)SP[19:08] New aircraft: Nor738anERGEN)SP[19:08] New aircraft: Nor738D (BERGEN)SP[19:11] New aircraft: Nor738BERGEN)N)SP[19:11] New aircraft: Nor738ERGEN)N)SP[19:15] New aircraft: Nor738AEN)N)SP[19:15] New aircraft: Nor738 AEN)N)SP[19:15] New aircraft: Nor738BERGEN)N)SP[19:15] New aircraft: Nor738anEN)N)SP[19:15] New aircraft: Nor738BERGEN)N)SP[19:19] New aircraft: Nor738AEN)N)SP[19:21] New aircraft: Nor738anEN)N)SP[19:21] New aircraft: Nor738AEN)N)SP[19:21] New aircraft: Nor738 AEN)N)SP[19:23] New aircraft: Nor738anEN)N)SP[19:23] New aircraft: Nor738 AEN)N)SP[19:23] New aircraft: Nor738anEN)N)SP[19:23] New aircraft: Nor738 AEN)N)SP[19:24] New aircraft: Nor738anEN)N)SP[19:41] New aircraft: Nor738 09EN)N)SP[19:42] New aircraft: Nor738anEN)N)SP[19:42] New aircraft: Nor738 09EN)N)SP[19:42] New aircraft: Nor738anEN)N)SP[19:42] New aircraft: Nor738 09EN)N)SP[19:45] New aircraft: Nor738anEN)N)SP[19:45] New aircraft: Nor738 09EN)N)SP[19:55] New aircraft: Nor738anEN)N)SP[19:55] New aircraft: Nor738 09EN)N)SP[19:58] New aircraft: Nor738anEN)N)SP[19:58] New aircraft: Nor738 09EN)N)SP I have not experienced this in my FS9. He has no problem with FSX. Any idea what might cause this?
Pete Dowson Posted January 14, 2014 Report Posted January 14, 2014 Any idea what might cause this? I don't know that code (it isn't C or ASM, the languages I understand) -- but from the output shown it looks like the "type" string for that aircraft is Nor738 and for some reason the terminating zero is being ignored in the code being used. Tell him to use FSUIPC's Monitor to log it, or to use FSInterogate. The data after the terminating zero is not relevant to the field's purpose. What is the actual problem in any case? Pete
Even92LN Posted January 15, 2014 Author Report Posted January 15, 2014 Thanks for reply, Pete! "Nor738" is the actual aircraft name, but for some reason it's mixed with VOR names (?) and other aircrafts.. The problem is that my application is supposed to log and notify the virtual airline each time the pilot change aircraft (in other words: each time the aircraft string change). I'm writing in C#. This is the complete code: int typeToken = 0; fsuipc.FSUIPC_Read(0x3D00, 256, ref typeToken, ref dwResult); fsuipc.FSUIPC_Process(ref dwResult); byte[] type = new byte[256]; if (fsuipc.FSUIPC_Get(ref typeToken, 256, ref type)) { string tmp = System.Text.Encoding.ASCII.GetString(type).TrimEnd('\0'); if(tmp.Length > 1) current_aircraft = tmp; } I'm using String.TrimEnd('\0'); to remove all characters after the first terminating zero.
Pete Dowson Posted January 16, 2014 Report Posted January 16, 2014 Nor738" is the actual aircraft name, but for some reason it's mixed with VOR names (?) and other aircrafts. Sorry, I don't know C# so there's no way what you show tells me you have it correct. Therefore please use FSUIPC logging and FSInterrogate to check exactly what the offset contains and what you are reading. I did suggest that, but I assume you've not bothered to do this? Additionally that same field is used to select Profiles ad Aircraft Specific assignments and settings, which obviously would not work with a corrupted string as you are implying. The aircraft name, again from that offset, is also written to the FSUIPC log file (in the line "Aircraft=" each time it is changed -- check that too. There are several ways to cross-check it which you should use. If you do find any of these showing the same as your code, by all means show it to me. Then we'll need to look for possible causes, some sort of corruption in your specific FS9 system. Pete
Paul Henty Posted January 16, 2014 Report Posted January 16, 2014 I'm using String.TrimEnd('\0'); to remove all characters after the first terminating zero. There's your problem. That isn't what TrimEnd() does. It only removes the specified character if it's the last character(s) of the string. To remove everything after the \0 you need a bit more code... string tmp = System.Text.Encoding.ASCII.GetString(type); int pos = tmp.IndexOf('\0'); if (pos >= 0) { tmp = tmp.Remove(pos); } Paul
Pete Dowson Posted January 16, 2014 Report Posted January 16, 2014 There's your problem. That isn't what TrimEnd() does. It only removes the specified character if it's the last character(s) of the string. To remove everything after the \0 you need a bit more code.. Thanks for helping out here Paul! Pete
Even92LN Posted January 16, 2014 Author Report Posted January 16, 2014 @Paul: You are totally right, I will try that! @Pete: I have asked the tester with the problem to try the FSUIPC logger, but I haven't got any feedback yet. However, he found that it only happens when he's flying the iFly 737. I will wait and see if Paul's suggestion did the trick, otherwise I will ask him once again to try the FSUIPC logger. EDIT: looks like problem is solved! :) Thanks to both of you for your time!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now