示例#1
0
        private int SearchPokemon(byte[,] pokemon, byte[] inputFile, int column)
        {
            int            found  = 0;
            Hex_Conversion hex    = new Hex_Conversion();
            Array_Manager  arr    = new Array_Manager();
            Offset         offset = new Offset();

            byte[] buffer = new byte[220];
            byte[] convert;
            int    pokeInParty = 0;
            bool   update      = false;

            if (inputFile.Length >= 256)
            {
                for (int i = 0; i < inputFile.Length; i++)
                {
                    if (inputFile[i] == 0x4E && inputFile[i + 1] == 0x19 && inputFile[i + 2] == 0x70 &&
                        inputFile[i + 3] == 0x6F && inputFile[i + 4] == 0x6B && inputFile[i + 5] == 0x65 &&
                        inputFile[i + 6] == 0x70 && inputFile[i + 7] == 0x61 && inputFile[i + 8] == 0x72 &&
                        inputFile[i + 9] == 0x74 && inputFile[i + 10] == 0x79 && inputFile[i + 11] == 0x2E &&
                        inputFile[i + 12] == 0x63)
                    {
                        if (i + 254 <= inputFile.Length)
                        {
                            pokeInParty = hex.ConOneHex(inputFile[i + 30]);
                            i          += 34;
                            for (int m = 0; m < pokeInParty && found < 24; m++)
                            {
                                for (int n = 0; n < 220; n++, i++)
                                {
                                    buffer[n] = inputFile[i];
                                }
                                convert = PK5(buffer);
                                arr.UpdateCheck(pokemon, column, found, convert, ref update, 5);
                                if (update == false)
                                {
                                    arr.Array1Dto2D(pokemon, found, column, convert);
                                    found++;
                                }
                                update = false;
                            }
                        }
                    }
                }
            }
            //Ensures that the game that the Pokemon is from is valid for gen 5.
            if (found != 0)
            {
                for (int i = 0; i < found; i++)
                {
                    if (pokemon[i, 95] == 0x00)
                    {
                        pokemon[i, 95] = 0x15;
                    }
                }
            }

            return(found);
        }
示例#2
0
        private void Rip_Click(object sender, EventArgs e)
        {
            Save1.Enabled  = false;
            Name1.Enabled  = false;
            Save2.Enabled  = false;
            Name2.Enabled  = false;
            Save3.Enabled  = false;
            Name3.Enabled  = false;
            Save4.Enabled  = false;
            Name4.Enabled  = false;
            Save5.Enabled  = false;
            Name5.Enabled  = false;
            Save6.Enabled  = false;
            Name6.Enabled  = false;
            Save7.Enabled  = false;
            Name7.Enabled  = false;
            Save8.Enabled  = false;
            Name8.Enabled  = false;
            Save9.Enabled  = false;
            Name9.Enabled  = false;
            Save10.Enabled = false;
            Name10.Enabled = false;
            Save11.Enabled = false;
            Name11.Enabled = false;
            Save12.Enabled = false;
            Name12.Enabled = false;
            Save13.Enabled = false;
            Name13.Enabled = false;
            Save14.Enabled = false;
            Name14.Enabled = false;
            Save15.Enabled = false;
            Name15.Enabled = false;
            Save16.Enabled = false;
            Name16.Enabled = false;
            Save17.Enabled = false;
            Name17.Enabled = false;
            Save18.Enabled = false;
            Name18.Enabled = false;
            Save19.Enabled = false;
            Name19.Enabled = false;
            Save20.Enabled = false;
            Name20.Enabled = false;
            Save21.Enabled = false;
            Name21.Enabled = false;
            Save22.Enabled = false;
            Name22.Enabled = false;
            Save23.Enabled = false;
            Name23.Enabled = false;
            Save24.Enabled = false;
            Name24.Enabled = false;

            if (fileAdded == true)
            {
                row = 24;
                if (Gen3.Checked == true)
                {
                    column       = 80;
                    pokemon      = new byte[row, column];
                    speciesIndex = 32;
                }
                if (Gen4.Checked == true || Gen5.Checked == true)
                {
                    column       = 136;
                    pokemon      = new byte[row, column];
                    speciesIndex = 8;
                }
                if (Gen6.Checked == true)
                {
                    column       = 232;
                    pokemon      = new byte[row, column];
                    speciesIndex = 8;
                }

                if (Gen3.Checked == true)
                {
                    Gen_3 rip3 = new Gen_3();
                    found = rip3.Start(pokemon, string.Format("{0}", openFileDialog1.FileName), row, column);
                }
                if (Gen4.Checked == true)
                {
                    Gen_4 rip4 = new Gen_4();
                    found = rip4.Start(pokemon, string.Format("{0}", openFileDialog1.FileName), row, column);
                }
                if (Gen5.Checked == true)
                {
                    Gen_5 rip5 = new Gen_5();
                    found = rip5.Start(pokemon, string.Format("{0}", openFileDialog1.FileName), column);
                }
                if (Gen6.Checked == true)
                {
                    Gen_6 rip6 = new Gen_6();
                    found = rip6.Start(pokemon, string.Format("{0}", openFileDialog1.FileName), column);
                }
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("No file added.");
            }

            System.Windows.Forms.MessageBox.Show(found.ToString() + " Pokemon found.");

            if (found != 0)
            {
                Hex_Conversion hex = new Hex_Conversion();
                if (1 <= found)
                {
                    Save1.Enabled = true;
                    Name1.Enabled = true;
                    Name1.Text    = hex.LittleEndian2D(pokemon, 0, speciesIndex, 2).ToString();
                }
                if (2 <= found)
                {
                    Save2.Enabled = true;
                    Name2.Enabled = true;
                    Name2.Text    = hex.LittleEndian2D(pokemon, 1, speciesIndex, 2).ToString();
                }
                if (3 <= found)
                {
                    Save3.Enabled = true;
                    Name3.Enabled = true;
                    Name3.Text    = hex.LittleEndian2D(pokemon, 2, speciesIndex, 2).ToString();
                }
                if (4 <= found)
                {
                    Save4.Enabled = true;
                    Name4.Enabled = true;
                    Name4.Text    = hex.LittleEndian2D(pokemon, 3, speciesIndex, 2).ToString();
                }
                if (5 <= found)
                {
                    Save5.Enabled = true;
                    Name5.Enabled = true;
                    Name5.Text    = hex.LittleEndian2D(pokemon, 4, speciesIndex, 2).ToString();
                }
                if (6 <= found)
                {
                    Save6.Enabled = true;
                    Name6.Enabled = true;
                    Name6.Text    = hex.LittleEndian2D(pokemon, 5, speciesIndex, 2).ToString();
                }
                if (7 <= found)
                {
                    Save7.Enabled = true;
                    Name7.Enabled = true;
                    Name7.Text    = hex.LittleEndian2D(pokemon, 6, speciesIndex, 2).ToString();
                }
                if (8 <= found)
                {
                    Save8.Enabled = true;
                    Name8.Enabled = true;
                    Name8.Text    = hex.LittleEndian2D(pokemon, 7, speciesIndex, 2).ToString();
                }
                if (9 <= found)
                {
                    Save9.Enabled = true;
                    Name9.Enabled = true;
                    Name9.Text    = hex.LittleEndian2D(pokemon, 8, speciesIndex, 2).ToString();
                }
                if (10 <= found)
                {
                    Save10.Enabled = true;
                    Name10.Enabled = true;
                    Name10.Text    = hex.LittleEndian2D(pokemon, 9, speciesIndex, 2).ToString();
                }
                if (11 <= found)
                {
                    Save11.Enabled = true;
                    Name11.Enabled = true;
                    Name11.Text    = hex.LittleEndian2D(pokemon, 10, speciesIndex, 2).ToString();
                }
                if (12 <= found)
                {
                    Save12.Enabled = true;
                    Name12.Enabled = true;
                    Name12.Text    = hex.LittleEndian2D(pokemon, 11, speciesIndex, 2).ToString();
                }
                if (13 <= found)
                {
                    Save13.Enabled = true;
                    Name13.Enabled = true;
                    Name13.Text    = hex.LittleEndian2D(pokemon, 12, speciesIndex, 2).ToString();
                }
                if (14 <= found)
                {
                    Save14.Enabled = true;
                    Name14.Enabled = true;
                    Name14.Text    = hex.LittleEndian2D(pokemon, 13, speciesIndex, 2).ToString();
                }
                if (15 <= found)
                {
                    Save15.Enabled = true;
                    Name15.Enabled = true;
                    Name15.Text    = hex.LittleEndian2D(pokemon, 14, speciesIndex, 2).ToString();
                }
                if (16 <= found)
                {
                    Save16.Enabled = true;
                    Name16.Enabled = true;
                    Name16.Text    = hex.LittleEndian2D(pokemon, 15, speciesIndex, 2).ToString();
                }
                if (17 <= found)
                {
                    Save17.Enabled = true;
                    Name17.Enabled = true;
                    Name17.Text    = hex.LittleEndian2D(pokemon, 16, speciesIndex, 2).ToString();
                }
                if (18 <= found)
                {
                    Save18.Enabled = true;
                    Name18.Enabled = true;
                    Name18.Text    = hex.LittleEndian2D(pokemon, 17, speciesIndex, 2).ToString();
                }
                if (19 <= found)
                {
                    Save19.Enabled = true;
                    Name19.Enabled = true;
                    Name19.Text    = hex.LittleEndian2D(pokemon, 18, speciesIndex, 2).ToString();
                }
                if (20 <= found)
                {
                    Save20.Enabled = true;
                    Name20.Enabled = true;
                    Name20.Text    = hex.LittleEndian2D(pokemon, 19, speciesIndex, 2).ToString();
                }
                if (21 <= found)
                {
                    Save21.Enabled = true;
                    Name21.Enabled = true;
                    Name21.Text    = hex.LittleEndian2D(pokemon, 20, speciesIndex, 2).ToString();
                }
                if (22 <= found)
                {
                    Save22.Enabled = true;
                    Name22.Enabled = true;
                    Name22.Text    = hex.LittleEndian2D(pokemon, 21, speciesIndex, 2).ToString();
                }
                if (23 <= found)
                {
                    Save23.Enabled = true;
                    Name23.Enabled = true;
                    Name23.Text    = hex.LittleEndian2D(pokemon, 22, speciesIndex, 2).ToString();
                }
                if (24 <= found)
                {
                    Save24.Enabled = true;
                    Name24.Enabled = true;
                    Name24.Text    = hex.LittleEndian2D(pokemon, 23, speciesIndex, 2).ToString();
                }
            }
        }
示例#3
0
        private int SearchPokemon(byte[,] pokemon, byte[] inputFile, int row, int column)
        {
            int            found = 0;
            const int      size  = 127;
            Hex_Conversion hex   = new Hex_Conversion();
            Array_Manager  arr   = new Array_Manager();

            if (inputFile.Length >= column)
            {
                for (int i = 0; i < row; i++)
                {
                    for (int j = 0; j < column; j++)
                    {
                        pokemon[i, j] = 0;
                    }
                }

                for (int i = 0; i < (inputFile.Length - size) && found < row; i++)
                {
                    ////Check ball
                    if (hex.ConOneHex(inputFile[i + 127]) < 17 && hex.ConOneHex(inputFile[i + 127]) != 0)
                    {
                        ////Checks level
                        if (hex.ConOneHex(inputFile[i + 52]) < 101)
                        {
                            ////Check OT terminating value
                            if (hex.ConOneHex(inputFile[i + 98]) == 255 && hex.ConOneHex(inputFile[i + 99]) == 255)
                            {
                                ////Check Pokemon name terminating value
                                if (hex.ConOneHex(inputFile[i + 75]) == 255 && hex.ConOneHex(inputFile[i + 74]) == 255)
                                {
                                    ////Item
                                    if (hex.LittleEndian(inputFile, i + 120, 2) < 536)
                                    {
                                        ////Check Species
                                        if (hex.LittleEndian(inputFile, i, 2) < 494 && hex.LittleEndian(inputFile, i, 2) != 0)
                                        {
                                            //Move 1
                                            if (hex.LittleEndian(inputFile, i + 12, 2) < 468 && hex.LittleEndian(inputFile, i + 12, 2) != 0)
                                            {
                                                //Move 2
                                                if (hex.LittleEndian(inputFile, i + 14, 2) < 468)
                                                {
                                                    //Move 3
                                                    if (hex.LittleEndian(inputFile, i + 16, 2) < 468)
                                                    {
                                                        //Move 4
                                                        if (hex.LittleEndian(inputFile, i + 18, 2) < 468)
                                                        {
                                                            //1 != 2 and != 3 and != 4
                                                            if (hex.LittleEndian(inputFile, i + 12, 2) != hex.LittleEndian(inputFile, i + 14, 2) &&
                                                                hex.LittleEndian(inputFile, i + 12, 2) != hex.LittleEndian(inputFile, i + 16, 2) &&
                                                                hex.LittleEndian(inputFile, i + 12, 2) != hex.LittleEndian(inputFile, i + 18, 2))
                                                            {
                                                                //2 != 3 and != 4 OR Moves 2 = 0 and 3 = 0 and 4 = 0
                                                                if ((hex.LittleEndian(inputFile, i + 14, 2) != hex.LittleEndian(inputFile, i + 16, 2) &&
                                                                     hex.LittleEndian(inputFile, i + 14, 2) != hex.LittleEndian(inputFile, i + 18, 2)) == true ||
                                                                    (hex.LittleEndian(inputFile, i + 14, 2) == 0 &&
                                                                     hex.LittleEndian(inputFile, i + 16, 2) == 0 &&
                                                                     hex.LittleEndian(inputFile, i + 18, 2) == 0) == true)
                                                                {
                                                                    //3 != 4
                                                                    if ((hex.LittleEndian(inputFile, i + 16, 2) != hex.LittleEndian(inputFile, i + 18, 2)) == true ||
                                                                        (hex.LittleEndian(inputFile, i + 16, 2) == 0 && hex.LittleEndian(inputFile, i + 18, 2) == 0) == true)
                                                                    {
                                                                        //Make sure move 2 is a move if move 3 is a move
                                                                        if (hex.LittleEndian(inputFile, i + 14, 2) == 0 && hex.LittleEndian(inputFile, i + 16, 2) != 0)
                                                                        {
                                                                            //Test failed
                                                                        }
                                                                        else
                                                                        {
                                                                            //Make sure move 3 is a move if move 4 is a move
                                                                            if (hex.LittleEndian(inputFile, i + 16, 2) == 0 && hex.LittleEndian(inputFile, i + 18, 2) != 0)
                                                                            {
                                                                                //Test Failed
                                                                            }
                                                                            else
                                                                            {
                                                                                //Ensures that current buffs of the Pokemon is not past +6
                                                                                if (hex.ConOneHex(inputFile[i + 24]) < 13 && hex.ConOneHex(inputFile[i + 25]) < 13 &&
                                                                                    hex.ConOneHex(inputFile[i + 26]) < 13 && hex.ConOneHex(inputFile[i + 27]) < 13 &&
                                                                                    hex.ConOneHex(inputFile[i + 28]) < 13 && hex.ConOneHex(inputFile[i + 29]) < 13 &&
                                                                                    hex.ConOneHex(inputFile[i + 30]) < 13 && hex.ConOneHex(inputFile[i + 31]) < 13)
                                                                                {
                                                                                    //Valid Pokemon found and Pokemon is extracted.
                                                                                    arr.AddString(pokemon, found, 0, inputFile, i + 104, 3);   //PID
                                                                                    arr.AddString(pokemon, found, 8, inputFile, i, 2);         //Species
                                                                                    arr.AddString(pokemon, found, 10, inputFile, i + 120, 2);  //Item
                                                                                    arr.AddString(pokemon, found, 12, inputFile, i + 116, 2);  //ID
                                                                                    arr.AddString(pokemon, found, 14, inputFile, i + 118, 2);  //SID
                                                                                    arr.AddString(pokemon, found, 16, inputFile, i + 100, 4);  //EXP
                                                                                    pokemon[found, 20] = inputFile[i + 53];                    //Friendship
                                                                                    pokemon[found, 21] = inputFile[i + 39];                    //Ability
                                                                                    arr.AddString(pokemon, found, 40, inputFile, i + 12, 8);   //Moves
                                                                                    arr.AddString(pokemon, found, 48, inputFile, i + 44, 4);   //PP
                                                                                    arr.AddString(pokemon, found, 52, inputFile, i + 48, 4);   //PP max
                                                                                    arr.AddString(pokemon, found, 56, inputFile, i + 20, 4);   //IVs
                                                                                    arr.AddString(pokemon, found, 72, inputFile, i + 54, 22);  //Pokemon Name
                                                                                    arr.AddString(pokemon, found, 104, inputFile, i + 84, 16); //OT name
                                                                                    arr.AddString(pokemon, found, 123, inputFile, i + 36, 3);  //Met Date
                                                                                    pokemon[found, 131] = inputFile[i + 127];                  //Ball

                                                                                    found++;
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(found);
        }
示例#4
0
        public void UpdateCheck(byte[,] pokemon, int column, int found, byte[] convert, ref bool update, int gen)
        {
            Hex_Conversion hex    = new Hex_Conversion();
            Offset         offset = new Offset();
            int            index  = 0;

            //Offset data
            int PID            = 0;
            int sizePID        = 0;
            int dex            = 0;
            int sizeDex        = 0;
            int item           = 0;
            int sizeItem       = 0;
            int ID             = 0;
            int sizeID         = 0;
            int SID            = 0;
            int sizeSID        = 0;
            int EXP            = 0;
            int sizeEXP        = 0;
            int friendship     = 0;
            int sizeFriendship = 0;
            int ability        = 0;
            int sizeAbility    = 0;
            int HPEV           = 0;
            int sizeHPEV       = 0;
            int attEV          = 0;
            int sizeAttEV      = 0;
            int defEV          = 0;
            int sizeDefEV      = 0;
            int speed          = 0;
            int sizeSpeed      = 0;
            int spAttEV        = 0;
            int sizeSpAttEV    = 0;
            int spDefEV        = 0;
            int sizeSpDefEV    = 0;
            int cool           = 0;
            int sizeCool       = 0;
            int beauty         = 0;
            int sizeBeauty     = 0;
            int cute           = 0;
            int sizeCute       = 0;
            int smart          = 0;
            int sizeSmart      = 0;
            int tough          = 0;
            int sizeTough      = 0;
            int sheen          = 0;
            int sizeSheen      = 0;
            int m1             = 0;
            int sizeM1         = 0;
            int m2             = 0;
            int sizeM2         = 0;
            int m3             = 0;
            int sizeM3         = 0;
            int m4             = 0;
            int sizeM4         = 0;
            int IV             = 0;
            int sizeIV         = 0;
            int nature         = 0;
            int sizeNature     = 0;
            int encryption     = 0;
            int sizeEncryption = 0;

            offset.Offsets3Later(ref PID, ref dex, ref item, ref ID, ref SID, ref EXP, ref friendship,
                                 ref ability, ref HPEV, ref attEV, ref defEV, ref speed, ref spAttEV, ref spDefEV,
                                 ref cool, ref beauty, ref cute, ref smart, ref tough, ref sheen, ref m1, ref m2,
                                 ref m3, ref m4, ref IV, ref nature, ref sizePID, ref sizeDex, ref sizeItem,
                                 ref sizeID, ref sizeSID, ref sizeEXP, ref sizeFriendship, ref sizeAbility,
                                 ref sizeHPEV, ref sizeAttEV, ref sizeDefEV, ref sizeSpeed, ref sizeSpAttEV,
                                 ref sizeSpDefEV, ref sizeCool, ref sizeBeauty, ref sizeCute, ref sizeSmart,
                                 ref sizeTough, ref sizeSheen, ref sizeM1, ref sizeM2, ref sizeM3, ref sizeM4,
                                 ref sizeIV, ref sizeNature, ref encryption, ref sizeEncryption, gen);

            if (found != 0)
            {
                for (int f = 0; f < found && update == false; f++)
                {
                    if (hex.LittleEndian2D(pokemon, f, PID, sizePID) == hex.LittleEndian(convert, PID, sizePID) &&
                        hex.LittleEndian2D(pokemon, f, dex, sizeDex) == hex.LittleEndian(convert, dex, sizeDex) &&
                        hex.LittleEndian2D(pokemon, f, ID, sizeID) == hex.LittleEndian(convert, ID, sizeID) &&
                        hex.LittleEndian2D(pokemon, f, SID, sizeSID) == hex.LittleEndian(convert, SID, sizeSID) &&
                        hex.LittleEndian2D(pokemon, f, item, sizeItem) == hex.LittleEndian(convert, item, sizeItem) &&                         //May cause issue if item is consumed
                        hex.LittleEndian2D(pokemon, f, friendship, sizeFriendship) == hex.LittleEndian(convert, friendship, sizeFriendship) && //May cause issue if Pokemon fraints
                        hex.LittleEndian2D(pokemon, f, ability, sizeAbility) == hex.LittleEndian(convert, ability, sizeAbility) &&
                        hex.LittleEndian2D(pokemon, f, HPEV, sizeHPEV) == hex.LittleEndian(convert, HPEV, sizeHPEV) &&
                        hex.LittleEndian2D(pokemon, f, attEV, sizeAttEV) == hex.LittleEndian(convert, attEV, sizeAttEV) &&
                        hex.LittleEndian2D(pokemon, f, defEV, sizeDefEV) == hex.LittleEndian(convert, defEV, sizeDefEV) &&
                        hex.LittleEndian2D(pokemon, f, spAttEV, sizeSpAttEV) == hex.LittleEndian(convert, spAttEV, sizeSpAttEV) &&
                        hex.LittleEndian2D(pokemon, f, spDefEV, sizeSpDefEV) == hex.LittleEndian(convert, spDefEV, sizeSpDefEV) &&
                        hex.LittleEndian2D(pokemon, f, speed, sizeSpeed) == hex.LittleEndian(convert, speed, sizeSpeed) &&
                        hex.LittleEndian2D(pokemon, f, cool, sizeCool) == hex.LittleEndian(convert, cool, sizeCool) &&
                        hex.LittleEndian2D(pokemon, f, beauty, sizeBeauty) == hex.LittleEndian(convert, beauty, sizeBeauty) &&
                        hex.LittleEndian2D(pokemon, f, cute, sizeCute) == hex.LittleEndian(convert, cute, sizeCute) &&
                        hex.LittleEndian2D(pokemon, f, smart, sizeSmart) == hex.LittleEndian(convert, smart, sizeSmart) &&
                        hex.LittleEndian2D(pokemon, f, tough, sizeTough) == hex.LittleEndian(convert, tough, sizeTough) &&
                        hex.LittleEndian2D(pokemon, f, sheen, sizeSheen) == hex.LittleEndian(convert, sheen, sizeSheen) &&
                        hex.LittleEndian2D(pokemon, f, m1, sizeM1) == hex.LittleEndian(convert, m1, sizeM1) &&
                        hex.LittleEndian2D(pokemon, f, m2, sizeM2) == hex.LittleEndian(convert, m2, sizeM2) &&
                        hex.LittleEndian2D(pokemon, f, m3, sizeM3) == hex.LittleEndian(convert, m3, sizeM3) &&
                        hex.LittleEndian2D(pokemon, f, m4, sizeM4) == hex.LittleEndian(convert, m4, sizeM4) &&
                        hex.LittleEndian2D(pokemon, f, nature, sizeNature) == hex.LittleEndian(convert, nature, sizeNature) &&
                        hex.LittleEndian2D(pokemon, f, encryption, sizeEncryption) == hex.LittleEndian(convert, encryption, sizeEncryption))
                    {
                        update = true;

                        if (hex.LittleEndian2D(pokemon, f, EXP, sizeEXP) < hex.LittleEndian(convert, EXP, sizeEXP))
                        {
                            Array1Dto2D(pokemon, f, column, convert);
                        }
                    }
                }
            }
        }