Skip to content
Patrice Mandin edited this page Jan 21, 2019 · 4 revisions

Table of Contents

Games

The .SLD file format is used by Resident Evil 3. It contains several TIM files, most likely the background image masks.

Structure

The values are stored in Little-Endian order.

Header

Each embedded file has this header:

typedef struct {
	unsigned long unknown0;  /* 1=Mask for this camera, 0=No mask for this camera */
	unsigned long length;	/* File length or 0 if no mask */
} sld_header_t;

To reach next file:

If unknown0=0, add 8 bytes to go to next file header. If unknown0=1, just add current offset and current file length.

Compressed file

Following the header of each file in SLD archive, you will find the compressed file. It starts with a LONG being the number of blocks to depack, and then the blocks to depack with the following routine:

	for (i=0; i<numBlocks; i++) {
		start = src[srcIndex++];

		if (start & 0x80) {
			count = start & 0x7f;

			memcpy(&dst[dstIndex], &src[srcIndex], count);
			srcIndex += count;
			dstIndex += count;
		} else {
			int tmp = (start<<8) | src[srcIndex++];
			offset = (tmp & 0x07ff)+4;
			count = (tmp>>11)+2;

			for (j=0; j<count; j++) {
				dst[dstIndex+j] = dst[dstIndex+j-offset];
			}
			dstIndex += count;
		}
	}

	*dstLength = dstIndex;
}
Clone this wiki locally