# HG changeset patch # User Matti Hamalainen # Date 1526003563 -10800 # Node ID bc13af8954d747d39206f7b073fb5f79bb1bfc47 # Parent 06a9c16601d69f2ebc31af4f4d1227592c8200de Add DMC64ImageFormat to C64 bitmap format encoding/decoding ops function parameters. diff -r 06a9c16601d6 -r bc13af8954d7 tools/lib64gfx.c --- a/tools/lib64gfx.c Fri May 11 04:23:47 2018 +0300 +++ b/tools/lib64gfx.c Fri May 11 04:52:43 2018 +0300 @@ -461,9 +461,11 @@ } -static BOOL fmtDrazLaceSetLaceType(DMC64Image *img, const struct _DMC64EncDecOp *op, const Uint8 *buf, const size_t len) +static BOOL fmtDrazLaceSetLaceType(DMC64Image *img, const DMC64EncDecOp *op, + const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) { (void) len; + (void) fmt; img->laceType = buf[op->offs] ? D64_ILACE_RES : D64_ILACE_COLOR; return TRUE; } @@ -544,11 +546,13 @@ } -static BOOL fmtTruePaintSetLaceType(DMC64Image *img, const struct _DMC64EncDecOp *op, const Uint8 *buf, const size_t len) +static BOOL fmtTruePaintSetLaceType(DMC64Image *img, const DMC64EncDecOp *op, + const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) { (void) op; (void) buf; (void) len; + (void) fmt; img->laceType = D64_ILACE_RES; return TRUE; } @@ -1406,7 +1410,7 @@ "op #%d, offs=%d ($%04x), bank=%d, size=%d ($%04x) @ %d ($%04x)\n", i, op->offs, op->offs, op->bank, size, size, len, len); } - if (!op->decFunction(img, op, buf, len)) + if (!op->decFunction(img, op, buf, len, fmt)) { return dmError(DMERR_INTERNAL, "Decode op custom function failed: op #%d, " @@ -1540,13 +1544,13 @@ goto err; } /* - if (!op->encFunction(op, buf, len)) + if (!op->encFunction(op, buf, img, fmt)) { res = dmError(DMERR_INTERNAL, "Encode op custom function failed: op #%d, " "offs=%d ($%04x), bank=%d, size=%d ($%04x) @ %d ($%04x)\n", - i, op->offs, op->offs, op->bank, size, size, len, len); - goto out; + i, op->offs, op->offs, op->bank, size, size, buf->len, buf->len); + goto err; } */ break; diff -r 06a9c16601d6 -r bc13af8954d7 tools/lib64gfx.h --- a/tools/lib64gfx.h Fri May 11 04:23:47 2018 +0300 +++ b/tools/lib64gfx.h Fri May 11 04:52:43 2018 +0300 @@ -151,6 +151,7 @@ #define D64_MAX_ENCDEC_OPS 64 +typedef struct _DMC64ImageFormat DMC64ImageFormat; typedef struct _DMC64EncDecOp { @@ -158,8 +159,8 @@ size_t offs; int bank; size_t size; - BOOL (*decFunction)(DMC64Image *img, const struct _DMC64EncDecOp *op, const Uint8 *buf, const size_t len); - BOOL (*encFunction)(const struct _DMC64EncDecOp *op, Uint8 **buf, size_t *len, const DMC64Image *img); + BOOL (*decFunction)(DMC64Image *img, const struct _DMC64EncDecOp *op, const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt); + BOOL (*encFunction)(const struct _DMC64EncDecOp *op, DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt); } DMC64EncDecOp;