mirror of
https://github.com/open-goal/jak-project
synced 2026-09-06 11:20:54 -04:00
decomp drawable, main (#3434)
This commit is contained in:
@@ -2078,9 +2078,10 @@ std::vector<BitFieldConstantDef> decompile_bitfield_from_int(const TypeSpec& typ
|
||||
return *try_decompile_bitfield_from_int(type, ts, value, true, {});
|
||||
}
|
||||
|
||||
std::vector<std::string> decompile_bitfield_enum_from_int(const TypeSpec& type,
|
||||
const TypeSystem& ts,
|
||||
u64 value) {
|
||||
std::optional<std::vector<std::string>> try_decompile_bitfield_enum_from_int(const TypeSpec& type,
|
||||
const TypeSystem& ts,
|
||||
u64 value,
|
||||
bool require_success) {
|
||||
u64 reconstructed = 0;
|
||||
std::vector<std::string> result;
|
||||
auto type_info = ts.try_enum_lookup(type.base_type());
|
||||
@@ -2116,10 +2117,14 @@ std::vector<std::string> decompile_bitfield_enum_from_int(const TypeSpec& type,
|
||||
}
|
||||
|
||||
if (reconstructed != value) {
|
||||
throw std::runtime_error(fmt::format(
|
||||
"Failed to decompile bitfield enum {}. Original value is 0x{:x} but we could only "
|
||||
"make 0x{:x} using the available fields.",
|
||||
type.print(), value, reconstructed));
|
||||
if (require_success) {
|
||||
throw std::runtime_error(fmt::format(
|
||||
"Failed to decompile bitfield enum {}. Original value is 0x{:x} but we could only "
|
||||
"make 0x{:x} using the available fields.",
|
||||
type.print(), value, reconstructed));
|
||||
} else {
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
if (bit_count == (int)result.size()) {
|
||||
@@ -2137,6 +2142,14 @@ std::vector<std::string> decompile_bitfield_enum_from_int(const TypeSpec& type,
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<std::string> decompile_bitfield_enum_from_int(const TypeSpec& type,
|
||||
const TypeSystem& ts,
|
||||
u64 value) {
|
||||
auto ret = try_decompile_bitfield_enum_from_int(type, ts, value, true);
|
||||
ASSERT(ret.has_value());
|
||||
return *ret;
|
||||
}
|
||||
|
||||
std::string decompile_int_enum_from_int(const TypeSpec& type, const TypeSystem& ts, u64 value) {
|
||||
auto type_info = ts.try_enum_lookup(type.base_type());
|
||||
ASSERT(type_info);
|
||||
|
||||
Reference in New Issue
Block a user