mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-09-22 14:55:11 +00:00
Libraries
This change looks dramatic, but it's just separating out the already-split namespaces into separate top-level folders. In theory, every single one could be built into their own Nuget package. `SabreTools.Serialization` still builds the normal Nuget package that is used by all other projects and includes all namespaces.
This commit is contained in:
99
SabreTools.Data.Models/XboxExecutable/Certificate.cs
Normal file
99
SabreTools.Data.Models/XboxExecutable/Certificate.cs
Normal file
@@ -0,0 +1,99 @@
|
||||
namespace SabreTools.Data.Models.XboxExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// XBox Executable certificate
|
||||
/// </summary>
|
||||
/// <see href="https://www.caustik.com/cxbx/download/xbe.htm"/>
|
||||
/// <see href="https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/master/src/common/xbe/Xbe.h"/>
|
||||
public class Certificate
|
||||
{
|
||||
/// <summary>
|
||||
/// Number of bytes that should be reserved for this certificate.
|
||||
/// </summary>
|
||||
public uint SizeOfCertificate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Time and Date when this certificate was created. Standard windows format.
|
||||
/// </summary>
|
||||
public uint TimeDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Title ID for this application. This field doesn't appear to matter with
|
||||
/// unsigned code, so it can be set to zero.
|
||||
/// </summary>
|
||||
public uint TitleID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Title name for this application (i.e. L"The Simpsons Road Rage").
|
||||
/// This buffer contains enough room for 40 Unicode characters.
|
||||
/// </summary>
|
||||
public byte[] TitleName { get; set; } = new byte[0x50];
|
||||
|
||||
/// <summary>
|
||||
/// Alternate Title IDs (16 4-byte DWORDs) for this certificate. These do not appear
|
||||
/// to matter with unsigned code (or signed code, for that matter), so they can all
|
||||
/// be set to zero.
|
||||
/// </summary>
|
||||
public uint[] AlternativeTitleIDs { get; set; } = new uint[16];
|
||||
|
||||
/// <summary>
|
||||
/// Allowed media types for this .XBE.
|
||||
/// </summary>
|
||||
public AllowedMediaTypes AllowedMediaTypes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Game region for this .XBE.
|
||||
/// </summary>
|
||||
public GameRegion GameRegion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Game ratings for this .XBE. It is typically safe to set this to 0xFFFFFFFF.
|
||||
/// </summary>
|
||||
public uint GameRatings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Disk Number. Typically zero.
|
||||
/// </summary>
|
||||
public uint DiskNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Certificate Version.
|
||||
/// </summary>
|
||||
public uint Version { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 16-byte LAN Key. An unsigned .XBE can just zero these out.
|
||||
/// </summary>
|
||||
public byte[] LANKey { get; set; } = new byte[16];
|
||||
|
||||
/// <summary>
|
||||
/// 16-byte Signature Key. An unsigned .XBE can just zero these out.
|
||||
/// </summary>
|
||||
public byte[] SignatureKey { get; set; } = new byte[16];
|
||||
|
||||
/// <summary>
|
||||
/// 16 x 16-byte Signature Keys. An unsigned .XBE can just zero these out.
|
||||
/// </summary>
|
||||
public byte[][] AlternateSignatureKeys { get; set; } = new byte[16][];
|
||||
|
||||
/// <summary>
|
||||
/// Original Certificate Size?
|
||||
/// </summary>
|
||||
public uint OriginalCertificateSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Online Service ID
|
||||
/// </summary>
|
||||
public uint OnlineService { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Extra Security Flags
|
||||
/// </summary>
|
||||
public uint SecurityFlags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Code Encryption Key?
|
||||
/// </summary>
|
||||
public byte[] CodeEncKey { get; set; } = new byte[16];
|
||||
}
|
||||
}
|
||||
22
SabreTools.Data.Models/XboxExecutable/Constants.cs
Normal file
22
SabreTools.Data.Models/XboxExecutable/Constants.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
namespace SabreTools.Data.Models.XboxExecutable
|
||||
{
|
||||
/// <see href="https://www.caustik.com/cxbx/download/xbe.htm"/>
|
||||
/// <see href="https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/master/src/common/xbe/Xbe.h"/>
|
||||
public static class Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// XBox Executable magic number ("XBEH")
|
||||
/// </summary>
|
||||
public static readonly byte[] MagicBytes = [0x58, 0x42, 0x45, 0x48];
|
||||
|
||||
/// <summary>
|
||||
/// XBox Executable magic number ("XBEH")
|
||||
/// </summary>
|
||||
public const string MagicString = "XBEH";
|
||||
|
||||
/// <summary>
|
||||
/// XBox Executable magic number ("XBEH")
|
||||
/// </summary>
|
||||
public const uint MagicUInt32 = 0x48454258;
|
||||
}
|
||||
}
|
||||
89
SabreTools.Data.Models/XboxExecutable/Enums.cs
Normal file
89
SabreTools.Data.Models/XboxExecutable/Enums.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using System;
|
||||
|
||||
namespace SabreTools.Data.Models.XboxExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// Allowed media types for this .XBE
|
||||
/// </summary>
|
||||
/// <see href="https://www.caustik.com/cxbx/download/xbe.htm"/>
|
||||
/// <see href="https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/master/src/common/xbe/Xbe.h"/>
|
||||
[Flags]
|
||||
public enum AllowedMediaTypes : uint
|
||||
{
|
||||
HARD_DISK = 0x00000001,
|
||||
DVD_X2 = 0x00000002,
|
||||
DVD_CD = 0x00000004,
|
||||
CD = 0x00000008,
|
||||
DVD_5_RO = 0x00000010,
|
||||
DVD_9_RO = 0x00000020,
|
||||
DVD_5_RW = 0x00000040,
|
||||
DVD_9_RW = 0x00000080,
|
||||
DONGLE = 0x00000100,
|
||||
MEDIA_BOARD = 0x00000200,
|
||||
NONSECURE_HARD_DISK = 0x40000000,
|
||||
NONSECURE_MODE = 0x80000000,
|
||||
MEDIA_MASK = 0x00FFFFFF,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Game region for this .XBE
|
||||
/// </summary>
|
||||
/// <see href="https://www.caustik.com/cxbx/download/xbe.htm"/>
|
||||
/// <see href="https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/master/src/common/xbe/Xbe.h"/>
|
||||
[Flags]
|
||||
public enum GameRegion : uint
|
||||
{
|
||||
NA = 0x00000001,
|
||||
JAPAN = 0x00000002,
|
||||
RESTOFWORLD = 0x00000004,
|
||||
MANUFACTURING = 0x80000000,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Various flags for this .XBE file
|
||||
/// </summary>
|
||||
/// <see href="https://www.caustik.com/cxbx/download/xbe.htm"/>
|
||||
/// <see href="https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/master/src/common/xbe/Xbe.h"/>
|
||||
[Flags]
|
||||
public enum InitializationFlags : uint
|
||||
{
|
||||
MountUtilityDrive = 0x00000001,
|
||||
FormatUtilityDrive = 0x00000002,
|
||||
Limit64Megabytes = 0x00000004,
|
||||
DontSetupHarddisk = 0x00000008,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Various flags for this library
|
||||
/// </summary>
|
||||
/// <see href="https://www.caustik.com/cxbx/download/xbe.htm"/>
|
||||
/// <see href="https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/master/src/common/xbe/Xbe.h"/>
|
||||
[Flags]
|
||||
public enum LibraryFlags : ushort
|
||||
{
|
||||
/// <remarks>13-Bit Mask</remarks>
|
||||
QFEVersion = 0x1FFF,
|
||||
|
||||
/// <remarks>02-Bit Mask</remarks>
|
||||
Approved = 0x6000,
|
||||
|
||||
/// <remarks>01-Bit Mask</remarks>
|
||||
DebugBuild = 0x8000,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Various flags for this .XBE section
|
||||
/// </summary>
|
||||
/// <see href="https://www.caustik.com/cxbx/download/xbe.htm"/>
|
||||
/// <see href="https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/master/src/common/xbe/Xbe.h"/>
|
||||
[Flags]
|
||||
public enum SectionFlags : uint
|
||||
{
|
||||
Writable = 0x00000001,
|
||||
Preload = 0x00000002,
|
||||
Executable = 0x00000004,
|
||||
InsertedFile = 0x00000008,
|
||||
HeadPageReadOnly = 0x00000010,
|
||||
TailPageReadOnly = 0x00000020,
|
||||
}
|
||||
}
|
||||
45
SabreTools.Data.Models/XboxExecutable/Executable.cs
Normal file
45
SabreTools.Data.Models/XboxExecutable/Executable.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
namespace SabreTools.Data.Models.XboxExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// XBox Executable format
|
||||
/// </summary>
|
||||
/// <see href="https://www.caustik.com/cxbx/download/xbe.htm"/>
|
||||
/// <see href="https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/master/src/common/xbe/Xbe.h"/>
|
||||
public class Executable
|
||||
{
|
||||
/// <summary>
|
||||
/// XBE header
|
||||
/// </summary>
|
||||
public Header? Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Certificate structure pointed to by <see cref="Header.CertificateAddress"/>
|
||||
/// </summary>
|
||||
public Certificate? Certificate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Section headers pointed to by <see cref="Header.SectionHeadersAddress"/>
|
||||
/// </summary>
|
||||
public SectionHeader[] SectionHeaders { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Thread Local Storage (TLS) structure pointed to by <see cref="Header.TLSAddress"/>
|
||||
/// </summary>
|
||||
public ThreadLocalStorage? ThreadLocalStorage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Library versions pointed to by <see cref="Header.LibraryVersionsAddress"/>
|
||||
/// </summary>
|
||||
public LibraryVersion[] LibraryVersions { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Kernel library version pointed to by <see cref="Header.KernelLibraryVersionAddress"/>
|
||||
/// </summary>
|
||||
public LibraryVersion? KernelLibraryVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// XAPI library version pointed to by <see cref="Header.XAPILibraryVersionAddress"/>
|
||||
/// </summary>
|
||||
public LibraryVersion? XAPILibraryVersion { get; set; }
|
||||
}
|
||||
}
|
||||
215
SabreTools.Data.Models/XboxExecutable/Header.cs
Normal file
215
SabreTools.Data.Models/XboxExecutable/Header.cs
Normal file
@@ -0,0 +1,215 @@
|
||||
namespace SabreTools.Data.Models.XboxExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// XBox Executable format header
|
||||
/// </summary>
|
||||
/// <see href="https://www.caustik.com/cxbx/download/xbe.htm"/>
|
||||
/// <see href="https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/master/src/common/xbe/Xbe.h"/>
|
||||
public class Header
|
||||
{
|
||||
/// <summary>
|
||||
/// "XBEH"
|
||||
/// </summary>
|
||||
public byte[] MagicNumber { get; set; } = new byte[4];
|
||||
|
||||
/// <summary>
|
||||
/// This is where a game is signed. Only on officially signed games is this field worthwhile.
|
||||
/// </summary>
|
||||
/// <remarks>256 bytes</remarks>
|
||||
public byte[] DigitalSignature { get; set; } = new byte[256];
|
||||
|
||||
/// <summary>
|
||||
/// Address at which to load this .XBE. Typically this will be 0x00010000.
|
||||
/// </summary>
|
||||
public uint BaseAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of bytes that should be reserved for headers.
|
||||
/// </summary>
|
||||
public uint SizeOfHeaders { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of bytes that should be reserved for this image.
|
||||
/// </summary>
|
||||
public uint SizeOfImage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of bytes that should be reserved for image header.
|
||||
/// </summary>
|
||||
public uint SizeOfImageHeader { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Time and Date when this image was created. Standard windows format.
|
||||
/// </summary>
|
||||
public uint TimeDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address to a Certificate structure, after the .XBE is loaded into memory.
|
||||
/// </summary>
|
||||
public uint CertificateAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of sections contained in this .XBE.
|
||||
/// </summary>
|
||||
public uint NumberOfSections { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address to an array of SectionHeader structures, after the .XBE is loaded into memory.
|
||||
/// </summary>
|
||||
public uint SectionHeadersAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Various flags for this .XBE file.
|
||||
/// </summary>
|
||||
public InitializationFlags InitializationFlags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address to the Image entry point, after the .XBE is loaded into memory. This is where execution starts.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This value is encoded with an XOR key. Considering this is far too weak to be considered security,
|
||||
/// I assume this XOR is a clever method for discerning between Debug/Retail .XBE files without adding
|
||||
/// another field to the .XBE header. The XOR key is dependant on the build:
|
||||
///
|
||||
/// Debug = 0x94859D4B, Retail = 0xA8FC57AB
|
||||
///
|
||||
/// To decode an entry point, you XOR with the debug key, then check if it is a valid entry point.
|
||||
/// If it is not, then you try again with the retail key.
|
||||
///
|
||||
/// To decode an entry point, you XOR with the debug key, then check if it is a valid entry point.
|
||||
/// If it is not, then you try again with the retail key.
|
||||
///
|
||||
/// Note: The Kernel Image Thunk Address member of this header must also be encoded as described later
|
||||
/// in this document.
|
||||
/// </remarks>
|
||||
public uint EntryPoint { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address to a TLS (Thread Local Storage) structure.
|
||||
/// </summary>
|
||||
public uint TLSAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Copied from the PE file this .XBE was created from.
|
||||
/// </summary>
|
||||
public uint PEStackCommit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Copied from the PE file this .XBE was created from.
|
||||
/// </summary>
|
||||
public uint PEHeapReserve { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Copied from the PE file this .XBE was created from.
|
||||
/// </summary>
|
||||
public uint PEHeapCommit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Copied from the PE file this .XBE was created from.
|
||||
/// </summary>
|
||||
public uint PEBaseAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Copied from the PE file this .XBE was created from.
|
||||
/// </summary>
|
||||
public uint PESizeOfImage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Copied from the PE file this .XBE was created from.
|
||||
/// </summary>
|
||||
public uint PEChecksum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Copied from the PE file this .XBE was created from.
|
||||
/// </summary>
|
||||
public uint PETimeDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address to the debug pathname
|
||||
/// (i.e. "D:\Nightlybuilds\011026.0\code\build\xbox\Release\simpsons.exe")
|
||||
/// </summary>
|
||||
public uint DebugPathNameAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address to the debug filename (i.e. "simpsons.exe")
|
||||
/// </summary>
|
||||
public uint DebugFileNameAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address to the debug unicode filename (i.e. L"simpsons.exe")
|
||||
/// </summary>
|
||||
public uint DebugUnicodeFileNameAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address to the Kernel Image Thunk Table, after the.XBE is loaded into memory.
|
||||
/// This is how .XBE files import kernel functions and data.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This value is encoded with an XOR key. Considering this is far too weak to be considered security,
|
||||
/// I assume this XOR is a clever method for discerning between Debug/Retail .XBE files without adding
|
||||
/// another field to the .XBE header. The XOR key is dependant on the build:
|
||||
///
|
||||
/// Debug = 0xEFB1F152, Retail = 0x5B6D40B6
|
||||
///
|
||||
/// To encode a kernel thunk address, you simply XOR the real address with either Debug or Retail key,
|
||||
/// depending on if you want the XBox to see this as a Debug or Retail executable.
|
||||
///
|
||||
/// To decode a kernel thunk address, you XOR with the debug key, then check if it is a valid address.
|
||||
/// If it is not, then you try again with the retail key.
|
||||
///
|
||||
/// The Kernel Thunk Table itself is simply an array of pointers to Kernel imports. There are 366 possible
|
||||
/// imports, and the table is terminated with a zero dword (0x00000000). Typically the values in this table
|
||||
/// can be generated with the following formula:
|
||||
///
|
||||
/// KernelThunkTable[v] = ImportThunk + 0x80000000;
|
||||
///
|
||||
/// so, for example, the import PsCreateSystemThreadEx, which has a thunk value of 255(0xFF) would be...
|
||||
///
|
||||
/// KernelThunkTable[v] = 0xFF + 0x80000000; // (0x800000FF)
|
||||
///
|
||||
/// When the.XBE is loaded by the OS (or the CXBX Emulator), all kernel imports are replaced by a valid
|
||||
/// function or data type address.In the case of CXBX, the import table entry at which
|
||||
/// (KernelThunkTable[v] & 0x1FF == 0xFF) will be replaced by &cxbx_PsCreateSystemThreadEx (which is
|
||||
/// a wrapper function).
|
||||
///
|
||||
/// Note: The Entry Point member of this header must also be encoded as described earlier in this document.
|
||||
/// </remarks>
|
||||
public uint KernelImageThunkAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address to the Non-Kernel Import Directory. It is typically safe to set this to zero.
|
||||
/// </summary>
|
||||
public uint NonKernelImportDirectoryAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of Library Versions pointed to by Library Versions Address.
|
||||
/// </summary>
|
||||
public uint NumberOfLibraryVersions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address to an array of LibraryVersion structures, after the .XBE is loaded into memory.
|
||||
/// </summary>
|
||||
public uint LibraryVersionsAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address to a LibraryVersion structure, after the .XBE is loaded into memory.
|
||||
/// </summary>
|
||||
public uint KernelLibraryVersionAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address to a LibraryVersion structure, after the .XBE is loaded into memory.
|
||||
/// </summary>
|
||||
public uint XAPILibraryVersionAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address to the Logo Bitmap (Typically a "Microsoft" logo). This field can be set
|
||||
/// to zero, meaning there is no bitmap present.
|
||||
/// </summary>
|
||||
public uint LogoBitmapAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Size (in bytes) of the Logo Bitmap data.
|
||||
/// </summary>
|
||||
public uint LogoBitmapSize { get; set; }
|
||||
}
|
||||
}
|
||||
35
SabreTools.Data.Models/XboxExecutable/LibraryVersion.cs
Normal file
35
SabreTools.Data.Models/XboxExecutable/LibraryVersion.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
namespace SabreTools.Data.Models.XboxExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// XBox Executable library version
|
||||
/// </summary>
|
||||
/// <see href="https://www.caustik.com/cxbx/download/xbe.htm"/>
|
||||
/// <see href="https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/master/src/common/xbe/Xbe.h"/>
|
||||
public class LibraryVersion
|
||||
{
|
||||
/// <summary>
|
||||
/// 8-byte name of this library. (i.e. "XAPILIB")
|
||||
/// </summary>
|
||||
public byte[] LibraryName { get; set; } = new byte[8];
|
||||
|
||||
/// <summary>
|
||||
/// Major version for this library (2-byte WORD).
|
||||
/// </summary>
|
||||
public ushort MajorVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Minor version for this library (2-byte WORD).
|
||||
/// </summary>
|
||||
public ushort MinorVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Build version for this library (2-byte WORD).
|
||||
/// </summary>
|
||||
public ushort BuildVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Various flags for this library.
|
||||
/// </summary>
|
||||
public LibraryFlags LibraryFlags { get; set; }
|
||||
}
|
||||
}
|
||||
61
SabreTools.Data.Models/XboxExecutable/SectionHeader.cs
Normal file
61
SabreTools.Data.Models/XboxExecutable/SectionHeader.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
namespace SabreTools.Data.Models.XboxExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// XBox Executable format section header
|
||||
/// </summary>
|
||||
/// <see href="https://www.caustik.com/cxbx/download/xbe.htm"/>
|
||||
/// <see href="https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/master/src/common/xbe/Xbe.h"/>
|
||||
/// <see cref="COFF.SectionHeader"/>
|
||||
public class SectionHeader
|
||||
{
|
||||
/// <summary>
|
||||
/// Various flags for this .XBE section.
|
||||
/// </summary>
|
||||
public SectionFlags SectionFlags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address of memory to load this section at.
|
||||
/// </summary>
|
||||
public uint VirtualAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of bytes in memory to fill with this section.
|
||||
/// </summary>
|
||||
public uint VirtualSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// File address where this section resides in the .XBE file.
|
||||
/// </summary>
|
||||
public uint RawAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of bytes of this section that exist in the .XBE file.
|
||||
/// </summary>
|
||||
public uint RawSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address to the name for this section, after the .XBE is loaded into memory.
|
||||
/// </summary>
|
||||
public uint SectionNameAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// It is typically safe to set this to zero.
|
||||
/// </summary>
|
||||
public uint SectionNameReferenceCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// It is typically safe to set this to point to a 2-byte WORD in memory with value zero.
|
||||
/// </summary>
|
||||
public uint HeadSharedPageReferenceCountAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// It is typically safe to set this to point to a 2-byte WORD in memory with value zero.
|
||||
/// </summary>
|
||||
public uint TailSharedPageReferenceCountAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 20-byte digest for this section. For unsigned .XBE files, it is safe to set this to zeros.
|
||||
/// </summary>
|
||||
public byte[] SectionDigest { get; set; } = new byte[20];
|
||||
}
|
||||
}
|
||||
40
SabreTools.Data.Models/XboxExecutable/ThreadLocalStorage.cs
Normal file
40
SabreTools.Data.Models/XboxExecutable/ThreadLocalStorage.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
namespace SabreTools.Data.Models.XboxExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// XBox Executable thread-local storage
|
||||
/// </summary>
|
||||
/// <see href="https://www.caustik.com/cxbx/download/xbe.htm"/>
|
||||
/// <see href="https://github.com/Cxbx-Reloaded/Cxbx-Reloaded/blob/master/src/common/xbe/Xbe.h"/>
|
||||
public class ThreadLocalStorage
|
||||
{
|
||||
/// <summary>
|
||||
/// Address, after the .XBE is loaded into memory, of this .XBE's TLS Data.
|
||||
/// </summary>
|
||||
public uint DataStartAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address, after the .XBE is loaded into memory, of the end of this XBE's TLS Data.
|
||||
/// </summary>
|
||||
public uint DataEndAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address, after the .XBE is loaded into memory, of this XBE's TLS Index.
|
||||
/// </summary>
|
||||
public uint TLSIndexAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Address, after the .XBE is loaded into memory, of this XBE's TLS Callback.
|
||||
/// </summary>
|
||||
public uint TLSCallbackAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Size of Zero Fill
|
||||
/// </summary>
|
||||
public uint SizeOfZeroFill { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Various TLS characteristics.
|
||||
/// </summary>
|
||||
public uint Characteristics { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user