DMXTrigger Resource

A DMXTrigger Resource is a binary file with a format described by the following C structure and constants:

#define DMXTRIG_RESTYPE     'D'
#define DMXTRIG_RESVERS     '1'

#define MAX_DMXTRIG_COUNT   100     // Maximum number of DMX Triggers loaded at once

typedef struct DMXTrigRange {       // 6 bytes
    uint16_t        rangeLow;               // Low end of range
    uint16_t        rangeHigh;              // High end of range
    uint8_t         reserved[2];            // -
} DMXTrigRange;

typedef struct DMXTrigSubmaster {   // 6 bytes
    uint16_t        playback;               // Playback index
    uint16_t        reserved1;              // -
    bool            invert;                 // Invert input
    uint8_t         reserved2;              // -
} DMXTrigSubmaster;

typedef struct DMXTriggerResource {
    //  ----------------------------------------------------------
    uint8_t         resType;                // (0x00) Resource type (DMXTrig = 'T')
    uint8_t         resVers;                // (0x01) Resource version (DMXTrig = '1')
    uint8_t         mode;                   // (0x02) Mode (0=Range, 1=Submaster, 2=Continuous, etc.)
    uint8_t         reserved1;              // (0x03) -
    uint16_t        channel;                // (0x04) DMX Channel (0..16383)

    union {
        struct DMXTrigRange     range;          // (0x06) Data for Range
        struct DMXTrigSubmaster submaster;      // (0x06) Data for Submaster
    } info;

    uint8_t         reserved2[3];           // (0x0C) -
    uint8_t         ruleCount;              // (0x0F) Number of rules in variableParams
    //  ----------------------------------------------------------
    char            variableParams[];       // (0x10) Beginning of variable "C-String" parameters
    //  char            name[];             // (0) Name (c-string)
    //  char            rules[][];          // (1+) Rules list (c-string list)
    //  ----------------------------------------------------------
} DMXTriggerResource;

//  Modes
#define DMXTRIG_MODE_RANGE              0   // Trigger occurs within a range of channel values
#define DMXTRIG_MODE_SUBMASTER          1   // Trigger directly controls a submaster value

//  Variable Strings
#define DMXTRIG_STR_NAME                0
#define DMXTRIG_STR_RULES               1