MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / IsHeaderParentCHD

Function IsHeaderParentCHD

pcsx2/CDVD/ChdFileReader.cpp:210–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210static bool IsHeaderParentCHD(const chd_header& header, const chd_header& parent_header)
211{
212 static const u8 nullmd5[CHD_MD5_BYTES]{};
213 static const u8 nullsha1[CHD_SHA1_BYTES]{};
214
215 // Check MD5 if it isn't empty.
216 if (std::memcmp(nullmd5, header.parentmd5, CHD_MD5_BYTES) != 0 &&
217 std::memcmp(nullmd5, parent_header.md5, CHD_MD5_BYTES) != 0 &&
218 std::memcmp(parent_header.md5, header.parentmd5, CHD_MD5_BYTES) != 0)
219 {
220 return false;
221 }
222
223 // Check SHA1 if it isn't empty.
224 if (std::memcmp(nullsha1, header.parentsha1, CHD_SHA1_BYTES) != 0 &&
225 std::memcmp(nullsha1, parent_header.sha1, CHD_SHA1_BYTES) != 0 &&
226 std::memcmp(parent_header.sha1, header.parentsha1, CHD_SHA1_BYTES) != 0)
227 {
228 return false;
229 }
230
231 return true;
232}
233
234static chd_file* OpenCHD(const std::string& filename, FileSystem::ManagedCFilePtr fp, Error* error, u32 recursion_level)
235{

Callers 1

OpenCHDFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected