Karli D Posted August 19, 2021 Report Posted August 19, 2021 (edited) Hi John, I came across strange behavior while reading offstes 09D21 and 0B26 (0618 will probably have the same issue, but didn't check that yet). Already discussed that with Paul Henty, and his guess is, that the 0 terminator isn't being written at the end of the string. The video explains what happens: Here's also the code - it's rather simple: public partial class Form1 : Form { private Offset<string> ICAOmanufacturer = new Offset<string>("Aircraft", 0x09D2, 16); private Offset<string> ICAOModel = new Offset<string>("Aircraft", 0x0B26, 32); public Form1() { InitializeComponent(); } private void Button1_Click(object sender, EventArgs e) { // Connect to FSUIPC try { if (!FSUIPCConnection.IsOpen) { FSUIPCConnection.Open(); button1.Enabled = false; } else { FSUIPCConnection.Close(); } } catch { // NO FSUIPC running } } private void Button2_Click(object sender, EventArgs e) { try { FSUIPCConnection.Process("Aircraft"); tbOutput.AppendText($"Manufacturer: {ICAOmanufacturer.Value}\r\nModel: {ICAOModel.Value}\r\n\r\n"); } catch(Exception ex) { tbOutput.Text = $"Exception: {ex.Message}"; } } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { FSUIPCConnection.Close(); } } Something is messed up and I'm not able to read the manufacturer name and the model correctly. Thank you. -EDIT- I confirm that 0618 (ICAO designator) has the same issue. Most aircraft has a 4 letter/digits designator, so the issue doesn't show up. But the Icon A5 has a shorter designator and here one can see the issue also. Edited August 19, 2021 by Karli D Checked the offset
John Dowson Posted August 22, 2021 Report Posted August 22, 2021 On 8/19/2021 at 3:42 PM, Karli D said: Already discussed that with Paul Henty, and his guess is, that the 0 terminator isn't being written at the end of the string. Yes, this is correct. I will update to add the 0 terminator to all 3 offsets when updated. Note also that I haven't really tested FSUIPC when changing aircraft using the dev menu facilities. I'm not sure the correct events are being received by FSUIPC changing aircraft this way. I'll take a look at this at some point, bit it may take me a while (low priority).
John Dowson Posted August 22, 2021 Report Posted August 22, 2021 2 hours ago, John Dowson said: I will update to add the 0 terminator to all 3 offsets when updated. Please try the attached version, v7.2.7c: FSUIPC7.exe
Karli D Posted August 22, 2021 Author Report Posted August 22, 2021 6 hours ago, John Dowson said: Please try the attached version, v7.2.7c: FSUIPC7.exe The 0 terminator works now. Thank you, John. But... - really sorry for being such a pain in the backend - the variables are not accessible the whole time now. Can't tell if that was the case before.Now I get the values just while in the main menu, but when I load the flight, they're gone! The only way to get the values then, is to switch the aircraft via the dev menu or to go back to the main menu. Of course I understand, that this is not a priority thing. I think I will try to use the title variable to achieve, what I need - the designator thingy doesn't work for all aircraft tho. But anyway, thought I'll report the outcome to you. Thanks for your efforts.
John Dowson Posted August 23, 2021 Report Posted August 23, 2021 14 hours ago, Karli D said: Now I get the values just while in the main menu, but when I load the flight, they're gone! Very strange. I'll take a look later this afternoon and get back to you. John
John Dowson Posted August 23, 2021 Report Posted August 23, 2021 I've taken a look at this and this is what I have found: - when available, the ICAO designator, manufacturer and model strings (available in offsets 0x0618, 0x09D2 and 0x0B26 respectively) are enclosed in double quotes - I have removed these in the attached version - when starting FSUIPC7 when MSFS is already running with an aircraft loaded (i.e. out of main menu), only a partial path (from the SimObjects folder) for the aircraft.cfg file is passed given, and it is not possible to determine the complete path. In such circumstances, the offsets will be empty. You can enable logging for Extras, which will show the path to the aircraft.cfg as received from MSFS (in your FSUIPC7.log file). This is a known issue and was reported to Asobo over a year ago now. - even when the full path name is received, it is sometimes not possible to read the aircraft.cfg file. This applies to Deluxe and Premium content aircraft (and maybe also add-ons), as the files are encrypted for such content. Again, this is a known issue and I don't think there will be a way around this. Note that this is actually documented in the offset status spreadsheet for those offsets: Read from aircraft.cfg file (only available when 0x3C00 contains the full path to this file, and the file is readable) So I'm afraid that there is not much more I can do about these offsets, pending further updates from Asobo, sorry. However, note that the ATC Model and Type are also available in offsets 0x3500 and 0x3160. You may be able to use those, but they are currently prefixed by TT:ATCCOM.AC_MODEL for 0x3500 TT:ATCCOM.ATC_NAME for 0x3160 It is on my list to look into this, to see if I can remove those unneeded prefixes, or maybe to use the specific language localisation package files that come with each aircraft, e.g. here's the contents of the en-Us.locPak file for the C152: Quote { "LocalisationPackage": { "Language": "en-US", "Strings": { "AIRCRAFT.DESCRIPTION": "With the Model 150 and its successor, the 152, Cessna created the most popular civilian training aircraft in the post-WW2 era. With the 152 Aerobat, they made a few key tweaks to the design and gave pilots a taste of barnstorming.<\/br><\/br>From 1978 to 1985, the Wichita, Kansas company manufactured 315 of the 152 Aerobats, single-engine two-seat monoplanes with strengthened fuselages, full harnesses, quick release doors, and cabin skylight windows for safe aerobatic flight.<\/br><\/br>In addition to the plane's greater structural strength, designed to withstand up to 6Gs positive and 3Gs negative force, the Aerobat injects fuel evenly into all four cylinders of its stock Lycoming 0-325 engine, for prompt ignition and combustion.<\/br><\/br>What does it all add up to? Legendary Cessna 152 performance, and the ability to pull off barrel rolls, lazy eights and Immelmanns to your heart's content.", "AIRCRAFT.UI_MANUFACTURER": "Textron Aviation", "AIRCRAFT.UI_MODEL": "Cessna 152 Aerobat" } } } There could still be issues with this for Premium/Delux/add-on content though, not sure yet. This is on my list to investigate, probably starting around mid-September. Latest build attached. John FSUIPC7.exe
Karli D Posted August 31, 2021 Author Report Posted August 31, 2021 Thank you very much for your efforts. I think now I found a way to identify the loaded aircraft. As for now it works well and I hope I can work with it for a while.
John Dowson Posted August 31, 2021 Report Posted August 31, 2021 5 hours ago, Karli D said: I think now I found a way to identify the loaded aircraft. Could you expand on this please?
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