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