34 lines
799 B
C++
34 lines
799 B
C++
#include "RegionFile.h"
|
|
#include "util/ByteUtil.h"
|
|
|
|
#include <fstream>
|
|
|
|
using std::string;
|
|
|
|
namespace Feather
|
|
{
|
|
RegionFile::RegionFile(string path)
|
|
: m_path(path)
|
|
{
|
|
m_stream = new std::ifstream(path, std::ifstream::binary);
|
|
m_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 * sizeof(int32_t)], 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);
|
|
//Log::Trace("{}: Sector [{:x}] Count:{} Num:{}", i, readInt, sectorCount, sector);
|
|
// We can record which sectors are used by this region here
|
|
}
|
|
}
|
|
} |