annotate tools/lib64fmts.c @ 1754:aa6a858db6bd

Implement support for CPU-Paint unpacked format.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 11 Jun 2018 15:44:17 +0300
parents 09641e7179f6
children 841ee79030fa
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
1594
afb49736615a Implement packed Koala Painter probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
13 static int fmtProbeKoalaPaintPacked(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
afb49736615a Implement packed Koala Painter probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
14 {
afb49736615a Implement packed Koala Painter probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
15 // Attempt to prevent misprobes of unpacked Koala and Run Paint
afb49736615a Implement packed Koala Painter probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
16 if (len > 30 &&
afb49736615a Implement packed Koala Painter probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
17 len != 10006 &&
1636
710961d02b8a Fix packed Koala Painter probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1635
diff changeset
18 len != 10003 &&
1594
afb49736615a Implement packed Koala Painter probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
19 dmCompareAddr16(buf, 0, fmt->addr))
afb49736615a Implement packed Koala Painter probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
20 return DM_PROBE_SCORE_MAX;
afb49736615a Implement packed Koala Painter probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
21
afb49736615a Implement packed Koala Painter probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
22 return DM_PROBE_SCORE_FALSE;
afb49736615a Implement packed Koala Painter probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
23 }
afb49736615a Implement packed Koala Painter probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
24
afb49736615a Implement packed Koala Painter probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
25
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
26 static int fmtDecodeKoalaPaintPacked(DMC64Image *img, const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
1578
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
27 {
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
28 int res;
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
29 DMGrowBuf mem;
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
30 DMCompParams cfg;
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
31
1711
4fd94bf558b3 Add function name field to DMCompParams struct and set it in places where we use DMCompParams.
Matti Hamalainen <ccr@tnsp.org>
parents: 1707
diff changeset
32 cfg.func = fmt->name;
1712
1f4ed247763d Indentation cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1711
diff changeset
33 cfg.type = DM_COMP_RLE_MARKER;
1f4ed247763d Indentation cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1711
diff changeset
34 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_2;
1f4ed247763d Indentation cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1711
diff changeset
35 cfg.rleMarkerB = 0xfe;
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
36
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
37 if ((res = dmDecodeGenericRLEAlloc(&mem, buf, &cfg)) != DMERR_OK)
1578
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
38 goto out;
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
39
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
40 res = dmC64DecodeGenericBMP(img, &mem, fmt);
1578
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
41
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
42 out:
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
43 dmGrowBufFree(&mem);
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
44 return res;
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
45 }
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
46
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
47
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
48 static int fmtEncodeKoalaPaintPacked(DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt)
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
49 {
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
50 int res;
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
51 DMGrowBuf tmp;
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
52 DMCompParams cfg;
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
53
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
54 // Encode the data to temp buffer
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
55 if ((res = dmC64EncodeGenericBMP(TRUE, &tmp, img, fmt)) != DMERR_OK)
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
56 goto out;
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
57
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
58 // And now RLE compress the data to the existing buffer
1711
4fd94bf558b3 Add function name field to DMCompParams struct and set it in places where we use DMCompParams.
Matti Hamalainen <ccr@tnsp.org>
parents: 1707
diff changeset
59 cfg.func = fmt->name;
1660
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
60 cfg.type = DM_COMP_RLE_MARKER;
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
61 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_2;
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
62 cfg.rleMarkerB = 0xfe;
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
63 cfg.rleMinCountB = 3;
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
64 cfg.rleMaxCountB = 255;
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
65 res = dmEncodeGenericRLE(buf, &tmp, &cfg);
1578
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
66
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
67 out:
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
68 dmGrowBufFree(&tmp);
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
69 return res;
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
70 }
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
71
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
72
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 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
74 {
1662
34d7c708649e Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1661
diff changeset
75 const Uint8 *ident = buf + 2;
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76 if (len > 22 &&
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77 dmCompareAddr16(buf, 0, fmt->addr) &&
1662
34d7c708649e Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1661
diff changeset
78 memcmp(ident, "DRAZPAINT ", 10) == 0 &&
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 ident[11] == '.' && (
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80 (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
81 (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
82 ))
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 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
84
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 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
86 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
89 static int fmtDecodeDrazPaintPacked(DMC64Image *img, const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 int res;
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
92 DMGrowBuf mem, tmp;
1505
3265175b24d2 Change the passing of RLE compression/decompression parameters to be in a dedicated struct.
Matti Hamalainen <ccr@tnsp.org>
parents: 1503
diff changeset
93 DMCompParams cfg;
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94
1711
4fd94bf558b3 Add function name field to DMCompParams struct and set it in places where we use DMCompParams.
Matti Hamalainen <ccr@tnsp.org>
parents: 1707
diff changeset
95 cfg.func = fmt->name;
1712
1f4ed247763d Indentation cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1711
diff changeset
96 cfg.type = DM_COMP_RLE_MARKER;
1f4ed247763d Indentation cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1711
diff changeset
97 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1;
1f4ed247763d Indentation cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1711
diff changeset
98 cfg.rleMarkerB = buf->data[0x0d];
1505
3265175b24d2 Change the passing of RLE compression/decompression parameters to be in a dedicated struct.
Matti Hamalainen <ccr@tnsp.org>
parents: 1503
diff changeset
99
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
100 if ((res = dmDecodeGenericRLEAlloc(&mem,
1747
5e928618fdc8 Change DMGrowBuf API somewhat and implement more copy operations.
Matti Hamalainen <ccr@tnsp.org>
parents: 1746
diff changeset
101 dmGrowBufConstCopyOffs(&tmp, buf, 0x0e), &cfg)) != DMERR_OK)
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 goto out;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
104 res = dmC64DecodeGenericBMP(img, &mem, fmt);
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
105
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
106 out:
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
107 dmGrowBufFree(&mem);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
108 return res;
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
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
112 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
113 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
114 int res;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
115 DMGrowBuf tmp;
1505
3265175b24d2 Change the passing of RLE compression/decompression parameters to be in a dedicated struct.
Matti Hamalainen <ccr@tnsp.org>
parents: 1503
diff changeset
116 DMCompParams cfg;
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
117 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
118
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
119 // 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
120 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
121 goto out;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
122
1650
9233da9de92c Refactor RLE encoding a bit, and add support for 16bit run counts and make things more configurable.
Matti Hamalainen <ccr@tnsp.org>
parents: 1649
diff changeset
123 // Analyze and setup RLE
1711
4fd94bf558b3 Add function name field to DMCompParams struct and set it in places where we use DMCompParams.
Matti Hamalainen <ccr@tnsp.org>
parents: 1707
diff changeset
124 cfg.func = fmt->name;
1660
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
125 cfg.type = DM_COMP_RLE_MARKER;
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
126 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1;
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
127 cfg.rleMinCountB = 3;
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
128 cfg.rleMaxCountB = 255;
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
130 dmGenericRLEAnalyze(&tmp, &cfg);
1661
dc3fbd130db7 RLE analyze was ran before setting up the compression config. Oops. Fixed.
Matti Hamalainen <ccr@tnsp.org>
parents: 1660
diff changeset
131
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132 // Add the header bits
1697
1036b0dcccb5 Refactor DMGrowBuf so that there can be buffers that grow "backwards".
Matti Hamalainen <ccr@tnsp.org>
parents: 1684
diff changeset
133 if (!dmGrowBufPut(buf, (Uint8 *) magicID, strlen(magicID)) ||
1660
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
134 !dmGrowBufPutU8(buf, cfg.rleMarkerB))
1503
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 res = DMERR_MALLOC;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137 goto out;
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
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140 // And now RLE compress the data to the existing buffer
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
141 res = dmEncodeGenericRLE(buf, &tmp, &cfg);
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 out:
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144 dmGrowBufFree(&tmp);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145 return res;
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
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
148
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
149 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
150 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
151 if (len > 22 &&
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
152 dmCompareAddr16(buf, 0, fmt->addr) &&
1662
34d7c708649e Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1661
diff changeset
153 memcmp(buf + 2, "DRAZLACE! 1.0", 13) == 0)
1503
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_MAX;
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 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
157 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
159
1529
4068d87ca884 Rename some decoder functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 1505
diff changeset
160 static BOOL fmtDrazLaceGetLaceType(DMC64Image *img, const DMC64EncDecOp *op,
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
161 const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
1503
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 (void) fmt;
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
164 img->laceType = buf->data[op->offs] ? D64_ILACE_RES : D64_ILACE_COLOR;
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165 return TRUE;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166 }
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
1535
2f7ff28ea56e Fix DrazLace encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1529
diff changeset
169 static BOOL fmtDrazLaceSetLaceType(const DMC64EncDecOp *op, DMGrowBuf *buf,
2f7ff28ea56e Fix DrazLace encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1529
diff changeset
170 const DMC64Image *img, const DMC64ImageFormat *fmt)
2f7ff28ea56e Fix DrazLace encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1529
diff changeset
171 {
2f7ff28ea56e Fix DrazLace encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1529
diff changeset
172 (void) fmt;
2f7ff28ea56e Fix DrazLace encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1529
diff changeset
173 buf->data[op->offs] = (img->laceType == D64_ILACE_RES) ? 1 : 0;
2f7ff28ea56e Fix DrazLace encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1529
diff changeset
174 return TRUE;
2f7ff28ea56e Fix DrazLace encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1529
diff changeset
175 }
2f7ff28ea56e Fix DrazLace encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1529
diff changeset
176
2f7ff28ea56e Fix DrazLace encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1529
diff changeset
177
1662
34d7c708649e Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1661
diff changeset
178 static const char *fmtBDP5MagicID = "BDP 5.00";
34d7c708649e Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1661
diff changeset
179
1651
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
180 static int fmtProbeBDP5Packed(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
181 {
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
182 if (len > 20 &&
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
183 dmCompareAddr16(buf, 0, fmt->addr) &&
1662
34d7c708649e Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1661
diff changeset
184 memcmp(buf + 2, fmtBDP5MagicID, strlen(fmtBDP5MagicID)) == 0)
1651
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
185 return DM_PROBE_SCORE_MAX;
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
186
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
187 return DM_PROBE_SCORE_FALSE;
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
188 }
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
189
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
190
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
191 static int fmtDecodeBDP5Packed(DMC64Image *img, const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
1651
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
192 {
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
193 int res;
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
194 DMGrowBuf mem, tmp;
1651
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
195 DMCompParams cfg;
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
196
1711
4fd94bf558b3 Add function name field to DMCompParams struct and set it in places where we use DMCompParams.
Matti Hamalainen <ccr@tnsp.org>
parents: 1707
diff changeset
197 cfg.func = fmt->name;
1712
1f4ed247763d Indentation cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1711
diff changeset
198 cfg.type = DM_COMP_RLE_MARKER;
1f4ed247763d Indentation cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1711
diff changeset
199 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_WORD_RUNS | DM_RLE_ORDER_1;
1f4ed247763d Indentation cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1711
diff changeset
200 cfg.rleMarkerB = buf->data[8];
1f4ed247763d Indentation cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1711
diff changeset
201 cfg.rleMarkerW = buf->data[9];
1651
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
202
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
203 if ((res = dmDecodeGenericRLEAlloc(&mem,
1747
5e928618fdc8 Change DMGrowBuf API somewhat and implement more copy operations.
Matti Hamalainen <ccr@tnsp.org>
parents: 1746
diff changeset
204 dmGrowBufConstCopyOffs(&tmp, buf, 10), &cfg)) != DMERR_OK)
1651
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
205 goto out;
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
206
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
207 res = dmC64DecodeGenericBMP(img, &mem, fmt);
1651
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
208
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
209 out:
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
210 dmGrowBufFree(&mem);
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
211 return res;
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
212 }
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
213
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
214
1663
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
215 static int fmtEncodeBDP5Packed(DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt)
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
216 {
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
217 int res;
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
218 DMGrowBuf mem;
1663
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
219 DMCompParams cfg;
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
220
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
221 // Encode the data to temp buffer
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
222 if ((res = dmC64EncodeGenericBMP(TRUE, &mem, img, fmt)) != DMERR_OK)
1663
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
223 goto out;
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
224
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
225 // Analyze and setup RLE
1711
4fd94bf558b3 Add function name field to DMCompParams struct and set it in places where we use DMCompParams.
Matti Hamalainen <ccr@tnsp.org>
parents: 1707
diff changeset
226 cfg.func = fmt->name;
1663
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
227 cfg.type = DM_COMP_RLE_MARKER;
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
228 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_WORD_RUNS | DM_RLE_ORDER_1;
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
229 cfg.rleMinCountB = 3;
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
230 cfg.rleMaxCountB = 255;
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
231 cfg.rleMinCountW = 256;
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
232 cfg.rleMaxCountW = 1024;
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
233
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
234 dmGenericRLEAnalyze(&mem, &cfg);
1663
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
235
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
236 // Add the header bits
1697
1036b0dcccb5 Refactor DMGrowBuf so that there can be buffers that grow "backwards".
Matti Hamalainen <ccr@tnsp.org>
parents: 1684
diff changeset
237 if (!dmGrowBufPut(buf, (Uint8 *) fmtBDP5MagicID, strlen(fmtBDP5MagicID)) ||
1663
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
238 !dmGrowBufPutU8(buf, cfg.rleMarkerB) ||
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
239 !dmGrowBufPutU8(buf, cfg.rleMarkerW))
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
240 {
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
241 res = DMERR_MALLOC;
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
242 goto out;
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
243 }
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
244
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
245 // And now RLE compress the data to the existing buffer
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
246 res = dmEncodeGenericRLE(buf, &mem, &cfg);
1663
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
247
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
248 out:
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
249 dmGrowBufFree(&mem);
1663
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
250 return res;
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
251 }
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
252
8ae32df3c184 Add support for BDP5 format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1662
diff changeset
253
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
254 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
255 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
256 if (len > 0x400 &&
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) &&
1662
34d7c708649e Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1661
diff changeset
258 memcmp(buf + 0x3ea, "GUNPAINT (JZ) ", 14) == 0)
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
259 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
260
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
261 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
262 }
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
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
265 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
266 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
267 size_t i, n;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
268
1745
2dbb2b63f6b3 Improve Amica Paint format probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1739
diff changeset
269 if (len < 256 || !dmCompareAddr16(buf, 0, fmt->addr))
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
270 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
271
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
272 // 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
273 // 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
274 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
275 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
276
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
277 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
278 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
279
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
280 if (n > 50)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
281 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
282 if (n > 25)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
283 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
284 if (n > 10)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
285 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
286
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
287 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
288 }
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
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
291 static int fmtDecodeAmicaPaintPacked(DMC64Image *img, const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
292 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
293 int res;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
294 DMGrowBuf mem, tmp;
1505
3265175b24d2 Change the passing of RLE compression/decompression parameters to be in a dedicated struct.
Matti Hamalainen <ccr@tnsp.org>
parents: 1503
diff changeset
295 DMCompParams cfg;
1503
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 // 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
298 // so we need to do some crappy buffer expansion here ..
1751
768fddda73e9 Convert fmtDecodeAmicaPaintPacked() to use the new DMGrowBuf functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 1749
diff changeset
299 if (dmGrowBufCopy(&tmp, buf, 1) == NULL)
768fddda73e9 Convert fmtDecodeAmicaPaintPacked() to use the new DMGrowBuf functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 1749
diff changeset
300 return DMERR_MALLOC;
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
301
1751
768fddda73e9 Convert fmtDecodeAmicaPaintPacked() to use the new DMGrowBuf functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 1749
diff changeset
302 tmp.len = tmp.size;
1503
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 // Now do an RLE decode on the enlarged buffer
1711
4fd94bf558b3 Add function name field to DMCompParams struct and set it in places where we use DMCompParams.
Matti Hamalainen <ccr@tnsp.org>
parents: 1707
diff changeset
305 cfg.func = fmt->name;
1712
1f4ed247763d Indentation cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1711
diff changeset
306 cfg.type = DM_COMP_RLE_MARKER;
1f4ed247763d Indentation cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1711
diff changeset
307 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1;
1f4ed247763d Indentation cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1711
diff changeset
308 cfg.rleMarkerB = 0xC2;
1650
9233da9de92c Refactor RLE encoding a bit, and add support for 16bit run counts and make things more configurable.
Matti Hamalainen <ccr@tnsp.org>
parents: 1649
diff changeset
309
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
310 if ((res = dmDecodeGenericRLEAlloc(&mem, &tmp, &cfg)) != DMERR_OK)
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
311 goto out;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
312
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
313 // And finally decode to bitmap struct
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
314 res = dmC64DecodeGenericBMP(img, &mem, fmt);
1503
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 out:
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
317 dmGrowBufFree(&tmp);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
318 dmGrowBufFree(&mem);
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
319 return res;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
320 }
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
1538
af729e29a6f6 Implement Amica Paint packed format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1535
diff changeset
323 static int fmtEncodeAmicaPaintPacked(DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt)
af729e29a6f6 Implement Amica Paint packed format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1535
diff changeset
324 {
af729e29a6f6 Implement Amica Paint packed format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1535
diff changeset
325 int res;
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
326 DMGrowBuf mem;
1538
af729e29a6f6 Implement Amica Paint packed format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1535
diff changeset
327 DMCompParams cfg;
af729e29a6f6 Implement Amica Paint packed format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1535
diff changeset
328
af729e29a6f6 Implement Amica Paint packed format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1535
diff changeset
329 // Encode the data to temp buffer
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
330 if ((res = dmC64EncodeGenericBMP(TRUE, &mem, img, fmt)) != DMERR_OK)
1538
af729e29a6f6 Implement Amica Paint packed format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1535
diff changeset
331 goto out;
af729e29a6f6 Implement Amica Paint packed format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1535
diff changeset
332
af729e29a6f6 Implement Amica Paint packed format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1535
diff changeset
333 // And now RLE compress the data to the existing buffer
1711
4fd94bf558b3 Add function name field to DMCompParams struct and set it in places where we use DMCompParams.
Matti Hamalainen <ccr@tnsp.org>
parents: 1707
diff changeset
334 cfg.func = fmt->name;
1660
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
335 cfg.type = DM_COMP_RLE_MARKER;
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
336 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1;
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
337 cfg.rleMarkerB = 0xC2;
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
338 cfg.rleMinCountB = 3;
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
339 cfg.rleMaxCountB = 255;
1650
9233da9de92c Refactor RLE encoding a bit, and add support for 16bit run counts and make things more configurable.
Matti Hamalainen <ccr@tnsp.org>
parents: 1649
diff changeset
340
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
341 res = dmEncodeGenericRLE(buf, &mem, &cfg);
1538
af729e29a6f6 Implement Amica Paint packed format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1535
diff changeset
342
af729e29a6f6 Implement Amica Paint packed format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1535
diff changeset
343 out:
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
344 dmGrowBufFree(&mem);
1538
af729e29a6f6 Implement Amica Paint packed format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1535
diff changeset
345 return res;
af729e29a6f6 Implement Amica Paint packed format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1535
diff changeset
346 }
af729e29a6f6 Implement Amica Paint packed format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1535
diff changeset
347
af729e29a6f6 Implement Amica Paint packed format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1535
diff changeset
348
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
349 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
350 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
351 if (len == fmt->size &&
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
352 (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
353 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
354
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
355 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
356 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
357
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
358
1529
4068d87ca884 Rename some decoder functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 1505
diff changeset
359 static BOOL fmtTruePaintGetLaceType(DMC64Image *img, const DMC64EncDecOp *op,
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
360 const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
361 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
362 (void) op;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
363 (void) buf;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
364 (void) fmt;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
365 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
366 return TRUE;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
367 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
368
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
369
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
370 static Uint8 fmtGetPixelTruePaint(
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
371 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
372 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
373 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
374 (void) raster;
1577
632f1dbc83eb Get rid of some code duplication by merging functionality of certain pixel
Matti Hamalainen <ccr@tnsp.org>
parents: 1575
diff changeset
375 return dmC64GetGenericMCPixel(img, bmoffs, scroffs, vshift, 0, vbitmap, 0, img->bgcolor);
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
376 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
377
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
378
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
379 static int fmtProbeTruePaintPacked(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
380 {
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
381 // The beginning/un-changing part of the BASIC bootstrap and
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
382 // relocation of decompression code
1684
e7990551c6d6 Rename function variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 1671
diff changeset
383 static const Uint8 magicID[] = {
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
384 0x0b, 0x08, 0x09, 0x00, 0x9e, 0x32, 0x30, 0x35,
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
385 0x39, 0x00, 0xa2, 0x00, 0x78, 0xbd, 0x1c, 0x08,
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
386 0x9d, 0xf5, 0x00, 0xe8, 0xd0, 0xf7, 0xe6, 0x01,
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
387 0x4c, 0x01, 0x01, 0xa5, 0xfe, 0xd0, 0x02, 0xc6,
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
388 0xff, 0xc6, 0xfe
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
389 };
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
390
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
391 if (len >= 512 && dmCompareAddr16(buf, 0, fmt->addr) &&
1684
e7990551c6d6 Rename function variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 1671
diff changeset
392 memcmp(buf + 2, magicID, sizeof(magicID)) == 0)
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
393 return DM_PROBE_SCORE_MAX;
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
394
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
395 return DM_PROBE_SCORE_FALSE;
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
396 }
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
397
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
398
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
399 //
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
400 // Based on disassembly of the depacker routine. Encoding seems to be
1714
95317672ff00 Improve a comment on TruePaint encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1712
diff changeset
401 // some kind of "improved RLE" variant with different modes and a
95317672ff00 Improve a comment on TruePaint encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1712
diff changeset
402 // simplistic "codebook".
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
403 //
1722
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
404 static int fmtTruePaintGetByte(DMGrowBuf *src, Uint8 *data, const int mode)
1649
dbdff3d50a4e Clean up fmtDecodeTruePaintPacked() a bit, and fix GCC warnings about
Matti Hamalainen <ccr@tnsp.org>
parents: 1648
diff changeset
405 {
1722
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
406 if (!dmGrowBufGetU8(src, data))
1649
dbdff3d50a4e Clean up fmtDecodeTruePaintPacked() a bit, and fix GCC warnings about
Matti Hamalainen <ccr@tnsp.org>
parents: 1648
diff changeset
407 {
1722
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
408 return dmError(DMERR_INVALID_DATA,
1649
dbdff3d50a4e Clean up fmtDecodeTruePaintPacked() a bit, and fix GCC warnings about
Matti Hamalainen <ccr@tnsp.org>
parents: 1648
diff changeset
409 "TruePaintRLE: Out of input data (N=%d)\n", mode);
dbdff3d50a4e Clean up fmtDecodeTruePaintPacked() a bit, and fix GCC warnings about
Matti Hamalainen <ccr@tnsp.org>
parents: 1648
diff changeset
410 }
dbdff3d50a4e Clean up fmtDecodeTruePaintPacked() a bit, and fix GCC warnings about
Matti Hamalainen <ccr@tnsp.org>
parents: 1648
diff changeset
411 else
1722
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
412 return DMERR_OK;
1649
dbdff3d50a4e Clean up fmtDecodeTruePaintPacked() a bit, and fix GCC warnings about
Matti Hamalainen <ccr@tnsp.org>
parents: 1648
diff changeset
413 }
dbdff3d50a4e Clean up fmtDecodeTruePaintPacked() a bit, and fix GCC warnings about
Matti Hamalainen <ccr@tnsp.org>
parents: 1648
diff changeset
414
dbdff3d50a4e Clean up fmtDecodeTruePaintPacked() a bit, and fix GCC warnings about
Matti Hamalainen <ccr@tnsp.org>
parents: 1648
diff changeset
415
1722
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
416 static int fmtDecodeTruePaintPacked(DMC64Image *img, const DMGrowBuf *psrc, const DMC64ImageFormat *fmt)
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
417 {
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
418 int res = DMERR_OK;
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
419 const Uint8 *codeBook1, *codeBook2;
1722
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
420 DMGrowBuf dst, src;
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
421 DMCompParams cfg;
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
422 Uint8 data;
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
423
1724
12504f179749 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1723
diff changeset
424 // 1b7e-67e8 decoded by original depacker
12504f179749 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1723
diff changeset
425 // 1c00-67e8 is the actual area used tho
1722
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
426 cfg.func = fmt->name;
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
427 cfg.type = DM_COMP_RLE_MARKER;
1724
12504f179749 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1723
diff changeset
428 cfg.flags = DM_RLE_BACKWARDS_OUTPUT | DM_RLE_BACKWARDS_INPUT | DM_OUT_CROP_END;
1722
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
429 cfg.rleMarkerB = 0xfe;
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
430 cfg.cropOutLen = 0x67e8 - 0x1c00;
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
431
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
432 // Codebooks: #1 is trampoline table markers, #2 is RLE data table
1722
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
433 codeBook1 = psrc->data + 0x81 - 2;
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
434 codeBook2 = psrc->data + 0x85 - 2;
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
435
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
436 // Allocate output buffer
1722
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
437 if ((res = dmGrowBufAlloc(&dst, 64*1024, 4*1024)) != DMERR_OK)
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
438 goto out;
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
439
1722
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
440 // As we need to modify the offs, etc. but not the data,
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
441 // we will just make a shallow copy of the DMGrowBuf struct
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
442 dmGrowBufConstCopy(&src, psrc);
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
443 dmSetupRLEBuffers(&dst, &src, &cfg);
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
444
1722
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
445 while ((res = fmtTruePaintGetByte(&src, &data, -1)) == DMERR_OK)
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
446 {
1722
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
447 unsigned int count = 1;
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
448 BOOL found = FALSE;
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
449
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
450 for (int n = 0; n < 8; n++)
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
451 if (codeBook1[n] == data && !found)
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
452 {
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
453 found = TRUE;
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
454 switch (n)
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
455 {
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
456 case 4: // Y = 4, JTO = $0B
1722
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
457 if ((res = fmtTruePaintGetByte(&src, &data, n)) != DMERR_OK)
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
458 goto out;
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
459
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
460 count = data;
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
461 if (data == 0)
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
462 goto finish;
1649
dbdff3d50a4e Clean up fmtDecodeTruePaintPacked() a bit, and fix GCC warnings about
Matti Hamalainen <ccr@tnsp.org>
parents: 1648
diff changeset
463
dbdff3d50a4e Clean up fmtDecodeTruePaintPacked() a bit, and fix GCC warnings about
Matti Hamalainen <ccr@tnsp.org>
parents: 1648
diff changeset
464 // fallthrough
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
465
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
466 case 1: // Y = 1, JTO = $17
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
467 count += 2;
1649
dbdff3d50a4e Clean up fmtDecodeTruePaintPacked() a bit, and fix GCC warnings about
Matti Hamalainen <ccr@tnsp.org>
parents: 1648
diff changeset
468 // fallthrough
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
469
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
470 case 0: // Y = 0, JTO = $19
1722
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
471 if ((res = fmtTruePaintGetByte(&src, &data, n)) != DMERR_OK)
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
472 goto out;
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
473 break;
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
474
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
475 case 2: // Y = 2, JTO = $07
1722
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
476 if ((res = fmtTruePaintGetByte(&src, &data, n)) != DMERR_OK)
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
477 goto out;
1649
dbdff3d50a4e Clean up fmtDecodeTruePaintPacked() a bit, and fix GCC warnings about
Matti Hamalainen <ccr@tnsp.org>
parents: 1648
diff changeset
478
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
479 count = data;
1649
dbdff3d50a4e Clean up fmtDecodeTruePaintPacked() a bit, and fix GCC warnings about
Matti Hamalainen <ccr@tnsp.org>
parents: 1648
diff changeset
480 // fallthrough
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
481
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
482 case 3: // Y = 3, JTO = $0B
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
483 count += 2;
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
484 data = 0;
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
485 break;
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
486
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
487 default: // Y = [5..8], JTO = $00
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
488 count++;
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
489 data = codeBook2[n];
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
490 break;
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
491 }
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
492 }
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
493
1722
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
494 if ((res = dmGenericRLEOutputRun(&dst, &cfg, data, count)) != DMERR_OK)
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
495 goto out;
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
496 }
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
497
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
498 finish:
1722
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
499 dmFinishRLEBuffers(&dst, &src, &cfg);
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
500 res = dmC64DecodeGenericBMP(img, &dst, fmt);
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
501
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
502 out:
1722
de8e0a404c06 Refactor fmtDecodeTruePaintPacked() to use more generic DMGrowBuf functions
Matti Hamalainen <ccr@tnsp.org>
parents: 1714
diff changeset
503 dmGrowBufFree(&dst);
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
504 return res;
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
505 }
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
506
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
507
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
508 #define XX2_MIN_SIZE 4000
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
509 #define XX2_WIDTH_CH 40
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
510 #define XX2_HEIGHT_CH 10
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
511 #define XX2_SIZE (XX2_WIDTH_CH * XX2_HEIGHT_CH)
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
512 #define XX2_BSIZE (XX2_SIZE * 8)
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
513
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
514
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
515 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
516 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
517 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
518 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
519 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
520
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
521 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
522 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
523
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
524
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
525 static int fmtDecodeFormatXX2(DMC64Image *img, const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
526 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
527 int res;
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
528 DMGrowBuf tmp;
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
529
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
530 // 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
531 // 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
532 // Otherwise allocate len bytes.
1748
9c4b3fecc510 Use the new DMGrowBuf functions in XX2 format buffer enlarging.
Matti Hamalainen <ccr@tnsp.org>
parents: 1747
diff changeset
533 if (dmGrowBufCopy(&tmp, buf, buf->len < XX2_MIN_SIZE ? XX2_MIN_SIZE - buf->len : 0) == NULL)
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
534 return DMERR_MALLOC;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
535
1748
9c4b3fecc510 Use the new DMGrowBuf functions in XX2 format buffer enlarging.
Matti Hamalainen <ccr@tnsp.org>
parents: 1747
diff changeset
536 tmp.len = tmp.size;
9c4b3fecc510 Use the new DMGrowBuf functions in XX2 format buffer enlarging.
Matti Hamalainen <ccr@tnsp.org>
parents: 1747
diff changeset
537 res = dmC64DecodeGenericBMP(img, &tmp, fmt);
9c4b3fecc510 Use the new DMGrowBuf functions in XX2 format buffer enlarging.
Matti Hamalainen <ccr@tnsp.org>
parents: 1747
diff changeset
538 dmGrowBufFree(&tmp);
1503
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 return res;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
541 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
542
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
543
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
544 #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
545 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
546
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
547
1579
4288b21e97b9 Improve and simplify Fun Paint 2 format support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1578
diff changeset
548 static int fmtProbeFunPaint2(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
549 {
1579
4288b21e97b9 Improve and simplify Fun Paint 2 format support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1578
diff changeset
550 if (len > 30 &&
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
551 dmCompareAddr16(buf, 0, fmt->addr) &&
1662
34d7c708649e Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1661
diff changeset
552 memcmp(buf + 2, fmtFunPaint2MagicID, strlen(fmtFunPaint2MagicID)) == 0)
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
553 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
554 else
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
555 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
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
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
559 static int fmtDecodeFunPaint2(DMC64Image *img, const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
560 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
561 int res;
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
562 DMGrowBuf tmp;
1579
4288b21e97b9 Improve and simplify Fun Paint 2 format support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1578
diff changeset
563
4288b21e97b9 Improve and simplify Fun Paint 2 format support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1578
diff changeset
564 // Check if the data is compressed
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
565 if (buf->data[14])
1579
4288b21e97b9 Improve and simplify Fun Paint 2 format support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1578
diff changeset
566 {
4288b21e97b9 Improve and simplify Fun Paint 2 format support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1578
diff changeset
567 DMGrowBuf mem;
4288b21e97b9 Improve and simplify Fun Paint 2 format support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1578
diff changeset
568 DMCompParams cfg;
4288b21e97b9 Improve and simplify Fun Paint 2 format support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1578
diff changeset
569
1711
4fd94bf558b3 Add function name field to DMCompParams struct and set it in places where we use DMCompParams.
Matti Hamalainen <ccr@tnsp.org>
parents: 1707
diff changeset
570 cfg.func = fmt->name;
1712
1f4ed247763d Indentation cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1711
diff changeset
571 cfg.type = DM_COMP_RLE_MARKER;
1f4ed247763d Indentation cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1711
diff changeset
572 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1;
1f4ed247763d Indentation cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 1711
diff changeset
573 cfg.rleMarkerB = buf->data[15];
1505
3265175b24d2 Change the passing of RLE compression/decompression parameters to be in a dedicated struct.
Matti Hamalainen <ccr@tnsp.org>
parents: 1503
diff changeset
574
1749
feaf5cf07603 Apparently Fun Paint 2 also saves one byte less than it should with the
Matti Hamalainen <ccr@tnsp.org>
parents: 1748
diff changeset
575 dmGrowBufCopyOffs(&tmp, buf, FUNPAINT2_HEADER_SIZE, 1);
feaf5cf07603 Apparently Fun Paint 2 also saves one byte less than it should with the
Matti Hamalainen <ccr@tnsp.org>
parents: 1748
diff changeset
576 tmp.len = tmp.size;
feaf5cf07603 Apparently Fun Paint 2 also saves one byte less than it should with the
Matti Hamalainen <ccr@tnsp.org>
parents: 1748
diff changeset
577
1598
b5e0f28f1842 Adjust Fun Paint 2 decoding now that the RLE decoding is fixed.
Matti Hamalainen <ccr@tnsp.org>
parents: 1594
diff changeset
578 if ((res = dmDecodeGenericRLEAlloc(
1749
feaf5cf07603 Apparently Fun Paint 2 also saves one byte less than it should with the
Matti Hamalainen <ccr@tnsp.org>
parents: 1748
diff changeset
579 &mem, &tmp, &cfg)) == DMERR_OK)
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
580 res = dmC64DecodeGenericBMP(img, &mem, fmt);
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
581
1579
4288b21e97b9 Improve and simplify Fun Paint 2 format support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1578
diff changeset
582 dmGrowBufFree(&mem);
1749
feaf5cf07603 Apparently Fun Paint 2 also saves one byte less than it should with the
Matti Hamalainen <ccr@tnsp.org>
parents: 1748
diff changeset
583 dmGrowBufFree(&tmp);
1579
4288b21e97b9 Improve and simplify Fun Paint 2 format support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1578
diff changeset
584 }
4288b21e97b9 Improve and simplify Fun Paint 2 format support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1578
diff changeset
585 else
4288b21e97b9 Improve and simplify Fun Paint 2 format support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1578
diff changeset
586 {
1747
5e928618fdc8 Change DMGrowBuf API somewhat and implement more copy operations.
Matti Hamalainen <ccr@tnsp.org>
parents: 1746
diff changeset
587 res = dmC64DecodeGenericBMP(img, dmGrowBufConstCopyOffs(&tmp, buf, FUNPAINT2_HEADER_SIZE), fmt);
1579
4288b21e97b9 Improve and simplify Fun Paint 2 format support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1578
diff changeset
588 }
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
589
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
590 return res;
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 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
595 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
596 // Add the header bits
1697
1036b0dcccb5 Refactor DMGrowBuf so that there can be buffers that grow "backwards".
Matti Hamalainen <ccr@tnsp.org>
parents: 1684
diff changeset
597 if (!dmGrowBufPut(buf, (Uint8 *) fmtFunPaint2MagicID, strlen(fmtFunPaint2MagicID)) ||
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
598 !dmGrowBufPutU8(buf, 0))
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
599 return DMERR_MALLOC;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
600
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
601 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
602 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
603
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
604
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
605 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
606 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
607 int res;
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
608 DMGrowBuf mem;
1505
3265175b24d2 Change the passing of RLE compression/decompression parameters to be in a dedicated struct.
Matti Hamalainen <ccr@tnsp.org>
parents: 1503
diff changeset
609 DMCompParams cfg;
1503
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 // Encode the data to temp buffer
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
612 if ((res = dmC64EncodeGenericBMP(TRUE, &mem, img, fmt)) != DMERR_OK)
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
613 goto out;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
614
1650
9233da9de92c Refactor RLE encoding a bit, and add support for 16bit run counts and make things more configurable.
Matti Hamalainen <ccr@tnsp.org>
parents: 1649
diff changeset
615 // Analyze and setup RLE
1711
4fd94bf558b3 Add function name field to DMCompParams struct and set it in places where we use DMCompParams.
Matti Hamalainen <ccr@tnsp.org>
parents: 1707
diff changeset
616 cfg.func = fmt->name;
1660
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
617 cfg.type = DM_COMP_RLE_MARKER;
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
618 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1;
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
619 cfg.rleMinCountB = 3;
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
620 cfg.rleMaxCountB = 255;
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
621
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
622 dmGenericRLEAnalyze(&mem, &cfg);
1661
dc3fbd130db7 RLE analyze was ran before setting up the compression config. Oops. Fixed.
Matti Hamalainen <ccr@tnsp.org>
parents: 1660
diff changeset
623
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
624 // Add the header bits
1697
1036b0dcccb5 Refactor DMGrowBuf so that there can be buffers that grow "backwards".
Matti Hamalainen <ccr@tnsp.org>
parents: 1684
diff changeset
625 if (!dmGrowBufPut(buf, (Uint8 *) fmtFunPaint2MagicID, strlen(fmtFunPaint2MagicID)) ||
1660
7555c8803529 More work on improving the generic RLE decoder/encoder.
Matti Hamalainen <ccr@tnsp.org>
parents: 1653
diff changeset
626 !dmGrowBufPutU8(buf, cfg.rleMarkerB))
1503
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 res = DMERR_MALLOC;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
629 goto out;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
630 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
631
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
632 // And now RLE compress the data to the existing buffer
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
633 res = dmEncodeGenericRLE(buf, &mem, &cfg);
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
634
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
635 out:
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
636 dmGrowBufFree(&mem);
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
637 return res;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
638 }
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 static Uint8 fmtGetPixelFunPaint2(
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
642 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
643 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
644 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
645 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
646 int vr, vb;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
647 if (raster < 100)
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
648 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
649 vb = 0;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
650 vr = raster;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
651 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
652 else
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
653 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
654 vb = 0;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
655 vr = raster - 100;
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
1577
632f1dbc83eb Get rid of some code duplication by merging functionality of certain pixel
Matti Hamalainen <ccr@tnsp.org>
parents: 1575
diff changeset
658 return dmC64GetGenericMCPixel(
632f1dbc83eb Get rid of some code duplication by merging functionality of certain pixel
Matti Hamalainen <ccr@tnsp.org>
parents: 1575
diff changeset
659 img, bmoffs, scroffs, vshift,
632f1dbc83eb Get rid of some code duplication by merging functionality of certain pixel
Matti Hamalainen <ccr@tnsp.org>
parents: 1575
diff changeset
660 vbank, vbitmap, 0,
1588
ca087c0cc9c4 Refactor the c64 format memory handling a bit for more flexibility.
Matti Hamalainen <ccr@tnsp.org>
parents: 1586
diff changeset
661 img->extraData[vb].data[vr] & 15);
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
662 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
663
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
664
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
665 static Uint8 fmtGetPixelGunPaint(
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
666 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
667 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
668 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
669 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
670 int vr, vb;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
671 if (raster < 177)
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 vb = 0;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
674 vr = raster;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
675 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
676 else
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
677 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
678 vb = 0;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
679 vr = raster - 177;
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
680 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
681
1577
632f1dbc83eb Get rid of some code duplication by merging functionality of certain pixel
Matti Hamalainen <ccr@tnsp.org>
parents: 1575
diff changeset
682 return dmC64GetGenericMCPixel(
632f1dbc83eb Get rid of some code duplication by merging functionality of certain pixel
Matti Hamalainen <ccr@tnsp.org>
parents: 1575
diff changeset
683 img, bmoffs, scroffs, vshift,
632f1dbc83eb Get rid of some code duplication by merging functionality of certain pixel
Matti Hamalainen <ccr@tnsp.org>
parents: 1575
diff changeset
684 vbank, vbitmap, 0,
1588
ca087c0cc9c4 Refactor the c64 format memory handling a bit for more flexibility.
Matti Hamalainen <ccr@tnsp.org>
parents: 1586
diff changeset
685 img->extraData[vb].data[vr] & 15);
1503
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
1582
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
689 static Uint8 fmtGetPixelBFLI(
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
690 const DMC64Image *img, const int bmoffs, const int scroffs,
1633
da4d7b5873c0 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1598
diff changeset
691 const int vshift, const int bitmap, const int raster)
1582
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
692 {
1633
da4d7b5873c0 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1598
diff changeset
693 const int vbb = bmoffs > 0x1fff ? 1 : 0;
1582
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
694 const int vbank = (raster & 7) + (vbb * 8);
1633
da4d7b5873c0 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1598
diff changeset
695 const int vbmoffs = bmoffs & 0x1fff;
da4d7b5873c0 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1598
diff changeset
696 const int vscroffs = scroffs & 0x3ff;
1582
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
697
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
698 //fprintf(stderr, "bmoffs=%d, scroffs=%d, vshift=%d, vbitmap=%d, raster=%d\n", vbmoffs, vscroffs, vshift, vbb, raster);
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
699
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
700 return dmC64GetGenericMCPixel(
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
701 img, vbmoffs, vscroffs, vshift,
1633
da4d7b5873c0 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1598
diff changeset
702 vbank, vbb, 0, img->bgcolor);
1582
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
703 }
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
704
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
705
1581
5aa1c3ec91d5 Rename a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 1579
diff changeset
706 static Uint8 fmtGetPixelBlackMailFLI(
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
707 const DMC64Image *img, const int bmoffs, const int scroffs,
1633
da4d7b5873c0 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1598
diff changeset
708 const int shift, const int bitmap, const int raster)
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
709 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
710 const int vbank = raster & 7;
1577
632f1dbc83eb Get rid of some code duplication by merging functionality of certain pixel
Matti Hamalainen <ccr@tnsp.org>
parents: 1575
diff changeset
711
632f1dbc83eb Get rid of some code duplication by merging functionality of certain pixel
Matti Hamalainen <ccr@tnsp.org>
parents: 1575
diff changeset
712 return dmC64GetGenericMCPixel(
1633
da4d7b5873c0 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1598
diff changeset
713 img, bmoffs, scroffs, shift,
da4d7b5873c0 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1598
diff changeset
714 vbank, bitmap, 0,
1588
ca087c0cc9c4 Refactor the c64 format memory handling a bit for more flexibility.
Matti Hamalainen <ccr@tnsp.org>
parents: 1586
diff changeset
715 img->extraData[0].data[raster] & 15);
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
716 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
717
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
718
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
719 static Uint8 fmtGetPixelFLIDesigner(
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
720 const DMC64Image *img, const int bmoffs, const int scroffs,
1633
da4d7b5873c0 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1598
diff changeset
721 const int shift, const int bitmap, const int raster)
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
722 {
1633
da4d7b5873c0 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1598
diff changeset
723 return dmC64GetGenericMCPixel(img, bmoffs, scroffs, shift, raster & 7, bitmap, 0, img->bgcolor);
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
724 }
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
725
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
726
1752
fe3ae3fdf0f3 Rename a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 1751
diff changeset
727 static Uint8 fmtGetPixelCrestHIFLIorCDHM(
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
728 const DMC64Image *img, const int bmoffs, const int scroffs,
1633
da4d7b5873c0 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1598
diff changeset
729 const int shift, const int bitmap, const int raster)
1503
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 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
732
1633
da4d7b5873c0 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 1598
diff changeset
733 if ((img->bitmap[bitmap].data[bmoffs] >> shift) & 1)
1588
ca087c0cc9c4 Refactor the c64 format memory handling a bit for more flexibility.
Matti Hamalainen <ccr@tnsp.org>
parents: 1586
diff changeset
734 return img->screen[vbank].data[scroffs] >> 4;
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
735 else
1588
ca087c0cc9c4 Refactor the c64 format memory handling a bit for more flexibility.
Matti Hamalainen <ccr@tnsp.org>
parents: 1586
diff changeset
736 return img->screen[vbank].data[scroffs] & 15;
1503
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
1734
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
740 static BOOL fmtECIGetLaceType(DMC64Image *img, const DMC64EncDecOp *op,
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
741 const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
742 {
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
743 (void) op;
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
744 (void) buf;
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
745 (void) fmt;
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
746 img->laceType = D64_ILACE_COLOR;
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
747 return TRUE;
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
748 }
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
749
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
750
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
751 static Uint8 fmtGetPixelECI(
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
752 const DMC64Image *img, const int bmoffs, const int scroffs,
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
753 const int shift, const int bitmap, const int raster)
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
754 {
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
755 const int vbank = raster & 7;
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
756 Uint8
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
757 c1 = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, vbank , 0, 0),
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
758 c2 = dmC64GetGenericSCPixel(img, bmoffs, scroffs, shift, vbank + 8, 1, 0);
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
759
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
760 (void) bitmap;
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
761 return (c1 * C64_NCOLORS) + c2;
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
762 }
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
763
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
764
1739
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
765 static int fmtConvertECIBMP2Image(DMImage *dst, const DMC64Image *src, const DMC64ImageFormat *fmt)
1734
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
766 {
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
767 if (!dmSetMixedColorC64Palette(dst))
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
768 return DMERR_MALLOC;
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
769
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
770 return dmC64ConvertGenericBMP2Image(dst, src, fmt);
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
771 }
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
772
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
773
1739
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
774 static int fmtProbeECIPacked(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
775 {
1746
dd57dd9430cb Improve ECI packed format probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
776 size_t i, n;
dd57dd9430cb Improve ECI packed format probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
777
1739
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
778 // XXX TODO: Perhaps count statistics about used byte values
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
779 // and compare to value in buf[2] which is the RLE marker
1753
09641e7179f6 Attempt to avoid misprobes of some Crest Hires FLI designer files as ECI 1.0 files.
Matti Hamalainen <ccr@tnsp.org>
parents: 1752
diff changeset
780 if (len < 128 ||
09641e7179f6 Attempt to avoid misprobes of some Crest Hires FLI designer files as ECI 1.0 files.
Matti Hamalainen <ccr@tnsp.org>
parents: 1752
diff changeset
781 !dmCompareAddr16(buf, 0, fmt->addr) ||
09641e7179f6 Attempt to avoid misprobes of some Crest Hires FLI designer files as ECI 1.0 files.
Matti Hamalainen <ccr@tnsp.org>
parents: 1752
diff changeset
782 len == 16386) // Crest Hires FLI Designer
1746
dd57dd9430cb Improve ECI packed format probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
783 return DM_PROBE_SCORE_FALSE;
dd57dd9430cb Improve ECI packed format probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
784
dd57dd9430cb Improve ECI packed format probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
785 for (n = 0, i = 3; i < len; i++)
dd57dd9430cb Improve ECI packed format probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
786 if (buf[i] == buf[2]) n++;
dd57dd9430cb Improve ECI packed format probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
787
dd57dd9430cb Improve ECI packed format probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
788 if (n > 50)
dd57dd9430cb Improve ECI packed format probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
789 return DM_PROBE_SCORE_GOOD;
dd57dd9430cb Improve ECI packed format probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
790 if (n > 25)
1739
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
791 return DM_PROBE_SCORE_AVG;
1746
dd57dd9430cb Improve ECI packed format probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
792 if (n > 10)
dd57dd9430cb Improve ECI packed format probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
793 return DM_PROBE_SCORE_MAYBE;
dd57dd9430cb Improve ECI packed format probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
794
dd57dd9430cb Improve ECI packed format probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1745
diff changeset
795 return DM_PROBE_SCORE_FALSE;
1739
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
796 }
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
797
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
798
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
799 static int fmtDecodeECIPacked(DMC64Image *img, const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
800 {
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
801 int res;
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
802 DMGrowBuf tmp;
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
803 DMGrowBuf mem;
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
804 DMCompParams cfg;
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
805
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
806 cfg.func = fmt->name;
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
807 cfg.type = DM_COMP_RLE_MARKER;
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
808 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1;
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
809 cfg.rleMarkerB = buf->data[0];
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
810
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
811 if ((res = dmDecodeGenericRLEAlloc(
1747
5e928618fdc8 Change DMGrowBuf API somewhat and implement more copy operations.
Matti Hamalainen <ccr@tnsp.org>
parents: 1746
diff changeset
812 &mem, dmGrowBufConstCopyOffs(&tmp, buf, 1), &cfg)) == DMERR_OK)
1739
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
813 res = dmC64DecodeGenericBMP(img, &mem, fmt);
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
814
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
815 dmGrowBufFree(&mem);
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
816 return res;
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
817 }
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
818
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
819
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
820 //
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
821 // Helper macros for defining screen ram layouts
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
822 // common for FLI type foramts
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
823 //
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
824 #define DEF_SCREEN_RAM(start, oindex, bindex, osize) { DO_COPY, DS_SCREEN_RAM, (start) + ((osize) * (oindex)), (bindex), 0, NULL, NULL }
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
825 #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
826 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
827 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
828 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
829 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
830 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
831 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
832 DEF_SCREEN_RAM((start), 6, (sindex + 6), (osize)), \
1590
22f29c25b349 Add commas after macro blocks in the format array.
Matti Hamalainen <ccr@tnsp.org>
parents: 1589
diff changeset
833 DEF_SCREEN_RAM((start), 7, (sindex + 7), (osize))
1503
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
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
836
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
837 //
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
838 // Many formats actually share memory layout, and there are packed and
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
839 // unpacked versions of several formats. We'll reuse these here through
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
840 // this common formats ops array, referred from dmC64ImageFormats[]
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
841 //
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
842 const DMC64EncDecOpList dmC64CommonFormatOps[] =
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
843 {
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
844 { // #0: Koala Paint type memory layout
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
845 { DO_COPY , DS_BITMAP_RAM , 0x0000, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
846 { DO_COPY , DS_SCREEN_RAM , 0x1f40, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
847 { DO_COPY , DS_COLOR_RAM , 0x2328, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
848 { DO_SET_MEM , DS_BGCOL , 0x2710, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
849 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
850 },
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
851
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
852 { // #1: Amica Paint, Run Paint, etc. layout
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
853 { DO_COPY , DS_BITMAP_RAM , 0x0000, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
854 { DO_COPY , DS_SCREEN_RAM , 0x1f40, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
855 { DO_COPY , DS_COLOR_RAM , 0x2328, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
856 { DO_SET_MEM , DS_BGCOL , 0x2710, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
857 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
858 },
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
859
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
860 { // #2: Art Studio etc. Hires
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
861 { DO_COPY , DS_BITMAP_RAM , 0x0000, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
862 { DO_COPY , DS_SCREEN_RAM , 0x1f40, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
863 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
864 },
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
865
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
866 { // #3: FunPaint II
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
867 DEF_SCREEN_RAMS_8(0x0000, 0, 0x400),
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
868 { DO_COPY , DS_BITMAP_RAM , 0x2000, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
869 { DO_COPY , DS_EXTRA_DATA , 0x3f40, 0, 100, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
870 { DO_COPY , DS_COLOR_RAM , 0x4000, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
871 DEF_SCREEN_RAMS_8(0x43e8, 8, 0x400),
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
872 { DO_COPY , DS_BITMAP_RAM , 0x63e8, 1, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
873 { DO_COPY , DS_EXTRA_DATA , 0x8328, 1, 100, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
874 { DO_DEC_FUNC , 0 , 0x2742, 0, 1, fmtTruePaintGetLaceType, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
875 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
876 },
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
877
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
878 { // #4: DrazPaint 1.x & 2
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
879 { DO_COPY , DS_COLOR_RAM , 0x0000, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
880 { DO_COPY , DS_BITMAP_RAM , 0x0800, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
881 { DO_COPY , DS_SCREEN_RAM , 0x0400, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
882 { DO_SET_MEM , DS_BGCOL , 0x2740, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
883 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
884 },
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
885
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
886 { // #5: DrazLace 1.0
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
887 { DO_COPY , DS_COLOR_RAM , 0x0000, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
888 { DO_COPY , DS_BITMAP_RAM , 0x0800, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
889 { DO_COPY , DS_SCREEN_RAM , 0x0400, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
890 { DO_SET_MEM , DS_BGCOL , 0x2740, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
891 { DO_COPY , DS_BITMAP_RAM , 0x2800, 1, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
892 { DO_DEC_FUNC , 0 , 0x2742, 0, 1, fmtDrazLaceGetLaceType, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
893 { DO_ENC_FUNC , 0 , 0x2742, 0, 1, NULL, fmtDrazLaceSetLaceType },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
894 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
895 },
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
896
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
897 { // #6: TruePaint
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
898 { DO_COPY , DS_SCREEN_RAM , 0x0000, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
899 { DO_SET_MEM , DS_BGCOL , 0x03e8, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
900 { DO_COPY , DS_BITMAP_RAM , 0x0400, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
901 { DO_COPY , DS_BITMAP_RAM , 0x2400, 1, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
902 { DO_COPY , DS_SCREEN_RAM , 0x4400, 1, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
903 { DO_COPY , DS_COLOR_RAM , 0x4800, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
904 { DO_DEC_FUNC , 0 , 0x0000, 0, 0, fmtTruePaintGetLaceType, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
905 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
906 },
1739
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
907
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
908 { // #7: ECI Graphic Editor Hires FLI
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
909 { DO_COPY , DS_BITMAP_RAM , 0x0000, 0, 0, NULL, NULL },
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
910 DEF_SCREEN_RAMS_8(0x2000, 0, 0x400),
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
911 { DO_COPY , DS_BITMAP_RAM , 0x4000, 1, 0, NULL, NULL },
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
912 DEF_SCREEN_RAMS_8(0x6000, 8, 0x400),
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
913 { DO_DEC_FUNC , 0 , 0 , 0, 0, fmtECIGetLaceType, NULL },
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
914 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
915 },
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
916 };
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
917
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
918
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
919 //
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
920 // Array with data for supported formats
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
921 //
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
922 const DMC64ImageFormat dmC64ImageFormats[] =
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
923 {
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
924 {
1545
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
925 D64_FMT_MC, "d2p", "DrazPaint 1.4/2.0 (packed)", 0x5800, 0, DM_FMT_RDWR,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
926 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
927 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
928 fmtProbeDrazPaint20Packed,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
929 fmtDecodeDrazPaintPacked, fmtEncodeDrazPaintPacked,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
930 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
931 NULL,
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
932 { }, &dmC64CommonFormatOps[4]
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
933 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
934
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
935 {
1545
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
936 D64_FMT_MC, "drp", "DrazPaint (unpacked)", 0x5800, 10051, DM_FMT_RDWR,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
937 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
938 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
939 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
940 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
941 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
942 NULL,
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
943 { }, &dmC64CommonFormatOps[4]
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
944 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
945
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
946 {
1545
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
947 D64_FMT_MC | D64_FMT_ILACE, "dlp", "DrazLace 1.0 (packed)", 0x5800, 0, DM_FMT_RDWR,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
948 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
949 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
950 fmtProbeDrazLace10Packed,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
951 fmtDecodeDrazPaintPacked, fmtEncodeDrazPaintPacked,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
952 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
953 NULL,
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
954 { }, &dmC64CommonFormatOps[5]
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
955 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
956
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
957 {
1545
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
958 D64_FMT_MC | D64_FMT_ILACE, "drl", "DrazLace 1.0 (unpacked)", 0x5800, 18242, DM_FMT_RDWR,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
959 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
960 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
961 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
962 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
963 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
964 NULL,
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
965 { }, &dmC64CommonFormatOps[5]
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
966 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
967
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
968 {
1665
0022e1a428ca Enable BDP5 encoding support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1663
diff changeset
969 D64_FMT_MC, "bdp5", "Boogie Down Paint 5 (packed)", 0x5000, 0, DM_FMT_RDWR,
1651
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
970 C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
971 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
972 fmtProbeBDP5Packed,
1665
0022e1a428ca Enable BDP5 encoding support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1663
diff changeset
973 fmtDecodeBDP5Packed, fmtEncodeBDP5Packed,
1651
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
974 NULL, NULL,
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
975 NULL,
1652
70fde5e03c2e BDP5 memory format is same as Koala, so reuse that.
Matti Hamalainen <ccr@tnsp.org>
parents: 1651
diff changeset
976 { }, &dmC64CommonFormatOps[0] // Memory format is same as Koala
1651
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
977 },
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
978
6dd191d04ea8 Implement support for Boogie Down Paint 5 (packed) format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1650
diff changeset
979 {
1574
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
980 D64_FMT_MC, "vid", "Vidcom 64 (unpacked)", 0x5800, 10050, DM_FMT_RDWR,
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
981 C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
982 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
983 NULL,
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
984 NULL, NULL,
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
985 NULL, NULL,
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
986 NULL,
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
987 {
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
988 { DO_COPY , DS_COLOR_RAM , 0x0000, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
989 { DO_SET_MEM , DS_BGCOL , 0x07e8, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
990 { DO_COPY , DS_BITMAP_RAM , 0x0800, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
991 { DO_COPY , DS_SCREEN_RAM , 0x0400, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
992 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
993 },
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
994 NULL
1574
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
995 },
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
996
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
997 {
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
998 D64_FMT_MC, "p64", "Picasso 64 (unpacked)", 0x1800, 10050, DM_FMT_RDWR,
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
999 C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
1000 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
1001 NULL,
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
1002 NULL, NULL,
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
1003 NULL, NULL,
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
1004 NULL,
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
1005 {
1669
fb7318b952c0 Cosmetic fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
1006 { DO_COPY , DS_COLOR_RAM , 0x0000, 0, 0, NULL, NULL },
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1007 { DO_SET_MEM , DS_BGCOL , 0x07fe, 0, 0, NULL, NULL },
1669
fb7318b952c0 Cosmetic fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
1008 { DO_COPY , DS_BITMAP_RAM , 0x0800, 0, 0, NULL, NULL },
fb7318b952c0 Cosmetic fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
1009 { DO_COPY , DS_SCREEN_RAM , 0x0400, 0, 0, NULL, NULL },
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1010 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1011 },
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1012 NULL
1574
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
1013 },
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
1014
0b0870a216e9 Add support for "Picasso 64" and "Vidcom 64" multicolor formats.
Matti Hamalainen <ccr@tnsp.org>
parents: 1573
diff changeset
1015 {
1545
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
1016 D64_FMT_MC | D64_FMT_ILACE, "mci", "Truepaint (unpacked)", 0x9c00, 19434, DM_FMT_RD,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1017 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
1018 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
1019 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1020 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1021 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1022 fmtGetPixelTruePaint,
1646
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
1023 { }, &dmC64CommonFormatOps[6]
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
1024 },
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
1025
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
1026 {
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
1027 D64_FMT_MC | D64_FMT_ILACE, "mcip", "Truepaint (packed)", 0x0801, 0, DM_FMT_RD,
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
1028 C64_SCR_WIDTH , C64_SCR_HEIGHT,
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
1029 C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT,
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
1030 fmtProbeTruePaintPacked,
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
1031 fmtDecodeTruePaintPacked, NULL,
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
1032 NULL, NULL,
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
1033 fmtGetPixelTruePaint,
415c732dc14c Implement support for packed TruePaint images.
Matti Hamalainen <ccr@tnsp.org>
parents: 1636
diff changeset
1034 { }, &dmC64CommonFormatOps[6]
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1035 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1036
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1037 {
1545
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
1038 D64_FMT_MC, "kla", "Koala Paint (unpacked)", 0x6000, 10003, DM_FMT_RDWR,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1039 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
1040 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
1041 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1042 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1043 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1044 NULL,
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1045 { }, &dmC64CommonFormatOps[0]
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1046 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1047
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1048 {
1578
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
1049 D64_FMT_MC, "klp", "Koala Paint (packed)", 0x6000, 0, DM_FMT_RDWR,
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
1050 C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
1051 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
1594
afb49736615a Implement packed Koala Painter probing.
Matti Hamalainen <ccr@tnsp.org>
parents: 1593
diff changeset
1052 fmtProbeKoalaPaintPacked,
1578
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
1053 fmtDecodeKoalaPaintPacked, fmtEncodeKoalaPaintPacked,
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
1054 NULL, NULL,
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
1055 NULL,
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1056 { }, &dmC64CommonFormatOps[0]
1578
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
1057 },
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
1058
fb60abb09a65 Add support for packed Koala Painter files, though without probing now.
Matti Hamalainen <ccr@tnsp.org>
parents: 1577
diff changeset
1059 {
1545
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
1060 D64_FMT_MC, "aas", "Advanced Art Studio (unpacked)", 0x2000, 10018, DM_FMT_RDWR,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1061 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
1062 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
1063 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1064 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1065 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1066 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1067 {
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1068 { DO_COPY , DS_BITMAP_RAM , 0x0000, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1069 { DO_COPY , DS_SCREEN_RAM , 0x1f40, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1070 { DO_COPY , DS_COLOR_RAM , 0x2338, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1071 { DO_SET_MEM , DS_BGCOL , 0x2329, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1072 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
1593
a77876a07425 Oops, missed this from the last commit.
Matti Hamalainen <ccr@tnsp.org>
parents: 1592
diff changeset
1073 },
a77876a07425 Oops, missed this from the last commit.
Matti Hamalainen <ccr@tnsp.org>
parents: 1592
diff changeset
1074 NULL
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1075 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1076
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1077 {
1754
aa6a858db6bd Implement support for CPU-Paint unpacked format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1753
diff changeset
1078 D64_FMT_MC, "cdu", "CDU-Paint (unpacked)", 0x7eef, 10277, DM_FMT_RDWR,
aa6a858db6bd Implement support for CPU-Paint unpacked format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1753
diff changeset
1079 C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
aa6a858db6bd Implement support for CPU-Paint unpacked format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1753
diff changeset
1080 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
aa6a858db6bd Implement support for CPU-Paint unpacked format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1753
diff changeset
1081 NULL,
aa6a858db6bd Implement support for CPU-Paint unpacked format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1753
diff changeset
1082 NULL, NULL,
aa6a858db6bd Implement support for CPU-Paint unpacked format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1753
diff changeset
1083 NULL, NULL,
aa6a858db6bd Implement support for CPU-Paint unpacked format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1753
diff changeset
1084 NULL,
aa6a858db6bd Implement support for CPU-Paint unpacked format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1753
diff changeset
1085 {
aa6a858db6bd Implement support for CPU-Paint unpacked format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1753
diff changeset
1086 { DO_COPY , DS_BITMAP_RAM , 0x0000 + 0x111, 0, 0, NULL, NULL },
aa6a858db6bd Implement support for CPU-Paint unpacked format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1753
diff changeset
1087 { DO_COPY , DS_SCREEN_RAM , 0x1f40 + 0x111, 0, 0, NULL, NULL },
aa6a858db6bd Implement support for CPU-Paint unpacked format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1753
diff changeset
1088 { DO_COPY , DS_COLOR_RAM , 0x2328 + 0x111, 0, 0, NULL, NULL },
aa6a858db6bd Implement support for CPU-Paint unpacked format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1753
diff changeset
1089 { DO_SET_MEM , DS_BGCOL , 0x2710 + 0x111, 0, 0, NULL, NULL },
aa6a858db6bd Implement support for CPU-Paint unpacked format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1753
diff changeset
1090 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
aa6a858db6bd Implement support for CPU-Paint unpacked format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1753
diff changeset
1091 },
aa6a858db6bd Implement support for CPU-Paint unpacked format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1753
diff changeset
1092 NULL
aa6a858db6bd Implement support for CPU-Paint unpacked format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1753
diff changeset
1093 },
aa6a858db6bd Implement support for CPU-Paint unpacked format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1753
diff changeset
1094
aa6a858db6bd Implement support for CPU-Paint unpacked format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1753
diff changeset
1095 {
1545
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
1096 D64_FMT_MC, "ami", "Amica Paint (packed)", 0x4000, 0, DM_FMT_RDWR,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1097 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
1098 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
1099 fmtProbeAmicaPaintPacked,
1538
af729e29a6f6 Implement Amica Paint packed format encoding.
Matti Hamalainen <ccr@tnsp.org>
parents: 1535
diff changeset
1100 fmtDecodeAmicaPaintPacked, fmtEncodeAmicaPaintPacked,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1101 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1102 NULL,
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1103 { }, &dmC64CommonFormatOps[1]
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1104 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1105
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1106 {
1545
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
1107 D64_FMT_MC, "rpm", "Run Paint (unpacked)", 0x6000, 10006, DM_FMT_RDWR,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1108 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
1109 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
1110 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1111 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1112 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1113 NULL,
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1114 { }, &dmC64CommonFormatOps[1]
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1115 },
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1116
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1117 {
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1118 D64_FMT_MC, "ipc", "Interpaint MC (unpacked)", 0x4000, 10003, DM_FMT_RDWR,
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1119 C64_SCR_WIDTH / 2, C64_SCR_HEIGHT,
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1120 C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT,
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1121 NULL,
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1122 NULL, NULL,
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1123 NULL, NULL,
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1124 NULL,
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1125 { }, &dmC64CommonFormatOps[1]
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1126 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1127
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1128 {
1545
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
1129 D64_FMT_HIRES, "art", "Art Studio (unpacked)", 0x2000, 9009, DM_FMT_RD,
1635
9ba9d049e6e9 Cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 1634
diff changeset
1130 C64_SCR_WIDTH , C64_SCR_HEIGHT,
9ba9d049e6e9 Cosmetic.
Matti Hamalainen <ccr@tnsp.org>
parents: 1634
diff changeset
1131 C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1132 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1133 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1134 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1135 NULL,
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1136 { }, &dmC64CommonFormatOps[2]
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1137 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1138
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1139 {
1545
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
1140 D64_FMT_HIRES, "iph", "Interpaint (unpacked)", 0x4000, 9002, DM_FMT_RD,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1141 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
1142 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
1143 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1144 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1145 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1146 NULL,
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1147 { }, &dmC64CommonFormatOps[2]
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1148 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1149
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1150 {
1545
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
1151 D64_FMT_HIRES, "dd", "Doodle (unpacked)", 0x1c00, 9218, DM_FMT_RDWR,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1152 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
1153 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
1154 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1155 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1156 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1157 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1158 {
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1159 { DO_COPY , DS_SCREEN_RAM , 0x0000, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1160 { DO_COPY , DS_BITMAP_RAM , 0x0400, 0, 0, NULL, NULL },
1669
fb7318b952c0 Cosmetic fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
1161 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1162 },
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1163 NULL
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1164 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1165
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1166 {
1670
ab4a38ba919f Implement hires Mono Magic support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1669
diff changeset
1167 D64_FMT_HIRES, "mon", "Monomagic (unpacked)", 0x2000, 8194, DM_FMT_RDWR,
ab4a38ba919f Implement hires Mono Magic support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1669
diff changeset
1168 C64_SCR_WIDTH , C64_SCR_HEIGHT,
ab4a38ba919f Implement hires Mono Magic support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1669
diff changeset
1169 C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT,
ab4a38ba919f Implement hires Mono Magic support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1669
diff changeset
1170 NULL,
ab4a38ba919f Implement hires Mono Magic support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1669
diff changeset
1171 NULL, NULL,
ab4a38ba919f Implement hires Mono Magic support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1669
diff changeset
1172 NULL, NULL,
ab4a38ba919f Implement hires Mono Magic support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1669
diff changeset
1173 NULL,
ab4a38ba919f Implement hires Mono Magic support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1669
diff changeset
1174 {
ab4a38ba919f Implement hires Mono Magic support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1669
diff changeset
1175 { DO_COPY , DS_BITMAP_RAM , 0x0000, 0, 0, NULL, NULL },
ab4a38ba919f Implement hires Mono Magic support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1669
diff changeset
1176 { DO_SET_OP , DS_SCREEN_RAM , 0xCF , 0, 0, NULL, NULL },
ab4a38ba919f Implement hires Mono Magic support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1669
diff changeset
1177 // Default colors used by MM are --^^
ab4a38ba919f Implement hires Mono Magic support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1669
diff changeset
1178 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
ab4a38ba919f Implement hires Mono Magic support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1669
diff changeset
1179 },
ab4a38ba919f Implement hires Mono Magic support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1669
diff changeset
1180 NULL
ab4a38ba919f Implement hires Mono Magic support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1669
diff changeset
1181 },
ab4a38ba919f Implement hires Mono Magic support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1669
diff changeset
1182
ab4a38ba919f Implement hires Mono Magic support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1669
diff changeset
1183 {
1671
dd9528cdd14a Add support for a plain hires format at $2000.
Matti Hamalainen <ccr@tnsp.org>
parents: 1670
diff changeset
1184 D64_FMT_HIRES, "hir", "Plain hires (unpacked)", 0x2000, 8002, DM_FMT_RDWR,
dd9528cdd14a Add support for a plain hires format at $2000.
Matti Hamalainen <ccr@tnsp.org>
parents: 1670
diff changeset
1185 C64_SCR_WIDTH , C64_SCR_HEIGHT,
dd9528cdd14a Add support for a plain hires format at $2000.
Matti Hamalainen <ccr@tnsp.org>
parents: 1670
diff changeset
1186 C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT,
dd9528cdd14a Add support for a plain hires format at $2000.
Matti Hamalainen <ccr@tnsp.org>
parents: 1670
diff changeset
1187 NULL,
dd9528cdd14a Add support for a plain hires format at $2000.
Matti Hamalainen <ccr@tnsp.org>
parents: 1670
diff changeset
1188 NULL, NULL,
dd9528cdd14a Add support for a plain hires format at $2000.
Matti Hamalainen <ccr@tnsp.org>
parents: 1670
diff changeset
1189 NULL, NULL,
dd9528cdd14a Add support for a plain hires format at $2000.
Matti Hamalainen <ccr@tnsp.org>
parents: 1670
diff changeset
1190 NULL,
dd9528cdd14a Add support for a plain hires format at $2000.
Matti Hamalainen <ccr@tnsp.org>
parents: 1670
diff changeset
1191 {
dd9528cdd14a Add support for a plain hires format at $2000.
Matti Hamalainen <ccr@tnsp.org>
parents: 1670
diff changeset
1192 { DO_COPY , DS_BITMAP_RAM , 0x0000, 0, 0, NULL, NULL },
dd9528cdd14a Add support for a plain hires format at $2000.
Matti Hamalainen <ccr@tnsp.org>
parents: 1670
diff changeset
1193 { DO_SET_OP , DS_SCREEN_RAM , 0xF0 , 0, 0, NULL, NULL },
dd9528cdd14a Add support for a plain hires format at $2000.
Matti Hamalainen <ccr@tnsp.org>
parents: 1670
diff changeset
1194 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
dd9528cdd14a Add support for a plain hires format at $2000.
Matti Hamalainen <ccr@tnsp.org>
parents: 1670
diff changeset
1195 },
dd9528cdd14a Add support for a plain hires format at $2000.
Matti Hamalainen <ccr@tnsp.org>
parents: 1670
diff changeset
1196 NULL
dd9528cdd14a Add support for a plain hires format at $2000.
Matti Hamalainen <ccr@tnsp.org>
parents: 1670
diff changeset
1197 },
dd9528cdd14a Add support for a plain hires format at $2000.
Matti Hamalainen <ccr@tnsp.org>
parents: 1670
diff changeset
1198
dd9528cdd14a Add support for a plain hires format at $2000.
Matti Hamalainen <ccr@tnsp.org>
parents: 1670
diff changeset
1199 {
1582
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
1200 D64_FMT_MC | D64_FMT_FLI, "bfli", "Big FLI (unpacked) [BROKEN]", 0x3bff, 33795, DM_FMT_RD,
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
1201 C64_SCR_WIDTH / 2, C64_SCR_HEIGHT * 2,
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
1202 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
1203 NULL,
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
1204 NULL, NULL,
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
1205 NULL, NULL,
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
1206 fmtGetPixelBFLI,
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
1207 {
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1208 { DO_COPY , DS_COLOR_RAM , 0x0001, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1209 DEF_SCREEN_RAMS_8(0x0401, 0, 0x400),
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1210 { DO_COPY , DS_BITMAP_RAM , 0x2401, 0, 0x1fff, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1211 DEF_SCREEN_RAMS_8(0x4401, 8, 0x400),
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1212 { DO_COPY , DS_BITMAP_RAM , 0x6401, 1, 0, NULL, NULL },
1669
fb7318b952c0 Cosmetic fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
1213 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1214 },
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1215 NULL
1582
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
1216 },
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
1217
1f6aed186c4e Add somewhat broken support for "Big FLI" aka BFLI files. Needs more work.
Matti Hamalainen <ccr@tnsp.org>
parents: 1581
diff changeset
1218 {
1545
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
1219 D64_FMT_MC | D64_FMT_FLI, "bml", "Blackmail FLI (unpacked)", 0x3b00, 17474, DM_FMT_RDWR,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1220 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
1221 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
1222 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1223 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1224 NULL, NULL,
1581
5aa1c3ec91d5 Rename a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 1579
diff changeset
1225 fmtGetPixelBlackMailFLI,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1226 {
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1227 { DO_COPY , DS_EXTRA_DATA , 0x0000, 0, 200, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1228 { DO_COPY , DS_COLOR_RAM , 0x0100, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1229 DEF_SCREEN_RAMS_8(0x0500, 0, 0x400),
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1230 { DO_COPY , DS_BITMAP_RAM , 0x2500, 0, 0, NULL, NULL },
1669
fb7318b952c0 Cosmetic fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
1231 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1232 },
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1233 NULL
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1234 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1235
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1236 {
1545
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
1237 D64_FMT_MC | D64_FMT_FLI, "fli", "FLI Designer (unpacked)", 0, 17409, DM_FMT_RD,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1238 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
1239 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
1240 fmtProbeFLIDesigner,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1241 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1242 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1243 fmtGetPixelFLIDesigner,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1244 {
1669
fb7318b952c0 Cosmetic fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
1245 { DO_COPY , DS_COLOR_RAM , 0x0000, 0, 0, NULL, NULL },
fb7318b952c0 Cosmetic fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
1246 DEF_SCREEN_RAMS_8(0x0400, 0, 0x400),
fb7318b952c0 Cosmetic fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
1247 { DO_COPY , DS_BITMAP_RAM , 0x2400, 0, 0, NULL, NULL },
fb7318b952c0 Cosmetic fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
1248 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1249 },
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1250 NULL
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1251 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1252
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1253 {
1734
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
1254 D64_FMT_HIRES | D64_FMT_FLI,
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
1255 "eci", "ECI Graphic Editor 1.0 (unpacked)", 0x4000, 32770, DM_FMT_RD,
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
1256 C64_SCR_WIDTH, C64_SCR_HEIGHT,
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
1257 C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT,
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
1258 NULL,
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
1259 NULL, NULL,
1739
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
1260 fmtConvertECIBMP2Image, NULL,
1734
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
1261 fmtGetPixelECI,
1739
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
1262 { }, &dmC64CommonFormatOps[7]
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
1263 },
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
1264
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
1265 {
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
1266 D64_FMT_HIRES | D64_FMT_FLI,
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
1267 "ecp", "ECI Graphic Editor 1.0 (packed)", 0x4000, 0, DM_FMT_RD,
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
1268 C64_SCR_WIDTH, C64_SCR_HEIGHT,
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
1269 C64_SCR_CH_WIDTH, C64_SCR_CH_HEIGHT,
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
1270 fmtProbeECIPacked,
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
1271 fmtDecodeECIPacked, NULL,
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
1272 fmtConvertECIBMP2Image, NULL,
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
1273 fmtGetPixelECI,
83f50e431206 Implement support for ECI packed format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1734
diff changeset
1274 { }, &dmC64CommonFormatOps[7]
1734
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
1275 },
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
1276
183d503b17a7 Implement support for hires FLI interlaced "ECI Graphic Editor 1.0 (unpacked)" format.
Matti Hamalainen <ccr@tnsp.org>
parents: 1731
diff changeset
1277 {
1723
13fe4010623f Allow writing of xx1 and xx2 formats, as useless that is.
Matti Hamalainen <ccr@tnsp.org>
parents: 1722
diff changeset
1278 D64_FMT_MC, "xx1", "Unknown $2000 format (unpacked)", 0x2000, 10242, DM_FMT_RDWR,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1279 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
1280 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
1281 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1282 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1283 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1284 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1285 {
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1286 { DO_COPY , DS_BITMAP_RAM , 0x0000, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1287 { DO_COPY , DS_SCREEN_RAM , 0x2000, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1288 { DO_COPY , DS_COLOR_RAM , 0x2400, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1289 { DO_SET_OP , DS_BGCOL , 0x00 , 0, 0, NULL, NULL },
1707
a0986cfd6f9d More consistently use DMGrowBuf in the lib64gfx APIs, and implement
Matti Hamalainen <ccr@tnsp.org>
parents: 1697
diff changeset
1290 { DO_SET_OP , DS_EXTRA_DATA , 10240 , 0, 0, NULL, NULL },
1669
fb7318b952c0 Cosmetic fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 1668
diff changeset
1291 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1292 },
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1293 NULL
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1294 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1295
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1296 {
1723
13fe4010623f Allow writing of xx1 and xx2 formats, as useless that is.
Matti Hamalainen <ccr@tnsp.org>
parents: 1722
diff changeset
1297 D64_FMT_MC, "xx2", "Unknown $2000 format (unpacked)", 0x2000, 0, DM_FMT_RDWR,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1298 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
1299 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
1300 fmtProbeFormatXX2,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1301 fmtDecodeFormatXX2, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1302 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1303 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1304 {
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1305 { DO_COPY , DS_BITMAP_RAM , 0x0000, 0, XX2_BSIZE, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1306 { DO_COPY , DS_SCREEN_RAM , XX2_BSIZE, 0, XX2_SIZE, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1307 { DO_COPY , DS_COLOR_RAM , XX2_BSIZE + XX2_SIZE, 0, XX2_SIZE, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1308 { DO_SET_OP , DS_BGCOL , 11 , 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1309 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1310 },
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1311 NULL
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1312 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1313
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1314 {
1545
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
1315 D64_FMT_MC | D64_FMT_FLI | D64_FMT_ILACE,
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
1316 "fp2", "FunPaint II (unpacked)", 0x3ff0, 33694, DM_FMT_RD,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1317 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
1318 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
1579
4288b21e97b9 Improve and simplify Fun Paint 2 format support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1578
diff changeset
1319 fmtProbeFunPaint2,
4288b21e97b9 Improve and simplify Fun Paint 2 format support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1578
diff changeset
1320 fmtDecodeFunPaint2, fmtEncodeFunPaint2Unpacked,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1321 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1322 fmtGetPixelFunPaint2,
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1323 { }, &dmC64CommonFormatOps[3]
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1324 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1325
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1326 {
1545
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
1327 D64_FMT_MC | D64_FMT_FLI | D64_FMT_ILACE,
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
1328 "fp2p", "FunPaint II (packed)", 0x3ff0, 0, DM_FMT_RD,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1329 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
1330 C64_SCR_CH_WIDTH , C64_SCR_CH_HEIGHT,
1579
4288b21e97b9 Improve and simplify Fun Paint 2 format support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1578
diff changeset
1331 NULL,
4288b21e97b9 Improve and simplify Fun Paint 2 format support.
Matti Hamalainen <ccr@tnsp.org>
parents: 1578
diff changeset
1332 fmtDecodeFunPaint2, fmtEncodeFunPaint2Packed,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1333 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1334 fmtGetPixelFunPaint2,
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1335 { }, &dmC64CommonFormatOps[3]
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1336 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1337
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1338 {
1545
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
1339 D64_FMT_MC | D64_FMT_FLI | D64_FMT_ILACE,
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
1340 "gun", "GunPaint (unpacked)", 0x4000, 0, DM_FMT_RD,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1341 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
1342 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
1343 fmtProbeGunPaint,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1344 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1345 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1346 fmtGetPixelGunPaint,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1347 {
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1348 DEF_SCREEN_RAMS_8(0x0000, 0, 0x400),
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1349 { DO_COPY , DS_BITMAP_RAM , 0x2000, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1350 { DO_COPY , DS_EXTRA_DATA , 0x3f4f, 0, 177, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1351 { DO_COPY , DS_COLOR_RAM , 0x4000, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1352 DEF_SCREEN_RAMS_8(0x4400, 8, 0x400),
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1353 { DO_COPY , DS_BITMAP_RAM , 0x6400, 1, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1354 { DO_COPY , DS_EXTRA_DATA , 0x47e8, 1, 20, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1355 { DO_DEC_FUNC , 0 , 0x2742, 0, 1, fmtTruePaintGetLaceType, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1356 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1357 },
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1358 NULL
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1359 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1360
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1361 {
1545
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
1362 D64_FMT_HIRES | D64_FMT_FLI,
3b613fcbf3ff Improve how format read/write capabilities are marked and shown.
Matti Hamalainen <ccr@tnsp.org>
parents: 1542
diff changeset
1363 "chi", "Crest Hires FLI Designer (unpacked)", 0x4000, 16386, DM_FMT_RD,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1364 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
1365 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
1366 NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1367 NULL, NULL,
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1368 NULL, NULL,
1752
fe3ae3fdf0f3 Rename a function.
Matti Hamalainen <ccr@tnsp.org>
parents: 1751
diff changeset
1369 fmtGetPixelCrestHIFLIorCDHM,
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1370 {
1668
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1371 { DO_COPY , DS_BITMAP_RAM , 0x0000, 0, 0, NULL, NULL },
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1372 DEF_SCREEN_RAMS_8(0x2000, 0, 0x400),
1741717b1ae5 Big overhaul to the enc/dec operator system to be more flexible.
Matti Hamalainen <ccr@tnsp.org>
parents: 1665
diff changeset
1373 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL },
1592
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1374 },
91d1bb571fca Implement common encdec ops lists for sharing oplists between formats that
Matti Hamalainen <ccr@tnsp.org>
parents: 1590
diff changeset
1375 NULL
1503
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1376 },
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1377 };
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1378
c7b9ef56319b Factor all the c64 file format specific things into lib64fmt.c
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1379 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
1380