fix: support legacy XTC file headers where pageTableOffset=48 (#1816)
## Summary **What is the goal of this PR?** Restore compatibility with older XTC files that use the legacy 48-byte header layout, so they open correctly instead of failing header/page-table validation. **What changes are included?** - Updates the XTC parser to accept legacy files where pageTableOffset starts at 0x30 instead of the newer full header size. - Avoids treating legacy header bytes as a valid chapterOffset, so older files are not misclassified as having chapters. - Switches XTC file size and seek operations to 64-bit-safe wrapper calls in HalStorage, which matches the XTC format’s 64-bit offset fields and keeps page/chapter lookups from narrowing offsets. - Keeps the existing bounds checks and improves related logging when XTC page loads fail. ## Additional Context - This is a narrow compatibility fix for XTC handling. The functional change is in the XTC parser; the HalStorage changes are supporting wrapper methods needed by that parser update. - Risk should be low outside XTC reading, since the HAL changes only expose existing underlying file APIs rather than changing storage behavior. --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? **YES**
This commit is contained in:
@@ -179,7 +179,8 @@ void XtcReaderActivity::renderPage() {
|
||||
// Load page data
|
||||
size_t bytesRead = xtc->loadPage(currentPage, pageBuffer, pageBufferSize);
|
||||
if (bytesRead == 0) {
|
||||
LOG_ERR("XTR", "Failed to load page %lu", currentPage);
|
||||
LOG_ERR("XTR", "Failed to load page %lu: bufferSize=%lu bitDepth=%u error=%s", currentPage, pageBufferSize,
|
||||
bitDepth, xtc::errorToString(xtc->getLastError()));
|
||||
free(pageBuffer);
|
||||
renderer.clearScreen();
|
||||
renderer.drawCenteredText(UI_12_FONT_ID, 300, tr(STR_PAGE_LOAD_ERROR), true, EpdFontFamily::BOLD);
|
||||
|
||||
Reference in New Issue
Block a user