Beispiel #1
0
        static void PatchCCNT(string[] Args)
        {
            string message = "";

            if (Args.Length > 1)
            {
                for (int i = 1; i < Args.Length; i++)
                {
                    message += Args[i] + " ";
                }
            }
            CommonCompressors.YAZ0   y       = new CommonCompressors.YAZ0();
            NDS.NitroSystem.FND.NARC SzsArch = new NDS.NitroSystem.FND.NARC();
            SzsArch = new NDS.NitroSystem.FND.NARC(y.Decompress(File.ReadAllBytes(@"CreatorClassNameTable.szs")));
            string ConvertedCCN = BymlConverter.GetXml(SzsArch.ToFileSystem().Files[0].Data);
            Dictionary <string, string> ccnt  = LoadCCNT(ConvertedCCN);
            Dictionary <string, string> ccnt2 = LoadCCNT(File.ReadAllText("CCNTpatch.xml", Form1.DefEnc));

            foreach (string k in ccnt2.Keys.ToArray())
            {
                if (!ccnt.ContainsKey(k))
                {
                    ccnt.Add(k, ccnt2[k]);
                }
            }
            FormEditors.FrmCCNTEdit.SaveFile(ref ccnt);
            MessageBox.Show(message + "\r\n\r\nThe4Dimension by Exelix11\r\nEvery File Explorer by Gericom");
        }
Beispiel #2
0
        private void LoadNARC()
        {
            var data     = ROMUtils.ROM.ReadFile(Name);
            var data_dec = NSMBeROM.LZ77_Decompress(data);

            NARC = new NARCFormat(data_dec);
            Fs   = NARC.ToFileSystem();
        }
Beispiel #3
0
        private void FrmBgmMain_Load(object sender, EventArgs e)
        {
            CommonCompressors.YAZ0   y       = new CommonCompressors.YAZ0();
            NDS.NitroSystem.FND.NARC SzsArch = new NDS.NitroSystem.FND.NARC();
            SzsArch = new NDS.NitroSystem.FND.NARC(y.Decompress(File.ReadAllBytes(@"BgmTable.szs")));
            foreach (LibEveryFileExplorer.Files.SimpleFileSystem.SFSFile file in SzsArch.ToFileSystem().Files)
            {
                SzsFiles.Add(file.FileName, file.Data);
            }

            string      ConvertedXml = BymlConverter.GetXml(SzsFiles["StageDefaultBgmList.byml"]);
            XmlDocument xml          = new XmlDocument();

            xml.LoadXml(ConvertedXml);
            XmlNode nodes = xml.SelectSingleNode("/Root/C1/C0");

            foreach (XmlNode no in nodes.ChildNodes)
            {
                int    scenario = 0;
                string name     = "";
                string music    = "";
                foreach (XmlNode n in no.ChildNodes)
                {
                    if (n.Attributes["Name"].Value == "Scenario")
                    {
                        scenario = Int32.Parse(n.Attributes["StringValue"].Value);
                    }
                    else if (n.Attributes["Name"].Value == "StageName")
                    {
                        name = n.Attributes["StringValue"].Value;
                    }
                    else if (n.Attributes["Name"].Value == "BgmLabel")
                    {
                        music = n.Attributes["StringValue"].Value;
                    }
                }
                name = name + "Map" + scenario.ToString() + ".szs";
                Levels.Add(name, music);
                if (!Music.Contains(music))
                {
                    Music.Add(music);
                }
            }

            foreach (string k in LevelsNum.Keys.ToArray())
            {
                listBox1.Items.Add(k + " (" + LevelsNum[k] + ")");
            }
            comboBox1.Items.AddRange(Music.ToArray());
            listBox1.SelectedIndex = 0;
        }
Beispiel #4
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker Sender = (BackgroundWorker)sender;
            int Total, actual;
            var files = Directory.GetFiles(ObjDataPath);

            Total = files.Length;
            for (int i = 0; i < files.Length; i++)
            {
                actual = i;
                Sender.ReportProgress(actual);
                if (files[i].EndsWith(".szs"))
                {
                    CommonCompressors.YAZ0   y = new CommonCompressors.YAZ0();
                    NDS.NitroSystem.FND.NARC f = new NDS.NitroSystem.FND.NARC(y.Decompress(File.ReadAllBytes(files[i])));
                    foreach (SFSFile file in f.ToFileSystem().Files)
                    {
                        if (file.FileName.Contains(".bcmdl"))
                        {
                            try
                            {
                                string Name = Application.StartupPath + @"\models\" + file.FileName.Remove(file.FileName.Length - 6, 6) + ".obj";
                                if (UseEFE)
                                {
                                    ConvertEFE(file.Data, Name);
                                }
                                else
                                {
                                    if (!Path.GetFileNameWithoutExtension(Name).ToLower().StartsWith("demo") && Path.GetFileNameWithoutExtension(Name).ToLower() != "karon")
                                    {
                                        RenderBase.OModelGroup mdl = new Ohana.CGFX().load(new MemoryStream(file.Data));
                                        new Ohana.OBJ().export(mdl, Name, 0);
                                    }
                                    else if (Path.GetFileNameWithoutExtension(Name).ToLower() == "karon")
                                    {
                                        ConvertEFE(file.Data, Name);
                                    }
                                }
                            }
                            catch
                            {
                                Debug.Print(@"\models\" + file.FileName.Remove(file.FileName.Length - 6, 6) + ".obj");
                            }
                        }
                    }
                }
            }
        }
Beispiel #5
0
        private void button4_Click(object sender, EventArgs e)
        {
            OpenFileDialog opn = new OpenFileDialog();

            opn.Title  = "Open a file";
            opn.Filter = "Supported formats (.szs, .byml, .xml)|*.szs; *.byml; *.xml|Every file|*.*";
            if (opn.ShowDialog() == DialogResult.OK)
            {
                if (Path.GetExtension(opn.FileName).ToLower() == ".xml")
                {
                    LoadCCNT2(File.ReadAllText(opn.FileName));
                }
                else if (Path.GetExtension(opn.FileName).ToLower() == ".byml")
                {
                    LoadCCNT2(BymlConverter.GetXml(opn.FileName));
                }
                else if (Path.GetExtension(opn.FileName).ToLower() == ".szs")
                {
                    CommonCompressors.YAZ0   y       = new CommonCompressors.YAZ0();
                    NDS.NitroSystem.FND.NARC SzsArch = new NDS.NitroSystem.FND.NARC();
                    SzsArch = new NDS.NitroSystem.FND.NARC(y.Decompress(File.ReadAllBytes(opn.FileName)));
                    string ConvertedCCN = BymlConverter.GetXml(SzsArch.ToFileSystem().Files[0].Data);
                    LoadCCNT2(ConvertedCCN);
                }
                else
                {
                    MessageBox.Show("Unknown format !");
                    return;
                }
            }
            else
            {
                return;
            }
            foreach (string k in CCNT2.Keys.ToArray())
            {
                if (!CCNT.ContainsKey(k))
                {
                    CCNT.Add(k, CCNT2[k]);
                }
            }
            updateListbox();
            MessageBox.Show("Done");
        }