#pragma once // Bundle region and binary bundle manifest, ported from ReSkateStudio's // sdk/frostbite/binary_bundle with the editor's asset database trimmed out. #include "binary_io.h" #include #include #include #include #include namespace dingosdk::frostbite { struct CasIdentifier { bool patch{}; std::uint32_t installChunk{}; std::uint16_t archive{}; auto operator<=>(const CasIdentifier&) const = default; }; struct BundleFileInfo { CasIdentifier location; std::uint32_t offset{}; std::uint32_t size{}; }; // A bundle's region: where every asset payload lives in cas, plus the inline // manifest describing the assets themselves. struct BundleRegion { std::vector files; std::vector inlineManifest; }; enum class AssetKind { ebx, resource, chunk }; struct BundleAsset { AssetKind kind{}; std::string name; Sha1 sha1; Guid guid; std::uint64_t resourceId{}; std::uint32_t resourceType{}; std::vector resourceMeta; std::uint64_t originalSize{}; std::uint32_t logicalOffset{}; std::uint32_t logicalSize{}; }; struct BinaryBundle { std::vector ebx; std::vector resources; std::vector chunks; std::vector chunkMetadata; }; [[nodiscard]] BundleRegion read_bundle_region(std::span data, std::size_t offset = 0); [[nodiscard]] std::vector write_bundle_region(std::span files, std::span inlineManifest = {}); [[nodiscard]] BinaryBundle read_binary_bundle(std::span data); [[nodiscard]] std::vector write_binary_bundle(const BinaryBundle& bundle); } // namespace dingosdk::frostbite