Skip to content

Commit

Permalink
updates to build template [read]
Browse files Browse the repository at this point in the history
patchcreator requires an exec to be in the command, which is copied to out. decided to use the readme instead of hunting for exec names and ensuring the right binary to be given

patchcreator also forces to its own gen folder, so I go up one dir if patchcreator is used. this wasnt a problem for rb3dx wii because oh how out_dir is built

we may want to think more on the concept of rebuild files.
in rb3dx you are supposed to copy the wii game files to the platform folder. Which means the xbox and ps3 folders have the dx binary, but the wii folder has the vanilla binary. not great for expansion, works for rb3
So instead I have a rebuild_files folder in dependencies with strictly dx files, that gets copied to the output instead of from the platform folder.

copy_vanilla_arks function added for patchcreator builds. i was on the fence if this should just be the default for patchcreator builds idk. because we give the user an out dir without the other ark parts, so they will have to combine them themselves. as i type this i am realizing that may be a problem for CI... welp

happy for feedback
  • Loading branch information
jnackmclain authored and DarkRTA committed Apr 20, 2024
1 parent 6060476 commit 6f8bd35
Showing 1 changed file with 29 additions and 8 deletions.
37 changes: 29 additions & 8 deletions python/build_template/configure_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
ninja.variable("ark_version", "-v 6")

#require user provided vanilla ark extract in "vanilla/platform" folder
#tbh you should probably just use patchcreator
vanilla_files = False

#copy back dx files and vanilla hdr to platform folder before building
rebuild_files = False

#set True for rb1 and newer
new_gen = True

Expand Down Expand Up @@ -59,10 +63,8 @@
#patchcreator options
patchcreator = False
new_ark_part = "10"
dol_name = "main.dol"
elf_name = " "
bin_name = " "
xex_name = " "
#deliver vanilla arks to out folder
copy_vanilla_arks_to_out = False

parser = argparse.ArgumentParser(prog="configure")
parser.add_argument("platform")
Expand Down Expand Up @@ -140,6 +142,10 @@
case "ps2":
out_dir = Path("out", args.platform, "GEN")

#patchcreator forces into a gen folder itself it sucks
if patchcreator == True and args.platform != "wii":
out_dir = out_dir.parent

#building an ark
if args.platform in ["ps3", "xbox", "ps2"] and patchcreator == False:
ninja.rule(
Expand All @@ -154,19 +160,17 @@
#append platform if this is new style ark
if new_gen == True:
hdr_name = hdr_name + "_" + args.platform
#this is fucking hilarious
exec_path = "README.md"
match args.platform:
case "wii":
hdr_path = "platform/" + args.platform + "/files/gen/" + hdr_name + ".hdr"
exec_path = "platform/" + args.platform + "/sys/" + dol_name
case "ps2":
hdr_path = "platform/" + args.platform + "/GEN/" + hdr_name.upper() + ".HDR"
exec_path = "platform/" + args.platform + "/" + elf_name
case "ps3":
hdr_path = "platform/" + args.platform + "/USRDIR/gen/" + hdr_name + ".hdr"
exec_path = "platform/" + args.platform + "/USRDIR/" + bin_name
case "xbox":
hdr_path = "platform/" + args.platform + "/gen/" + hdr_name + ".hdr"
exec_path = "platform/" + args.platform + "/" + xex_name
ninja.rule(
"ark",
f"$arkhelper patchcreator -a {ark_dir} -o {out_dir} {hdr_path} {exec_path} --logLevel error",
Expand All @@ -185,6 +189,23 @@

build_files = []

# copy whatever arbitrary files you need to output
if rebuild_files == True:
for f in filter(lambda x: x.is_file(), Path("dependencies", "rebuild_files", args.platform).rglob("*")):
index = f.parts.index(args.platform)
out_path = Path("out", args.platform).joinpath(*f.parts[index + 1 :])
ninja.build(str(out_path), "copy", str(f))
build_files.append(str(out_path))

if copy_vanilla_arks_to_out == True:
#copies each ark part from the platform folder to output
#we are about to overwrite the hdr anyway so it doesnt matter if we copy it now
for f in filter(lambda x: x.is_file(), Path("platform", args.platform, "gen").rglob("*")):
index = f.parts.index(args.platform)
out_path = Path("out", args.platform).joinpath(*f.parts[index + 1 :])
ninja.build(str(out_path), "copy", str(f))
build_files.append(str(out_path))

# copy platform files
if args.platform != "wii" and patchcreator == False:
for f in filter(lambda x: x.is_file(), Path("platform", args.platform).rglob("*")):
Expand Down

0 comments on commit 6f8bd35

Please sign in to comment.