Beispiel #1
0
 private void L_Game_Click(object sender, EventArgs e)
 {
     if (GB_RomFS.Enabled && RomFS != null && ModifierKeys == Keys.Control)
         if (DialogResult.Yes == Util.Prompt(MessageBoxButtons.YesNo, "Restore Original Files?"))
             restoreGARCs(oras, allGARCs);
 }
Beispiel #2
0
 private void B_MoveTutor_Click(object sender, EventArgs e)
 {
     if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
     if (!oras) { Util.Alert("No Tutors for X/Y."); return; } // Already disabled button...
     if (ExeFS != null) new Tutors().Show();
 }
Beispiel #3
0
        private bool checkIfExeFS(string path)
        {
            string[] files = Directory.GetFiles(path);
            if (files.Length != 3) return false;

            FileInfo fi = new FileInfo(files[0]);
            if (fi.Name.Contains("code"))
            {
                if (fi.Length % 0x200 != 0 && (Util.Prompt(MessageBoxButtons.YesNo, "Detected Compressed code.bin.", "Decompress? File will be replaced.") == DialogResult.Yes))
                    new Thread(() => { threads++; new blz.BLZCoder(new string[] { "-d", files[0] }, pBar1); threads--; Util.Alert("Decompressed!"); }).Start();

                ExeFS = path;
                return true;
            }
            return false;
        }
Beispiel #4
0
 private void B_Mart_Click(object sender, EventArgs e)
 {
     if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
     if (ExeFS != null) new Mart().Show();
 }
Beispiel #5
0
        private void openQuick(string path)
        {
            FileInfo fi = new FileInfo(path);
            if (!Directory.Exists(path)) return;

            if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
            if (fi.Name.Contains("code.bin"))
            {
                if (fi.Length % 0x200 == 0 && (Util.Prompt(MessageBoxButtons.YesNo, "Detected Decompressed code.bin.", "Compress? File will be replaced.") == DialogResult.Yes))
                    new Thread(() => { threads++; new blz.BLZCoder(new string[] { "-en", path }, pBar1); threads--; Util.Alert("Compressed!"); }).Start();
                else if (Util.Prompt(MessageBoxButtons.YesNo, "Detected Compressed code.bin.", "Decompress? File will be replaced.") == DialogResult.Yes)
                    new Thread(() => { threads++; new blz.BLZCoder(new string[] { "-d", path }, pBar1); threads--; Util.Alert("Decompressed!"); }).Start();
                return;
            }
            else
            {
                // Check for ROMFS/EXEFS
                string[] folders = Directory.GetDirectories(path);
                int count = folders.Length;
                if (count != 2 && count != 1) return; // Only want exefs & romfs (can have exheader there too, it's not a folder)
                {
                    // First file should be 'exe'
                    if (new FileInfo(folders[0]).Name.ToLower().Contains("exe") && Directory.Exists(folders[0]))
                        checkIfExeFS(folders[0]);
                    if (new FileInfo(folders[count - 1]).Name.ToLower().Contains("rom") && Directory.Exists(folders[count - 1]))
                        checkIfRomFS(folders[count - 1]);

                    GB_RomFS.Enabled = (RomFS != null);
                    GB_ExeFS.Enabled = (RomFS != null && ExeFS != null);
                    B_MoveTutor.Enabled = oras; // Default false unless loaded
                    if (RomFS != null)
                    { L_Game.Text = (oras) ? "Game Loaded: ORAS" : "Game Loaded: XY"; TB_Path.Text = path; }
                    else if (ExeFS != null)
                    { L_Game.Text = "ExeFS loaded - no RomFS"; TB_Path.Text = path; }
                    else
                    { L_Game.Text = "No Game Loaded"; TB_Path.Text = ""; }

                    if (RomFS != null)
                    {
                        // Trigger Data Loading
                        updateStatus("Data found! Loading persistent data for subforms...", false);
                        changeLanguage(null, null);
                    }

                    // Method finished.
                    System.Media.SystemSounds.Asterisk.Play();
                }
            }
        }