NdsForge.NET 1.0.1
Read, validate, edit, compare, and build Nintendo DS and DSi images from .NET
Loading...
Searching...
No Matches
NdsReadOptions.cs
1namespace NdsForge;
2
4public sealed record NdsReadOptions
5{
7 public static NdsReadOptions Default { get; } = new();
8
11 public int MaximumFileNameTableBytes { get; init; } = 16 * 1024 * 1024;
12
14 public int MaximumFileAllocationTableBytes { get; init; } = 8 * 1024 * 1024;
15
17 public int MaximumDirectoryCount { get; init; } = 4096;
18
20 public int MaximumDirectoryDepth { get; init; } = 128;
21
23 public int MaximumOverlayCount { get; init; } = 65_536;
24
26 public int MaximumBannerBytes { get; init; } = 0x23C0;
27
30 internal void Validate()
31 {
32 ArgumentOutOfRangeException.ThrowIfNegativeOrZero(MaximumFileNameTableBytes);
33 ArgumentOutOfRangeException.ThrowIfNegativeOrZero(MaximumFileAllocationTableBytes);
34 ArgumentOutOfRangeException.ThrowIfNegativeOrZero(MaximumDirectoryCount);
35 ArgumentOutOfRangeException.ThrowIfNegativeOrZero(MaximumDirectoryDepth);
36 ArgumentOutOfRangeException.ThrowIfNegativeOrZero(MaximumOverlayCount);
37 ArgumentOutOfRangeException.ThrowIfNegativeOrZero(MaximumBannerBytes);
38 }
39}
Controls resource limits applied while parsing an image.
int MaximumOverlayCount
Bounds entries decoded independently from each ARM9 or ARM7 overlay table.
int MaximumFileAllocationTableBytes
Limits bytes allocated for the FAT, whose eight-byte records map file IDs to image regions.
int MaximumFileNameTableBytes
Limits bytes allocated for the NitroFS FNT before any names or directory links are decoded.
int MaximumBannerBytes
Bounds banner allocation before its version field selects a smaller, exact supported layout.
int MaximumDirectoryDepth
Bounds recursive FNT traversal so cyclic or adversarial directory trees cannot exhaust the call stack...
static NdsReadOptions Default
Supplies conservative allocation and recursion ceilings suitable for untrusted retail-sized images.
int MaximumDirectoryCount
Caps reachable FNT directory records and may not exceed the format's 4,096-ID namespace.