#pragma once // Superbundle TOC reader and patch writer, ported from ReSkateStudio's // sdk/frostbite/toc. The writer rebuilds the bundle and chunk perfect hashes, // which is what makes a merged TOC resolvable by the engine. #include "binary_bundle.h" #include #include #include #include #include namespace dingosdk::frostbite { inline constexpr std::size_t tocEnvelopeSize = 0x22C; struct TocBundle { std::string name; std::vector region; std::uint8_t loadFlag{1}; }; struct TocChunk { Guid guid; CasIdentifier location; std::uint32_t offset{}; std::uint32_t size{}; bool removed{}; }; struct TocDocument { std::uint32_t flags{}; std::vector bundles; std::vector chunks; std::vector bundleHashMap; std::vector chunkHashMap; }; [[nodiscard]] std::uint32_t toc_hash(std::span key, std::uint32_t seed = 0x811C9DC5U) noexcept; // Emits a complete patch TOC, envelope included, with uncompressed names. [[nodiscard]] std::vector write_patch_toc(std::span bundles, std::span chunks = {}, std::uint32_t flags = 3); [[nodiscard]] TocDocument read_toc(std::span data, std::span externalBundleData = {}); void verify_toc(const TocDocument& document); } // namespace dingosdk::frostbite