2024-03-12 20:33:01 +00:00
|
|
|
#ifndef SPITWAD_H
|
|
|
|
#define SPITWAD_H
|
2024-02-28 16:10:56 +00:00
|
|
|
|
|
|
|
#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;
|
|
|
|
};
|
|
|
|
|
2024-03-13 17:32:27 +00:00
|
|
|
int new_WAD_from_data(struct WAD* wad, const unsigned char* data, size_t data_sz);
|
2024-02-28 16:10:56 +00:00
|
|
|
int new_WAD_from_file(struct WAD* wad, const char* path);
|
2024-03-13 17:32:27 +00:00
|
|
|
int new_WAD(struct WAD* wad);
|
2024-02-28 16:10:56 +00:00
|
|
|
void destroy_WAD(struct WAD* wad);
|
|
|
|
int write_to_file(struct WAD* wad, const char* path);
|
|
|
|
|
2024-03-13 17:32:27 +00:00
|
|
|
|
2024-03-12 20:33:01 +00:00
|
|
|
#endif //SPITWAD_H
|