namespace TuneBoss.Core.Models; /// How a sub-field of a settings byte is edited. public enum MiscEditorKind { Flag, // single bit → checkbox Enum, // bit range → combo (Options indexed by value) Number, // bit range → numeric 0..(mask>>shift) } /// /// One sub-field occupying a contiguous bit range of a byte. /// Value = (byte & Mask) >> shift(Mask); written back masked. /// 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 { /// Human-readable label: underscores → spaces, shortforms expanded. public string DisplayText => MiscDisplayText.For(Label); } /// /// Decomposition of a single settings byte into bit sub-fields, plus optional /// inter-bit constraints (bit indices 0..7). /// 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