add support for non virtual states (#764)

* add support for non virtual states

* typecheck go

* start on virtual states

* more support for virtual states

* offline passes

* fix tests

* use behavior shortcut instead of lambda

* final cleanup of virtual go

* unused var warnings and fix inconsistent enum decompile order on win vs linux

* fix thread safety bug with goal symbol table and vif1 interrupt handler

* fix type mistake
This commit is contained in:
water111
2021-08-17 20:54:03 -04:00
committed by GitHub
parent 2dfb2b2545
commit 97ab6a4e12
76 changed files with 7111 additions and 7828 deletions
+14 -4
View File
@@ -1281,13 +1281,23 @@ std::string decompile_int_enum_from_int(const TypeSpec& type, const TypeSystem&
auto type_info = ts.try_enum_lookup(type.base_type());
assert(type_info);
assert(!type_info->is_bitfield());
std::vector<std::string> matches;
for (auto& field : type_info->entries()) {
if ((u64)field.second == value) {
return field.first;
matches.push_back(field.first);
}
}
throw std::runtime_error(
fmt::format("Failed to decompile integer enum. Value {} (0x{:x}) wasn't found in enum {}",
value, value, type_info->get_name()));
if (matches.size() == 0) {
throw std::runtime_error(
fmt::format("Failed to decompile integer enum. Value {} (0x{:x}) wasn't found in enum {}",
value, value, type_info->get_name()));
} else if (matches.size() == 1) {
return matches.front();
} else {
std::sort(matches.begin(), matches.end());
return matches.front();
}
}
} // namespace decompiler