This repository has been archived by the owner on Jul 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bundlerawwebheader.cpp
65 lines (53 loc) · 1.74 KB
/
bundlerawwebheader.cpp
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
60
61
62
63
64
65
#include "bundlerawwebheader.h"
#include "bundlereader.h"
bool VRCE::BundleFiles::BundleRawWebHeader::HasHash(VRCE::BundleFiles::BundleVersion generation) noexcept
{
return generation >= BundleVersion::BF_520a1;
}
bool VRCE::BundleFiles::BundleRawWebHeader::HasCompleteFileSize(VRCE::BundleFiles::BundleVersion generation) noexcept
{
return generation >= BundleVersion::BF_260_340;
}
bool VRCE::BundleFiles::BundleRawWebHeader::HasUncompressedBlocksInfoSize(VRCE::BundleFiles::BundleVersion generation) noexcept
{
return generation >= BundleVersion::BF_350_4x;
}
VRCE::BundleFiles::BundleRawWebHeader::BundleRawWebHeader()
: m_crc()
, m_minimumStreamedBytes()
, m_headerSize()
, m_numberOfScenesToDownloadBeforeStreaming()
, m_scenes()
, m_completeFileSize()
, m_uncompressedBlocksInfoSize()
, m_hash()
{
}
void VRCE::BundleFiles::BundleRawWebHeader::read(VRCE::BundleFiles::BundleReader& reader, VRCE::BundleFiles::BundleVersion generation)
{
if (HasHash(generation)) {
m_hash.read(reader);
m_crc = reader.read32u();
}
m_minimumStreamedBytes = reader.read32u();
m_headerSize = reader.read32s();
m_numberOfScenesToDownloadBeforeStreaming = reader.read32s();
m_scenes = reader.readObjectVector<BundleScene>();
if (HasCompleteFileSize(generation))
{
m_completeFileSize = reader.read32u();
}
if (HasUncompressedBlocksInfoSize(generation))
{
m_uncompressedBlocksInfoSize = reader.read32s();
}
reader.alignStream();
}
std::int32_t VRCE::BundleFiles::BundleRawWebHeader::headerSize() const
{
return m_headerSize;
}
int32_t VRCE::BundleFiles::BundleRawWebHeader::uncompressedBlocksInfoSize() const
{
return m_uncompressedBlocksInfoSize;
}