[decompiler] as-type and font method support (#3855)

Add support for `as-type` macro, and detecting inline font methods. This
works in all three games but I've only updated jak 3's goal_src for now.
Eventually I will go back and work through the others, but I want to get
more decompiler features in first.


![image](https://github.com/user-attachments/assets/5c31bf85-97b4-437c-bc4b-dc054e60551e)

---------

Co-authored-by: water111 <awaterford1111445@gmail.com>
This commit is contained in:
water111
2025-02-01 21:23:11 -05:00
committed by GitHub
parent d5590ab638
commit 48cb9bb787
645 changed files with 5391 additions and 16694 deletions
+18
View File
@@ -91,6 +91,14 @@ Matcher Matcher::cast(const std::string& type, Matcher value) {
return m;
}
Matcher Matcher::numeric_cast(const std::string& type, Matcher value) {
Matcher m;
m.m_kind = Kind::NUMERIC_CAST;
m.m_str = type;
m.m_sub_matchers = {value};
return m;
}
Matcher Matcher::cast_to_any(int type_out, Matcher value) {
Matcher m;
m.m_kind = Kind::CAST_TO_ANY;
@@ -412,6 +420,16 @@ bool Matcher::do_match(Form* input, MatchResult::Maps* maps_out, const Env* cons
return false;
} break;
case Kind::NUMERIC_CAST: {
auto as_cast = dynamic_cast<CastElement*>(input->try_as_single_active_element());
if (as_cast && as_cast->numeric()) {
if (as_cast->type().print() == m_str) {
return m_sub_matchers.at(0).do_match(as_cast->source(), maps_out, env);
}
}
return false;
} break;
case Kind::CAST_TO_ANY: {
auto as_cast = dynamic_cast<CastElement*>(input->try_as_single_active_element());
if (as_cast) {