Report correct DDT status and encode NotDumped entries with the status shift

The Mode 1 user-data DDT entry was always written as Mode1Correct even
when the prefix or ECC/EDC was wrong; report Errored in that case like the
Mode 2 paths. The all-zero paths assigned SectorStatusNotDumped without
the <<60 status shift (harmless only because it is zero) and the Mode 2
all-zero path never marked its DDTs dirty, so an all-blank Mode 2 track
wrote no DDT at all; shift the status and set the dirty flags. Also widen
a truncating (uint32_t) cast on the Mode 2 prefix slot index to uint64_t.
This commit is contained in:
2026-09-01 14:55:56 +01:00
parent 03b2494fa6
commit f3cf5f729c

View File

@@ -957,8 +957,8 @@ AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_long(void *context, uint64_t se
if(empty)
{
ctx->sector_prefix_ddt2[corrected_sector_address] = SectorStatusNotDumped;
ctx->sector_suffix_ddt2[corrected_sector_address] = SectorStatusNotDumped;
ctx->sector_prefix_ddt2[corrected_sector_address] = (uint64_t)SectorStatusNotDumped << 60;
ctx->sector_suffix_ddt2[corrected_sector_address] = (uint64_t)SectorStatusNotDumped << 60;
ctx->dirty_sector_prefix_ddt = true; // Mark prefix DDT as dirty
ctx->dirty_sector_suffix_ddt = true; // Mark suffix DDT as dirty
return aaruf_write_sector(context, sector_address, negative, data + 16, SectorStatusNotDumped,
@@ -1021,7 +1021,9 @@ AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_long(void *context, uint64_t se
}
ctx->dirty_sector_suffix_ddt = true; // Mark suffix DDT as dirty
return aaruf_write_sector(context, sector_address, negative, data + 16, SectorStatusMode1Correct,
return aaruf_write_sector(context, sector_address, negative, data + 16,
prefix_correct && suffix_correct ? SectorStatusMode1Correct
: SectorStatusErrored,
2048);
case kTrackTypeCdMode2Form1:
case kTrackTypeCdMode2Form2:
@@ -1100,8 +1102,10 @@ AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_long(void *context, uint64_t se
if(empty)
{
ctx->sector_prefix_ddt2[corrected_sector_address] = SectorStatusNotDumped;
ctx->sector_suffix_ddt2[corrected_sector_address] = SectorStatusNotDumped;
ctx->sector_prefix_ddt2[corrected_sector_address] = (uint64_t)SectorStatusNotDumped << 60;
ctx->sector_suffix_ddt2[corrected_sector_address] = (uint64_t)SectorStatusNotDumped << 60;
ctx->dirty_sector_prefix_ddt = true; // Mark prefix DDT as dirty
ctx->dirty_sector_suffix_ddt = true; // Mark suffix DDT as dirty
return aaruf_write_sector(context, sector_address, negative, data + 16, SectorStatusNotDumped,
2328);
}
@@ -1134,7 +1138,7 @@ AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_long(void *context, uint64_t se
}
memcpy(ctx->sector_prefix + ctx->sector_prefix_offset, data, 16);
ctx->sector_prefix_ddt2[corrected_sector_address] = (uint32_t)(ctx->sector_prefix_offset / 16);
ctx->sector_prefix_ddt2[corrected_sector_address] = (uint64_t)(ctx->sector_prefix_offset / 16);
ctx->sector_prefix_ddt2[corrected_sector_address] |= (uint64_t)SectorStatusErrored << 60;
ctx->sector_prefix_offset += 16;
ctx->dirty_sector_prefix_block = true; // Mark prefix block as dirty