public CodeGenerator(Form1 frm1, byte[] formdata)
        {
            m_parent = frm1;
            tabdata = formdata;
            InitializeComponent();
            this.CenterToParent();
            RTB_Code.Clear();
            TB_Write.Clear();
            SaveGame = m_parent.SaveGame;
            CB_Box.Items.Clear();
            for (int i = 1; i <= 31; i++)
                CB_Box.Items.Add(i.ToString());

            CB_Source.SelectedIndex = 0;
            CB_Slot.SelectedIndex = 0;
            CB_Box.SelectedIndex = 0;
        }
Ejemplo n.º 2
0
        private void openMAIN(byte[] input, string path, string GameType, bool oras, bool ram = false)
        {
            ramsavloaded = ram;
            L_Save.Text = "SAV: " + Path.GetFileName(path);
            SaveGame = new PKX.Structures.SaveGame(GameType);

            // Load CyberGadget
            savindex = 0;
            savefile = new byte[0x100000];
            cyberSAV = input;
            cybergadget = true;
            B_ExportSAV.Enabled = true;
            B_SwitchSAV.Enabled = false;
            Array.Copy(input, 0, savefile, 0x5400, input.Length);

            openSave(oras);
        }
Ejemplo n.º 3
0
        private void open1MB(byte[] input, string path, string GameType, bool oras)
        {
            ramsavloaded = false;
            L_Save.Text = "SAV: " + Path.GetFileName(path);
            SaveGame = new PKX.Structures.SaveGame(GameType);
            savegame_oras = oras;

            savefile = input;
            cybergadget = false;

            // Logic to allow unlocking of Switch SAV
            // Setup SHA
            SHA256 mySHA256 = SHA256.Create();

            // Check both IVFC Hashes
            byte[] zeroarray = new byte[0x200];
            Array.Copy(savefile, 0x2000 + 0 * 0x7F000, zeroarray, 0, 0x20);
            byte[] hashValue1 = mySHA256.ComputeHash(zeroarray);
            Array.Copy(savefile, 0x2000 + 1 * 0x7F000, zeroarray, 0, 0x20);
            byte[] hashValue2 = mySHA256.ComputeHash(zeroarray);

            byte[] realHash1 = new byte[0x20];
            byte[] realHash2 = new byte[0x20];

            Array.Copy(savefile, 0x43C - 0 * 0x130, realHash1, 0, 0x20);
            Array.Copy(savefile, 0x43C - 1 * 0x130, realHash2, 0, 0x20);

            B_SwitchSAV.Enabled = (hashValue1.SequenceEqual(realHash1) && hashValue2.SequenceEqual(realHash2));
            getSAVOffsets(ref oras); // to detect if we are ORAS or not
            Array.Copy(savefile, 0x5400 + 0x7F000 * savindex, cyberSAV, 0, cyberSAV.Length);

            openSave(oras);
        }
Ejemplo n.º 4
0
        private void getSAVOffsets(ref bool oras)
        {
            // Get the save file offsets for the input game
            bool enableInterface = false;
            if (BitConverter.ToUInt32(savefile, 0x6A810 + 0x7F000 * savindex) == 0x42454546)
            {
                enableInterface = true;
                SaveGame = new PKX.Structures.SaveGame("XY");
            }
            else if (BitConverter.ToUInt32(savefile, 0x7B210 + 0x7F000 * savindex) == 0x42454546)
            {
                enableInterface = true;
                SaveGame = new PKX.Structures.SaveGame("ORAS");
                oras = true;
            }
            else
            {
                Util.Error("Unrecognized Save File loaded.");
                SaveGame = new PKX.Structures.SaveGame("Error");
            }

            // Enable Buttons
            GB_SAVtools.Enabled = B_JPEG.Enabled = B_VerifyCHK.Enabled = B_VerifySHA.Enabled = B_SwitchSAV.Enabled
                = enableInterface;
        }
Ejemplo n.º 5
0
        private void openMAIN(byte[] input, string path, string GameType, bool oras, bool ram = false)
        {
            ramsavloaded = ram;
            L_Save.Text = "SAV: " + Path.GetFileName(path);
            SaveGame = new PKX.Structures.SaveGame(GameType);

            // Load CyberGadget
            savefile = input;
            powersave = null;
            B_ExportSAV.Enabled = true;
            savefile = input;

            openSave(oras);
        }
Ejemplo n.º 6
0
        private void open1MB(byte[] input, string path, string GameType, bool oras)
        {
            ramsavloaded = false;
            L_Save.Text = "SAV: " + Path.GetFileName(path);
            SaveGame = new PKX.Structures.SaveGame(GameType);

            powersave = input;
            savefile = input.Skip(0x5400).Take(oras ? 0x76000 : 0x65600).ToArray();

            getSAVOffsets(ref oras); // to detect if we are ORAS or not

            openSave(oras);
        }
Ejemplo n.º 7
0
        private void getSAVOffsets(ref bool oras)
        {
            // Get the save file offsets for the input game
            bool enableInterface = false;
            if (savefile.Length == 0x65600 && BitConverter.ToUInt32(savefile, savefile.Length - 0x1F0) == 0x42454546)
            {
                enableInterface = true;
                SaveGame = new PKX.Structures.SaveGame("XY");
            }
            else if (savefile.Length == 0x76000 && BitConverter.ToUInt32(savefile, savefile.Length - 0x1F0) == 0x42454546)
            {
                enableInterface = true;
                SaveGame = new PKX.Structures.SaveGame("ORAS");
                oras = true;
            }
            else
            {
                Util.Error("Unrecognized Save File loaded.");
                SaveGame = new PKX.Structures.SaveGame("Error");
            }

            // Enable Buttons
            GB_SAVtools.Enabled = B_JPEG.Enabled = B_VerifyCHK.Enabled = enableInterface;
        }