summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Melanson <mike@multimedia.cx>2003-02-08 15:39:07 +0000
committerMike Melanson <mike@multimedia.cx>2003-02-08 15:39:07 +0000
commit168a2fa77ae40c883931a2cf977bc8276344ce05 (patch)
tree08324c6942cb786671a3d99ea81005f79dc1046b
parent090e85cdd28db892bec3d9ad0212859c796a748d (diff)
downloadxine-lib-168a2fa77ae40c883931a2cf977bc8276344ce05.tar.gz
xine-lib-168a2fa77ae40c883931a2cf977bc8276344ce05.tar.bz2
modified to support FLI files from Magic Carpet PC game
CVS patchset: 4118 CVS date: 2003/02/08 15:39:07
-rw-r--r--src/libxinevdec/fli.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/libxinevdec/fli.c b/src/libxinevdec/fli.c
index 45589c0a5..12045a760 100644
--- a/src/libxinevdec/fli.c
+++ b/src/libxinevdec/fli.c
@@ -23,7 +23,7 @@
* avoid when implementing a FLI decoder, visit:
* http://www.pcisys.net/~melanson/codecs/
*
- * $Id: fli.c,v 1.17 2003/01/08 01:02:31 miguelfreitas Exp $
+ * $Id: fli.c,v 1.18 2003/02/08 15:39:07 tmmm Exp $
*/
#include <stdio.h>
@@ -81,6 +81,7 @@ typedef struct fli_decoder_s {
unsigned char yuv_palette[PALETTE_SIZE];
yuv_planes_t yuv_planes;
unsigned char *ghost_image;
+ int magic_number; /* FLI file magic number, e.g., 0xAF11 */
} fli_decoder_t;
@@ -135,10 +136,14 @@ void decode_fli_frame(fli_decoder_t *this) {
case FLI_256_COLOR:
case FLI_COLOR:
stream_ptr_after_color_chunk = stream_ptr + chunk_size - 6;
- if (chunk_type == FLI_COLOR)
- color_shift = 2;
- else
+ /* check special case: if this has the internal magic number of
+ * 0xAF13, this file is from the Magic Carpet game and uses 6-bit
+ * colors even though it reports 256-color chunks in a 0xAF12-type
+ * file */
+ if ((chunk_type == FLI_256_COLOR) && (this->magic_number != 0xAF13))
color_shift = 0;
+ else
+ color_shift = 2;
/* set up the palette */
color_packets = LE_16(&this->buf[stream_ptr]);
stream_ptr += 2;
@@ -432,6 +437,7 @@ static void fli_decode_data (video_decoder_t *this_gen,
this->width = (LE_16(&buf->content[8]) + 1) & ~0x1;
this->height = LE_16(&buf->content[10]);
this->video_step = buf->decoder_info[1];
+ this->magic_number = LE_16(&buf->content[4]);
this->ghost_image = xine_xmalloc(this->width * this->height);
init_yuv_planes(&this->yuv_planes, this->width, this->height);