diff --git a/FirmwareGen/GPT/GPTUtils.cs b/FirmwareGen/GPT/GPTUtils.cs index 74a48d8..c0e7f24 100644 --- a/FirmwareGen/GPT/GPTUtils.cs +++ b/FirmwareGen/GPT/GPTUtils.cs @@ -170,16 +170,24 @@ private static byte[] MakeGPT(ulong FirstLBA, ulong LastLBA, ulong SectorSize, G ulong FirstUsableLBA = FirstLBA + TotalGPTLBACount; ulong LastUsableLBA = LastLBA - TotalGPTLBACount; - uint PartitionEntryCount = 32; - if ((uint)Partitions.Length + 2 > PartitionEntryCount) - { - if ((uint)Partitions.Length + 2 > PartitionEntryCount * 4) - { - throw new Exception("Unsupported Configuration, too many partitions than supported, please file an issue."); - } + uint PartitionEntryCount; + if ((uint)Partitions.Length > 128) + { + throw new Exception("Unsupported Configuration, too many partitions than supported, please file an issue."); + } + else if ((uint)Partitions.Length > 64) + { PartitionEntryCount = 128; } + else if ((uint)Partitions.Length > 32) + { + PartitionEntryCount = 64; + } + else + { + PartitionEntryCount = 32; + } GPTHeader Header = new() { @@ -199,7 +207,6 @@ private static byte[] MakeGPT(ulong FirstLBA, ulong LastLBA, ulong SectorSize, G PartitionArrayCRC32 = 0 }; - List PartitionTableBuffer = []; for (int i = 0; i < Partitions.Length; i++) {