# HG changeset patch # User Matti Hamalainen # Date 1560227924 -10800 # Node ID a39bf85308e5806556de104a17bd96df1512d457 # Parent 7c4c9013e41232c94b58deafa5976a7ecac13916 Add helper function dmC64GetOpType() and use it to display operator type name instead of just number. diff -r 7c4c9013e412 -r a39bf85308e5 tools/lib64gfx.c --- a/tools/lib64gfx.c Tue Jun 11 07:37:56 2019 +0300 +++ b/tools/lib64gfx.c Tue Jun 11 07:38:44 2019 +0300 @@ -903,6 +903,26 @@ } +const char *dmC64GetOpType(const int type) +{ + static const char *typeNames[DO_LAST] = + { + "COPY", + "SET_MEM", + "SET_OP", + "SET_MEM_HI", + "SET_MEM_LO", + + "FUNC", + "CHAR_CFG", + }; + if (type >= 0 && type < DO_LAST) + return typeNames[type]; + else + return "ERROR"; +} + + const DMC64MemBlock * dmC64GetOpMemBlock(const DMC64Image *img, const int subject, const int bank) { if (bank >= 0 && bank < img->nbanks) @@ -954,9 +974,9 @@ if (op->type == DO_COPY && op->offs + size > buf->len + 1) { return dmError(DMERR_INVALID_DATA, - "Decode SRC out of bounds, op #%d type=%d, subj=%s, offs=%d ($%04x), " + "Decode SRC out of bounds, op #%d type=%s, subj=%s, offs=%d ($%04x), " "bank=%d, size=%d ($%04x) @ %d ($%04x)\n", - i, op->type, subjname, op->offs, op->offs, op->bank, + i, dmC64GetOpType(op->type), subjname, op->offs, op->offs, op->bank, size, size, buf->len, buf->len); } @@ -1011,9 +1031,9 @@ default: return dmError(DMERR_INTERNAL, - "Unhandled op type %d in " + "Unhandled op type %s in " "op #%d, offs=%d ($%04x), bank=%d, size=%d ($%04x) @ %d ($%04x)\n", - op->type, i, op->offs, op->offs, op->bank, size, size, buf->len, buf->len); + dmC64GetOpType(op->type), i, op->offs, op->offs, op->bank, size, size, buf->len, buf->len); } break; @@ -1044,9 +1064,9 @@ default: return dmError(DMERR_INTERNAL, - "Unhandled op type %d in " + "Unhandled op type %s in " "op #%d, offs=%d ($%04x), bank=%d, size=%d ($%04x) @ %d ($%04x)\n", - op->type, i, op->offs, op->offs, op->bank, size, size, buf->len, buf->len); + dmC64GetOpType(op->type), i, op->offs, op->offs, op->bank, size, size, buf->len, buf->len); } switch (op->subject) { @@ -1213,9 +1233,9 @@ default: return dmError(DMERR_INTERNAL, - "Unhandled op type %d in " + "Unhandled op type %s in " "op #%d, offs=%d ($%04x), bank=%d, size=%d ($%04x) @ %d ($%04x)\n", - op->type, i, op->offs, op->offs, op->bank, size, size, buf->len, buf->len); + dmC64GetOpType(op->type), i, op->offs, op->offs, op->bank, size, size, buf->len, buf->len); } break; @@ -1255,9 +1275,9 @@ default: return dmError(DMERR_INTERNAL, - "Unhandled op type %d in " + "Unhandled op type %s in " "op #%d, offs=%d ($%04x), bank=%d, size=%d ($%04x) @ %d ($%04x)\n", - op->type, i, op->offs, op->offs, op->bank, size, size, buf->len, buf->len); + dmC64GetOpType(op->type), i, op->offs, op->offs, op->bank, size, size, buf->len, buf->len); } break;