Jump to content
The simFlight Network Forums

FS2004 BGL file structure


Afin
 Share

Recommended Posts

hi pete and everyone,

I'm glad to know you Pete. You are genius and really kind. :)

I'm trying to understanding the bgl file structure in fs2004. I have read analysis about new bgl file structure from Winfried Orthmann:

http://www.scenery.org/_downloads/newbgucture.zip.

There are thing I want to ask, about the ICAO data type coding.

It's said on the "newbglfilestructure.pdf":

ICAO Identifiers and region codes are coded in a special format. Each number and letter has a value from 0 .. 37:

blank = 00

digits 0 .. 9 = 02 .. 11

letters A .. Z = 12 .. 37

The code is calculated by starting from left: the value of the first digit/letter is multiplied by 38, then the value of the next digit/letter to the right is added, the sum s multiplied by 38, and as long as there are more digits/letters this process is repeated. The region codes have only 2 digits/letters and the result is used as such; for the ICAO identifiers for airports, ILS, VOR, NDB and waypoints there are up to 5 digits/letters, and the result is shifted left by 5 positions, i.e. multiplied by 0x20. Bits 0 .. 4 of the resulting DWORD are frequently used for other purposes.

The ICAO identifiers for primary and secondary ILS in a runway record are not shifted.

I am trying to decompile the bgl file with the airport ICAO code "WIPR" and found the coded dword on the bgl is "03 9D 93 E1". And then I am manually calculated the coded dword for "WIPR" And here is my calculation:

value of "W"= 34

value of "I"= 20

value of "P"= 37

value of "R"= 39

(34* 38 )= 1292 + 20 = 1312*38 = 49856 +37 = 49893*38=1895934+39=

1895973 * 38 = 72046974(decimal) = 44B597E (hexadecimal) shift left by 5 = 896B2FC0 (result).

The result is really different with the coded dword I found on the bgl. Is there something I've done wrong?

Pete, can you give more explanation about ICAO data type coding? How "WIPR" coded so that it become ""03 9D 93 E1"? I have also attach the bgl file I used on this post.

Thank you very much,

Arifin

Sorry for my bad English.

AF2_WIPR.zip

Link to comment
Share on other sites

I am trying to decompile the bgl file with the airport ICAO code "WIPR" and found the coded dword on the bgl is "03 9D 93 E1". And then I am manually calculated the coded dword for "WIPR" And here is my calculation:

value of "W"= 34

value of "I"= 20

value of "P"= 37

value of "R"= 39

Check your arithmetic.

P = 37, following W? I think not. Try 27. Likewise 29 for R.

Also you don't need to multiply the last result by 38 as there is no more to follow.

34 x 38 = 1292, +20 = 1312, x 38 = 49856

+ 27 = 49883, x 38 = 1895554, + 29 = 1895583.

1895583 in hex is 1CEC9F, shift left 5 (x 32) = 039D93E0

You say you found 039D93E1, but obviously the '1' at the end comes from something else as it cannot result from a shift left of 5 bits. As your extract says "Bits 0 .. 4 of the resulting DWORD are frequently used for other purposes."

Regards,

Pete

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • 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.