Merge pull request #59 from lioncash/enum

General: Be explicit about athena's SeekOrigin type
This commit is contained in:
Phillip Stephens 2019-09-08 00:13:44 -07:00 committed by GitHub
commit 1992060927
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 93 additions and 85 deletions

View File

@ -669,11 +669,12 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
}
}
if (s < secCount - 1)
reader.seek(secStart + secSizes[s], athena::Begin);
if (s < secCount - 1) {
reader.seek(secStart + secSizes[s], athena::SeekOrigin::Begin);
}
}
reader.seek(afterHeaderPos, athena::Begin);
reader.seek(afterHeaderPos, athena::SeekOrigin::Begin);
visitedDLOffsets = false;
unsigned createdUVLayers = 0;
@ -989,8 +990,9 @@ atUint32 ReadGeomSectionsToBlender(hecl::blender::PyOutStream& os, athena::io::I
}
}
if (s < secCount - 1)
reader.seek(secStart + secSizes[s], athena::Begin);
if (s < secCount - 1) {
reader.seek(secStart + secSizes[s], athena::SeekOrigin::Begin);
}
}
/* Finish Mesh */
@ -1086,8 +1088,9 @@ void NameCMDL(athena::io::IStreamReader& reader, PAKRouter& pakRouter, typename
matSet.nameTextures(pakRouter, bestName.c_str(), s);
}
if (s < head.secCount - 1)
reader.seek(secStart + head.secSizes[s], athena::Begin);
if (s < head.secCount - 1) {
reader.seek(secStart + head.secSizes[s], athena::SeekOrigin::Begin);
}
}
}
@ -1545,7 +1548,7 @@ bool WriteHMDLCMDL(const hecl::ProjectPath& outPath, const hecl::ProjectPath& in
}
/* Ensure final surface's alignment writes zeros */
writer.seek(-1, athena::Current);
writer.seek(-1, athena::SeekOrigin::Current);
writer.writeUByte(0);
writer.close();
return true;
@ -2040,7 +2043,7 @@ void SurfaceHeader_1::Enumerate<BigDNA::Read>(typename Read::StreamT& reader) {
aabb[1] = reader.readVec3fBig();
remAABB -= 24;
}
reader.seek(remAABB, athena::Current);
reader.seek(remAABB, athena::SeekOrigin::Current);
/* align */
reader.seekAlign32();
}
@ -2104,7 +2107,7 @@ void SurfaceHeader_2::Enumerate<BigDNA::Read>(typename Read::StreamT& reader) {
aabb[1] = reader.readVec3fBig();
remAABB -= 24;
}
reader.seek(remAABB, athena::Current);
reader.seek(remAABB, athena::SeekOrigin::Current);
/* align */
reader.seekAlign32();
}
@ -2172,7 +2175,7 @@ void SurfaceHeader_3::Enumerate<BigDNA::Read>(typename Read::StreamT& reader) {
aabb[1] = reader.readVec3fBig();
remAABB -= 24;
}
reader.seek(remAABB, athena::Current);
reader.seek(remAABB, athena::SeekOrigin::Current);
/* unk3 */
unk3 = reader.readUByte();
/* align */

View File

@ -34,14 +34,16 @@ public:
LogDNACommon.report(logvisor::Fatal, fmt("PAK stream cursor overrun"));
}
void seek(atInt64 pos, athena::SeekOrigin origin) override {
if (origin == athena::Begin)
if (origin == athena::SeekOrigin::Begin) {
m_pos = pos;
else if (origin == athena::Current)
} else if (origin == athena::SeekOrigin::Current) {
m_pos += pos;
else if (origin == athena::End)
} else if (origin == athena::SeekOrigin::End) {
m_pos = m_sz + pos;
if (m_pos > m_sz)
}
if (m_pos > m_sz) {
LogDNACommon.report(logvisor::Fatal, fmt("PAK stream cursor overrun"));
}
}
atUint64 position() const override { return m_pos; }
atUint64 length() const override { return m_sz; }

View File

@ -116,7 +116,7 @@ void PAKBridge::build() {
if (worldMapEnt) {
worldMapEnt->name = entry.name + "_mapw";
PAKEntryReadStream rs = worldMapEnt->beginReadStream(m_node);
rs.seek(8, athena::Current);
rs.seek(8, athena::SeekOrigin::Current);
atUint32 areaCount = rs.readUint32Big();
mapw.reserve(areaCount);
for (atUint32 i = 0; i < areaCount; ++i)

View File

@ -46,7 +46,7 @@ void MREA::AddCMDLRigPairs(PAKEntryReadStream& rs, PAKRouter<PAKBridge>& pakRout
atUint64 secStart = rs.position();
while (curSec != head.sclySecIdx)
secStart += head.secSizes[curSec++];
rs.seek(secStart, athena::Begin);
rs.seek(secStart, athena::SeekOrigin::Begin);
SCLY scly;
scly.read(rs);
scly.addCMDLRigPairs(pakRouter, charAssoc);
@ -65,7 +65,7 @@ UniqueID32 MREA::GetPATHId(PAKEntryReadStream& rs) {
secStart += head.secSizes[curSec++];
if (!head.secSizes[curSec])
return {};
rs.seek(secStart, athena::Begin);
rs.seek(secStart, athena::SeekOrigin::Begin);
return {rs};
}
@ -231,7 +231,7 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
atUint64 secStart = rs.position();
matSet.read(rs);
matSet.readToBlender(os, pakRouter, entry, 0);
rs.seek(secStart + head.secSizes[0], athena::Begin);
rs.seek(secStart + head.secSizes[0], athena::SeekOrigin::Begin);
std::vector<DNACMDL::VertexAttributes> vertAttribs;
DNACMDL::GetVertexAttributes(matSet, vertAttribs);
@ -241,7 +241,7 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
MeshHeader mHeader;
secStart = rs.position();
mHeader.read(rs);
rs.seek(secStart + head.secSizes[curSec++], athena::Begin);
rs.seek(secStart + head.secSizes[curSec++], athena::SeekOrigin::Begin);
curSec += DNACMDL::ReadGeomSectionsToBlender<PAKRouter<PAKBridge>, MaterialSet, RigPair, DNACMDL::SurfaceHeader_1>(
os, rs, pakRouter, entry, dummy, true, true, vertAttribs, m, head.secCount, 0, &head.secSizes[curSec]);
os.format(fmt(
@ -255,14 +255,14 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
/* Skip AROT */
secStart = rs.position();
rs.seek(secStart + head.secSizes[curSec++], athena::Begin);
rs.seek(secStart + head.secSizes[curSec++], athena::SeekOrigin::Begin);
/* Read SCLY layers */
secStart = rs.position();
SCLY scly;
scly.read(rs);
scly.exportToLayerDirectories(entry, pakRouter, force);
rs.seek(secStart + head.secSizes[curSec++], athena::Begin);
rs.seek(secStart + head.secSizes[curSec++], athena::SeekOrigin::Begin);
/* Read collision meshes */
DeafBabe collision;
@ -270,32 +270,32 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
collision.read(rs);
DeafBabe::BlenderInit(os);
collision.sendToBlender(os);
rs.seek(secStart + head.secSizes[curSec++], athena::Begin);
rs.seek(secStart + head.secSizes[curSec++], athena::SeekOrigin::Begin);
/* Skip unknown section */
rs.seek(head.secSizes[curSec++], athena::Current);
rs.seek(head.secSizes[curSec++], athena::SeekOrigin::Current);
/* Read BABEDEAD Lights as Cycles emissives */
secStart = rs.position();
ReadBabeDeadToBlender_1_2(os, rs);
rs.seek(secStart + head.secSizes[curSec++], athena::Begin);
rs.seek(secStart + head.secSizes[curSec++], athena::SeekOrigin::Begin);
/* Dump VISI entities */
secStart = rs.position();
if (head.secSizes[curSec] && rs.readUint32Big() == 'VISI') {
{
rs.seek(secStart, athena::Begin);
rs.seek(secStart, athena::SeekOrigin::Begin);
auto visiData = rs.readUBytes(head.secSizes[curSec]);
athena::io::FileWriter visiOut(outPath.getWithExtension(_SYS_STR(".visi"), true).getAbsolutePath());
visiOut.writeUBytes(visiData.get(), head.secSizes[curSec]);
rs.seek(secStart + 4, athena::Begin);
rs.seek(secStart + 4, athena::SeekOrigin::Begin);
}
athena::io::YAMLDocWriter visiWriter("VISI");
if (auto __vec = visiWriter.enterSubVector("entities")) {
rs.seek(18, athena::Current);
rs.seek(18, athena::SeekOrigin::Current);
uint32_t entityCount = rs.readUint32Big();
rs.seek(8, athena::Current);
rs.seek(8, athena::SeekOrigin::Current);
for (uint32_t i = 0; i < entityCount; ++i) {
uint32_t entityId = rs.readUint32Big();
visiWriter.writeUint32(nullptr, entityId);
@ -332,14 +332,14 @@ void MREA::Name(const SpecBase& dataSpec, PAKEntryReadStream& rs, PAKRouter<PAKB
MaterialSet matSet;
matSet.read(rs);
matSet.nameTextures(pakRouter, fmt::format(fmt("MREA_{}"), entry.id).c_str(), -1);
rs.seek(secStart + head.secSizes[0], athena::Begin);
rs.seek(secStart + head.secSizes[0], athena::SeekOrigin::Begin);
/* Skip to SCLY */
atUint32 curSec = 1;
secStart = rs.position();
while (curSec != head.sclySecIdx)
secStart += head.secSizes[curSec++];
rs.seek(secStart, athena::Begin);
rs.seek(secStart, athena::SeekOrigin::Begin);
SCLY scly;
scly.read(rs);
scly.nameIDs(pakRouter);
@ -347,7 +347,7 @@ void MREA::Name(const SpecBase& dataSpec, PAKEntryReadStream& rs, PAKRouter<PAKB
/* Skip to PATH */
while (curSec != head.pathSecIdx)
secStart += head.secSizes[curSec++];
rs.seek(secStart, athena::Begin);
rs.seek(secStart, athena::SeekOrigin::Begin);
UniqueID32 pathID(rs);
const nod::Node* node;

View File

@ -13,7 +13,7 @@ void SCLY::Enumerate<BigDNA::Read>(athena::io::IStreamReader& rs) {
rs.enumerate<ScriptLayer>(layers, layerCount, [&i, this](athena::io::IStreamReader& rs, ScriptLayer& layer) {
atUint64 start = rs.position();
layer.read(rs);
rs.seek(start + layerSizes[i++], athena::Begin);
rs.seek(start + layerSizes[i++], athena::SeekOrigin::Begin);
});
}
@ -118,9 +118,10 @@ void SCLY::ScriptLayer::Enumerate<BigDNA::Read>(athena::io::IStreamReader& rs) {
fmt(_SYS_STR("Error while reading object of type 0x{:02X}, did not read the expected amount of "
"data, read 0x{:x}, expected 0x{:x}")),
(atUint32)type, actualLen, len);
rs.seek(start + len, athena::Begin);
} else
rs.seek(start + len, athena::SeekOrigin::Begin);
} else {
Log.report(logvisor::Fatal, fmt(_SYS_STR("Unable to find type 0x{:X} in object database")), (atUint32)type);
}
}
}

View File

@ -86,7 +86,7 @@ void PAKBridge::build() {
std::vector<UniqueID32> mapw;
if (worldMapEnt) {
PAKEntryReadStream rs = worldMapEnt->beginReadStream(m_node);
rs.seek(8, athena::Current);
rs.seek(8, athena::SeekOrigin::Current);
atUint32 areaCount = rs.readUint32Big();
mapw.reserve(areaCount);
for (atUint32 i = 0; i < areaCount; ++i)

View File

@ -80,10 +80,11 @@ MREA::StreamReader::StreamReader(athena::io::IStreamReader& source, atUint32 blk
void MREA::StreamReader::seek(atInt64 diff, athena::SeekOrigin whence) {
atUint64 target = diff;
if (whence == athena::Current)
if (whence == athena::SeekOrigin::Current) {
target = m_pos + diff;
else if (whence == athena::End)
} else if (whence == athena::SeekOrigin::End) {
target = m_totalDecompLen - diff;
}
if (target >= m_totalDecompLen)
Log.report(logvisor::Fatal, fmt("MREA stream seek overrun"));
@ -106,7 +107,7 @@ void MREA::StreamReader::seek(atInt64 diff, athena::SeekOrigin whence) {
/* Seek source if needed */
if (bIdx != m_nextBlk - 1) {
m_source.seek(m_blkBase + cAccum, athena::Begin);
m_source.seek(m_blkBase + cAccum, athena::SeekOrigin::Begin);
m_nextBlk = bIdx;
nextBlock();
}
@ -168,7 +169,7 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
atUint64 decompLen = drs.length();
mreaDecompOut.writeBytes(drs.readBytes(decompLen).get(), decompLen);
mreaDecompOut.close();
drs.seek(0, athena::Begin);
drs.seek(0, athena::SeekOrigin::Begin);
/* Start up blender connection */
hecl::blender::Connection& conn = btok.getBlenderConnection();
@ -181,12 +182,12 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
egmcOffset += head.secSizes[i];
/* Load EGMC if possible so we can assign meshes to scanIds */
drs.seek(egmcOffset, athena::Begin);
drs.seek(egmcOffset, athena::SeekOrigin::Begin);
UniqueID32 egmcId(drs);
DNACommon::EGMC egmc;
pakRouter.lookupAndReadDNA(egmcId, egmc);
drs.seek(0, athena::Begin);
drs.seek(0, athena::SeekOrigin::Begin);
/* Open Py Stream and read sections */
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
@ -224,7 +225,7 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
atUint64 secStart = drs.position();
matSet.read(drs);
matSet.readToBlender(os, pakRouter, entry, 0);
drs.seek(secStart + head.secSizes[0], athena::Begin);
drs.seek(secStart + head.secSizes[0], athena::SeekOrigin::Begin);
std::vector<DNACMDL::VertexAttributes> vertAttribs;
DNACMDL::GetVertexAttributes(matSet, vertAttribs);
@ -234,7 +235,7 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
MeshHeader mHeader;
secStart = drs.position();
mHeader.read(drs);
drs.seek(secStart + head.secSizes[curSec++], athena::Begin);
drs.seek(secStart + head.secSizes[curSec++], athena::SeekOrigin::Begin);
curSec += DNACMDL::ReadGeomSectionsToBlender<PAKRouter<PAKBridge>, MaterialSet, RigPair, DNACMDL::SurfaceHeader_2>(
os, drs, pakRouter, entry, dummy, true, true, vertAttribs, m, head.secCount, 0, &head.secSizes[curSec]);
os.format(fmt(
@ -246,25 +247,26 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
mHeader.visorFlags.disableXray() ? "True" : "False", mHeader.visorFlags.thermalLevelStr());
/* Seek through AROT-relation sections */
drs.seek(head.secSizes[curSec++], athena::Current);
drs.seek(head.secSizes[curSec++], athena::Current);
drs.seek(head.secSizes[curSec++], athena::SeekOrigin::Current);
drs.seek(head.secSizes[curSec++], athena::SeekOrigin::Current);
}
/* Skip AROT */
drs.seek(head.secSizes[curSec++], athena::Current);
drs.seek(head.secSizes[curSec++], athena::SeekOrigin::Current);
/* Skip BVH */
drs.seek(head.secSizes[curSec++], athena::Current);
drs.seek(head.secSizes[curSec++], athena::SeekOrigin::Current);
/* Skip Bitmap */
drs.seek(head.secSizes[curSec++], athena::Current);
drs.seek(head.secSizes[curSec++], athena::SeekOrigin::Current);
/* Skip SCLY (for now) */
for (atUint32 l = 0; l < head.sclyLayerCount; ++l)
drs.seek(head.secSizes[curSec++], athena::Current);
for (atUint32 l = 0; l < head.sclyLayerCount; ++l) {
drs.seek(head.secSizes[curSec++], athena::SeekOrigin::Current);
}
/* Skip SCGN (for now) */
drs.seek(head.secSizes[curSec++], athena::Current);
drs.seek(head.secSizes[curSec++], athena::SeekOrigin::Current);
/* Read collision meshes */
DeafBabe collision;
@ -272,15 +274,15 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
collision.read(drs);
DeafBabe::BlenderInit(os);
collision.sendToBlender(os);
drs.seek(secStart + head.secSizes[curSec++], athena::Begin);
drs.seek(secStart + head.secSizes[curSec++], athena::SeekOrigin::Begin);
/* Skip unknown section */
drs.seek(head.secSizes[curSec++], athena::Current);
drs.seek(head.secSizes[curSec++], athena::SeekOrigin::Current);
/* Read BABEDEAD Lights as Cycles emissives */
secStart = drs.position();
DNAMP1::MREA::ReadBabeDeadToBlender_1_2(os, drs);
drs.seek(secStart + head.secSizes[curSec++], athena::Begin);
drs.seek(secStart + head.secSizes[curSec++], athena::SeekOrigin::Begin);
/* Origins to center of mass */
os << "bpy.context.view_layer.layer_collection.children['Collision'].hide_viewport = False\n"

View File

@ -69,7 +69,7 @@ struct MREA {
Value<atUint32> unk3SecIdx;
Value<atUint32> egmcSecIdx;
Value<atUint32> compressedBlockCount;
Seek<12, athena::Current> align1;
Seek<12, athena::SeekOrigin::Current> align1;
Vector<atUint32, AT_DNA_COUNT(secCount)> secSizes;
};

View File

@ -14,7 +14,7 @@ void CHAR::AnimationInfo::EVNT::SFXEvent::Enumerate<BigDNA::Read>(athena::io::IS
if (extraType == 1)
extraFloat = reader.readFloatBig();
else if (extraType == 2)
reader.seek(35, athena::Current);
reader.seek(35, athena::SeekOrigin::Current);
}
template <>
@ -29,7 +29,7 @@ void CHAR::AnimationInfo::EVNT::SFXEvent::Enumerate<BigDNA::Write>(athena::io::I
if (extraType == 1)
writer.writeFloatBig(extraFloat);
else if (extraType == 2)
writer.seek(35, athena::Current);
writer.seek(35, athena::SeekOrigin::Current);
}
template <>

View File

@ -90,7 +90,7 @@ void PAKBridge::build() {
std::vector<UniqueID64> mapw;
if (worldMapEnt) {
PAKEntryReadStream rs = worldMapEnt->beginReadStream(m_node);
rs.seek(8, athena::Current);
rs.seek(8, athena::SeekOrigin::Current);
atUint32 areaCount = rs.readUint32Big();
mapw.reserve(areaCount);
for (atUint32 i = 0; i < areaCount; ++i)

View File

@ -84,7 +84,7 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
atUint64 decompLen = drs.length();
mreaDecompOut.writeBytes(drs.readBytes(decompLen).get(), decompLen);
mreaDecompOut.close();
drs.seek(0, athena::Begin);
drs.seek(0, athena::SeekOrigin::Begin);
/* Start up blender connection */
hecl::blender::Connection& conn = btok.getBlenderConnection();
@ -118,7 +118,7 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
atUint64 secStart = drs.position();
matSet.read(drs);
matSet.readToBlender(os, pakRouter, entry, 0);
drs.seek(secStart + head.secSizes[0], athena::Begin);
drs.seek(secStart + head.secSizes[0], athena::SeekOrigin::Begin);
std::vector<DNACMDL::VertexAttributes> vertAttribs;
DNACMDL::GetVertexAttributes(matSet, vertAttribs);
@ -131,16 +131,16 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
MeshHeader mHeader;
secStart = drs.position();
mHeader.read(drs);
drs.seek(secStart + head.secSizes[curSec++], athena::Begin);
drs.seek(secStart + head.secSizes[curSec++], athena::SeekOrigin::Begin);
/* Surface count from here */
secStart = drs.position();
surfaceCounts.push_back(drs.readUint32Big());
drs.seek(secStart + head.secSizes[curSec++], athena::Begin);
drs.seek(secStart + head.secSizes[curSec++], athena::SeekOrigin::Begin);
/* Seek through AROT-relation sections */
drs.seek(head.secSizes[curSec++], athena::Current);
drs.seek(head.secSizes[curSec++], athena::Current);
drs.seek(head.secSizes[curSec++], athena::SeekOrigin::Current);
drs.seek(head.secSizes[curSec++], athena::SeekOrigin::Current);
}
/* Skip though WOBJs */
@ -150,13 +150,13 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
/* Skip AROT */
if (secIdxIt->first == FOURCC('ROCT')) {
drs.seek(head.secSizes[curSec++], athena::Current);
drs.seek(head.secSizes[curSec++], athena::SeekOrigin::Current);
++secIdxIt;
}
/* Skip AABB */
if (secIdxIt->first == FOURCC('AABB')) {
drs.seek(head.secSizes[curSec++], athena::Current);
drs.seek(head.secSizes[curSec++], athena::SeekOrigin::Current);
++secIdxIt;
}
@ -173,20 +173,20 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
/* Skip DEPS */
if (secIdxIt->first == FOURCC('DEPS')) {
drs.seek(head.secSizes[curSec++], athena::Current);
drs.seek(head.secSizes[curSec++], athena::SeekOrigin::Current);
++secIdxIt;
}
/* Skip SOBJ (SCLY) */
if (secIdxIt->first == FOURCC('SOBJ')) {
for (atUint32 l = 0; l < head.sclyLayerCount; ++l)
drs.seek(head.secSizes[curSec++], athena::Current);
drs.seek(head.secSizes[curSec++], athena::SeekOrigin::Current);
++secIdxIt;
}
/* Skip SGEN */
if (secIdxIt->first == FOURCC('SGEN')) {
drs.seek(head.secSizes[curSec++], athena::Current);
drs.seek(head.secSizes[curSec++], athena::SeekOrigin::Current);
++secIdxIt;
}
@ -197,7 +197,7 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
collision.read(drs);
DNAMP2::DeafBabe::BlenderInit(os);
collision.sendToBlender(os);
drs.seek(secStart + head.secSizes[curSec++], athena::Begin);
drs.seek(secStart + head.secSizes[curSec++], athena::SeekOrigin::Begin);
++secIdxIt;
}
@ -205,7 +205,7 @@ bool MREA::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl:
if (secIdxIt->first == FOURCC('LITE')) {
secStart = drs.position();
ReadBabeDeadToBlender_3(os, drs);
drs.seek(secStart + head.secSizes[curSec++], athena::Begin);
drs.seek(secStart + head.secSizes[curSec++], athena::SeekOrigin::Begin);
++secIdxIt;
}
@ -231,7 +231,7 @@ bool MREA::ExtractLayerDeps(PAKEntryReadStream& rs, PAKBridge::Level::Area& area
StreamReader drs(rs, head.compressedBlockCount, head.secIndexCount);
for (const std::pair<DNAFourCC, atUint32>& idx : drs.m_secIdxs) {
if (idx.first == FOURCC('DEPS')) {
drs.seek(head.getSecOffset(idx.second), athena::Begin);
drs.seek(head.getSecOffset(idx.second), athena::SeekOrigin::Begin);
DEPS deps;
deps.read(drs);

View File

@ -25,7 +25,7 @@ struct MREA {
Value<atUint32> secCount;
Value<atUint32> compressedBlockCount;
Value<atUint32> secIndexCount;
Seek<20, athena::Current> align1;
Seek<20, athena::SeekOrigin::Current> align1;
Vector<atUint32, AT_DNA_COUNT(secCount)> secSizes;
atUint32 getSecOffset(atUint32 idx) const {

View File

@ -11,11 +11,11 @@ void PAK::Enumerate<BigDNA::Read>(athena::io::IStreamReader& reader) {
if (m_header.version != 2)
Log.report(logvisor::Fatal, fmt("unexpected PAK magic"));
reader.seek(8, athena::Current);
reader.seek(8, athena::SeekOrigin::Current);
atUint32 strgSz = reader.readUint32Big();
reader.seek(4, athena::Current);
reader.seek(4, athena::SeekOrigin::Current);
atUint32 rshdSz = reader.readUint32Big();
reader.seek(44, athena::Current);
reader.seek(44, athena::SeekOrigin::Current);
atUint32 dataOffset = 128 + strgSz + rshdSz;
atUint64 strgBase = reader.position();
@ -26,7 +26,7 @@ void PAK::Enumerate<BigDNA::Read>(athena::io::IStreamReader& reader) {
m_nameEntries.emplace_back();
m_nameEntries.back().read(reader);
}
reader.seek(strgBase + strgSz, athena::Begin);
reader.seek(strgBase + strgSz, athena::SeekOrigin::Begin);
atUint32 count = reader.readUint32Big();
m_entries.clear();
@ -91,12 +91,12 @@ void PAK::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& writer) {
atUint32 dataPad = ((dataSz + 63) & ~63) - dataSz;
dataSz += dataPad;
writer.writeUint32Big(dataSz);
writer.seek(36, athena::Current);
writer.seek(36, athena::SeekOrigin::Current);
writer.writeUint32Big((atUint32)m_nameEntries.size());
for (const NameEntry& entry : m_nameEntries)
entry.write(writer);
writer.seek(strgPad, athena::Current);
writer.seek(strgPad, athena::SeekOrigin::Current);
writer.writeUint32Big((atUint32)m_entries.size());
for (const auto& entry : m_entries) {
@ -104,7 +104,7 @@ void PAK::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& writer) {
copy.offset -= dataOffset;
copy.write(writer);
}
writer.seek(rshdPad, athena::Current);
writer.seek(rshdPad, athena::SeekOrigin::Current);
}
template <>

View File

@ -19,7 +19,7 @@ struct PAK : BigDNA {
Value<atUint32> version;
Value<atUint32> headSz;
Value<atUint8> md5sum[16];
Seek<40, athena::Current> seek;
Seek<40, athena::SeekOrigin::Current> seek;
} m_header;
struct NameEntry : BigDNA {

View File

@ -42,7 +42,7 @@ void STRG::_read(athena::io::IStreamReader& reader) {
for (atUint32 l = 0; l < langCount; ++l) {
std::vector<std::string> strs;
for (atUint32 s = 0; s < strCount; ++s) {
reader.seek(strBase + strOffs[l * strCount + s], athena::Begin);
reader.seek(strBase + strOffs[l * strCount + s], athena::SeekOrigin::Begin);
atUint32 len = reader.readUint32Big();
strs.emplace_back(reader.readString(len));
}

View File

@ -1264,7 +1264,7 @@ struct SpecMP1 : SpecBase {
void writePakFileIndex(athena::io::FileWriter& w, const std::vector<urde::SObjectTag>& tags,
const std::vector<std::tuple<size_t, size_t, bool>>& index, atUint64 resTableOffset) override {
w.seek(resTableOffset, athena::Begin);
w.seek(resTableOffset, athena::SeekOrigin::Begin);
auto it = tags.begin();
for (const auto& item : index) {

View File

@ -129,7 +129,7 @@ bool ProjectManager::openProject(hecl::SystemStringView path) {
}
r.reset();
reader.seek(0, athena::Begin);
reader.seek(0, athena::SeekOrigin::Begin);
if (!r.parse(&reader)) {
return makeProj(true);
}