diff --git a/DataSpec/DNACommon/CMDL.cpp b/DataSpec/DNACommon/CMDL.cpp index 91e14b0b9..e40a8fcad 100644 --- a/DataSpec/DNACommon/CMDL.cpp +++ b/DataSpec/DNACommon/CMDL.cpp @@ -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(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(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(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 */ diff --git a/DataSpec/DNACommon/PAK.hpp b/DataSpec/DNACommon/PAK.hpp index f4ef94012..0e4bcd4b0 100644 --- a/DataSpec/DNACommon/PAK.hpp +++ b/DataSpec/DNACommon/PAK.hpp @@ -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; } diff --git a/DataSpec/DNAMP1/DNAMP1.cpp b/DataSpec/DNAMP1/DNAMP1.cpp index 017b0365d..56052df42 100644 --- a/DataSpec/DNAMP1/DNAMP1.cpp +++ b/DataSpec/DNAMP1/DNAMP1.cpp @@ -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) diff --git a/DataSpec/DNAMP1/MREA.cpp b/DataSpec/DNAMP1/MREA.cpp index 794a7b394..8c60f3644 100644 --- a/DataSpec/DNAMP1/MREA.cpp +++ b/DataSpec/DNAMP1/MREA.cpp @@ -46,7 +46,7 @@ void MREA::AddCMDLRigPairs(PAKEntryReadStream& rs, PAKRouter& 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 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, 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(athena::io::IStreamReader& rs) { rs.enumerate(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(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); + } } } diff --git a/DataSpec/DNAMP2/DNAMP2.cpp b/DataSpec/DNAMP2/DNAMP2.cpp index 9c4c50a17..e6582febe 100644 --- a/DataSpec/DNAMP2/DNAMP2.cpp +++ b/DataSpec/DNAMP2/DNAMP2.cpp @@ -86,7 +86,7 @@ void PAKBridge::build() { std::vector 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) diff --git a/DataSpec/DNAMP2/MREA.cpp b/DataSpec/DNAMP2/MREA.cpp index 84bdef52f..6b5f94ddd 100644 --- a/DataSpec/DNAMP2/MREA.cpp +++ b/DataSpec/DNAMP2/MREA.cpp @@ -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 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, 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" diff --git a/DataSpec/DNAMP2/MREA.hpp b/DataSpec/DNAMP2/MREA.hpp index d11a416ca..5e678d5b7 100644 --- a/DataSpec/DNAMP2/MREA.hpp +++ b/DataSpec/DNAMP2/MREA.hpp @@ -69,7 +69,7 @@ struct MREA { Value unk3SecIdx; Value egmcSecIdx; Value compressedBlockCount; - Seek<12, athena::Current> align1; + Seek<12, athena::SeekOrigin::Current> align1; Vector secSizes; }; diff --git a/DataSpec/DNAMP3/CHAR.cpp b/DataSpec/DNAMP3/CHAR.cpp index 10bc8eee8..c1e18b0c0 100644 --- a/DataSpec/DNAMP3/CHAR.cpp +++ b/DataSpec/DNAMP3/CHAR.cpp @@ -14,7 +14,7 @@ void CHAR::AnimationInfo::EVNT::SFXEvent::Enumerate(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(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 <> diff --git a/DataSpec/DNAMP3/DNAMP3.cpp b/DataSpec/DNAMP3/DNAMP3.cpp index 45acd0d9f..512a58047 100644 --- a/DataSpec/DNAMP3/DNAMP3.cpp +++ b/DataSpec/DNAMP3/DNAMP3.cpp @@ -90,7 +90,7 @@ void PAKBridge::build() { std::vector 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) diff --git a/DataSpec/DNAMP3/MREA.cpp b/DataSpec/DNAMP3/MREA.cpp index f85ff6e64..53e97c576 100644 --- a/DataSpec/DNAMP3/MREA.cpp +++ b/DataSpec/DNAMP3/MREA.cpp @@ -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 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& 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); diff --git a/DataSpec/DNAMP3/MREA.hpp b/DataSpec/DNAMP3/MREA.hpp index 170a3c42e..35d234d54 100644 --- a/DataSpec/DNAMP3/MREA.hpp +++ b/DataSpec/DNAMP3/MREA.hpp @@ -25,7 +25,7 @@ struct MREA { Value secCount; Value compressedBlockCount; Value secIndexCount; - Seek<20, athena::Current> align1; + Seek<20, athena::SeekOrigin::Current> align1; Vector secSizes; atUint32 getSecOffset(atUint32 idx) const { diff --git a/DataSpec/DNAMP3/PAK.cpp b/DataSpec/DNAMP3/PAK.cpp index 1ce15ad2a..20b5e56ec 100644 --- a/DataSpec/DNAMP3/PAK.cpp +++ b/DataSpec/DNAMP3/PAK.cpp @@ -11,11 +11,11 @@ void PAK::Enumerate(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(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(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(athena::io::IStreamWriter& writer) { copy.offset -= dataOffset; copy.write(writer); } - writer.seek(rshdPad, athena::Current); + writer.seek(rshdPad, athena::SeekOrigin::Current); } template <> diff --git a/DataSpec/DNAMP3/PAK.hpp b/DataSpec/DNAMP3/PAK.hpp index 898b7031a..e705b7694 100644 --- a/DataSpec/DNAMP3/PAK.hpp +++ b/DataSpec/DNAMP3/PAK.hpp @@ -19,7 +19,7 @@ struct PAK : BigDNA { Value version; Value headSz; Value md5sum[16]; - Seek<40, athena::Current> seek; + Seek<40, athena::SeekOrigin::Current> seek; } m_header; struct NameEntry : BigDNA { diff --git a/DataSpec/DNAMP3/STRG.cpp b/DataSpec/DNAMP3/STRG.cpp index 06b8cdf89..6420f8890 100644 --- a/DataSpec/DNAMP3/STRG.cpp +++ b/DataSpec/DNAMP3/STRG.cpp @@ -42,7 +42,7 @@ void STRG::_read(athena::io::IStreamReader& reader) { for (atUint32 l = 0; l < langCount; ++l) { std::vector 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)); } diff --git a/DataSpec/SpecMP1.cpp b/DataSpec/SpecMP1.cpp index 05c577335..ffa7a4b9e 100644 --- a/DataSpec/SpecMP1.cpp +++ b/DataSpec/SpecMP1.cpp @@ -1264,7 +1264,7 @@ struct SpecMP1 : SpecBase { void writePakFileIndex(athena::io::FileWriter& w, const std::vector& tags, const std::vector>& index, atUint64 resTableOffset) override { - w.seek(resTableOffset, athena::Begin); + w.seek(resTableOffset, athena::SeekOrigin::Begin); auto it = tags.begin(); for (const auto& item : index) { diff --git a/Editor/ProjectManager.cpp b/Editor/ProjectManager.cpp index cd04bcfb7..a32454488 100644 --- a/Editor/ProjectManager.cpp +++ b/Editor/ProjectManager.cpp @@ -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); }