annotate tools/lib64fmts.c @ 1503:c7b9ef56319b

Factor all the c64 file format specific things into lib64fmt.c
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 11 May 2018 07:41:55 +0300
parents
children 3265175b24d2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 * Functions for reading and converting various restricted
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 * C64/etc and/or indexed/paletted graphics formats.
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 * Programmed and designed by Matti 'ccr' Hamalainen
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
5 * (C) Copyright 2012-2018 Tecnic Software productions (TNSP)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 *
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 * Please read file 'COPYING' for information on license and distribution.
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8 */
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9 #include "lib64gfx.h"
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
10
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
11
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
12 // Based on Pepto's palette, stolen from VICE
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
13 DMColor dmDefaultC64Palette[C64_NCOLORS] =
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
14 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
15 { 0x00, 0x00, 0x00, 0xff },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
16 { 0xFF, 0xFF, 0xFF, 0xff },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
17 { 0x68, 0x37, 0x2B, 0xff },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
18 { 0x70, 0xA4, 0xB2, 0xff },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
19 { 0x6F, 0x3D, 0x86, 0xff },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
20 { 0x58, 0x8D, 0x43, 0xff },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
21 { 0x35, 0x28, 0x79, 0xff },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
22 { 0xB8, 0xC7, 0x6F, 0xff },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
23 { 0x6F, 0x4F, 0x25, 0xff },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
24 { 0x43, 0x39, 0x00, 0xff },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
25 { 0x9A, 0x67, 0x59, 0xff },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
26 { 0x44, 0x44, 0x44, 0xff },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
27 { 0x6C, 0x6C, 0x6C, 0xff },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
28 { 0x9A, 0xD2, 0x84, 0xff },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
29 { 0x6C, 0x5E, 0xB5, 0xff },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
30 { 0x95, 0x95, 0x95, 0xff },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
31 };
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
32
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
33
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
34 static int fmtProbeDrazPaint20Packed(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
35 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
36 const char *ident = (const char *) buf + 2;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
37
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
38 if (len > 22 &&
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
39 dmCompareAddr16(buf, 0, fmt->addr) &&
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
40 strncmp(ident, "DRAZPAINT ", 10) == 0 &&
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
41 ident[11] == '.' && (
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
42 (ident[10] == '1' && ident[12] == '4') ||
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
43 (ident[10] == '2' && ident[12] == '0')
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
44 ))
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
45 return DM_PROBE_SCORE_MAX;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
46
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
47 return DM_PROBE_SCORE_FALSE;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
48 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
49
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
50
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
51 static int fmtDecodeDrazPaintPacked(DMC64Image *img, const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
52 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
53 int res;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
54 DMGrowBuf mem;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
55
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
56 if ((res = dmDecodeGenericRLEAlloc(&mem, buf + 0x0e, buf + len, *(buf + 0x0d), 0, 0, DM_RLE_MARKER)) != DMERR_OK)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
57 goto out;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
58
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
59 res = dmC64DecodeGenericBMP(img, mem.data, mem.len, fmt);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 out:
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 dmGrowBufFree(&mem);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 return res;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 static int fmtEncodeDrazPaintPacked(DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 int res;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70 DMGrowBuf tmp;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 Uint8 rleMarker;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 const char *magicID = (fmt->type & D64_FMT_ILACE) ? "DRAZLACE! 1.0" : "DRAZPAINT 2.0";
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 // Encode the data to temp buffer
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 if ((res = dmC64EncodeGenericBMP(TRUE, &tmp, img, fmt)) != DMERR_OK)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 goto out;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78 // Analyze the data ..
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 dmGenericRLEAnalyze(&tmp, &rleMarker, DM_RLE_MARKER);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80 rleMarker = 0xff;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
82 // Add the header bits
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 if (!dmGrowBufPut(buf, magicID, strlen(magicID)) ||
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 !dmGrowBufPutU8(buf, rleMarker))
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
86 res = DMERR_MALLOC;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 goto out;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90 // And now RLE compress the data to the existing buffer
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 res = dmEncodeGenericRLE(buf, tmp.data, tmp.data + tmp.len,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 rleMarker, 3, 255, DM_RLE_MARKER);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94 out:
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95 dmGrowBufFree(&tmp);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 return res;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100 static int fmtProbeDrazLace10Packed(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 if (len > 22 &&
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103 dmCompareAddr16(buf, 0, fmt->addr) &&
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
104 strncmp((const char *) (buf + 2), "DRAZLACE! 1.0", 13) == 0)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105 return DM_PROBE_SCORE_MAX;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
106
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
107 return DM_PROBE_SCORE_FALSE;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
108 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
109
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
110
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
111 static BOOL fmtDrazLaceSetLaceType(DMC64Image *img, const DMC64EncDecOp *op,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
112 const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
113 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
114 (void) len;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
115 (void) fmt;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
116 img->laceType = buf[op->offs] ? D64_ILACE_RES : D64_ILACE_COLOR;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
117 return TRUE;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
118 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
120
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
121 static int fmtProbeGunPaint(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
123 if (len > 0x400 &&
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124 dmCompareAddr16(buf, 0, fmt->addr) &&
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
125 strncmp((const char *) (buf + 0x3ea), "GUNPAINT (JZ) ", 14) == 0)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
126 return DM_PROBE_SCORE_MAX;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
127
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
128 return DM_PROBE_SCORE_FALSE;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
131
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132 static int fmtProbeAmicaPaintPacked(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134 size_t i, n;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136 if (len < 2048 || !dmCompareAddr16(buf, 0, fmt->addr))
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137 return DM_PROBE_SCORE_FALSE;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139 // Interpaint Hi-Res gives a false positive
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140 // as do some GunPaint images ..
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 if (len == 9002 || fmtProbeGunPaint(buf, len, fmt) > DM_PROBE_SCORE_GOOD)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 return DM_PROBE_SCORE_FALSE;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144 for (n = 0, i = 2; i < len; i++)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 if (buf[i] == 0xC2) n++;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
146
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
147 if (n > 50)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148 return DM_PROBE_SCORE_GOOD;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149 if (n > 25)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
150 return DM_PROBE_SCORE_AVG;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 if (n > 10)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152 return DM_PROBE_SCORE_MAYBE;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
153
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
154 return DM_PROBE_SCORE_FALSE;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
156
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
157
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158 static int fmtDecodeAmicaPaintPacked(DMC64Image *img, const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
159 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
160 int res;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161 DMGrowBuf mem, tmp;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
162
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163 // Amica Paint apparently is broken and stores one byte less than it should
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164 // so we need to do some crappy buffer expansion here ..
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165 if ((res = dmGrowBufAlloc(&tmp, len + 4, 4)) != DMERR_OK)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166 return res;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
167
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
168 tmp.len = len;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
169 memcpy(tmp.data, buf, len);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
170 tmp.data[tmp.len++] = 0;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
171
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
172 // Now do an RLE decode on the enlarged buffer
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
173 if ((res = dmDecodeGenericRLE(&mem, tmp.data, tmp.data + tmp.len, 0xC2, 0, 0, DM_RLE_MARKER)) != DMERR_OK)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
174 goto out;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
175
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
176 // And finally decode to bitmap struct
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
177 res = dmC64DecodeGenericBMP(img, mem.data, mem.len, fmt);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
178
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
179 out:
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
180 dmGrowBufFree(&tmp);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
181 dmGrowBufFree(&mem);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
182 return res;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
183 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
184
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
185
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
186 static int fmtProbeFLIDesigner(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
187 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
188 if (len == fmt->size &&
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
189 (dmCompareAddr16(buf, 0, 0x3c00) || dmCompareAddr16(buf, 0, 0x3ff0)))
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
190 return DM_PROBE_SCORE_MAX;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
191
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
192 return DM_PROBE_SCORE_FALSE;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
193 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
194
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
195
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
196 static BOOL fmtTruePaintSetLaceType(DMC64Image *img, const DMC64EncDecOp *op,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
197 const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
198 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
199 (void) op;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
200 (void) buf;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
201 (void) len;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
202 (void) fmt;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
203 img->laceType = D64_ILACE_RES;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
204 return TRUE;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
205 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
206
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
207
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
208 static Uint8 fmtGetPixelTruePaint(
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
209 const DMC64Image *img, const int bmoffs, const int scroffs,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
210 const int vshift, const int vbitmap, const int raster)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
211 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
212 (void) raster;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
213 return dmC64GetGenericMCPixel(img, bmoffs, scroffs, vshift, 0, vbitmap, 0);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
214 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
215
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
216
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
217 #define XX2_MIN_SIZE 4000
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
218
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
219 static int fmtProbeFormatXX2(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
220 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
221 if (len >= XX2_MIN_SIZE && len <= XX2_MIN_SIZE + 8 &&
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
222 dmCompareAddr16(buf, 0, fmt->addr))
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
223 return DM_PROBE_SCORE_MAYBE;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
224
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
225 return DM_PROBE_SCORE_FALSE;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
226 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
227
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
228
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
229 static int fmtDecodeFormatXX2(DMC64Image *img, const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
230 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
231 int res;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
232
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
233 // If there is only data for less than XX2_MIN_SIZE bytes,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
234 // allocate a buffer of that size and copy data there.
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
235 // Otherwise allocate len bytes.
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
236 size_t nlen = len < XX2_MIN_SIZE ? XX2_MIN_SIZE : len;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
237 Uint8 *mem = dmMalloc0(nlen);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
238 if (mem == NULL)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
239 return DMERR_MALLOC;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
240
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
241 memcpy(mem, buf, len);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
242 res = dmC64DecodeGenericBMP(img, mem, nlen, fmt);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
243
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
244 dmFree(mem);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
245 return res;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
246 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
247
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
248
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
249 #define FUNPAINT2_HEADER_SIZE (0x10)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
250 static const char *fmtFunPaint2MagicID = "FUNPAINT (MT) ";
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
251
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
252
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
253 static BOOL fmtProbeFunPaint2Header(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
254 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
255 return
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
256 len > 30 &&
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
257 dmCompareAddr16(buf, 0, fmt->addr) &&
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
258 strncmp((const char *) (buf + 2), fmtFunPaint2MagicID, strlen(fmtFunPaint2MagicID)) == 0;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
259 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
260
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
261
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
262 static int fmtProbeFunPaint2Unpacked(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
263 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
264 if (fmtProbeFunPaint2Header(buf, len, fmt) &&
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
265 buf[2 + 14] == 0)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
266 return DM_PROBE_SCORE_MAX;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
267 else
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
268 return DM_PROBE_SCORE_FALSE;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
269 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
270
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
271
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
272 static int fmtProbeFunPaint2Packed(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
273 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
274 if (fmtProbeFunPaint2Header(buf, len, fmt) &&
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
275 buf[2 + 14] != 0)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
276 return DM_PROBE_SCORE_MAX;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
277 else
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
278 return DM_PROBE_SCORE_FALSE;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
279 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
280
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
281
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
282 static int fmtDecodeFunPaint2Unpacked(DMC64Image *img, const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
283 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
284 return dmC64DecodeGenericBMP(img, buf + FUNPAINT2_HEADER_SIZE, len - FUNPAINT2_HEADER_SIZE, fmt);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
285 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
286
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
287
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
288 static int fmtDecodeFunPaint2Packed(DMC64Image *img, const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
289 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
290 int res;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
291 DMGrowBuf mem;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
292 dmGrowBufInit(&mem);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
293
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
294 if ((res = dmDecodeGenericRLE(&mem, buf + FUNPAINT2_HEADER_SIZE, buf + len, *(buf + 15), 0, 0, DM_RLE_MARKER)) != DMERR_OK)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
295 goto out;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
296
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
297 res = dmC64DecodeGenericBMP(img, mem.data, mem.len, fmt);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
298
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
299 out:
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
300 dmGrowBufFree(&mem);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
301 return res;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
302 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
303
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
304
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
305 static int fmtEncodeFunPaint2Unpacked(DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
306 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
307 // Add the header bits
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
308 if (!dmGrowBufPut(buf, fmtFunPaint2MagicID, strlen(fmtFunPaint2MagicID)) ||
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
309 !dmGrowBufPutU8(buf, 0))
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
310 return DMERR_MALLOC;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
311
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
312 return dmC64EncodeGenericBMP(FALSE, buf, img, fmt);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
313 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
314
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
315
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
316 static int fmtEncodeFunPaint2Packed(DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
317 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
318 int res;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
319 DMGrowBuf tmp;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
320 Uint8 rleMarker;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
321
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
322 // Encode the data to temp buffer
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
323 if ((res = dmC64EncodeGenericBMP(TRUE, &tmp, img, fmt)) != DMERR_OK)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
324 goto out;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
325
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
326 // Analyze the data ..
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
327 dmGenericRLEAnalyze(&tmp, &rleMarker, DM_RLE_MARKER);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
328 rleMarker = 0xff;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
329
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
330 // Add the header bits
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
331 if (!dmGrowBufPut(buf, fmtFunPaint2MagicID, strlen(fmtFunPaint2MagicID)) ||
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
332 !dmGrowBufPutU8(buf, rleMarker))
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
333 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
334 res = DMERR_MALLOC;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
335 goto out;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
336 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
337
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
338 // And now RLE compress the data to the existing buffer
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
339 res = dmEncodeGenericRLE(buf, tmp.data, tmp.data + tmp.len,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
340 rleMarker, 3, 255, DM_RLE_MARKER);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
341
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
342 out:
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
343 dmGrowBufFree(&tmp);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
344 return res;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
345 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
346
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
347
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
348 static Uint8 fmtGetPixelFunPaint2(
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
349 const DMC64Image *img, const int bmoffs, const int scroffs,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
350 const int vshift, const int vbitmap, const int raster)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
351 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
352 const int vbank = (raster & 7) + (vbitmap * 8);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
353 int vr, vb;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
354 if (raster < 100)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
355 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
356 vb = 0;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
357 vr = raster;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
358 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
359 else
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
360 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
361 vb = 0;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
362 vr = raster - 100;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
363 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
364
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
365 switch ((img->bitmap[vbitmap][bmoffs] >> vshift) & 3)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
366 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
367 case 0: return img->extraData[vb][vr] & 15; break;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
368 case 1: return img->screen[vbank][scroffs] >> 4; break;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
369 case 2: return img->screen[vbank][scroffs] & 15; break;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
370 default: return img->color[0][scroffs] & 15; break;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
371 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
372 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
373
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
374
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
375 static Uint8 fmtGetPixelGunPaint(
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
376 const DMC64Image *img, const int bmoffs, const int scroffs,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
377 const int vshift, const int vbitmap, const int raster)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
378 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
379 const int vbank = (raster & 7);// + (vbitmap * 8);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
380 int vr, vb;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
381 if (raster < 177)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
382 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
383 vb = 0;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
384 vr = raster;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
385 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
386 else
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
387 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
388 vb = 0;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
389 vr = raster - 177;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
390 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
391
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
392 switch ((img->bitmap[vbitmap][bmoffs] >> vshift) & 3)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
393 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
394 case 0: return img->extraData[vb][vr] & 15; break;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
395 case 1: return img->screen[vbank][scroffs] >> 4; break;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
396 case 2: return img->screen[vbank][scroffs] & 15; break;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
397 default: return img->color[0][scroffs] & 15; break;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
398 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
399 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
400
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
401
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
402 static Uint8 fmtGetPixelBMFLI(
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
403 const DMC64Image *img, const int bmoffs, const int scroffs,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
404 const int vshift, const int vbitmap, const int raster)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
405 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
406 const int vbank = raster & 7;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
407 switch ((img->bitmap[vbitmap][bmoffs] >> vshift) & 3)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
408 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
409 case 0: return img->extraData[0][raster]; break;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
410 case 1: return img->screen[vbank][scroffs] >> 4; break;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
411 case 2: return img->screen[vbank][scroffs] & 15; break;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
412 default: return img->color[0][scroffs] & 15; break;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
413 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
414 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
415
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
416
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
417 static Uint8 fmtGetPixelFLIDesigner(
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
418 const DMC64Image *img, const int bmoffs, const int scroffs,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
419 const int vshift, const int vbitmap, const int raster)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
420 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
421 return dmC64GetGenericMCPixel(img, bmoffs, scroffs, vshift, raster & 7, vbitmap, 0);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
422 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
423
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
424
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
425 static Uint8 fmtGetPixelCHFLI(
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
426 const DMC64Image *img, const int bmoffs, const int scroffs,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
427 const int vshift, const int vbitmap, const int raster)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
428 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
429 const int vbank = raster & 7;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
430
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
431 if ((img->bitmap[vbitmap][bmoffs] >> vshift) & 1)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
432 return img->screen[vbank][scroffs] >> 4;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
433 else
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
434 return img->screen[vbank][scroffs] & 15;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
435 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
436
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
437
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
438 static int fmtEncodeStub(DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
439 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
440 (void) buf;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
441 (void) img;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
442 (void) fmt;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
443
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
444 return dmError(DMERR_NOT_SUPPORTED,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
445 "Encoding of '%s' format not supported.\n",
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
446 fmt->name);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
447 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
448
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
449
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
450 //
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
451 // Array with data for supported formats
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
452 //
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
453 #define DEF_SCREEN_RAM(start, oindex, bindex, osize) { DT_SCREEN_RAM, (start) + ((osize) * (oindex)), (bindex), 0, NULL, NULL }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
454 #define DEF_SCREEN_RAMS_8(start, sindex, osize) \
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
455 DEF_SCREEN_RAM((start), 0, (sindex + 0), (osize)), \
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
456 DEF_SCREEN_RAM((start), 1, (sindex + 1), (osize)), \
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
457 DEF_SCREEN_RAM((start), 2, (sindex + 2), (osize)), \
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
458 DEF_SCREEN_RAM((start), 3, (sindex + 3), (osize)), \
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
459 DEF_SCREEN_RAM((start), 4, (sindex + 4), (osize)), \
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
460 DEF_SCREEN_RAM((start), 5, (sindex + 5), (osize)), \
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
461 DEF_SCREEN_RAM((start), 6, (sindex + 6), (osize)), \
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
462 DEF_SCREEN_RAM((start), 7, (sindex + 7), (osize)),
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
463
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
464
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
465 const DMC64ImageFormat dmC64ImageFormats[] =
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
466 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
467 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
468 D64_FMT_MC, "d2p", "DrazPaint 1.4/2.0 (packed)", 0x5800, 0,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
469 C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
470 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
471 fmtProbeDrazPaint20Packed,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
472 fmtDecodeDrazPaintPacked, fmtEncodeDrazPaintPacked,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
473 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
474 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
475 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
476 { DT_COLOR_RAM, 0x0000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
477 { DT_BITMAP, 0x0800, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
478 { DT_SCREEN_RAM, 0x0400, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
479 { DT_COLOR_REG, 0x2740, 0, DC_BGCOL, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
480 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
481 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
482 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
483
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
484 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
485 D64_FMT_MC, "drp", "DrazPaint (unpacked)", 0x5800, 10051,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
486 C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
487 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
488 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
489 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
490 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
491 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
492 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
493 { DT_COLOR_RAM, 0x0000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
494 { DT_BITMAP, 0x0800, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
495 { DT_SCREEN_RAM, 0x0400, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
496 { DT_COLOR_REG, 0x2740, 0, DC_BGCOL, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
497 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
498 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
499 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
500
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
501 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
502 D64_FMT_MC | D64_FMT_ILACE, "dlp", "DrazLace 1.0 (packed)", 0x5800, 0,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
503 C64_SCR_WIDTH , C64_SCR_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
504 C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
505 fmtProbeDrazLace10Packed,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
506 fmtDecodeDrazPaintPacked, fmtEncodeDrazPaintPacked,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
507 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
508 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
509 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
510 { DT_COLOR_RAM, 0x0000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
511 { DT_BITMAP, 0x0800, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
512 { DT_SCREEN_RAM, 0x0400, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
513 { DT_COLOR_REG, 0x2740, 0, DC_BGCOL, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
514 { DT_BITMAP, 0x2800, 1, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
515 { DT_DEC_FUNCTION, 0x2742, 0, 1, fmtDrazLaceSetLaceType, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
516 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
517 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
518 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
519
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
520 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
521 D64_FMT_MC | D64_FMT_ILACE, "drl", "DrazLace 1.0 (unpacked)", 0x5800, 18242,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
522 C64_SCR_WIDTH , C64_SCR_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
523 C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
524 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
525 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
526 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
527 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
528 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
529 { DT_COLOR_RAM, 0x0000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
530 { DT_BITMAP, 0x0800, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
531 { DT_SCREEN_RAM, 0x0400, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
532 { DT_COLOR_REG, 0x2740, 0, DC_BGCOL, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
533 { DT_BITMAP, 0x2800, 1, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
534 { DT_DEC_FUNCTION, 0x2742, 0, 1, fmtDrazLaceSetLaceType, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
535 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
536 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
537 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
538
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
539 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
540 D64_FMT_MC | D64_FMT_ILACE, "mci", "Truepaint (unpacked)", 0x9c00, 19434,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
541 C64_SCR_WIDTH , C64_SCR_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
542 C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
543 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
544 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
545 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
546 fmtGetPixelTruePaint,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
547 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
548 { DT_SCREEN_RAM, 0x0000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
549 { DT_COLOR_REG, 0x03e8, 0, DC_BGCOL, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
550 { DT_BITMAP, 0x0400, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
551 { DT_BITMAP, 0x2400, 1, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
552 { DT_SCREEN_RAM, 0x4400, 1, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
553 { DT_COLOR_RAM, 0x4800, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
554 { DT_DEC_FUNCTION, 0x0000, 0, 0, fmtTruePaintSetLaceType, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
555 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
556 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
557 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
558
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
559 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
560 D64_FMT_MC, "kla", "Koala Paint (unpacked)", 0x6000, 10003,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
561 C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
562 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
563 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
564 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
565 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
566 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
567 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
568 { DT_BITMAP, 0x0000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
569 { DT_SCREEN_RAM, 0x1f40, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
570 { DT_COLOR_RAM, 0x2328, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
571 { DT_COLOR_REG, 0x2710, 0, DC_BGCOL, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
572 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
573 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
574 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
575
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
576 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
577 D64_FMT_MC, "ocp", "Advanced Art Studio (unpacked)", 0x2000, 10018,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
578 C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
579 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
580 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
581 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
582 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
583 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
584 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
585 { DT_BITMAP, 0x0000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
586 { DT_SCREEN_RAM, 0x1f40, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
587 { DT_COLOR_RAM, 0x2338, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
588 { DT_COLOR_REG, 0x2329, 0, DC_BGCOL, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
589 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
590 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
591 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
592
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
593 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
594 D64_FMT_MC, "ami", "Amica Paint (packed)", 0x4000, 0,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
595 C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
596 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
597 fmtProbeAmicaPaintPacked,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
598 fmtDecodeAmicaPaintPacked, fmtEncodeStub,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
599 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
600 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
601 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
602 { DT_COLOR_RAM, 0x2328, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
603 { DT_BITMAP, 0x0000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
604 { DT_SCREEN_RAM, 0x1f40, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
605 { DT_COLOR_REG, 0x2710, 0, DC_BGCOL, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
606 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
607 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
608 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
609
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
610 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
611 D64_FMT_MC, "rpm", "Run Paint (unpacked)", 0x6000, 10006,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
612 C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
613 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
614 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
615 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
616 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
617 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
618 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
619 { DT_COLOR_RAM, 0x2328, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
620 { DT_BITMAP, 0x0000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
621 { DT_SCREEN_RAM, 0x1f40, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
622 { DT_COLOR_REG, 0x2710, 0, DC_BGCOL, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
623 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
624 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
625 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
626
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
627 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
628 D64_FMT_HIRES, "art", "Art Studio (unpacked)", 0x2000, 9009,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
629 C64_SCR_WIDTH , C64_SCR_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
630 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
631 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
632 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
633 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
634 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
635 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
636 { DT_BITMAP, 0x0000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
637 { DT_SCREEN_RAM, 0x1f40, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
638 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
639 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
640 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
641
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
642 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
643 D64_FMT_HIRES, "iph", "Interpaint (unpacked)", 0x4000, 9002,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
644 C64_SCR_WIDTH , C64_SCR_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
645 C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
646 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
647 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
648 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
649 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
650 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
651 { DT_BITMAP, 0x0000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
652 { DT_SCREEN_RAM, 0x1f40, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
653 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
654 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
655 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
656
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
657 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
658 D64_FMT_MC, "ipc", "Interpaint MC (unpacked)", 0x4000, 10003,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
659 C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
660 C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
661 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
662 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
663 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
664 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
665 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
666 { DT_BITMAP, 0x0000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
667 { DT_SCREEN_RAM, 0x1f40, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
668 { DT_COLOR_RAM, 0x2328, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
669 { DT_COLOR_REG, 0x2710, 0, DC_BGCOL, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
670 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
671 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
672 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
673
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
674 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
675 D64_FMT_HIRES, "dd", "Doodle (unpacked)", 0x1c00, 9218,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
676 C64_SCR_WIDTH , C64_SCR_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
677 C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
678 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
679 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
680 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
681 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
682 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
683 { DT_SCREEN_RAM, 0x0000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
684 { DT_BITMAP, 0x0400, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
685 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
686 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
687 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
688
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
689 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
690 D64_FMT_MC | D64_FMT_FLI, "bml", "Blackmail FLI (unpacked)", 0x3b00, 17474,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
691 C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
692 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
693 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
694 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
695 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
696 fmtGetPixelBMFLI,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
697 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
698 { DT_EXTRA_DATA, 0x0000, 0, 200, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
699 { DT_COLOR_RAM, 0x0100, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
700 DEF_SCREEN_RAMS_8( 0x0500, 0, 0x400)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
701 { DT_BITMAP, 0x2500, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
702 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
703 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
704 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
705
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
706 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
707 D64_FMT_MC | D64_FMT_FLI, "fli", "FLI Designer (unpacked)", 0, 17409,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
708 C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
709 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
710 fmtProbeFLIDesigner,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
711 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
712 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
713 fmtGetPixelFLIDesigner,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
714 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
715 { DT_COLOR_RAM, 0x0000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
716 DEF_SCREEN_RAMS_8( 0x0400, 0, 0x400)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
717 { DT_BITMAP, 0x2400, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
718 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
719 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
720 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
721
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
722 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
723 D64_FMT_MC, "xx1", "Unknown $2000 format (unpacked)", 0x2000, 10242,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
724 C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
725 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
726 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
727 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
728 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
729 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
730 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
731 { DT_BITMAP, 0x0000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
732 { DT_SCREEN_RAM, 0x2000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
733 { DT_COLOR_RAM, 0x2400, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
734 { DT_COLOR_SET, 0x00 , 0, DC_BGCOL, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
735 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
736 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
737 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
738
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
739 #define XX2_WIDTH_CH 40
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
740 #define XX2_HEIGHT_CH 10
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
741 #define XX2_SIZE (XX2_WIDTH_CH * XX2_HEIGHT_CH)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
742 #define XX2_BSIZE (XX2_SIZE * 8)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
743
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
744 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
745 D64_FMT_MC, "xx2", "Unknown $2000 format (unpacked)", 0x2000, 0,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
746 XX2_WIDTH_CH * 4, XX2_HEIGHT_CH * 8,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
747 XX2_WIDTH_CH , XX2_HEIGHT_CH,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
748 fmtProbeFormatXX2,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
749 fmtDecodeFormatXX2, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
750 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
751 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
752 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
753 { DT_BITMAP, 0x0000, 0, XX2_BSIZE, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
754 { DT_COLOR_RAM, XX2_BSIZE + XX2_SIZE, 0, XX2_SIZE, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
755 { DT_SCREEN_RAM, XX2_BSIZE, 0, XX2_SIZE, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
756 { DT_COLOR_SET, 11, 0, DC_BGCOL, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
757 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
758 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
759 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
760
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
761 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
762 D64_FMT_MC | D64_FMT_FLI | D64_FMT_ILACE, "fp2", "FunPaint II (unpacked)", 0x3ff0, 33694,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
763 C64_SCR_WIDTH, C64_SCR_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
764 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
765 fmtProbeFunPaint2Unpacked,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
766 fmtDecodeFunPaint2Unpacked, fmtEncodeFunPaint2Unpacked,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
767 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
768 fmtGetPixelFunPaint2,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
769 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
770 DEF_SCREEN_RAMS_8( 0x0000, 0, 0x400)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
771 { DT_BITMAP, 0x2000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
772 { DT_EXTRA_DATA, 0x3f40, 0, 100, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
773 { DT_COLOR_RAM, 0x4000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
774 DEF_SCREEN_RAMS_8( 0x43e8, 8, 0x400)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
775 { DT_BITMAP, 0x63e8, 1, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
776 { DT_EXTRA_DATA, 0x8328, 1, 100, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
777 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
778 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
779 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
780
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
781 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
782 D64_FMT_MC | D64_FMT_FLI | D64_FMT_ILACE, "fp2p", "FunPaint II (packed)", 0x3ff0, 0,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
783 C64_SCR_WIDTH, C64_SCR_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
784 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
785 fmtProbeFunPaint2Packed,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
786 fmtDecodeFunPaint2Packed, fmtEncodeFunPaint2Packed,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
787 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
788 fmtGetPixelFunPaint2,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
789 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
790 DEF_SCREEN_RAMS_8( 0x0000, 0, 0x400)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
791 { DT_BITMAP, 0x2000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
792 { DT_EXTRA_DATA, 0x3f40, 0, 100, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
793 { DT_COLOR_RAM, 0x4000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
794 DEF_SCREEN_RAMS_8( 0x43e8, 8, 0x400)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
795 { DT_BITMAP, 0x63e8, 1, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
796 { DT_EXTRA_DATA, 0x8328, 1, 100, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
797 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
798 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
799 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
800
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
801 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
802 D64_FMT_MC | D64_FMT_FLI | D64_FMT_ILACE, "gun", "GunPaint (unpacked)", 0x4000, 0,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
803 C64_SCR_WIDTH, C64_SCR_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
804 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
805 fmtProbeGunPaint,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
806 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
807 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
808 fmtGetPixelGunPaint,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
809 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
810 DEF_SCREEN_RAMS_8( 0x0000, 0, 0x400)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
811 { DT_BITMAP, 0x2000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
812 { DT_EXTRA_DATA, 0x3f4f, 0, 177, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
813 { DT_COLOR_RAM, 0x4000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
814 DEF_SCREEN_RAMS_8( 0x4400, 8, 0x400)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
815 { DT_BITMAP, 0x6400, 1, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
816 { DT_EXTRA_DATA, 0x47e8, 1, 20, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
817 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
818 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
819 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
820
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
821 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
822 D64_FMT_HIRES | D64_FMT_FLI, "chi", "Crest Hires FLI Designer (unpacked)", 0x4000, 16386,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
823 C64_SCR_WIDTH, 14 * 8,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
824 C64_SCR_CH_WIDTH , 14,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
825 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
826 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
827 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
828 fmtGetPixelCHFLI,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
829 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
830 { DT_BITMAP, 0x0000, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
831 DEF_SCREEN_RAMS_8( 0x2000, 0, 0x400)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
832 { DT_LAST, 0, 0, 0, NULL, NULL },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
833 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
834 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
835 };
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
836
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
837 const int ndmC64ImageFormats = sizeof(dmC64ImageFormats) / sizeof(dmC64ImageFormats[0]);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
838