blob: 4cec80fdb142e62ae3c2101f61ca4091818106b1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include <zencore/iobuffer.h>
#include <zencore/iohash.h>
#include <zencore/zencore.h>
#include <functional>
#include <vector>
namespace zen {
class BasicFile;
struct ChunkedInfo
{
uint64_t RawSize = 0;
IoHash RawHash;
std::vector<uint32_t> ChunkSequence;
std::vector<IoHash> ChunkHashes;
};
struct ChunkSource
{
uint64_t Offset; // 8
uint32_t Size; // 4
};
struct ChunkedInfoWithSource
{
ChunkedInfo Info;
std::vector<ChunkSource> ChunkSources;
};
struct ChunkedParams
{
bool UseThreshold = true;
size_t MinSize = (2u * 1024u) - 128u;
size_t MaxSize = (16u * 1024u);
size_t AvgSize = (3u * 1024u);
};
static const ChunkedParams UShaderByteCodeParams = {.UseThreshold = true, .MinSize = 17280, .MaxSize = 139264, .AvgSize = 36340};
ChunkedInfoWithSource ChunkData(BasicFile& RawData,
uint64_t Offset,
uint64_t Size,
ChunkedParams Params = {},
std::atomic<uint64_t>* BytesProcessed = nullptr,
std::atomic<bool>* AbortFlag = nullptr);
void Reconstruct(const ChunkedInfo& Info,
const std::filesystem::path& TargetPath,
std::function<IoBuffer(const IoHash& ChunkHash)> GetChunk);
IoBuffer SerializeChunkedInfo(const ChunkedInfo& Info);
ChunkedInfo DeserializeChunkedInfo(IoBuffer& Buffer);
void chunkedfile_forcelink();
} // namespace zen
|