NdsForge.NET 1.0.1
Read, validate, edit, compare, and build Nintendo DS and DSi images from .NET
Loading...
Searching...
No Matches
NdsProgramDefinition.cs
1namespace NdsForge;
2
11public sealed class NdsProgramDefinition
12{
14 private ReadOnlyMemory<byte> _footer;
15
22 NdsProcessor processor,
23 ReadOnlySpan<byte> contents,
24 uint loadAddress,
25 uint entryAddress)
26 {
27 Processor = processor;
28 Contents = contents.ToArray();
29 LoadAddress = loadAddress;
30 EntryAddress = entryAddress;
31 }
32
34 public NdsProcessor Processor { get; }
35
37 public ReadOnlyMemory<byte> Contents { get; }
38
40 public uint LoadAddress { get; }
41
43 public uint EntryAddress { get; }
44
46 public ReadOnlyMemory<byte> Footer => _footer;
47
52 public NdsProgramDefinition SetFooter(ReadOnlySpan<byte> footer)
53 {
54 if (Processor != NdsProcessor.Arm9 || footer.Length != 12 || NdsBinary.ReadUInt32(footer, 0) != 0xDEC00621)
55 {
56 throw new InvalidDataException("An SDK footer must be a 12-byte ARM9 footer beginning with 0xDEC00621.");
57 }
58
59 _footer = footer.ToArray();
60 return this;
61 }
62}
uint LoadAddress
Specifies the first runtime address receiving payload bytes; it is not a ROM offset.
ReadOnlyMemory< byte > Footer
Contains the optional 12-byte ARM9 SDK footer beginning with marker 0xDEC00621.
ReadOnlyMemory< byte > Contents
Contains the exact cartridge payload in definition-owned, externally immutable memory.
uint EntryAddress
Specifies the first instruction address and must be meaningful for the selected processor mode.
NdsProcessor Processor
Distinguishes ARM9, ARM7, ARM9i, and ARM7i address spaces and header tuples.
NdsProgramDefinition SetFooter(ReadOnlySpan< byte > footer)
Attaches a recognized SDK footer immediately after ARM9 while retaining its separate structural ident...
NdsProgramDefinition(NdsProcessor processor, ReadOnlySpan< byte > contents, uint loadAddress, uint entryAddress)
Captures exact executable bytes together with their runtime identity and addresses.
NdsProcessor
Identifies a processor and execution mode.