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;
        }
示例#2
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;
        }
示例#3
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;
        }
示例#4
0
        public AddressTools(ICacheFile cache, EngineDescription buildInfo)
        {
            InitializeComponent();

            _cache = cache;

            switch (_cache.Engine)
            {
            case EngineType.ThirdGeneration when !string.IsNullOrEmpty(buildInfo.GameModule):
                realtime = new ThirdGenMCCRTEProvider(buildInfo);
                break;

            case EngineType.SecondGeneration when !string.IsNullOrEmpty(buildInfo.GameModule):
                realtime = new SecondGenMCCRTEProvider(buildInfo);
                break;

            case EngineType.SecondGeneration:
                realtime = new SecondGenRTEProvider(buildInfo);
                break;

            case EngineType.FirstGeneration when !string.IsNullOrEmpty(buildInfo.GameModule):
                realtime = new FirstGenMCCRTEProvider(buildInfo);
                break;

            case EngineType.FirstGeneration:
                realtime = new FirstGenRTEProvider(buildInfo);
                break;
            }
        }
示例#5
0
        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;
        }
示例#6
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 groupName = VariousFunctions.SterilizeTagGroupName(CharConstant.ToString(tag.RawTag.Group.Magic)).Trim();

            _pluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins",
                                        _buildInfo.Settings.GetSetting <string>("plugins"), groupName);

            if (_buildInfo.Settings.PathExists("fallbackPlugins"))
            {
                _fallbackPluginPath = string.Format("{0}\\{1}\\{2}.xml", VariousFunctions.GetApplicationLocation() + @"Plugins",
                                                    _buildInfo.Settings.GetSetting <string>("fallbackPlugins"), groupName);
            }

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

            cbEnumPrefix.SelectedIndex = (int)App.AssemblyStorage.AssemblySettings.PluginsEnumPrefix;

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

            // Load Info
            lblTagName.Text = tag.TagFileName != null
                                ? tag.TagFileName + "." + tag.GroupName
                                : "0x" + tag.RawTag.Index.Value.ToString("X");

            lblDatum.Text   = string.Format("{0}", tag.RawTag.Index);
            lblAddress.Text = string.Format("0x{0:X8}", tag.RawTag.MetaLocation.AsPointer());
            lblOffset.Text  = string.Format("0x{0:X}", tag.RawTag.MetaLocation.AsOffset());

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

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

            LoadNewTagEntry(tag);

            // Set init finished
            hasInitFinished = true;
        }
示例#8
0
        public AddressTools(ICacheFile cache, EngineDescription buildInfo)
        {
            InitializeComponent();

            _cache = cache;

            if (buildInfo.PokingPlatform == RTEConnectionType.LocalProcess32 ||
                buildInfo.PokingPlatform == RTEConnectionType.LocalProcess64)
            {
                switch (_cache.Engine)
                {
                case EngineType.ThirdGeneration when !string.IsNullOrEmpty(buildInfo.PokingModule):
                    realtime = new ThirdGenMCCRTEProvider(buildInfo);
                    break;

                case EngineType.SecondGeneration when !string.IsNullOrEmpty(buildInfo.PokingModule):
                    realtime = new SecondGenMCCRTEProvider(buildInfo);
                    break;

                case EngineType.SecondGeneration:
                    realtime = new SecondGenRTEProvider(buildInfo);
                    break;

                case EngineType.FirstGeneration when !string.IsNullOrEmpty(buildInfo.PokingModule):
                    realtime = new FirstGenMCCRTEProvider(buildInfo);
                    break;

                case EngineType.FirstGeneration:
                    realtime = new FirstGenRTEProvider(buildInfo);
                    break;
                }
            }
            else
            {
                inputRuntime.IsEnabled  = false;
                outputRuntime.IsEnabled = false;
            }
        }
示例#9
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();
            }
        }
示例#10
0
 public RTEStreamManager(IRTEProvider provider, ICacheFile cacheFile)
 {
     _provider = provider;
     _cacheFile = cacheFile;
 }
示例#11
0
 public RTEStreamManager(IRTEProvider provider, ICacheFile cacheFile)
 {
     _provider  = provider;
     _cacheFile = cacheFile;
 }
示例#12
0
        public MetaContainer(EngineDescription buildInfo, string cacheLocation, TagEntry tag, TagHierarchy tags, ICacheFile cache,
                             IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie)
        {
            InitializeComponent();

            _cacheLocation = cacheLocation;
            _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;
            if (App.AssemblyStorage.AssemblySettings.HalomapLastSelectedMetaEditor ==
                Settings.LastMetaEditorType.Info)
            {
                tbMetaEditors.SelectedIndex =
                    (int)Settings.LastMetaEditorType.MetaEditor;
            }


            // Create Meta Editor Tab
            _metaEditor           = new MetaEditor(_buildInfo, _tag, this, _tags, _cache, _streamManager, _rteProvider, _stringIDTrie);
            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.Group.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 Sound

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

            #endregion
        }
示例#13
0
        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
        }
示例#14
0
        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
        }
示例#15
0
 public RTEStreamManager(IRTEProvider provider, ICacheFile cacheFile, ITag tag)
 {
     _provider  = provider;
     _cacheFile = cacheFile;
     _tag       = tag;
 }
示例#16
0
        public MetaContainer(EngineDescription buildInfo, string cacheLocation, TagEntry tag, TagHierarchy tags, ICacheFile cache,
                             IStreamManager streamManager, IRTEProvider rteProvider, Trie stringIDTrie)
        {
            InitializeComponent();

            _cacheLocation = cacheLocation;
            _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;
            if (App.AssemblyStorage.AssemblySettings.HalomapLastSelectedMetaEditor ==
                Settings.LastMetaEditorType.Info)
            {
                tbMetaEditors.SelectedIndex =
                    (int)Settings.LastMetaEditorType.MetaEditor;
            }


            // 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 Sound

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

            #endregion

            // Load Info
            lblTagName.Text = tag.TagFileName != null
                                ? tag.TagFileName + "." + tag.ClassName
                                : "0x" + tag.RawTag.Index.Value.ToString("X");

            lblDatum.Text   = string.Format("Datum Index: {0}", tag.RawTag.Index);
            lblAddress.Text = string.Format("Memory Address: 0x{0:X8}", tag.RawTag.MetaLocation.AsPointer());
            lblOffset.Text  = string.Format("File Offset: 0x{0:X}", tag.RawTag.MetaLocation.AsOffset());
        }
示例#17
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();
            }
        }
示例#18
0
 public RTEStreamManager(IRTEProvider provider, ICacheFile cacheFile, ITag tag)
 {
     _provider = provider;
     _cacheFile = cacheFile;
     _tag = tag;
 }