79 Commits
1.4.7 ... 1.5.7

Author SHA1 Message Date
Matt Nadareski
2749c2f5bd Bump version 2024-12-11 11:25:41 -05:00
Matt Nadareski
41ce962700 Reorder LZ constants 2024-12-11 11:10:01 -05:00
Matt Nadareski
85b7103bd3 Re-rename Expand to SZDD for consistency 2024-12-11 11:09:28 -05:00
Matt Nadareski
4c61a191e8 Remove MS-ZIP Block type 2024-12-11 11:00:44 -05:00
Matt Nadareski
0f70598969 Add LZ prefixes for easier checking 2024-12-11 10:58:47 -05:00
Matt Nadareski
d6b057d808 Move LZ models out of Compression namespace 2024-12-11 10:54:10 -05:00
Matt Nadareski
3d8036e7b5 Remove things that Compression doesn't need anymore 2024-12-11 10:46:28 -05:00
Matt Nadareski
bb35946866 Ensure KWAJ header flags serialized 2024-12-11 04:19:02 -05:00
Matt Nadareski
78f9f1b36f Fix KWAJ serialization 2024-12-11 04:16:23 -05:00
Matt Nadareski
9d1b1ca36d Further simplify LZ models 2024-12-11 03:48:10 -05:00
Matt Nadareski
6e1f8bf55e Fix issues with MS-LZ models 2024-12-11 01:50:02 -05:00
Matt Nadareski
a19afc240c Bump version 2024-12-10 15:28:49 -05:00
Matt Nadareski
148e97ef64 Add now-supported DOSCenter SHA-1 attribute 2024-12-07 23:28:52 -05:00
Matt Nadareski
676b446025 Add badge for build status 2024-12-06 10:48:43 -05:00
Matt Nadareski
aeff75d8d3 Rename workflow file, add releases to README 2024-12-06 10:47:42 -05:00
Matt Nadareski
e20e515f56 Attempt to use publish script 2024-12-06 10:43:08 -05:00
Matt Nadareski
bf02266f0f Bump version 2024-11-29 19:51:47 -05:00
Matt Nadareski
b521e503c2 Rearrange SGA 2024-11-28 20:26:58 -05:00
Matt Nadareski
48e79d26ed Ensure nullable arrays are correct 2024-11-27 23:37:25 -05:00
Matt Nadareski
989ef41c6d Get/Set may be fully disallowed? 2024-11-27 21:31:33 -05:00
Matt Nadareski
6b0c4c3024 Bump version 2024-11-27 21:15:05 -05:00
Matt Nadareski
4b54d0f4dc Fix build 2024-11-27 21:09:01 -05:00
Matt Nadareski
2bc1cfc5d0 Cleanup from issues in Serialization 2024-11-27 21:03:50 -05:00
Matt Nadareski
362abfdc64 Remove layout from CopyrightRecord 2024-11-27 10:38:58 -05:00
Matt Nadareski
a06ff8f8b3 Bump version 2024-11-20 14:03:14 -05:00
Matt Nadareski
7269e91913 Partially add VBSP lump 40 2024-11-19 14:34:32 -05:00
Matt Nadareski
c118271565 Add VBSP lump 29 2024-11-19 14:30:54 -05:00
Matt Nadareski
71ccbc6ab1 Fix issues found during Serialization update 2024-11-19 12:47:09 -05:00
Matt Nadareski
ed5c1a7173 Use array-of-array instead of multidimensional array 2024-11-18 23:35:47 -05:00
Matt Nadareski
0451af3eb4 Bump version 2024-11-18 20:37:56 -05:00
Matt Nadareski
7967eb29eb Move Deflate constants to new file 2024-11-18 12:09:48 -05:00
Matt Nadareski
6bbe904cc3 Move Deflate-specific models to separate namespace 2024-11-18 10:04:45 -05:00
Matt Nadareski
dce9d98885 Add GZIP models 2024-11-18 02:45:07 -05:00
Matt Nadareski
f862e018fb Update VPK models 2024-11-18 02:13:52 -05:00
Matt Nadareski
b4a5154da8 Update VBSP models 2024-11-18 01:59:46 -05:00
Matt Nadareski
077aa3c57e Update BSP models 2024-11-17 21:20:50 -05:00
Matt Nadareski
ea8630ba8c Update WAD3 models 2024-11-17 19:56:59 -05:00
Matt Nadareski
385491c67b Framework only matters for executable 2024-11-15 20:16:03 -05:00
Matt Nadareski
f57461e0c3 Make obsolete types NoWarn instead of ignore 2024-11-15 20:10:16 -05:00
Matt Nadareski
18f49ac43f It was correct 2024-11-14 11:19:21 -05:00
Matt Nadareski
28fd81adab Minor tweaks 2024-11-13 23:12:37 -05:00
Matt Nadareski
ecca68822d Bump version 2024-11-13 20:33:38 -05:00
Matt Nadareski
58c2dcbe4f Fix duplicate data bug in N3DS cart data 2024-11-13 17:03:57 -05:00
Matt Nadareski
f9b8717abb Add .NET 9 to target frameworks 2024-11-13 00:33:49 -05:00
Matt Nadareski
6a356a5874 Add .NET 9 to target frameworks 2024-11-13 00:19:00 -05:00
Matt Nadareski
88c6a0302f Add .NET 9 to target frameworks 2024-11-13 00:16:28 -05:00
Matt Nadareski
5282db965f Bump version 2024-11-13 00:12:59 -05:00
Matt Nadareski
33217a7efe Remove "overflow" fields finally 2024-11-13 00:09:20 -05:00
Matt Nadareski
c8583589d6 Add .NET 9 to target frameworks 2024-11-12 23:58:35 -05:00
Matt Nadareski
6ed2b406d7 Add .NET 9 to target frameworks 2024-11-12 23:57:23 -05:00
Matt Nadareski
4b08e0f5dd Add keys to Rom for MD2/4 2024-11-12 12:41:39 -05:00
Matt Nadareski
e8259fed12 Add placeholders to main hashfile 2024-11-12 12:40:17 -05:00
Matt Nadareski
d06df28f72 Add placeholder models for MD2/MD4 2024-11-12 12:39:38 -05:00
Matt Nadareski
f73ff87922 Make CHD headers (mostly) serializable 2024-11-12 12:31:23 -05:00
Matt Nadareski
dd6b79a21b Use collection expressions 2024-11-12 12:23:47 -05:00
Matt Nadareski
d3daa2c4aa Add GameHeader models 2024-11-04 13:45:05 -05:00
Matt Nadareski
1620d00edf Technically use CodecType 2024-10-31 13:42:37 -04:00
Matt Nadareski
5565fa2fc3 Bump version 2024-10-31 11:08:14 -04:00
Matt Nadareski
e088e203ea Tags are tags, use them 2024-10-31 00:26:46 -04:00
Matt Nadareski
acc8d95930 Correctly redefine const as enum 2024-10-31 00:15:43 -04:00
Matt Nadareski
1a76c59827 Port significantly more CHD info 2024-10-31 00:05:19 -04:00
Matt Nadareski
8725ec0337 Port more CHD info from SabreTools 2024-10-19 23:58:56 -04:00
Matt Nadareski
8991cc460d Correct info for IS-CAB components 2024-10-03 02:49:47 -04:00
Matt Nadareski
98ce8b65ec Correct info for IS-CAB file groups 2024-10-03 02:35:15 -04:00
Matt Nadareski
ca58343c30 Bump version 2024-10-01 12:32:33 -04:00
Matt Nadareski
2f637e0012 Remove ValueTuple requirement 2024-10-01 01:41:43 -04:00
Matt Nadareski
80172942fd Mark extended TAR header info 2024-09-26 14:08:55 -04:00
Matt Nadareski
aa0960b42f Separate entry from archive in TAR 2024-09-26 13:45:49 -04:00
Matt Nadareski
2554f64277 Add layout for TAR header 2024-09-26 12:15:59 -04:00
Matt Nadareski
4c5c960915 Slight tweak to TAR header (nw) 2024-09-26 12:03:20 -04:00
Matt Nadareski
1cb49163dd Upate MinValueTupleBridge to 0.2.1 2024-09-25 10:46:16 -04:00
Matt Nadareski
d144dd47a1 Bump version 2024-08-08 14:19:26 -04:00
Matt Nadareski
c4247c7ccb Move readme back to where it should be 2024-08-08 14:16:26 -04:00
Matt Nadareski
1e77437167 Fixup csproj a bit 2024-08-08 14:15:30 -04:00
Matt Nadareski
3d79e07d76 Move project to subfolder 2024-08-08 14:11:45 -04:00
Matt Nadareski
9d50d577ab Fix things found during NDecrypt usage 2024-08-08 13:18:47 -04:00
Matt Nadareski
494ca175fb Fix layout of ISv3 directory 2024-06-03 11:57:30 -04:00
Matt Nadareski
73b3d4a7a8 Bump version 2024-05-15 14:09:49 -04:00
Matt Nadareski
bd40158423 Forgot to check... 2024-05-15 14:08:14 -04:00
836 changed files with 6881 additions and 3018 deletions

View File

@@ -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
- name: Restore dependencies
run: dotnet restore
- name: Pack
run: dotnet pack
dotnet-version: 9.0.x
- name: Run publish script
run: ./publish-nix.sh
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: 'Nuget Package'
path: 'bin/Release/*.nupkg'
path: '*.nupkg'
- name: Upload to rolling
uses: ncipollo/release-action@v1.14.0
with:
allowUpdates: True
artifacts: 'bin/Release/*.nupkg'
artifacts: '*.nupkg'
body: 'Last built commit: ${{ github.sha }}'
name: 'Rolling Release'
prerelease: True

View File

@@ -11,7 +11,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Build
run: dotnet build

View File

@@ -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
}
}

View File

@@ -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;
}
}

View File

@@ -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; }
}
}

View File

@@ -1,14 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/BSPFile.h"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Header
{
/// <summary>
/// Version
/// </summary>
public uint Version;
}
}

View File

@@ -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; }
}
}

View File

@@ -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,
}
}

View File

@@ -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;
}
}

View File

@@ -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,
}
}

View File

@@ -1,22 +0,0 @@
using System.Runtime.InteropServices;
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"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class FileHeaader
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
public string? Magic;
public byte CompressionType;
[MarshalAs(UnmanagedType.U1)]
public char LastChar;
public uint RealLength;
}
}

View File

@@ -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; }
}
}

View File

@@ -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; }
}
}

View File

@@ -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; }
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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; }
}
}

View File

@@ -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; }
}
}

View File

@@ -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
}
}

View File

@@ -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,
}
}

View File

@@ -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
}
}

View File

@@ -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; }
}
}

View File

@@ -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,
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -1,26 +1,16 @@
# SabreTools.Models
[![Build and Test](https://github.com/SabreTools/SabreTools.Models/actions/workflows/build_and_test.yml/badge.svg?branch=main)](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; }
/// <remarks>Should be empty</remarks>
[XmlAnyElement]
public object[]? ADDITIONAL_ELEMENTS { get; set; }
#endregion
```
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.
For the latest WIP build here: [Rolling Release](https://github.com/SabreTools/SabreTools.Models/releases/rolling)
## Missing Metadata Models

View File

@@ -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
}
}

View File

@@ -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> { }
}

View File

@@ -1,41 +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.4.7</Version>
<WarningsNotAsErrors>CS0618</WarningsNotAsErrors>
<!-- 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>

View File

@@ -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

View File

@@ -5,7 +5,6 @@ namespace SabreTools.Models.AACS
/// <summary>
/// This record type is undocumented but found in real media key blocks
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public sealed class CopyrightRecord : Record
{
/// <summary>

View File

@@ -21,6 +21,6 @@ namespace SabreTools.Models.AACS
/// <summary>
/// Revocation list entries
/// </summary>
public DriveRevocationSignatureBlock?[]? SignatureBlocks { get; set; }
public DriveRevocationSignatureBlock[]? SignatureBlocks { get; set; }
}
}

View File

@@ -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; }
}
}

View File

@@ -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; }
}
}

View File

@@ -24,6 +24,6 @@ namespace SabreTools.Models.AACS
/// <summary>
/// Revocation list entries
/// </summary>
public HostRevocationSignatureBlock?[]? SignatureBlocks { get; set; }
public HostRevocationSignatureBlock[]? SignatureBlocks { get; set; }
}
}

View File

@@ -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; }
}
}

View File

@@ -9,6 +9,6 @@ namespace SabreTools.Models.AACS
/// <summary>
/// Records
/// </summary>
public Record?[]? Records { get; set; }
public Record[]? Records { get; set; }
}
}

View File

@@ -201,17 +201,5 @@ namespace SabreTools.Models.ArchiveDotOrg
public string? Width { get; set; }
#endregion
#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
}
}

View File

@@ -0,0 +1,12 @@
using System.Xml;
using System.Xml.Serialization;
namespace SabreTools.Models.ArchiveDotOrg
{
[XmlRoot("files")]
public class Files
{
[XmlElement("file")]
public File[]? File { get; set; }
}
}

View File

@@ -8,6 +8,6 @@ namespace SabreTools.Models.AttractMode
[Required]
public string[]? Header { get; set; }
public Row?[]? Row { get; set; }
public Row[]? Row { get; set; }
}
}

View File

@@ -47,12 +47,5 @@ namespace SabreTools.Models.AttractMode
public string? PlayedTime { get; set; }
public string? FileIsAvailable { get; set; }
#region DO NOT USE IN PRODUCTION
/// <remarks>Should be empty</remarks>
public string[]? ADDITIONAL_ELEMENTS { get; set; }
#endregion
}
}

View File

@@ -1,3 +1,5 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BDPlus
{
/// <see href="https://github.com/mwgoldsmith/bdplus/blob/master/src/libbdplus/bdsvm/loader.c"/>
@@ -6,40 +8,39 @@ namespace SabreTools.Models.BDPlus
/// <summary>
/// "BDSVM_CC"
/// </summary>
/// <remarks>8 bytes</remarks>
public string? Signature { get; set; }
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
public string? Signature;
/// <summary>
/// Unknown data
/// </summary>
/// <remarks>5 bytes</remarks>
public byte[]? Unknown1 { get; set; }
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public byte[]? Unknown1 = new byte[5];
/// <summary>
/// Version year
/// </summary>
public ushort Year { get; set; }
public ushort Year;
/// <summary>
/// Version month
/// </summary>
public byte Month { get; set; }
public byte Month;
/// <summary>
/// Version day
/// </summary>
public byte Day { get; set; }
public byte Day;
/// <summary>
/// Unknown data
/// </summary>
/// <remarks>4 bytes</remarks>
public byte[]? Unknown2 { get; set; }
public uint Unknown2;
/// <summary>
/// Length
/// </summary>
public uint Length { get; set; }
public uint Length;
/// <summary>
/// Length bytes of data

View File

@@ -2,7 +2,7 @@ namespace SabreTools.Models.BFPK
{
public static class Constants
{
public static readonly byte[] SignatureBytes = new byte[] { 0x42, 0x46, 0x50, 0x4b };
public static readonly byte[] SignatureBytes = [0x42, 0x46, 0x50, 0x4b];
public const string SignatureString = "BFPK";

View File

@@ -0,0 +1,11 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class AmbientIndexLump : Lump
{
/// <summary>
/// Indicies
/// </summary>
public LeafAmbientIndex[]? Indicies { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class AmbientLightingLump : Lump
{
/// <summary>
/// Lightings
/// </summary>
public LeafAmbientLighting[]? Lightings { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// The brush lump (Lump 18) contains all brushes that were
/// present in the original VMF file before compiling.
/// Unlike faces, brushes are constructive solid geometry (CSG)
/// defined by planes instead of edges and vertices. It is the
/// presence of the brush and brushside lumps in Source BSP
/// files that makes decompiling them a much easier job than
/// for GoldSrc files, which lacked this info.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Brush
{
/// <summary>
/// First brushside
/// </summary>
public int FirstSide;
/// <summary>
/// Number of brushsides
/// </summary>
public int NumSides;
/// <summary>
/// Contents flags
/// </summary>
public VbspContents Contents;
}
}

View File

@@ -0,0 +1,11 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class BrushesLump : Lump
{
/// <summary>
/// Brushes
/// </summary>
public Brush[]? Brushes { get; set; }
}
}

View File

@@ -0,0 +1,48 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// Planenum is an index info the plane array, giving the plane
/// corresponding to this brushside. Texinfo and dispinfo are
/// references into the texture and displacement info lumps.
/// Bevel is zero for normal brush sides, but 1 if the side is
/// a bevel plane (which seem to be used for collision detection).
///
/// Unlike the face array, brushsides are not culled (removed)
/// where they touch the void. Void-facing sides do however have
/// their texinfo entry changed to the tools/toolsnodraw texture
/// during the compile process. Note there is no direct way of
/// linking brushes and brushsides and the corresponding face array
/// entries which are used to render that brush. Brushsides are
/// used by the engine to calculate all player physics collision
/// with world brushes. (Vphysics objects use lump 29 instead.)
///
/// The maximum number of brushsides is 65536 (MAX_MAP_BRUSHSIDES).
/// The maximum number of brushsides on a single brush is 128 (MAX_BRUSH_SIDES).
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Brushside
{
/// <summary>
/// Facing out of the leaf
/// </summary>
public ushort PlaneNum;
/// <summary>
/// Texture info
/// </summary>
public short TextureInfo;
/// <summary>
/// Displacement info
/// </summary>
public short DisplacementInfo;
/// <summary>
/// Is the side a bevel plane?
/// </summary>
public short Bevel;
}
}

View File

@@ -0,0 +1,11 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class BrushsidesLump : Lump
{
/// <summary>
/// Brushsides
/// </summary>
public Brushside[]? Brushsides { get; set; }
}
}

View File

@@ -0,0 +1,66 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// The face lump contains the surfaces of the scene.
///
/// The first number of this data structure is an index into
/// the planes lump giving a plane which is parallel to this
/// face (meaning they share the same normal). The second
/// value may be seen as a boolean. If nPlaneSide equals 0,
/// then the normal vector of this face equals the one of the
/// parallel plane exactly. Otherwise, the normal of the plane
/// has to be multiplied by -1 to point into the right direction.
/// Afterwards we have an index into the surfedges lump, as
/// well as the count of consecutive surfedges from that position.
/// Furthermore there is an index into the texture info lump,
/// which is used to find the BSPTEXINFO structure needed to
/// calculate the texture coordinates for this face. Afterwards,
/// there are four bytes giving some lighting information (partly
/// used by the renderer to hide sky surfaces). Finally we have
/// an offset in byes giving the beginning of the binary lightmap
/// data of this face in the lighting lump.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BspFace
{
/// <summary>
/// Plane the face is parallel to
/// </summary>
public ushort PlaneIndex;
/// <summary>
/// Set if different normals orientation
/// </summary>
public ushort PlaneSideCount;
/// <summary>
/// Index of the first surfedge
/// </summary>
public uint FirstEdgeIndex;
/// <summary>
/// Number of consecutive surfedges
/// </summary>
public ushort NumberOfEdges;
/// <summary>
/// Index of the texture info structure
/// </summary>
public ushort TextureInfoIndex;
/// <summary>
/// Specify lighting styles
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public byte[]? LightingStyles = new byte[4];
/// <summary>
/// Offsets into the raw lightmap data; if less than zero,
/// then a lightmap was not baked for the given face.
/// </summary>
public int LightmapOffset;
}
}

View File

@@ -0,0 +1,11 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
public sealed class BspFacesLump : Lump
{
/// <summary>
/// Faces
/// </summary>
public BspFace[]? Faces { get; set; }
}
}

View File

@@ -0,0 +1,94 @@
namespace SabreTools.Models.BSP
{
/// <summary>
/// Half-Life Level
/// </summary>
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/BSPFile.h"/>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
public sealed class BspFile
{
/// <summary>
/// Header data
/// </summary>
public BspHeader? Header { get; set; }
#region Lumps
/// <summary>
/// LUMP_ENTITIES [0]
/// </summary>
public EntitiesLump? Entities { get; set; }
/// <summary>
/// LUMP_PLANES [1]
/// </summary>
public PlanesLump? PlanesLump { get; set; }
/// <summary>
/// LUMP_TEXTURES [2]
/// </summary>
public TextureLump? TextureLump { get; set; }
/// <summary>
/// LUMP_VERTICES [3]
/// </summary>
public VerticesLump? VerticesLump { get; set; }
/// <summary>
/// LUMP_VISIBILITY [4]
/// </summary>
public VisibilityLump? VisibilityLump { get; set; }
/// <summary>
/// LUMP_NODES [5]
/// </summary>
public BspNodesLump? NodesLump { get; set; }
/// <summary>
/// LUMP_TEXINFO [6]
/// </summary>
public BspTexinfoLump? TexinfoLump { get; set; }
/// <summary>
/// LUMP_FACES [7]
/// </summary>
public BspFacesLump? FacesLump { get; set; }
/// <summary>
/// LUMP_LIGHTING [8]
/// </summary>
public LightmapLump? LightmapLump { get; set; }
/// <summary>
/// LUMP_CLIPNODES [9]
/// </summary>s
public ClipnodesLump? ClipnodesLump { get; set; }
/// <summary>
/// LUMP_LEAVES [10]
/// </summary>
public BspLeavesLump? LeavesLump { get; set; }
/// <summary>
/// LUMP_MARKSURFACES [11]
/// </summary>
public MarksurfacesLump? MarksurfacesLump { get; set; }
/// <summary>
/// LUMP_EDGES [12]
/// </summary>
public EdgesLump? EdgesLump { get; set; }
/// <summary>
/// LUMP_SURFEDGES [13]
/// </summary>
public SurfedgesLump? SurfedgesLump { get; set; }
/// <summary>
/// LUMP_MODELS [14]
/// </summary>
public BspModelsLump? ModelsLump { get; set; }
#endregion
}
}

View File

@@ -0,0 +1,23 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/BSPFile.h"/>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BspHeader
{
/// <summary>
/// Version
/// </summary>
/// <remarks>Must be 30 for a valid HL BSP file</remarks>
public int Version;
/// <summary>
/// Lumps
/// </summary>
/// <remarks>15 entries</remarks>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.BSP_HEADER_LUMPS)]
public BspLumpEntry[]? Lumps;
}
}

View File

@@ -0,0 +1,67 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// The leaves lump contains the leaves of the BSP tree.
///
/// The first entry of this struct is the type of the content
/// of this leaf. It can be one of the predefined values, found
/// in the compiler source codes, and is litte relevant for the
/// actual rendering process. All the more important is the
/// next integer containing the offset into the vis lump. It
/// defines the start of the raw PVS data for this leaf. If this
/// value equals -1, no VIS lists are available for this leaf,
/// usually if the map has been built without the VIS compiler.
/// The next two 16bit integer triples span the bounding box of
/// this leaf. Furthermore, the struct contains an index pointing
/// into the array of marksurfaces loaded from the marksufaces
/// lump as well as the number of consecutive marksurfaces belonging
/// to this leaf. The marksurfaces are looped through during the
/// rendering process and point to the actual faces. The final 4 bytes
/// specify the volume of ambient sounds in Quake, but are unused in
/// GoldSrc.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BspLeaf
{
/// <summary>
/// Contents enumeration
/// </summary>
public BspContents Contents;
/// <summary>
/// Offset into the visibility lump
/// </summary>
public int VisOffset;
/// <summary>
/// Defines bounding box
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public short[] Mins = new short[3];
/// <summary>
/// Defines bounding box
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public short[] Maxs = new short[3];
/// <summary>
/// Index into marksurfaces array
/// </summary>
public ushort FirstMarkSurfaceIndex;
/// <summary>
/// Count of marksurfaces array
/// </summary>
public ushort MarkSurfacesCount;
/// <summary>
/// Ambient sound levels
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public byte[]? AmbientLevels = new byte[4];
}
}

View File

@@ -0,0 +1,11 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
public sealed class BspLeavesLump : Lump
{
/// <summary>
/// Leaves
/// </summary>
public BspLeaf[]? Leaves { get; set; }
}
}

View File

@@ -3,17 +3,18 @@ using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/BSPFile.h"/>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Lump
public class BspLumpEntry
{
/// <summary>
/// Offset
/// File offset to data
/// </summary>
public uint Offset;
public int Offset;
/// <summary>
/// Length
/// Length of data
/// </summary>
public uint Length;
public int Length;
}
}

View File

@@ -0,0 +1,63 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// A model is kind of a mini BSP tree. Its size is determinded
/// by the bounding box spaned by the first to members of this
/// struct. The major difference between a model and the BSP
/// tree holding the scene is that the models use a local
/// coordinate system for their vertexes and just state its
/// origin in world coordinates. During rendering the coordinate
/// system is translated to the origin of the model (glTranslate())
/// and moved back after the models BSP tree has been traversed.
/// Furthermore their are 4 indexes into node arrays. The first
/// one has proofed to index the root node of the mini BSP tree
/// used for rendering. The other three indexes could probably be
/// used for collision detection, meaning they point into the
/// clipnodes, but I am not sure about this. The meaning of the
/// next value is also somehow unclear to me. Finally their are
/// direct indexes into the faces array, not taking the redirecting
/// by the marksurfaces.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BspModel
{
/// <summary>
/// Defines bounding box
/// </summary>
public Vector3D? Mins;
/// <summary>
/// Defines bounding box
/// </summary>
public Vector3D? Maxs;
/// <summary>
/// Coordinates to move the coordinate system
/// </summary>
public Vector3D? OriginVector;
/// <summary>
/// Index into nodes array
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.MAX_MAP_HULLS)]
public int[]? HeadnodesIndex = new int[Constants.MAX_MAP_HULLS];
/// <summary>
/// ???
/// </summary>
public int VisLeafsCount;
/// <summary>
/// Index into faces
/// </summary>
public int FirstFaceIndex;
/// <summary>
/// Count of faces
/// </summary>
public int FacesCount;
}
}

View File

@@ -0,0 +1,11 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
public sealed class BspModelsLump : Lump
{
/// <summary>
/// Model
/// </summary>
public BspModel[]? Models { get; set; }
}
}

View File

@@ -0,0 +1,62 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// This lump is simple again and contains an array of binary
/// structures, the nodes, which are a major part of the BSP tree.
///
/// Every BSPNODE structure represents a node in the BSP tree and
/// every node equals more or less a division step of the BSP algorithm.
/// Therefore, each node has an index (iPlane) referring to a plane
/// in the plane lump which devides the node into its two child nodes.
/// The childnodes are also stored as indexes. Contrary to the plane
/// index, the node index for the child is signed. If the index is
/// larger than 0, the index indicates a child node. If it is equal
/// to or smaller than zero (no valid array index), the bitwise
/// inversed value of the index gives an index into the leaves lump.
/// Additionally two points (nMins, nMaxs) span the bounding box
/// (AABB, axis aligned bounding box) delimitting the space of the node.
/// Finally firstFace indexes into the face lump and spezifies the
/// first of nFaces surfaces contained in this node.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public class BspNode
{
/// <summary>
/// Index into Planes lump
/// </summary>
public uint PlaneIndex;
/// <summary>
/// If > 0, then indices into Nodes.
/// Otherwise bitwise inverse indices into Leafs
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public ushort[] Children = new ushort[2];
/// <summary>
/// Defines bounding box
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public ushort[] Mins = new ushort[3];
/// <summary>
/// Defines bounding box
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public ushort[] Maxs = new ushort[3];
/// <summary>
/// Index into Faces
/// </summary>
public ushort FirstFace;
/// <summary>
/// Count of Faces
/// </summary>
public ushort FaceCount;
}
}

View File

@@ -0,0 +1,11 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
public sealed class BspNodesLump : Lump
{
/// <summary>
/// Nodes
/// </summary>
public BspNode[]? Nodes { get; set; }
}
}

View File

@@ -0,0 +1,52 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// The texinfo lump contains informations about how textures are
/// applied to surfaces. The lump itself is an array of binary data
/// structures.
///
/// This struct is mainly responsible for the calculation of the texture
/// coordinates (vS, fSShift, vT, fTShift). This values determine the
/// position of the texture on the surface. The iMiptex integer refers
/// to the textures in the texture lump and would be the index in an
/// array of BSPMITEX structs. Finally, there are 4 Bytes used for flags.
/// Only one flag is used by the vanilla engine, being 0x1 for disabling
/// lightmaps and subdivision for the surface (used by sky and liquids).
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BspTexinfo
{
/// <summary>
/// S-vector
/// </summary>
public Vector3D? SVector;
/// <summary>
/// Texture shift in the S direction
/// </summary>
public float TextureSShift;
/// <summary>
/// T-vector
/// </summary>
public Vector3D? TVector;
/// <summary>
/// Texture shift in the T direction
/// </summary>
public float TextureTShift;
/// <summary>
/// Index into textures array
/// </summary>
public uint MiptexIndex;
/// <summary>
/// Texture flags
/// </summary>
public TextureFlag Flags;
}
}

View File

@@ -0,0 +1,11 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
public sealed class BspTexinfoLump : Lump
{
/// <summary>
/// Texinfos
/// </summary>
public BspTexinfo[]? Texinfos { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <see href="https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/bspfile.h#L600"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class CDispCornerNeighbors
{
/// <summary>
/// Indices of neighbors.
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public ushort[] Neighbors = new ushort[4];
public byte NeighborCount;
}
}

View File

@@ -0,0 +1,12 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <see href="https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/bspfile.h#L583"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class CDispNeighbor
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public CDispSubNeighbor[]? SubNeighbors = new CDispSubNeighbor[2];
}
}

View File

@@ -0,0 +1,32 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <see href="https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/bspfile.h#L557"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class CDispSubNeighbor
{
/// <summary>
/// This indexes into ddispinfos.
/// </summary>
/// <remarks>0xFFFF if there is no neighbor here.</remarks>
public ushort NeighborIndex;
/// <summary>
/// (CCW) rotation of the neighbor wrt this displacement.
/// </summary>
public byte NeighborOrientation;
// These use the NeighborSpan type.
/// <summary>
/// Where the neighbor fits onto this side of our displacement.
/// </summary>
public byte Span;
/// <summary>
/// Where we fit onto our neighbor.
/// </summary>
public byte NeighborSpan;
}
}

View File

@@ -0,0 +1,28 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// This lump contains the so-called clipnodes, which build a second
/// BSP tree used only for collision detection.
///
/// This structure is a reduced form of the BSPNODE struct from the
/// nodes lump. Also the BSP tree built by the clipnodes is simpler
/// than the one described by the BSPNODEs to accelerate collision calculations.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Clipnode
{
/// <summary>
/// Index into planes
/// </summary>
public int PlaneIndex;
/// <summary>
/// Negative numbers are contents
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public short[]? ChildrenIndices = new short[2];
}
}

Some files were not shown because too many files have changed in this diff Show More