skunkworks-c/include/skip.h

58 lines
3.1 KiB
C
Raw Normal View History

2023-02-09 19:36:39 +01:00
/******************************************************************************/
/* Skip File Format, skunkworks zip */
/* */
/* little-endian */
/* */
/* Main Header: */
/* */
/* bytes | what */
/* ------+------------------------------------------------------------------- */
/* 4 | 'SWZP' */
/* 1 | version, currently 0x00 */
/* 1 | compression format, currently only 0 supported, uncompressed */
/* 4 | size of uncompressed data chunk */
/* 4 | size of compressed data chunk (same as compressed if format 0) */
/* 2 | file count */
/* */
/* File Header (appears 'file count' times in a row): */
/* */
/* bytes | what */
/* ------+------------------------------------------------------------------- */
/* 4 | offset from beginning of data chunk */
/* 4 | file size (uncompressed) */
/* 1 | length of filename */
/* * | filename (not zero terminated) */
/* */
/* Rest of File: */
/* */
/* bytes | what */
/* ------+------------------------------------------------------------------- */
/* * | data chunk */
/* 4 | length of file total (to easily find header if file is attached to */
/* an executable) */
/******************************************************************************/
#ifndef GUARD_62F584E45B48B8F6069643FC44702ED5
#define GUARD_62F584E45B48B8F6069643FC44702ED5
#include "types.h"
struct sw_skip {
u32 data_size;
u8 *data;
u16 file_count;
struct {
u32 offset;
u32 size;
char *name;
} *files;
};
struct sw_skip *sw_skip_create();
struct sw_skip *sw_skip_load(char *filename);
void sw_skip_destroy(struct sw_skip *skip);
void sw_skip_save(struct sw_skip *skip, char *filename);
#endif /* GUARD_62F584E45B48B8F6069643FC44702ED5 */