Mercurial > hg > dmlib
comparison tools/lib64fmts.c @ 1776:aa427e68e114
Theoretically fix Gun Paint format writing.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 12 Jun 2018 17:56:35 +0300 |
parents | 4e4d54135baf |
children | a7f9e12bcd9b |
comparison
equal
deleted
inserted
replaced
1775:4e4d54135baf | 1776:aa427e68e114 |
---|---|
249 dmGrowBufFree(&mem); | 249 dmGrowBufFree(&mem); |
250 return res; | 250 return res; |
251 } | 251 } |
252 | 252 |
253 | 253 |
254 static const char *fmtGunPaintMagicID = "GUNPAINT (JZ) "; | |
255 #define fmtGunPaintMagicLen (14) | |
256 #define fmtGunPaintMagicOffs (0x3e8) | |
257 | |
254 static int fmtProbeGunPaint(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) | 258 static int fmtProbeGunPaint(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) |
255 { | 259 { |
256 if (len > 0x400 && | 260 if (len > 0x400 && |
257 dmCompareAddr16(buf, 0, fmt->addr) && | 261 dmCompareAddr16(buf, 0, fmt->addr) && |
258 memcmp(buf + 0x3ea, "GUNPAINT (JZ) ", 14) == 0) | 262 memcmp(buf + fmtGunPaintMagicOffs + 2, fmtGunPaintMagicID, fmtGunPaintMagicLen) == 0) |
259 return DM_PROBE_SCORE_MAX; | 263 return DM_PROBE_SCORE_MAX; |
260 | 264 |
261 return DM_PROBE_SCORE_FALSE; | 265 return DM_PROBE_SCORE_FALSE; |
266 } | |
267 | |
268 | |
269 static BOOL fmtEncodeGunPaint(const DMC64EncDecOp *op, DMGrowBuf *buf, | |
270 const DMC64Image *img, const DMC64ImageFormat *fmt) | |
271 { | |
272 (void) op; | |
273 (void) img; | |
274 (void) fmt; | |
275 memcpy(buf->data + fmtGunPaintMagicOffs, fmtGunPaintMagicID, fmtGunPaintMagicLen); | |
276 return TRUE; | |
262 } | 277 } |
263 | 278 |
264 | 279 |
265 static int fmtProbeAmicaPaintPacked(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) | 280 static int fmtProbeAmicaPaintPacked(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) |
266 { | 281 { |
1499 fmtDecodeFunPaint2, fmtEncodeFunPaint2Packed, | 1514 fmtDecodeFunPaint2, fmtEncodeFunPaint2Packed, |
1500 { }, &dmC64CommonFormats[3] | 1515 { }, &dmC64CommonFormats[3] |
1501 }, | 1516 }, |
1502 | 1517 |
1503 { | 1518 { |
1504 "gun", "GunPaint (unpacked)", 0x4000, 0, DM_FMT_RD, | 1519 "gun", "GunPaint (unpacked)", 0x4000, 0, DM_FMT_RDWR, |
1505 fmtProbeGunPaint, | 1520 fmtProbeGunPaint, |
1506 NULL, NULL, | 1521 NULL, NULL, |
1507 { | 1522 { |
1508 D64_FMT_MC | D64_FMT_FLI | D64_FMT_ILACE, | 1523 D64_FMT_MC | D64_FMT_FLI | D64_FMT_ILACE, |
1509 C64_SCR_WIDTH, C64_SCR_HEIGHT, | 1524 C64_SCR_WIDTH, C64_SCR_HEIGHT, |
1517 { DO_COPY , DS_COLOR_RAM , 0x4000, 0, 0, NULL, NULL }, | 1532 { DO_COPY , DS_COLOR_RAM , 0x4000, 0, 0, NULL, NULL }, |
1518 DEF_SCREEN_RAMS_8(0x4400, 8, 0x400), | 1533 DEF_SCREEN_RAMS_8(0x4400, 8, 0x400), |
1519 { DO_COPY , DS_BITMAP_RAM , 0x6400, 1, 0, NULL, NULL }, | 1534 { DO_COPY , DS_BITMAP_RAM , 0x6400, 1, 0, NULL, NULL }, |
1520 { DO_COPY , DS_EXTRA_DATA , 0x47e8, 1, 20, NULL, NULL }, | 1535 { DO_COPY , DS_EXTRA_DATA , 0x47e8, 1, 20, NULL, NULL }, |
1521 { DO_DEC_FUNC , 0 , 0x2742, 0, 1, fmtTruePaintGetLaceType, NULL }, | 1536 { DO_DEC_FUNC , 0 , 0x2742, 0, 1, fmtTruePaintGetLaceType, NULL }, |
1537 { DO_ENC_FUNC , 0 , fmtGunPaintMagicOffs, 0, fmtGunPaintMagicLen, NULL, fmtEncodeGunPaint }, | |
1522 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL }, | 1538 { DO_LAST , 0 , 0 , 0, 0, NULL, NULL }, |
1523 } | 1539 } |
1524 }, | 1540 }, |
1525 NULL | 1541 NULL |
1526 }, | 1542 }, |