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
|
|
|
|
|
2023-02-25 00:14:05 +01:00
|
|
|
#include "file.h"
|
2023-02-09 19:36:39 +01:00
|
|
|
#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);
|
|
|
|
|
2023-02-25 00:14:05 +01:00
|
|
|
void sw_skip_add(struct sw_skip *skip, u8 *data, u32 data_size, char *name);
|
|
|
|
void sw_skip_add_file(struct sw_skip *skip, char *name, char *filename);
|
|
|
|
void sw_skip_attach(struct sw_skip *skip, char *filename);
|
|
|
|
void sw_skip_dettach(char *filename);
|
|
|
|
/* returns 0 if file not avaible */
|
|
|
|
u8 *sw_skip_get(struct sw_skip *skip, char *name, u32 *out_size);
|
2023-02-09 19:36:39 +01:00
|
|
|
void sw_skip_save(struct sw_skip *skip, char *filename);
|
|
|
|
|
|
|
|
#endif /* GUARD_62F584E45B48B8F6069643FC44702ED5 */
|