mirror of
https://github.com/d0k3/GodMode9.git
synced 2025-06-26 13:42:47 +00:00
parent
24f93a24c4
commit
636e8ea348
@ -703,14 +703,16 @@ u32 Sha256Calculator(const char* path) {
|
||||
|
||||
snprintf(sha_path, 256, "%s.sha", path);
|
||||
bool have_sha = (FileGetData(sha_path, sha256_file, 32, 0) == 32);
|
||||
bool write_sha = !have_sha && (drvtype & DRV_SDCARD); // writing only on SD
|
||||
bool match_sha = have_sha && (memcmp(sha256, sha256_file, 32) == 0);
|
||||
bool match_prev = (memcmp(sha256, sha256_prev, 32) == 0);
|
||||
bool write_sha = (!have_sha || (have_sha && !match_sha)) && (drvtype & DRV_SDCARD); // writing only on SD
|
||||
if (ShowPrompt(write_sha, "%s\n%016llX%016llX\n%016llX%016llX%s%s%s%s%s",
|
||||
pathstr, getbe64(sha256 + 0), getbe64(sha256 + 8), getbe64(sha256 + 16), getbe64(sha256 + 24),
|
||||
(have_sha) ? "\nSHA verification: " : "",
|
||||
(have_sha) ? ((memcmp(sha256, sha256_file, 32) == 0) ? "passed!" : "failed!") : "",
|
||||
(memcmp(sha256, sha256_prev, 32) == 0) ? "\n \nIdentical with previous file:\n" : "",
|
||||
(memcmp(sha256, sha256_prev, 32) == 0) ? pathstr_prev : "",
|
||||
(write_sha) ? "\n \nWrite .SHA file?" : "") && !have_sha && write_sha) {
|
||||
(have_sha) ? ((match_sha) ? "passed!" : "failed!") : "",
|
||||
(match_prev) ? "\n \nIdentical with previous file:\n" : "",
|
||||
(match_prev) ? pathstr_prev : "",
|
||||
(write_sha) ? "\n \nWrite .SHA file?" : "") && write_sha) {
|
||||
FileSetData(sha_path, sha256, 32, 0, true);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user