From a0177f1174c4eafe017b5c7932af68d71d2574f2 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 13 Nov 2024 21:29:43 -0500 Subject: [PATCH] Add bitmasks helper method --- SabreTools.Serialization/Wrappers/N3DS.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/SabreTools.Serialization/Wrappers/N3DS.cs b/SabreTools.Serialization/Wrappers/N3DS.cs index 121006a7..02f79a2f 100644 --- a/SabreTools.Serialization/Wrappers/N3DS.cs +++ b/SabreTools.Serialization/Wrappers/N3DS.cs @@ -248,6 +248,23 @@ namespace SabreTools.Serialization.Wrappers #region Data + /// + /// Get the bit masks for a partition + /// + public BitMasks GetBitMasks(int partitionIndex) + { + if (Model.Partitions == null) + return 0; + if (partitionIndex < 0 || partitionIndex >= Model.Partitions.Length) + return 0; + + var partition = Model.Partitions[partitionIndex]; + if (partition?.Flags == null) + return 0; + + return partition.Flags.BitMasks; + } + /// /// Determines if a file header represents a CODE block ///