Compress foresta.rel, add in orthrus to tools for future RARC usage

This commit is contained in:
Cuyler36
2024-11-12 15:33:54 -05:00
parent 78e8c6b9f4
commit 0bee7dbc04
4 changed files with 73 additions and 10 deletions
+9 -1
View File
@@ -106,6 +106,12 @@ parser.add_argument(
type=Path,
help="path to sjiswrap.exe (optional)",
)
parser.add_argument(
"--orthrus",
metavar="BINARY",
type=Path,
help="path to orthrus[.exe] (optional)",
)
parser.add_argument(
"--verbose",
action="store_true",
@@ -138,6 +144,7 @@ config.compilers_path = args.compilers
config.generate_map = args.map
config.non_matching = args.non_matching
config.sjiswrap_path = args.sjiswrap
config.orthrus_path = args.orthrus
config.progress = args.progress
if not is_windows():
config.wrapper = args.wrapper
@@ -152,6 +159,7 @@ config.dtk_tag = "v1.2.0"
config.objdiff_tag = "v2.3.4"
config.sjiswrap_tag = "v1.2.0"
config.wibo_tag = "0.6.11"
config.orthrus_tag = "v0.2.0"
# Project
config.config_path = Path("config") / config.version / "config.yml"
@@ -1485,7 +1493,7 @@ config.libs = [
Object(Matching, "game/m_vibctl.c"),
Object(Matching, "game/m_view.c"),
Object(Matching, "game/m_warning_ovl.c"),
Object(NonMatching, "game/m_watch_my_step.c"),
Object(Equivalent, "game/m_watch_my_step.c"),
],
),
Rel(
+7 -6
View File
@@ -273,16 +273,17 @@ extern void watch_my_step_draw(GAME_PLAY* play) {
CLOSE_DISP(g);
if (S_watch_my_step.mode >= 3) {
/* nonmatch starts here */
f32 text_opacity = (S_watch_my_step.opacity - 0.5f) * 2.0f;
if (text_opacity > 0.0f) {
/* nonmatch starts here */
int a = text_opacity * 255.0f;
f32 x = 160.0f + (S_watch_my_step.pos_x - 0.5f * (S_watch_my_step.scale * 120.0f + 40.0f));
f32 y = 120.0f + (S_watch_my_step.pos_y - 0.5f * (S_watch_my_step.scale * 7.0f + 23.0f));
f32 x = (160.0f + (S_watch_my_step.pos_x - 0.5f * (S_watch_my_step.scale * 120.0f + 40.0f)) + 10.0f);
f32 y = (120.0f + (S_watch_my_step.pos_y - 0.5f * (S_watch_my_step.scale * 7.0f + 23.0f) + 5.0f));
mFont_SetLineStrings(game, S_watch_my_step.item_name, mIN_ITEM_NAME_LEN,
(1.0f - S_watch_my_step.scale) + x + 10.0f, S_watch_my_step.scale * 3.0f + y + 5.0f,
45, 45, 35, a, FALSE, TRUE, 0.875f, 0.875f, mFont_MODE_POLY);
(1.0f - S_watch_my_step.scale) + x, // x
(S_watch_my_step.scale * 3.0f) + y, // y
45, 45, 35, 255.0f * text_opacity, FALSE, TRUE, 0.875f, 0.875f, mFont_MODE_POLY);
}
}
}
+17
View File
@@ -82,6 +82,22 @@ def wibo_url(tag: str) -> str:
return f"{repo}/releases/download/{tag}/wibo"
def orthrus_url(tag: str) -> str:
uname = platform.uname()
suffix = ""
system = uname.system.lower()
if system == "darwin":
system = "macos"
elif system == "windows":
suffix = ".exe"
arch = uname.machine.lower()
if arch == "amd64":
arch = "x86_64"
repo = "https://github.com/NWPlayer123/Orthrus"
return f"{repo}/releases/download/{tag}/orthrus-{system}-{arch}{suffix}"
TOOLS: Dict[str, Callable[[str], str]] = {
"binutils": binutils_url,
"compilers": compilers_url,
@@ -89,6 +105,7 @@ TOOLS: Dict[str, Callable[[str], str]] = {
"objdiff-cli": objdiff_cli_url,
"sjiswrap": sjiswrap_url,
"wibo": wibo_url,
"orthrus": orthrus_url,
}
+40 -3
View File
@@ -140,6 +140,8 @@ class ProjectConfig:
self.sjiswrap_path: Optional[Path] = None # If None, download
self.objdiff_tag: Optional[str] = None # Git tag
self.objdiff_path: Optional[Path] = None # If None, download
self.orthrus_tag: Optional[str] = None # Git tag
self.orthrus_path: Optional[Path] = None # If None, download
# Project config
self.non_matching: bool = False
@@ -366,6 +368,7 @@ def generate_build_ninja(
build_path = config.out_path()
progress_path = build_path / "progress.json"
report_path = build_path / "report.json"
foresta_szs_path = build_path / "foresta" / "foresta.rel.szs"
build_tools_path = config.build_dir / "tools"
download_tool = config.tools_dir / "download_tool.py"
n.rule(
@@ -473,6 +476,22 @@ def generate_build_ninja(
else:
sys.exit("ProjectConfig.sjiswrap_tag missing")
if config.orthrus_path:
orthrus = config.orthrus_path
elif config.orthrus_tag:
orthrus = build_tools_path / f"orthrus{EXE}"
n.build(
outputs=orthrus,
rule="download_tool",
implicit=download_tool,
variables={
"tool": "orthrus",
"tag": config.orthrus_tag,
},
)
else:
sys.exit("ProjectConfig.orthrus_tag missing")
wrapper = config.compiler_wrapper()
# Only add an implicit dependency on wibo if we download it
wrapper_implicit: Optional[Path] = None
@@ -530,7 +549,7 @@ def generate_build_ninja(
n.build(
outputs="tools",
rule="phony",
inputs=[dtk, sjiswrap, wrapper, compilers, binutils, objdiff],
inputs=[dtk, sjiswrap, wrapper, compilers, binutils, objdiff, orthrus],
)
n.newline()
@@ -1013,6 +1032,11 @@ def generate_build_ninja(
rspfile="$rspfile",
rspfile_content="$in_newline",
)
n.rule(
name="compressrel",
command=f"{dtk} yaz0 compress $in -o $out",
description="Compress REL"
)
generated_rels: List[str] = []
for idx, link in enumerate(build_config["links"]):
# Map module names to link steps
@@ -1041,6 +1065,12 @@ def generate_build_ninja(
rels_to_generate,
)
)
rel_compressed_outputs = list(
map(
lambda step: f"{step.output()}.szs",
rels_to_generate
)
)
rel_names = list(
map(
lambda step: step.name,
@@ -1060,6 +1090,13 @@ def generate_build_ninja(
},
order_only="post-link",
)
n.build(
outputs=rel_compressed_outputs,
rule="compressrel",
inputs=rel_outputs,
implicit=[dtk],
order_only="post-link",
)
n.newline()
# Add all build steps needed post-build (re-building archives and such)
@@ -1239,9 +1276,9 @@ def generate_build_ninja(
if config.non_matching:
n.default(link_outputs)
elif config.progress:
n.default(progress_path)
n.default([progress_path, foresta_szs_path])
else:
n.default(ok_path)
n.default([ok_path, foresta_szs_path])
else:
n.default(build_config_path)