Пример #1
0
        public static void LoadFromList(this BMG bmg, ListView list)
        {
            var i = 0;

            foreach (TextBox box in list.Items)
            {
                bmg.DAT1.Strings[i] = box.Text;
                i++;
            }
        }
Пример #2
0
        private void Open()
        {
            OpenFileDialog m_openFile = new OpenFileDialog();

            m_openFile.FileName   = "bmgres";
            m_openFile.DefaultExt = ".arc";
            m_openFile.Filter     = "arc files (*.arc)|*.arc";

            if (m_openFile.ShowDialog() == true)
            {
                VirtualFilesystemDirectory sourceDir = WArchiveTools.ArchiveUtilities.LoadArchive(m_openFile.FileName);

                foreach (VirtualFilesystemNode node in sourceDir.Children)
                {
                    EndianBinaryReader reader;

                    if (node.Type == NodeType.File)
                    {
                        VirtualFilesystemFile file = node as VirtualFilesystemFile;

                        if (file.Extension == ".bmg")
                        {
                            if (IsDataLoaded)
                            {
                                CloseCurrentFile();
                            }

                            reader = new EndianBinaryReader(file.Data, Endian.Big);

                            LoadedTextFile = new BMG(reader);

                            m_listboxSelectedIndex = 0;
                            m_loadedFileName       = m_openFile.FileName;
                            WindowTitle            = m_loadedFileName;

                            ColViewSource        = new CollectionViewSource();
                            ColViewSource.Source = LoadedTextFile.MessageList;
                            SelectedMessage      = LoadedTextFile.MessageList[0];
                            IsDataLoaded         = true;

                            m_loadedDirRoot = sourceDir;
                        }

                        else if (file.Extension == ".bmc")
                        {
                            VirtualFilesystemFile bmcFile = node as VirtualFilesystemFile;

                            reader = new EndianBinaryReader(bmcFile.Data, Endian.Big);

                            LoadedColorFile = new BMC(reader);
                        }
                    }
                }
            }
        }
Пример #3
0
 private void LoadBMGOnList(ref ListView list, BMG bmg)
 {
     list.Items.Clear();
     foreach (var str in bmg.DAT1.Strings)
     {
         list.Items.Add(new TextBox
         {
             TextWrapping  = TextWrapping.Wrap,
             AcceptsReturn = true,
             Text          = str,
         });
     }
 }
Пример #4
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();
        }
Пример #5
0
        public void Load()
        {
            if (ComboIndex < 0)
            {
                LanguageCombo.SelectedIndex = 0;
            }
            var    rfs      = MainWindow.LoadedROM.ToFileSystem();
            string ext      = GetCARCExtension(LanguageCombo.SelectedIndex);
            var    cbmain2d = ROMUtils.GetFile("Main2D" + ext + ".carc", rfs);
            var    bmain2d  = ROM.LZ77_Decompress(cbmain2d);

            Main2D = new NARC(bmain2d);
            var dmain2d = Main2D.ToFileSystem();
            var common  = ROMUtils.GetFile("common.bmg", dmain2d);

            Common = new BMG(common);
            var cbstatic2d = ROMUtils.GetFile("Static2D.carc", rfs);
            var bstatic2d  = ROM.LZ77_Decompress(cbstatic2d);

            Static2D = new NARC(bstatic2d);
            var dstatic2d = Static2D.ToFileSystem();
            var mbchild   = ROMUtils.GetFile("MBChild" + ext + ".bmg", dstatic2d);

            MBChild = new BMG(mbchild);
            var cbchksel = ROMUtils.GetFile("CharacterKartSelect" + ext + ".carc", rfs);
            var bchksel  = ROM.LZ77_Decompress(cbchksel);

            CharacterKartSelect = new NARC(bchksel);
            var dchksel = CharacterKartSelect.ToFileSystem();
            var ksel    = ROMUtils.GetFile("kart_select.bmg", dchksel);

            KartSelect = new BMG(ksel);
            var cbwlmenu = ROMUtils.GetFile("WLMenu" + ext + ".carc", rfs);
            var bwlmenu  = ROM.LZ77_Decompress(cbwlmenu);

            WLMenu = new NARC(bwlmenu);
            var dwlmenu = WLMenu.ToFileSystem();
            var banner  = ROMUtils.GetFile("banner.bmg", dwlmenu);

            Banner = new BMG(banner);
            CommonTextsList.Items.Clear();
            MBChildTextsList.Items.Clear();
            KartSelectTextsList.Items.Clear();
            DlPlayTextsList.Items.Clear();
            foreach (var str in Common.DAT1.Strings)
            {
                CommonTextsList.Items.Add(new TextBox()
                {
                    TextWrapping  = TextWrapping.Wrap,
                    AcceptsReturn = true,
                    Text          = str,
                });
            }
            foreach (var str in MBChild.DAT1.Strings)
            {
                MBChildTextsList.Items.Add(new TextBox()
                {
                    TextWrapping  = TextWrapping.Wrap,
                    AcceptsReturn = true,
                    Text          = str,
                });
            }
            foreach (var str in KartSelect.DAT1.Strings)
            {
                KartSelectTextsList.Items.Add(new TextBox()
                {
                    TextWrapping  = TextWrapping.Wrap,
                    AcceptsReturn = true,
                    Text          = str,
                });
            }
            foreach (var str in Banner.DAT1.Strings)
            {
                DlPlayTextsList.Items.Add(new TextBox()
                {
                    TextWrapping  = TextWrapping.Wrap,
                    AcceptsReturn = true,
                    Text          = str,
                });
            }
        }
 public BMGViewer(BMG Strings)
 {
     this.Strings = Strings;
     InitializeComponent();
 }