Important information: this site is currently scheduled to go offline indefinitely by end of the year.

Beasts and Bumpkins MFB files (unknown RLE compression)

Get your graphics formats figures out here! Got details for others? Post here!
Post Reply
Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 46 times
Contact:

Beasts and Bumpkins MFB files (unknown RLE compression)

Post by Rheini »

Need some help with these graphic files from an older 2D-game Beasts and Bumpkins.
It uses DirectDraw (if this helps somehow).
The files seem to contain static graphics as well as animations. Mix.dat and reflect.dat might be some sort of palette, but I'm not sure.
You do not have the required permissions to view the files attached to this post.
Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 46 times
Contact:

Re: Beasts and Bumpkins MFB files

Post by Rheini »

Current status:

Code: Select all

char magic[3]; // "MFB"
char version[3]; // should be 101d (= 65h)
ushort width; // is the width of a single image
ushort height; // is the height of a single image
ushort uk3; // not used?
ushort uk4; // not used?
ushort flags; // bit 2 means compressed, 1 and 4 are unknown
ushort numImages; // number of images

if((flags & 2) == 0) // uncompressed data
{
	struct {
		struct {
			byte data[width];
		} lines[height] <optimize=false>;
	} images[numImages] <optimize=false>;
}
else // compressed data
{
	struct {
		uint size;
		byte data[size];
	} images[numImages]<optimize=false>;
}
Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 46 times
Contact:

Re: Beasts and Bumpkins MFB files

Post by Rheini »

The compression used is something along the lines of RLE. One color in the palette will be the transparency, which will occur a lot.
Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 46 times
Contact:

Re: Beasts and Bumpkins MFB files

Post by Rheini »

Mix.dat and reflect.dat are lookup tables for reflection etc.
The images use palettes stored in the main game executable.
Unfortunately I still don't know the RLE algorithm :(
You do not have the required permissions to view the files attached to this post.
GameZelda
advanced
Posts: 61
Joined: Wed Nov 14, 2007 5:56 pm
Been thanked: 29 times

Re: Beasts and Bumpkins MFB files (unknown RLE compression)

Post by GameZelda »

Code: Select all

/**
 * Uncompress a Beast and Bumpkins RLE-encoded data block.
 *
 * [in] in: The input (compressed) data.
 * [in] inSize: The size of the input data.
 * [out] out: The output (uncompressed) data.
 * [out] outSize: The size of the output data.
 *
 * (For images, outSize = width * height).
 *
 * TODO: Add bounds checking.
 */
bool unRLE(const uint8_t *in, size_t inSize, uint8_t *out, size_t outSize)
{
    size_t inPos = 0, outPos = 0;
    uint8_t copyByte = in[0];

    while (outPos < outSize)
    {
        if (in[inPos] == copyByte)
        {
            uint8_t count = in[inPos + 1];
            inPos += 2;

            while (count--)
                out[outPos++] = copyByte;
        }
        else
        {
            out[outPos++] = in[inPos++];
        }
    }

    return true;
}
The palettes are in the resources section of the EXE.
Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 46 times
Contact:

Re: Beasts and Bumpkins MFB files (unknown RLE compression)

Post by Rheini »

Woohoo thanks a lot!
Did you find it out by disassembling or just with the file?
Rheini
Moderator
Posts: 652
Joined: Wed Oct 18, 2006 9:48 pm
Location: Germany
Has thanked: 19 times
Been thanked: 46 times
Contact:

Re: Beasts and Bumpkins MFB files (unknown RLE compression)

Post by Rheini »

Works like a charm :)

Image
Post Reply