# HG changeset patch # User Matti Hamalainen # Date 1558827874 -10800 # Node ID 51b8826bd4c134029605ec510f28d003639b9ce8 # Parent 27cf33c3a6462030f183ce7fd139ba882bb23cb5 Some fixes in charmap to image decoding. diff -r 27cf33c3a646 -r 51b8826bd4c1 tools/lib64gfx.c --- a/tools/lib64gfx.c Sun May 26 02:43:08 2019 +0300 +++ b/tools/lib64gfx.c Sun May 26 02:44:34 2019 +0300 @@ -1304,8 +1304,8 @@ // Hi-res charmap const int x = xc / 8; const int scroffs = scroffsy + x; + const int vshift = 7 - (xc & 7); const int chr = src->screen[0].data[scroffs]; - const int vshift = 7 - (xc & 7); if ((src->charData[0].data[chr * C64_CHR_SIZE + yb] >> vshift) & 1) *dp++ = src->color[0].data[scroffs]; @@ -1314,11 +1314,11 @@ } else { - // Multicolor variants + // Multicolor charmap const int x = xc / 4; const int scroffs = scroffsy + x; const int chr = src->screen[0].data[scroffs]; - const int col = src->color[0].data[scroffs] & 15; + const int col = src->color[0].data[scroffs]; if (col & 8) { @@ -1328,14 +1328,14 @@ case 0: *dp++ = src->bgcolor; break; case 1: *dp++ = src->d022; break; case 2: *dp++ = src->d023; break; - case 3: *dp++ = col; + case 3: *dp++ = col & 15; } } else { const int vshift = 7 - (xc & 7); if ((src->charData[0].data[chr * C64_CHR_SIZE + yb] >> vshift) & 1) - *dp++ = src->color[0].data[scroffs]; + *dp++ = col & 7; else *dp++ = src->bgcolor; }