Exemple #1
0
        private void btnCompile_Click(object sender, EventArgs e)
        {
            if (!Patcher.PatchMaker.PatchToSupportBigASMHacks())
            {
                return;
            }

            //code and patcher borrowed from NSMBe and edited.
            System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(txtFolder.Text);
            Patcher.PatchMaker      pm  = new Patcher.PatchMaker(dir,
                                                                 chkDynamic.Checked ? 0x02400000 :
                                                                 uint.Parse(txtOffset.Text, System.Globalization.NumberStyles.HexNumber));

            if (chkDynamic.Checked)
            {
                pm.makeDynamicLibrary(txtFolder.Text + "/" + txtOutput.Text);
            }
            else
            {
                pm.compilePatch();
                pm.generatePatch(txtFolder.Text + "/" + txtOutput.Text);
            }
        }
Exemple #2
0
        private void btnCompile_Click(object sender, EventArgs e)
        {
            if (!Patcher.PatchMaker.PatchToSupportBigASMHacks())
            {
                return;
            }

            //code and patcher borrowed from NSMBe and edited.
            System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(txtFolder.Text);
            uint addr = 0x02400000;

            if (btnOverlay.Checked)
            {
                addr = new NitroOverlay(Program.m_ROM, uint.Parse(txtOverlayId.Text)).GetRAMAddr();
            }
            else if (btnInjection.Checked)
            {
            }
            else if (!btnDynamicLibrary.Checked)
            {
                addr = uint.Parse(txtOffset.Text, System.Globalization.NumberStyles.HexNumber);
            }
            Patcher.PatchMaker pm = new Patcher.PatchMaker(dir, addr);

            byte[] ret = null;
            if (btnDynamicLibrary.Checked)
            {
                ret = pm.makeDynamicLibrary();
            }
            else if (btnOverlay.Checked)
            {
                pm.compilePatch();
                pm.makeOverlay(uint.Parse(txtOverlayId.Text));
                return;
            }
            else if (btnInjection.Checked)
            {
                //TODO.
            }
            else
            {
                pm.compilePatch();
                ret = pm.generatePatch();
            }
            if (ret == null)
            {
                return;
            }
            bool isOut = btnExternal.Checked;

            if (isOut)
            {
                string file = txtOutput.Text;
                if (txtOutput.Text == "")
                {
                    return;
                }
                System.IO.File.WriteAllBytes(file, ret);
            }
            else
            {
                if (txtInput.Text != "")
                {
                    var file = Program.m_ROM.GetFileFromName(txtInput.Text);
                    file.m_Data = ret;
                    file.SaveChanges();
                }
            }
        }