| 423 | } |
| 424 | |
| 425 | BookMetadataCache::TocEntry BookMetadataCache::getTocEntry(const int index) { |
| 426 | if (!loaded) { |
| 427 | LOG_ERR("BMC", "getTocEntry called but cache not loaded"); |
| 428 | return {}; |
| 429 | } |
| 430 | |
| 431 | if (index < 0 || index >= static_cast<int>(tocCount)) { |
| 432 | LOG_ERR("BMC", "getTocEntry index %d out of range", index); |
| 433 | return {}; |
| 434 | } |
| 435 | |
| 436 | // Seek to TOC LUT item, read from LUT and get out data |
| 437 | bookFile.seek(lutOffset + sizeof(uint32_t) * spineCount + sizeof(uint32_t) * index); |
| 438 | uint32_t tocEntryPos; |
| 439 | serialization::readPod(bookFile, tocEntryPos); |
| 440 | bookFile.seek(tocEntryPos); |
| 441 | return readTocEntry(bookFile); |
| 442 | } |
| 443 | |
| 444 | BookMetadataCache::SpineEntry BookMetadataCache::readSpineEntry(HalFile& file) const { |
| 445 | SpineEntry entry; |
no test coverage detected