MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / WriteInstalledModManifest

Function WriteInstalledModManifest

engine/Poseidon/Core/ModInstall.cpp:101–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99 g = f;
100 f = e;
101 e = d + temp1;
102 d = c;
103 c = b;
104 b = a;
105 a = temp1 + temp2;
106 }
107 _state[0] += a;
108 _state[1] += b;
109 _state[2] += c;
110 _state[3] += d;
111 _state[4] += e;
112 _state[5] += f;
113 _state[6] += g;
114 _state[7] += h;
115 }
116
117 std::array<uint32_t, 8> _state = {0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
118 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19};
119 std::array<uint8_t, 64> _block{};
120 size_t _blockSize = 0;
121 uint64_t _bitCount = 0;
122};
123} // namespace
124
125bool VerifyModArtifact(const std::string& path, int64_t expectedBytes, const std::string& expectedSha256,
126 std::string* error)
127{
128 const auto fail = [&](const std::string& message)
129 {
130 if (error != nullptr)
131 *error = message;
132 return false;
133 };
134 FILE* file = std::fopen(path.c_str(), "rb");
135 if (file == nullptr)
136 return fail("cannot open downloaded package");
137 Sha256 hash;
138 std::array<uint8_t, 64 * 1024> buffer{};
139 int64_t size = 0;
140 size_t read = 0;
141 while ((read = std::fread(buffer.data(), 1, buffer.size(), file)) > 0)
142 {
143 hash.Update(buffer.data(), read);
144 size += static_cast<int64_t>(read);

Callers 2

MakeModDownloadTaskFunction · 0.85

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected