[decomp] game-info (#779)

* support more process stuff

* more of game info

* add ref file

* progress on save
This commit is contained in:
water111
2021-08-22 20:12:47 -04:00
committed by GitHub
parent 30d1e1d6c9
commit 403bb5f4de
117 changed files with 6234 additions and 2243 deletions
+32 -15
View File
@@ -7,6 +7,15 @@
namespace decompiler {
namespace {
bool kind_for_lambda(FunctionName::FunctionKind k) {
if (k == FunctionName::FunctionKind::UNIDENTIFIED || k == FunctionName::FunctionKind::NV_STATE ||
k == FunctionName::FunctionKind::V_STATE) {
return true;
}
return false;
}
bool try_convert_lambda(const Function& parent_function,
FormPool& pool,
Form* f,
@@ -17,23 +26,31 @@ bool try_convert_lambda(const Function& parent_function,
auto& env = parent_function.ir2.env;
auto label_kv = env.label_types().find(lab.name);
if (label_kv != env.label_types().end()) {
if (label_kv->second.type_name == "_lambda_") {
auto& file = env.file;
auto other_func = file->try_get_function_at_label(atom->label());
if (other_func) {
goos::Object result;
if (defstate_behavior) {
result = final_output_defstate_anonymous_behavior(*other_func);
} else {
result = final_output_lambda(*other_func);
}
f->clear();
f->push_back(pool.alloc_element<LambdaDefinitionElement>(result));
return true;
}
if (label_kv->second.type_name != "_lambda_") {
lg::error(
"Label {} wasn't marked as a lambda, but it is. Marking lambdas is no longer required.",
lab.name);
}
}
auto& file = env.file;
auto other_func = file->try_get_function_at_label(atom->label());
if (other_func && kind_for_lambda(other_func->guessed_name.kind)) {
if (!other_func->ir2.env.has_local_vars()) {
// don't bother if we don't even have vars.
return false;
}
goos::Object result;
if (defstate_behavior) {
result = final_output_defstate_anonymous_behavior(*other_func);
} else {
result = final_output_lambda(*other_func);
}
f->clear();
f->push_back(pool.alloc_element<LambdaDefinitionElement>(result));
return true;
}
}
return false;
}