comparison tools/lib64gfx.c @ 2322:5abb81daadd5

Rename DMC64EncDecOp::offs2 to blkoffs.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 03 Sep 2019 10:41:21 +0300
parents cd266022e4a8
children dc79c64f158c
comparison
equal deleted inserted replaced
2321:9360a693d8af 2322:5abb81daadd5
1006 case DS_CHAR_DATA: 1006 case DS_CHAR_DATA:
1007 case DS_EXTRA_DATA: 1007 case DS_EXTRA_DATA:
1008 // XXX BZZZT .. a nasty cast here 1008 // XXX BZZZT .. a nasty cast here
1009 blk = (DMC64MemBlock *) dmC64GetOpMemBlock(img, op->subject, op->bank); 1009 blk = (DMC64MemBlock *) dmC64GetOpMemBlock(img, op->subject, op->bank);
1010 1010
1011 if ((dmC64MemBlockReAlloc(blk, op->offs2 + size)) != DMERR_OK) 1011 if ((dmC64MemBlockReAlloc(blk, op->blkoffs + size)) != DMERR_OK)
1012 { 1012 {
1013 return dmError(DMERR_MALLOC, 1013 return dmError(DMERR_MALLOC,
1014 "Could not allocate '%s' block! " 1014 "Could not allocate '%s' block! "
1015 "op #%d, offs=%d ($%04x), bank=%d, size=%d ($%04x) @ %d ($%04x)\n", 1015 "op #%d, offs=%d ($%04x), bank=%d, size=%d ($%04x) @ %d ($%04x)\n",
1016 subjname, i, op->offs, op->offs, op->bank, op->offs2 + size, op->offs2 + size, buf->len, buf->len); 1016 subjname, i, op->offs, op->offs, op->bank, op->blkoffs + size, op->blkoffs + size, buf->len, buf->len);
1017 } 1017 }
1018 switch (op->type) 1018 switch (op->type)
1019 { 1019 {
1020 case DO_COPY: 1020 case DO_COPY:
1021 memcpy(blk->data + op->offs2, src, size); 1021 memcpy(blk->data + op->blkoffs, src, size);
1022 break; 1022 break;
1023 1023
1024 case DO_SET_MEM: 1024 case DO_SET_MEM:
1025 dmMemset(blk->data + op->offs2, *src, size); 1025 dmMemset(blk->data + op->blkoffs, *src, size);
1026 break; 1026 break;
1027 1027
1028 case DO_SET_MEM_HI: 1028 case DO_SET_MEM_HI:
1029 dmMemset(blk->data + op->offs2, (*src >> 4) & 0x0f, size); 1029 dmMemset(blk->data + op->blkoffs, (*src >> 4) & 0x0f, size);
1030 break; 1030 break;
1031 1031
1032 case DO_SET_MEM_LO: 1032 case DO_SET_MEM_LO:
1033 dmMemset(blk->data + op->offs2, *src & 0x0f, size); 1033 dmMemset(blk->data + op->blkoffs, *src & 0x0f, size);
1034 break; 1034 break;
1035 1035
1036 case DO_SET_OP: 1036 case DO_SET_OP:
1037 dmMemset(blk->data + op->offs2, op->offs, size); 1037 dmMemset(blk->data + op->blkoffs, op->offs, size);
1038 break; 1038 break;
1039 1039
1040 default: 1040 default:
1041 return dmError(DMERR_INTERNAL, 1041 return dmError(DMERR_INTERNAL,
1042 "Unhandled op type %s in " 1042 "Unhandled op type %s in "
1083 case DS_BGCOL: 1083 case DS_BGCOL:
1084 case DS_D021: img->bgcolor = value; break; 1084 case DS_D021: img->bgcolor = value; break;
1085 case DS_D022: img->d022 = value; break; 1085 case DS_D022: img->d022 = value; break;
1086 case DS_D023: img->d023 = value; break; 1086 case DS_D023: img->d023 = value; break;
1087 case DS_D024: img->d024 = value; break; 1087 case DS_D024: img->d024 = value; break;
1088 case DS_EXTRA_INFO: img->extraInfo[op->offs2] = value; break; 1088 case DS_EXTRA_INFO: img->extraInfo[op->blkoffs] = value; break;
1089 } 1089 }
1090 break; 1090 break;
1091 1091
1092 default: 1092 default:
1093 return dmError(DMERR_INTERNAL, 1093 return dmError(DMERR_INTERNAL,
1226 "'%s' block is NULL in " 1226 "'%s' block is NULL in "
1227 "op #%d, offs=%d ($%04x), bank=%d, size=%d ($%04x) @ %d ($%04x)\n", 1227 "op #%d, offs=%d ($%04x), bank=%d, size=%d ($%04x) @ %d ($%04x)\n",
1228 subjname, i, op->offs, op->offs, op->bank, size, size, buf->len, buf->len); 1228 subjname, i, op->offs, op->offs, op->bank, size, size, buf->len, buf->len);
1229 goto err; 1229 goto err;
1230 } 1230 }
1231 if (op->offs2 + size > blk->size) 1231 if (op->blkoffs + size > blk->size)
1232 { 1232 {
1233 res = dmError(DMERR_INTERNAL, 1233 res = dmError(DMERR_INTERNAL,
1234 "'%s' size mismatch %d <> %d in " 1234 "'%s' size mismatch %d <> %d in "
1235 "op #%d, offs=%d ($%04x), bank=%d, offs2=%d ($%02x), size=%d ($%04x)\n", 1235 "op #%d, offs=%d ($%04x), bank=%d, offs2=%d ($%02x), size=%d ($%04x)\n",
1236 subjname, op->offs2 + size, blk->size, i, op->offs, op->offs, op->bank, op->offs2, op->offs2, size, size); 1236 subjname, op->blkoffs + size, blk->size, i, op->offs, op->offs, op->bank, op->blkoffs, op->blkoffs, size, size);
1237 goto err; 1237 goto err;
1238 } 1238 }
1239 memcpy(dst, blk->data + op->offs2, size); 1239 memcpy(dst, blk->data + op->blkoffs, size);
1240 break; 1240 break;
1241 1241
1242 case DO_SET_MEM: 1242 case DO_SET_MEM:
1243 case DO_SET_MEM_HI: 1243 case DO_SET_MEM_HI:
1244 case DO_SET_MEM_LO: 1244 case DO_SET_MEM_LO:
1267 case DS_BGCOL: 1267 case DS_BGCOL:
1268 case DS_D021: value = img->bgcolor; break; 1268 case DS_D021: value = img->bgcolor; break;
1269 case DS_D022: value = img->d022; break; 1269 case DS_D022: value = img->d022; break;
1270 case DS_D023: value = img->d023; break; 1270 case DS_D023: value = img->d023; break;
1271 case DS_D024: value = img->d024; break; 1271 case DS_D024: value = img->d024; break;
1272 case DS_EXTRA_INFO: value = img->extraInfo[op->offs2]; break; 1272 case DS_EXTRA_INFO: value = img->extraInfo[op->blkoffs]; break;
1273 } 1273 }
1274 switch (op->type) 1274 switch (op->type)
1275 { 1275 {
1276 case DO_COPY: 1276 case DO_COPY:
1277 case DO_SET_MEM: 1277 case DO_SET_MEM: