Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
tools
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
{
18
VERSION_UNKNOWN
,
19
VERSION_SM64_U
,
20
VERSION_SM64_E
,
21
VERSION_SM64_J
,
22
VERSION_SM64_SHINDOU
,
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_
sm64_rom_type
rom_type sm64_rom_type(unsigned char *buf, unsigned int length)
Definition:
libsm64.c:283
VERSION_SM64_J
Definition:
libsm64.h:21
VERSION_UNKNOWN
Definition:
libsm64.h:18
sm64_config
Definition:
libsm64.h:25
rom_version
rom_version
Definition:
libsm64.h:16
VERSION_SM64_U
Definition:
libsm64.h:19
ROM_SM64_BE
Definition:
libsm64.h:11
sm64_config::padding
unsigned int padding
Definition:
libsm64.h:30
ROM_SM64_BS
Definition:
libsm64.h:10
sm64_config::in_filename
char * in_filename
Definition:
libsm64.h:27
sm64_config::alignment
unsigned int alignment
Definition:
libsm64.h:31
sm64_config::ext_filename
char * ext_filename
Definition:
libsm64.h:28
sm64_rom_version
rom_version sm64_rom_version(unsigned char *buf)
Definition:
libsm64.c:304
ROM_SM64_BE_EXT
Definition:
libsm64.h:13
sm64_config::dump
char dump
Definition:
libsm64.h:33
ROM_SM64_LE
Definition:
libsm64.h:12
sm64_decompress_mio0
void sm64_decompress_mio0(const sm64_config *config, unsigned char *in_buf, unsigned int in_length, unsigned char *out_buf)
Definition:
libsm64.c:322
ROM_INVALID
Definition:
libsm64.h:9
VERSION_SM64_E
Definition:
libsm64.h:20
sm64_update_checksums
void sm64_update_checksums(unsigned char *buf)
Definition:
libsm64.c:410
sm64_config::ext_size
unsigned int ext_size
Definition:
libsm64.h:29
rom_type
rom_type
Definition:
libsm64.h:7
sm64_config::fill
char fill
Definition:
libsm64.h:32
VERSION_SM64_SHINDOU
Definition:
libsm64.h:22
Generated by
1.8.13