Version section bin files

This commit is contained in:
Dave Allie
2025-12-06 22:04:59 +11:00
parent dd6e649d74
commit bb151caee7
4 changed files with 31 additions and 20 deletions

View File

@@ -6,12 +6,12 @@
#include <fstream>
constexpr uint8_t STATE_VERSION = 1;
constexpr uint8_t STATE_FILE_VERSION = 1;
constexpr char STATE_FILE[] = "/sd/.crosspoint/state.bin";
bool CrossPointState::saveToFile() const {
std::ofstream outputFile(STATE_FILE);
serialization::writePod(outputFile, STATE_VERSION);
serialization::writePod(outputFile, STATE_FILE_VERSION);
serialization::writeString(outputFile, openEpubPath);
outputFile.close();
return true;
@@ -22,7 +22,7 @@ bool CrossPointState::loadFromFile() {
uint8_t version;
serialization::readPod(inputFile, version);
if (version != STATE_VERSION) {
if (version != STATE_FILE_VERSION) {
Serial.printf("CrossPointState: Unknown version %u\n", version);
inputFile.close();
return false;

View File

@@ -148,7 +148,7 @@ void EpubReaderScreen::renderPage() {
const auto filepath = epub->getSpineItem(currentSpineIndex);
Serial.printf("Loading file: %s, index: %d\n", filepath.c_str(), currentSpineIndex);
section = new Section(epub, currentSpineIndex, renderer);
if (!section->hasCache()) {
if (!section->loadCacheMetadata()) {
Serial.println("Cache not found, building...");
{