mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-01-23 21:45:00 +03:00
065b566eb6
* Remove existing recomp * Compile ido-static-recomp instead of relying on precompiled version. Also introduce makefile changes to allow aarch64 devices to compile. * Get mio0 from the source, and build it in the init. * Workaround for sm64tools not ignoring it's build files. * Fix cflags * Fancy colours for build system * Remove sm64tools submodule and just take the minimum required files instead. * Remove ido-static-recomp submodule and just fetch latest from GH instead. * Add support for using a venv in python. * remove mio0-decompressor temp * Fix the mio0-decompress files being somehow missing. * Fix stray message about "fix_checksum" * Update logo to be a VAR, and have a failed build say FAILED * Add checksum fix back in.
51 lines
1.5 KiB
C
51 lines
1.5 KiB
C
#ifndef LIBMIO0_H_
|
|
#define LIBMIO0_H_
|
|
|
|
// defines
|
|
|
|
#define MIO0_HEADER_LENGTH 16
|
|
|
|
// typedefs
|
|
|
|
typedef struct
|
|
{
|
|
unsigned int dest_size;
|
|
unsigned int comp_offset;
|
|
unsigned int uncomp_offset;
|
|
} mio0_header_t;
|
|
|
|
// function prototypes
|
|
|
|
// decode MIO0 header
|
|
// returns 1 if valid header, 0 otherwise
|
|
int mio0_decode_header(const unsigned char *buf, mio0_header_t *head);
|
|
|
|
// encode MIO0 header from struct
|
|
void mio0_encode_header(unsigned char *buf, const mio0_header_t *head);
|
|
|
|
// decode MIO0 data in memory
|
|
// in: buffer containing MIO0 data
|
|
// out: buffer for output data
|
|
// end: output offset of the last byte decoded from in (set to NULL if unwanted)
|
|
// returns bytes extracted to 'out' or negative value on failure
|
|
int mio0_decode(const unsigned char *in, unsigned char *out, unsigned int *end);
|
|
|
|
// encode MIO0 data in memory
|
|
// in: buffer containing raw data
|
|
// out: buffer for MIO0 data
|
|
// returns size of compressed data in 'out' including MIO0 header
|
|
int mio0_encode(const unsigned char *in, unsigned int length, unsigned char *out);
|
|
|
|
// decode an entire MIO0 block at an offset from file to output file
|
|
// in_file: input filename
|
|
// offset: offset to start decoding from in_file
|
|
// out_file: output filename
|
|
int mio0_decode_file(const char *in_file, unsigned long offset, const char *out_file);
|
|
|
|
// encode an entire file
|
|
// in_file: input filename containing raw data to be encoded
|
|
// out_file: output filename to write MIO0 compressed data to
|
|
int mio0_encode_file(const char *in_file, const char *out_file);
|
|
|
|
#endif // LIBMIO0_H_
|