Page 1 of 2

Offset Values

Posted: Sun Jan 13, 2008 11:37 pm
by Aumaan Anubis
Right, so I made an app, awhile ago, that can edit the bipd jump height value. I had used a tutorial to do it, so the code wasn't my own. I scanned through it, and saw that the offset for bipd jump height was 504.

I'd like to be able to find the offset for, say, the max and min ROF of a weapon. Or something else like that. I don't know much about Hex or Binary, including BinaryReaders, so I was wondering if there was a simple way.

Re: Offset Values

Posted: Sun Jan 13, 2008 11:45 pm
by Supermodder911
It is simple how I described on AIM. :!:

Re: Offset Values

Posted: Sun Jan 13, 2008 11:47 pm
by Aumaan Anubis
Aumaan Anubis wrote:Right, so I made an app, awhile ago, that can edit the bipd jump height value. I had used a tutorial to do it, so the code wasn't my own. I scanned through it, and saw that the offset for bipd jump height was 504.

I'd like to be able to find the offset for, say, the max and min ROF of a weapon. Or something else like that. I don't know much about Hex or Binary, including BinaryReaders, so I was wondering if there was a simple way.

Re: Offset Values

Posted: Mon Jan 14, 2008 12:42 am
by Grimdoomer
look in the plugin for the tag you want to edit, then find the value you wish to change and look at what struct it is in. You will need the offset of that struct and the offset of the value you wish to edit. Then you simply get the meta offset of the Tag after you select it of coarse then do:

Code: Select all

BR.BaseStream.Position = TagsMetaOffset + (structOffset + Value Offset)
And thats it. I think might want to run this by someone else.

Re: Offset Values

Posted: Mon Jan 14, 2008 1:45 am
by XZodia
dont forget to add the multiply of by the chunk size /end drunkensseses

Re: Offset Values

Posted: Mon Jan 14, 2008 3:13 am
by Aumaan Anubis
I honestly have no idea what you said grimdoomer.

I was hoping that there was an app where you'd type in a number and it'd be like, "That the max ROF of a weapon!" or something nice and easy like that.

But that's probably a little too much too hope for.

Re: Offset Values

Posted: Mon Jan 14, 2008 4:35 am
by OwnZ joO
Well there no real way to find the offset through a program, you should just look at a plugin to find the offset of the max rate of fire.

Re: Offset Values

Posted: Mon Jan 14, 2008 4:45 am
by Aumaan Anubis
That actually helps.

But both Weapon Pickup Distance and Minimum ROF share the same offset of 0x4. How do I distinguish between them?

Re: Offset Values

Posted: Mon Jan 14, 2008 12:42 pm
by XZodia
? values cant share an offset

Re: Offset Values

Posted: Mon Jan 14, 2008 12:50 pm
by neodos
Yes they do, hmm, chunks can be shared in another tag, reflexives too, i noticed that on wgit and skin, seems like same thing for vehi and weap.

Re: Offset Values

Posted: Mon Jan 14, 2008 1:28 pm
by Grimdoomer
He forgot the struct offset :? here

Code: Select all

<struct name="Magazine" offset="704" visible="true" size="92" label="">
    <bitmask32 name="Flags" offset="0" visible="True">
      <option name="Wastes rounds when reloaded" value="1" />
      <option name="Every round must be chambered" value="2" />
    </bitmask32>
    <short name="Rounds Recharged (per second)" offset="4" visible="True" />
    <short name="Initial Rounds" offset="6" visible="True" />
    <short name="Max Rounds" offset="8" visible="True" />
    <short name="Max Rounds Loaded" offset="10" visible="True" />
    <int name="Max Rounds Held" offset="12" visible="True" />
    <float name="Reload Time(seconds)" offset="16" visible="False" />
    <int name="Rounds Reloaded" offset="20" visible="True" />
    <float name="Chamber Time(seconds)" offset="24" visible="True" />
    <unused offset="28" size="24" />
    <tag name="Reloading Effect" offset="52" visible="True" />
    <id name="Reloading Effect" offset="56" visible="True" />
    <tag name="Chambering Effect" offset="60" visible="True" />
    <id name="Chambering Effect" offset="64" visible="True" />
    <tag name="Unused" offset="68" visible="False" />
    <id name="Unused" offset="72" visible="False" />
    <tag name="Unused" offset="76" visible="False" />
    <id name="Unused" offset="80" visible="False" />
    <struct name="Magazines" offset="84" visible="true" size="12" label="">
      <int name="Rounds" offset="0" visible="True" />
      <tag name="Equipment" offset="4" visible="True" />
      <id name="Equipment" offset="8" visible="True" />
    </struct>
  </struct>
thats the part you need to look at, the struct offset is 704, and intial rounds offset is 6. All you do is get the metaoffset of the tag, and goto the struct offset. Then you read the chunkcount there, then advance byt the offset of the intial rounds wich is 6:

Code: Select all

BR.BaseStream.Posistion = TagsMetaOffset + 704
ChunkCount = BR.Readint32
BR.BaseStream.Position += 6
InitialRounds = BR.ReadShort
Thats it.

Offset Values

Posted: Mon Jan 14, 2008 10:15 pm
by Aumaan Anubis
I'm not a programming master, so I'll just post my source.
Keep in mind, this isn't the code related to the controls on the form, and therefore I have absolutely no idea what's happening.

Code: Select all

Imports System.IO
Public Class H2Map


    Public Structure Halo2Map
        'Basic Map Info
        Public MapLocation As String
        Public MapLoaded As Boolean
        Public H2Tag() As H2Tag
        Public mapMagic As Long
        Public mapSecondaryMagic As Long
        Public mapName As String
        'Basic header Info
        Public indexOffset As Long
        Public indexSize As Long
        Public metaSize As Long
        Public fileTableOffset As Long
        'Basic Index Info
        Public primaryMagicConstantMagic As Long
        Public objectIndexOffset As Long
        Public objectCount As Long
        Public Sub LoadH2Map()
            Dim BR As New BinaryReader(New FileStream(MapLocation, FileMode.Open, FileAccess.Read, FileShare.Read))
            BR.BaseStream.Position = 16
            indexOffset = BR.ReadInt32()
            indexSize = BR.ReadInt32()
            metaSize = BR.ReadInt32()
            BR.BaseStream.Position = 708
            fileTableOffset = BR.ReadInt32()
            BR.BaseStream.Position = 408
            Dim tempcharforname As Char = " "
            Do While tempcharforname <> Chr(0)
                tempcharforname = BR.ReadChar
                If tempcharforname <> Chr(0) Then mapName &= tempcharforname
            Loop
            BR.BaseStream.Position = indexOffset
            primaryMagicConstantMagic = BR.ReadInt32()
            BR.BaseStream.Position += 4
            objectIndexOffset = BR.ReadInt32()
            BR.BaseStream.Position += 12
            objectCount = BR.ReadInt32()
            Dim TagStart As Long = indexOffset + 32 + (objectIndexOffset - primaryMagicConstantMagic)
            ReDim H2Tag(0 To objectCount + 1)
            BR.BaseStream.Position = TagStart
            For i As Integer = 1 To objectCount Step 1
                H2Tag(i).TagClass = StrReverse(BR.ReadChars(4))
                H2Tag(i).TagID = BR.ReadInt32()
                H2Tag(i).MetaOffset = BR.ReadInt32()
                H2Tag(i).MetaSize = BR.ReadInt32()
            Next
            mapMagic = H2Tag(1).MetaOffset - (indexOffset + indexSize)
            mapSecondaryMagic = primaryMagicConstantMagic - indexOffset - 32
            For i As Integer = 1 To objectCount Step 1
                H2Tag(i).MetaOffset = H2Tag(i).MetaOffset - mapMagic
            Next
            BR.BaseStream.Position = fileTableOffset
            For i As Integer = 1 To objectCount Step 1
                Dim tempchar As Char = " "
                Do While tempchar <> Chr(0)
                    tempchar = BR.ReadChar()
                    H2Tag(i).TagPath &= tempchar
                Loop
            Next
            BR.Close()


            MapLoaded = True
        End Sub
        Public Sub LoadIntoTreeView(ByVal TreeView1 As TreeView, ByVal ProgressBar1 As ProgressBar)
            TreeView1.Nodes.Add("Map(" & mapName & ")")
            TreeView1.Sorted = True
            ProgressBar1.Maximum = objectCount + 1
            ProgressBar1.Minimum = 0
            ProgressBar1.Value = 0
            Dim templistbox As New ListBox
            For x As Integer = 1 To objectCount Step 1
                'If the templistbox dosent have the class in it then add it to it and also add it to the treeview
                If templistbox.Items.Contains(H2Tag(x).TagClass) = False Then
                    templistbox.Items.Add(H2Tag(x).TagClass)
                    TreeView1.Nodes(0).Nodes.Add(BuildClassNode(H2Tag(x).TagClass))
                    Application.DoEvents()
                End If
                'Increase the Progressbar
                ProgressBar1.Value += 1
            Next
            'Dispose the templistbox
            templistbox.Dispose()

            'Expand the TreeView
            TreeView1.Nodes(0).Expand()

            'Reset the Progressbar to 0
            ProgressBar1.Value = 0
        End Sub
        Private Function BuildClassNode(ByVal tagClass As String)
            'create a temp TreeNode
            Dim ClassNode As New TreeNode

            'Set the text to the tagclass
            ClassNode.Text = "[" & tagClass & "]"

            'Loop through all the tags and if its of the class we want then add to the node
            For i As Integer = 1 To objectCount Step 1
                If H2Tag(i).TagClass = tagClass Then
                    ClassNode.Nodes.Add(H2Tag(i).TagPath)
                End If
            Next

            'return the node we put together
            Return ClassNode
        End Function
        Public Sub LoadIntoListBox(ByVal Listbox1 As ListBox, ByVal ProgressBar1 As ProgressBar, Optional ByVal TagClass As String = "")
            'Set up the ProgressBars
            ProgressBar1.Maximum = objectCount + 1
            ProgressBar1.Minimum = 0
            ProgressBar1.Value = 0
            'If they dont specify A tagClass then do all then if they do then do just that class
            If TagClass = "" Then
                'This will let you use a Listbox
                For i As Integer = 1 To objectCount Step 1
                    Listbox1.Items.Add(H2Tag(i).TagPath)
                    ProgressBar1.Value += 1
                Next
            Else
                'This will let you use a Listbox with only 1 tag class
                For i As Integer = 1 To objectCount Step 1
                    If H2Tag(i).TagClass = TagClass Then
                        Listbox1.Items.Add(H2Tag(i).TagPath)
                    End If
                    ProgressBar1.Value += 1
                Next
            End If
            ProgressBar1.Value = 0
        End Sub
        Public Function FindTagIndexByPath(ByVal TagPath As String) As Integer
            Dim index As Integer = 0
            'Loop through all the tags and if we find a matching path then we return then index of it
            For i As Integer = 1 To objectCount Step 1
                If H2Tag(i).TagPath = TagPath Then
                    index = i
                    Exit For
                End If
            Next
            Return index
        End Function
    End Structure
    Public Structure H2Tag
        Public TagID As Long
        Public TagClass As String
        Public MetaOffset As Long
        Public MetaSize As Long
        Public TagPath As String
    End Structure
End Class
Visual Basic, unfortunately.

Offset Values

Posted: Mon Jan 14, 2008 10:31 pm
by Grimdoomer
if this is anthonys source from his tut then please get the fuck out of here.

Offset Values

Posted: Mon Jan 14, 2008 10:43 pm
by XZodia
it certainly looks like it....

Offset Values

Posted: Mon Jan 14, 2008 10:47 pm
by Aumaan Anubis
Uhh why?

I used his tutorial.

Did I not give him credit or something?
Aumaan Anubis wrote:I'm not a programming master, so I'll just post my source.
Keep in mind, this isn't the code related to the controls on the form, and therefore I have absolutely no idea what's happening.
I thought that this would give it away that it's not mine...

Offset Values

Posted: Mon Jan 14, 2008 11:22 pm
by XZodia
well you refered to it as your source...and wat was the point in posting it anyway?

Offset Values

Posted: Mon Jan 14, 2008 11:26 pm
by Aumaan Anubis
My source was meant to be interpreted as the source I was using.

Offset Values

Posted: Mon Jan 14, 2008 11:32 pm
by Prey
:/

Whoever's source it is.. it is terrible...

Offset Values

Posted: Mon Jan 14, 2008 11:33 pm
by Supermodder911
Tis anthonys.

Offset Values

Posted: Mon Jan 14, 2008 11:41 pm
by Aumaan Anubis
Yeah Prey, this is the source for the application I was making awhile back that you helped me with when I got like, tons of errors. It is Anthony's.

Hey, if anyone wants to write a new tut for C# on making a simple app, please, go ahead.
I'll be able to scan the code and hopefully further my minimal knowledge.

Offset Values

Posted: Mon Jan 14, 2008 11:42 pm
by XZodia

Offset Values

Posted: Mon Jan 14, 2008 11:46 pm
by Aumaan Anubis
Really? Is that what that is?

Sweet, I'll take a look at it.

Offset Values

Posted: Mon Jan 14, 2008 11:50 pm
by Aumaan Anubis
Ooook, slighty(majorly) too advanced for me to comprehend.

I'll keep doing stuff and come back to it later.

Offset Values

Posted: Tue Jan 15, 2008 12:04 am
by XZodia
lol years of experience went into that dll and its still crap imo

Offset Values

Posted: Tue Jan 15, 2008 12:33 am
by Grimdoomer
well I have a small open map demo in C# I can give to you. Every pretty much has a comment on what it does.