Ejemplo n.º 1
0
        public TextsWindow()
        {
            InitializeComponent();

            Static2D = new CARCEditor("Static2D.carc");

            for (var i = 0; i < CARCLanguages.Length; i++)
            {
                var main2d = new CARCEditor(FormatLanguageFile("Main2D", "carc", i));
                Main2D.Add(main2d);
                var common = new BMG(main2d.ReadFile("common.bmg"));
                Common.Add(common);

                var mbchild = new BMG(Static2D.ReadFile(FormatLanguageFile("MBChild", "bmg", i)));
                MBChild.Add(mbchild);

                var chksel = new CARCEditor(FormatLanguageFile("CharacterKartSelect", "carc", i));
                CharacterKartSelect.Add(chksel);
                var kartsel = new BMG(chksel.ReadFile("kart_select.bmg"));
                KartSelect.Add(kartsel);

                var wlmenu = new CARCEditor(FormatLanguageFile("WLMenu", "carc", i));
                WLMenu.Add(wlmenu);
                var banner = new BMG(wlmenu.ReadFile("banner.bmg"));
                Banner.Add(banner);

                var menu = new CARCEditor(FormatLanguageFile("Menu", "carc", i));
                Menu.Add(menu);
                var menu_bmg = new BMG(menu.ReadFile("menu.bmg"));
                MenuBMG.Add(menu_bmg);
                var mission = new BMG(menu.ReadFile("mission.bmg"));
                Mission.Add(mission);
                var rule = new BMG(menu.ReadFile("rule.bmg"));
                Rule.Add(rule);
            }

            Load();
        }
Ejemplo n.º 2
0
        private void Save(int Lang)
        {
            string ext = GetCARCExtension(Lang);
            var    rfs = MainWindow.LoadedROM.ToFileSystem();
            int    idx = 0;

            foreach (TextBox elem in CommonTextsList.Items)
            {
                Common.DAT1.Strings[idx] = elem.Text;
                idx++;
            }
            var common  = Common.Save();
            var dmain2d = Main2D.ToFileSystem();
            var fcommon = ROMUtils.GetSFSFile("common.bmg", dmain2d);

            fcommon.Data = common;
            Main2D.FromFileSystem(dmain2d);
            var fmain2d = ROMUtils.GetSFSFile("Main2D" + ext + ".carc", rfs);

            fmain2d.Data = ROM.LZ77_Compress(Main2D.Write());
            idx          = 0;
            foreach (TextBox elem in MBChildTextsList.Items)
            {
                MBChild.DAT1.Strings[idx] = elem.Text;
                idx++;
            }
            var mbchild   = MBChild.Save();
            var dstatic2d = Static2D.ToFileSystem();
            var fmbchild  = ROMUtils.GetSFSFile("MBChild" + ext + ".bmg", dstatic2d);

            fmbchild.Data = mbchild;
            Static2D.FromFileSystem(dstatic2d);
            var fstatic2d = ROMUtils.GetSFSFile("Static2D.carc", rfs);

            fstatic2d.Data = ROM.LZ77_Compress(Static2D.Write());
            idx            = 0;
            foreach (TextBox elem in KartSelectTextsList.Items)
            {
                KartSelect.DAT1.Strings[idx] = elem.Text;
                idx++;
            }
            var ksel    = KartSelect.Save();
            var dchksel = CharacterKartSelect.ToFileSystem();
            var fksel   = ROMUtils.GetSFSFile("kart_select.bmg", dchksel);

            fksel.Data = ksel;
            CharacterKartSelect.FromFileSystem(dchksel);
            var fchksel = ROMUtils.GetSFSFile("CharacterKartSelect" + ext + ".carc", rfs);

            fchksel.Data = ROM.LZ77_Compress(CharacterKartSelect.Write());


            idx = 0;
            foreach (TextBox elem in DlPlayTextsList.Items)
            {
                Banner.DAT1.Strings[idx] = elem.Text;
                idx++;
            }
            var banner  = Banner.Save();
            var dwlmenu = WLMenu.ToFileSystem();
            var fbanner = ROMUtils.GetSFSFile("banner.bmg", dwlmenu);

            fbanner.Data = banner;
            WLMenu.FromFileSystem(dwlmenu);
            var fwlmenu = ROMUtils.GetSFSFile("WLMenu" + ext + ".carc", rfs);

            fwlmenu.Data = ROM.LZ77_Compress(WLMenu.Write());

            MainWindow.LoadedROM.FromFileSystem(rfs);
        }