Cache reader progress

This commit is contained in:
jpirnay
2026-04-26 23:21:19 +02:00
parent 7e9c953127
commit 5b0a7743d1
6 changed files with 72 additions and 122 deletions
+5 -2
View File
@@ -334,12 +334,15 @@ void XtcReaderActivity::renderPage() {
void XtcReaderActivity::saveProgress() const {
FsFile f;
if (Storage.openFileForWrite("XTR", xtc->getCachePath() + "/progress.bin", f)) {
uint8_t data[4];
const uint32_t pageCount = xtc->getPageCount();
const uint8_t overallPercent = (pageCount > 0) ? static_cast<uint8_t>((currentPage + 1) * 100 / pageCount) : 0;
uint8_t data[5];
data[0] = currentPage & 0xFF;
data[1] = (currentPage >> 8) & 0xFF;
data[2] = (currentPage >> 16) & 0xFF;
data[3] = (currentPage >> 24) & 0xFF;
f.write(data, 4);
data[4] = overallPercent;
f.write(data, 5);
f.close();
}
}