#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>

#define h(x) printf("%08x\n", x)

struct sl_header {
    char hdr[4];
    uint32_t version;
    uint8_t desc[78];
    uint32_t unk_1;
    uint64_t nul_1;
    uint32_t unk_2;
    uint8_t nul_2[92];
    uint16_t unk_3;
    uint32_t unk_4;
    uint16_t unk_5;
    uint32_t unk_6;
    uint16_t unk_7;
    uint32_t unk_8;
    uint8_t nul_3[14];
    uint32_t directory_offset;
    uint32_t directory_length;
    uint8_t nul_4[16];
    uint32_t counter_offset;
    uint32_t counter_length;
    uint32_t filedir_offset;
    uint32_t filedir_length;
    uint32_t unk_offset;
    uint32_t unk_length;
    uint32_t image_offset;
    uint32_t image_length;
    uint8_t nul_5[40];
};

int main()
{
    int fd = open("WMAZE.BIN", O_RDONLY);
    struct sl_header hdr;
    read(fd, &hdr, sizeof (struct sl_header));
    h(hdr.filedir_offset);
    return 0;
}
