Exemple #1
0
        public UInt32 get_berry_checksum()
        {
            byte[] chk = getData(0, SIZE_ECB - 4);
            int    i;

            for (i = 0; i < 8; i++) //These 8 bytes are taken as 0x00 for chk calculation
            {
                chk[0xC + i] = 0x00;
            }
            return(ME3.me3_checksum(chk, chk.Length));
        }
Exemple #2
0
        public void fix_berry_checksum()
        {
            byte[] chk = getData(0, SIZE_ECB - 4);
            int    i;

            for (i = 0; i < 8; i++) //These 8 bytes are taken as 0x00 for chk calculation
            {
                chk[0xC + i] = 0x00;
            }
            UInt32 checksum = ME3.me3_checksum(chk, chk.Length);

            setData(BitConverter.GetBytes(checksum).ToArray(), SIZE_ECB - 4);
        }
Exemple #3
0
 void Inject_me3_butClick(object sender, EventArgs e)
 {
     if (sav3file.has_mystery_event == true || sav3file.game == 1)
     {
         if (sav3file.game == 1)
         {
             MessageBox.Show("Mystery Event was removed from non Japanese Emerald.\n\tYou can still inject the data at your own risk.");
         }
         string path     = null;
         int    filesize = FileIO.load_file(ref me3file, ref path, me3filter);
         if (filesize == sav3file.me3_size)
         {
             ME3 me3_struct = new ME3(me3file, filesize);
             if (sav3file.game != me3_struct.isemerald)
             {
                 MessageBox.Show("This ME3 file is not for this game!");
             }
             else
             {
                 sav3file.set_ME3(me3file);
                 //custom_script.Checked = true;
                 //Add fix sav3 checksum func3
                 sav3file.update_section_chk(4);
                 MessageBox.Show("Mystery event injected.");
                 FileIO.save_data(sav3file.Data, savfilter);
             }
         }
         else if (filesize == -1)
         {
             ;
         }
         else
         {
             MessageBox.Show("Invalid file size.");
         }
     }
     else
     {
         MessageBox.Show("Save file does not have Mystery Event enabled.");
     }
 }
Exemple #4
0
        void Load_me3(string path)
        {
            int filesize = FileIO.load_file(ref me3buffer, ref path, me3filter);

            if (filesize == SAV3.ME3_SIZE_E || filesize == SAV3.ME3_SIZE_RS)
            {
                radio_RS.Checked = false;
                radio_E.Checked  = false;

                me3_path.Text = path;
                me3file       = new ME3(me3buffer, filesize);

                switch (me3file.isemerald)
                {
                case 0:
                    radio_RS.Checked = true;
                    break;

                case 1:
                    radio_E.Checked = true;
                    break;
                }

                get_me3data();

                save_me3_but.Enabled      = true;
                removescript_but.Enabled  = true;
                export_script_but.Enabled = true;
                import_script_but.Enabled = true;
                custom_script.Checked     = false;
                script_check.Checked      = true;
            }
            else
            {
                MessageBox.Show("Invalid file size.");
            }
        }