[Decomp] Decompile engine math library types (#272)

* decompile some stuff

* fix typo

* playing around with trigonometry

* more progress on trig

* more trig

* comments and small fixes

* finish trig
This commit is contained in:
water111
2021-02-20 11:42:46 -05:00
committed by GitHub
parent 87f2984cf5
commit 8775840265
43 changed files with 2909 additions and 203 deletions
+27 -1
View File
@@ -283,7 +283,8 @@ void ObjectFileDB::ir2_type_analysis_pass() {
attempted_functions++;
// try type analysis here.
auto hints = get_config().type_hints_by_function_by_idx[func.guessed_name.to_string()];
if (func.run_type_analysis_ir2(ts, dts, data.linked_data, hints)) {
auto label_types = get_config().label_types[data.to_unique_name()];
if (func.run_type_analysis_ir2(ts, dts, data.linked_data, hints, label_types)) {
successful_functions++;
} else {
func.warnings.type_prop_warning("Type analysis failed");
@@ -469,6 +470,31 @@ std::string ObjectFileDB::ir2_to_file(ObjectFileData& data) {
}
result += '\n';
} else if (func.ir2.atomic_ops_succeeded) {
auto& ao = func.ir2.atomic_ops;
for (size_t i = 0; i < ao->ops.size(); i++) {
auto& op = ao->ops.at(i);
if (!dynamic_cast<FunctionEndOp*>(op.get())) {
auto instr_idx = ao->atomic_op_to_instruction.at(i);
// check for a label to print
auto label_id = data.linked_data.get_label_at(seg, (func.start_word + instr_idx) * 4);
if (label_id != -1) {
result += fmt::format("(label {})\n", data.linked_data.labels.at(label_id).name);
}
// check for no misaligned labels in code segments.
for (int j = 1; j < 4; j++) {
assert(data.linked_data.get_label_at(seg, (func.start_word + instr_idx) * 4 + j) ==
-1);
}
// print assembly ops.
}
// print instruction
result += fmt::format(" {}\n", op->to_string(func.ir2.env));
}
}
if (func.ir2.print_debug_forms) {