2022-01-01 17:45:41 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2022-01-24 20:41:45 +00:00
|
|
|
def add_custom_arguments(parser):
|
2023-02-21 22:03:18 +00:00
|
|
|
parser.add_argument(
|
|
|
|
"--version",
|
|
|
|
default="us",
|
|
|
|
dest='version',
|
|
|
|
help="Decide what version of the game to use (us, jp12, pspeu, etc.)",
|
|
|
|
)
|
2022-01-24 20:41:45 +00:00
|
|
|
parser.add_argument(
|
|
|
|
"--overlay",
|
|
|
|
default="dra",
|
|
|
|
dest='overlay',
|
|
|
|
help="Defines which overlay to use for the diff (main, dra, st/mad, etc.)",
|
|
|
|
)
|
|
|
|
|
2023-01-02 16:49:03 +00:00
|
|
|
|
2023-02-21 22:03:18 +00:00
|
|
|
def apply_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'
|
2023-02-08 14:42:25 +00:00
|
|
|
config['source_directories'] = [
|
2023-02-21 22:03:18 +00:00
|
|
|
f'src/{name}', 'include', f'asm/{version}/{name}']
|
2023-02-08 14:42:25 +00:00
|
|
|
config['objdump_executable'] = 'mipsel-linux-gnu-objdump'
|
|
|
|
|
|
|
|
|
2023-02-21 22:03:18 +00:00
|
|
|
def apply_bin(config, version, name):
|
2023-02-08 14:42:25 +00:00
|
|
|
config["arch"] = "mipsel"
|
2023-02-21 22:03:18 +00:00
|
|
|
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'
|
2023-02-08 14:42:25 +00:00
|
|
|
config['source_directories'] = [
|
2023-02-21 22:03:18 +00:00
|
|
|
f'src/{name}', 'include', f'asm/{version}/{name}']
|
2023-02-08 14:42:25 +00:00
|
|
|
config['objdump_executable'] = 'mipsel-linux-gnu-objdump'
|
|
|
|
|
|
|
|
|
2023-02-21 22:03:18 +00:00
|
|
|
def apply_servant(config, version, name):
|
2023-02-08 14:42:25 +00:00
|
|
|
config["arch"] = "mipsel"
|
2023-02-21 22:03:18 +00:00
|
|
|
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'
|
2023-02-08 14:42:25 +00:00
|
|
|
config['source_directories'] = [
|
2023-02-21 22:03:18 +00:00
|
|
|
f'src/servant/{name}', 'include', f'asm/{version}/servant/{name}']
|
2023-02-08 14:42:25 +00:00
|
|
|
config['objdump_executable'] = 'mipsel-linux-gnu-objdump'
|
2022-01-24 20:41:45 +00:00
|
|
|
|
2022-11-19 12:24:20 +00:00
|
|
|
|
2023-02-21 22:03:18 +00:00
|
|
|
def apply_stage(config, version, name):
|
2022-01-01 17:45:41 +00:00
|
|
|
config["arch"] = "mipsel"
|
2023-02-21 22:03:18 +00:00
|
|
|
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'
|
2023-01-02 16:49:03 +00:00
|
|
|
config['source_directories'] = [
|
2023-02-21 22:03:18 +00:00
|
|
|
f'src/st/{name}', 'include', f'asm/{version}/st/{name}']
|
2023-02-08 14:42:25 +00:00
|
|
|
config['objdump_executable'] = 'mipsel-linux-gnu-objdump'
|
|
|
|
|
|
|
|
|
|
|
|
def apply(config, args):
|
|
|
|
name = args.overlay or 'dra'
|
2023-02-21 22:03:18 +00:00
|
|
|
version = args.version or 'us'
|
2023-02-08 14:42:25 +00:00
|
|
|
if name.startswith("st/"):
|
2023-02-21 22:03:18 +00:00
|
|
|
apply_stage(config, version, name[3:])
|
2023-02-08 14:42:25 +00:00
|
|
|
elif name.startswith("tt_"):
|
2023-02-21 22:03:18 +00:00
|
|
|
apply_servant(config, version, name)
|
2023-02-08 14:42:25 +00:00
|
|
|
elif name is "dra" or name is "main":
|
2023-02-21 22:03:18 +00:00
|
|
|
apply_base(config, version, name)
|
2023-02-08 14:42:25 +00:00
|
|
|
else:
|
2023-02-21 22:03:18 +00:00
|
|
|
apply_bin(config, version, name)
|
2023-02-08 14:42:25 +00:00
|
|
|
|
|
|
|
config["arch"] = "mipsel"
|
2023-01-02 16:49:03 +00:00
|
|
|
config['objdump_executable'] = 'mipsel-linux-gnu-objdump'
|