// Checksums protected override void SetChecksums() { for (int i = 0; i < BLOCK_COUNT; i++) { int ofs = ABO + (i * SIZE_BLOCK); var index = BlockOrder[i]; if (index == -1) { continue; } int len = chunkLength[index]; ushort chk = Checksums.CheckSum32(Data, ofs, len); BitConverter.GetBytes(chk).CopyTo(Data, ofs + 0xFF6); } if (State.BAK.Length < SaveUtil.SIZE_G3RAW) // don't update HoF for half-sizes { return; } // Hall of Fame Checksums { ushort chk = Checksums.CheckSum32(Data, 0x1C000, SIZE_BLOCK_USED); BitConverter.GetBytes(chk).CopyTo(Data, 0x1CFF4); } { ushort chk = Checksums.CheckSum32(Data, 0x1D000, SIZE_BLOCK_USED); BitConverter.GetBytes(chk).CopyTo(Data, 0x1DFF4); } }
private bool IsChunkValid(int i) { int ofs = ABO + (i * SIZE_BLOCK); int len = chunkLength[BlockOrder[i]]; ushort chk = Checksums.CheckSum32(Data, ofs, len); return(chk == BitConverter.ToUInt16(Data, ofs + 0xFF6)); }
private bool IsChunkValidHoF(int ofs) { ushort chk = Checksums.CheckSum32(Data, ofs, SIZE_BLOCK_USED); return(chk == BitConverter.ToUInt16(Data, ofs + 0xFF4)); }