/// <summary> /// Get a tag group definition from a game name and four character tag /// </summary> /// <param name="game"></param> /// <param name="group_tag"></param> /// <returns></returns> /// <remarks> /// Does not handle Struct group tags. /// /// If <paramref name="game"/> equals <see cref="BlamVersion.Unknown"/>, <see cref="MiscGroups"/> is used for finding the TagGroup /// </remarks> /// <exception cref="Debug.Exceptions.UnreachableException">When <paramref name="game"/> is an unhandled game</exception> public static TagGroup TagGroupFrom(BlamVersion game, uint group_tag) { if (group_tag == uint.MaxValue) return TagGroup.Null; if ((game & BlamVersion.Halo1) != 0) return Halo1.TagGroups.Groups.FindTagGroup(group_tag); #if !NO_HALO2 else if ((game & BlamVersion.Halo2) != 0) return Halo2.TagGroups.Groups.FindTagGroup(group_tag); #endif #if !NO_HALO3 else if ((game & BlamVersion.Halo3) != 0) return Halo3.TagGroups.Groups.FindTagGroup(group_tag); #endif #if !NO_HALO_ODST else if ((game & BlamVersion.HaloOdst) != 0) return HaloOdst.TagGroups.Groups.FindTagGroup(group_tag); #endif #if !NO_HALO_REACH else if ((game & BlamVersion.HaloReach) != 0) return HaloReach.TagGroups.Groups.FindTagGroup(group_tag); #endif #if !NO_HALO4 else if ((game & BlamVersion.Halo4) != 0) return Halo4.TagGroups.Groups.FindTagGroup(group_tag); #endif else if ((game & BlamVersion.Stubbs) != 0) return Stubbs.TagGroups.Groups.FindTagGroup(group_tag); else if (game == BlamVersion.Unknown) return MiscGroups.Groups.FindTagGroup(group_tag); throw new Debug.Exceptions.UnreachableException(game); }
int ImplicitUpgradeCalculateFieldStartIndex(Definition def, int size_of, BlamVersion engine, uint flags) { int index; if (!implicitUpgradeFieldIndexes.TryGetValue(size_of, out index)) { int current_size_of = VersioningGetRealSizeOf(flags); for (int x = def.Count - 1; x >= 0; x--) { var f = def[x]; //if(f.FieldType != FieldType.UselessPad) current_size_of -= FieldUtil.Sizeof(f, engine, false, flags); if (current_size_of == size_of) { implicitUpgradeFieldIndexes.Add(size_of, index = x); break; } else if (current_size_of < size_of) // field layouts don't match up return -1; } } return index; }
public static Interface GetInterface(BlamVersion v) { if ((v & BlamVersion.Halo1) != 0) return new Blam.Halo1.CheApe.Project.Interface(); #if !NO_HALO2 else if ((v & BlamVersion.Halo2) != 0) return new Blam.Halo2.CheApe.Project.Interface(); #endif throw new Debug.Exceptions.UnreachableException(v); }
/// <summary> /// Writes a blank xml document for someone to start filling in /// </summary> /// <param name="file"></param> /// <param name="engine"></param> public static void WriteBlankDocument(string file, BlamVersion engine) { // maybe I should use XmlTextWriter, but I rly don't care right now... using (var io = new System.IO.StreamWriter(file)) { io.WriteLine("<?xml version=\"1.0\" encoding=\"us-ascii\" standalone=\"yes\"?>"); io.WriteLine("<definitions game=\"{0}\">", engine); io.Write("</definitions>"); } }
public BuilderTagIndex(BlamVersion version, Managers.ITagIndex source_index) : base(version, source_index) { int max_tag_count = 1024; var g = Program.GetManager(version).FindGame(version); if (g != null) max_tag_count = g.Tags.MaxCount; Array = new Managers.DataArray<BuilderItem>(max_tag_count, "builder tag instances"); DataArraySet(Array); }
static void ScanForScriptFunctions(BlamVersion engine, string path, string[] script_functions) { using (var handler = new CacheHandler<Blam.Halo3.CacheFile>(engine, path)) { var cf = handler.CacheInterface; cf.Read(); ScanForScriptFunctionsImpl(script_functions, handler.CacheInterface); } }
internal protected override Blam.Cache.BuilderBase ConstructCacheBuilder(BlamVersion game) { Blam.Cache.BuilderBase cb = null; if ((game & BlamVersion.Stubbs) != 0) { cb = new Stubbs.Builder(); } return cb; }
static string EngineGetTestResultsPath(BlamVersion engine) { switch (engine) { case BlamVersion.Halo2_Xbox: return kTestResultsPathXbox; case BlamVersion.Halo2_Alpha: return kTestResultsPathXboxAlpha; case BlamVersion.Halo2_PC: return kTestResultsPathPc; default: return kTestResultsPath; } }
internal protected override Blam.CacheFile LoadCacheFile(BlamVersion game, string file_path, bool is_resource) { Blam.CacheFile cf = null; if ((game & BlamVersion.HaloOdst) != 0) { // if (is_resource) // return null; /*else*/ cf = new HaloOdst.CacheFile(file_path); } return cf; }
public static void InitializeScriptFunctionsList(BlamVersion engine, out string[] script_functions) { switch (engine) { case BlamVersion.Halo3_Xbox: script_functions = new string[kScriptFunctionCountHalo3]; break; case BlamVersion.HaloOdst_Xbox: script_functions = new string[kScriptFunctionCountHaloOdst]; break; case BlamVersion.HaloReach_Beta: script_functions = new string[kScriptFunctionCountReachBeta]; break; case BlamVersion.HaloReach_Xbox: script_functions = new string[kScriptFunctionCountReachRetail]; break; default: script_functions = null; break; } for (int x = 0; x < script_functions.Length; x++) script_functions[x] = "123"; }
void CacheOutputInformation(BlamVersion game) { string dir = null; if (game == BlamVersion.Stubbs_PC) dir = kMapsDirectoryPc; else if (game == BlamVersion.Stubbs_Xbox) dir = kMapsDirectoryXbox; if(!string.IsNullOrEmpty(dir)) { CacheFileOutputInfoArgs.TestThreadedMethod(TestContext, CacheOutputInformation, game, dir, kMapNames); } }
public EngineSettingsForm(BlamVersion version) { InitializeComponent(); SetDialogName(version); object settings = null; switch (version.ToBuild()) { case BlamBuild.Halo1: settings = BlamLib.Program.Halo1.Manager.Settings; break; case BlamBuild.Halo2: settings = BlamLib.Program.Halo2.Manager.Settings; break; case BlamBuild.Halo3: settings = BlamLib.Program.Halo3.Manager.Settings; break; case BlamBuild.HaloOdst: settings = BlamLib.Program.HaloOdst.Manager.Settings; break; case BlamBuild.HaloReach: settings = BlamLib.Program.HaloReach.Manager.Settings; break; case BlamBuild.Stubbs: settings = BlamLib.Program.Stubbs.Manager.Settings; break; } PropGrid.SelectedObject = settings; }
protected static void SecurityAesDecrypt(BlamVersion game, Blam.CacheSectionType section_type, byte[] input, out byte[] output, GetAesParametersProc GetAesParameters) { output = null; using (var aesm = new Crypt.AesManaged()) { aesm.KeySize = 128; aesm.Padding = Crypt.PaddingMode.Zeros; aesm.Mode = Crypt.CipherMode.CBC; byte[] key, iv; GetAesParameters(game, section_type, out key, out iv); if (key != null && iv != null) using (var ctx = aesm.CreateDecryptor(key, iv)) { output = ctx.TransformFinalBlock(input, 0, input.Length); } } }
protected ProjectState(BlamVersion engine, Project proj) { this.engine = engine; Managers.GameManager.Namespace nspace; Managers.GameManager.Platform plat; // Get the namespace of the engine we're using Managers.GameManager.FromBlamVersion(engine, out nspace, out plat); // Read the CheApe engine definition data we need for importing definition = new XmlInterface(engine); definition.Read(Managers.GameManager.GetRelativePath(nspace), "CheApe.xml"); InitializeTypeIndicies(); proj.OwnerState = this; project = proj; Managers.BlamDefinition gd = Program.GetManager(engine); (gd as Managers.IScriptingController).ScriptingCacheOpen(engine); scriptingInterface = gd[engine].GetResource<Scripting.XmlInterface>(Managers.BlamDefinition.ResourceScripts); }
/// <summary> Default constructor. </summary> public ModelExtractor(BlamVersion gameVersion) { InitializeComponent(); // Force controls added to the control panel to dock to the top mControlPanel.ControlAdded += (sender, e) => { e.Control.Dock = DockStyle.Top; }; // Create the controller mController = new ModelExtractorController(gameVersion); // Attach to controller state changes mController.StateChanged += ControllerStateChanged; SetState(ModelExtractorStateEnum.ExtractorClosed); // Attach child controls to controller mTagsPathControl.BindPath("TagsFolder", mController.GetExtractorSettings()); mDataPathControl.BindPath("DataFolder", mController.GetExtractorSettings()); mMessageList.Attach(mController); mJobListControl.Attach(mController); // Populate the model type list foreach (var type in mController.GetExtractorFactory().GetFileTypes()) { mModelTypeComboBox.Items.Add(String.Format("{0} (*.{1})", type.TypeName, type.TypeExtension)); mExtensions.Add(type.TypeExtension); } // Set the initial extractor type mModelTypeComboBox.SelectedIndex = 0; mModelTypeComboBox.SelectedIndexChanged += SelectedExtensionChanged; SetExtractor(); }
protected Compiler(BlamVersion engine) { Head = new CacheFileHeader(engine); MemoryStream = null; OwnerState = null; DebugStrings = new Util.StringPool(true); RamMemory = new BlamLib.IO.EndianWriter(new System.IO.MemoryStream(1024), this); }
/// <summary> /// Returns a CacheFile object based on a cache name /// </summary> /// <remarks> /// If the <paramref name="cache_name"/> is null or empty then <paramref name="is_internal"/> /// gets set to true and null is returned. If null and <paramref name="is_internal"/> is not set, /// the CacheFile is either not loaded or the location was invalid. /// </remarks> /// <param name="ver">Halo3 engine version</param> /// <param name="cache_name">Blam based cache name</param> /// <param name="is_internal">bool reference to set if the reference is internal</param> /// <returns>The CacheFile associated with <paramref name="cache_name"/></returns> public static Blam.Halo3.CacheFile FromLocation(BlamVersion ver, string cache_name, out bool is_internal) { is_internal = false; Blam.Halo3.CacheFile c = FromLocation(ver, cache_name); is_internal = c == null; return c; }
/// <summary>Returns true if the engine version is for anything other than a game console</summary> /// <param name="version">game engine version</param> /// <returns></returns> /// <remarks>Returns true if its for the mac as well</remarks> public static bool IsPc(this BlamVersion version) { return (((version & BlamVersion.PC) != 0) || ((version & BlamVersion.Mac) != 0)); }
/// <summary> /// Returns true if the supplied blam engine makes use of field set version /// headers in the tag file streams /// </summary> /// <param name="version">game engine version</param> /// <returns></returns> public static bool UsesFieldSetVersionHeader(this BlamVersion version) { return(((version & BlamVersion.Halo1) == 0) && ((version & BlamVersion.Stubbs) == 0)); }
internal protected override Blam.CacheFile LoadCacheFile(BlamVersion game, string file_path, bool is_resource) { Blam.CacheFile cf = null; if((game & BlamVersion.Halo1) != 0) { if (is_resource && game.IsPc()) // hacks 'r us. f*****g data file cache... { if (file_path.Contains("bitmaps.map")) return new BitmapCacheFile(game, file_path); else if (file_path.Contains("sounds.map")) return new SoundCacheFile(game, file_path); else if (file_path.Contains("loc.map")) return new LocCacheFile(game, file_path); } else cf = new Halo1.CacheFile(file_path); } return cf; }
/// <summary>Invalid engine exception details</summary> /// <param name="expected">The engine we were expecting</param> /// <param name="got">The engine we actually got</param> /// <remarks>Meant for specific engine conflicts (eg, <see cref="BlamVersion.Halo1_Xbox"/> <see cref="BlamVersion.Halo1_PC"/>)</remarks> public InvalidBlamVersionException(BlamVersion expected, BlamVersion got) : base(null, "Invalid engine") { Debug.LogFile.WriteLine( "Invalid engine: expected '{0}' but got '{1}'", expected, got); }
/// <summary> /// Dispose a tag index from memory /// </summary> /// <param name="index_id">Handle for the tag index object</param> public static void CloseTagIndex(Blam.DatumIndex index_id) { BlamVersion engine = Managers.BlamDefinition.CacheDatumToEngine(index_id); GetManager(engine).CloseTagIndex(index_id); }
/// <summary> /// <see cref="BlamLib.Managers.IScriptingController"/> /// </summary> /// <param name="game"></param> /// <returns></returns> public override bool ScriptingCacheClose(BlamVersion game) { int count = -1; switch (game) { case BlamVersion.HaloOdst_Xbox: count = Interlocked.Decrement(ref ScriptingCacheReferencesXbox); break; // case BlamVersion.HaloOdst_PC: count = Interlocked.Decrement(ref ScriptingCacheReferencesPC); break; default: throw new Debug.Exceptions.UnreachableException(); } if(count == 0) // since it's pre-decrement assigned, it will equal to zero when nothing is using it anymore { base.CloseResource(game, Managers.BlamDefinition.ResourceScripts); return true; } else if (count == -1) throw new Debug.Exceptions.UnreachableException(); return false; }
/// <summary> /// Dispose a cache file from memory /// </summary> /// <param name="cache_id">Handle for the cache file object</param> public static void CloseCacheFile(Blam.DatumIndex cache_id) { BlamVersion engine = Managers.BlamDefinition.CacheDatumToEngine(cache_id); GetManager(engine).CloseCacheFile(cache_id); }
/// <summary> /// Get a tag index that is loaded in memory /// </summary> /// <param name="index_id">Handle for the tag index object</param> /// <returns></returns> public static Managers.ITagIndex GetTagIndex(Blam.DatumIndex index_id) { BlamVersion engine = Managers.BlamDefinition.TagIndexDatumToEngine(index_id); return(GetManager(engine).GetTagIndex(index_id)); }
/// <summary> /// Get a cache file that is loaded in memory /// </summary> /// <param name="cache_id">Handle for the cache file object</param> /// <returns></returns> public static Blam.CacheFile GetCacheFile(Blam.DatumIndex cache_id) { BlamVersion engine = Managers.BlamDefinition.CacheDatumToEngine(cache_id); return(GetManager(engine).GetCacheFile(cache_id)); }
/// <summary> /// Dispose a cache builder from memory /// </summary> /// <param name="builder_id">Handle for the cache builder object</param> public static void CloseCacheBuilder(Blam.DatumIndex builder_id) { BlamVersion engine = Managers.BlamDefinition.CacheBuilderDatumToEngine(builder_id); GetManager(engine).CloseCacheBuilder(builder_id); }
/// <summary>Returns true if the supplied blam engine makes use of string ids</summary> /// <param name="version">game engine version</param> /// <returns></returns> public static bool UsesStringIds(this BlamVersion version) { return(((version & BlamVersion.Halo1) == 0) && ((version & BlamVersion.Stubbs) == 0)); }
internal Project(BlamVersion v, string file_name) { engine = v; fileName = file_name; folder = System.IO.Path.GetDirectoryName(file_name) + "\\"; }
/// <summary> /// Extension method for <see cref="BlamVersion"/> for streaming an instance to a stream /// </summary> /// <param name="version"></param> /// <param name="s"></param> public static void Write(this BlamVersion version, IO.EndianWriter s) { s.Write((ushort)version); }
public LocCacheFile(BlamVersion engine, string path) : base(engine, path) { }
/// <summary> /// Get a <see cref="TagGroup"/> via a handle stored in a <see cref="DatumIndex"/> object which is a strong reference /// and can be trusted to work even when streamed to a file and loaded at another time after the application /// has reset /// </summary> /// <param name="group_handle">Strong reference to a <see cref="TagGroup"/></param> /// <returns></returns> public static TagGroup TagGroupFromHandle(DatumIndex group_handle) { if (group_handle == DatumIndex.Null) { return(TagGroup.Null); } BlamVersion engine = (BlamVersion)group_handle.Salt; ushort index = group_handle.Index; bool is_struct = Util.Flags.Test(index, (ushort)0x8000); switch (engine) { case BlamVersion.Halo1: return(Halo1.TagGroups.Groups[index]); #if !NO_HALO2 case BlamVersion.Halo2: if (is_struct) { return(Halo2.StructGroups.Groups[index]); } return(Halo2.TagGroups.Groups[index]); #endif #if NO_HALO3 case BlamVersion.Halo3: if (is_struct) { return(Halo3.StructGroups.Groups[index]); } return(Halo3.TagGroups.Groups[index]); #endif #if NO_HALO_ODST case BlamVersion.HaloOdst: // TODO: ummm, add the code for struct groups //if (is_struct) return HaloOdst.StructGroups.Groups[index]; return(HaloOdst.TagGroups.Groups[index]); #endif #if NO_HALO_REACH case BlamVersion.HaloReach: if (is_struct) { return(HaloReach.StructGroups.Groups[index]); } return(HaloReach.TagGroups.Groups[index]); #endif #if NO_HALO4 case BlamVersion.Halo4: if (is_struct) { return(Halo4.StructGroups.Groups[index]); } return(Halo4.TagGroups.Groups[index]); #endif case BlamVersion.Stubbs: return(Stubbs.TagGroups.Groups[index]); case BlamVersion.Unknown: return(MiscGroups.Groups[index]); default: throw new Debug.Exceptions.UnreachableException(engine); } }
public override Blam.CacheFile GetCacheFileFromLocation(BlamVersion ver, string cache_name) { return Program.HaloOdst.FromLocation(ver, cache_name); }
/// <summary> /// Returns a CacheFile object based on a cache name /// </summary> /// <param name="ver">Halo3 engine version</param> /// <param name="cache_name">Blam based cache name</param> /// <returns>The CacheFile associated with <paramref name="cache_name"/></returns> public static Blam.Halo3.CacheFile FromLocation(BlamVersion ver, string cache_name) { if (string.IsNullOrEmpty(cache_name)) { return(null); } Blam.CacheType t = BlamLib.Blam.CacheType.None; if (cache_name.Contains("mainmenu")) { t = BlamLib.Blam.CacheType.MainMenu; } else if (cache_name.Contains("shared")) { t = BlamLib.Blam.CacheType.Shared; } else if (cache_name.Contains("campaign")) { t = BlamLib.Blam.CacheType.SharedCampaign; } else { throw new Debug.Exceptions.UnreachableException(cache_name); } if (ver == BlamVersion.Halo3_Xbox) { switch (t) { case BlamLib.Blam.CacheType.MainMenu: return(XboxMainmenu); case BlamLib.Blam.CacheType.Shared: return(XboxShared); case BlamLib.Blam.CacheType.SharedCampaign: return(XboxCampaign); } } else if (ver == BlamVersion.Halo3_Epsilon) { switch (t) { case BlamLib.Blam.CacheType.MainMenu: return(EpsilonMainmenu); case BlamLib.Blam.CacheType.Shared: return(EpsilonShared); case BlamLib.Blam.CacheType.SharedCampaign: return(EpsilonCampaign); } } else if (ver == BlamVersion.Halo3_Beta) { switch (t) { case BlamLib.Blam.CacheType.MainMenu: return(BetaMainmenu); case BlamLib.Blam.CacheType.Shared: return(BetaShared); case BlamLib.Blam.CacheType.SharedCampaign: throw new Debug.Exceptions.UnreachableException(); } } return(null); }
/// <summary> /// <see cref="BlamLib.Managers.IVertexBufferController"/> /// </summary> /// <param name="game"></param> /// <returns></returns> public bool VertexBufferCacheClose(BlamVersion game) { int count = -1; switch (game) { case BlamVersion.Halo1_Xbox: count = Interlocked.Decrement(ref VertexBufferCacheReferencesXbox); break; case BlamVersion.Halo1_XboxX: count = Interlocked.Decrement(ref VertexBufferCacheReferencesXboxX);break; case BlamVersion.Halo1_PC: //count = Interlocked.Decrement(ref VertexBufferCacheReferencesPC); break; case BlamVersion.Halo1_PCX: //count = Interlocked.Decrement(ref VertexBufferCacheReferencesPCX);break; case BlamVersion.Halo1_Mac: //count = Interlocked.Decrement(ref VertexBufferCacheReferencesMac);break; case BlamVersion.Halo1_CE: count = Interlocked.Decrement(ref VertexBufferCacheReferencesCE); break; default: throw new Debug.Exceptions.UnreachableException(); } if(count == 0) // since it's pre-decrement assigned, it will equal to zero when nothing is using it anymore { base.CloseResource(game, Managers.BlamDefinition.ResourceVertexBuffers); return true; } else if (count == -1) throw new Debug.Exceptions.UnreachableException(); return false; }
//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> Constructor. </summary> /// /// <param name="game"> The game engine version. </param> /// <param name="path"> Full pathname of the tags root directory. </param> /// <param name="tags_dir"> (Optional) the tags folder name. </param> public TagIndexHandler(BlamVersion game, string path, string tags_dir = "tags") { mGameVersion = game; mIndexHandle = BlamLib.Program.GetManager(mGameVersion).OpenTagIndex(game, path, tags_dir); mIndexInterface = BlamLib.Program.GetTagIndex(mIndexHandle) as T; }
protected internal override Blam.Cache.BuilderBase ConstructCacheBuilder(BlamVersion game) { throw new NotSupportedException(); }
/// <summary>Returns true if the engine version is for any of the xbox systems</summary> /// <param name="version">game engine version</param> /// <returns></returns> public static bool IsXbox(this BlamVersion version) { return((version & BlamVersion.Xbox) != 0); }
public abstract bool StringIdCacheOpen(BlamVersion game);
internal static void SecurityAesDecrypt(BlamVersion game, CacheSectionType section_type, byte[] input, out byte[] output) { SecurityAesDecrypt(game, section_type, input, out output, GetAesParameters); }
public XmlInterface(BlamVersion engine) { this.engine = engine; }
/// <summary> /// Returns a CacheFile object based on a cache name /// </summary> /// <param name="ver">Halo3 engine version</param> /// <param name="cache_name">Blam based cache name</param> /// <returns>The CacheFile associated with <paramref name="cache_name"/></returns> public static Blam.Halo3.CacheFile FromLocation(BlamVersion ver, string cache_name) { if (string.IsNullOrEmpty(cache_name)) return null; Blam.CacheType t = BlamLib.Blam.CacheType.None; if (cache_name.Contains("mainmenu")) t = BlamLib.Blam.CacheType.MainMenu; else if (cache_name.Contains("shared")) t = BlamLib.Blam.CacheType.Shared; else if (cache_name.Contains("campaign")) t = BlamLib.Blam.CacheType.SharedCampaign; else throw new Debug.Exceptions.UnreachableException(cache_name); if (ver == BlamVersion.Halo3_Xbox) { switch (t) { case BlamLib.Blam.CacheType.MainMenu: return XboxMainmenu; case BlamLib.Blam.CacheType.Shared: return XboxShared; case BlamLib.Blam.CacheType.SharedCampaign: return XboxCampaign; } } else if (ver == BlamVersion.Halo3_Epsilon) { switch (t) { case BlamLib.Blam.CacheType.MainMenu: return EpsilonMainmenu; case BlamLib.Blam.CacheType.Shared: return EpsilonShared; case BlamLib.Blam.CacheType.SharedCampaign: return EpsilonCampaign; } } else if (ver == BlamVersion.Halo3_Beta) { switch (t) { case BlamLib.Blam.CacheType.MainMenu: return BetaMainmenu; case BlamLib.Blam.CacheType.Shared: return BetaShared; case BlamLib.Blam.CacheType.SharedCampaign: throw new Debug.Exceptions.UnreachableException(); } } return null; }
/// <summary> /// Extension method for <see cref="BlamVersion"/> for streaming an instance from a stream /// </summary> /// <param name="version"></param> /// <param name="s"></param> public static void Read(this BlamVersion version, IO.EndianReader s) { version = (BlamVersion)s.ReadUInt16(); }
public override Blam.CacheFile GetCacheFileFromLocation(BlamVersion ver, string cache_name, out bool is_internal) { return(Program.Halo4.FromLocation(ver, cache_name, out is_internal)); }
public abstract bool ScriptingCacheClose(BlamVersion game);
protected DataCacheFile(BlamVersion engine, string path) { if (!SharableReferencePc(path) && !SharableReferenceCe(path)) { InputStream = new IO.EndianReader(path, IO.EndianState.Little, this); if (!CacheIsReadonly(path)) OutputStream = new IO.EndianWriter(path, IO.EndianState.Little, this); } cacheIndex = new DataIndex(); engineVersion = engine; }
public abstract bool VertexBufferCacheOpen(BlamVersion game);
/// <summary> /// <see cref="BlamLib.Managers.IScriptingController"/> /// </summary> /// <param name="game"></param> /// <returns></returns> public override bool ScriptingCacheOpen(BlamVersion game) { int count = 0; switch (game) { case BlamVersion.HaloOdst_Xbox: count = Interlocked.Increment(ref ScriptingCacheReferencesXbox); break; // case BlamVersion.HaloOdst_PC: count = Interlocked.Increment(ref ScriptingCacheReferencesPC); break; default: throw new Debug.Exceptions.UnreachableException(); } if(count == 1) { base.PrecacheResource(game, Managers.BlamDefinition.ResourceScripts); return true; } else if (count == 0) throw new Debug.Exceptions.UnreachableException(); return false; }
public abstract bool VertexBufferCacheClose(BlamVersion game);
public override Blam.CacheFile GetCacheFileFromLocation(BlamVersion ver, string cache_name) { return(Program.Halo4.FromLocation(ver, cache_name)); }
/// <summary>BlamVersion to BlamBuild</summary> /// <param name="ver">game engine version</param> /// <returns></returns> public static BlamBuild ToBuild(this BlamVersion ver) { return(((BlamBuild)ver) & BlamBuild.kAll); }
public override Blam.CacheFile GetCacheFileFromLocation(BlamVersion ver, string cache_name, out bool is_internal) { return Program.HaloOdst.FromLocation(ver, cache_name, out is_internal); }
/// <summary> /// <see cref="BlamLib.Managers.IVertexBufferController"/> /// </summary> /// <param name="game"></param> /// <returns></returns> public bool VertexBufferCacheOpen(BlamVersion game) { int count = 0; switch (game) { case BlamVersion.Halo1_Xbox: count = Interlocked.Increment(ref VertexBufferCacheReferencesXbox); break; case BlamVersion.Halo1_XboxX: count = Interlocked.Increment(ref VertexBufferCacheReferencesXboxX);break; case BlamVersion.Halo1_PC: //count = Interlocked.Increment(ref VertexBufferCacheReferencesPC); break; case BlamVersion.Halo1_PCX: //count = Interlocked.Increment(ref VertexBufferCacheReferencesPCX);break; case BlamVersion.Halo1_Mac: //count = Interlocked.Increment(ref VertexBufferCacheReferencesMac);break; case BlamVersion.Halo1_CE: count = Interlocked.Increment(ref VertexBufferCacheReferencesCE); break; default: throw new Debug.Exceptions.UnreachableException(); } if(count == 1) { base.PrecacheResource(game, Managers.BlamDefinition.ResourceVertexBuffers); return true; } else if (count == 0) throw new Debug.Exceptions.UnreachableException(); return false; }
public static bool HasFlag(this BlamVersion ver, BlamVersion flag) { return((ver & flag) == flag); }
public abstract bool StringIdCacheClose(BlamVersion game);
/// <summary>BlamVersion to BlamPlatform</summary> /// <param name="ver">game engine version</param> /// <returns></returns> public static BlamPlatform ToPlatform(this BlamVersion ver) { return(((BlamPlatform)ver) & BlamPlatform.kAll); }
/// <summary> /// Translate a BlamVersion enumeration into a Namespace and Platform enumerations /// </summary> /// <param name="g">Enumeration to translate</param> /// <param name="n"><paramref name="g"/>'s Namespace</param> /// <param name="p"><paramref name="g"/>'s Platform</param> public static void FromBlamVersion(BlamVersion g, out Namespace n, out Platform p) { n = Namespace.Unknown; p = Platform.Unknown; if ((g & BlamVersion.Xbox) != 0) p = Platform.Xbox; else if ((g & BlamVersion.PC) != 0) p = Platform.PC; else if ((g & BlamVersion.Mac) != 0)p = Platform.Mac; if ((g & BlamVersion.Halo1) != 0) n = Namespace.Halo1; else if ((g & BlamVersion.Stubbs) != 0) n = Namespace.Stubbs; else if ((g & BlamVersion.Halo2) != 0) n = Namespace.Halo2; else if ((g & BlamVersion.Halo3) != 0) n = Namespace.Halo3; else if ((g & BlamVersion.HaloOdst) != 0) n = Namespace.HaloOdst; else if ((g & BlamVersion.HaloReach) != 0) n = Namespace.HaloReach; else if ((g & BlamVersion.Halo4) != 0) n = Namespace.Halo4; }
public abstract bool ScriptingCacheOpen(BlamVersion game);