Skip to content

Commit 4943415

Browse files
committed
Store file dates from 2024
Remove trimmed_crc in <track> elements Omit pregap property in <track> if its zero
1 parent e3a65ba commit 4943415

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

MakePureDOSDAT.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ void ListCHDTracks(std::vector<Bit8u>& line, const Bit8u* chd_data, size_t chd_s
454454
if (!hunk_pos) { memset(track_out, 0, data_size); }
455455
else { memcpy(track_out, chd_data + hunk_pos + hunk_ofs, data_size); }
456456
}
457-
Bit32u in_zeros = 0, out_zeros = 0, datacrc32 = 0;
457+
Bit32u in_zeros = 0, out_zeros = 0;
458458
if (isAudio)
459459
{
460460
// CHD audio endian swap
@@ -463,21 +463,20 @@ void ListCHDTracks(std::vector<Bit8u>& line, const Bit8u* chd_data, size_t chd_s
463463
// Additional info for audio tracks
464464
for (; in_zeros != track_size && track_data[in_zeros] == 0; in_zeros++) {}
465465
if (in_zeros != track_size) for (; out_zeros != track_size && track_data[track_size - 1 - out_zeros] == 0; out_zeros++) {}
466-
datacrc32 = CRC32(track_data + in_zeros, (size_t)(track_size - in_zeros - out_zeros));
467466
}
468467
Bit32u trackcrc32 = CRC32(track_data, (size_t)track_size);
469468
Bit8u trackmd5[16], tracksha1[20];
470469
FastMD5(track_data, (size_t)track_size, trackmd5);
471470
SHA1(track_data, (size_t)track_size, tracksha1);
472471

473-
XMLAppendRawF(line, 200, " <track number=\"%d\" type=\"%s\" frames=\"%d\" %spregap=\"%d\" duration=\"%02d:%02d:%02d\" size=\"%u\"",
474-
mt_track_no, mt_type, mt_frames, ((mt_pregap && mt_pgtype[0] != 'V') ? "omitted_" : ""), mt_pregap, (mt_frames/75/60), (mt_frames/75)%60, mt_frames%75, (Bit32u)track_size);
472+
XMLAppendRawF(line, 128, " <track number=\"%d\" type=\"%s\" frames=\"%d\"", mt_track_no, mt_type, mt_frames);
473+
if (mt_pregap) XMLAppendRawF(line, 40, " %spregap=\"%d\"", (mt_pgtype[0] != 'V' ? "omitted_" : ""), mt_pregap);
474+
XMLAppendRawF(line, 64, " duration=\"%02d:%02d:%02d\" size=\"%u\"", (mt_frames/75/60), (mt_frames/75)%60, mt_frames%75, (Bit32u)track_size);
475475
XMLAppendRawF(line, 21, " crc=\"%08x\" md5=\"", trackcrc32);
476476
for (int md5i = 0; md5i != 16; md5i++) XMLAppendRawF(line, 2, "%02x", trackmd5[md5i]);
477477
XMLAppendRaw(line, 8, "\" sha1=\"");
478478
for (int sha1i = 0; sha1i != 20; sha1i++) XMLAppendRawF(line, 2, "%02x", tracksha1[sha1i]);
479-
if (isAudio)
480-
XMLAppendRawF(line, 72, "\" in_zeros=\"%u\" out_zeros=\"%u\" trimmed_crc=\"%08x", in_zeros, out_zeros, datacrc32);
479+
if (isAudio) XMLAppendRawF(line, 72, "\" in_zeros=\"%u\" out_zeros=\"%u", in_zeros, out_zeros);
481480
XMLAppendRaw(line, 4, "\"/>\n");
482481
free(track_data);
483482
}
@@ -716,9 +715,9 @@ int main(int argc, char *argv[])
716715
*p = '/'; // convert back-slashes to regular slashes
717716

718717
bool is_dir = (name[filename_len - 1] == '/' || (external_attr & 0x10));
719-
if (is_dir && (file_date >> 9) >= 44)
718+
if (is_dir && (file_date >> 9) >= 45)
720719
{
721-
// Fix time stamp of directory records from 2024 and newer to 1999-12-31 (and skip them when outputting records of non-empty directories below)
720+
// Fix time stamp of directory records from 2025 and newer to 1999-12-31 (and skip them when outputting records of non-empty directories below)
722721
file_date = ((19 << 9) | (12 << 5) | 31);
723722
file_time = 0;
724723
}
@@ -727,9 +726,9 @@ int main(int argc, char *argv[])
727726
// Don't output the TrrntZip default time stamp (1996-12-24 23:32:00)
728727
file_date = file_time = 0;
729728
}
730-
else if ((file_date >> 9) >= 44)
729+
else if ((file_date >> 9) >= 45)
731730
{
732-
// Don't output file time stamps from 2024 and newer
731+
// Don't output file time stamps from 2025 and newer
733732
file_date = file_time = 0;
734733
}
735734

0 commit comments

Comments
 (0)