Mercurial > hg > dmlib
diff tools/lib64gfx.c @ 2398:0b1928ed902f
Merge dmC64ImageGetNumBlocks() into dmC64SetupImageData().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 10 Jan 2020 01:45:46 +0200 |
parents | 2dbbc1c91231 |
children | c5a32812dd97 |
line wrap: on
line diff
--- a/tools/lib64gfx.c Fri Jan 10 01:37:41 2020 +0200 +++ b/tools/lib64gfx.c Fri Jan 10 01:45:46 2020 +0200 @@ -96,23 +96,6 @@ } -int dmC64ImageGetNumBlocks(const DMC64ImageFormat *fmt) -{ - int nblocks = 0; - for (int i = 0; i < D64_MAX_ENCDEC_OPS; i++) - { - const DMC64EncDecOp *op = fmtGetEncDecOp(fmt, i); - if (op->type == DO_LAST) - break; - - if (op->bank > nblocks) - nblocks = op->bank; - } - - return nblocks + 1; -} - - int dmC64MemBlockAlloc(DMC64MemBlock *blk, const size_t size) { if ((blk->data = dmMalloc0(size)) == NULL) @@ -167,8 +150,19 @@ static void dmC64SetupImageData(DMC64Image *img, const DMC64ImageFormat *fmt) { + int nblocks = 0; + for (int i = 0; i < D64_MAX_ENCDEC_OPS; i++) + { + const DMC64EncDecOp *op = fmtGetEncDecOp(fmt, i); + if (op->type == DO_LAST) + break; + + if (op->bank > nblocks) + nblocks = op->bank; + } + img->fmt = fmt->format; - img->nblocks = dmC64ImageGetNumBlocks(fmt); + img->nblocks = nblocks + 1; dmMemset(img->extraInfo, 0, sizeof(img->extraInfo)); img->extraInfo[D64_EI_MODE] = fmt->format->mode;