comparison tools/lib64fmts.c @ 2166:4c3fdc9c0056

Clean up some variable and constant names.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 11 Jun 2019 05:44:22 +0300
parents 3d3094ba21c5
children 9d362ea1a606
comparison
equal deleted inserted replaced
2165:3d3094ba21c5 2166:4c3fdc9c0056
22 22
23 23
24 // XXX TODO: Research what these values actually mean. It would seem probable 24 // XXX TODO: Research what these values actually mean. It would seem probable
25 // that these may not be static values at all, as there are 8 more that change 25 // that these may not be static values at all, as there are 8 more that change
26 // before actual image data, but do not seem to be used in the image itself. 26 // before actual image data, but do not seem to be used in the image itself.
27 static const Uint8 fmtMicroIllustratorMagicID_1[] = 27 static const Uint8 fmtMicroIllustrator_MagicID_1[] =
28 { 28 {
29 0xff, 0x80, 0x69, 0x67, 0x14, 0x00, 29 0xff, 0x80, 0x69, 0x67, 0x14, 0x00,
30 }; 30 };
31 31
32 static const Uint8 fmtMicroIllustratorMagicID_2[] = 32 static const Uint8 fmtMicroIllustrator_MagicID_2[] =
33 { 33 {
34 0xe8, 0x03, 0xe8, 0x03, 0x40, 0x1f, 34 0xe8, 0x03, 0xe8, 0x03, 0x40, 0x1f,
35 }; 35 };
36 36
37 static int fmtProbeMicroIllustrator(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) 37 static int fmtProbeMicroIllustrator(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
38 { 38 {
39 if (buf->len == fmt->size && 39 if (buf->len == fmt->size &&
40 DM_MEMCMP_SIZE(buf->data + 2, fmtMicroIllustratorMagicID_1) == 0 40 DM_MEMCMP_SIZE(buf->data + 2, fmtMicroIllustrator_MagicID_1) == 0
41 && 41 &&
42 DM_MEMCMP_SIZE(buf->data + 9, fmtMicroIllustratorMagicID_2) == 0 42 DM_MEMCMP_SIZE(buf->data + 9, fmtMicroIllustrator_MagicID_2) == 0
43 ) 43 )
44 return DM_PROBE_SCORE_MAX; 44 return DM_PROBE_SCORE_MAX;
45 45
46 return DM_PROBE_SCORE_FALSE; 46 return DM_PROBE_SCORE_FALSE;
47 } 47 }
52 { 52 {
53 (void) op; 53 (void) op;
54 (void) img; 54 (void) img;
55 (void) fmt; 55 (void) fmt;
56 56
57 memcpy(buf->data + 2, fmtMicroIllustratorMagicID_1, sizeof(fmtMicroIllustratorMagicID_1)); 57 memcpy(buf->data + 2, fmtMicroIllustrator_MagicID_1, sizeof(fmtMicroIllustrator_MagicID_1));
58 memcpy(buf->data + 9, fmtMicroIllustratorMagicID_2, sizeof(fmtMicroIllustratorMagicID_2)); 58 memcpy(buf->data + 9, fmtMicroIllustrator_MagicID_2, sizeof(fmtMicroIllustrator_MagicID_2));
59 59
60 return DMERR_OK; 60 return DMERR_OK;
61 } 61 }
62 62
63 63
454 vshift, 0, 454 vshift, 0,
455 rasterX & 1, 0, img->bgcolor); 455 rasterX & 1, 0, img->bgcolor);
456 } 456 }
457 457
458 458
459 static const char *fmtBDP5MagicID = "BDP 5.00"; 459 static const char *fmtBDP5_MagicID = "BDP 5.00";
460 460
461 static int fmtProbeBDP5Packed(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) 461 static int fmtProbeBDP5Packed(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
462 { 462 {
463 if (buf->len > 20 && 463 if (buf->len > 20 &&
464 dmCompareAddr16(buf, 0, fmt->addr) && 464 dmCompareAddr16(buf, 0, fmt->addr) &&
465 DM_MEMCMP_LEN(buf->data + 2, fmtBDP5MagicID) == 0) 465 DM_MEMCMP_LEN(buf->data + 2, fmtBDP5_MagicID) == 0)
466 return DM_PROBE_SCORE_MAX; 466 return DM_PROBE_SCORE_MAX;
467 467
468 return DM_PROBE_SCORE_FALSE; 468 return DM_PROBE_SCORE_FALSE;
469 } 469 }
470 470
521 cfg.rleMaxCountW = 1024; 521 cfg.rleMaxCountW = 1024;
522 522
523 dmGenericRLEAnalyze(&mem, &cfg); 523 dmGenericRLEAnalyze(&mem, &cfg);
524 524
525 // Add the header bits 525 // Add the header bits
526 if (!dmGrowBufPut(buf, (Uint8 *) fmtBDP5MagicID, strlen(fmtBDP5MagicID)) || 526 if (!dmGrowBufPut(buf, (Uint8 *) fmtBDP5_MagicID, strlen(fmtBDP5_MagicID)) ||
527 !dmGrowBufPutU8(buf, cfg.rleMarkerB) || 527 !dmGrowBufPutU8(buf, cfg.rleMarkerB) ||
528 !dmGrowBufPutU8(buf, cfg.rleMarkerW)) 528 !dmGrowBufPutU8(buf, cfg.rleMarkerW))
529 { 529 {
530 res = DMERR_MALLOC; 530 res = DMERR_MALLOC;
531 goto out; 531 goto out;
538 dmGrowBufFree(&mem); 538 dmGrowBufFree(&mem);
539 return res; 539 return res;
540 } 540 }
541 541
542 542
543 static const char *fmtGunPaintMagicID = "GUNPAINT (JZ) "; 543 static const char *fmtGunPaint_MagicID = "GUNPAINT (JZ) ";
544 #define fmtGunPaintMagicLen (14) 544 #define fmtGunPaint_MagicLen (14)
545 #define fmtGunPaintMagicOffs (0x3e8) 545 #define fmtGunPaint_MagicOffs (0x3e8)
546 546
547 static int fmtProbeGunPaint(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) 547 static int fmtProbeGunPaint(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
548 { 548 {
549 if (buf->len > fmtGunPaintMagicOffs + fmtGunPaintMagicLen && 549 if (buf->len > fmtGunPaint_MagicOffs + fmtGunPaint_MagicLen &&
550 dmCompareAddr16(buf, 0, fmt->addr) && 550 dmCompareAddr16(buf, 0, fmt->addr) &&
551 memcmp(buf->data + fmtGunPaintMagicOffs + 2, fmtGunPaintMagicID, fmtGunPaintMagicLen) == 0) 551 memcmp(buf->data + fmtGunPaint_MagicOffs + 2, fmtGunPaint_MagicID, fmtGunPaint_MagicLen) == 0)
552 return DM_PROBE_SCORE_MAX; 552 return DM_PROBE_SCORE_MAX;
553 553
554 return DM_PROBE_SCORE_FALSE; 554 return DM_PROBE_SCORE_FALSE;
555 } 555 }
556 556
562 (void) img; 562 (void) img;
563 (void) fmt; 563 (void) fmt;
564 564
565 // Here we assume that the op triggering this function is 565 // Here we assume that the op triggering this function is
566 // at the end of the oplist, so the memory is allocated, 566 // at the end of the oplist, so the memory is allocated,
567 memcpy(buf->data + fmtGunPaintMagicOffs + 2, fmtGunPaintMagicID, fmtGunPaintMagicLen); 567 memcpy(buf->data + fmtGunPaint_MagicOffs + 2, fmtGunPaint_MagicID, fmtGunPaint_MagicLen);
568 568
569 return DMERR_OK; 569 return DMERR_OK;
570 } 570 }
571 571
572 572
1225 { 1225 {
1226 DM_C64_GENERIC_SC_PIXEL_DEFS(img) 1226 DM_C64_GENERIC_SC_PIXEL_DEFS(img)
1227 const int spr_y = rasterY / D64_SPR_HEIGHT_PX; 1227 const int spr_y = rasterY / D64_SPR_HEIGHT_PX;
1228 const int spr_yd = rasterY % D64_SPR_HEIGHT_PX; 1228 const int spr_yd = rasterY % D64_SPR_HEIGHT_PX;
1229 const int spr_x = rasterX / D64_SPR_WIDTH_PX; 1229 const int spr_x = rasterX / D64_SPR_WIDTH_PX;
1230 const int spr_xd = rasterX % D64_SPR_WIDTH_PX; 1230 const int spr_xd = (rasterX % D64_SPR_WIDTH_PX) / 8;
1231 const int offs = (spr_y * 8 + spr_x) * D64_SPR_SIZE + (spr_yd * D64_SPR_WIDTH_UT) + (spr_xd / 8); 1231 const int offs = (spr_y * 8 + spr_x) * D64_SPR_SIZE + (spr_yd * D64_SPR_WIDTH_UT) + spr_xd;
1232 const int mask = 1 << (7 - (rasterX & 7)); 1232 const int mask = 1 << (7 - (rasterX & 7));
1233 int res; 1233 int res;
1234 1234
1235 Uint8 color1, 1235 Uint8 color1,
1236 color2 = img->extraData[0].data[offs] & mask ? 0x0f : 0, 1236 color2 = img->extraData[0].data[offs] & mask ? 0x0f : 0,
2260 { DO_COPY , DS_BITMAP_RAM , 0x6400, 1, 0 , 0, NULL, NULL }, 2260 { DO_COPY , DS_BITMAP_RAM , 0x6400, 1, 0 , 0, NULL, NULL },
2261 // GunPaint does not store the last 3 d021 values .. so set them to black 2261 // GunPaint does not store the last 3 d021 values .. so set them to black
2262 // XXX TODO: According to some, the last 4 should be same .. 2262 // XXX TODO: According to some, the last 4 should be same ..
2263 { DO_SET_MEM , DS_EXTRA_DATA , 0 , 0, 3 , 20+177, NULL, NULL }, 2263 { DO_SET_MEM , DS_EXTRA_DATA , 0 , 0, 3 , 20+177, NULL, NULL },
2264 { DO_FUNC , 0 , 0x2742, 0, 1 , 0, fmtTruePaintGetLaceType, NULL }, 2264 { DO_FUNC , 0 , 0x2742, 0, 1 , 0, fmtTruePaintGetLaceType, NULL },
2265 { DO_FUNC , 0 , fmtGunPaintMagicOffs, 0, fmtGunPaintMagicLen, 0, NULL, fmtEncodeGunPaint }, 2265 { DO_FUNC , 0 , fmtGunPaint_MagicOffs, 0, fmtGunPaint_MagicLen, 0, NULL, fmtEncodeGunPaint },
2266 { DO_LAST , 0 , 0 , 0, 0 , 0, NULL, NULL }, 2266 { DO_LAST , 0 , 0 , 0, 0 , 0, NULL, NULL },
2267 } 2267 }
2268 }, 2268 },
2269 NULL 2269 NULL
2270 }, 2270 },