#include "RegionFile.h" #include "util/ByteUtil.h" #include using std::string; namespace Feather { RegionFile::RegionFile(string path) { std::ifstream stream(path, std::ifstream::binary); stream.read(m_header, 8KB); // Populate m_offsets for (int i = 0; i < 1024; i++) { int32_t readInt = 0; std::memcpy(&readInt, &m_header[i * 4], sizeof(int32_t)); // Read big endian ints. readInt = ReverseBytes(readInt); m_offsets[i] = readInt; if (readInt == 0) continue; //int sector = GetSectorNumber(readInt); //int sectorCount = GetSectorCount(readInt); // We can record which sectors are used by this region here } } }