示例#1
0
        void bwIconReplace_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                BackgroundWorker bwIconReplace = sender as BackgroundWorker;
                replacedIcon = (string)e.Argument;

                bwIconReplace.ReportProgress(0);

                if (replacedIcon.ToLower().EndsWith(".bin"))
                {
                    bwIconReplace.ReportProgress(0, "Loading icon.bin...");
                    newIconBin.LoadFile(replacedIcon);
                }
                else if (replacedIcon.ToLower().EndsWith(".app"))
                {
                    bwIconReplace.ReportProgress(0, "Loading 00000000.app...");
                    U8 tmpU8 = U8.Load(replacedIcon);

                    bwIconReplace.ReportProgress(50, "Loading icon.bin...");
                    for (int i = 0; i < tmpU8.NumOfNodes; i++)
                    {
                        if (tmpU8.StringTable[i].ToLower() == "icon.bin")
                        {
                            newIconBin.LoadFile(tmpU8.Data[i]); break;
                        }
                    }
                }
                else //wad
                {
                    bwIconReplace.ReportProgress(0, "Loading WAD...");
                    WAD tmpWad = WAD.Load(replacedIcon);

                    if (!tmpWad.HasBanner)
                    {
                        throw new Exception("CustomizeMii only handles Channel WADs!");
                    }

                    bwIconReplace.ReportProgress(60, "Loading icon.bin...");
                    for (int i = 0; i < tmpWad.BannerApp.NumOfNodes; i++)
                    {
                        if (tmpWad.BannerApp.StringTable[i].ToLower() == "icon.bin")
                        {
                            newIconBin.LoadFile(tmpWad.BannerApp.Data[i]); break;
                        }
                    }
                }

                iconTransparents.Clear();

                addTpls();
                addBrlyts();
                addBrlans();
            }
            catch (Exception ex)
            {
                replacedIcon = string.Empty;
                errorBox(ex.Message);
            }
        }
示例#2
0
        void bwSoundReplace_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                BackgroundWorker bwSoundReplace = sender as BackgroundWorker;
                replacedSound = (string)e.Argument;

                bwSoundReplace.ReportProgress(0);

                if (replacedSound.ToLower().EndsWith(".bin"))
                {
                    bwSoundReplace.ReportProgress(0, "Loading sound.bin...");
                    newSoundBin = File.ReadAllBytes(replacedSound);
                }
                else if (replacedSound.ToLower().EndsWith(".app"))
                {
                    bwSoundReplace.ReportProgress(0, "Loading 00000000.app...");
                    U8 tmpU8 = U8.Load(replacedSound);

                    bwSoundReplace.ReportProgress(80, "Loading sound.bin...");
                    for (int i = 0; i < tmpU8.NumOfNodes; i++)
                    {
                        if (tmpU8.StringTable[i].ToLower() == "sound.bin")
                        {
                            newSoundBin = tmpU8.Data[i]; break;
                        }
                    }
                }
                else
                {
                    bwSoundReplace.ReportProgress(0, "Loading WAD...");
                    WAD tmpWad = WAD.Load(replacedSound);

                    if (!tmpWad.HasBanner)
                    {
                        throw new Exception("CustomizeMii only handles Channel WADs!");
                    }

                    bwSoundReplace.ReportProgress(90, "Loading sound.bin...");
                    for (int i = 0; i < tmpWad.BannerApp.NumOfNodes; i++)
                    {
                        if (tmpWad.BannerApp.StringTable[i].ToLower() == "sound.bin")
                        {
                            newSoundBin = tmpWad.BannerApp.Data[i]; break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                replacedSound = string.Empty;
                errorBox(ex.Message);
            }
        }
示例#3
0
        private void tbDol_DragDrop(object sender, DragEventArgs e)
        {
            string[] data = (string[])e.Data.GetData(DataFormats.FileDrop);

            if (data[0].ToLower().EndsWith(".wad"))
            {
                try
                {
                    WAD tmpWad = WAD.Load(data[0]);

                    if (tmpWad.NumOfContents == 3)
                    {
                        int appIndex = 0;
                        if (tmpWad.BootIndex == 1)
                        {
                            appIndex = 2;
                        }
                        else if (tmpWad.BootIndex == 2)
                        {
                            appIndex = 1;
                        }

                        if (appIndex > 0)
                        {
                            newDol = tmpWad.Contents[appIndex];
                            setControlText(tbDol, data[0]);
                            btnBrowseDol.Text = "Clear";
                        }
                        else
                        {
                            errorBox("The DOL file couldn't be found!");
                        }
                    }
                    else
                    {
                        errorBox("The DOL file couldn't be found!");
                    }
                }
                catch (Exception ex)
                {
                    setControlText(tbDol, string.Empty);
                    btnBrowseDol.Text = "Browse...";
                    errorBox(ex.Message);
                }
            }
            else if (data[0].ToLower().EndsWith(".dol"))
            {
                newDol = File.ReadAllBytes(data[0]);
                setControlText(tbDol, data[0]);
                btnBrowseDol.Text = "Clear";
            }
        }
        private void startPatching(object wadPath)
        {
            try
            {
                int patchCount = 0;

                WAD w = WAD.Load((string)wadPath);
                iosPatcher.LoadIOS(ref w);

                if (patches[0] && patches[1] && patches[2])
                {
                    patchCount = iosPatcher.PatchAll();
                }
                else
                {
                    if (patches[0])
                    {
                        patchCount += iosPatcher.PatchFakeSigning();
                    }
                    if (patches[1])
                    {
                        patchCount += iosPatcher.PatchEsIdentify();
                    }
                    if (patches[2])
                    {
                        patchCount += iosPatcher.PatchNandPermissions();
                    }
                }

                if (patchCount > 0)
                {
                    string newPath = Path.GetDirectoryName((string)wadPath) + Path.DirectorySeparatorChar + Path.GetFileNameWithoutExtension((string)wadPath) + "_patched.wad";
                    w.Save(newPath);
                    iosPatcher_Debug(null, new MessageEventArgs("\nPatched WAD was saved to: " + newPath));
                }
                else
                {
                    iosPatcher_Debug(null, new MessageEventArgs("\nNo patches were made!"));
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
        }