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.
Important information: this site is currently scheduled to go offline indefinitely by end of the year.
Beasts and Bumpkins MFB files (unknown RLE compression)
-
- 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)
You do not have the required permissions to view the files attached to this post.
-
- 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
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>;
}
-
- 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
The compression used is something along the lines of RLE. One color in the palette will be the transparency, which will occur a lot.
-
- 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
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
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.
Re: Beasts and Bumpkins MFB files (unknown RLE compression)
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;
}
-
- 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)
Woohoo thanks a lot!
Did you find it out by disassembling or just with the file?
Did you find it out by disassembling or just with the file?