Initial Commit

This commit is contained in:
2026-09-28 16:55:31 +08:00
commit 14f8706198
128 changed files with 19860 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
namespace TuneBoss.Core.Models;
/// <summary>How a sub-field of a settings byte is edited.</summary>
public enum MiscEditorKind
{
Flag, // single bit → checkbox
Enum, // bit range → combo (Options indexed by value)
Number, // bit range → numeric 0..(mask>>shift)
}
/// <summary>
/// One sub-field occupying a contiguous bit range of a byte.
/// Value = (byte &amp; Mask) >> shift(Mask); written back masked.
/// </summary>
public sealed record MiscBitField(
string Label,
int Mask, // e.g. 0x01 (flag), 0xF0 (high nibble), 0x7F (7-bit value)
MiscEditorKind Kind = MiscEditorKind.Flag,
string[]? Options = null) // Enum only: option labels indexed by value
{
/// <summary>Human-readable label: underscores → spaces, shortforms expanded.</summary>
public string DisplayText => MiscDisplayText.For(Label);
}
/// <summary>
/// Decomposition of a single settings byte into bit sub-fields, plus optional
/// inter-bit constraints (bit indices 0..7).
/// </summary>
public sealed record MiscByteSpec(
MiscBlock Block,
string FieldLabel, // must match a MiscField.Label in MiscFieldRegistry
MiscBitField[] Fields,
(int A, int B)[]? MutualExclusive = null, // checking one clears the other
(int A, int B)[]? Linked = null); // toggling one toggles the other