From 1e530714b72d6b8c58ca990e71d7388956056c4e Mon Sep 17 00:00:00 2001 From: water111 <48171810+water111@users.noreply.github.com> Date: Sun, 3 Nov 2024 11:43:27 -0500 Subject: [PATCH] [jak3] Fix for precd extraction (#3744) It looks like one of the tie models in this level has bad color data in the lowest LOD. For now, just skip extracting the lowest lod for this TIE only. Co-authored-by: water111 --- decompiler/config/jak3/ntsc_v1/inputs.jsonc | 2 +- decompiler/level_extractor/BspHeader.cpp | 3 ++- decompiler/level_extractor/extract_tie.cpp | 4 ++++ goal_src/jak3/game.gp | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/decompiler/config/jak3/ntsc_v1/inputs.jsonc b/decompiler/config/jak3/ntsc_v1/inputs.jsonc index b5f47006d1f..ffd7135048f 100644 --- a/decompiler/config/jak3/ntsc_v1/inputs.jsonc +++ b/decompiler/config/jak3/ntsc_v1/inputs.jsonc @@ -186,7 +186,7 @@ "DGO/PRECA.DGO", "DGO/PRECB.DGO", "DGO/PRECC.DGO", - // "DGO/PRECD.DGO", + "DGO/PRECD.DGO", // title/intro "DGO/WIN.DGO", // wasintro "DGO/TITLE.DGO", diff --git a/decompiler/level_extractor/BspHeader.cpp b/decompiler/level_extractor/BspHeader.cpp index 5413407f3a2..f69c4eef991 100644 --- a/decompiler/level_extractor/BspHeader.cpp +++ b/decompiler/level_extractor/BspHeader.cpp @@ -1017,7 +1017,8 @@ void PrototypeBucketTie::read_from_file(TypedRef ref, for (int i = 0; i < 4; i++) { u32 start = index_start[i]; u32 end = start + frag_count[i]; - ASSERT(num_color_qwcs <= end); + // precd tie has a bug where geo 3's + // ASSERT(num_color_qwcs <= end); num_color_qwcs = std::max(end, num_color_qwcs); } diff --git a/decompiler/level_extractor/extract_tie.cpp b/decompiler/level_extractor/extract_tie.cpp index 577edb2c069..53ce30a09a9 100644 --- a/decompiler/level_extractor/extract_tie.cpp +++ b/decompiler/level_extractor/extract_tie.cpp @@ -2753,6 +2753,10 @@ void extract_tie(const level_tools::DrawableTreeInstanceTie* tree, bool dump_level, GameVersion version) { for (int geo = 0; geo < GEOM_MAX; ++geo) { + // as far as I can tell, this one has bad colors + if (debug_name == "PRECD.DGO-2-tie" && geo == 3) { + continue; + } tfrag3::TieTree this_tree; // sanity check the vis tree (not a perfect check, but this is used in game and should be right) diff --git a/goal_src/jak3/game.gp b/goal_src/jak3/game.gp index 766c047422f..a5bf480cbf3 100644 --- a/goal_src/jak3/game.gp +++ b/goal_src/jak3/game.gp @@ -272,7 +272,7 @@ (cgo-file "preca.gd" common-dep) (cgo-file "precb.gd" common-dep) (cgo-file "precc.gd" common-dep) -; (cgo-file "precd.gd" common-dep) +(cgo-file "precd.gd" common-dep) ; ;; title/intro (cgo-file "win.gd" common-dep) ;; wasintro (cgo-file "title.gd" common-dep)