romhack.h
1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef __ROMHACK_H__
#define __ROMHACK_H__
#include <list>
#include <hash_map.h>
using namespace std;
typedef unsigned char u8;
typedef unsigned long u32;
typedef signed long s32;
typedef enum {
R_MIPS_26,
R_MIPS_LO16,
R_MIPS_HI16,
} reltype_t;
typedef struct {
char *symbol;
u32 hi;
u32 lo;
u8 found;
u32 size;
} sym_t;
typedef struct {
u32 index;
u32 hi_offset;
u32 lo_offset;
reltype_t type;
sym_t *sym;
u32 text;
} rel_t;
typedef struct {
char *symbol;
u32 num_ops;
u32 first_op;
u32 first_mask;
u32 crc;
u32 partial_crc;
list<u32> offsets;
list<rel_t*> relocs;
u8 ambiguous;
} sig_t;
struct eqstr
{
bool operator()(const char* s1, const char* s2) const {
return strcmp(s1, s2) == 0;
}
};
typedef hash_map<char *, sig_t *, hash<char *>, eqstr> sigmap_t;
typedef hash_map<char *, sym_t *, hash<char *>, eqstr> symmap_t;
typedef struct {
char *symbol;
u32 offset;
} override_t;
typedef struct {
u32 src;
u32 dst;
} dynamic_t;
typedef struct {
u32 data[20];
} vimode_t;
void make_crc_table();
extern u32 crc32(u32 crc, u8* buf, u32 len);
extern int do_pal;
void scan_rom(u8* rom, u32 rom_len, sigmap_t &sigs);
void patch_vitbl(u8*rom, u32 rom_len);
void read_library(char *, symmap_t &, sigmap_t &);
#endif /* __ROMHACK_H__ */