Example #1
0
        public override int MaxGameID => 15; // Colo/XD

        // Checksums
        protected override void setChecksums()
        {
            switch (Version)
            {
            case GameVersion.DP:
                // 0x0000-0xC0EC @ 0xC0FE
                // 0xc100-0x1E2CC @ 0x1E2DE
                BitConverter.GetBytes(SaveUtil.ccitt16(Data.Skip(0 + GBO).Take(0xC0EC).ToArray())).CopyTo(Data, 0xC0FE + GBO);
                BitConverter.GetBytes(SaveUtil.ccitt16(Data.Skip(0xc100 + SBO).Take(0x121CC).ToArray())).CopyTo(Data, 0x1E2DE + SBO);
                break;

            case GameVersion.Pt:
                // 0x0000-0xCF18 @ 0xCF2A
                // 0xCF2C-0x1F0FC @ 0x1F10E
                BitConverter.GetBytes(SaveUtil.ccitt16(Data.Skip(0 + GBO).Take(0xCF18).ToArray())).CopyTo(Data, 0xCF2A + GBO);
                BitConverter.GetBytes(SaveUtil.ccitt16(Data.Skip(0xCF2C + SBO).Take(0x121D0).ToArray())).CopyTo(Data, 0x1F10E + SBO);
                break;

            case GameVersion.HGSS:
                // 0x0000-0xF618 @ 0xF626
                // 0xF700-0x21A00 @ 0x21A0E
                BitConverter.GetBytes(SaveUtil.ccitt16(Data.Skip(0 + GBO).Take(0xF618).ToArray())).CopyTo(Data, 0xF626 + GBO);
                BitConverter.GetBytes(SaveUtil.ccitt16(Data.Skip(0xF700 + SBO).Take(0x12300).ToArray())).CopyTo(Data, 0x21A0E + SBO);
                break;
            }
        }
Example #2
0
        protected override void setChecksums()
        {
            int[][] c = getCHKOffsets(Version);
            if (c == null)
            {
                return;
            }

            BitConverter.GetBytes(SaveUtil.ccitt16(getData(c[0][0] + GBO, c[0][1] - c[0][0]))).CopyTo(Data, c[0][2] + GBO);
            BitConverter.GetBytes(SaveUtil.ccitt16(getData(c[1][0] + SBO, c[1][1] - c[1][0]))).CopyTo(Data, c[1][2] + SBO);
        }
Example #3
0
 protected override void setChecksums()
 {
     // Check for invalid block lengths
     if (Blocks.Length < 3) // arbitrary...
     {
         Console.WriteLine("Not enough blocks ({0}), aborting setChecksums", Blocks.Length);
         return;
     }
     // Apply checksums
     foreach (BlockInfo b in Blocks)
     {
         byte[] array = Data.Skip(b.Offset).Take(b.Length).ToArray();
         ushort chk   = SaveUtil.ccitt16(array);
         BitConverter.GetBytes(chk).CopyTo(Data, b.ChecksumOffset);
         BitConverter.GetBytes(chk).CopyTo(Data, b.ChecksumMirror);
     }
 }
Example #4
0
 protected override void setChecksums()
 {
     // Check for invalid block lengths
     if (Blocks.Length < 3) // arbitrary...
     {
         Console.WriteLine("Not enough blocks ({0}), aborting setChecksums", Blocks.Length);
         return;
     }
     // Apply checksums
     for (int i = 0; i < Blocks.Length; i++)
     {
         if (Blocks[i].Length + Blocks[i].Offset > Data.Length)
         { Console.WriteLine("Block {0} has invalid offset/length value.", i); return; }
         byte[] array = new byte[Blocks[i].Length];
         Array.Copy(Data, Blocks[i].Offset, array, 0, array.Length);
         BitConverter.GetBytes(SaveUtil.ccitt16(array)).CopyTo(Data, BlockInfoOffset + 6 + i * 8);
     }
 }