d/jak2: finish vol | cam-layout | menu | default-menu and start working on nav code (#1867)

I also added font-color names since this PR adds quite a few:

![image](https://user-images.githubusercontent.com/13153231/189508209-c8849672-fac5-47cb-9652-f1d4648f0af8.png)
This commit is contained in:
Tyler Wilding
2022-09-11 13:42:46 -04:00
committed by GitHub
parent 813611e0b2
commit 017070525a
76 changed files with 23936 additions and 6517 deletions
+43 -6
View File
@@ -436,9 +436,9 @@ goos::Object decomp_ref_to_inline_array_guess_size(
// verify the stride matches the type system
auto elt_type_info = ts.lookup_type(array_elt_type);
int ye = align(elt_type_info->get_size_in_memory(),
elt_type_info->get_inline_array_stride_alignment());
ASSERT(stride == ye);
int elt_size = align(elt_type_info->get_size_in_memory(),
elt_type_info->get_inline_array_stride_alignment());
ASSERT(stride == elt_size);
// the input is the location of the data field.
// we expect that to be a label:
@@ -573,6 +573,29 @@ goos::Object nav_mesh_poly_arr_decompile(const std::vector<LinkedWord>& words,
file, TypeSpec("nav-poly"), 8);
}
goos::Object nav_mesh_poly_arr_jak2_decompile(const std::vector<LinkedWord>& words,
const std::vector<DecompilerLabel>& labels,
int my_seg,
int field_location,
const TypeSystem& ts,
const std::vector<std::vector<LinkedWord>>& all_words,
const LinkedObjectFile* file) {
return decomp_ref_to_inline_array_guess_size(words, labels, my_seg, field_location, ts, all_words,
file, TypeSpec("nav-poly"), 64);
}
goos::Object nav_mesh_nav_control_arr_decompile(
const std::vector<LinkedWord>& words,
const std::vector<DecompilerLabel>& labels,
int my_seg,
int field_location,
const TypeSystem& ts,
const std::vector<std::vector<LinkedWord>>& all_words,
const LinkedObjectFile* file) {
return decomp_ref_to_inline_array_guess_size(words, labels, my_seg, field_location, ts, all_words,
file, TypeSpec("nav-control"), 288);
}
goos::Object nav_mesh_route_arr_decompile(const std::vector<LinkedWord>& words,
const std::vector<DecompilerLabel>& labels,
int my_seg,
@@ -958,6 +981,7 @@ goos::Object decompile_structure(const TypeSpec& type,
fmt::format("Dynamic value field {} in static data type {} not yet implemented",
field.name(), actual_type.print()));
} else {
// TODO - this is getting a little unwieldly -- refactor this at some point
if (field.name() == "data" && type.print() == "ocean-near-indices") {
// first, get the label:
field_defs_out.emplace_back(
@@ -971,15 +995,28 @@ goos::Object decompile_structure(const TypeSpec& type,
field_defs_out.emplace_back(
field.name(), sp_field_init_spec_decompile(obj_words, labels, label.target_segment,
field_start, ts, words, file));
} else if (field.name() == "vertex" && type.print() == "nav-mesh") {
} else if (field.name() == "vertex" && type.print() == "nav-mesh" &&
file->version == GameVersion::Jak1) {
field_defs_out.emplace_back(
field.name(), nav_mesh_vertex_arr_decompile(obj_words, labels, label.target_segment,
field_start, ts, words, file));
} else if (field.name() == "poly" && type.print() == "nav-mesh") {
} else if (field.name() == "poly" && type.print() == "nav-mesh" &&
file->version == GameVersion::Jak1) {
field_defs_out.emplace_back(
field.name(), nav_mesh_poly_arr_decompile(obj_words, labels, label.target_segment,
field_start, ts, words, file));
} else if (field.name() == "route" && type.print() == "nav-mesh") {
} else if (field.name() == "poly-array" && type.print() == "nav-mesh" &&
file->version == GameVersion::Jak2) {
field_defs_out.emplace_back(field.name(), nav_mesh_poly_arr_jak2_decompile(
obj_words, labels, label.target_segment,
field_start, ts, words, file));
} else if (field.name() == "nav-control-array" && type.print() == "nav-mesh" &&
file->version == GameVersion::Jak2) {
field_defs_out.emplace_back(field.name(), nav_mesh_nav_control_arr_decompile(
obj_words, labels, label.target_segment,
field_start, ts, words, file));
} else if (field.name() == "route" && type.print() == "nav-mesh" &&
file->version == GameVersion::Jak1) {
field_defs_out.emplace_back(
field.name(), nav_mesh_route_arr_decompile(obj_words, labels, label.target_segment,
field_start, ts, words, file));