From 4b274a454b94bb4562d05f432c5b5330d42c2d5c Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sun, 6 Nov 2022 23:47:54 -0800 Subject: [PATCH] Add extensions for NE resource entries --- BurnOutSharp.Builder/Extensions.cs | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/BurnOutSharp.Builder/Extensions.cs b/BurnOutSharp.Builder/Extensions.cs index d0416883..b11aee74 100644 --- a/BurnOutSharp.Builder/Extensions.cs +++ b/BurnOutSharp.Builder/Extensions.cs @@ -272,5 +272,39 @@ namespace BurnOutSharp.Builder } #endregion + + #region New Executable + + /// + /// Determine if a resource type information entry is an integer or offset + /// + /// Resource type information entry to check + /// True if the entry is an integer type, false if an offset, null on error + public static bool? IsIntegerType(this Models.NewExecutable.ResourceTypeInformationEntry entry) + { + // We can't do anything with an invalid entry + if (entry == null) + return null; + + // If the highest order bit is set, it's an integer type + return (entry.TypeID & 0x8000) != 0; + } + + /// + /// Determine if a resource type resource entry is an integer or offset + /// + /// Resource type resource entry to check + /// True if the entry is an integer type, false if an offset, null on error + public static bool? IsIntegerType(this Models.NewExecutable.ResourceTypeResourceEntry entry) + { + // We can't do anything with an invalid entry + if (entry == null) + return null; + + // If the highest order bit is set, it's an integer type + return (entry.ResourceID & 0x8000) != 0; + } + + #endregion } } \ No newline at end of file