This should fix the remaining caching issues

This commit is contained in:
BernardoGiordano 2019-07-08 21:56:51 +02:00
parent 77b5097177
commit a54fcb8834

View file

@ -79,15 +79,19 @@ void calculateTitleDBHash(u8* hash)
AM_GetTitleCount(MEDIATYPE_SD, &titleCount);
if (Configuration::getInstance().nandSaves()) {
AM_GetTitleCount(MEDIATYPE_NAND, &nandCount);
u64 buf[titleCount + nandCount];
AM_GetTitleList(&titlesRead, MEDIATYPE_SD, titleCount, buf);
AM_GetTitleList(&nandTitlesRead, MEDIATYPE_NAND, nandCount, buf + titlesRead * sizeof(u64));
sha256(hash, (u8*)buf, (titleCount + nandCount) * sizeof(u64));
std::vector<u64> ordered;
ordered.reserve(titleCount + nandCount);
AM_GetTitleList(&titlesRead, MEDIATYPE_SD, titleCount, ordered.data());
AM_GetTitleList(&nandTitlesRead, MEDIATYPE_NAND, nandCount, ordered.data() + titlesRead * sizeof(u64));
sort(ordered.begin(), ordered.end());
sha256(hash, (u8*)ordered.data(), (titleCount + nandCount) * sizeof(u64));
}
else {
u64 buf[titleCount];
AM_GetTitleList(&titlesRead, MEDIATYPE_SD, titleCount, buf);
sha256(hash, (u8*)buf, titleCount * sizeof(u64));
std::vector<u64> ordered;
ordered.reserve(titleCount);
AM_GetTitleList(&titlesRead, MEDIATYPE_SD, titleCount, ordered.data());
sort(ordered.begin(), ordered.end());
sha256(hash, (u8*)ordered.data(), titleCount * sizeof(u64));
}
}