I am working on an application. I need to access meta data. I have successfully calculated the secondary magic. And I understand that the data location is the following:
start of the meta + meta offset + value offset
However, I have found conflicting reports of how to calculate the meta start. One involved subtracting the secondary magic from the meta offset. This makes no sense to me.
I have also been told that one simply adds the secondary magic to the meta offset; however, the secondary magic is greater than the file size. On the other hand, the output of the secondary magic matches the output of DotHalo.
So, what gives?
Meta Access Information
Ok, first of all there are some values you need to take frm the Header:
Then you goto the index and this is where you get the secondaryMagic:
Then you read all the tagInfo from the index and subtract the secondaryMagic frm the raw offset each time:
Now w/e you need to access the meta of a tag you just need to go to its stored offset - 'br.BaseStream.Position = tagsList[45].MetaOffset;'
Code: Select all
br.BaseStream.Position = 16;
//the offset of the index
indexOffset = br.ReadInt32();
//the total length in bytes of the index
indexSize = br.ReadInt32();
//the start of the meta (straight after the index)
metaStart = indexOffset + indexSize;
//the total length in bytes of the meta
metaSize = br.ReadInt32();
//MetaSize + index Size + BSP Size
nonRawSize = br.ReadInt32();
Code: Select all
//start of tags + 8 (skips matg tags tagtype and ident)
br.BaseStream.Position = offsetOfObjectIndex + 8;
//constant is raw meta offset of matg tag
secondaryMagicConstant = br.ReadInt32();
secondaryMagic = secondaryMagicConstant - map.header.metaStart;
Code: Select all
for (int x = 0; x < map.index.objectCount; x++)
{
//this is the tagtype, they are backward in map so we reverse
string tt = map.Reverse(new string(br.ReadChars(4)));
//if its not in the list add it
if (!tagTypes.Contains(tt)) tagTypes.Add(tt);
//and this is the rest of the info
tagsList[x].Type = tt;
tagsList[x].Ident = br.ReadInt32();
tagsList[x].MetaOffset = br.ReadInt32() - map.index.secondaryMagic;
tagsList[x].MetaSize = br.ReadInt32();
}
Halo 2 Prophet - Skin with ease with the simple 3D point and click interface.
Halo 3 Research Thread - Contribute to the research into Halo 3.
Halo 3 Research Thread - Contribute to the research into Halo 3.