decomp: the majority of navigate and rolling-lightning-mole (#741)

* decomp: Add texture-upload to ref tests

* maybe 50% done?

* 5 functions to go!

* decomp: stuck in `navigate`

* work-around fp issue

* some cleanup and label casts

* working on supporting asm instructions -- this is currently WRONG

* support ASM operations

* fixes for asm op support

* decomp: finish the vast majority of `navigate`

* format

* update test though i think this suggests a regression!

* decomp: cleanup some more of navigate

* decomp: finish `rolling-lightning-mole`

* revert `r0` handling for `pcpyud` and `pextuw`

* update ref tests

* lint

* fix a failing test

* help

* navigate mostly works now, with some potential bugs

* remove my debugging logs

* update ref tests

* review feedback cleanup

* these are all likely fine

* can't get the crab to chase me anymore

* the crab is back
This commit is contained in:
Tyler Wilding
2022-01-18 01:14:47 -05:00
committed by GitHub
parent f8fa95f9bf
commit 142961a747
70 changed files with 11764 additions and 909 deletions
+48 -2
View File
@@ -336,8 +336,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);
assert(stride == align(elt_type_info->get_size_in_memory(),
elt_type_info->get_inline_array_stride_alignment()));
int ye = align(elt_type_info->get_size_in_memory(),
elt_type_info->get_inline_array_stride_alignment());
assert(stride == ye);
// the input is the location of the data field.
// we expect that to be a label:
@@ -450,6 +451,39 @@ goos::Object sp_field_init_spec_decompile(const std::vector<LinkedWord>& words,
file, TypeSpec("sp-field-init-spec"), 16);
}
goos::Object nav_mesh_vertex_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-vertex"), 16);
}
goos::Object nav_mesh_poly_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-poly"), 8);
}
goos::Object nav_mesh_route_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("vector4ub"), 4);
}
goos::Object sp_launch_grp_launcher_decompile(const std::vector<LinkedWord>& words,
const std::vector<DecompilerLabel>& labels,
int my_seg,
@@ -676,6 +710,18 @@ 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") {
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") {
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") {
field_defs_out.emplace_back(
field.name(), nav_mesh_route_arr_decompile(obj_words, labels, label.target_segment,
field_start, ts, words, file));
} else if (field.name() == "launcher" && type.print() == "sparticle-launch-group") {
field_defs_out.emplace_back(field.name(), sp_launch_grp_launcher_decompile(
obj_words, labels, label.target_segment,