Halo 2 Programming Question
- Click16
- Posts: 1941
- Joined: Mon Dec 31, 2007 4:36 am
- Location: United States
Halo 2 Programming Question
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.
- XZodia
- Staff
- Posts: 2208
- Joined: Sun Dec 09, 2007 2:09 pm
- Location: UK
- Contact:
Re: Halo 2 Programming Question
I advise using my dll's or write a contribute applet. it'll save you a lot of time.
- OwnZ joO
- Posts: 1197
- Joined: Sun Dec 09, 2007 4:46 pm
Re: Halo 2 Programming Question
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]
[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]
- 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
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.
http://forums.remnantmods.com/viewtopic.php?f=12&t=16
It also shows the header layout and more info.
- Click16
- Posts: 1941
- Joined: Mon Dec 31, 2007 4:36 am
- Location: United States
Re: Halo 2 Programming Question
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?
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?
- OwnZ joO
- Posts: 1197
- Joined: Sun Dec 09, 2007 4:46 pm
Re: Halo 2 Programming Question
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.
- Click16
- Posts: 1941
- Joined: Mon Dec 31, 2007 4:36 am
- Location: United States
Re: Halo 2 Programming Question
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
- Grimdoomer
- Admin
- Posts: 1835
- Joined: Sun Dec 09, 2007 9:09 pm
Re: Halo 2 Programming Question
Well first off MapLocation is a string, and HaloMap is an object.
I don't know exactly how your Halo2Map class is organized.
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
Don't snort the magic, we need it for the network.