spitwad/spitwad.h

35 lines
644 B
C

#ifndef SPITWAD_H
#define SPITWAD_H
#include <stdint.h>
#include <stdlib.h>
enum WAD_Type {
IWAD,
PWAD
};
struct DirEntry {
uint32_t offset;
uint32_t length;
char name[9];
};
struct WAD {
enum WAD_Type type;
uint32_t dir_sz;
uint32_t dir_offset;
unsigned char *data;
size_t data_sz;
struct DirEntry *directory;
};
int new_WAD_from_data(struct WAD* wad, const unsigned char* data, size_t data_sz);
int new_WAD_from_file(struct WAD* wad, const char* path);
int new_WAD(struct WAD* wad);
void destroy_WAD(struct WAD* wad);
int write_to_file(struct WAD* wad, const char* path);
#endif //SPITWAD_H