diff --git a/BurnOutSharp.Models/LinearExecutable/Enums.cs b/BurnOutSharp.Models/LinearExecutable/Enums.cs index e83194d8..a472ee72 100644 --- a/BurnOutSharp.Models/LinearExecutable/Enums.cs +++ b/BurnOutSharp.Models/LinearExecutable/Enums.cs @@ -64,6 +64,42 @@ namespace BurnOutSharp.Models.LinearExecutable MIPSMarkIII = 0x42, } + public enum DirectiveNumber : ushort + { + /// + /// Resident Flag Mask. + /// + /// + /// Directive numbers with this bit set indicate that the directive data + /// is in the resident area and will be kept resident in memory when the + /// module is loaded. + /// + ResidentFlagMask = 0x8000, + + /// + /// Verify Record Directive. (Verify record is a resident table.) + /// + VerifyRecordDirective = 0x8001, + + /// + /// Language Information Directive. (This is a non-resident table.) + /// + LanguageInformationDirective = 0x0002, + + /// + /// Co-Processor Required Support Table. + /// + CoProcessorRequiredSupportTable = 0x0003, + + /// + /// Thread State Initialization Directive. + /// + ThreadStateInitializationDirective = 0x0004, + + // Additional directives can be added as needed in the future, as long as + // they do not overlap previously defined directive numbers. + } + [Flags] public enum ModuleFlags : uint { diff --git a/BurnOutSharp.Models/LinearExecutable/Executable.cs b/BurnOutSharp.Models/LinearExecutable/Executable.cs index c4141c92..732b53da 100644 --- a/BurnOutSharp.Models/LinearExecutable/Executable.cs +++ b/BurnOutSharp.Models/LinearExecutable/Executable.cs @@ -43,7 +43,12 @@ namespace BurnOutSharp.Models.LinearExecutable public ResidentNameTableEntry[] ResidentNameTable { get; set; } // TODO: Entry table - // TODO: Module format directives table + + /// + /// Module format directives table (optional) + /// + public ModuleFormatDirectivesTableEntry[] ModuleFormatDirectivesTable { get; set; } + // TODO: Resident directives data // TODO: Per-page checksum table // TODO: Fix-up page table diff --git a/BurnOutSharp.Models/LinearExecutable/ModuleFormatDirectivesTableEntry.cs b/BurnOutSharp.Models/LinearExecutable/ModuleFormatDirectivesTableEntry.cs new file mode 100644 index 00000000..8d25b458 --- /dev/null +++ b/BurnOutSharp.Models/LinearExecutable/ModuleFormatDirectivesTableEntry.cs @@ -0,0 +1,48 @@ +using System.Runtime.InteropServices; + +namespace BurnOutSharp.Models.LinearExecutable +{ + /// + /// The Module Format Directives Table is an optional table that allows additional + /// options to be specified. It also allows for the extension of the linear EXE + /// format by allowing additional tables of information to be added to the linear + /// EXE module without affecting the format of the linear EXE header. Likewise, + /// module format directives provide a place in the linear EXE module for + /// 'temporary tables' of information, such as incremental linking information + /// and statistic information gathered on the module. When there are no module + /// format directives for a linear EXE module, the fields in the linear EXE header + /// referencing the module format directives table are zero. + /// + /// + /// + [StructLayout(LayoutKind.Sequential)] + public class ModuleFormatDirectivesTableEntry + { + /// + /// Directive number. + /// + /// + /// The directive number specifies the type of directive defined. This can be + /// used to determine the format of the information in the directive data. + /// + public DirectiveNumber DirectiveNumber; + + /// + /// Directive data length. + /// + /// + /// This specifies the length in byte of the directive data for this directive number. + /// + public ushort DirectiveDataLength; + + /// + /// Directive data offset. + /// + /// + /// This is the offset to the directive data for this directive number. It is relative + /// to beginning of linear EXE header for a resident table, and relative to the + /// beginning of the EXE file for non-resident tables. + /// + public uint DirectiveDataOffset; + } +}