Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion reversing/rsz/non-native-dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def als(align, size):
"GameObjectRef": als(8, 16),
"Color": als(4, 4),
"DateTime": als(8, 8),
# Struct could have variable size and alignment depends on its element. So we set to (1, 1).
"Struct": als(1, 1),
# Enum could have variable size and alignment, so we fallback to its base type and never use it.

"Uint2": als(4, 8),
Expand Down Expand Up @@ -387,7 +389,9 @@ def generate_field_entries(il2cpp_dump, natives, key, il2cpp_entry, use_typedefs
code = rsz_entry["code"]
type = rsz_entry["type"]

if code == "Struct" and type in il2cpp_dump:
if code == "Struct" and type in il2cpp_dump and rsz_entry.get("array", 0) != 1:
# keep struct type data unpacked for backwards compatibility if it is not an array.

nested_entry, nested_str, i, struct_i = generate_field_entries(il2cpp_dump, natives, type, il2cpp_dump[type], use_typedefs, "STRUCT_" + name + "_", i, struct_i)

if len(nested_entry) > 0:
Expand All @@ -405,6 +409,20 @@ def generate_field_entries(il2cpp_dump, natives, key, il2cpp_entry, use_typedefs
code = code_typedefs[code]
else:
code = "RSZ" + code

if rsz_entry["array"] == 1:
array_type = il2cpp_dump[type]
if array_type.get("element_type_name", None) is not None:
type = array_type["element_type_name"]
elif array_type.get("is_generic_type", False):
array_element_types = [item["type"] for item in array_type["generic_arg_types"]]
if len(array_element_types) == 1:
type = array_element_types[0]
else:
print(f"Array type {type} has multiple element types: {array_element_types}")
else:
print(f"Array type {type} has no element type")


'''
if rsz_entry["array"] == True:
Expand Down
10 changes: 10 additions & 0 deletions src/mods/tools/ObjectExplorer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,16 @@ void ObjectExplorer::generate_sdk() {
type_entry["is_generic_type"] = t.is_generic_type();
type_entry["is_generic_type_definition"] = t.is_generic_type_definition();

#if TDB_VER >= 71
if (tdef->element_typeid_TBD != 0) {
type_entry["element_type_name"] = init_type(il2cpp_dump, tdb, tdef->element_typeid_TBD)->full_name;
}
#elif TDB_VER >= 69
if (tdef->element_typeid != 0) {
type_entry["element_type_name"] = init_type(il2cpp_dump, tdb, tdef->element_typeid)->full_name;
}
#endif

if (auto gtd = t.get_generic_type_definition(); gtd != nullptr) {
type_entry["generic_type_definition"] = gtd->get_full_name();
}
Expand Down
Loading