# HG changeset patch # User Matti Hamalainen # Date 1530138247 -10800 # Node ID 3c6f638ce402d0f2dbe0bdfe132d8e079cd4dd5a # Parent ee9bbf891352afddcdd420444213ab1fd2c84f62 Remove the useless distinction of DO_ENC_FUNC and DO_DEC_FUNC, as the function pointers are separate anyway. Thus we now only have DO_FUNC. diff -r ee9bbf891352 -r 3c6f638ce402 tools/lib64fmts.c --- a/tools/lib64fmts.c Wed Jun 27 19:13:36 2018 +0300 +++ b/tools/lib64fmts.c Thu Jun 28 01:24:07 2018 +0300 @@ -1097,7 +1097,7 @@ DEF_SCREEN_RAMS_8(0x43e8, 8, 0x400, 0), { DO_COPY , DS_BITMAP_RAM , 0x63e8, 1, 0 , 0, NULL, NULL }, { DO_COPY , DS_EXTRA_DATA , 0x8328, 0, 100, 100, NULL, NULL }, - { DO_DEC_FUNC , 0 , 0 , 0, 1 , 0, fmtTruePaintGetLaceType, NULL }, + { DO_FUNC , 0 , 0 , 0, 1 , 0, fmtTruePaintGetLaceType, NULL }, { DO_LAST , 0 , 0 , 0, 0 , 0, NULL, NULL }, } }, @@ -1128,8 +1128,7 @@ { DO_COPY , DS_BITMAP_RAM , 0x0800, 0, 0, 0, NULL, NULL }, { DO_COPY , DS_SCREEN_RAM , 0x0400, 0, 0, 0, NULL, NULL }, { DO_SET_MEM_LO , DS_BGCOL , 0x2740, 0, 0, 0, NULL, NULL }, - { DO_DEC_FUNC , 0 , 0x2742, 0, 1, 0, fmtDrazLaceGetLaceType, NULL }, - { DO_ENC_FUNC , 0 , 0x2742, 0, 1, 0, NULL, fmtDrazLaceSetLaceType }, + { DO_FUNC , 0 , 0x2742, 0, 1, 0, fmtDrazLaceGetLaceType, fmtDrazLaceSetLaceType }, { DO_COPY , DS_BITMAP_RAM , 0x2800, 1, 0, 0, NULL, NULL }, { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL }, } @@ -1148,7 +1147,7 @@ { DO_COPY , DS_BITMAP_RAM , 0x2400, 1, 0, 0, NULL, NULL }, { DO_COPY , DS_SCREEN_RAM , 0x4400, 1, 0, 0, NULL, NULL }, { DO_COPY , DS_COLOR_RAM , 0x4800, 0, 0, 0, NULL, NULL }, - { DO_DEC_FUNC , 0 , 0x0000, 0, 0, 0, fmtTruePaintGetLaceType, NULL }, + { DO_FUNC , 0 , 0x0000, 0, 0, 0, fmtTruePaintGetLaceType, NULL }, { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL }, } }, @@ -1164,7 +1163,7 @@ DEF_SCREEN_RAMS_8(0x2000, 0, 0x400, 0), { DO_COPY , DS_BITMAP_RAM , 0x4000, 1, 0, 0, NULL, NULL }, DEF_SCREEN_RAMS_8(0x6000, 8, 0x400, 0), - { DO_DEC_FUNC , 0 , 0 , 0, 0, 0, fmtECIGetLaceType, NULL }, + { DO_FUNC , 0 , 0 , 0, 0, 0, fmtECIGetLaceType, NULL }, { DO_LAST , 0 , 0 , 0, 0, 0, NULL, NULL }, } }, @@ -1765,8 +1764,8 @@ // GunPaint does not store the last 3 d021 values .. so set them to black // XXX TODO: According to some, the last 4 should be same .. { DO_SET_MEM , DS_EXTRA_DATA , 0 , 0, 3 , 20+177, NULL, NULL }, - { DO_DEC_FUNC , 0 , 0x2742, 0, 1 , 0, fmtTruePaintGetLaceType, NULL }, - { DO_ENC_FUNC , 0 , fmtGunPaintMagicOffs, 0, fmtGunPaintMagicLen, 0, NULL, fmtEncodeGunPaint }, + { DO_FUNC , 0 , 0x2742, 0, 1 , 0, fmtTruePaintGetLaceType, NULL }, + { DO_FUNC , 0 , fmtGunPaintMagicOffs, 0, fmtGunPaintMagicLen, 0, NULL, fmtEncodeGunPaint }, { DO_LAST , 0 , 0 , 0, 0 , 0, NULL, NULL }, } }, diff -r ee9bbf891352 -r 3c6f638ce402 tools/lib64gfx.c --- a/tools/lib64gfx.c Wed Jun 27 19:13:36 2018 +0300 +++ b/tools/lib64gfx.c Thu Jun 28 01:24:07 2018 +0300 @@ -751,8 +751,7 @@ break; // Just list the allowed ops here - case DO_DEC_FUNC: - case DO_ENC_FUNC: + case DO_FUNC: case DO_CHAR_CFG: case DO_LAST: break; @@ -1014,15 +1013,9 @@ } break; - case DO_DEC_FUNC: - if (op->decFunction == NULL) - { - return dmError(DMERR_INTERNAL, - "Decode op is a function, but function ptr is NULL: " - "op #%d, offs=%d ($%04x), bank=%d, size=%d ($%04x) @ %d ($%04x)\n", - i, op->offs, op->offs, op->bank, size, size, buf->len, buf->len); - } - if (!op->decFunction(img, op, buf, fmt)) + case DO_FUNC: + if (op->decFunction != NULL && + !op->decFunction(img, op, buf, fmt)) { return dmError(DMERR_INTERNAL, "Decode op custom function failed: op #%d, " @@ -1187,16 +1180,9 @@ } break; - case DO_ENC_FUNC: - if (op->encFunction == NULL) - { - res = dmError(DMERR_INTERNAL, - "Encode op is a function, but function ptr is NULL: " - "op #%d, offs=%d ($%04x), bank=%d, size=%d ($%04x) @ %d ($%04x)\n", - i, op->offs, op->offs, op->bank, size, size, buf->len, buf->len); - goto err; - } - if (!op->encFunction(op, buf, img, fmt)) + case DO_FUNC: + if (op->encFunction != NULL && + !op->encFunction(op, buf, img, fmt)) { res = dmError(DMERR_INTERNAL, "Encode op custom function failed: op #%d, " diff -r ee9bbf891352 -r 3c6f638ce402 tools/lib64gfx.h --- a/tools/lib64gfx.h Wed Jun 27 19:13:36 2018 +0300 +++ b/tools/lib64gfx.h Thu Jun 28 01:24:07 2018 +0300 @@ -92,8 +92,7 @@ DO_SET_MEM_HI, // Copy one byte value like DO_SET_MEM, but high nibble only DO_SET_MEM_LO, // Like above, but low nibble - DO_DEC_FUNC, // Execute specified decoding function (only for decoding operations) - DO_ENC_FUNC, // Same, but for encoding + DO_FUNC, // Execute specified decoding / encoding function DO_CHAR_CFG, // Set character mode configuration