decomp: finish _almost all of_ the remaining camera code (#845)

* decomp: mostly finish `cam-master`

* decomp/scripts: lots of work in cam-states

* stash

* Merge remote-tracking branch 'water111/master' into decomp/camera-master

Updated submodule third-party/googletest

* decompiler: Add support for non power of 2 offsets for inline arr access

* decomp: mostly finish `cam-states` need to fix a macro issue

* blocked: `cam-master` decompiler crash when adding casts

* decomp: finish `cam-states-dbg`

* decomp: mostly finish `pov-camera` with the exception of joint-related code

* decomp: `cam-debug` finished decompiling, no way does this compile yet though

* decomp: considerable work done in `cam-layout`

* decomp: `cam-layout` almost done!

* decomp: `pov-camera` finished, TC tests will fail for now

* decomp: working on resolving issues

* decomp: cam-layout decompiling

* fixing more issues in cam-master...one event handler remains

* skip problematic function in `cam-master` for now

* gsrc: update res macros

* decomp: finish `cam-states`

* decomp: giving up on `cam-debug`

* tests: allow skipping state handlers in ref tests

* decomp: working through cam-layout bugs

* decomp: allow for shifting non-integers

* decomp: finalize `cam-layout` and `cam-master`

* decomp: finalize `cam-states`

* cleanup: bi-annual formatting of the casting files

* formatting

* address feedback - leave the float labels alone for now

* address feedback

* linting/formatting

* update gsrc and ref tests

Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>
This commit is contained in:
Tyler Wilding
2021-10-16 21:01:23 -04:00
committed by GitHub
parent 993f348c93
commit 45318be063
57 changed files with 29413 additions and 3078 deletions
+35 -1
View File
@@ -4738,7 +4738,41 @@ void ArrayFieldAccess::update_with_val(Form* new_val,
auto deref = pool.alloc_element<DerefElement>(base, false, tokens);
result->push_back(deref);
} else {
throw std::runtime_error("Not power of two case, not yet implemented (no offset)");
auto mult_matcher = Matcher::op(
GenericOpMatcher::fixed(FixedOperatorKind::MULTIPLICATION),
{Matcher::match_or({Matcher::cast("uint", Matcher::integer(m_expected_stride)),
Matcher::integer(m_expected_stride)}),
Matcher::any(0)});
mult_matcher = Matcher::match_or(
{Matcher::cast("uint", mult_matcher), Matcher::cast("int", mult_matcher), mult_matcher});
auto op_match =
GenericOpMatcher::or_match({GenericOpMatcher::fixed(FixedOperatorKind::ADDITION),
GenericOpMatcher::fixed(FixedOperatorKind::ADDITION_PTR)});
auto add_matcher = Matcher::op(op_match, {Matcher::any(1), mult_matcher});
add_matcher =
Matcher::match_or({add_matcher, Matcher::op(op_match, {mult_matcher, Matcher::any(1)})});
auto mr = match(add_matcher, new_val);
if (!mr.matched) {
throw std::runtime_error("Failed to match non-power of two case: " +
new_val->to_string(env));
}
auto base = strip_int_or_uint_cast(mr.maps.forms.at(1));
auto idx = mr.maps.forms.at(0);
assert(idx && base);
std::vector<DerefToken> tokens = m_deref_tokens;
for (auto& x : tokens) {
if (x.kind() == DerefToken::Kind::EXPRESSION_PLACEHOLDER) {
x = DerefToken::make_int_expr(idx);
}
}
auto deref = pool.alloc_element<DerefElement>(base, false, tokens);
result->push_back(deref);
}
} else {
if (m_expected_stride == 1) {