Skip to content

arsd.declarativeloader: Cannot define fixed size embedded arrays #467

@naydef

Description

@naydef

I'm trying to use this module to load files, where some part of their structure is unknown, so I need to add padding.

The following does not work:

struct WusFile
{
    struct SndEntry
    {
        int len;
        byte[0xC] pad1;
        byte[0x12] pad2;
        @NumElements!len short[] sample;
    }

    int cnt;
    @NumElements!cnt SndEntry[] snd;
}

The error message:

arsd/declarativeloader.d(159): Error: no property `Field` for `t` of type `wus_extract.WusFile.SndEntry`
wusExtract.d(10):        struct `SndEntry` defined here
arsd/declarativeloader.d(197): Error: template instance `arsd.declarativeloader.loadFrom!(SndEntry, ubyte[])` error instantiating
wusExtract.d(38):        instantiated from here: `loadFrom!(WusFile, ubyte[])`

I didn't find something in the module that can allow this. (Didn't try hard enough, though)
I tried using @NumElements!54 byte[] pad;, but not working, too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions