Page 1 of 1

Halo 2 bitmap data

Posted: Sat Jan 21, 2006 5:24 pm
by Klaz0r
How is the information about the raw bitmap data stored inside the bitmap tags? I think I found where the offset is kept, but how can I tell, just from looking at the hex:

that the map is kept internal/shared,
the size of the raw data,
and what the dxt version is.

I've checked the insolence website, they have a section for it, but there isn't anything there yet.

Posted: Sat Jan 21, 2006 6:43 pm
by mrhyperpenguin
this structure of the bitmap tags is defined in the whitepaper

just follow the reflexive 0x44 bytes in the meta

struct bitmMeta {
byte[68] data;
struct image {
char[4] bitm;
ushort width;
ushort height;
ushort depth;
ushort type;
ushort format;
ushort flags;
ushort regPointX;
ushort regPointY;
ushort mipMapCount;
ushort pixelOffset;
uint zero;
uint[6] offset;
uint[6] size;
uint identifier;
byte[36] unknown;
}
}

Posted: Sat Jan 21, 2006 7:02 pm
by Klaz0r
:) Thanks a lot man. Now I can get back to work.

EDIT:
ok, just so I can make sure, concerning the below:

Code: Select all

struct bitmMeta {
  byte[68] data;
  struct image {
    char[4] bitm;
    ushort width;
    ushort height;
    ushort depth;
    ushort type;
    ushort format;
    ushort flags;
    ushort regPointX;
    ushort regPointY;
    ushort mipMapCount;
    ushort pixelOffset;
    uint zero;
    uint[6] offset;
    uint[6] size;
    uint identifier;
    byte[36] unknown;
  }
}
An unsigned short is 2 bytes, an unsigned integer is 8 bytes, and byte[68] means 68 bytes. Is this right?

Posted: Sat Jan 21, 2006 8:37 pm
by mrhyperpenguin
yes.

unsigned shorts are the same as shorts, but unsigned shorts can represent 0 to +65,535 (shorts represent −32,768 to +32,767)

unsigned intergers represent 0 to +4,294,967,295. intergers represent −2,147,483,648 to +2,147,483,647.

byte[68] means that there is a byte with an array that has 68 "slots" of byte.

Posted: Sun Jan 22, 2006 5:17 pm
by Klaz0r
Ok, I seem to have found an inconsistency, Here is a bitm tag from zanzibar, with my interpretation of the structure:
Picture
Some values look right, but others don't.

Posted: Sun Jan 22, 2006 6:17 pm
by mrhyperpenguin
sorry i mislead you, byte an u/int is 4 bytes
here is an updated picture of yours

Image

the reflexive points to struct image{}

Posted: Mon Jan 23, 2006 3:17 pm
by Klaz0r
Thanks :D

EDIT: Sorry, I have a couple more questions,
1. Do I need to do anything to the offset, or does it point to the right place already?
2. Size needs to be rounded to the nearest 512, right?
3. Can I just extract the raw data at the offset and save that to a file, and that would be the bitmap? Or do I need to do anything to it?

Thanks for putting up with me.

Posted: Thu Jan 26, 2006 3:00 pm
by Klaz0r
Nobody knows? If not, just don't reply, and I'll let this die.

Posted: Thu Jan 26, 2006 10:25 pm
by Iron_Forge
The offset is a pure offset...Nothing needs to be done to it, unless of course it points to one of the shared files...

The size does not need to be rounded to 512 for the purposes of extracting...They are padded to 512 bytes when stored in the map file should you want to add them/etc...

The raw data is simply that, the raw data...No header is given...For the most part, a DDS header (with the correct values entered) can be tossed at the front to get a valid DXT image, since DDS supports pretty much all of the images used in Halo...There are a few formats that can be extracted without conversion to other image formats given the correct headers for those formats...

Posted: Fri Jan 27, 2006 1:43 pm
by Klaz0r
Ok then, last question (I hope). How can I write the correct headers to the files? I can determine what format the file is in, but what do I need to write? I'm guessing there isn't a static header for every dds file.

Posted: Fri Jan 27, 2006 1:47 pm
by Aequitas

Posted: Fri Jan 27, 2006 2:05 pm
by Klaz0r
Ok, sorry for being a noob, but I don't fully understand the link. I can probably figure out the width, height, depth, and mipmap count, but other than that, I don't understand. Also, do I just write these values directly to the beginning of the dds? If you could, relate the values from that link to the values in the picture above. And thanks for replying guys.

Posted: Sat Jan 28, 2006 3:29 pm
by mrhyperpenguin
if you want to view the raw data that you extracted from the map in say photoshop (with the plugin), you would have to write the .DDS header and attach it to the raw data.

it would be best to take a bitmap meta, its raw data, and the .dds version of the raw data, and the link Aequitas gave to you to write your own .dds header.

for example, the first member or your .dds header is "DWORD dwSize" (referencing the link). and you would write "Size of structure. This member must be set to 124." in dwSize (again, referencing the link).