Page 1 of 1

Nulled out tags

Posted: Sat Jan 12, 2008 10:12 pm
by Patrickh
so im looping through metadata, searching for tag IDs that i can recognize (loading dependencies) but i have a problem. I found out how to load nulled out dependencies, but when loading nulled out lone IDs, how do i tell what class they are supposed to be? HHT does this and I'm wondering how. Do i need to hardcode some offsets based off of tagmaps or can it be determined from the map file? if you haven't noticed, im talking about halo 1 (pc). Any help would be appreciated :wink:

Posted: Sun Jan 13, 2008 2:14 am
by shade45
There should be a 4 char string right before the ID which will tell you the tag type.

Re: Nulled out tags

Posted: Sun Jan 13, 2008 3:35 am
by Prey
Patrickh wrote:but when loading nulled out lone IDs
Anyway, this would definitely be loaded from some sort of plugin.. I see no other way of getting the class from just a -1.

Posted: Sun Jan 13, 2008 11:38 am
by Patrickh
thanks guys

New question:

what's wrong with this meta injector?
im injecting valid metas and they don't inject correctly. I've just been reading a byte from the selected file, then writing it into the map, looping through all the bytes in the meta
heres my code:

Code: Select all

 Private Sub InjectMeta()

        Dim metaoffset As Int32
        Dim tagmetasize As Int32
        class1 = ClassA.SelectedItem.ToString
        metaoffset = Val("&H" & tagMetaOffset.Text)
        tagmetasize = txtTagmetasize.Text
        Dim ofd As New OpenFileDialog
        ofd.Filter = "[" & class1 & "] tag. (*." & class1 & ")|*." & class1 & "|[" & class1 & "] tag. (*." & class1 & ".meta)|*." & class1 & ".meta"
        ofd.Title = "Meta Injection"
        If ofd.ShowDialog <> Windows.Forms.DialogResult.Cancel Then
            Dim br As New IO.BinaryReader(New IO.FileStream(ofd.FileName, IO.FileMode.Open, IO.FileAccess.Read))
            Dim bw As New IO.BinaryWriter(New IO.FileStream(map_location, IO.FileMode.Open, IO.FileAccess.Write))
            For i As Integer = 0 To tagmetasize - 1
                br.BaseStream.Position = i
                Dim byteval As Byte
                byteval = br.ReadByte
                bw.BaseStream.Position = metaoffset + i
                bw.Write(byteval)
            Next
            bw.Close()
            br.Close()
            MsgBox("Meta Injection Complete.")
        End If

    End Sub
what am i doing wrong?

Posted: Sun Jan 13, 2008 1:31 pm
by Prey
"metaoffset = Val("&H" & tagMetaOffset.Text) "

I think this may be it.. are you sure tagMetaOffset.Text is in hexadecimal format? And if it is, are you sure it doesn't already have the "0x" prefix?

Posted: Sun Jan 13, 2008 2:53 pm
by Patrickh
Prey wrote:"metaoffset = Val("&H" & tagMetaOffset.Text) "

I think this may be it.. are you sure tagMetaOffset.Text is in hexadecimal format? And if it is, are you sure it doesn't already have the "0x" prefix?
well tagMetaOffset.Text diplays the tags meta offset converted to hex, so metaoffset should wind up equalling it converted back to dec
also, i used the same line in my extractor, which reads from that offset, and the extractor works perfectly. Heres the code for my extractor:

Code: Select all

 
            Dim metaoffset As Int32
            Dim tagmetasize As Int32

            class1 = ClassA.SelectedItem.ToString
            metaoffset = Val("&H" & tagMetaOffset.Text)
            tagmetasize = txtTagmetasize.Text
            Dim sfd As New SaveFileDialog
            sfd.Filter = "[" & class1 & "] tag. (*." & class1 & ")|*." & class1
            sfd.Title = "Meta Extraction"
            If sfd.ShowDialog <> Windows.Forms.DialogResult.Cancel Then
                Dim br As New IO.BinaryReader(New IO.FileStream(map_location, IO.FileMode.Open, IO.FileAccess.Read))
                Dim bw As New IO.BinaryWriter(New IO.FileStream(sfd.FileName, IO.FileMode.Create, IO.FileAccess.Write))
                For i As Integer = 0 To tagmetasize - 1
                    br.BaseStream.Position = metaoffset + i
                    Dim byteval As Byte
                    byteval = br.ReadByte
                    bw.BaseStream.Position = i
                    bw.Write(byteval)
                Next
                br.Close()
                bw.Close()
                MsgBox("Meta Extraction Complete.")
            End If
thanks for the help

Posted: Sun Jan 13, 2008 3:00 pm
by Prey
Meh. It's all I can see that is wrong. Use a breakpoint or Msgbox to make sure it definitely converts to the correct meta offset.

Posted: Sun Jan 13, 2008 4:00 pm
by Patrickh
Prey wrote:Meh. It's all I can see that is wrong. Use a breakpoint or Msgbox to make sure it definitely converts to the correct meta offset.
that is strange... i added this to the end of the injection code:

Code: Select all

MsgBox("Meta Injection Complete. Meta offset: " & Hex$(metaoffset))
and it displayed the proper offset :?
I'll post the answer here when i figure out what's up.

edit: ok, what's happening is that i extract the pelican's meta, then inject it back in. when i reload the map and click on the tag, it loads a bunch of dependencies i don't recognize, that definately don't belong to the pelican. The wierd part: i extract the meta from the wierd tag and it extract the tags metadata perfectly accurately... so i guess the problem is how it's loading the dependencies, but it displays the metaoffset and metasize correctly, so scanning for dependencies should be any different since the meta is apparently the same. :(
If you guys have any ideas of whats up, that'd be great. otherwise ill just fiddle with it