Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
libsm64.h
Go to the documentation of this file.
1 #ifndef LIBSM64_H_
2 #define LIBSM64_H_
3 
4 #define MIO0_DIR "mio0files"
5 
6 // typedefs
7 typedef enum
8 {
9  ROM_INVALID, // not valid SM64 ROM
10  ROM_SM64_BS, // SM64 byte-swapped (BADC)
11  ROM_SM64_BE, // SM64 big-endian (ABCD)
12  ROM_SM64_LE, // SM64 little-endian
13  ROM_SM64_BE_EXT, // SM64 big-endian, extended
14 } rom_type;
15 
16 typedef enum
17 {
23 } rom_version;
24 
25 typedef struct
26 {
27  char *in_filename;
28  char *ext_filename;
29  unsigned int ext_size;
30  unsigned int padding;
31  unsigned int alignment;
32  char fill;
33  char dump;
34 } sm64_config;
35 
36 // determine ROM type based on data
37 // buf: buffer containing raw SM64 ROM file data
38 // length: length of 'buf'
39 // returns SM64 ROM type or invalid
40 rom_type sm64_rom_type(unsigned char *buf, unsigned int length);
41 
42 // determine SM64 ROM type based on cksum data
43 // buf: buffer containing raw SM64 ROM file data
44 // returns SM64 ROM version or unknown
45 rom_version sm64_rom_version(unsigned char *buf);
46 
47 // find and decompress all MIO0 blocks
48 // config: configuration to determine alignment, padding and size
49 // in_buf: buffer containing entire contents of SM64 data in big endian
50 // length: length of in_buf
51 // out_buf: buffer containing extended SM64
52 void sm64_decompress_mio0(const sm64_config *config,
53  unsigned char *in_buf,
54  unsigned int in_length,
55  unsigned char *out_buf);
56 
57 // update N64 header checksums
58 // buf: buffer containing ROM data
59 // checksums are written into the buffer
60 void sm64_update_checksums(unsigned char *buf);
61 
62 #endif // LIBSM64_H_
rom_type sm64_rom_type(unsigned char *buf, unsigned int length)
Definition: libsm64.c:283
Definition: libsm64.h:21
Definition: libsm64.h:18
Definition: libsm64.h:25
rom_version
Definition: libsm64.h:16
Definition: libsm64.h:19
Definition: libsm64.h:11
unsigned int padding
Definition: libsm64.h:30
Definition: libsm64.h:10
char * in_filename
Definition: libsm64.h:27
unsigned int alignment
Definition: libsm64.h:31
char * ext_filename
Definition: libsm64.h:28
rom_version sm64_rom_version(unsigned char *buf)
Definition: libsm64.c:304
Definition: libsm64.h:13
char dump
Definition: libsm64.h:33
Definition: libsm64.h:12
void sm64_decompress_mio0(const sm64_config *config, unsigned char *in_buf, unsigned int in_length, unsigned char *out_buf)
Definition: libsm64.c:322
Definition: libsm64.h:9
Definition: libsm64.h:20
void sm64_update_checksums(unsigned char *buf)
Definition: libsm64.c:410
unsigned int ext_size
Definition: libsm64.h:29
rom_type
Definition: libsm64.h:7
char fill
Definition: libsm64.h:32
Definition: libsm64.h:22