Hi ScruffyDuck,
when decompiling file 'Scenery\World\Scenery\bvcf.bgl', SDE seems to hang in an endless loop. I had the same problem in my own decompiling code, but now it works. Here is how i decompile bgl files with boundary sections:
I assume you used Winfried Orthmanns BGL file structure description document, too. So i will only describe where my code differs from his doc.
The fixed part of the boundary record ends with "maximumAltitude" (offset 28, size 4), so the size of the fixed part boundary record is 32. After that follows a table of subrecords, similar to the subrecords in airports.
The following subrecords are possible:
- id 0x19: name
- id 0x21: point list
- id 0x12: COM
- id 0x00: end of subrecord table
The described structure of the name subrecord is correct, however it is not always the first subrecord. Sometimes its missing at all.
The point list subrecord is almost correct, except for the field "type of point", which is only one instead of two bytes. The second byte holds the "origin index" (see SDK docs) instead.
The COM subrecord has exactly the same structure as the COM subrecord of airports.
The end of the subrecord table is marked by an id with the value 0x00. Nothing else follows, not even the usual subrecord size field. After reading id = 0, the file seek position is right after the end of the whole boundary record (as calculated from the boundary records size field).
Since i dont know the sequence of subrecords, i use a loop after the fixed part of the boundary record. In the loop, i read the subrecord id, and then i use switch/case statement to read the remaining part of the subrecord.
I tried my code with ALL bgl files of the FSX Deluxe edition. I didnt found any further errors nor any other boundary subrecord types.
However, there are a few duplicate boundaries and geopols:
- BNXWorld0.bgl: boundaries: 7908 unique + 6 duplicates
- BNXWorld1.bgl: boundaries: 9136 unique + 7 dups; geopols: 49 unique + 18 dups
- BNXWorld2.bgl: geopols: 332 unique + 153 dups
- BNXWorld3.bgl: geopols: 361 unique + 170 dups
- BNXWorld4.bgl: geopols: 327 unique + 182 dups
- BNXWorld5.bgl: geopols: 34 unique + 16 dups
- bvcf.bgl: boundaries: 4201 unique + 0 dups
I havent figured out yet why there are so many dups.
If you need further info, just yell ..
By the way, what programming language are you using for SDE ?
I am using C# for my decompiling stuff.
when decompiling file 'Scenery\World\Scenery\bvcf.bgl', SDE seems to hang in an endless loop. I had the same problem in my own decompiling code, but now it works. Here is how i decompile bgl files with boundary sections:
I assume you used Winfried Orthmanns BGL file structure description document, too. So i will only describe where my code differs from his doc.
The fixed part of the boundary record ends with "maximumAltitude" (offset 28, size 4), so the size of the fixed part boundary record is 32. After that follows a table of subrecords, similar to the subrecords in airports.
The following subrecords are possible:
- id 0x19: name
- id 0x21: point list
- id 0x12: COM
- id 0x00: end of subrecord table
The described structure of the name subrecord is correct, however it is not always the first subrecord. Sometimes its missing at all.
The point list subrecord is almost correct, except for the field "type of point", which is only one instead of two bytes. The second byte holds the "origin index" (see SDK docs) instead.
The COM subrecord has exactly the same structure as the COM subrecord of airports.
The end of the subrecord table is marked by an id with the value 0x00. Nothing else follows, not even the usual subrecord size field. After reading id = 0, the file seek position is right after the end of the whole boundary record (as calculated from the boundary records size field).
Since i dont know the sequence of subrecords, i use a loop after the fixed part of the boundary record. In the loop, i read the subrecord id, and then i use switch/case statement to read the remaining part of the subrecord.
I tried my code with ALL bgl files of the FSX Deluxe edition. I didnt found any further errors nor any other boundary subrecord types.
However, there are a few duplicate boundaries and geopols:
- BNXWorld0.bgl: boundaries: 7908 unique + 6 duplicates
- BNXWorld1.bgl: boundaries: 9136 unique + 7 dups; geopols: 49 unique + 18 dups
- BNXWorld2.bgl: geopols: 332 unique + 153 dups
- BNXWorld3.bgl: geopols: 361 unique + 170 dups
- BNXWorld4.bgl: geopols: 327 unique + 182 dups
- BNXWorld5.bgl: geopols: 34 unique + 16 dups
- bvcf.bgl: boundaries: 4201 unique + 0 dups
I havent figured out yet why there are so many dups.
If you need further info, just yell ..
By the way, what programming language are you using for SDE ?
I am using C# for my decompiling stuff.