Exemple #1
0
        public MetaEditor(EngineDescription buildInfo, TagEntry tag, MetaContainer parentContainer, TagHierarchy tags,
			ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie)
        {
            InitializeComponent();

            _parentMetaContainer = parentContainer;
            _tag = tag;
            _tags = tags;
            _buildInfo = buildInfo;
            _cache = cache;
            _fileManager = streamManager;
            _rteProvider = rteProvider;
            _searchTimer = new Timer(SearchTimer);
            _stringIdTrie = stringIDTrie;

            // Load Plugin Path
            string className = VariousFunctions.SterilizeTagClassName(CharConstant.ToString(tag.RawTag.Class.Magic)).Trim();
            _pluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins",
                _buildInfo.Settings.GetSetting<string>("plugins"), className);

            // Set Option boxes
            cbShowInvisibles.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowInvisibles;
            cbShowComments.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowComments;
            cbShowEnumIndex.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowEnumIndex;
            cbShowInformation.IsChecked = App.AssemblyStorage.AssemblySettings.PluginsShowInformation;

            // Load Meta
            RefreshEditor(MetaReader.LoadType.File);

            // Set init finished
            hasInitFinished = true;
        }
        public MetaEditor(BuildInformation buildInfo, TagEntry tag, MetaContainer parentContainer, TagHierarchy tags, ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie)
        {
            InitializeComponent();

            _parentMetaContainer = parentContainer;
            _tag = tag;
            _tags = tags;
            _buildInfo = buildInfo;
            _cache = cache;
            _streamManager = streamManager;
            _rteProvider = rteProvider;
            _searchTimer = new Timer(SearchTimer);
            _stringIDTrie = stringIDTrie;

            // Load Plugin Path
            string className = VariousFunctions.SterilizeTagClassName(CharConstant.ToString(tag.RawTag.Class.Magic)).Trim();
            _pluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins", _buildInfo.PluginFolder, className);

            // Set Invisibility box
            cbShowInvisibles.IsChecked = Settings.pluginsShowInvisibles;

            // Load Meta
            RefreshEditor();

            // Set init finished
            hasInitFinished = true;
        }
        public MetaContainer(BuildInformation buildInfo, TagEntry tag, TagHierarchy tags, ICacheFile cache, IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie)
        {
            InitializeComponent();

            _tag = tag;
            _tags = tags;
            _buildInfo = buildInfo;
            _cache = cache;
            _streamManager = streamManager;
            _rteProvider = rteProvider;
            _stringIDTrie = stringIDTrie;

            tbMetaEditors.SelectedIndex = (int)Settings.halomapLastSelectedMetaEditor;

            // Create Meta Information Tab
            _metaInformation = new MetaInformation(_buildInfo, _tag, _cache);
            tabTagInfo.Content = _metaInformation;

            // Create Meta Editor Tab
            _metaEditor = new MetaEditor(_buildInfo, _tag, this, _tags, _cache, _streamManager, _rteProvider, _stringIDTrie)
                              {
                                  Padding = new Thickness(0)
                              };
            tabMetaEditor.Content = _metaEditor;

            // Create Plugin Editor Tab
            _pluginEditor = new PluginEditor(_buildInfo, _tag, this, _metaEditor);
            tabPluginEditor.Content = _pluginEditor;
        }
Exemple #4
0
 public StringIDData(string name, uint offset, uint address, StringID sid, StringIDSource source, Trie autocompleteTrie, uint pluginLine)
     : base(name, offset, address, pluginLine)
 {
     _value = sid;
     _source = source;
     _autocompleteTrie = autocompleteTrie;
 }
        public ThirdGenPluginVisitor(TagHierarchy tags, Trie stringIDTrie, FileSegmentGroup metaArea, bool showInvisibles)
        {
            _tags = tags;
            _stringIDTrie = stringIDTrie;
            _metaArea = metaArea;

            Values = new ObservableCollection<MetaField>();
            Reflexives = new ObservableCollection<ReflexiveData>();
            _showInvisibles = showInvisibles;
        }
Exemple #6
0
        /// <summary>
        ///     Save meta to the Blam Cache File
        /// </summary>
        public MetaWriter(IWriter writer, uint baseOffset, ICacheFile cache, EngineDescription buildInfo, SaveType type,
			FieldChangeSet changes, Trie stringIdTrie)
        {
            _writer = writer;
            _baseOffset = baseOffset;
            _cache = cache;
            _type = type;
            _changes = changes;
            _stringIdTrie = stringIdTrie;

            // Load layouts
            _reflexiveLayout = buildInfo.Layouts.GetLayout("reflexive");
            _tagRefLayout = buildInfo.Layouts.GetLayout("tag reference");
            _dataRefLayout = buildInfo.Layouts.GetLayout("data reference");
        }
		public LocaleEditor(GameLanguage language, ICacheFile cache, IStreamManager streamManager, Trie stringIdTrie,
			LocaleSymbolCollection symbols)
		{
			InitializeComponent();

			_currentLanguage = language;
			_cache = cache;
			_streamManager = streamManager;
			_symbols = symbols;
			StringIDTrie = stringIdTrie;

			// Thread the loading routine
			var thrd = new Thread(LoadAll);
			thrd.SetApartmentState(ApartmentState.STA);
			thrd.Start();
		}
Exemple #8
0
        public void InitalizeMap()
        {
            using (FileStream fileStream = File.OpenRead(_cacheLocation))
            {
                var reader = new EndianReader(fileStream, Endian.BigEndian);
                try
                {
                    _cacheFile = CacheFileLoader.LoadCacheFile(reader, App.AssemblyStorage.AssemblySettings.DefaultDatabase,
                        out _buildInfo);

            #if DEBUG
                    Dispatcher.Invoke(new Action(() => contentTabs.Items.Add(new CloseableTabItem
                    {
                        Header = new ContentControl
                        {
                            Content = "Debug Tools",
                            ContextMenu = BaseContextMenu
                        },
                        Content = new DebugTools(_cacheFile)
                    })));
            #endif
                }
                catch (Exception ex)
                {
                    Dispatcher.Invoke(new Action(delegate
                    {
                        if (!_0xabad1dea.IWff.Heman(reader))
                        {
                            StatusUpdater.Update("Not a supported target engine");
                            MetroMessageBox.Show("Unable to open cache file",
                                ex.Message + ".\r\nWhy not add support in the 'Formats' folder?");
                        }
                        else
                        {
                            StatusUpdater.Update("HEYYEYAAEYAAAEYAEYAA");
                        }

                        App.AssemblyStorage.AssemblySettings.HomeWindow.ExternalTabClose(_tab);
                    }));
                    return;
                }
                _mapManager = new FileStreamManager(_cacheLocation, reader.Endianness);

                // Build SID trie
                _stringIdTrie = new Trie();
                if (_cacheFile.StringIDs != null)
                    _stringIdTrie.AddRange(_cacheFile.StringIDs);

                Dispatcher.Invoke(new Action(delegate
                {
                    if (App.AssemblyStorage.AssemblySettings.StartpageHideOnLaunch)
                        App.AssemblyStorage.AssemblySettings.HomeWindow.ExternalTabClose(Home.TabGenre.StartPage);
                }));

                // Set up RTE
                switch (_cacheFile.Engine)
                {
                    case EngineType.SecondGeneration:
                        _rteProvider = new H2VistaRTEProvider("halo2.exe");
                        break;

                    case EngineType.ThirdGeneration:
                        _rteProvider = new XBDMRTEProvider(App.AssemblyStorage.AssemblySettings.Xbdm);
                        break;
                }

                Dispatcher.Invoke(new Action(() => StatusUpdater.Update("Loaded Cache File")));

                // Add to Recents
                Dispatcher.Invoke(new Action(delegate
                {
                    RecentFiles.AddNewEntry(Path.GetFileName(_cacheLocation), _cacheLocation,
                        _buildInfo.Settings.GetSetting<string>("shortName"), Settings.RecentFileType.Cache);
                    StatusUpdater.Update("Added To Recents");
                }));

                /*ITag dice = _cacheFile.Tags[0x0102];
                IRenderModel diceModel = _cacheFile.ResourceMetaLoader.LoadRenderModelMeta(dice, reader);
                var resourceTable = _cacheFile.Resources.LoadResourceTable(reader);
                Resource diceResource = resourceTable.Resources[diceModel.ModelResourceIndex.Index];
                ICacheFile resourceFile = _cacheFile;
                Stream resourceStream = fileStream;
                if (diceResource.Location.PrimaryPage.FilePath != null)
                {
                    resourceStream = File.OpenRead(Path.Combine(Path.GetDirectoryName(_cacheLocation), Path.GetFileName(diceResource.Location.PrimaryPage.FilePath)));
                    resourceFile = new ThirdGenCacheFile(new EndianReader(resourceStream, Endian.BigEndian), _buildInfo, _cacheFile.BuildString);
                }
                ResourcePageExtractor extractor = new ResourcePageExtractor(resourceFile);
                string path = Path.GetTempFileName();
                FileStream pageStream = File.Open(path, FileMode.Create, FileAccess.ReadWrite);
                extractor.ExtractPage(diceResource.Location.PrimaryPage, resourceStream, pageStream);
                if (resourceStream != fileStream)
                    resourceStream.Close();
                IReader pageReader = new EndianReader(pageStream, Endian.BigEndian);
                pageReader.SeekTo(diceResource.Location.PrimaryOffset);
                ObjExporter exporter = new ObjExporter("C:\\Users\\Aaron\\Desktop\\test.obj");
                System.Collections.BitArray sections = new System.Collections.BitArray(diceModel.Sections.Length, true);
                //sections[3] = true;
                //sections[1] = true;
                ModelReader.ReadModelData(pageReader, diceModel, sections, _buildInfo, exporter);
                exporter.Close();
                pageReader.Close();*/

                LoadHeader();
                LoadTags();
                LoadLocales();
                LoadScripts();
            }
        }
        public MetaContainer(EngineDescription buildInfo, TagEntry tag, TagHierarchy tags, ICacheFile cache,
			IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie)
        {
            InitializeComponent();

            _tag = tag;
            _tags = tags;
            _buildInfo = buildInfo;
            _cache = cache;
            _streamManager = streamManager;
            _rteProvider = rteProvider;
            _stringIDTrie = stringIDTrie;

            tbMetaEditors.SelectedIndex = (int) App.AssemblyStorage.AssemblySettings.HalomapLastSelectedMetaEditor;

            // Create Meta Information Tab
            _metaInformation = new MetaInformation(_buildInfo, _tag, _cache);
            tabTagInfo.Content = _metaInformation;

            // Create Meta Editor Tab
            _metaEditor = new MetaEditor(_buildInfo, _tag, this, _tags, _cache, _streamManager, _rteProvider, _stringIDTrie)
            {
                Padding = new Thickness(0)
            };
            tabMetaEditor.Content = _metaEditor;

            // Create Plugin Editor Tab
            _pluginEditor = new PluginEditor(_buildInfo, _tag, this, _metaEditor);
            tabPluginEditor.Content = _pluginEditor;

            // Create Raw Tabs

            #region Models

            //if (_cache.ResourceMetaLoader.SupportsRenderModels && _tag.RawTag.Class.Magic == CharConstant.FromString("mode"))
            //{
            //	tabSound.Visibility = Visibility.Visible;
            //	tabSound.Content = new SoundEditor(_tag, _cache, _streamManager);
            //}
            //else
            //{
            //	tabSound.Visibility = Visibility.Collapsed;
            //	if (App.AssemblyStorage.AssemblySettings.halomapLastSelectedMetaEditor == App.AssemblyStorage.AssemblySettings.LastMetaEditorType.Model)
            //		tbMetaEditors.SelectedIndex = (int)App.AssemblyStorage.AssemblySettings.LastMetaEditorType.MetaEditor;
            //}

            #endregion

            #region BSP

            /*if (true && _tag.RawTag.Class.Magic == CharConstant.FromString("sbsp")) // add some manual check here akarias, since you code isn't in blamite
            {
                tabBspEditor.Visibility = Visibility.Visible;
                tabBspEditor.Content = new BspEditor(_tag, _cache, _streamManager);
            }
            else*/
            {
                tabBspEditor.Visibility = Visibility.Collapsed;
                if (App.AssemblyStorage.AssemblySettings.HalomapLastSelectedMetaEditor == Settings.LastMetaEditorType.Bsp)
                    tbMetaEditors.SelectedIndex = (int) Settings.LastMetaEditorType.MetaEditor;
            }

            #endregion

            #region Sound

            //if (_cache.ResourceMetaLoader.SupportsSounds && _tag.RawTag.Class.Magic == CharConstant.FromString("snd!"))
            //{
            //	tabSound.Visibility = Visibility.Visible;
            //	tabSound.Content = new SoundEditor(_tag, _cache, _streamManager);
            //}
            //else
            //{
            //	tabSound.Visibility = Visibility.Collapsed;
            //	if (App.AssemblyStorage.AssemblySettings.halomapLastSelectedMetaEditor == App.AssemblyStorage.AssemblySettings.LastMetaEditorType.Sound)
            //		tbMetaEditors.SelectedIndex = (int)App.AssemblyStorage.AssemblySettings.LastMetaEditorType.MetaEditor;
            //}

            #endregion
        }
Exemple #10
0
        public void InitalizeMap()
        {
            using (var fileStream = File.OpenRead(_cacheLocation))
            {
                var reader = new EndianReader(fileStream, Endian.BigEndian);
                var formatsPath = Path.Combine(VariousFunctions.GetApplicationLocation(), "Formats");
                var supportedBuildsPath = Path.Combine(formatsPath, "SupportedBuilds.xml");
                _layoutLoader = new BuildInfoLoader(supportedBuildsPath, formatsPath);
                try
                {
                    _cacheFile = CacheFileLoader.LoadCacheFile(reader, _layoutLoader, out _buildInfo);
                }
                catch (NotSupportedException ex)
                {
                    Dispatcher.Invoke(new Action(delegate
                                          {
                                              if (!_0xabad1dea.IWff.Heman(reader))
                                              {
                                                  StatusUpdater.Update("Not a supported target engine");
                                                  MetroMessageBox.Show("Unable to open cache file", ex.Message + ".\r\nWhy not add support in the 'Formats' folder?");
                                              }
                                              else
                                              {
                                                  StatusUpdater.Update("HEYYEYAAEYAAAEYAEYAA");
                                              }

                                              Settings.homeWindow.ExternalTabClose((TabItem)Parent);
                                          }));
                    return;
                }
                _mapManager = new FileStreamManager(_cacheLocation, reader.Endianness);

                // Build SID trie
                _stringIDTrie = new Trie();
                _stringIDTrie.AddRange(_cacheFile.StringIDs);

                Dispatcher.Invoke(new Action(delegate
                                      {
                                          if (Settings.startpageHideOnLaunch)
                                              Settings.homeWindow.ExternalTabClose(Home.TabGenre.StartPage);
                                      }));

                // Set up RTE
                switch (_cacheFile.Engine)
                {
                    case EngineType.SecondGeneration:
                        _rteProvider = new H2VistaRTEProvider("halo2.exe");
                        break;

                    case EngineType.ThirdGeneration:
                        _rteProvider = new XBDMRTEProvider(Settings.xbdm);
                        break;
                }

                Dispatcher.Invoke(new Action(() => StatusUpdater.Update("Loaded Cache File")));

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

                LoadHeader();
                LoadMetaData();
                LoadTags();
                LoadLocales();
                LoadScripts();
            }
        }
Exemple #11
0
		public StringIDData(string name, uint offset, uint address, string val, Trie autocompleteTrie, uint pluginLine)
			: base(name, offset, address, pluginLine)
		{
			_value = val;
			_autocompleteTrie = autocompleteTrie;
		}