From 81fa77d75f39f5906e065e986e0eb80a3dceedbd Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 23 Aug 2015 22:38:38 -0700 Subject: [PATCH] Break CRO update check & overwrite to separate loops --- pk3DS/3DS/CRO.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pk3DS/3DS/CRO.cs b/pk3DS/3DS/CRO.cs index 2ab8eb1..e271ea1 100644 --- a/pk3DS/3DS/CRO.cs +++ b/pk3DS/3DS/CRO.cs @@ -157,7 +157,7 @@ internal static bool rehashCRR(string PATH_CRR, string PATH_CRO, bool saveCRO = updateTB(TB_Progress, "Hashes sorted, writing hashes to CRR."); - // Store Hashes in CRR + // Loop to check which CROs have to be updated. Do this separate from overwriting so we don't overwrite hashes for other CROs (yet). int updatedCTR = 0; for (int i = 0; i < hashData.Length; i++) { @@ -170,8 +170,11 @@ internal static bool rehashCRR(string PATH_CRR, string PATH_CRO, bool saveCRO = updateTB(TB_Progress, String.Format("{0} hash has been updated.", Path.GetFileName(file))); updatedCTR++; } - Array.Copy(hashData[i], 0, CRR, hashTableOffset + 0x20 * i, 0x20); } + // Store Hashes in CRR + for (int i = 0; i < hashData.Length; i++) + Array.Copy(hashData[i], 0, CRR, hashTableOffset + 0x20 * i, 0x20); + updateTB(TB_Progress, updatedCTR > 0 ? String.Format("{0} hashes have been updated.", updatedCTR)