comparison tools/lib64fmts.c @ 2541:671f41166527

Reorder / rename Unknown format 3 to Format XX3.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 27 Jul 2021 08:56:41 +0300
parents a60e046b7294
children 0b1e73d49503
comparison
equal deleted inserted replaced
2540:a60e046b7294 2541:671f41166527
8 */ 8 */
9 #include "lib64gfx.h" 9 #include "lib64gfx.h"
10 10
11 #define DM_MEMCMP_SIZE(mptr, mcmp) memcmp((mptr), (mcmp), sizeof(mcmp)) 11 #define DM_MEMCMP_SIZE(mptr, mcmp) memcmp((mptr), (mcmp), sizeof(mcmp))
12 #define DM_MEMCMP_LEN(mptr, mcmp) memcmp((mptr), (mcmp), strlen(mcmp)) 12 #define DM_MEMCMP_LEN(mptr, mcmp) memcmp((mptr), (mcmp), strlen(mcmp))
13
14
15 static const Uint8 fmtUnknown3_MagicID_1[] =
16 {
17 0x01, 0x08, 0x0B, 0x08, 0xF0, 0x02, 0x9E, 0x32,
18 0x30, 0x36, 0x31, 0x00, 0x00, 0x00, 0xA9, 0x14,
19 0x8D, 0x18, 0xD0, 0xA2, 0x00, 0xA9, 0x20, 0x9D,
20 0x00, 0x04, 0x9D, 0x00, 0x05, 0x9D, 0x00, 0x06,
21 };
22
23 static int fmtProbeUnknown3(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
24 {
25 if (buf->len == fmt->size &&
26 DM_MEMCMP_SIZE(buf->data, fmtUnknown3_MagicID_1) == 0
27 )
28 return DM_PROBE_SCORE_MAX;
29
30 return DM_PROBE_SCORE_FALSE;
31 }
32 13
33 14
34 // Basic probe, but return MAX score for this format 15 // Basic probe, but return MAX score for this format
35 static int fmtProbeGigapaintHires(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) 16 static int fmtProbeGigapaintHires(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
36 { 17 {
1388 1369
1389 // Flinterlazer stores color RAMs as speedcode, so we need to 1370 // Flinterlazer stores color RAMs as speedcode, so we need to
1390 // decode some 6510 instructions to get the data. 1371 // decode some 6510 instructions to get the data.
1391 return fmtDecode6502SpeedCode( 1372 return fmtDecode6502SpeedCode(
1392 dmGrowBufConstCopyOffsSize(&tmp, buf, 0, 0x17b2), img, 0); 1373 dmGrowBufConstCopyOffsSize(&tmp, buf, 0, 0x17b2), img, 0);
1374 }
1375
1376
1377 static const Uint8 fmtFormatXX3_MagicID_1[] =
1378 {
1379 0x01, 0x08, 0x0B, 0x08, 0xF0, 0x02, 0x9E, 0x32,
1380 0x30, 0x36, 0x31, 0x00, 0x00, 0x00, 0xA9, 0x14,
1381 0x8D, 0x18, 0xD0, 0xA2, 0x00, 0xA9, 0x20, 0x9D,
1382 0x00, 0x04, 0x9D, 0x00, 0x05, 0x9D, 0x00, 0x06,
1383 };
1384
1385 static int fmtProbeFormatXX3(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
1386 {
1387 if (buf->len == fmt->size &&
1388 DM_MEMCMP_SIZE(buf->data, fmtFormatXX3_MagicID_1) == 0
1389 )
1390 return DM_PROBE_SCORE_MAX;
1391
1392 return DM_PROBE_SCORE_FALSE;
1393 } 1393 }
1394 1394
1395 1395
1396 #define XX2_MIN_SIZE 4000 1396 #define XX2_MIN_SIZE 4000
1397 #define XX2_WIDTH_CH 40 1397 #define XX2_WIDTH_CH 40
2954 } 2954 }
2955 }, 2955 },
2956 NULL 2956 NULL
2957 }, 2957 },
2958 2958
2959 {
2960 "xx3", "Unknown $0801 format (viewer) (unpacked)", 0x0801, 10500, 0, DM_FMT_RD,
2961 fmtProbeFormatXX3,
2962 NULL, NULL,
2963 {
2964 D64_FMT_MC,
2965 D64_SCR_WIDTH / 2, D64_SCR_HEIGHT,
2966 D64_SCR_CH_WIDTH , D64_SCR_CH_HEIGHT,
2967 2, 1,
2968 NULL, NULL,
2969 NULL,
2970 {
2971 { DO_COPY , DS_BITMAP_RAM , 0x09f2 - 0x0801, 0, 0, 0, NULL, NULL, DF_NORMAL },
2972 { DO_COPY , DS_SCREEN_RAM , 0x2932 - 0x0801, 0, 0, 0, NULL, NULL, DF_NORMAL },
2973 { DO_SET_MEM_LO , DS_D020 , 0x09e6 - 0x0801, 0, 0, 0, NULL, NULL, DF_NORMAL },
2974 { DO_SET_MEM_LO , DS_BGCOL , 0x09e7 - 0x0801, 0, 0, 0, NULL, NULL, DF_NORMAL },
2975 { DO_COPY , DS_COLOR_RAM , 0x2d1a - 0x0801, 0, 0, 0, NULL, NULL, DF_NORMAL },
2976 { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL, DF_NORMAL },
2977 },
2978 },
2979 NULL
2980 },
2959 { 2981 {
2960 "fp2", "FunPaint II (unpacked)", 0x3ff0, 33694, 0, DM_FMT_RDWR, 2982 "fp2", "FunPaint II (unpacked)", 0x3ff0, 33694, 0, DM_FMT_RDWR,
2961 fmtProbeFunPaint2, 2983 fmtProbeFunPaint2,
2962 fmtDecodeFunPaint2, fmtEncodeFunPaint2Unpacked, 2984 fmtDecodeFunPaint2, fmtEncodeFunPaint2Unpacked,
2963 { }, &dmC64CommonFormats[3] 2985 { }, &dmC64CommonFormats[3]
3253 fmtProbeSupeRes, 3275 fmtProbeSupeRes,
3254 fmtDecodeSupeRes,fmtEncodeSupeRes, 3276 fmtDecodeSupeRes,fmtEncodeSupeRes,
3255 { }, &dmC64CommonFormats[0] 3277 { }, &dmC64CommonFormats[0]
3256 }, 3278 },
3257 3279
3258 {
3259 "xx3", "Unknown 3 (unpacked)", 0x0801, 10500, 0, DM_FMT_RD,
3260 fmtProbeUnknown3,
3261 NULL, NULL,
3262 {
3263 D64_FMT_MC,
3264 D64_SCR_WIDTH / 2, D64_SCR_HEIGHT,
3265 D64_SCR_CH_WIDTH , D64_SCR_CH_HEIGHT,
3266 2, 1,
3267 NULL, NULL,
3268 NULL,
3269 {
3270 { DO_COPY , DS_BITMAP_RAM , 0x09f2 - 0x0801, 0, 0, 0, NULL, NULL, DF_NORMAL },
3271 { DO_COPY , DS_SCREEN_RAM , 0x2932 - 0x0801, 0, 0, 0, NULL, NULL, DF_NORMAL },
3272 { DO_SET_MEM_LO , DS_D020 , 0x09e6 - 0x0801, 0, 0, 0, NULL, NULL, DF_NORMAL },
3273 { DO_SET_MEM_LO , DS_BGCOL , 0x09e7 - 0x0801, 0, 0, 0, NULL, NULL, DF_NORMAL },
3274 { DO_COPY , DS_COLOR_RAM , 0x2d1a - 0x0801, 0, 0, 0, NULL, NULL, DF_NORMAL },
3275 { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL, DF_NORMAL },
3276 },
3277 },
3278 NULL
3279 },
3280 3280
3281 }; 3281 };
3282 3282
3283 const int ndmC64ImageFormats = sizeof(dmC64ImageFormats) / sizeof(dmC64ImageFormats[0]); 3283 const int ndmC64ImageFormats = sizeof(dmC64ImageFormats) / sizeof(dmC64ImageFormats[0]);
3284 3284