public override void ExtractionDispose() { cacheLanguagePackContainer = null; if (globals_handle != DatumIndex.Null) { Unload(globals_handle); globals_handle = DatumIndex.Null; } if (sound_gestalt_handle != DatumIndex.Null) { Unload(sound_gestalt_handle); sound_gestalt_handle = DatumIndex.Null; } if (kVertexBuffers != null) { kVertexBuffers = null; Program.Halo2.Manager.VertexBufferCacheClose(cacheFile.EngineVersion); } base.ExtractionDispose(); }
public override void ExtractionInitialize() { // If we have kVertexBuffers initialized, then that means we've already ran extract init. if (kVertexBuffers != null) return; base.ExtractionInitialize(); var h2cf = base.cacheFile as CacheFile; Program.Halo2.Manager.VertexBufferCacheOpen(Engine); kVertexBuffers = Program.Halo2.Manager.FindGame(Engine).GetResource <Render.VertexBufferInterface.VertexBuffersGen2> (Managers.BlamDefinition.ResourceVertexBuffers); // We only need the globals tag for language pack headers. If this is a PC multiplayer map, then // the headers are stored elsewhere in the cache so we don't have to exception when there is no globals tag if ((globals_handle = base.Open(@"globals\globals", TagGroups.matg)) == DatumIndex.Null && Engine != BlamVersion.Halo2_PC) throw new Debug.ExceptionLog("ExtractionInitialize: couldn't open the globals tag!"); #region Initialze the cache language pack interface if (globals_handle != DatumIndex.Null) { var globals = (base[globals_handle].TagDefinition as Tags.globals_group); globals.LanguagePacksReadFromCache(h2cf); cacheLanguagePackContainer = globals; } // either this map's globals tag is f****d up or it's a MP map for PC and thus doesn't have a local copy) else if (h2cf.HeaderHalo2.PcFields.UsesCustomLanguagePack) { var pc_fields = h2cf.HeaderHalo2.PcFields; pc_fields.LanguagePackHeadersReadFromCache(h2cf); pc_fields.LanguagePacksReadFromCache(h2cf); cacheLanguagePackContainer = pc_fields; } #endregion // TODO: we may want to use the tag_index found in global's sound_block instead... if ((sound_gestalt_handle = base.Open(@"i've got a lovely bunch of coconuts", TagGroups.ugh_)) == DatumIndex.Null) { if (h2cf.HeaderHalo2.PcFields.UsesCustomSoundGestalt) sound_gestalt_handle = base.Open(h2cf.HeaderHalo2.PcFields.SecondarySoundGestalt); if(sound_gestalt_handle == DatumIndex.Null && Engine != BlamVersion.Halo2_PC) // TODO: tag sharing logic throw new Debug.ExceptionLog("ExtractionInitialize: couldn't open the sound gestalt!"); } #region Initialize the feign invalid-shader tag const string invalid_handle_shader_name = @"shaders\invalid"; Blam.CacheIndex.Item i; if (h2cf.TryAndFind(invalid_handle_shader_name, TagGroups.shad, out i)) invalid_handle_shader = i.Datum; else invalid_handle_shader = h2cf.AddFeignTagInstance(invalid_handle_shader_name, TagGroups.shad).Datum; #endregion }
public override void ExtractionInitialize() { // If we have kVertexBuffers initialized, then that means we've already ran extract init. if (kVertexBuffers != null) { return; } base.ExtractionInitialize(); var h2cf = base.cacheFile as CacheFile; Program.Halo2.Manager.VertexBufferCacheOpen(Engine); kVertexBuffers = Program.Halo2.Manager.FindGame(Engine).GetResource <Render.VertexBufferInterface.VertexBuffersGen2> (Managers.BlamDefinition.ResourceVertexBuffers); // We only need the globals tag for language pack headers. If this is a PC multiplayer map, then // the headers are stored elsewhere in the cache so we don't have to exception when there is no globals tag if ((globals_handle = base.Open(@"globals\globals", TagGroups.matg)) == DatumIndex.Null && Engine != BlamVersion.Halo2_PC) { throw new Debug.ExceptionLog("ExtractionInitialize: couldn't open the globals tag!"); } #region Initialze the cache language pack interface if (globals_handle != DatumIndex.Null) { var globals = (base[globals_handle].TagDefinition as Tags.globals_group); globals.LanguagePacksReadFromCache(h2cf); cacheLanguagePackContainer = globals; } // either this map's globals tag is f****d up or it's a MP map for PC and thus doesn't have a local copy) else if (h2cf.HeaderHalo2.PcFields.UsesCustomLanguagePack) { var pc_fields = h2cf.HeaderHalo2.PcFields; pc_fields.LanguagePackHeadersReadFromCache(h2cf); pc_fields.LanguagePacksReadFromCache(h2cf); cacheLanguagePackContainer = pc_fields; } #endregion // TODO: we may want to use the tag_index found in global's sound_block instead... if ((sound_gestalt_handle = base.Open(@"i've got a lovely bunch of coconuts", TagGroups.ugh_)) == DatumIndex.Null) { if (h2cf.HeaderHalo2.PcFields.UsesCustomSoundGestalt) { sound_gestalt_handle = base.Open(h2cf.HeaderHalo2.PcFields.SecondarySoundGestalt); } if (sound_gestalt_handle == DatumIndex.Null && Engine != BlamVersion.Halo2_PC) // TODO: tag sharing logic { throw new Debug.ExceptionLog("ExtractionInitialize: couldn't open the sound gestalt!"); } } #region Initialize the feign invalid-shader tag const string invalid_handle_shader_name = @"shaders\invalid"; Blam.CacheIndex.Item i; if (h2cf.TryAndFind(invalid_handle_shader_name, TagGroups.shad, out i)) { invalid_handle_shader = i.Datum; } else { invalid_handle_shader = h2cf.AddFeignTagInstance(invalid_handle_shader_name, TagGroups.shad).Datum; } #endregion }