diff --git a/src/dat/mcx.c b/src/dat/mcx.c index d518cdc..5b7c062 100644 --- a/src/dat/mcx.c +++ b/src/dat/mcx.c @@ -14,6 +14,7 @@ void mcx_delchunk(u8 *restrict buf, int chunk) { u32 *table = (u32 *)buf; size_t bidx = (table[chunk] >> 8) * 0x1000; // compute the byte offset the chunk starts at size_t blen = (table[chunk] & 0xFF) * 0x1000; // compute the byte length of the chunk + size_t slen = (table[chunk] & 0xFF); // acquire the sector length of the chunk table[chunk] = 0; table[chunk + 0x400] = time(NULL); // assign the current time to the timestamp, for correctness NOTE: might need to zero-out instead @@ -23,8 +24,10 @@ void mcx_delchunk(u8 *restrict buf, int chunk) { // count the amount of bytes that we must move blen = 0; - for (chunk++; chunk < 0x400; chunk++) + for (chunk++; chunk < 0x400; chunk++) { blen += table[chunk] & 0xFF * 0x1000; + table[chunk] -= htobe32(slen << 8); + } memmove(head, tail, blen); }