lib3ddevil1/include/devil1tex.h

74 lines
2.0 KiB
C
Raw Normal View History

#ifndef DEVIL1TEX_H
#define DEVIL1TEX_H
#include <stdint.h>
#include <stdbool.h>
// disable struct padding
// to easily impose struct on plain data.
#pragma pack(push, 1)
struct TexturePack {
char id[4];
int32_t batchNumber;
uint32_t firstBatchOffset; // <format=hex>
uint32_t unknownA;
};
struct TextureBatchDescriptor{
int32_t batchIdx;
uint32_t hash; // <format=hex>
uint32_t texNumber;
uint32_t unknownA[8]; // <format=hex>
uint32_t textureSize; // <format=hex>
uint32_t unknownB[30];
};
struct Texture {
// size of array is defined by descriptor
// textureSize
unsigned char *data;
};
struct TextureBatch {
// quantity of textures are defined by descriptor
// texNumber
struct Texture *batch;
};
#pragma pack(pop)
2018-04-18 08:33:06 +05:30
typedef struct {
2018-04-19 18:00:13 +05:30
// input: pointer to struct
2018-04-18 08:33:06 +05:30
void (* const printheader) (struct TexturePack*);
2018-04-19 18:00:13 +05:30
// input: pointer to struct
2018-04-18 08:33:06 +05:30
void (* const printbatchdesc)(struct TextureBatchDescriptor*);
2018-04-19 18:00:13 +05:30
// input: pointer to struct, file data
bool (* const getheader) (struct TexturePack*, const char*);
2018-04-19 18:00:13 +05:30
// input: pointer of pointer to struct, order, file data, file size
// ** = 'pass by reference' of a pointer to struct
2018-04-18 08:33:06 +05:30
bool (* const getbatchdesc) (struct TextureBatchDescriptor**,
unsigned int,
const char *,
unsigned int);
2018-04-19 18:00:13 +05:30
// input: pointer of pointer to struct, order, file data, file size
// ** = 'pass by reference' of a pointer to struct
2018-04-18 08:33:06 +05:30
bool (* const getbatch) (struct TextureBatch**,
unsigned int,
const char*,
unsigned int);
2018-04-19 18:00:13 +05:30
// input: pointer to struct, order, file data, file size
bool (* const gettextures) (struct Texture*,
2018-04-18 08:33:06 +05:30
unsigned int,
const char*,
const unsigned int);
} fn_devil1tex;
extern fn_devil1tex const DEVIL1TEX;
#endif