コード例 #1
0
ファイル: Form1.cs プロジェクト: YxCREATURExY/Assembly
        public Form1()
        {
            InitializeComponent();

            XDocument supportedBuilds = XDocument.Load(@"Formats\SupportedBuilds.xml");
            _buildLoader = new BuildInfoLoader(supportedBuilds, @"Formats\");
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: YxCREATURExY/Assembly
        private void makePatch_Click(object sender, EventArgs e)
        {
            Patch patch = new Patch();
            patch.Name = patchName.Text;
            patch.Description = patchDescription.Text;
            patch.Author = patchAuthor.Text;

            IReader originalReader = new EndianReader(File.OpenRead(unmoddedPath.Text), Endian.BigEndian);
            IReader newReader = new EndianReader(File.OpenRead(moddedPath.Text), Endian.BigEndian);

            ThirdGenVersionInfo version = new ThirdGenVersionInfo(originalReader);
            BuildInfoLoader loader = new BuildInfoLoader(XDocument.Load(@"Formats\SupportedBuilds.xml"), @"Formats\");
            BuildInformation buildInfo = loader.LoadBuild(version.BuildString);
            ThirdGenCacheFile originalFile = new ThirdGenCacheFile(originalReader, buildInfo, version.BuildString);
            ThirdGenCacheFile newFile = new ThirdGenCacheFile(newReader, buildInfo, version.BuildString);

            MetaComparer.CompareMeta(originalFile, originalReader, newFile, newReader, patch);
            LocaleComparer.CompareLocales(originalFile, originalReader, newFile, newReader, patch);

            originalReader.Close();
            newReader.Close();

            IWriter output = new EndianWriter(File.OpenWrite(outPath.Text), Endian.BigEndian);
            AssemblyPatchWriter.WritePatch(patch, output);
            output.Close();

            MessageBox.Show("Done!");
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: YxCREATURExY/Assembly
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Title = "Open Cache File";
            ofd.Filter = "Blam Cache Files|*.map";
            if (ofd.ShowDialog() == DialogResult.Cancel)
                return;

            txtMapPath.Text = ofd.FileName;

            Stream fileStream = File.OpenRead(ofd.FileName);
            _reader = new EndianReader(fileStream, Endian.BigEndian);

            lbStrings.Items.Clear();
            ThirdGenVersionInfo version = new ThirdGenVersionInfo(_reader);
            XDocument supportedBuilds = XDocument.Load(@"Formats\SupportedBuilds.xml");
            BuildInfoLoader layoutLoader = new BuildInfoLoader(supportedBuilds, @"Formats\");
            BuildInformation buildInfo = layoutLoader.LoadBuild(version.BuildString);
            if (buildInfo == null)
            {
                MessageBox.Show("Unsupported engine build \"" + version.BuildString + "\"", Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            _map = new ThirdGenCacheFile(_reader, buildInfo, version.BuildString);

            txtGame.Text = buildInfo.GameName;
            txtBuild.Text = _map.Info.BuildString.ToString();
            txtType.Text = _map.Info.Type.ToString();
            txtInternalName.Text = _map.Info.InternalName;
            txtScenarioName.Text = _map.Info.ScenarioName;
            txtVirtBase.Text = "0x" + _map.Info.MetaBase.AsAddress().ToString("X8");
            txtVirtSize.Text = "0x" + _map.Info.MetaSize.ToString("X");
            txtXdk.Text = _map.Info.XDKVersion.ToString();
            txtRawTableOffset.Text = "0x" + _map.Info.RawTableOffset.ToString("X8");
            txtRawTableSize.Text = "0x" + _map.Info.RawTableSize.ToString("X");
            txtIndexHeaderAddr.Text = "0x" + _map.Info.IndexHeaderLocation.AsAddress().ToString("X8");
            txtIndexOffsetMagic.Text = "0x" + _map.Info.LocaleOffsetMask;
            txtMapMagic.Text = "0x" + _map.Info.AddressMask;

            lbClasses.Items.Clear();
            tvTags.Nodes.Clear();
            Dictionary<ITagClass, TreeNode> classNodes = new Dictionary<ITagClass, TreeNode>();
            foreach (ITagClass tagClass in _map.TagClasses)
            {
                string className = CharConstant.ToString(tagClass.Magic);
                lbClasses.Items.Add(className);
                classNodes[tagClass] = tvTags.Nodes.Add(className);
            }

            for (int i = 0; i < _map.Tags.Count; i++)
            {
                ITag tag = _map.Tags[i];
                if (tag.Index.IsValid)
                {
                    string name = _map.FileNames.FindTagName(tag.Index);
                    if (name == null)
                        name = tag.Index.ToString();
                    classNodes[tag.Class].Nodes.Add(name);
                }
            }

            lbLanguages.Items.Clear();
            foreach (FieldInfo language in typeof(LocaleLanguage).GetFields())
                lbLanguages.Items.Add(language.Name);
        }
コード例 #4
0
ファイル: HaloMap.xaml.cs プロジェクト: YxCREATURExY/Assembly
        public void InitalizeMap()
        {
            _mapManager = new FileStreamManager(_cacheLocation);
            using (Stream fileStream = _mapManager.OpenRead())
            {
                EndianReader reader = new EndianReader(fileStream, Endian.BigEndian);
                Dispatcher.Invoke(new Action(delegate { StatusUpdater.Update("Opened File"); }));

                _version = new ThirdGenVersionInfo(reader);
                _supportedBuilds = XDocument.Load(VariousFunctions.GetApplicationLocation() + @"Formats\SupportedBuilds.xml");
                _layoutLoader = new BuildInfoLoader(_supportedBuilds, VariousFunctions.GetApplicationLocation() + @"Formats\");
                _buildInfo = _layoutLoader.LoadBuild(_version.BuildString);

                Dispatcher.Invoke(new Action(delegate { StatusUpdater.Update("Loaded Build Definitions"); }));

                if (_buildInfo == null)
                {
                    Dispatcher.Invoke(new Action(delegate
                        {
                            if (!_0xabad1dea.IWff.Heman(reader))
                            {
                                StatusUpdater.Update("Not a supported cache build");
                                MetroMessageBox.Show("Unable to open cache file", "Unsupported blam engine build \"" + _version.BuildString + "\". Why not add support in the 'Formats' folder?");
                            }
                            else
                            {
                                StatusUpdater.Update("HEYYEYAAEYAAAEYAEYAA");
                            }

                            Settings.homeWindow.ExternalTabClose((TabItem)this.Parent);
                        }));
                    return;
                }
                Dispatcher.Invoke(new Action(delegate
                {
                    if (Settings.startpageHideOnLaunch)
                        Settings.homeWindow.ExternalTabClose(Windows.Home.TabGenre.StartPage);
                }));

                // Load the cache file
                _cacheFile = new ThirdGenCacheFile(reader, _buildInfo, _version.BuildString);
                Dispatcher.Invoke(new Action(delegate { StatusUpdater.Update("Loaded Cache File"); }));

                // Add to Recents
                Dispatcher.Invoke(new Action(delegate
                {
                    RecentFiles.AddNewEntry(System.IO.Path.GetFileName(_cacheLocation), _cacheLocation, _buildInfo.ShortName, Settings.RecentFileType.Cache);
                    StatusUpdater.Update("Added To Recents");
                }));

                LoadHeader();
                LoadTags();
                LoadLocales();
                LoadScripts();
            }
        }