That TileMgr.cpp file definitely helped, I can extract the level 9 textures and name them according to their Latitude/Longitude, but I'm still having trouble with the level 10 and level 11 textures. The formula I'm using to identify which tile belongs where is based on the patch templates in the GlobalInit function, and it seems to work for identifying where each patch belongs where for the level 9 portion of the file, but it's not working for the level 10 and level 11 portion.
BTW, anybody know what the subtile indices in the .bin file refers to?
As far as I understand it, subtile indices (subidx[4]) are indexes of TILEFILESPEC structs of 4 next level tiles. So L9 tilefilespec has subidx[4] that are offsets for 4 L10 tilefilespec structs, which have their own subidx[4] array that are offsets for 4 L11 tfs structs. If subidx[j] == 0 then that subtile's tfs doesn't exists.
indexes for subtiles and their position in tile:
0, 1
2, 3
subtiles in the upper row should have ilat % 2 = 1, and subtiles in the right row should have ilng % 2 = 1
If you want to get L11 tile texture with, for example (ilat = 58 or 81.56 deg., nlat = 8*2*2*2 = 64 , ilng = 33 or 247.5 deg (67.5 deg E) nlng = NLNG[7]*2*2*2 = 48 ).
L10:
58 % 2 = 0, 58 / 2 = 29 ilat for L10
33 % 2 = 1, 33 / 2 = 16 ilat for L10
so this L11 tile have subidx = 3
L9:
29 % 2 = 1, 29 / 2 = 14
16 % 2 = 0, 16 / 2 = 8
L10 tile is a subtile of L9 tile with index 0
L8:
14 % 2 = 0, 14 / 2 = 7 [1st row]
16 % 2 = 0, 8 / 2 = 4 [5th of 364]
previous L9 tile is a subtile of this tile with index 2
so, TILEFILESPEC struct for that L11 tile can be found (if all these tiles exist) as = tfs[ tfs[ tfs[ tfs[4].subidx[2] ].subidx[0] ].subidx[3] ]. then you can get texture offset in Planet_tile.tex from tidx or midx. (if they not == NOTILE, i.e. 0xFFFFFFFF )