diff options
| author | Dan Engelbrecht <[email protected]> | 2026-04-13 19:17:09 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-04-13 19:17:09 +0200 |
| commit | 3d59b5d7036c35fe484d052ff32dbdc9d0a75cf7 (patch) | |
| tree | 8d24babc8cd3d097800af0bd960c7ba1d72927d7 /src/zenhorde/hordebundle.cpp | |
| parent | use mimalloc by default (#952) (diff) | |
| download | zen-3d59b5d7036c35fe484d052ff32dbdc9d0a75cf7.tar.xz zen-3d59b5d7036c35fe484d052ff32dbdc9d0a75cf7.zip | |
fix utf characters in source code (#953)
Diffstat (limited to 'src/zenhorde/hordebundle.cpp')
| -rw-r--r-- | src/zenhorde/hordebundle.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/zenhorde/hordebundle.cpp b/src/zenhorde/hordebundle.cpp index af6b97e59..f89a6bc15 100644 --- a/src/zenhorde/hordebundle.cpp +++ b/src/zenhorde/hordebundle.cpp @@ -48,7 +48,7 @@ static constexpr uint8_t BlobType_DirectoryV1[20] = {0x11, 0xEC, 0x14, 0x07, 0x1 static constexpr size_t BlobTypeSize = 20; -// ─── VarInt helpers (UE format) ───────────────────────────────────────────── +// --- VarInt helpers (UE format) --------------------------------------------- static size_t MeasureVarInt(size_t Value) @@ -76,7 +76,7 @@ WriteVarInt(std::vector<uint8_t>& Buffer, size_t Value) Output[0] = static_cast<uint8_t>((0xFF << (9 - static_cast<int>(ByteCount))) | static_cast<uint8_t>(Value)); } -// ─── Binary helpers ───────────────────────────────────────────────────────── +// --- Binary helpers --------------------------------------------------------- static void WriteLE32(std::vector<uint8_t>& Buffer, int32_t Value) @@ -121,7 +121,7 @@ PatchLE32(std::vector<uint8_t>& Buffer, size_t Offset, int32_t Value) memcpy(Buffer.data() + Offset, &Value, 4); } -// ─── Packet builder ───────────────────────────────────────────────────────── +// --- Packet builder --------------------------------------------------------- // Builds a single uncompressed Horde V2 packet. Layout: // [Signature(3) + Version(1) + PacketLength(4)] 8 bytes (header) @@ -229,7 +229,7 @@ struct PacketBuilder { AlignTo4(Data); - // ── Type table: count(int32) + count * BlobTypeSize bytes ── + // -- Type table: count(int32) + count * BlobTypeSize bytes -- const int32_t TypeTableOffset = static_cast<int32_t>(Data.size()); WriteLE32(Data, static_cast<int32_t>(Types.size())); for (const uint8_t* TypeEntry : Types) @@ -237,12 +237,12 @@ struct PacketBuilder WriteBytes(Data, TypeEntry, BlobTypeSize); } - // ── Import table: count(int32) + (count+1) offsets(int32 each) + import data ── + // -- Import table: count(int32) + (count+1) offsets(int32 each) + import data -- const int32_t ImportTableOffset = static_cast<int32_t>(Data.size()); const int32_t ImportCount = static_cast<int32_t>(Imports.size()); WriteLE32(Data, ImportCount); - // Reserve space for (count+1) offset entries — will be patched below + // Reserve space for (count+1) offset entries - will be patched below const size_t ImportOffsetsStart = Data.size(); for (int32_t i = 0; i <= ImportCount; ++i) { @@ -266,7 +266,7 @@ struct PacketBuilder // Sentinel offset (points past the last import's data) PatchLE32(Data, ImportOffsetsStart + static_cast<size_t>(ImportCount) * 4, static_cast<int32_t>(Data.size())); - // ── Export table: count(int32) + (count+1) offsets(int32 each) ── + // -- Export table: count(int32) + (count+1) offsets(int32 each) -- const int32_t ExportTableOffset = static_cast<int32_t>(Data.size()); const int32_t ExportCount = static_cast<int32_t>(ExportOffsets.size()); WriteLE32(Data, ExportCount); @@ -278,7 +278,7 @@ struct PacketBuilder // Sentinel: points to the start of the type table (end of export data region) WriteLE32(Data, TypeTableOffset); - // ── Patch header ── + // -- Patch header -- // PacketLength = total packet size including the 8-byte header const int32_t PacketLength = static_cast<int32_t>(Data.size()); PatchLE32(Data, 4, PacketLength); @@ -290,7 +290,7 @@ struct PacketBuilder } }; -// ─── Encoded packet wrapper ───────────────────────────────────────────────── +// --- Encoded packet wrapper ------------------------------------------------- // Wraps an uncompressed packet with the encoded header: // [Signature(3) + Version(1) + HeaderLength(4)] 8 bytes @@ -327,7 +327,7 @@ EncodePacket(std::vector<uint8_t> UncompressedPacket) return Encoded; } -// ─── Bundle blob name generation ──────────────────────────────────────────── +// --- Bundle blob name generation -------------------------------------------- static std::string GenerateBlobName() @@ -344,7 +344,7 @@ GenerateBlobName() return std::string(Name.ToView()); } -// ─── File info for bundling ───────────────────────────────────────────────── +// --- File info for bundling ------------------------------------------------- struct FileInfo { @@ -357,7 +357,7 @@ struct FileInfo IoHash RootExportHash; // IoHash of the root export for this file }; -// ─── CreateBundle implementation ──────────────────────────────────────────── +// --- CreateBundle implementation -------------------------------------------- bool BundleCreator::CreateBundle(const std::vector<BundleFile>& Files, const std::filesystem::path& OutputDir, BundleResult& OutResult) @@ -534,7 +534,7 @@ BundleCreator::CreateBundle(const std::vector<BundleFile>& Files, const std::fil FileInfo& Info = ValidFiles[i]; DirImports.push_back(Info.DirectoryExportImportIndex); - // IoHash of target (20 bytes) — import is consumed sequentially from the + // IoHash of target (20 bytes) - import is consumed sequentially from the // export's import list by ReadBlobRef, not encoded in the payload WriteBytes(DirPayload, Info.RootExportHash.Hash, sizeof(IoHash)); // name (string) |