mirror of
https://github.com/SabreTools/SabreTools.Models.git
synced 2026-02-04 21:30:19 +00:00
Compare commits
244 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0130a9caee | ||
|
|
da204f129f | ||
|
|
945a62d1f2 | ||
|
|
8ab5088607 | ||
|
|
9e9fcac654 | ||
|
|
76dac1025c | ||
|
|
0ec1cac7cf | ||
|
|
6a0b97fdcd | ||
|
|
66f7adc49a | ||
|
|
4bc685ba23 | ||
|
|
89ef827251 | ||
|
|
beb42b7e35 | ||
|
|
0502808962 | ||
|
|
e3411d3984 | ||
|
|
9d13cb01e3 | ||
|
|
649ea98a52 | ||
|
|
b90d7c5e9a | ||
|
|
9def156302 | ||
|
|
e1db4fc17b | ||
|
|
ae4ad5c272 | ||
|
|
5bda523aec | ||
|
|
eda099d44e | ||
|
|
b5ac9304a4 | ||
|
|
b40f84dd4b | ||
|
|
4a276fb65e | ||
|
|
973a94b340 | ||
|
|
c6062f71eb | ||
|
|
fd7746fae3 | ||
|
|
d3c6bdf23f | ||
|
|
605a3bf30d | ||
|
|
710ddc912d | ||
|
|
2f94464b7d | ||
|
|
b3d9bd3d6b | ||
|
|
c51c16ed2d | ||
|
|
978b6904db | ||
|
|
d62bd2f60c | ||
|
|
26f7f4d7da | ||
|
|
50a6f9ba89 | ||
|
|
f07c11fb47 | ||
|
|
dc47f64ee6 | ||
|
|
69006247a9 | ||
|
|
9c43b80502 | ||
|
|
cbb7563724 | ||
|
|
c7530884b3 | ||
|
|
e59c9205d4 | ||
|
|
f5859638c2 | ||
|
|
84d3740e73 | ||
|
|
517324ab58 | ||
|
|
a02c037995 | ||
|
|
a1890e1fe6 | ||
|
|
32c6633788 | ||
|
|
81b53c9785 | ||
|
|
54c05f2746 | ||
|
|
4a4d7ceddf | ||
|
|
0f029c5979 | ||
|
|
bb4fee91d9 | ||
|
|
ed56e2543d | ||
|
|
d675673e50 | ||
|
|
ebee967c7f | ||
|
|
f5da54eaac | ||
|
|
2350c1af27 | ||
|
|
454d507b41 | ||
|
|
10de4acbb9 | ||
|
|
8ec91d8d04 | ||
|
|
1d62d69a53 | ||
|
|
5b5fed8932 | ||
|
|
32123d4b80 | ||
|
|
f5717c3929 | ||
|
|
e8db261d73 | ||
|
|
9557f43dab | ||
|
|
51b9c1a016 | ||
|
|
bb3cd54865 | ||
|
|
0c6060a901 | ||
|
|
c18770f627 | ||
|
|
c2a5d6770c | ||
|
|
4ef79ccdca | ||
|
|
cf5135f330 | ||
|
|
6d989209db | ||
|
|
cc48593646 | ||
|
|
415d571b65 | ||
|
|
4a6e244b38 | ||
|
|
771a39517f | ||
|
|
b072a3809c | ||
|
|
341585206a | ||
|
|
2dc2ab5dd1 | ||
|
|
144a3ce52b | ||
|
|
85199789f7 | ||
|
|
fb39216c82 | ||
|
|
1a2de39868 | ||
|
|
f18b6c8850 | ||
|
|
8f1e49e464 | ||
|
|
6547242f93 | ||
|
|
edf00f3ab2 | ||
|
|
bce4736037 | ||
|
|
81f28974c0 | ||
|
|
30ebe84af4 | ||
|
|
b07fbdedd6 | ||
|
|
cd8fff4a86 | ||
|
|
3d3275e3cb | ||
|
|
4c76ce1230 | ||
|
|
0c4e3b4bf2 | ||
|
|
e8f4386199 | ||
|
|
ab66ccf3c5 | ||
|
|
cc60d54a33 | ||
|
|
e805f4cb9a | ||
|
|
328c893a38 | ||
|
|
ab2a12c996 | ||
|
|
362b123661 | ||
|
|
4a8a4746a2 | ||
|
|
3f368a3be8 | ||
|
|
2749c2f5bd | ||
|
|
41ce962700 | ||
|
|
85b7103bd3 | ||
|
|
4c61a191e8 | ||
|
|
0f70598969 | ||
|
|
d6b057d808 | ||
|
|
3d8036e7b5 | ||
|
|
bb35946866 | ||
|
|
78f9f1b36f | ||
|
|
9d1b1ca36d | ||
|
|
6e1f8bf55e | ||
|
|
a19afc240c | ||
|
|
148e97ef64 | ||
|
|
676b446025 | ||
|
|
aeff75d8d3 | ||
|
|
e20e515f56 | ||
|
|
bf02266f0f | ||
|
|
b521e503c2 | ||
|
|
48e79d26ed | ||
|
|
989ef41c6d | ||
|
|
6b0c4c3024 | ||
|
|
4b54d0f4dc | ||
|
|
2bc1cfc5d0 | ||
|
|
362abfdc64 | ||
|
|
a06ff8f8b3 | ||
|
|
7269e91913 | ||
|
|
c118271565 | ||
|
|
71ccbc6ab1 | ||
|
|
ed5c1a7173 | ||
|
|
0451af3eb4 | ||
|
|
7967eb29eb | ||
|
|
6bbe904cc3 | ||
|
|
dce9d98885 | ||
|
|
f862e018fb | ||
|
|
b4a5154da8 | ||
|
|
077aa3c57e | ||
|
|
ea8630ba8c | ||
|
|
385491c67b | ||
|
|
f57461e0c3 | ||
|
|
18f49ac43f | ||
|
|
28fd81adab | ||
|
|
ecca68822d | ||
|
|
58c2dcbe4f | ||
|
|
f9b8717abb | ||
|
|
6a356a5874 | ||
|
|
88c6a0302f | ||
|
|
5282db965f | ||
|
|
33217a7efe | ||
|
|
c8583589d6 | ||
|
|
6ed2b406d7 | ||
|
|
4b08e0f5dd | ||
|
|
e8259fed12 | ||
|
|
d06df28f72 | ||
|
|
f73ff87922 | ||
|
|
dd6b79a21b | ||
|
|
d3daa2c4aa | ||
|
|
1620d00edf | ||
|
|
5565fa2fc3 | ||
|
|
e088e203ea | ||
|
|
acc8d95930 | ||
|
|
1a76c59827 | ||
|
|
8725ec0337 | ||
|
|
8991cc460d | ||
|
|
98ce8b65ec | ||
|
|
ca58343c30 | ||
|
|
2f637e0012 | ||
|
|
80172942fd | ||
|
|
aa0960b42f | ||
|
|
2554f64277 | ||
|
|
4c5c960915 | ||
|
|
1cb49163dd | ||
|
|
d144dd47a1 | ||
|
|
c4247c7ccb | ||
|
|
1e77437167 | ||
|
|
3d79e07d76 | ||
|
|
9d50d577ab | ||
|
|
494ca175fb | ||
|
|
73b3d4a7a8 | ||
|
|
bd40158423 | ||
|
|
149a45d871 | ||
|
|
e18d8d7543 | ||
|
|
38f0d4aef5 | ||
|
|
3959993255 | ||
|
|
00df5bdd6e | ||
|
|
00c087d8e0 | ||
|
|
6bc948784a | ||
|
|
c4f14854c2 | ||
|
|
adaac68898 | ||
|
|
a9bc4a2bfe | ||
|
|
262b91de65 | ||
|
|
62bd6a4bde | ||
|
|
7f14f0c5b0 | ||
|
|
33d63fddae | ||
|
|
209be57bf4 | ||
|
|
a1581e9d9b | ||
|
|
521664d5a8 | ||
|
|
73a8d91a83 | ||
|
|
438e87f833 | ||
|
|
2cdedbb456 | ||
|
|
b57a545598 | ||
|
|
8dc6eb2eee | ||
|
|
b58436d71a | ||
|
|
925c20021f | ||
|
|
9bebf95599 | ||
|
|
089e13ca03 | ||
|
|
de07b3b0dd | ||
|
|
22cb5360e6 | ||
|
|
a422ec7e6d | ||
|
|
f60afd6368 | ||
|
|
b8f67a8ab0 | ||
|
|
d844a8b582 | ||
|
|
8583baa862 | ||
|
|
8f3be17850 | ||
|
|
5856967794 | ||
|
|
8f78c73c6f | ||
|
|
af4ff3d383 | ||
|
|
3e638a5c57 | ||
|
|
638d0226c1 | ||
|
|
07c6d5b43a | ||
|
|
108e63a099 | ||
|
|
c636d3252b | ||
|
|
b19dbf2254 | ||
|
|
111b84170c | ||
|
|
2d7df0d4fb | ||
|
|
aba02663e5 | ||
|
|
594fec923a | ||
|
|
b5cf4e870d | ||
|
|
e6976796c2 | ||
|
|
295d8c7612 | ||
|
|
4dd184583c | ||
|
|
081c9c9245 | ||
|
|
b974380ccf | ||
|
|
41ed2cbc9a | ||
|
|
2cfcb49e35 |
@@ -1,4 +1,4 @@
|
||||
name: Nuget Pack
|
||||
name: Build and Test
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -16,25 +16,22 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: |
|
||||
6.0.x
|
||||
8.0.x
|
||||
9.0.x
|
||||
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
|
||||
- name: Pack
|
||||
run: dotnet pack
|
||||
- name: Run tests
|
||||
run: dotnet test
|
||||
|
||||
- name: Upload build
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: 'Nuget Package'
|
||||
path: 'bin/Release/*.nupkg'
|
||||
- name: Run publish script
|
||||
run: ./publish-nix.sh
|
||||
|
||||
- name: Upload to rolling
|
||||
uses: ncipollo/release-action@v1.14.0
|
||||
with:
|
||||
allowUpdates: True
|
||||
artifacts: 'bin/Release/*.nupkg'
|
||||
artifacts: "*.nupkg,*.snupkg"
|
||||
body: 'Last built commit: ${{ github.sha }}'
|
||||
name: 'Rolling Release'
|
||||
prerelease: True
|
||||
10
.github/workflows/check_pr.yml
vendored
10
.github/workflows/check_pr.yml
vendored
@@ -11,7 +11,13 @@ jobs:
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: |
|
||||
6.0.x
|
||||
8.0.x
|
||||
9.0.x
|
||||
|
||||
- name: Build
|
||||
run: dotnet build
|
||||
run: dotnet build
|
||||
|
||||
- name: Run tests
|
||||
run: dotnet test
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.ArchiveDotOrg
|
||||
{
|
||||
[XmlRoot("files")]
|
||||
public class Files
|
||||
{
|
||||
[XmlElement("file")]
|
||||
public File?[]? File { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
namespace SabreTools.Models.BSP
|
||||
{
|
||||
public static class Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// Number of lumps in a BSP
|
||||
/// </summary>
|
||||
public const int HL_BSP_LUMP_COUNT = 15;
|
||||
|
||||
/// <summary>
|
||||
/// Index for the entities lump
|
||||
/// </summary>
|
||||
public const int HL_BSP_LUMP_ENTITIES = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Index for the texture data lump
|
||||
/// </summary>
|
||||
public const int HL_BSP_LUMP_TEXTUREDATA = 2;
|
||||
|
||||
/// <summary>
|
||||
/// Number of valid mipmap levels
|
||||
/// </summary>
|
||||
public const int HL_BSP_MIPMAP_COUNT = 4;
|
||||
}
|
||||
}
|
||||
29
BSP/File.cs
29
BSP/File.cs
@@ -1,29 +0,0 @@
|
||||
namespace SabreTools.Models.BSP
|
||||
{
|
||||
/// <summary>
|
||||
/// Half-Life Level
|
||||
/// </summary>
|
||||
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/BSPFile.h"/>
|
||||
public sealed class File
|
||||
{
|
||||
/// <summary>
|
||||
/// Header data
|
||||
/// </summary>
|
||||
public Header? Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Lumps
|
||||
/// </summary>
|
||||
public Lump?[]? Lumps { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Texture header data
|
||||
/// </summary>
|
||||
public TextureHeader? TextureHeader { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Textures
|
||||
/// </summary>
|
||||
public Texture?[]? Textures { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace SabreTools.Models.BSP
|
||||
{
|
||||
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/BSPFile.h"/>
|
||||
public sealed class Header
|
||||
{
|
||||
/// <summary>
|
||||
/// Version
|
||||
/// </summary>
|
||||
public uint Version { get; set; }
|
||||
}
|
||||
}
|
||||
16
BSP/Lump.cs
16
BSP/Lump.cs
@@ -1,16 +0,0 @@
|
||||
namespace SabreTools.Models.BSP
|
||||
{
|
||||
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/BSPFile.h"/>
|
||||
public sealed class Lump
|
||||
{
|
||||
/// <summary>
|
||||
/// Offset
|
||||
/// </summary>
|
||||
public uint Offset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Length
|
||||
/// </summary>
|
||||
public uint Length { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
namespace SabreTools.Models.BSP
|
||||
{
|
||||
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/BSPFile.h"/>
|
||||
public sealed class Texture
|
||||
{
|
||||
/// <summary>
|
||||
/// Name
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Width
|
||||
/// </summary>
|
||||
public uint Width { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Height
|
||||
/// </summary>
|
||||
public uint Height { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Offsets
|
||||
/// </summary>
|
||||
public uint[]? Offsets { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Texture data
|
||||
/// </summary>
|
||||
public byte[]? TextureData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Palette size
|
||||
/// </summary>
|
||||
public uint PaletteSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Palette data
|
||||
/// </summary>
|
||||
public byte[]? PaletteData { get; set; }
|
||||
}
|
||||
}
|
||||
42
CHD/Enums.cs
42
CHD/Enums.cs
@@ -1,42 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace SabreTools.Models.CHD
|
||||
{
|
||||
/// <see href="https://github.com/mamedev/mame/blob/master/src/lib/util/chd.h"/>
|
||||
public enum CompressionType : uint
|
||||
{
|
||||
#region V1
|
||||
|
||||
CHDCOMPRESSION_NONE = 0,
|
||||
CHDCOMPRESSION_ZLIB = 1,
|
||||
|
||||
#endregion
|
||||
|
||||
#region V3
|
||||
|
||||
CHDCOMPRESSION_ZLIB_PLUS = 2,
|
||||
|
||||
#endregion
|
||||
|
||||
#region V4
|
||||
|
||||
CHDCOMPRESSION_AV = 3,
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <see href="https://github.com/mamedev/mame/blob/master/src/lib/util/chd.h"/>
|
||||
[Flags]
|
||||
public enum Flags : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// Set if this drive has a parent
|
||||
/// </summary>
|
||||
DriveHasParent = 0x00000001,
|
||||
|
||||
/// <summary>
|
||||
/// Set if this drive allows writes
|
||||
/// </summary>
|
||||
DriveAllowsWrites = 0x00000002,
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.LZ
|
||||
{
|
||||
public static class Constants
|
||||
{
|
||||
public const int GETLEN = 2048;
|
||||
|
||||
public const int LZ_MAGIC_LEN = 8;
|
||||
|
||||
public const int LZ_HEADER_LEN = 14;
|
||||
|
||||
public static readonly byte[] MagicBytes = new byte[] { 0x53, 0x5a, 0x44, 0x44, 0x88, 0xf0, 0x27, 0x33 };
|
||||
|
||||
public static readonly string MagicString = System.Text.Encoding.ASCII.GetString(MagicBytes);
|
||||
|
||||
public const ulong MagicUInt64 = 0x3327f08844445a53;
|
||||
|
||||
public const int LZ_TABLE_SIZE = 0x1000;
|
||||
|
||||
public const int MAX_LZSTATES = 16;
|
||||
|
||||
public const int LZ_MIN_HANDLE = 0x400;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.LZ
|
||||
{
|
||||
/// <see href="https://github.com/wine-mirror/wine/blob/master/include/lzexpand.h"/>
|
||||
public enum LZERROR
|
||||
{
|
||||
LZERROR_OK = 1,
|
||||
LZERROR_NOT_LZ = 0,
|
||||
LZERROR_BADINHANDLE = -1,
|
||||
LZERROR_BADOUTHANDLE = -2,
|
||||
LZERROR_READ = -3,
|
||||
LZERROR_WRITE = -4,
|
||||
LZERROR_GLOBALLOC = -5,
|
||||
LZERROR_GLOBLOCK = -6,
|
||||
LZERROR_BADVALUE = -7,
|
||||
LZERROR_UNKNOWNALG = -8,
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.LZ
|
||||
{
|
||||
/// <summary>
|
||||
/// Format of first 14 byte of LZ compressed file
|
||||
/// </summary>
|
||||
/// <see href="https://github.com/wine-mirror/wine/blob/master/dlls/kernel32/lzexpand.c"/>
|
||||
public sealed class FileHeaader
|
||||
{
|
||||
public string? Magic { get; set; }
|
||||
|
||||
public byte CompressionType { get; set; }
|
||||
|
||||
public char LastChar { get; set; }
|
||||
|
||||
public uint RealLength { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
using System.IO;
|
||||
|
||||
namespace SabreTools.Models.Compression.LZ
|
||||
{
|
||||
public sealed class State
|
||||
{
|
||||
/// <summary>
|
||||
/// Internal backing stream
|
||||
/// </summary>
|
||||
public Stream? Source { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The last char of the filename for replacement
|
||||
/// </summary>
|
||||
public char LastChar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Decompressed length of the file
|
||||
/// </summary>
|
||||
public uint RealLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Position the decompressor currently is
|
||||
/// </summary>
|
||||
public uint RealCurrent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Position the user wants to read from
|
||||
/// </summary>
|
||||
public uint RealWanted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The rotating LZ table
|
||||
/// </summary>
|
||||
public byte[]? Table { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// CURrent TABle ENTry
|
||||
/// </summary>
|
||||
public uint CurrentTableEntry { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Length and position of current string
|
||||
/// </summary>
|
||||
public byte StringLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// From stringtable
|
||||
/// </summary>
|
||||
public uint StringPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Bitmask within blocks
|
||||
/// </summary>
|
||||
public ushort ByteType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// GETLEN bytes
|
||||
/// </summary>
|
||||
public byte[]? Window { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Current read
|
||||
/// </summary>
|
||||
public uint WindowCurrent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Length last got
|
||||
/// </summary>
|
||||
public uint WindowLength { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.LZX
|
||||
{
|
||||
/// <summary>
|
||||
/// An aligned offset block is identical to the verbatim block except for the presence of the aligned offset
|
||||
/// tree preceding the other trees.
|
||||
/// </summary>
|
||||
/// <see href="https://interoperability.blob.core.windows.net/files/MS-PATCH/%5bMS-PATCH%5d.pdf"/>
|
||||
public class AlignedOffsetBlockData : BlockData
|
||||
{
|
||||
/// <summary>
|
||||
/// Aligned offset tree
|
||||
/// </summary>
|
||||
/// <remarks>8 elements, 3 bits each</remarks>
|
||||
public byte[]? AlignedOffsetTree { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Pretree for first 256 elements of main tree
|
||||
/// </summary>
|
||||
/// <remarks>20 elements, 4 bits each</remarks>
|
||||
public byte[]? PretreeFirst256 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Path lengths of first 256 elements of main tree
|
||||
/// </summary>
|
||||
/// <remarks>Encoded using pretree</remarks>
|
||||
public int[]? PathLengthsFirst256 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Pretree for remainder of main tree
|
||||
/// </summary>
|
||||
/// <remarks>20 elements, 4 bits each</remarks>
|
||||
public byte[]? PretreeRemainder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Path lengths of remaining elements of main tree
|
||||
/// </summary>
|
||||
/// <remarks>Encoded using pretree</remarks>
|
||||
public int[]? PathLengthsRemainder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Pretree for length tree
|
||||
/// </summary>
|
||||
/// <remarks>20 elements, 4 bits each</remarks>
|
||||
public byte[]? PretreeLengthTree { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Path lengths of elements in length tree
|
||||
/// </summary>
|
||||
/// <remarks>Encoded using pretree</remarks>
|
||||
public int[]? PathLengthsLengthTree { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Token sequence (matches and literals)
|
||||
/// </summary>
|
||||
/// <remarks>Variable</remarks>
|
||||
public byte[]? TokenSequence { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.LZX
|
||||
{
|
||||
/// <summary>
|
||||
/// An LZXD block represents a sequence of compressed data that is encoded with the same set of
|
||||
/// Huffman trees, or a sequence of uncompressed data. There can be one or more LZXD blocks in a
|
||||
/// compressed stream, each with its own set of Huffman trees. Blocks do not have to start or end on a
|
||||
/// chunk boundary; blocks can span multiple chunks, or a single chunk can contain multiple blocks. The
|
||||
/// number of chunks is related to the size of the data being compressed, while the number of blocks is
|
||||
/// related to how well the data is compressed.
|
||||
/// </summary>
|
||||
/// <see href="https://interoperability.blob.core.windows.net/files/MS-PATCH/%5bMS-PATCH%5d.pdf"/>
|
||||
public class Block
|
||||
{
|
||||
/// <summary>
|
||||
/// Block header
|
||||
/// </summary>
|
||||
public BlockHeader? Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Block data
|
||||
/// </summary>
|
||||
public BlockData? BlockData { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.LZX
|
||||
{
|
||||
/// <see href="https://interoperability.blob.core.windows.net/files/MS-PATCH/%5bMS-PATCH%5d.pdf"/>
|
||||
public abstract class BlockData
|
||||
{
|
||||
// No common fields between all block data
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.LZX
|
||||
{
|
||||
/// <summary>
|
||||
/// The Block Type field, as specified in section 2.3.1.1, indicates which type of block follows,
|
||||
/// and the Block Size field, as specified in section 2.3.1.2, indicates the number of
|
||||
/// uncompressed bytes represented by the block. Following the generic block
|
||||
/// header is a type-specific header that describes the remainder of the block.
|
||||
/// </summary>
|
||||
/// <see href="https://interoperability.blob.core.windows.net/files/MS-PATCH/%5bMS-PATCH%5d.pdf"/>
|
||||
public class BlockHeader
|
||||
{
|
||||
/// <remarks>3 bits</remarks>
|
||||
public BlockType BlockType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Block size is the high 8 bits of 24
|
||||
/// </summary>
|
||||
/// <remarks>8 bits</remarks>
|
||||
public byte BlockSizeMSB { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Block size is the middle 8 bits of 24
|
||||
/// </summary>
|
||||
/// <remarks>8 bits</remarks>
|
||||
public byte BlockSizeByte2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Block size is the low 8 bits of 24
|
||||
/// </summary>
|
||||
/// <remarks>8 bits</remarks>
|
||||
public byte BlocksizeLSB { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.LZX
|
||||
{
|
||||
/// <summary>
|
||||
/// The LZXD compressor emits chunks of compressed data. A chunk represents exactly 32 KB of
|
||||
/// uncompressed data until the last chunk in the stream, which can represent less than 32 KB. To
|
||||
/// ensure that an exact number of input bytes represent an exact number of output bytes for each
|
||||
/// chunk, after each 32 KB of uncompressed data is represented in the output compressed bitstream, the
|
||||
/// output bitstream is padded with up to 15 bits of zeros to realign the bitstream on a 16-bit boundary
|
||||
/// (even byte boundary) for the next 32 KB of data. This results in a compressed chunk of a byte-aligned
|
||||
/// size. The compressed chunk could be smaller than 32 KB or larger than 32 KB if the data is
|
||||
/// incompressible when the chunk is not the last one.
|
||||
/// </summary>
|
||||
public class Chunk
|
||||
{
|
||||
/// <summary>
|
||||
/// Chunk header
|
||||
/// </summary>
|
||||
public ChunkHeader? Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Block headers and data
|
||||
/// </summary>
|
||||
public Block[]? Blocks { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.LZX
|
||||
{
|
||||
/// <summary>
|
||||
/// The LZXD compressor emits chunks of compressed data. A chunk represents exactly 32 KB of
|
||||
/// uncompressed data until the last chunk in the stream, which can represent less than 32 KB. To
|
||||
/// ensure that an exact number of input bytes represent an exact number of output bytes for each
|
||||
/// chunk, after each 32 KB of uncompressed data is represented in the output compressed bitstream, the
|
||||
/// output bitstream is padded with up to 15 bits of zeros to realign the bitstream on a 16-bit boundary
|
||||
/// (even byte boundary) for the next 32 KB of data. This results in a compressed chunk of a byte-aligned
|
||||
/// size. The compressed chunk could be smaller than 32 KB or larger than 32 KB if the data is
|
||||
/// incompressible when the chunk is not the last one.
|
||||
/// </summary>
|
||||
public class ChunkHeader
|
||||
{
|
||||
/// <summary>
|
||||
/// The LZXD engine encodes a compressed, chunk-size prefix field preceding each compressed chunk in
|
||||
/// the compressed byte stream. The compressed, chunk-size prefix field is a byte aligned, little-endian,
|
||||
/// 16-bit field. The chunk prefix chain could be followed in the compressed stream without
|
||||
/// decompressing any data. The next chunk prefix is at a location computed by the absolute byte offset
|
||||
/// location of this chunk prefix plus 2 (for the size of the chunk-size prefix field) plus the current chunk
|
||||
/// size.
|
||||
/// </summary>
|
||||
public ushort ChunkSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The first bit in the first chunk in the LZXD bitstream (following the 2-byte, chunk-size prefix described
|
||||
/// in section 2.2.1) indicates the presence or absence of two 16-bit fields immediately following the
|
||||
/// single bit. If the bit is set, E8 translation is enabled for all the following chunks in the stream using the
|
||||
/// 32-bit value derived from the two 16-bit fields as the E8_file_size provided to the compressor when E8
|
||||
/// translation was enabled. Note that E8_file_size is completely independent of the length of the
|
||||
/// uncompressed data. E8 call translation is disabled after the 32,768th chunk (after 1 gigabyte (GB) of
|
||||
/// uncompressed data).
|
||||
/// </summary>
|
||||
public byte E8Translation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// E8 translation size, high WORD
|
||||
/// </summary>
|
||||
public ushort? TranslationSizeHighWord { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// E8 translation size, low WORD
|
||||
/// </summary>
|
||||
public ushort? TranslationSizeLowWord { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.LZX
|
||||
{
|
||||
public static class Constants
|
||||
{
|
||||
/* some constants defined by the LZX specification */
|
||||
public const int LZX_MIN_MATCH = 2;
|
||||
public const int LZX_MAX_MATCH = 257;
|
||||
public const int LZX_NUM_CHARS = 256;
|
||||
public const int LZX_PRETREE_NUM_ELEMENTS = 20;
|
||||
|
||||
/// <summary>
|
||||
/// aligned offset tree #elements
|
||||
/// </summary>
|
||||
public const int LZX_ALIGNED_NUM_ELEMENTS = 8;
|
||||
|
||||
/// <summary>
|
||||
/// this one missing from spec!
|
||||
/// </summary>
|
||||
public const int LZX_NUM_PRIMARY_LENGTHS = 7;
|
||||
|
||||
/// <summary>
|
||||
/// length tree #elements
|
||||
/// </summary>
|
||||
public const int LZX_NUM_SECONDARY_LENGTHS = 249;
|
||||
|
||||
/* LZX huffman defines: tweak tablebits as desired */
|
||||
public const int LZX_PRETREE_MAXSYMBOLS = LZX_PRETREE_NUM_ELEMENTS;
|
||||
public const int LZX_PRETREE_TABLEBITS = 6;
|
||||
public const int LZX_MAINTREE_MAXSYMBOLS = LZX_NUM_CHARS + 50 * 8;
|
||||
public const int LZX_MAINTREE_TABLEBITS = 12;
|
||||
public const int LZX_LENGTH_MAXSYMBOLS = LZX_NUM_SECONDARY_LENGTHS + 1;
|
||||
public const int LZX_LENGTH_TABLEBITS = 12;
|
||||
public const int LZX_ALIGNED_MAXSYMBOLS = LZX_ALIGNED_NUM_ELEMENTS;
|
||||
public const int LZX_ALIGNED_TABLEBITS = 7;
|
||||
|
||||
public const int LZX_LENTABLE_SAFETY = 64; /* we allow length table decoding overruns */
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.LZX
|
||||
{
|
||||
/// <summary>
|
||||
/// 3-bit block type
|
||||
/// </summary>
|
||||
public enum BlockType : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// Not valid
|
||||
/// </summary>
|
||||
INVALID_0 = 0b000,
|
||||
|
||||
/// <summary>
|
||||
/// Verbatim block
|
||||
/// </summary>
|
||||
Verbatim = 0b001,
|
||||
|
||||
/// <summary>
|
||||
/// Aligned offset block
|
||||
/// </summary>
|
||||
AlignedOffset = 0b010,
|
||||
|
||||
/// <summary>
|
||||
/// Uncompressed block
|
||||
/// </summary>
|
||||
Uncompressed = 0b011,
|
||||
|
||||
/// <summary>
|
||||
/// Not valid
|
||||
/// </summary>
|
||||
INVALID_4 = 0b100,
|
||||
|
||||
/// <summary>
|
||||
/// Not valid
|
||||
/// </summary>
|
||||
INVALID_5 = 0b101,
|
||||
|
||||
/// <summary>
|
||||
/// Not valid
|
||||
/// </summary>
|
||||
INVALID_6 = 0b110,
|
||||
|
||||
/// <summary>
|
||||
/// Not valid
|
||||
/// </summary>
|
||||
INVALID_7 = 0b111,
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.LZX
|
||||
{
|
||||
/// <summary>
|
||||
/// Following the generic block header, an uncompressed block begins with 1 to 16 bits of zero padding
|
||||
/// to align the bit buffer on a 16-bit boundary. At this point, the bitstream ends and a byte stream
|
||||
/// begins. Following the zero padding, new 32-bit values for R0, R1, and R2 are output in little-endian
|
||||
/// form, followed by the uncompressed data bytes themselves. Finally, if the uncompressed data length
|
||||
/// is odd, one extra byte of zero padding is encoded to realign the following bitstream.
|
||||
///
|
||||
/// Then the bitstream of byte-swapped 16-bit integers resumes for the next Block Type field (if there
|
||||
/// are subsequent blocks).
|
||||
///
|
||||
/// The decoded R0, R1, and R2 values are used as initial repeated offset values to decode the
|
||||
/// subsequent compressed block if present.
|
||||
/// </summary>
|
||||
/// <see href="https://interoperability.blob.core.windows.net/files/MS-PATCH/%5bMS-PATCH%5d.pdf"/>
|
||||
public class UncompressedBlockData : BlockData
|
||||
{
|
||||
/// <summary>
|
||||
/// Padding to align following field on 16-bit boundary
|
||||
/// </summary>
|
||||
/// <remarks>Bits have a value of zero</remarks>
|
||||
public ushort PaddingBits { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Least significant to most significant byte (little-endian DWORD ([MS-DTYP]))
|
||||
/// </summary>
|
||||
/// <remarks>Encoded directly in the byte stream, not in the bitstream of byte-swapped 16-bit words</remarks>
|
||||
public uint R0 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Least significant to most significant byte (little-endian DWORD)
|
||||
/// </summary>
|
||||
/// <remarks>Encoded directly in the byte stream, not in the bitstream of byte-swapped 16-bit words</remarks>
|
||||
public uint R1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Least significant to most significant byte (little-endian DWORD)
|
||||
/// </summary>
|
||||
/// <remarks>Encoded directly in the byte stream, not in the bitstream of byte-swapped 16-bit words</remarks>
|
||||
public uint R2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Can use the direct memcpy function, as specified in [IEEE1003.1]
|
||||
/// </summary>
|
||||
/// <remarks>Encoded directly in the byte stream, not in the bitstream of byte-swapped 16-bit words</remarks>
|
||||
public byte[]? RawDataBytes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Only if uncompressed size is odd
|
||||
/// </summary>
|
||||
public byte AlignmentByte { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.LZX
|
||||
{
|
||||
/// <summary>
|
||||
/// The fields of a verbatim block that follow the generic block header
|
||||
/// </summary>
|
||||
/// <see href="https://interoperability.blob.core.windows.net/files/MS-PATCH/%5bMS-PATCH%5d.pdf"/>
|
||||
public class VerbatimBlockData : BlockData
|
||||
{
|
||||
/// <summary>
|
||||
/// Pretree for first 256 elements of main tree
|
||||
/// </summary>
|
||||
/// <remarks>20 elements, 4 bits each</remarks>
|
||||
public byte[]? PretreeFirst256 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Path lengths of first 256 elements of main tree
|
||||
/// </summary>
|
||||
/// <remarks>Encoded using pretree</remarks>
|
||||
public int[]? PathLengthsFirst256 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Pretree for remainder of main tree
|
||||
/// </summary>
|
||||
/// <remarks>20 elements, 4 bits each</remarks>
|
||||
public byte[]? PretreeRemainder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Path lengths of remaining elements of main tree
|
||||
/// </summary>
|
||||
/// <remarks>Encoded using pretree</remarks>
|
||||
public int[]? PathLengthsRemainder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Pretree for length tree
|
||||
/// </summary>
|
||||
/// <remarks>20 elements, 4 bits each</remarks>
|
||||
public byte[]? PretreeLengthTree { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Path lengths of elements in length tree
|
||||
/// </summary>
|
||||
/// <remarks>Encoded using pretree</remarks>
|
||||
public int[]? PathLengthsLengthTree { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Token sequence (matches and literals)
|
||||
/// </summary>
|
||||
/// <remarks>Variable</remarks>
|
||||
public byte[]? TokenSequence { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.MSZIP
|
||||
{
|
||||
/// <summary>
|
||||
/// Each MSZIP block MUST consist of a 2-byte MSZIP signature and one or more RFC 1951 blocks. The
|
||||
/// 2-byte MSZIP signature MUST consist of the bytes 0x43 and 0x4B. The MSZIP signature MUST be
|
||||
/// the first 2 bytes in the MSZIP block. The MSZIP signature is shown in the following packet diagram.
|
||||
///
|
||||
/// Each MSZIP block is the result of a single deflate compression operation, as defined in [RFC1951].
|
||||
/// The compressor that performs the compression operation MUST generate one or more RFC 1951
|
||||
/// blocks, as defined in [RFC1951]. The number, deflation mode, and type of RFC 1951 blocks in each
|
||||
/// MSZIP block is determined by the compressor, as defined in [RFC1951]. The last RFC 1951 block in
|
||||
/// each MSZIP block MUST be marked as the "end" of the stream(1), as defined by [RFC1951]
|
||||
/// section 3.2.3. Decoding trees MUST be discarded after each RFC 1951 block, but the history buffer
|
||||
/// MUST be maintained.Each MSZIP block MUST represent no more than 32 KB of uncompressed data.
|
||||
///
|
||||
/// The maximum compressed size of each MSZIP block is 32 KB + 12 bytes. This enables the MSZIP
|
||||
/// block to contain 32 KB of data split between two noncompressed RFC 1951 blocks, each of which
|
||||
/// has a value of BTYPE = 00.
|
||||
/// </summary>
|
||||
/// <see href="https://interoperability.blob.core.windows.net/files/MS-MCI/%5bMS-MCI%5d.pdf"/>
|
||||
public class Block
|
||||
{
|
||||
/// <summary>
|
||||
/// Block header
|
||||
/// </summary>
|
||||
public BlockHeader? BlockHeader { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Compressed blocks
|
||||
/// </summary>
|
||||
public DeflateBlock[]? CompressedBlocks { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.MSZIP
|
||||
{
|
||||
/// <summary>
|
||||
/// Each MSZIP block MUST consist of a 2-byte MSZIP signature and one or more RFC 1951 blocks. The
|
||||
/// 2-byte MSZIP signature MUST consist of the bytes 0x43 and 0x4B. The MSZIP signature MUST be
|
||||
/// the first 2 bytes in the MSZIP block. The MSZIP signature is shown in the following packet diagram.
|
||||
/// </summary>
|
||||
/// <see href="https://interoperability.blob.core.windows.net/files/MS-MCI/%5bMS-MCI%5d.pdf"/>
|
||||
public class BlockHeader
|
||||
{
|
||||
/// <summary>
|
||||
/// 'CK'
|
||||
/// </summary>
|
||||
public ushort Signature { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.MSZIP
|
||||
{
|
||||
/// <summary>
|
||||
/// Compression with Huffman codes (BTYPE=01 or BTYPE=02)
|
||||
/// </summary>
|
||||
/// <see href="https://interoperability.blob.core.windows.net/files/MS-MCI/%5bMS-MCI%5d.pdf"/>
|
||||
/// <see href="https://www.rfc-editor.org/rfc/rfc1951"/>
|
||||
public abstract class CompressedDataHeader : DataHeader
|
||||
{
|
||||
/// <summary>
|
||||
/// Huffman code lengths for the literal / length alphabet
|
||||
/// </summary>
|
||||
public virtual uint[]? LiteralLengths { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Huffman distance codes for the literal / length alphabet
|
||||
/// </summary>
|
||||
public virtual uint[]? DistanceCodes { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.MSZIP
|
||||
{
|
||||
/// <see href="https://github.com/wine-mirror/wine/blob/master/dlls/cabinet/cabinet.h"/>
|
||||
public static class Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// Window size
|
||||
/// </summary>
|
||||
public const ushort ZIPWSIZE = 0x8000;
|
||||
|
||||
/// <summary>
|
||||
/// Bits in base literal/length lookup table
|
||||
/// </summary>
|
||||
public const int ZIPLBITS = 9;
|
||||
|
||||
/// <summary>
|
||||
/// Bits in base distance lookup table
|
||||
/// </summary>
|
||||
public const int ZIPDBITS = 6;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum bit length of any code
|
||||
/// </summary>
|
||||
public const int ZIPBMAX = 16;
|
||||
|
||||
/// <summary>
|
||||
/// Maximum number of codes in any set
|
||||
/// </summary>
|
||||
public const int ZIPN_MAX = 288;
|
||||
|
||||
#region THOSE_ZIP_CONSTS
|
||||
|
||||
/// <summary>
|
||||
/// Order of the bit length code lengths
|
||||
/// </summary>
|
||||
public static readonly byte[] BitLengthOrder = new byte[]
|
||||
{
|
||||
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Copy lengths for literal codes 257..285
|
||||
/// </summary>
|
||||
public static readonly ushort[] CopyLengths = new ushort[]
|
||||
{
|
||||
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51,
|
||||
59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Extra bits for literal codes 257..285
|
||||
/// </summary>
|
||||
/// <remarks>99 == invalid</remarks>
|
||||
public static readonly ushort[] LiteralExtraBits = new ushort[]
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4,
|
||||
4, 5, 5, 5, 5, 0, 99, 99
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Copy offsets for distance codes 0..29
|
||||
/// </summary>
|
||||
public static readonly ushort[] CopyOffsets = new ushort[]
|
||||
{
|
||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385,
|
||||
513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Extra bits for distance codes
|
||||
/// </summary>
|
||||
public static readonly ushort[] DistanceExtraBits = new ushort[]
|
||||
{
|
||||
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10,
|
||||
10, 11, 11, 12, 12, 13, 13
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// And'ing with Zipmask[n] masks the lower n bits
|
||||
/// </summary>
|
||||
public static readonly ushort[] BitMasks = new ushort[17]
|
||||
{
|
||||
0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
|
||||
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
|
||||
};
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.MSZIP
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for all data headers (BTYPE=00, BTYPE=01, or BTYPE=02)
|
||||
/// </summary>
|
||||
/// <see href="https://www.rfc-editor.org/rfc/rfc1951"/>
|
||||
public abstract class DataHeader
|
||||
{
|
||||
// No common fields between all data headers
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.MSZIP
|
||||
{
|
||||
/// <summary>
|
||||
/// Each MSZIP block is the result of a single deflate compression operation, as defined in [RFC1951].
|
||||
/// The compressor that performs the compression operation MUST generate one or more RFC 1951
|
||||
/// blocks, as defined in [RFC1951]. The number, deflation mode, and type of RFC 1951 blocks in each
|
||||
/// MSZIP block is determined by the compressor, as defined in [RFC1951]. The last RFC 1951 block in
|
||||
/// each MSZIP block MUST be marked as the "end" of the stream(1), as defined by [RFC1951]
|
||||
/// section 3.2.3. Decoding trees MUST be discarded after each RFC 1951 block, but the history buffer
|
||||
/// MUST be maintained.Each MSZIP block MUST represent no more than 32 KB of uncompressed data.
|
||||
/// </summary>
|
||||
/// <see href="https://interoperability.blob.core.windows.net/files/MS-MCI/%5bMS-MCI%5d.pdf"/>
|
||||
public class DeflateBlock
|
||||
{
|
||||
/// <summary>
|
||||
/// Deflate block (RFC-1951) header
|
||||
/// </summary>
|
||||
public DeflateBlockHeader? Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Compression-specific data header
|
||||
/// </summary>
|
||||
public DataHeader? DataHeader { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// MSZIP data
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Depending on the implementation of these models, this property could either be
|
||||
/// compressed or uncompressed data. Keep this in mind when using the built
|
||||
/// versions of this model.
|
||||
/// </remarks>
|
||||
public byte[]? Data { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.MSZIP
|
||||
{
|
||||
/// <see href="https://www.rfc-editor.org/rfc/rfc1951"/>
|
||||
public class DeflateBlockHeader
|
||||
{
|
||||
/// <summary>
|
||||
/// Set if and only if this is the last block of the data set.
|
||||
/// </summary>
|
||||
/// <remarks>Bit 0</remarks>
|
||||
public bool BFINAL { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Specifies how the data are compressed
|
||||
/// </summary>
|
||||
/// <remarks>Bits 1-2</remarks>
|
||||
public CompressionType BTYPE { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.MSZIP
|
||||
{
|
||||
/// <summary>
|
||||
/// Compression with dynamic Huffman codes (BTYPE=10)
|
||||
/// </summary>
|
||||
/// <see href="https://www.rfc-editor.org/rfc/rfc1951"/>
|
||||
public class DynamicCompressedDataHeader : CompressedDataHeader
|
||||
{
|
||||
// Codes are provided externally
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.MSZIP
|
||||
{
|
||||
public enum CompressionType : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// no compression
|
||||
/// </summary>
|
||||
NoCompression = 0b00,
|
||||
|
||||
/// <summary>
|
||||
/// Compressed with fixed Huffman codes
|
||||
/// </summary>
|
||||
FixedHuffman = 0b01,
|
||||
|
||||
/// <summary>
|
||||
/// Compressed with dynamic Huffman codes
|
||||
/// </summary>
|
||||
DynamicHuffman = 0b10,
|
||||
|
||||
/// <summary>
|
||||
/// Reserved (error)
|
||||
/// </summary>
|
||||
Reserved = 0b11,
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace SabreTools.Models.Compression.MSZIP
|
||||
{
|
||||
/// <summary>
|
||||
/// Compression with fixed Huffman codes (BTYPE=01)
|
||||
/// </summary>
|
||||
/// <see href="https://interoperability.blob.core.windows.net/files/MS-MCI/%5bMS-MCI%5d.pdf"/>
|
||||
/// <see href="https://www.rfc-editor.org/rfc/rfc1951"/>
|
||||
public class FixedCompressedDataHeader : CompressedDataHeader
|
||||
{
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Huffman code lengths for the literal / length alphabet
|
||||
/// </summary>
|
||||
public override uint[]? LiteralLengths
|
||||
{
|
||||
get
|
||||
{
|
||||
// If we have cached lengths, use those
|
||||
if (_literalLengths != null)
|
||||
return _literalLengths;
|
||||
|
||||
// Otherwise, build it from scratch
|
||||
_literalLengths = new uint[288];
|
||||
|
||||
// Literal Value 0 - 143, 8 bits
|
||||
for (int i = 0; i < 144; i++)
|
||||
_literalLengths[i] = 8;
|
||||
|
||||
// Literal Value 144 - 255, 9 bits
|
||||
for (int i = 144; i < 256; i++)
|
||||
_literalLengths[i] = 9;
|
||||
|
||||
// Literal Value 256 - 279, 7 bits
|
||||
for (int i = 256; i < 280; i++)
|
||||
_literalLengths[i] = 7;
|
||||
|
||||
// Literal Value 280 - 287, 8 bits
|
||||
for (int i = 280; i < 288; i++)
|
||||
_literalLengths[i] = 8;
|
||||
|
||||
return _literalLengths;
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new FieldAccessException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Huffman distance codes for the literal / length alphabet
|
||||
/// </summary>
|
||||
public override uint[]? DistanceCodes
|
||||
{
|
||||
get
|
||||
{
|
||||
// If we have cached distances, use those
|
||||
if (_distanceCodes != null)
|
||||
return _distanceCodes;
|
||||
|
||||
// Otherwise, build it from scratch
|
||||
_distanceCodes = new uint[30];
|
||||
|
||||
// Fixed length, 5 bits
|
||||
for (int i = 0; i < 30; i++)
|
||||
_distanceCodes[i] = 5;
|
||||
|
||||
return _distanceCodes;
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new FieldAccessException();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Instance Variables
|
||||
|
||||
/// <summary>
|
||||
/// Huffman code lengths for the literal / length alphabet
|
||||
/// </summary>
|
||||
private uint[]? _literalLengths = null;
|
||||
|
||||
/// <summary>
|
||||
/// Huffman distance codes for the literal / length alphabet
|
||||
/// </summary>
|
||||
private uint[]? _distanceCodes = null;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.MSZIP
|
||||
{
|
||||
/// <summary>
|
||||
/// Non-compressed blocks (BTYPE=00)
|
||||
/// </summary>
|
||||
/// <see href="https://www.rfc-editor.org/rfc/rfc1951"/>
|
||||
public class NonCompressedBlockHeader : DataHeader
|
||||
{
|
||||
/// <summary>
|
||||
/// The number of data bytes in the block
|
||||
/// </summary>
|
||||
/// <remarks>Bytes 0-1</remarks>
|
||||
public ushort LEN { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The one's complement of LEN
|
||||
/// </summary>
|
||||
/// <remarks>Bytes 2-3</remarks>
|
||||
public ushort NLEN { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.Quantum
|
||||
{
|
||||
/// <see href="www.russotto.net/quantumcomp.html"/>
|
||||
public static class Constants
|
||||
{
|
||||
public static readonly int[] PositionSlot = new int[]
|
||||
{
|
||||
0x00000, 0x00001, 0x00002, 0x00003, 0x00004, 0x00006, 0x00008, 0x0000c,
|
||||
0x00010, 0x00018, 0x00020, 0x00030, 0x00040, 0x00060, 0x00080, 0x000c0,
|
||||
0x00100, 0x00180, 0x00200, 0x00300, 0x00400, 0x00600, 0x00800, 0x00c00,
|
||||
0x01000, 0x01800, 0x02000, 0x03000, 0x04000, 0x06000, 0x08000, 0x0c000,
|
||||
0x10000, 0x18000, 0x20000, 0x30000, 0x40000, 0x60000, 0x80000, 0xc0000,
|
||||
0x100000, 0x180000
|
||||
};
|
||||
|
||||
public static readonly int[] PositionExtraBits = new int[]
|
||||
{
|
||||
0, 0, 0, 0, 1, 1, 2, 2,
|
||||
3, 3, 4, 4, 5, 5, 6, 6,
|
||||
7, 7, 8, 8, 9, 9, 10, 10,
|
||||
11, 11, 12, 12, 13, 13, 14, 14,
|
||||
15, 15, 16, 16, 17, 17, 18, 18,
|
||||
19, 19
|
||||
};
|
||||
|
||||
public static readonly int[] LengthSlot = new int[]
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x08,
|
||||
0x0a, 0x0c, 0x0e, 0x12, 0x16, 0x1a, 0x1e, 0x26,
|
||||
0x2e, 0x36, 0x3e, 0x4e, 0x5e, 0x6e, 0x7e, 0x9e,
|
||||
0xbe, 0xde, 0xfe
|
||||
};
|
||||
|
||||
public static readonly int[] LengthExtraBits = new int[]
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 1, 1,
|
||||
1, 1, 2, 2, 2, 2, 3, 3,
|
||||
3, 3, 4, 4, 4, 4, 5, 5,
|
||||
5, 5, 0
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Number of position slots for (tsize - 10)
|
||||
/// </summary>
|
||||
public static readonly int[] NumPositionSlots = new int[]
|
||||
{
|
||||
20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.Quantum
|
||||
{
|
||||
public enum SelectorModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Literal model, 64 entries, start at symbol 0
|
||||
/// </summary>
|
||||
SELECTOR_0 = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Literal model, 64 entries, start at symbol 64
|
||||
/// </summary>
|
||||
SELECTOR_1 = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Literal model, 64 entries, start at symbol 128
|
||||
/// </summary>
|
||||
SELECTOR_2 = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Literal model, 64 entries, start at symbol 192
|
||||
/// </summary>
|
||||
SELECTOR_3 = 3,
|
||||
|
||||
/// <summary>
|
||||
/// LZ model, 3 character matches, max 24 entries, start at symbol 0
|
||||
/// </summary>
|
||||
SELECTOR_4 = 4,
|
||||
|
||||
/// <summary>
|
||||
/// LZ model, 4 character matches, max 36 entries, start at symbol 0
|
||||
/// </summary>
|
||||
SELECTOR_5 = 5,
|
||||
|
||||
/// <summary>
|
||||
/// LZ model, 5+ character matches, max 42 entries, start at symbol 0
|
||||
/// </summary>
|
||||
SELECTOR_6_POSITION = 6,
|
||||
|
||||
/// <summary>
|
||||
/// LZ model, 5+ character matches, 27 entries, start at symbol 0
|
||||
/// </summary>
|
||||
SELECTOR_6_LENGTH = 7,
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.Quantum
|
||||
{
|
||||
/// <see href="http://www.russotto.net/quantumcomp.html"/>
|
||||
public sealed class Model
|
||||
{
|
||||
public int Entries { get; set; }
|
||||
|
||||
/// <remarks>
|
||||
/// All the models are initialized with the symbols in symbol
|
||||
/// order in the table, and with every symbol in the table
|
||||
/// having a frequency of 1
|
||||
/// </remarks>
|
||||
public ModelSymbol?[]? Symbols { get; set; }
|
||||
|
||||
/// <remarks>
|
||||
/// The initial total frequency is equal to the number of entries
|
||||
/// in the table
|
||||
/// </remarks>
|
||||
public int TotalFrequency { get; set; }
|
||||
|
||||
/// <remarks>The initial time_to_reorder value is 4</remarks>
|
||||
public int TimeToReorder { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace SabreTools.Models.Compression.Quantum
|
||||
{
|
||||
/// <see href="http://www.russotto.net/quantumcomp.html"/>
|
||||
public sealed class ModelSymbol
|
||||
{
|
||||
public ushort Symbol { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The cumulative frequency is the frequency of all the symbols
|
||||
/// which are at a higher index in the table than that symbol —
|
||||
/// thus the last entry in the table has a cumulative frequency of 0.
|
||||
/// </summary>
|
||||
public ushort CumulativeFrequency { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace SabreTools.Models.InstallShieldArchiveV3
|
||||
{
|
||||
/// <see href="https://github.com/wfr/unshieldv3/blob/master/ISArchiveV3.cpp"/>
|
||||
public class Directory
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
|
||||
public ushort FileCount { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
namespace SabreTools.Models.InstallShieldArchiveV3
|
||||
{
|
||||
/// <see href="https://github.com/wfr/unshieldv3/blob/master/ISArchiveV3.h"/>
|
||||
public class File
|
||||
{
|
||||
public byte VolumeEnd { get; set; }
|
||||
|
||||
public ushort Index { get; set; }
|
||||
|
||||
public uint UncompressedSize { get; set; }
|
||||
|
||||
public uint CompressedSize { get; set; }
|
||||
|
||||
public uint Offset { get; set; }
|
||||
|
||||
public uint DateTime { get; set; }
|
||||
|
||||
public uint Reserved0 { get; set; }
|
||||
|
||||
public ushort ChunkSize { get; set; }
|
||||
|
||||
public Attributes Attrib { get; set; }
|
||||
|
||||
public byte IsSplit { get; set; }
|
||||
|
||||
public byte Reserved1 { get; set; }
|
||||
|
||||
public byte VolumeStart { get; set; }
|
||||
|
||||
public string? Name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
namespace SabreTools.Models.InstallShieldArchiveV3
|
||||
{
|
||||
/// <see href="https://github.com/wfr/unshieldv3/blob/master/ISArchiveV3.h"/>
|
||||
public class Header
|
||||
{
|
||||
public uint Signature1 { get; set; }
|
||||
|
||||
public uint Signature2 { get; set; }
|
||||
|
||||
public ushort Reserved0 { get; set; }
|
||||
|
||||
public ushort IsMultivolume { get; set; }
|
||||
|
||||
public ushort FileCount { get; set; }
|
||||
|
||||
public uint DateTime { get; set; }
|
||||
|
||||
public uint CompressedSize { get; set; }
|
||||
|
||||
public uint UncompressedSize { get; set; }
|
||||
|
||||
public uint Reserved1 { get; set; }
|
||||
|
||||
/// <remarks>
|
||||
/// Set in first vol only, zero in subsequent vols
|
||||
/// </remarks>
|
||||
public byte VolumeTotal { get; set; }
|
||||
|
||||
/// <remarks>
|
||||
/// [1...n]
|
||||
/// </remarks>
|
||||
public byte VolumeNumber { get; set; }
|
||||
|
||||
public byte Reserved2 { get; set; }
|
||||
|
||||
public uint SplitBeginAddress { get; set; }
|
||||
|
||||
public uint SplitEndAddress { get; set; }
|
||||
|
||||
public uint TocAddress { get; set; }
|
||||
|
||||
public uint Reserved3 { get; set; }
|
||||
|
||||
public ushort DirCount { get; set; }
|
||||
|
||||
public uint Reserved4 { get; set; }
|
||||
|
||||
public uint Reserved5 { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace SabreTools.Models.InstallShieldCabinet
|
||||
{
|
||||
/// <see href="https://github.com/twogood/unshield/blob/main/lib/cabfile.h"/>
|
||||
[Flags]
|
||||
public enum FileFlags : ushort
|
||||
{
|
||||
FILE_SPLIT = 1,
|
||||
FILE_OBFUSCATED = 2,
|
||||
FILE_COMPRESSED = 4,
|
||||
FILE_INVALID = 8,
|
||||
}
|
||||
|
||||
/// <see href="https://github.com/twogood/unshield/blob/main/lib/cabfile.h"/>
|
||||
public enum LinkFlags : byte
|
||||
{
|
||||
LINK_NONE = 0,
|
||||
LINK_PREV = 1,
|
||||
LINK_NEXT = 2,
|
||||
LINK_BOTH = 3,
|
||||
}
|
||||
}
|
||||
7
LICENSE
Normal file
7
LICENSE
Normal file
@@ -0,0 +1,7 @@
|
||||
Copyright (c) 2018-2025 Matt Nadareski
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -1,14 +0,0 @@
|
||||
namespace SabreTools.Models.Listrom
|
||||
{
|
||||
public class MetadataFile
|
||||
{
|
||||
public Set[]? Set { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
public string[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.Listxml
|
||||
{
|
||||
[XmlRoot("analog")]
|
||||
public class Analog
|
||||
{
|
||||
[Required]
|
||||
[XmlAttribute("mask")]
|
||||
public string? Mask { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.Listxml
|
||||
{
|
||||
[XmlRoot("device_ref")]
|
||||
public class DeviceRef
|
||||
{
|
||||
[Required]
|
||||
[XmlAttribute("name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.Listxml
|
||||
{
|
||||
[XmlRoot("extension")]
|
||||
public class Extension
|
||||
{
|
||||
[Required]
|
||||
[XmlAttribute("name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.Listxml
|
||||
{
|
||||
[XmlRoot("port")]
|
||||
public class Port
|
||||
{
|
||||
[Required]
|
||||
[XmlAttribute("tag")]
|
||||
public string? Tag { get; set; }
|
||||
|
||||
[XmlElement("analog")]
|
||||
public Analog[]? Analog { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.Listxml
|
||||
{
|
||||
[XmlRoot("sample")]
|
||||
public class Sample
|
||||
{
|
||||
[Required]
|
||||
[XmlAttribute("name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.Listxml
|
||||
{
|
||||
[XmlRoot("slot")]
|
||||
public class Slot
|
||||
{
|
||||
[Required]
|
||||
[XmlAttribute("name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
[XmlElement("slotoption")]
|
||||
public SlotOption[]? SlotOption { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.Listxml
|
||||
{
|
||||
[XmlRoot("sound")]
|
||||
public class Sound
|
||||
{
|
||||
/// <remarks>Numeric</remarks>
|
||||
[Required]
|
||||
[XmlAttribute("channels")]
|
||||
public string? Channels { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.Logiqx
|
||||
{
|
||||
[XmlRoot("archive")]
|
||||
public class Archive
|
||||
{
|
||||
[Required]
|
||||
[XmlAttribute("name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.Logiqx
|
||||
{
|
||||
[XmlRoot("device_ref")]
|
||||
public class DeviceRef
|
||||
{
|
||||
[Required]
|
||||
[XmlAttribute("name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.Logiqx
|
||||
{
|
||||
[XmlRoot("sample")]
|
||||
public class Sample
|
||||
{
|
||||
[Required]
|
||||
[XmlAttribute("name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
namespace SabreTools.Models.N3DS
|
||||
{
|
||||
/// <see href="https://www.3dbrew.org/wiki/NCSD#Card_Info_Header"/>
|
||||
public sealed class CardInfoHeader
|
||||
{
|
||||
/// <summary>
|
||||
/// CARD2: Writable Address In Media Units (For 'On-Chip' Savedata). CARD1: Always 0xFFFFFFFF.
|
||||
/// </summary>
|
||||
public uint WritableAddressMediaUnits { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Card Info Bitmask
|
||||
/// </summary>
|
||||
public uint CardInfoBitmask { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Reserved
|
||||
/// </summary>
|
||||
public byte[]? Reserved1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Filled size of cartridge
|
||||
/// </summary>
|
||||
public uint FilledSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Reserved
|
||||
/// </summary>
|
||||
public byte[]? Reserved2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Title version
|
||||
/// </summary>
|
||||
public ushort TitleVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Card revision
|
||||
/// </summary>
|
||||
public ushort CardRevision { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Reserved
|
||||
/// </summary>
|
||||
public byte[]? Reserved3 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Title ID of CVer in included update partition
|
||||
/// </summary>
|
||||
public byte[]? CVerTitleID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Version number of CVer in included update partition
|
||||
/// </summary>
|
||||
public ushort CVerVersionNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Reserved
|
||||
/// </summary>
|
||||
public byte[]? Reserved4 { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
namespace SabreTools.Models.N3DS
|
||||
{
|
||||
/// <see href="https://www.3dbrew.org/wiki/NCSD#Development_Card_Info_Header_Extension"/>
|
||||
public sealed class DevelopmentCardInfoHeader
|
||||
{
|
||||
/// <summary>
|
||||
/// InitialData
|
||||
/// </summary>
|
||||
public InitialData? InitialData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// CardDeviceReserved1
|
||||
/// </summary>
|
||||
public byte[]? CardDeviceReserved1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// TitleKey
|
||||
/// </summary>
|
||||
public byte[]? TitleKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// CardDeviceReserved2
|
||||
/// </summary>
|
||||
public byte[]? CardDeviceReserved2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// TestData
|
||||
/// </summary>
|
||||
public TestData? TestData { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
namespace SabreTools.Models.N3DS
|
||||
{
|
||||
/// <see href="https://www.3dbrew.org/wiki/NCSD#InitialData"/>
|
||||
public sealed class InitialData
|
||||
{
|
||||
/// <summary>
|
||||
/// Card seed keyY (first u64 is Media ID (same as first NCCH partitionId))
|
||||
/// </summary>
|
||||
public byte[]? CardSeedKeyY { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Encrypted card seed (AES-CCM, keyslot 0x3B for retail cards, see CTRCARD_SECSEED)
|
||||
/// </summary>
|
||||
public byte[]? EncryptedCardSeed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Card seed AES-MAC
|
||||
/// </summary>
|
||||
public byte[]? CardSeedAESMAC { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Card seed nonce
|
||||
/// </summary>
|
||||
public byte[]? CardSeedNonce { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Reserved3
|
||||
/// </summary>
|
||||
public byte[]? Reserved { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Copy of first NCCH header (excluding RSA signature)
|
||||
/// </summary>
|
||||
public NCCHHeader? BackupHeader { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
namespace SabreTools.Models.N3DS
|
||||
{
|
||||
/// <see href="https://www.3dbrew.org/wiki/CIA#Meta"/>
|
||||
public sealed class MetaData
|
||||
{
|
||||
/// <summary>
|
||||
/// Title ID dependency list - Taken from the application's ExHeader
|
||||
/// </summary>
|
||||
/// TODO: Determine numeric format of each entry
|
||||
public byte[]? TitleIDDependencyList { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Reserved
|
||||
/// </summary>
|
||||
public byte[]? Reserved1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Core Version
|
||||
/// </summary>
|
||||
public uint CoreVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Reserved
|
||||
/// </summary>
|
||||
public byte[]? Reserved2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Icon Data(.ICN) - Taken from the application's ExeFS
|
||||
/// </summary>
|
||||
public byte[]? IconData { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
namespace SabreTools.Models.N3DS
|
||||
{
|
||||
/// <summary>
|
||||
/// The test data is the same one encountered in development DS/DSi cartridges.
|
||||
/// </summary>
|
||||
/// <see href="https://www.3dbrew.org/wiki/NCSD#TestData"/>
|
||||
public sealed class TestData
|
||||
{
|
||||
/// <summary>
|
||||
/// The bytes FF 00 FF 00 AA 55 AA 55.
|
||||
/// </summary>
|
||||
public byte[]? Signature { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An ascending byte sequence equal to the offset mod 256 (08 09 0A ... FE FF 00 01 ... FF).
|
||||
/// </summary>
|
||||
public byte[]? AscendingByteSequence { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A descending byte sequence equal to 255 minus the offset mod 256 (FF FE FD ... 00 FF DE ... 00).
|
||||
/// </summary>
|
||||
public byte[]? DescendingByteSequence { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Filled with 00 (0b00000000) bytes.
|
||||
/// </summary>
|
||||
public byte[]? Filled00 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Filled with FF (0b11111111) bytes.
|
||||
/// </summary>
|
||||
public byte[]? FilledFF { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Filled with 0F (0b00001111) bytes.
|
||||
/// </summary>
|
||||
public byte[]? Filled0F { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Filled with F0 (0b11110000) bytes.
|
||||
/// </summary>
|
||||
public byte[]? FilledF0 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Filled with 55 (0b01010101) bytes.
|
||||
/// </summary>
|
||||
public byte[]? Filled55 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Filled with AA (0b10101010) bytes.
|
||||
/// </summary>
|
||||
public byte[]? FilledAA { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The final byte is 00 (0b00000000).
|
||||
/// </summary>
|
||||
public byte FinalByte { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace SabreTools.Models.NewExecutable
|
||||
{
|
||||
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
|
||||
public sealed class ImportNameRelocationRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// Index into module reference table for the imported module.
|
||||
/// </summary>
|
||||
public ushort Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Offset within Imported Names Table to procedure name string.
|
||||
/// </summary>
|
||||
public ushort Offset { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
namespace SabreTools.Models.NewExecutable
|
||||
{
|
||||
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
|
||||
public sealed class ImportOrdinalRelocationRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// Index into module reference table for the imported module.
|
||||
/// </summary>
|
||||
public ushort Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Procedure ordinal number.
|
||||
/// </summary>
|
||||
public ushort Ordinal { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
namespace SabreTools.Models.NewExecutable
|
||||
{
|
||||
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
|
||||
public sealed class OSFixupRelocationRecord
|
||||
{
|
||||
/// <summary>
|
||||
/// Operating system fixup type.
|
||||
/// Floating-point fixups.
|
||||
/// </summary>
|
||||
public OSFixupType FixupType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 0
|
||||
/// </summary>
|
||||
public ushort Reserved { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
namespace SabreTools.Models.NewExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// The segment table contains an entry for each segment in the executable
|
||||
/// file. The number of segment table entries are defined in the segmented
|
||||
/// EXE header. The first entry in the segment table is segment number 1.
|
||||
/// The following is the structure of a segment table entry.
|
||||
/// </summary>
|
||||
/// <see href="http://bytepointer.com/resources/win16_ne_exe_format_win3.0.htm"/>
|
||||
public sealed class SegmentTableEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// Logical-sector offset (n byte) to the contents of the segment
|
||||
/// data, relative to the beginning of the file. Zero means no
|
||||
/// file data.
|
||||
/// </summary>
|
||||
public ushort Offset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Length of the segment in the file, in bytes. Zero means 64K.
|
||||
/// </summary>
|
||||
public ushort Length { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Flag word.
|
||||
/// </summary>
|
||||
public SegmentTableEntryFlag FlagWord { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Minimum allocation size of the segment, in bytes. Total size
|
||||
/// of the segment. Zero means 64K.
|
||||
/// </summary>
|
||||
public ushort MinimumAllocationSize { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.OfflineList
|
||||
{
|
||||
[XmlRoot("canOpen")]
|
||||
public class CanOpen
|
||||
{
|
||||
[XmlElement("extension")]
|
||||
public string[]? Extension { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.OfflineList
|
||||
{
|
||||
[XmlRoot("datURL")]
|
||||
public class DatUrl
|
||||
{
|
||||
[XmlAttribute("fileName")]
|
||||
public string? FileName { get; set; }
|
||||
|
||||
[XmlText]
|
||||
public string? Content { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.OfflineList
|
||||
{
|
||||
[XmlRoot("romCRC")]
|
||||
public class FileRomCRC
|
||||
{
|
||||
[XmlAttribute("extension")]
|
||||
public string? Extension { get; set; }
|
||||
|
||||
[XmlText]
|
||||
public string? Content { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.OfflineList
|
||||
{
|
||||
[XmlRoot("files")]
|
||||
public class Files
|
||||
{
|
||||
[XmlElement("romCRC")]
|
||||
public FileRomCRC[]? RomCRC { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.OfflineList
|
||||
{
|
||||
[XmlRoot("gui")]
|
||||
public class GUI
|
||||
{
|
||||
[XmlElement("images")]
|
||||
public Images? Images { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.OfflineList
|
||||
{
|
||||
[XmlRoot("games")]
|
||||
public class Games
|
||||
{
|
||||
[XmlElement("game")]
|
||||
public Game[]? Game { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.OfflineList
|
||||
{
|
||||
[XmlRoot("search")]
|
||||
public class Search
|
||||
{
|
||||
[XmlElement("to")]
|
||||
public To[]? To { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.OpenMSX
|
||||
{
|
||||
[XmlRoot("original")]
|
||||
public class Original
|
||||
{
|
||||
/// <remarks>Boolean?</remarks>
|
||||
[XmlAttribute("value")]
|
||||
public string? Value { get; set; }
|
||||
|
||||
[XmlText]
|
||||
public string? Content { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace SabreTools.Models.OpenMSX
|
||||
{
|
||||
[XmlRoot("softwaredb")]
|
||||
public class SoftwareDb
|
||||
{
|
||||
[XmlAttribute("timestamp")]
|
||||
public string? Timestamp { get; set; }
|
||||
|
||||
[XmlElement("software")]
|
||||
public Software[]? Software { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,307 +0,0 @@
|
||||
namespace SabreTools.Models.PortableExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// The symbol table in this section is inherited from the traditional
|
||||
/// COFF format. It is distinct from Microsoft Visual C++ debug information.
|
||||
/// A file can contain both a COFF symbol table and Visual C++ debug
|
||||
/// information, and the two are kept separate. Some Microsoft tools use
|
||||
/// the symbol table for limited but important purposes, such as
|
||||
/// communicating COMDAT information to the linker. Section names and file
|
||||
/// names, as well as code and data symbols, are listed in the symbol table.
|
||||
///
|
||||
/// The location of the symbol table is indicated in the COFF header.
|
||||
///
|
||||
/// The symbol table is an array of records, each 18 bytes long. Each record
|
||||
/// is either a standard or auxiliary symbol-table record. A standard record
|
||||
/// defines a symbol or name.
|
||||
/// </summary>
|
||||
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
|
||||
public sealed class COFFSymbolTableEntry
|
||||
{
|
||||
#region Standard COFF Symbol Table Entry
|
||||
|
||||
#region Symbol Name
|
||||
|
||||
/// <summary>
|
||||
/// An array of 8 bytes. This array is padded with nulls on the right if
|
||||
/// the name is less than 8 bytes long.
|
||||
/// </summary>
|
||||
public byte[]? ShortName { get; set; } = new byte[8];
|
||||
|
||||
/// <summary>
|
||||
/// A field that is set to all zeros if the name is longer than 8 bytes.
|
||||
/// </summary>
|
||||
public uint Zeroes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An offset into the string table.
|
||||
/// </summary>
|
||||
public uint Offset { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// The value that is associated with the symbol. The interpretation of this
|
||||
/// field depends on SectionNumber and StorageClass. A typical meaning is the
|
||||
/// relocatable address.
|
||||
/// </summary>
|
||||
public uint Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The signed integer that identifies the section, using a one-based index
|
||||
/// into the section table. Some values have special meaning.
|
||||
/// </summary>
|
||||
public ushort SectionNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A number that represents type. Microsoft tools set this field to 0x20
|
||||
/// (function) or 0x0 (not a function).
|
||||
/// </summary>
|
||||
public SymbolType SymbolType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An enumerated value that represents storage class.
|
||||
/// </summary>
|
||||
public StorageClass StorageClass { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The number of auxiliary symbol table entries that follow this record.
|
||||
/// </summary>
|
||||
public byte NumberOfAuxSymbols { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Auxiliary Symbol Records
|
||||
|
||||
// Auxiliary symbol table records always follow, and apply to, some standard
|
||||
// symbol table record. An auxiliary record can have any format that the tools
|
||||
// can recognize, but 18 bytes must be allocated for them so that symbol table
|
||||
// is maintained as an array of regular size. Currently, Microsoft tools
|
||||
// recognize auxiliary formats for the following kinds of records: function
|
||||
// definitions, function begin and end symbols (.bf and .ef), weak externals,
|
||||
// file names, and section definitions.
|
||||
//
|
||||
// The traditional COFF design also includes auxiliary-record formats for arrays
|
||||
// and structures.Microsoft tools do not use these, but instead place that
|
||||
// symbolic information in Visual C++ debug format in the debug sections.
|
||||
|
||||
#region Auxiliary Format 1: Function Definitions
|
||||
|
||||
// A symbol table record marks the beginning of a function definition if it
|
||||
// has all of the following: a storage class of EXTERNAL (2), a Type value
|
||||
// that indicates it is a function (0x20), and a section number that is
|
||||
// greater than zero. Note that a symbol table record that has a section
|
||||
// number of UNDEFINED (0) does not define the function and does not have
|
||||
// an auxiliary record. Function-definition symbol records are followed by
|
||||
// an auxiliary record in the format described below:
|
||||
|
||||
/// <summary>
|
||||
/// The symbol-table index of the corresponding .bf (begin function)
|
||||
/// symbol record.
|
||||
/// </summary>
|
||||
public uint AuxFormat1TagIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The size of the executable code for the function itself. If the function
|
||||
/// is in its own section, the SizeOfRawData in the section header is greater
|
||||
/// or equal to this field, depending on alignment considerations.
|
||||
/// </summary>
|
||||
public uint AuxFormat1TotalSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The file offset of the first COFF line-number entry for the function, or
|
||||
/// zero if none exists.
|
||||
/// </summary>
|
||||
public uint AuxFormat1PointerToLinenumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The symbol-table index of the record for the next function. If the function
|
||||
/// is the last in the symbol table, this field is set to zero.
|
||||
/// </summary>
|
||||
public uint AuxFormat1PointerToNextFunction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unused
|
||||
/// </summary>
|
||||
public ushort AuxFormat1Unused { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Auxiliary Format 2: .bf and .ef Symbols
|
||||
|
||||
// For each function definition in the symbol table, three items describe
|
||||
// the beginning, ending, and number of lines. Each of these symbols has
|
||||
// storage class FUNCTION (101):
|
||||
//
|
||||
// A symbol record named .bf (begin function). The Value field is unused.
|
||||
//
|
||||
// A symbol record named .lf (lines in function). The Value field gives the
|
||||
// number of lines in the function.
|
||||
//
|
||||
// A symbol record named .ef (end of function). The Value field has the same
|
||||
// number as the Total Size field in the function-definition symbol record.
|
||||
//
|
||||
// The .bf and .ef symbol records (but not .lf records) are followed by an
|
||||
// auxiliary record with the following format:
|
||||
|
||||
/// <summary>
|
||||
/// Unused
|
||||
/// </summary>
|
||||
public uint AuxFormat2Unused1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The actual ordinal line number (1, 2, 3, and so on) within the source file,
|
||||
/// corresponding to the .bf or .ef record.
|
||||
/// </summary>
|
||||
public ushort AuxFormat2Linenumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unused
|
||||
/// </summary>
|
||||
public byte[]? AuxFormat2Unused2 { get; set; } = new byte[6];
|
||||
|
||||
/// <summary>
|
||||
/// The symbol-table index of the next .bf symbol record. If the function is the
|
||||
/// last in the symbol table, this field is set to zero. It is not used for
|
||||
/// .ef records.
|
||||
/// </summary>
|
||||
public uint AuxFormat2PointerToNextFunction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unused
|
||||
/// </summary>
|
||||
public ushort AuxFormat2Unused3 { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Auxiliary Format 3: Weak Externals
|
||||
|
||||
// "Weak externals" are a mechanism for object files that allows flexibility at
|
||||
// link time. A module can contain an unresolved external symbol (sym1), but it
|
||||
// can also include an auxiliary record that indicates that if sym1 is not
|
||||
// present at link time, another external symbol (sym2) is used to resolve
|
||||
// references instead.
|
||||
//
|
||||
// If a definition of sym1 is linked, then an external reference to the symbol
|
||||
// is resolved normally. If a definition of sym1 is not linked, then all references
|
||||
// to the weak external for sym1 refer to sym2 instead. The external symbol, sym2,
|
||||
// must always be linked; typically, it is defined in the module that contains
|
||||
// the weak reference to sym1.
|
||||
//
|
||||
// Weak externals are represented by a symbol table record with EXTERNAL storage
|
||||
// class, UNDEF section number, and a value of zero. The weak-external symbol
|
||||
// record is followed by an auxiliary record with the following format:
|
||||
|
||||
/// <summary>
|
||||
/// The symbol-table index of sym2, the symbol to be linked if sym1 is not found.
|
||||
/// </summary>
|
||||
public uint AuxFormat3TagIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A value of IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY indicates that no library search
|
||||
/// for sym1 should be performed.
|
||||
/// A value of IMAGE_WEAK_EXTERN_SEARCH_LIBRARY indicates that a library search for
|
||||
/// sym1 should be performed.
|
||||
/// A value of IMAGE_WEAK_EXTERN_SEARCH_ALIAS indicates that sym1 is an alias for sym2.
|
||||
/// </summary>
|
||||
public uint AuxFormat3Characteristics { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unused
|
||||
/// </summary>
|
||||
public byte[]? AuxFormat3Unused { get; set; } = new byte[10];
|
||||
|
||||
#endregion
|
||||
|
||||
#region Auxiliary Format 4: Files
|
||||
|
||||
// This format follows a symbol-table record with storage class FILE (103).
|
||||
// The symbol name itself should be .file, and the auxiliary record that
|
||||
// follows it gives the name of a source-code file.
|
||||
|
||||
/// <summary>
|
||||
/// An ANSI string that gives the name of the source file. This is padded
|
||||
/// with nulls if it is less than the maximum length.
|
||||
/// </summary>
|
||||
public byte[]? AuxFormat4FileName { get; set; } = new byte[18];
|
||||
|
||||
#endregion
|
||||
|
||||
#region Auxiliary Format 5: Section Definitions
|
||||
|
||||
// This format follows a symbol-table record that defines a section. Such a
|
||||
// record has a symbol name that is the name of a section (such as .text or
|
||||
// .drectve) and has storage class STATIC (3). The auxiliary record provides
|
||||
// information about the section to which it refers. Thus, it duplicates some
|
||||
// of the information in the section header.
|
||||
|
||||
/// <summary>
|
||||
/// The size of section data; the same as SizeOfRawData in the section header.
|
||||
/// </summary>
|
||||
public uint AuxFormat5Length { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The number of relocation entries for the section.
|
||||
/// </summary>
|
||||
public ushort AuxFormat5NumberOfRelocations { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The number of line-number entries for the section.
|
||||
/// </summary>
|
||||
public ushort AuxFormat5NumberOfLinenumbers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The checksum for communal data. It is applicable if the IMAGE_SCN_LNK_COMDAT
|
||||
/// flag is set in the section header.
|
||||
/// </summary>
|
||||
public uint AuxFormat5CheckSum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// One-based index into the section table for the associated section. This is
|
||||
/// used when the COMDAT selection setting is 5.
|
||||
/// </summary>
|
||||
public ushort AuxFormat5Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The COMDAT selection number. This is applicable if the section is a
|
||||
/// COMDAT section.
|
||||
/// </summary>
|
||||
public byte AuxFormat5Selection { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Unused
|
||||
/// </summary>
|
||||
public byte[]? AuxFormat5Unused { get; set; } = new byte[3];
|
||||
|
||||
#endregion
|
||||
|
||||
#region Auxiliary Format 6: CLR Token Definition (Object Only)
|
||||
|
||||
// This auxiliary symbol generally follows the IMAGE_SYM_CLASS_CLR_TOKEN. It is
|
||||
// used to associate a token with the COFF symbol table's namespace.
|
||||
|
||||
/// <summary>
|
||||
/// Must be IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF (1).
|
||||
/// </summary>
|
||||
public byte AuxFormat6AuxType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Reserved, must be zero.
|
||||
/// </summary>
|
||||
public byte AuxFormat6Reserved1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The symbol index of the COFF symbol to which this CLR token definition refers.
|
||||
/// </summary>
|
||||
public uint AuxFormat6SymbolTableIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Reserved, must be zero.
|
||||
/// </summary>
|
||||
public byte[]? AuxFormat6Reserved2 { get; set; } = new byte[12];
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
namespace SabreTools.Models.PortableExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// The following list describes the Microsoft PE executable format, with the
|
||||
/// base of the image header at the top. The section from the MS-DOS 2.0
|
||||
/// Compatible EXE Header through to the unused section just before the PE header
|
||||
/// is the MS-DOS 2.0 Section, and is used for MS-DOS compatibility only.
|
||||
/// </summary>
|
||||
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
|
||||
public sealed class Executable
|
||||
{
|
||||
/// <summary>
|
||||
/// MS-DOS executable stub
|
||||
/// </summary>
|
||||
public MSDOS.Executable? Stub { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// After the MS-DOS stub, at the file offset specified at offset 0x3c, is a 4-byte
|
||||
/// signature that identifies the file as a PE format image file. This signature is "PE\0\0"
|
||||
/// (the letters "P" and "E" followed by two null bytes).
|
||||
/// </summary>
|
||||
public string? Signature { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// COFF file header
|
||||
/// </summary>
|
||||
public COFFFileHeader? COFFFileHeader { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional header
|
||||
/// </summary>
|
||||
public OptionalHeader? OptionalHeader { get; set; }
|
||||
|
||||
// TODO: Support grouped sections in section reading and parsing
|
||||
// https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#grouped-sections-object-only
|
||||
// Grouped sections are ordered and mean that the data in the sections contributes
|
||||
// to the "base" section (the one without the "$X" suffix). This may negatively impact
|
||||
// the use of some of the different types of executables.
|
||||
|
||||
/// <summary>
|
||||
/// Section table
|
||||
/// </summary>
|
||||
public SectionHeader?[]? SectionTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// COFF symbol table
|
||||
/// </summary>
|
||||
public COFFSymbolTableEntry?[]? COFFSymbolTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// COFF string table
|
||||
/// </summary>
|
||||
public COFFStringTable? COFFStringTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Attribute certificate table
|
||||
/// </summary>
|
||||
public AttributeCertificateTableEntry?[]? AttributeCertificateTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Delay-load directory table
|
||||
/// </summary>
|
||||
public DelayLoadDirectoryTable? DelayLoadDirectoryTable { get; set; }
|
||||
|
||||
#region Named Sections
|
||||
|
||||
// .cormeta - CLR metadata is stored in this section. It is used to indicate that
|
||||
// the object file contains managed code. The format of the metadata is not
|
||||
// documented, but can be handed to the CLR interfaces for handling metadata.
|
||||
|
||||
/// <summary>
|
||||
/// Base relocation table (.reloc)
|
||||
/// </summary>
|
||||
public BaseRelocationBlock?[]? BaseRelocationTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Debug table (.debug*)
|
||||
/// </summary>
|
||||
public DebugTable? DebugTable { get; set; }
|
||||
|
||||
// .drectve - A section is a directive section if it has the IMAGE_SCN_LNK_INFO
|
||||
// flag set in the section header and has the .drectve section name. The linker
|
||||
// removes a .drectve section after processing the information, so the section
|
||||
// does not appear in the image file that is being linked.
|
||||
//
|
||||
// A .drectve section consists of a string of text that can be encoded as ANSI
|
||||
// or UTF-8. If the UTF-8 byte order marker (BOM, a three-byte prefix that
|
||||
// consists of 0xEF, 0xBB, and 0xBF) is not present, the directive string is
|
||||
// interpreted as ANSI. The directive string is a series of linker options that
|
||||
// are separated by spaces. Each option contains a hyphen, the option name, and
|
||||
// any appropriate attribute. If an option contains spaces, the option must be
|
||||
// enclosed in quotes. The .drectve section must not have relocations or line
|
||||
// numbers.
|
||||
//
|
||||
// TODO: Can we implement reading/parsing the .drectve section?
|
||||
|
||||
/// <summary>
|
||||
/// Export table (.edata)
|
||||
/// </summary>
|
||||
public ExportTable? ExportTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Import table (.idata)
|
||||
/// </summary>
|
||||
public ImportTable? ImportTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Resource directory table (.rsrc)
|
||||
/// </summary>
|
||||
public ResourceDirectoryTable? ResourceDirectoryTable { get; set; }
|
||||
|
||||
// .sxdata - The valid exception handlers of an object are listed in the .sxdata
|
||||
// section of that object. The section is marked IMAGE_SCN_LNK_INFO. It contains
|
||||
// the COFF symbol index of each valid handler, using 4 bytes per index.
|
||||
//
|
||||
// Additionally, the compiler marks a COFF object as registered SEH by emitting
|
||||
// the absolute symbol "@feat.00" with the LSB of the value field set to 1. A
|
||||
// COFF object with no registered SEH handlers would have the "@feat.00" symbol,
|
||||
// but no .sxdata section.
|
||||
//
|
||||
// TODO: Can we implement reading/parsing the .sxdata section?
|
||||
|
||||
#endregion
|
||||
|
||||
// TODO: Implement and/or document the following non-modeled parts:
|
||||
// - Delay-Load Import Tables
|
||||
// - [The Delay-Load Directory Table]
|
||||
// - Delay Import Address Table
|
||||
// - Delay Import Name Table
|
||||
// - Delay Bound Import Address Table
|
||||
// - Delay Unload Import Address Table
|
||||
// - The .pdata Section [Multiple formats per entry]
|
||||
// - The .tls Section
|
||||
// - TLS Callback Functions
|
||||
// - [The Load Configuration Structure (Image Only)]
|
||||
|
||||
// TODO: Determine if "Archive (Library) File Format" is worth modelling
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
namespace SabreTools.Models.PortableExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// The export data section, named .edata, contains information about symbols that other images
|
||||
/// can access through dynamic linking. Exported symbols are generally found in DLLs, but DLLs
|
||||
/// can also import symbols.
|
||||
///
|
||||
/// An overview of the general structure of the export section is described below. The tables
|
||||
/// described are usually contiguous in the file in the order shown (though this is not
|
||||
/// required). Only the export directory table and export address table are required to export
|
||||
/// symbols as ordinals. (An ordinal is an export that is accessed directly by its export
|
||||
/// address table index.) The name pointer table, ordinal table, and export name table all
|
||||
/// exist to support use of export names.
|
||||
/// </summary>
|
||||
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
|
||||
public sealed class ExportTable
|
||||
{
|
||||
/// <summary>
|
||||
/// A table with just one row (unlike the debug directory). This table indicates the
|
||||
/// locations and sizes of the other export tables.
|
||||
/// </summary>
|
||||
public ExportDirectoryTable? ExportDirectoryTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An array of RVAs of exported symbols. These are the actual addresses of the exported
|
||||
/// functions and data within the executable code and data sections. Other image files
|
||||
/// can import a symbol by using an index to this table (an ordinal) or, optionally, by
|
||||
/// using the public name that corresponds to the ordinal if a public name is defined.
|
||||
/// </summary>
|
||||
public ExportAddressTableEntry?[]? ExportAddressTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An array of pointers to the public export names, sorted in ascending order.
|
||||
/// </summary>
|
||||
public ExportNamePointerTable? NamePointerTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An array of the ordinals that correspond to members of the name pointer table. The
|
||||
/// correspondence is by position; therefore, the name pointer table and the ordinal table
|
||||
/// must have the same number of members. Each ordinal is an index into the export address
|
||||
/// table.
|
||||
/// </summary>
|
||||
public ExportOrdinalTable? OrdinalTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A series of null-terminated ASCII strings. Members of the name pointer table point into
|
||||
/// this area. These names are the public names through which the symbols are imported and
|
||||
/// exported; they are not necessarily the same as the private names that are used within
|
||||
/// the image file.
|
||||
/// </summary>
|
||||
public ExportNameTable? ExportNameTable { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace SabreTools.Models.PortableExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// All image files that import symbols, including virtually all executable (EXE) files,
|
||||
/// have an .idata section. A typical file layout for the import information follows:
|
||||
///
|
||||
/// - Directory Table
|
||||
/// Null Directory Entry
|
||||
/// - DLL1 Import Lookup Table
|
||||
/// Null
|
||||
/// - DLL2 Import Lookup Table
|
||||
/// Null
|
||||
/// - DLL3 Import Lookup Table
|
||||
/// Null
|
||||
/// - Hint-Name Table
|
||||
/// </summary>
|
||||
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
|
||||
public sealed class ImportTable
|
||||
{
|
||||
/// <summary>
|
||||
/// The import information begins with the import directory table, which describes the
|
||||
/// remainder of the import information.
|
||||
/// </summary>
|
||||
public ImportDirectoryTableEntry?[]? ImportDirectoryTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An import lookup table is an array of 32-bit numbers for PE32 or an array of 64-bit
|
||||
/// numbers for PE32+.
|
||||
/// </summary>
|
||||
public Dictionary<int, ImportLookupTableEntry?[]?>? ImportLookupTables { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// These addresses are the actual memory addresses of the symbols, although technically
|
||||
/// they are still called "virtual addresses".
|
||||
/// </summary>
|
||||
public Dictionary<int, ImportAddressTableEntry?[]?>? ImportAddressTables { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// One hint/name table suffices for the entire import section.
|
||||
/// </summary>
|
||||
public HintNameTableEntry?[]? HintNameTable { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,343 +0,0 @@
|
||||
namespace SabreTools.Models.PortableExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// The data directory entry for a pre-reserved SEH load configuration
|
||||
/// structure must specify a particular size of the load configuration
|
||||
/// structure because the operating system loader always expects it to
|
||||
/// be a certain value. In that regard, the size is really only a
|
||||
/// version check. For compatibility with Windows XP and earlier versions
|
||||
/// of Windows, the size must be 64 for x86 images.
|
||||
/// </summary>
|
||||
/// <see href="https://learn.microsoft.com/en-us/windows/win32/debug/pe-format"/>
|
||||
public sealed class LoadConfigurationDirectory
|
||||
{
|
||||
/// <summary>
|
||||
/// Flags that indicate attributes of the file, currently unused.
|
||||
/// </summary>
|
||||
public uint Characteristics { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Date and time stamp value. The value is represented in the number of
|
||||
/// seconds that have elapsed since midnight (00:00:00), January 1, 1970,
|
||||
/// Universal Coordinated Time, according to the system clock. The time
|
||||
/// stamp can be printed by using the C runtime (CRT) time function.
|
||||
/// </summary>
|
||||
public uint TimeDateStamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Major version number.
|
||||
/// </summary>
|
||||
public ushort MajorVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Minor version number.
|
||||
/// </summary>
|
||||
public ushort MinorVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The global loader flags to clear for this process as the loader starts
|
||||
/// the process.
|
||||
/// </summary>
|
||||
public uint GlobalFlagsClear { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The global loader flags to set for this process as the loader starts
|
||||
/// the process.
|
||||
/// </summary>
|
||||
public uint GlobalFlagsSet { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The default timeout value to use for this process's critical sections
|
||||
/// that are abandoned.
|
||||
/// </summary>
|
||||
public uint CriticalSectionDefaultTimeout { get; set; }
|
||||
|
||||
#region DeCommitFreeBlockThreshold
|
||||
|
||||
/// <summary>
|
||||
/// Memory that must be freed before it is returned to the system, in bytes.
|
||||
/// </summary>
|
||||
public uint DeCommitFreeBlockThreshold_PE32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Memory that must be freed before it is returned to the system, in bytes.
|
||||
/// </summary>
|
||||
public ulong DeCommitFreeBlockThreshold_PE32Plus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region DeCommitTotalFreeThreshold
|
||||
|
||||
/// <summary>
|
||||
/// Total amount of free memory, in bytes.
|
||||
/// </summary>
|
||||
public uint DeCommitTotalFreeThreshold_PE32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Total amount of free memory, in bytes.
|
||||
/// </summary>
|
||||
public ulong DeCommitTotalFreeThreshold_PE32Plus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region LockPrefixTable
|
||||
|
||||
/// <summary>
|
||||
/// [x86 only] The VA of a list of addresses where the LOCK prefix is used so
|
||||
/// that they can be replaced with NOP on single processor machines.
|
||||
/// </summary>
|
||||
public uint LockPrefixTable_PE32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [x86 only] The VA of a list of addresses where the LOCK prefix is used so
|
||||
/// that they can be replaced with NOP on single processor machines.
|
||||
/// </summary>
|
||||
public ulong LockPrefixTable_PE32Plus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region MaximumAllocationSize
|
||||
|
||||
/// <summary>
|
||||
/// Maximum allocation size, in bytes.
|
||||
/// </summary>
|
||||
public uint MaximumAllocationSize_PE32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Maximum allocation size, in bytes.
|
||||
/// </summary>
|
||||
public ulong MaximumAllocationSize_PE32Plus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region VirtualMemoryThreshold
|
||||
|
||||
/// <summary>
|
||||
/// Maximum virtual memory size, in bytes.
|
||||
/// </summary>
|
||||
public uint VirtualMemoryThreshold_PE32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Maximum virtual memory size, in bytes.
|
||||
/// </summary>
|
||||
public ulong VirtualMemoryThreshold_PE32Plus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region ProcessAffinityMask
|
||||
|
||||
/// <summary>
|
||||
/// Setting this field to a non-zero value is equivalent to calling
|
||||
/// SetProcessAffinityMask with this value during process startup (.exe only)
|
||||
/// </summary>
|
||||
public uint ProcessAffinityMask_PE32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Setting this field to a non-zero value is equivalent to calling
|
||||
/// SetProcessAffinityMask with this value during process startup (.exe only)
|
||||
/// </summary>
|
||||
public ulong ProcessAffinityMask_PE32Plus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Process heap flags that correspond to the first argument of the
|
||||
/// HeapCreate function. These flags apply to the process heap that
|
||||
/// is created during process startup.
|
||||
/// </summary>
|
||||
public uint ProcessHeapFlags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The service pack version identifier.
|
||||
/// </summary>
|
||||
public ushort CSDVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Must be zero.
|
||||
/// </summary>
|
||||
public ushort Reserved { get; set; }
|
||||
|
||||
#region EditList
|
||||
|
||||
/// <summary>
|
||||
/// Reserved for use by the system.
|
||||
/// </summary>
|
||||
public uint EditList_PE32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Reserved for use by the system.
|
||||
/// </summary>
|
||||
public ulong EditList_PE32Plus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region SecurityCookie
|
||||
|
||||
/// <summary>
|
||||
/// A pointer to a cookie that is used by Visual C++ or GS implementation.
|
||||
/// </summary>
|
||||
public uint SecurityCookie_PE32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A pointer to a cookie that is used by Visual C++ or GS implementation.
|
||||
/// </summary>
|
||||
public ulong SecurityCookie_PE32Plus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region SEHandlerTable
|
||||
|
||||
/// <summary>
|
||||
/// [x86 only] The VA of the sorted table of RVAs of each valid, unique
|
||||
/// SE handler in the image.
|
||||
/// </summary>
|
||||
public uint SEHandlerTable_PE32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [x86 only] The VA of the sorted table of RVAs of each valid, unique
|
||||
/// SE handler in the image.
|
||||
/// </summary>
|
||||
public ulong SEHandlerTable_PE32Plus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region SEHandlerCount
|
||||
|
||||
/// <summary>
|
||||
/// [x86 only] The count of unique handlers in the table.
|
||||
/// </summary>
|
||||
public uint SEHandlerCount_PE32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// [x86 only] The count of unique handlers in the table.
|
||||
/// </summary>
|
||||
public ulong SEHandlerCount_PE32Plus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region GuardCFCheckFunctionPointer
|
||||
|
||||
/// <summary>
|
||||
/// The VA where Control Flow Guard check-function pointer is stored.
|
||||
/// </summary>
|
||||
public uint GuardCFCheckFunctionPointer_PE32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The VA where Control Flow Guard check-function pointer is stored.
|
||||
/// </summary>
|
||||
public ulong GuardCFCheckFunctionPointer_PE32Plus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region GuardCFDispatchFunctionPointer
|
||||
|
||||
/// <summary>
|
||||
/// The VA where Control Flow Guard dispatch-function pointer is stored.
|
||||
/// </summary>
|
||||
public uint GuardCFDispatchFunctionPointer_PE32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The VA where Control Flow Guard dispatch-function pointer is stored.
|
||||
/// </summary>
|
||||
public ulong GuardCFDispatchFunctionPointer_PE32Plus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region GuardCFFunctionTable
|
||||
|
||||
/// <summary>
|
||||
/// The VA of the sorted table of RVAs of each Control Flow Guard
|
||||
/// function in the image.
|
||||
/// </summary>
|
||||
public uint GuardCFFunctionTable_PE32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The VA of the sorted table of RVAs of each Control Flow Guard
|
||||
/// function in the image.
|
||||
/// </summary>
|
||||
public ulong GuardCFFunctionTable_PE32Plus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region GuardCFFunctionCount
|
||||
|
||||
/// <summary>
|
||||
/// The count of unique RVAs in the above table.
|
||||
/// </summary>
|
||||
public uint GuardCFFunctionCount_PE32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The count of unique RVAs in the above table.
|
||||
/// </summary>
|
||||
public ulong GuardCFFunctionCount_PE32Plus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Control Flow Guard related flags.
|
||||
/// </summary>
|
||||
public GuardFlags GuardFlags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Code integrity information.
|
||||
/// </summary>
|
||||
/// <remarks>12 bytes</remarks>
|
||||
public byte[]? CodeIntegrity { get; set; }
|
||||
|
||||
#region GuardAddressTakenIatEntryTable
|
||||
|
||||
/// <summary>
|
||||
/// The VA where Control Flow Guard address taken IAT table is stored.
|
||||
/// </summary>
|
||||
public uint GuardAddressTakenIatEntryTable_PE32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The VA where Control Flow Guard address taken IAT table is stored.
|
||||
/// </summary>
|
||||
public ulong GuardAddressTakenIatEntryTable_PE32Plus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region GuardAddressTakenIatEntryCount
|
||||
|
||||
/// <summary>
|
||||
/// The count of unique RVAs in the above table.
|
||||
/// </summary>
|
||||
public uint GuardAddressTakenIatEntryCount_PE32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The count of unique RVAs in the above table.
|
||||
/// </summary>
|
||||
public ulong GuardAddressTakenIatEntryCount_PE32Plus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region GuardLongJumpTargetTable
|
||||
|
||||
/// <summary>
|
||||
/// The VA where Control Flow Guard long jump target table is stored.
|
||||
/// </summary>
|
||||
public uint GuardLongJumpTargetTable_PE32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The VA where Control Flow Guard long jump target table is stored.
|
||||
/// </summary>
|
||||
public ulong GuardLongJumpTargetTable_PE32Plus { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region GuardLongJumpTargetCount
|
||||
|
||||
/// <summary>
|
||||
/// The count of unique RVAs in the above table.
|
||||
/// </summary>
|
||||
public uint GuardLongJumpTargetCount_PE32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The count of unique RVAs in the above table.
|
||||
/// </summary>
|
||||
public ulong GuardLongJumpTargetCount_PE32Plus { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
namespace SabreTools.Models.PortableExecutable
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains information about each item in a menu resource that does not open a menu
|
||||
/// or a submenu. The structure definition provided here is for explanation only; it
|
||||
/// is not present in any standard header file.
|
||||
///
|
||||
/// Contains information about the menu items in a menu resource that open a menu
|
||||
/// or a submenu. The structure definition provided here is for explanation only;
|
||||
/// it is not present in any standard header file.
|
||||
/// </summary>
|
||||
/// <see href="https://learn.microsoft.com/en-us/windows/win32/menurc/normalmenuitem"/>
|
||||
/// <see href="https://learn.microsoft.com/en-us/windows/win32/menurc/popupmenuitem"/>
|
||||
public sealed class MenuItem
|
||||
{
|
||||
#region NORMALMENUITEM
|
||||
|
||||
/// <summary>
|
||||
/// The type of menu item.
|
||||
/// </summary>
|
||||
public MenuFlags NormalResInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A null-terminated Unicode string that contains the text for this menu item.
|
||||
/// There is no fixed limit on the size of this string.
|
||||
/// </summary>
|
||||
public string? NormalMenuText { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region POPUPMENUITEM
|
||||
|
||||
/// <summary>
|
||||
/// Describes the menu item.
|
||||
/// </summary>
|
||||
public MenuFlags PopupItemType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Describes the menu item.
|
||||
/// </summary>
|
||||
public MenuFlags PopupState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A numeric expression that identifies the menu item that is passed in the
|
||||
/// WM_COMMAND message.
|
||||
/// </summary>
|
||||
public uint PopupID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A set of bit flags that specify the type of menu item.
|
||||
/// </summary>
|
||||
public MenuFlags PopupResInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A null-terminated Unicode string that contains the text for this menu item.
|
||||
/// There is no fixed limit on the size of this string.
|
||||
/// </summary>
|
||||
public string? PopupMenuText { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
73
README.MD
73
README.MD
@@ -1,31 +1,64 @@
|
||||
# SabreTools.Models
|
||||
|
||||
[](https://github.com/SabreTools/SabreTools.Models/actions/workflows/build_and_test.yml)
|
||||
|
||||
This library comprises of models that represent either directly serializable or representative structures for all SabreTools projects. All of the main models representing metadata files should have parsers created outside of the current code.
|
||||
|
||||
Find the link to the Nuget package [here](https://www.nuget.org/packages/SabreTools.Models).
|
||||
|
||||
In most completed models for serialization, there is a section that looks like the following:
|
||||
## Releases
|
||||
|
||||
```c#
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
For the most recent stable build, download the latest release here: [Releases Page](https://github.com/SabreTools/SabreTools.Models/releases)
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyAttribute]
|
||||
public XmlAttribute[]? ADDITIONAL_ATTRIBUTES { get; set; }
|
||||
For the latest WIP build here: [Rolling Release](https://github.com/SabreTools/SabreTools.Models/releases/rolling)
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
[XmlAnyElement]
|
||||
public object[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
## Notable Information Sources
|
||||
|
||||
#endregion
|
||||
```
|
||||
Not all of this information was able to be gathered directly from the files in question, so here is a non-exhaustive list of sites and projects that allow this project to exist. Most of the models also have direct links to specific pages or code snippets, where available.
|
||||
|
||||
This code should be removed before the models are used. This is only included during debugging and implementation as to ensure that there are no notable holes in the models that would disallow 1:1 replication of inputs.
|
||||
|
||||
## Missing Metadata Models
|
||||
|
||||
The following metadata file formats do not have models included in this library yet and, as such, do not have serializers:
|
||||
|
||||
- Missfile
|
||||
- SabreJSON
|
||||
- SabreDAT XML
|
||||
| Site/Project | Models Directory |
|
||||
| --- | --- |
|
||||
| [3DBrew](https://www.3dbrew.org/wiki/Main_Page) | N3DS |
|
||||
| [Aaru Data Preservation Suite](https://github.com/aaru-dps) | PIC |
|
||||
| [Advanced Access Content System Licensing Administrator (AACS LA)](https://aacsla.com/) | AACS |
|
||||
| [BYTE*](https://web.archive.org/web/20240703222951/https://bytepointer.com/index.htm) | NewExecutable |
|
||||
| [cabextract/libmspack](https://www.cabextract.org.uk/) | LZ |
|
||||
| [DBox](https://dbox.tools/) | Xbox |
|
||||
| [DebugInfo.com](https://www.debuginfo.com/index.html) | PortableExecutable |
|
||||
| [Devilsclaw](https://devilsclaws.net/) | PFF |
|
||||
| [DSiBrew](https://dsibrew.org/wiki/Main_Page) | Nitro |
|
||||
| [DVD Resources for Open Source Development](https://dvd.sourceforge.net/) | DVD |
|
||||
| [EDM/2](https://www.edm2.com/index.php/Main_Page) | LinearExecutable |
|
||||
| [faydoc.tripod.com](https://faydoc.tripod.com/formats/) | LinearExecutable |
|
||||
| [GuitarGame_ChartFormats](https://github.com/TheNathannator/GuitarGame_ChartFormats/) | Charts |
|
||||
| [HandWiki](https://handwiki.org/wiki/Start) | Quantum |
|
||||
| [HLLib](https://github.com/RavuAlHemio/hllib/) | BSP, GCF, NCF, PAK, SGA, VPK, WAD3, XZP |
|
||||
| [IBM Documentation](https://www.ibm.com/docs/en) | TAR |
|
||||
| [IETF](https://www.ietf.org/) | GZIP |
|
||||
| [Independent Commodore Library](https://petlibrary.tripod.com/) | PKZIP |
|
||||
| [Ladislav Zezula](http://zezula.net/en/tools/main.html) | MoPaQ |
|
||||
| [libaacs](https://code.videolan.org/videolan/libaacs/) | AACS |
|
||||
| [libbdplus](https://github.com/mwgoldsmith/bdplus) | BD+ |
|
||||
| [libexe](https://github.com/libyal/libexe/) | NewExecutable |
|
||||
| [MAME](https://github.com/mamedev/mame/) | CHD |
|
||||
| [Matthew Russotto](http://www.russotto.net/quantumcomp.html) | Compression/Quantum |
|
||||
| [Microsoft Learn](https://learn.microsoft.com/en-us/) | BMP, CFB, Compression/LZX, Compression/MSZIP, MicrosoftCabinet, OLE, PortableExecutable, SecuROM, WiseInstaller |
|
||||
| [msitools](https://github.com/GNOME/msitools/) | CFB |
|
||||
| [OSDev.org](https://wiki.osdev.org/Expanded_Main_Page) | MSDOS, NewExecutable |
|
||||
| [PInvoke.net](http://www.pinvoke.net/index.aspx) | MSDOS |
|
||||
| [PKWARE(?)](https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT) | PKZIP |
|
||||
| [PS3 Developer Wiki](https://www.psdevwiki.com/ps3/) | IRD, PlayStation3 |
|
||||
| [RanseiLink](https://github.com/Deijin27/RanseiLink) | Nitro |
|
||||
| [Reverse Engineering Wise](https://codeberg.org/CYBERDEV/REWise) | WiseInstaller |
|
||||
| [SharpCompress](https://github.com/adamhathcock/sharpcompress) | PKZIP |
|
||||
| [Source SDK 2013](https://github.com/ValveSoftware/source-sdk-2013) | BSP |
|
||||
| [Technical Committee T10](https://www.t10.org/) | PIC |
|
||||
| [The Go tools for Windows + Assembler](https://www.godevtool.com/) | PortableExecutable |
|
||||
| [The Whole Half-Life](https://twhl.info/wiki/page/Specification:_WAD3) | WAD3 |
|
||||
| [Unshield](https://github.com/twogood/unshield) | InstallShieldCabinet |
|
||||
| [unshieldv3](https://github.com/wfr/unshieldv3) | InstallShieldArchiveV3 |
|
||||
| [Valve Developer Community](https://developer.valvesoftware.com/wiki/Main_Page) | BSP, VPK |
|
||||
| [w4kfu's bl0g](https://web.archive.org/web/20250206143756/http://blog.w4kfu.com/) | SafeDisc |
|
||||
| [Wine](https://github.com/wine-mirror/wine/) | LZ |
|
||||
| [XboxDevWiki.net](https://xboxdevwiki.net/Main_Page) | Xbox |
|
||||
| [XeNTaX Game Research Forum](http://web.archive.org/web/20231031162306/https://forum.xentax.com/) | SFFS |
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace SabreTools.Models.RomCenter
|
||||
{
|
||||
/// <remarks>[games]</remarks>
|
||||
public class Games
|
||||
{
|
||||
public Rom[]? Rom { get; set; }
|
||||
|
||||
#region DO NOT USE IN PRODUCTION
|
||||
|
||||
/// <remarks>Should be empty</remarks>
|
||||
public string[]? ADDITIONAL_ELEMENTS { get; set; }
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
namespace SabreTools.Models.SFFS
|
||||
{
|
||||
/// <see href="https://forum.xentax.com/viewtopic.php?f=21&t=2084"/>
|
||||
public sealed class FileEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// MD5 hash of filename (not encrypted,)
|
||||
/// </summary>
|
||||
/// <remarks>0x10 bytes</remarks>
|
||||
public byte[]? FilenameMD5Hash { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Index of fileheader (encrypted with filename)
|
||||
/// </summary>
|
||||
public ulong FileHeaderIndex { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
namespace SabreTools.Models.SGA
|
||||
{
|
||||
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/SGAFile.h"/>
|
||||
public sealed class Directory4 : SpecializedDirectory<Header4, DirectoryHeader4, Section4, Folder4, File4, ushort> { }
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Assembly Properties -->
|
||||
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0</TargetFrameworks>
|
||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Version>1.3.0</Version>
|
||||
|
||||
<!-- Package Properties -->
|
||||
<Authors>Matt Nadareski</Authors>
|
||||
<Description>Common models used by other SabreTools projects</Description>
|
||||
<Copyright>Copyright (c) Matt Nadareski 2022-2024</Copyright>
|
||||
<PackageProjectUrl>https://github.com/SabreTools/</PackageProjectUrl>
|
||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||
<RepositoryUrl>https://github.com/SabreTools/SabreTools.Models</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<PackageTags>model models executable protection archive</PackageTags>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="README.md" Pack="true" PackagePath="" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Support for old .NET versions -->
|
||||
<ItemGroup Condition="$(TargetFramework.StartsWith(`net2`)) OR $(TargetFramework.StartsWith(`net3`))">
|
||||
<PackageReference Include="MinValueTupleBridge" Version="0.2.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$(TargetFramework.StartsWith(`net4`))">
|
||||
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.31903.59
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SabreTools.Models", "SabreTools.Models.csproj", "{51F0D5D9-7C2B-445A-8ECD-4A47B33609C4}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SabreTools.Models", "SabreTools.Models\SabreTools.Models.csproj", "{51F0D5D9-7C2B-445A-8ECD-4A47B33609C4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace SabreTools.Models.AACS
|
||||
{
|
||||
/// <summary>
|
||||
@@ -8,6 +10,7 @@ namespace SabreTools.Models.AACS
|
||||
/// <summary>
|
||||
/// Null-terminated ASCII string representing the copyright
|
||||
/// </summary>
|
||||
public string? Copyright { get; set; }
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string? Copyright;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace SabreTools.Models.AACS
|
||||
{
|
||||
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public sealed class DriveRevocationListEntry
|
||||
{
|
||||
/// <summary>
|
||||
@@ -9,13 +12,14 @@ namespace SabreTools.Models.AACS
|
||||
/// field indicates that only one ID is being revoked, a value of one
|
||||
/// in the Range field indicates two ID’s are being revoked, and so on.
|
||||
/// </summary>
|
||||
public ushort Range { get; set; }
|
||||
public ushort Range;
|
||||
|
||||
/// <summary>
|
||||
/// A 6-byte Drive ID value identifying the Licensed Drive being revoked
|
||||
/// (or the first in a range of Licensed Drives being revoked, in the
|
||||
/// case of a non-zero Range value).
|
||||
/// </summary>
|
||||
public byte[]? DriveID { get; set; }
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||
public byte[]? DriveID;
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,6 @@ namespace SabreTools.Models.AACS
|
||||
/// <summary>
|
||||
/// Revocation list entries
|
||||
/// </summary>
|
||||
public DriveRevocationSignatureBlock?[]? SignatureBlocks { get; set; }
|
||||
public DriveRevocationSignatureBlock[]? SignatureBlocks { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,6 @@ namespace SabreTools.Models.AACS
|
||||
/// A list of 8-byte Host Drive List Entry fields, the length of this
|
||||
/// list being equal to the number in the signature block.
|
||||
/// </summary>
|
||||
public DriveRevocationListEntry?[]? EntryFields { get; set; }
|
||||
public DriveRevocationListEntry[]? EntryFields { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,20 @@ namespace SabreTools.Models.AACS
|
||||
/// Section 3.2.5.2, which are only processed by Class II Licensed Products.
|
||||
/// </summary>
|
||||
Type10 = 0x000A1003,
|
||||
|
||||
/// <summary>
|
||||
/// Type 2.0 Category C.
|
||||
/// This is the Media Key Block Type found on "UHD" media (AACS v2.0)
|
||||
/// </summary>
|
||||
/// <see href="https://code.videolan.org/videolan/libaacs/-/blob/master/src/libaacs/mkb.h"/>
|
||||
Type20 = 0x48141003,
|
||||
|
||||
/// <summary>
|
||||
/// Type 2.1 Category C.
|
||||
/// This is the Media Key Block Type found on "UHD" media (AACS v2.1)
|
||||
/// </summary>
|
||||
/// <see href="https://code.videolan.org/videolan/libaacs/-/blob/master/src/libaacs/mkb.h"/>
|
||||
Type21 = 0x48151003,
|
||||
}
|
||||
|
||||
public enum RecordType : byte
|
||||
@@ -35,6 +49,7 @@ namespace SabreTools.Models.AACS
|
||||
ExplicitSubsetDifference = 0x04,
|
||||
MediaKeyData = 0x05,
|
||||
SubsetDifferenceIndex = 0x07,
|
||||
MediaKeyVariantData = 0x0C,
|
||||
TypeAndVersion = 0x10,
|
||||
DriveRevocationList = 0x20,
|
||||
HostRevocationList = 0x21,
|
||||
@@ -42,5 +57,13 @@ namespace SabreTools.Models.AACS
|
||||
|
||||
// Not documented
|
||||
Copyright = 0x7F,
|
||||
|
||||
// Record types only found in UHD media (AACS v2)
|
||||
// <see href="https://code.videolan.org/videolan/libaacs/-/blob/master/src/devtools/mkb_dump.c"/>
|
||||
Unknown0x28_AACS2 = 0x28,
|
||||
DriveRevocationList_AACS2 = 0x30,
|
||||
HostRevocationList_AACS2 = 0x31,
|
||||
VerifyMediaKey_AACS2 = 0x86,
|
||||
EmptyRecord0xF8_AACS2 = 0xF8,
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,6 @@ namespace SabreTools.Models.AACS
|
||||
/// <summary>
|
||||
/// In this record, each subset-difference is encoded with 5 bytes.
|
||||
/// </summary>
|
||||
public SubsetDifference?[]? SubsetDifferences { get; set; }
|
||||
public SubsetDifference[]? SubsetDifferences { get; set; }
|
||||
}
|
||||
}
|
||||
13
SabreTools.Models/AACS/GenericRecord.cs
Normal file
13
SabreTools.Models/AACS/GenericRecord.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace SabreTools.Models.AACS
|
||||
{
|
||||
/// <summary>
|
||||
/// This represents any record that does not have a concrete model yet
|
||||
/// </summary>
|
||||
public sealed class GenericRecord : Record
|
||||
{
|
||||
/// <summary>
|
||||
/// Unparsed data comprising the record after the header
|
||||
/// </summary>
|
||||
public byte[]? Data { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace SabreTools.Models.AACS
|
||||
{
|
||||
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public sealed class HostRevocationListEntry
|
||||
{
|
||||
/// <summary>
|
||||
@@ -9,13 +12,14 @@ namespace SabreTools.Models.AACS
|
||||
/// field indicates that only one ID is being revoked, a value of one
|
||||
/// in the Range field indicates two ID’s are being revoked, and so on.
|
||||
/// </summary>
|
||||
public ushort Range { get; set; }
|
||||
public ushort Range;
|
||||
|
||||
/// <summary>
|
||||
/// A 6-byte Host ID value identifying the host being revoked (or the
|
||||
/// first in a range of hosts being revoked, in the case of a non-zero
|
||||
/// Range value).
|
||||
/// </summary>
|
||||
public byte[]? HostID { get; set; }
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||
public byte[]? HostID;
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,6 @@ namespace SabreTools.Models.AACS
|
||||
/// <summary>
|
||||
/// Revocation list entries
|
||||
/// </summary>
|
||||
public HostRevocationSignatureBlock?[]? SignatureBlocks { get; set; }
|
||||
public HostRevocationSignatureBlock[]? SignatureBlocks { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,6 @@ namespace SabreTools.Models.AACS
|
||||
/// A list of 8-byte Host Revocation List Entry fields, the length of this
|
||||
/// list being equal to the number in the signature block.
|
||||
/// </summary>
|
||||
public HostRevocationListEntry?[]? EntryFields { get; set; }
|
||||
public HostRevocationListEntry[]? EntryFields { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,6 @@ namespace SabreTools.Models.AACS
|
||||
/// <summary>
|
||||
/// Records
|
||||
/// </summary>
|
||||
public Record?[]? Records { get; set; }
|
||||
public Record[]? Records { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace SabreTools.Models.AACS
|
||||
{
|
||||
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public sealed class SubsetDifference
|
||||
{
|
||||
/// <summary>
|
||||
@@ -9,12 +12,12 @@ namespace SabreTools.Models.AACS
|
||||
/// the mask. For example, the value 0x01 denotes a mask of
|
||||
/// 0xFFFFFFFE; value 0x0A denotes a mask of 0xFFFFFC00.
|
||||
/// </summary>
|
||||
public byte Mask { get; set; }
|
||||
public byte Mask;
|
||||
|
||||
/// <summary>
|
||||
/// The last 4 bytes are the uv number, most significant
|
||||
/// byte first.
|
||||
/// </summary>
|
||||
public uint Number { get; set; }
|
||||
public uint Number;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user