Пример #1
0
 public void LoadColosseum()
 {
     this.gameConfigData = new GameConfigData(gameSave, ByteHelper.SubByteArray(8, raw, 112), this);
     this.playerData     = new PlayerData(gameSave, ByteHelper.SubByteArray(120, raw, 2840), this);
     this.pcData         = new PCData(gameSave, ByteHelper.SubByteArray(2960, raw, 29080), this);
     this.daycareData    = new DaycareData(gameSave, ByteHelper.SubByteArray(33136, raw, 0x140), this);
     this.memoData       = new StrategyMemoData(gameSave, ByteHelper.SubByteArray(33456, raw, 6004), this);
     //Mailbox 32040 + 1096 = 33136
     //BattleMode 58344
     //RibbonDescriptions 115804
     this.randomBytes = new byte[20];
     ByteHelper.ReplaceBytes(randomBytes, 0, ByteHelper.SubByteArray(0x1dfd8, raw, 20));
 }
Пример #2
0
        public void LoadXD()
        {
            this.checksum = new uint[4];
            this.substructureSizes = new ushort[16];
            this.substructureOffsets = new uint[16];
            this.flagDataSubSizes = new ushort[5];
            this.unhandledSubstructures = new byte[16][];
            this.randomBytes = new byte[40];

            ushort[] checksum_tmp = new ushort[8];
            for (int i = 0; i < 8; i++)
                checksum_tmp[8 - i - 1] = BigEndian.ToUInt16(raw, 0x10 + i * 2);
            for (int i = 0; i < 4; i++)
                checksum[i] = ((uint)checksum_tmp[i * 2] << 16) | (uint)checksum_tmp[i * 2 + 1];

            ushort[] substructureOffsetsTmp = new ushort[32];
            BigEndian.LoadArray(substructureSizes, raw, 0x20);
            BigEndian.LoadArray(substructureOffsetsTmp, raw, 0x40);
            BigEndian.LoadArray(flagDataSubSizes, raw, 0x80);
            flagDataSubSizes[4] = raw[0x8A];

            //int start = 8 + 0xA0;
            for (int i = 0; i < 16; i++)
                substructureOffsets[i] = (uint)(((uint)substructureOffsetsTmp[2 * i + 1] << 16) | (uint)substructureOffsetsTmp[2 * i]);

            otherCorruptionFlags = substructureSizes[0] != 0x88;
            for (int i = 0; i < 16; i++) {
                //if (i == 1 || i == 2)
                //	unhandledSubstructures[i] = null;
                //else
                    unhandledSubstructures[i] = LoadSubstructure(raw, substructureOffsets[i], substructureSizes[i], SubstructureMaxSizes[i]);
            }

            int id = 0;
            this.gameConfigData = new GameConfigData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            id = 1;
            this.playerData = new PlayerData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            id = 2;
            this.pcData = new PCData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            id = 4;
            this.daycareData = new DaycareData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            id = 5;
            this.memoData = new StrategyMemoData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            id = 7;
            this.shadowData = new ShadowPokemonData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            id = 14;
            this.purifierData = new PurifierData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            { // Flags
                ushort size = 0;
                for (int i = 0; i < 5; i++)
                    size += flagDataSubSizes[i];
                if (size <= SubstructureMaxSizes[8])
                    ByteHelper.ReplaceBytes(unhandledSubstructures[8], size, new byte[SubstructureMaxSizes[8] - size]);
            }
            for (int i = 0; i < 16; i++)
                substructureSizes[i] = SubstructureMaxSizes[i];

            ByteHelper.ReplaceBytes(randomBytes, 0, ByteHelper.SubByteArray(raw.Length - 40, raw, 40));
        }
Пример #3
0
        public void LoadXD()
        {
            this.checksum               = new uint[4];
            this.substructureSizes      = new ushort[16];
            this.substructureOffsets    = new uint[16];
            this.flagDataSubSizes       = new ushort[5];
            this.unhandledSubstructures = new byte[16][];
            this.randomBytes            = new byte[40];


            ushort[] checksum_tmp = new ushort[8];
            for (int i = 0; i < 8; i++)
            {
                checksum_tmp[8 - i - 1] = BigEndian.ToUInt16(raw, 0x10 + i * 2);
            }
            for (int i = 0; i < 4; i++)
            {
                checksum[i] = ((uint)checksum_tmp[i * 2] << 16) | (uint)checksum_tmp[i * 2 + 1];
            }

            ushort[] substructureOffsetsTmp = new ushort[32];
            BigEndian.LoadArray(substructureSizes, raw, 0x20);
            BigEndian.LoadArray(substructureOffsetsTmp, raw, 0x40);
            BigEndian.LoadArray(flagDataSubSizes, raw, 0x80);
            flagDataSubSizes[4] = raw[0x8A];

            //int start = 8 + 0xA0;
            for (int i = 0; i < 16; i++)
            {
                substructureOffsets[i] = (uint)(((uint)substructureOffsetsTmp[2 * i + 1] << 16) | (uint)substructureOffsetsTmp[2 * i]);
            }

            otherCorruptionFlags = substructureSizes[0] != 0x88;
            for (int i = 0; i < 16; i++)
            {
                //if (i == 1 || i == 2)
                //	unhandledSubstructures[i] = null;
                //else
                unhandledSubstructures[i] = LoadSubstructure(raw, substructureOffsets[i], substructureSizes[i], SubstructureMaxSizes[i]);
            }

            int id = 0;

            this.gameConfigData = new GameConfigData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            id = 1;
            this.playerData = new PlayerData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            id                = 2;
            this.pcData       = new PCData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            id                = 4;
            this.daycareData  = new DaycareData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            id                = 5;
            this.memoData     = new StrategyMemoData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            id                = 7;
            this.shadowData   = new ShadowPokemonData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            id                = 14;
            this.purifierData = new PurifierData(gameSave, LoadSubstructure(raw, substructureOffsets[id], substructureSizes[id], SubstructureMaxSizes[id]), this);
            {             // Flags
                ushort size = 0;
                for (int i = 0; i < 5; i++)
                {
                    size += flagDataSubSizes[i];
                }
                if (size <= SubstructureMaxSizes[8])
                {
                    ByteHelper.ReplaceBytes(unhandledSubstructures[8], size, new byte[SubstructureMaxSizes[8] - size]);
                }
            }
            for (int i = 0; i < 16; i++)
            {
                substructureSizes[i] = SubstructureMaxSizes[i];
            }

            ByteHelper.ReplaceBytes(randomBytes, 0, ByteHelper.SubByteArray(raw.Length - 40, raw, 40));
        }
Пример #4
0
 public void LoadColosseum()
 {
     this.gameConfigData = new GameConfigData(gameSave, ByteHelper.SubByteArray(8, raw, 112), this);
     this.playerData = new PlayerData(gameSave, ByteHelper.SubByteArray(120, raw, 2840), this);
     this.pcData = new PCData(gameSave, ByteHelper.SubByteArray(2960, raw, 29080), this);
     this.daycareData = new DaycareData(gameSave, ByteHelper.SubByteArray(33136, raw, 0x140), this);
     this.memoData = new StrategyMemoData(gameSave, ByteHelper.SubByteArray(33456, raw, 6004), this);
     //Mailbox 32040 + 1096 = 33136
     //BattleMode 58344
     //RibbonDescriptions 115804
     this.randomBytes = new byte[20];
     ByteHelper.ReplaceBytes(randomBytes, 0, ByteHelper.SubByteArray(0x1dfd8, raw, 20));
 }