Halo 2 Programming Question

Discuss anything programming related.
Post Reply
User avatar
Click16
Posts: 1941
Joined: Mon Dec 31, 2007 4:36 am
Location: United States

Halo 2 Programming Question

Post by Click16 »

I was thinking of making a Halo 2 Program. My only problem is that I don't know what the offset of the tag's data is. I downloaded the tutorial in the tutorial section, but it doesn't teach me anything. It only taught me how to read. I don't know how to open the map, or read the map. It is all too new to me. I would make the program in VB only because I know VB all too well. I have not the slightest clue how to work with C# or C++. Any help will be appreciated. Also, when you tell me code, tell me what it is, what it does, and how it might work in a simple way.
Image
User avatar
XZodia
Staff
Posts: 2208
Joined: Sun Dec 09, 2007 2:09 pm
Location: UK
Contact:

Re: Halo 2 Programming Question

Post by XZodia »

I advise using my dll's or write a contribute applet. it'll save you a lot of time.
Image
JacksonCougar wrote:I find you usually have great ideas.
JacksonCougar wrote:Ah fuck. Why must you always be right? Why.
User avatar
OwnZ joO
Posts: 1197
Joined: Sun Dec 09, 2007 4:46 pm

Re: Halo 2 Programming Question

Post by OwnZ joO »

Basically you need to read the Map Header, which then tells you the offset to the ObjectIndex. That will tell you the offset to the tag table. Then you need to read TagCount amount of Tags from that table. You will need to subtract the secondary magic from the raw offset of each tag in order to find where they are in the map. Then in order to read the meta for the tag into a byte array for example you would use code something like this:
[code]
br.BaseStream.Position = tag.MetaOffset; // seek to the translated offset
byte[] meta = br.ReadBytes(tag.MetaSize); // read the size of the meta from the meta's offset
[/code]
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Halo 2 Programming Question

Post by troymac1ure »

Grimdoomer obviously put ALOT of time into this very question, so look at his thread on Programming an H2 App:
http://forums.remnantmods.com/viewtopic.php?f=12&t=16

It also shows the header layout and more info.
User avatar
Click16
Posts: 1941
Joined: Mon Dec 31, 2007 4:36 am
Location: United States

Re: Halo 2 Programming Question

Post by Click16 »

Ok, when i read trough that tutorial, i understand it alot! i have the program built, I just dont know how to make the open file dialog do something with the class. Like i understand the binary reader, i just want to ask this question.

If the Open File Dialog is in Form1, how can i make it so when i click ok (OpenFileDialog.FileOK) it sends the map's location to the class where the data needs to go?
Image
User avatar
OwnZ joO
Posts: 1197
Joined: Sun Dec 09, 2007 4:46 pm

Re: Halo 2 Programming Question

Post by OwnZ joO »

Well if you have a basic understanding of coding, you should be able to figure it out by taking that advice. It might also be a good idea to set a breakpoint in the tutorial(I'm assuming you mean the one I helped with that Supermodder released) where it opens the map and step through that. You should be able to find out what order things go in using that.
User avatar
Click16
Posts: 1941
Joined: Mon Dec 31, 2007 4:36 am
Location: United States

Re: Halo 2 Programming Question

Post by Click16 »

Code: Select all

 Private Sub OpenMapDialog_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenMapDialog.FileOk
        Dim OMD As String = OpenMapDialog.FileName
        If OpenMapDialog.ShowDialog() = DialogResult.OK Then
            Map.MapLocation = New Halo2Map(OMD)
        End If
    End Sub
OK, This is what I have so far. My only error is that OMD in brackets gives this error: Too many arguments to 'Public Sub New() I have searched around, but no luck. Anyone else wana shoot at it?
Image
User avatar
Grimdoomer
Admin
Posts: 1835
Joined: Sun Dec 09, 2007 9:09 pm

Re: Halo 2 Programming Question

Post by Grimdoomer »

Well first off MapLocation is a string, and HaloMap is an object.

Code: Select all

Private Sub OpenMapDialog_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenMapDialog.FileOk
        If OpenMapDialog.ShowDialog() = DialogResult.OK Then
            Map.MapLocation = OpenMapDialog.FileName
            Map.Read()
        End If
    End Sub
I don't know exactly how your Halo2Map class is organized.
Don't snort the magic, we need it for the network.
Post Reply