arsd icon indicating copy to clipboard operation
arsd copied to clipboard

arsd.declarativeloader: Cannot define fixed size embedded arrays

Open naydef opened this issue 1 year ago • 0 comments

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.

naydef avatar Dec 10 '24 21:12 naydef