view src/dmpack.h @ 2576:812b16ee49db

I had been living under apparent false impression that "realfft.c" on which the FFT implementation in DMLIB was basically copied from was released in public domain at some point, but it could very well be that it never was. Correct license is (or seems to be) GNU GPL. Thus I removing the code from DMLIB, and profusely apologize to the author, Philip Van Baren. It was never my intention to distribute code based on his original work under a more liberal license than originally intended.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 11 Mar 2022 16:32:50 +0200
parents c1cae47cd410
children 9807ae37ad69
line wrap: on
line source

/*
 * DMLib
 * -- PACK-file routines
 * Programmed and designed by Matti 'ccr' Hamalainen
 * (C) Copyright 2011-2015 Tecnic Software productions (TNSP)
 */
#ifndef DMPACK_H
#define DMPACK_H
#include "dmlib.h"


#define	DPACK_IDENT     "TNSPDPCK"      // Magic ident
#define	DPACK_VERSION   (0x0200)        // Version


typedef struct _DMPackEntry
{
    char    filename[DMRES_NAME_LEN + 1]; // +1 for NUL byte
    Uint64  offset;            // Offset in pack file
    Uint32  csize;             // Compressed data size
    Uint32  size;              // Size of UNCOMPRESSED data
    Uint32  flags;             // Stored flags, see DMF_* in dmres.h

    Uint32  privFlags;  // PrivFlags are not stored
    struct _DMPackEntry *next, *prev;
} DMPackEntry;


typedef struct
{
    DMPackEntry *entries;
    char *  filename;          // Filename & path
    FILE *  file;              // File
} DMPackFile;


typedef struct
{
    char    ident[8];          // Magic identifier
    Uint16  version;           // Version
    Uint32  dirEntries;        // Number of entries
    Uint64  dirOffset;         // Offset of the directory
} DMPackFileHeader;


DMPackEntry *  dmPackEntryNew();
void           dmPackEntryFree(DMPackEntry *);
void           dmPackEntryInsert(DMPackEntry **, DMPackEntry *);
void           dmPackEntryDelete(DMPackEntry **, DMPackEntry *);

DMPackEntry *  dmPackFind(DMPackEntry *list, const char *filename);

int            dmPackOpen(const char *, DMPackFile **, BOOL);
int            dmPackClose(DMPackFile *);
int            dmPackRead(DMPackFile *, const char *, Uint8 **, size_t *);


#endif // DMPACK_H