25 SectorBuffer* buffers,
size_t startSector,
size_t nbSectors)
27 auto last = startSector + nbSectors - 1;
47 SectorBuffer* buffers,
size_t startSector,
size_t nbSectors)
51 for (
auto i :
xrange(nbSectors)) {
72 writeSectorImpl(sector, buf);
80 const SectorBuffer* buffers,
size_t startSector,
size_t nbSectors)
84 for (
auto i :
xrange(nbSectors)) {
92 return getNbSectorsImpl();
97 patch = std::make_unique<IPSPatch>(std::move(patchFile), std::move(patch));
102 return patch->getFilenames();
107 return !patch->isEmptyPatch();
113 if (sha1cache.
empty()) {
125 constexpr
size_t MAX_CHUNK = 32;
129 while (sector < total) {
130 auto chunk =
std::min(MAX_CHUNK, total - sector);
146 return forcedWriteProtect || isWriteProtectedImpl();
152 forcedWriteProtect =
true;
This class represents a filename.
const std::string & getMessage() const &
Helper class to perform a sha1 calculation.
Sha1Sum digest()
Get the final hash.
void update(span< const uint8_t > data)
Incrementally calculate the hash value.
bool isWriteProtected() const
virtual bool isDummyDisk() const
virtual void checkCaches()
void readSector(size_t sector, SectorBuffer &buf)
void readSectors(SectorBuffer *buffers, size_t startSector, size_t nbSectors)
size_t getNbSectors() const
Sha1Sum getSha1Sum(FilePool &filepool)
Calculate SHA1 of the content of this disk.
virtual void readSectorsImpl(SectorBuffer *buffers, size_t startSector, size_t nbSectors)
virtual void flushCaches()
virtual Sha1Sum getSha1SumImpl(FilePool &filepool)
void writeSectors(const SectorBuffer *buffers, size_t startSector, size_t nbSectors)
std::vector< Filename > getPatches() const
void applyPatch(Filename patchFile)
void writeSector(size_t sector, const SectorBuffer &buf)
virtual void readSectorImpl(size_t sector, SectorBuffer &buf)
void setPeekMode(bool peek)
This class represents the result of a sha1 calculation (a 160-bit value).
constexpr vecN< N, T > min(const vecN< N, T > &x, const vecN< N, T > &y)
This file implemented 3 utility functions:
constexpr auto xrange(T e)