H2V Generic Tutorial

Post tutorials for Halo2 Vista editing here.
Post Reply
User avatar
Patrickh




Wordewatician 500

Posts: 1173
Joined: Wed Mar 14, 2007 4:53 pm

H2V Generic Tutorial

Post by Patrickh »

This was made to describe how Mr. Mohawk works. Nobody learns anything from just using a program. Keep in mind this reference only scratches the surface, and only explains just what you need to know, and no more.

HALO 2 VISTA MAP REFERENCE

'###Following the tags###'

*Main map header*
At the beginning of the map file.

0x10 (Int32) -> Index Offset:
This is the offset to the index header, which contains very important info regarding tags.

0x14 (Int32) -> Meta Start
This is the offset to the start of the meta data.

0x2D0 (Int32) -> FileTable Start
This the offset to where all the tag names are stored. They are stored in the same order
as they are in the index and metadata.

*Index Header*
Located at the Index offset read from the main header

Primary Magic: This value is calculated by the following expression:
the first Int32 in the Index header - Index offset + size of index offset.
Because in H2V the fisrt value of the index offset is always 32,
and the size of the index header is always 32, Primary Magic simplifies to -IndexOffset

Secondary Magic: This Value is calculated by the following expression:
(Tags Start - Index offset) - (metastart + IndexOffset)
In Halo 2, in between the index header and the tags start there is a table of all the tag classes.
There are 120 entries in this table, each of which has a length of 12 bytes in the following
structure: (4 chars) Primary class, (4 chars) Secondary class, (4 chars) Third class
now if you do the math, you can calculate the first quantity of our expression.
Tags Start = IndexOffset + 32 + 120 * 12 = 1472 + Index offset
So the first part of our expression is 1472 (also contained in the index header).

After the index header is 1440 bytes of tag classes as we discussed earlier, then the tags start.

The number of tags is contained in the index header as well, which will help us read the tags.
Last Int32 in index header: Tag count

*Index*

Now for the tags. Starting at the tags start there is a list of all of the tags in the map.
Each entry in the list follows this structure:
(4 chars) Primary Tag Class:
the primary tag class of the entry

(Int32/UInt32) I.D.:
A number identifying the tag, each tags I.D. will be unique.

(Int32) Meta Offset:
This is the offset to the tags metadata. If you read this value as Int32, then subtract secondary
magic, it will lead you to the start of the tags meta.

(Int32) Meta Size:
The size of the tags meta in bytes.

So, each tag index entry is 16 bytes long. You can collect all this tag information with a program
by looping through the index and storing the four bits of information for each one.

'###Finding dependencies and Lone I.D.s###'

Remember in the tag index how each tag has it's own unique I.D.?
Both dependencies and lone I.D.s are simply I.D.s in the tags metadata.
so to find them, you have to read through the tags index and collect all the I.D.s into a list, and also
what tag each of the I.D.s belongs to. Then, you search a tags metadata, and if you find a value that matches
an I.D. in your list, you've found one. For dependencies, the dependency's primary class is stored right before
the I.D. So to check which type the I.D. is, back up four bytes from where you found it, and if the 4 chars there
match the dependencies primary tag class, you have a dependency, otherwise it's a lone I.D.

*Nulled out tags*

When a tag is nulled out, it's I.D. within the metadata looks like this: FFFF FFFF
If you read that as Int32, it equals -1. But not all -1 values in the metadata are
Nulled out I.D.s, for example, if you take the ARGB color for pure white and write it as
one byte per value (Halo uses this to store color sometimes, or at least it did in Halo 1)
it turns out as FFFF FFFF. So to distinguish, when we find a -1, we back up four bytes and read the four chars.
If they match, it means that the -1 is in the place of a dependency's I.D., and it is a nulled out tag.

'###Meta Swaps###'

All that a meta swap does is change a tags meta offset within the index to that of a different tag. So if the rocket
has a meta offset of x as the third Int32 within its tag index entry, and the battle rifle bullet has y, you can go
to the battle rifle's tag index entry and write x over the third Int32. Now when the game loads the tags, and the
battle fires, it will shoot its bullets. But when it loads the bullet tag from the index, it will point to the rockets
metadata, and the battle rifle will shoot rockets instead. Pretty simple.

Thats where I will leave off, I may write more in the future, but now you should have a good understanding about how
Mr. Mohawk functions. I trust that anyone who is smart enough to understand this information is smart enough not to misuse it.
If i mistyped any info, feel free to tell me
Image
conure says: or i could jsut incase my shoes in papar mache, followed by my dog
|||Lethargy||| Mr. Mohawk|||
|||feel free to contact me via PMs, AIM, MSNM, or Xfire if you have any questions|||
User avatar
grimdoomer




System Engineer

Posts: 1440
Joined: Mon Oct 09, 2006 4:36 pm

Post by grimdoomer »

Some of this is absurd but ok.
Image
AI Zones in MP | Ambiance | Gravemind Beta v1.1
Aumaan Anubis wrote:Grimdoomer. The first person ever to mod Halo 2 Vista.
User avatar
LuxuriousMeat





Posts: 824
Joined: Thu Nov 03, 2005 6:43 pm
Location: zzzzzzzzzzzzzzzz
Contact:

Post by LuxuriousMeat »

It's nice of you to release this information, but I highly doubt this will help anyone unless they have prior knowledge of previous versions of Halo maps. Because you didn't really explain it very well. Also, some of the ways you do things is not the most efficient and does a lot more math than needed.
Image
User avatar
Patrickh




Wordewatician 500

Posts: 1173
Joined: Wed Mar 14, 2007 4:53 pm

Post by Patrickh »

well as it says, it is just explains what you need to know to get editing and no more. And grimdoomer, which part is absurd? this is not a method to load a map but a helper for those who know their way around a map but are wondering whats what and where to start.
Image
conure says: or i could jsut incase my shoes in papar mache, followed by my dog
|||Lethargy||| Mr. Mohawk|||
|||feel free to contact me via PMs, AIM, MSNM, or Xfire if you have any questions|||
User avatar
halo0001





Posts: 853
Joined: Tue Aug 22, 2006 7:59 pm
Location: USA

Post by halo0001 »

ok ive been trying to convert anthonys h2x tutorial app found here:
http://forums.halomods.com/viewtopic.ph ... 67&t=38615

Ive been working on the one that displays the lone ids, dependacys and Reflexives in vb.

Well ive gotten it to list the tags and all of that but when i click on say the bipd-masterchief I get an error i think it has something to do with the metasize i dont know how to accurately loop the index and find it, so i was wondering how you did it with mr.mohawk.
btw on spacestation i get 40247296 for the metasize.
Image
Post Reply