mirror of
https://github.com/open-goal/jak-project
synced 2026-05-24 23:22:14 -04:00
[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.  --------- Co-authored-by: water111 <awaterford1111445@gmail.com>
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user