1#include "MapdataFileAccessor.hh"
6MapdataFileAccessor::MapdataFileAccessor(
const MapdataFileAccessor::SData *data) : m_rawData(data) {
7 u32 offset = parse<u16>(data->headerSize) - parse<u16>(data->sectionCount) * 4;
8 m_sectionDefOffset = offset;
9 m_sectionDef =
reinterpret_cast<const u32 *
>(
reinterpret_cast<const u8 *
>(m_rawData) + offset);
10 m_version = offset > 12 ? parse<u32>(m_sectionDef[-1]) : 0;
14const MapSectionHeader *MapdataFileAccessor::findSection(u32 signature)
const {
15 const MapSectionHeader *sectionPtr =
nullptr;
17 for (
size_t i = 0; i < parse<u16>(m_rawData->sectionCount); ++i) {
18 const MapSectionHeader *header =
19 reinterpret_cast<const MapSectionHeader *
>(
reinterpret_cast<const u8 *
>(m_rawData) +
20 parse<u16>(m_rawData->headerSize) + parse<u32>(m_sectionDef[i]));
21 if (parse<u32>(header->magic) == signature) {
High-level handling for generic system operations, such as input reading, race configuration,...