mirror of
https://github.com/open-goal/jak-project
synced 2026-08-22 07:04:29 -04:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user