forked from Xeeynamo/sotn-decomp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
diff_settings.py
119 lines (100 loc) · 4.33 KB
/
diff_settings.py
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/usr/bin/env python3
import os
def add_custom_arguments(parser):
parser.add_argument(
"--version",
default=None,
dest="version",
help="Decide what version of the game to use (us, jp12, pspeu, etc.)",
)
parser.add_argument(
"--overlay",
default="dra",
dest="overlay",
help="Defines which overlay to use for the diff (main, dra, st/mad, etc.)",
)
def apply_psx_base(config, version, name):
config["baseimg"] = f"disks/{version}/" + (f"{name}.bin").upper()
config["myimg"] = f"build/{version}/" + (f"{name}.bin").upper()
config["mapfile"] = f"build/{version}/{name}.map"
config["source_directories"] = [f"src/{name}", "include", f"asm/{version}/{name}"]
config["objdump_executable"] = "mipsel-linux-gnu-objdump"
def apply_psx_bin(config, version, name):
config["baseimg"] = f"disks/{version}/" + (f"BIN/{name}.BIN").upper()
config["myimg"] = f"build/{version}/" + (f"{name}.bin").upper()
config["mapfile"] = f"build/{version}/{name}.map"
config["source_directories"] = [f"src/{name}", "include", f"asm/{version}/{name}"]
config["objdump_executable"] = "mipsel-linux-gnu-objdump"
def apply_psx_servant(config, version, name):
config["baseimg"] = f"disks/{version}/" + (f"SERVANT/{name}.bin").upper()
config["myimg"] = f"build/{version}/" + (f"{name}.bin").upper()
config["mapfile"] = f"build/{version}/{name}.map"
config["source_directories"] = [
f"src/servant/{name}",
"include",
f"asm/{version}/servant/{name}",
]
config["objdump_executable"] = "mipsel-linux-gnu-objdump"
def apply_psx_weapon(config, version, name):
config["baseimg"] = f"disks/{version}/" + (f"SERVANT/{name}.bin").upper()
config["myimg"] = f"build/{version}/weapon/w0_{name[2:]}.bin"
config["mapfile"] = f"build/{version}/weapon/w0_{name[2:]}.map"
config["source_directories"] = [
f"src/weapon/{name}",
"include",
f"asm/{version}/weapon/{name}",
]
config["objdump_executable"] = "mipsel-linux-gnu-objdump"
def apply_psx_stage(config, version, name):
config["baseimg"] = f"disks/{version}/" + (f"ST/{name}/{name}.BIN").upper()
config["myimg"] = f"build/{version}/" + (f"{name}.bin").upper()
config["mapfile"] = f"build/{version}/st{name}.map"
config["source_directories"] = [
f"src/st/{name}",
f"src/st/{name}_psp",
"include",
f"asm/{version}/st/{name}",
]
config["objdump_executable"] = "mipsel-linux-gnu-objdump"
def apply_psx_boss(config, version, name):
config["baseimg"] = f"disks/{version}/" + (f"BOSS/{name}/{name}.BIN").upper()
config["myimg"] = f"build/{version}/" + (f"{name}.bin").upper()
config["mapfile"] = f"build/{version}/bo{name}.map"
config["source_directories"] = [
f"src/boss/{name}",
f"src/boss/{name}_psp",
"include",
f"asm/{version}/boss/{name}",
]
config["objdump_executable"] = "mipsel-linux-gnu-objdump"
def apply_saturn(config, name):
config["arch"] = "sh2"
config["baseimg"] = f"disks/saturn" + (f"/{name}.PRG").upper()
config["myimg"] = f"build/saturn" + (f"/{name}.PRG").upper()
config["mapfile"] = f"build/saturn/{name}.map"
config["source_directories"] = [f"src/saturn/"]
config["objdump_executable"] = "sh-elf-objdump"
def apply(config, args):
version = args.version or os.getenv("VERSION") or "us"
if version == "saturn":
apply_saturn(config, args.overlay)
else:
name = args.overlay or "dra"
if name.startswith("st/"):
apply_psx_stage(config, version, name[3:])
elif name.startswith("st"):
apply_psx_stage(config, version, name[2:])
elif name.startswith("bo/"):
apply_psx_boss(config, version, name[3:])
elif name.startswith("bo"):
apply_psx_boss(config, version, name[2:])
elif name.startswith("tt_"):
apply_psx_servant(config, version, name)
elif name.startswith("w_"):
apply_psx_weapon(config, version, name)
elif name == "dra" or name == "main":
apply_psx_base(config, version, name)
else:
apply_psx_bin(config, version, name)
config["arch"] = "mipsel:4000" if version == "pspeu" else "mipsel"
config["objdump_executable"] = "mipsel-linux-gnu-objdump"