mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-07-08 18:06:41 +00:00
Add Z3DS metadata structures
This commit is contained in:
@@ -226,4 +226,18 @@ namespace SabreTools.Data.Models.N3DS
|
||||
Optional = 0x4000,
|
||||
Shared = 0x8000,
|
||||
}
|
||||
|
||||
/// <see href="https://github.com/azahar-emu/azahar/blob/master/src/common/zstd_compression.h"/>
|
||||
public enum Z3DSMetadataItemType : byte
|
||||
{
|
||||
/// <summary>
|
||||
/// End marker
|
||||
/// </summary>
|
||||
End = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Binary metadata
|
||||
/// </summary>
|
||||
Binary = 1,
|
||||
}
|
||||
}
|
||||
|
||||
20
SabreTools.Data.Models/N3DS/Z3DSMetadata.cs
Normal file
20
SabreTools.Data.Models/N3DS/Z3DSMetadata.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
namespace SabreTools.Data.Models.N3DS
|
||||
{
|
||||
/// <summary>
|
||||
/// Metadata block whose size is defined by <see cref="Z3DSFileHeader.MetadataSize"/>
|
||||
/// </summary>
|
||||
/// <see href="https://github.com/azahar-emu/azahar/blob/master/src/common/zstd_compression.h"/>
|
||||
public class Z3DSMetadata
|
||||
{
|
||||
/// <summary>
|
||||
/// Metadata version
|
||||
/// </summary>
|
||||
/// <remarks>Currently only a value of 1 is expected</remarks>
|
||||
public byte Version { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set of metadata entries in the block
|
||||
/// </summary>
|
||||
public Z3DSMetadataItem[] Items { get; set; } = [];
|
||||
}
|
||||
}
|
||||
38
SabreTools.Data.Models/N3DS/Z3DSMetadataItem.cs
Normal file
38
SabreTools.Data.Models/N3DS/Z3DSMetadataItem.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
namespace SabreTools.Data.Models.N3DS
|
||||
{
|
||||
/// <summary>
|
||||
/// Metadata item entry
|
||||
/// </summary>
|
||||
/// <see href="https://github.com/azahar-emu/azahar/blob/master/src/common/zstd_compression.h"/>
|
||||
public class Z3DSMetadataItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Item type
|
||||
/// </summary>
|
||||
public Z3DSMetadataItemType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Length of the name field
|
||||
/// </summary>
|
||||
public byte NameLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Length of the data field
|
||||
/// </summary>
|
||||
public ushort DataLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Name encoded as bytes whose length is given
|
||||
/// by <see cref="NameLength"/>
|
||||
/// </summary>
|
||||
/// <remarks>Ignored if <see cref="Type"/> is End</remarks>
|
||||
public byte[] Name { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// Data encoded as bytes whose length is given
|
||||
/// by <see cref="DataLength"/>
|
||||
/// </summary>
|
||||
/// <remarks>Ignored if <see cref="Type"/> is End</remarks>
|
||||
public byte[] Data { get; set; } = [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user