[Tut] The Basics of Map Reading & other info!

Moderator: Halo Moderators

User avatar
Slapzy
Ranger
Posts: 1806
Joined: Mon May 05, 2008 3:21 pm
Location: ~root@208.113.172.130# sudo rm -f /
Contact:

[Tut] The Basics of Map Reading & other info!

Post by Slapzy » Thu Apr 09, 2009 6:22 am

The Basics of Map Reading.
Published by Slappey
Information by: Modzy, Altimit01, Jonathan, Sword, and various others I've acquired information from.

*This tutorial assumes you already know the basics on hex.*
______________________



Terminology
  • ______________________

    Terminology

    First off, let's start with some terminology:

    Offset: The sequence of bytes at a given address.

    Address: The location in hex of an offset.

    0x851974 (the address) contains the offset 2800F14B. (in the demo bloodgulch)

    Endianness - The byte ordering in memory used to represent some kind of data in computing.

    Big Endian - Describes data formatting (sequence of bytes) in which each field is addressed by referring to its most significant byte.

    4B F1 00 28

    Little Endian - Describes data formatting (sequence of bytes) in which each field is addressed by referring to its least significant byte.

    28 00 F1 4B

    Little endian describes a sequence of bytes stored in the computers RAM.
    Most computers store RAM memory in little endian. However, PPC stores it in big endian.
    The byte order is reversed from big endian. (see above examples)

    Transition Offset - The space between the start of a tag's meta and the chunk itself. There are several transition offsets in a meta, and there are many chunks in a map.

    Reflexive - the transition offset to a chunk count.

    Chunks - a part of the tag's meta, that Halo uses to determine the tag's properties or characteristics. (The little independent pieces, like what contains the 00-4B-00, and each of first, second, and third. Example: Reflexive: 3-4B-0, The chunk count, would be the number of chunks in one group/array. (like 3 in this case))
    See Figure 1 for reference.

    Chunk Count - The number of chunks stored in an array as two different offsets. Both are 32 bit integers, (meaning 4 bytes) side by side. The first offset is how many chunks there are, and the second is the reflexive. A typical chunk count looks like
    a [count | pointer | zero] tuple, where count is the number of items, pointer shows where the offset is, and zero is, well, zero...

    Tag Array - A huge list of all the tags in the map, that includes all their name offsets, meta offsets, tag classes, etc.

    Figure 1
    Figure 2
    ______________________
Things you should know:
______________________
  • Things you should know:

    Map Information & Structure:

    Halo loads the map into memory all at once. It does all its calculations in the fast RAM memory. Because RAM data is stored in little endian, the maps need to be in little endian. So that when it's loaded into RAM, all its bytes are in big endian and easily readable. So, all that to say, maps are stored in little endian.

    Halo Demo Map File Header:

    Demo map offsets:
    0x2C0: Head string
    0x588: Game type
    0x5E8: Decompressed map size
    0x5EC: Index offset
    0x2C4: Meta data size
    0x58C: Map name
    0x2C8: Map build date
    0x02: Map type
    0x5F0: Foot string

    Head String: 0x2C0 begins the "Demo Mapfile Header" or the important parts. In ASCII it reads "dehE" and in hexidecimal it is 64 65 68 45.

    Game type: 0x588 has the short 06 which most likely represents the map version number. In the full version it is 07, in XBox its 05 and in halo CE 609. Halo Demo will not accept maps unless there is 06 there.

    Decompressed map size: 0x5EC this 32-bit integer expresses the full size of the mapfile in bytes. In the case of xbox maps, it indicates the size of the mapfile after it has been decompressed. If you're rebuilding for PC it's not required that you change this value but it is generally considered a good idea.

    Index offset: 0x5EC this 32-bit integer is the most important piece of data contained in the header. It contains the address of the index header, and afterwards, the offset to the index. The offset to index is necessary to calculate the magic. Magic = (index magic - (offset to index + 40 )) 0x5EC is always the address, in any demo map for the index offset.

    Meta data size: 0x2C4 this 32-bit integer is the other useful piece of data contained in the header. It tells us the size in bytes of all the meta data. Once again, it's not necessary to update this with rebuilding, but it is recommended. In an original, unmodified demo bloodgulch map there are 57 89 F4 bytes worth of metadata in the map.

    Map name: 0x58C this string contains the internal name of the map, in this case bloodgulch, and goes on for about 20 bytes. Though there is one byte at the end of the 00's there, it has no effect on the map. However should be the same as the name of the map file.

    Map build date: 0x2C8 this string indicates the build data/version of the map, which goes on for 0x1C bytes. Demo, full and CE each have different build dates but changing the dates around doesn't seem to have much effect. CE might be more specific about the build date according to some sources.

    Map type: 0x02 this 32-bit integer indicates whether the map is a single player map (value = 0 ), a multiplayer map (value = 1) or a UI map (value = 2). These three types are the only ones that contain a normal mapfile header (yes you can open ui.map in most editors).

    Foot string: 0x5F0 this string in a full map represents the head of the header data. Since demo scrambles the header it no longer is at the end of the data. On normal maps it is "toof" while on demo maps it is "tofG". It is necessary in the halo demo mapfile, otherwise Halo Demo will not read the map and throw a file not found error.

    At this point all the data can just equal 00 until 0x800. Its just random, meaningless data that was probably used to confuse modders or people who are reverse engineering the files. Overall there are 0x7B8 meaningless bytes in the file.

    ______________________
Map Reading
______________________
  • Things we've learned!
    ______________________


    Well, We've learned some information on RAM memory, that most computers store it in little endian, however if you are on ppc, It's big endian, and can be reversed to little endian using some techniques 'Little Endian Processing Mode, & Byte order Load ad stored instructions. "More info Here"

    We've learned some terms, and some information on the map file.

    We've learned how to calculate the Map Magic.

    We've learned how to locate the address for the offset you want.
    (index offset - map magic = offset you want)
This concludes the tutorial on basic map reading. Enjoy.

Worked on this thing for 3 freakin days... practically nonstop. Sure hope it helps.
~ Teh Slapz
Image
TaxiService wrote:OMG BARREL ROLL ON ACIDS
._. \·. |: /.· .-. ·.\ :| .·/ ._. \·. |: /.· .-. ·.\ :| .·/ ._.
WHOOHHAGHGHHGEHGR

User avatar
(KHC) Shadow
SEAL
Posts: 527
Joined: Tue Jul 22, 2008 10:38 am
Contact:

Re: [Tut] The Basics of Map Reading & other info!

Post by (KHC) Shadow » Thu Apr 30, 2009 2:53 pm

OMG THANK THE GODS. Someone finally made this. i bow to your superior 1337ness xD....FOR NOW (until i get to the chapter in my book where it teachers how to open files O_O)
Image

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests