33 lines
627 B
C
33 lines
627 B
C
|
#ifndef SPITWAD_SPITWAD_H
|
||
|
#define SPITWAD_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(struct WAD* wad, const unsigned char* data, size_t data_sz);
|
||
|
int new_WAD_from_file(struct WAD* wad, const char* path);
|
||
|
void destroy_WAD(struct WAD* wad);
|
||
|
int write_to_file(struct WAD* wad, const char* path);
|
||
|
|
||
|
#endif //SPITWAD_SPITWAD_H
|