[Decomp] Math library: transform and quaternion (#344)

* decompile transform

* types for quaternion

* part of quaternion

* finish quaternion

* fix offline test reference

* wip fix to let issue

* fix
This commit is contained in:
water111
2021-04-02 11:35:14 -04:00
committed by GitHub
parent 7867de8fd7
commit 9969445cf7
44 changed files with 3485 additions and 459 deletions
+16 -1
View File
@@ -2,6 +2,7 @@
#include "insert_lets.h"
#include "decompiler/IR2/GenericElementMatcher.h"
#include "decompiler/util/DecompilerTypeSystem.h"
namespace decompiler {
@@ -290,7 +291,21 @@ Form* insert_cast_for_let(RegisterAccess dst,
auto dst_type = env.get_variable_type(dst, true);
if (src_type != dst_type) {
// fmt::print("inserting let cast because {} != {}\n", dst_type.print(), src_type.print());
/*auto src_as_cast = dynamic_cast<CastElement*>(src->try_as_single_element());
if (src_as_cast) {
if (env.dts->ts.tc(dst_type, src_as_cast->type())) {
return src; // no need to cast again.
} else {
// don't nest casts
src_as_cast->set_type(dst_type);
return src;
}
}*/
auto as_single = src->try_as_single_element();
if (as_single) {
return pool.alloc_single_form(nullptr, make_cast_using_existing(as_single, dst_type, pool));
}
return pool.alloc_single_element_form<CastElement>(nullptr, dst_type, src);
}