MCPcopy Create free account
hub / github.com/clementgallet/libTAS / debugIsMatchingPage

Method debugIsMatchingPage

src/library/checkpoint/SaveStateLoading.cpp:266–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266bool SaveStateLoading::debugIsMatchingPage(char* addr)
267{
268 char current_page[4096];
269
270 if (current_flag == Area::FULL_PAGE) {
271 lseek(pfd, next_pfd_offset - 4096, SEEK_SET);
272 Utils::readAll(pfd, current_page, 4096);
273 }
274 else if (current_flag == Area::COMPRESSED_PAGE) {
275 char compressed[LZ4_COMPRESSBOUND(4096)];
276 if (!validateCompressedLength()) {
277 memset(current_page, 0, 4096);
278 return false;
279 }
280 Utils::readAll(pfd, compressed, compressed_length);
281 int ret = LZ4_decompress_safe(compressed, current_page, compressed_length, 4096);
282 if (ret != 4096) {
283 LOG(LL_ERROR, LCF_CHECKPOINT, "LZ4_decompress_safe failed with return code %d", ret);
284 memset(current_page, 0, 4096);
285 return false;
286 }
287 }
288
289 return 0 == memcmp(addr, current_page, 4096);
290}
291
292}

Callers 2

readAnAreaFunction · 0.80
writeAnAreaFunction · 0.80

Calls 1

LZ4_decompress_safeFunction · 0.85

Tested by

no test coverage detected