Jump to content

Question about MBM texture files (technical)


Krupski

Recommended Posts

Hi all,

I've written a small utility called "mbm2png" that converts MBM texture files to PNG. I wish to write the reverse utility also.

I've got one small question that I need to figure out first...

In the MBM file header are five 32 bit little-endian dwords that describe, in order:

Offset 0x00: 3KSP (i.e. a "magic number")

Offset 0x04: Bitmap WIDTH (i.e. 0x00020000 == 512 pixels wide)

Offset 0x08: Bitmap HEIGHT (i.e. 0x00020000 == 512 pixels tall)

Offset 0x0C: UNKNOWN (0x00000000 or 0x01000000 == 0 or 1)

Offset 0x10: Bit (color) depth (0x18000000 == 24 bits, 0x20000000 == 32 bits)

Offset 0x14: Texture data begins

Here's an example from a typical file:

-------------------------------------------------------------------------

00000000 03 4B 53 50 00 02 00 00 00 02 00 00 00 00 00 00 .KSP............

00000010 18 00 00 00 75 75 75 75 75 75 75 75 75 75 75 75 ....uuuuuuuuuuuu

00000020 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 uuuuuuuuuuuuuuuu

00000030 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 uuuuuuuuuuuuuuuu

00000040 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 uuuuuuuuuuuuuuuu

-------------------------------------------------------------------------

The one shown as "unknown" is the one I need to know about.

It's USUALLY a zero for 24 bit textures and a one for 32 bit textures (making me think it flags "transparency" or something)... but once in a while there is a 32 bit color depth file that has this word set to "zero".

It doesn't seem to matter when converting an MBM file to PNG, but I am assuming it's important the other way around (else it wouldn't be there - right?).

So, if anyone can tell me what this flag means so I can set it correctly in my "PNG2MBM" program, I will greatly appreciate it.

Thanks!

-- Roger

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...