Offset Values

Discuss anything programming related.
User avatar
Aumaan Anubis
Staff
Posts: 1812
Joined: Thu Dec 13, 2007 12:18 am
Contact:

Offset Values

Post 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.
Supermodder911
Posts: 409
Joined: Sat Jan 12, 2008 11:42 pm
Location: Michigan
Contact:

Re: Offset Values

Post by Supermodder911 »

It is simple how I described on AIM. :!:
Image
Chad Warden is Ballin'. No jk.
User avatar
Aumaan Anubis
Staff
Posts: 1812
Joined: Thu Dec 13, 2007 12:18 am
Contact:

Re: Offset Values

Post 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.
User avatar
Grimdoomer
Admin
Posts: 1835
Joined: Sun Dec 09, 2007 9:09 pm

Re: Offset Values

Post 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.
Don't snort the magic, we need it for the network.
User avatar
XZodia
Staff
Posts: 2208
Joined: Sun Dec 09, 2007 2:09 pm
Location: UK
Contact:

Re: Offset Values

Post by XZodia »

dont forget to add the multiply of by the chunk size /end drunkensseses
Image
JacksonCougar wrote:I find you usually have great ideas.
JacksonCougar wrote:Ah fuck. Why must you always be right? Why.
User avatar
Aumaan Anubis
Staff
Posts: 1812
Joined: Thu Dec 13, 2007 12:18 am
Contact:

Re: Offset Values

Post 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.
User avatar
OwnZ joO
Posts: 1197
Joined: Sun Dec 09, 2007 4:46 pm

Re: Offset Values

Post 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.
User avatar
Aumaan Anubis
Staff
Posts: 1812
Joined: Thu Dec 13, 2007 12:18 am
Contact:

Re: Offset Values

Post 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?
User avatar
XZodia
Staff
Posts: 2208
Joined: Sun Dec 09, 2007 2:09 pm
Location: UK
Contact:

Re: Offset Values

Post by XZodia »

? values cant share an offset
Image
JacksonCougar wrote:I find you usually have great ideas.
JacksonCougar wrote:Ah fuck. Why must you always be right? Why.
User avatar
neodos
Posts: 1493
Joined: Sun Dec 09, 2007 8:58 pm

Re: Offset Values

Post 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.
User avatar
Grimdoomer
Admin
Posts: 1835
Joined: Sun Dec 09, 2007 9:09 pm

Re: Offset Values

Post 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.
Don't snort the magic, we need it for the network.
User avatar
Aumaan Anubis
Staff
Posts: 1812
Joined: Thu Dec 13, 2007 12:18 am
Contact:

Offset Values

Post 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.
User avatar
Grimdoomer
Admin
Posts: 1835
Joined: Sun Dec 09, 2007 9:09 pm

Offset Values

Post by Grimdoomer »

if this is anthonys source from his tut then please get the fuck out of here.
Don't snort the magic, we need it for the network.
User avatar
XZodia
Staff
Posts: 2208
Joined: Sun Dec 09, 2007 2:09 pm
Location: UK
Contact:

Offset Values

Post by XZodia »

it certainly looks like it....
Image
JacksonCougar wrote:I find you usually have great ideas.
JacksonCougar wrote:Ah fuck. Why must you always be right? Why.
User avatar
Aumaan Anubis
Staff
Posts: 1812
Joined: Thu Dec 13, 2007 12:18 am
Contact:

Offset Values

Post 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...
User avatar
XZodia
Staff
Posts: 2208
Joined: Sun Dec 09, 2007 2:09 pm
Location: UK
Contact:

Offset Values

Post by XZodia »

well you refered to it as your source...and wat was the point in posting it anyway?
Image
JacksonCougar wrote:I find you usually have great ideas.
JacksonCougar wrote:Ah fuck. Why must you always be right? Why.
User avatar
Aumaan Anubis
Staff
Posts: 1812
Joined: Thu Dec 13, 2007 12:18 am
Contact:

Offset Values

Post by Aumaan Anubis »

My source was meant to be interpreted as the source I was using.
User avatar
Prey
Posts: 129
Joined: Sat Dec 29, 2007 5:06 pm
Location: UK

Offset Values

Post by Prey »

:/

Whoever's source it is.. it is terrible...
Supermodder911
Posts: 409
Joined: Sat Jan 12, 2008 11:42 pm
Location: Michigan
Contact:

Offset Values

Post by Supermodder911 »

Tis anthonys.
Image
Chad Warden is Ballin'. No jk.
User avatar
Aumaan Anubis
Staff
Posts: 1812
Joined: Thu Dec 13, 2007 12:18 am
Contact:

Offset Values

Post 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.
User avatar
XZodia
Staff
Posts: 2208
Joined: Sun Dec 09, 2007 2:09 pm
Location: UK
Contact:

Offset Values

Post by XZodia »

Image
JacksonCougar wrote:I find you usually have great ideas.
JacksonCougar wrote:Ah fuck. Why must you always be right? Why.
User avatar
Aumaan Anubis
Staff
Posts: 1812
Joined: Thu Dec 13, 2007 12:18 am
Contact:

Offset Values

Post by Aumaan Anubis »

Really? Is that what that is?

Sweet, I'll take a look at it.
User avatar
Aumaan Anubis
Staff
Posts: 1812
Joined: Thu Dec 13, 2007 12:18 am
Contact:

Offset Values

Post by Aumaan Anubis »

Ooook, slighty(majorly) too advanced for me to comprehend.

I'll keep doing stuff and come back to it later.
User avatar
XZodia
Staff
Posts: 2208
Joined: Sun Dec 09, 2007 2:09 pm
Location: UK
Contact:

Offset Values

Post by XZodia »

lol years of experience went into that dll and its still crap imo
Image
JacksonCougar wrote:I find you usually have great ideas.
JacksonCougar wrote:Ah fuck. Why must you always be right? Why.
User avatar
Grimdoomer
Admin
Posts: 1835
Joined: Sun Dec 09, 2007 9:09 pm

Offset Values

Post 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.
Don't snort the magic, we need it for the network.
Post Reply