void EncryptData() { if (isDecrypted) { for (int k = 0; k < DATA_SIZE; k += 4) { uint val = gs.GetUInt(k); val ^= key; gs.StoreUInt(k, val); } key = 0; } }
void Checksum() { uint sum = 0; for (int off = 0; off < data.Length; off += 4) { sum += gs.GetUInt(off); } ushort part1 = (ushort)(sum >> 16); ushort part2 = (ushort)(sum & 0xFFFF); ushort res = (ushort)(part1 + part2); gs.StoreUShort(0x0FF6, res); }
public Section(byte[] sectionData) { gs = new GetSet(sectionData); _sectionData = sectionData; Array.Copy(sectionData, data, DATA_SIZE); _sectionId = gs.GetUShort(0x0FF4); _checksum = gs.GetUShort(0x0FF6); _saveIndex = gs.GetUInt(0x0FFC); }