Skip to content

Commit

Permalink
SDKDumper: Encode size into dumped classes
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed May 21, 2024
1 parent d3313ed commit e1c7cc5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/mods/uobjecthook/SDKDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,27 @@ sdkgenny::Struct* SDKDumper::get_or_generate_struct(sdk::UStruct* ustruct) {
generate_properties(s, ustruct);
generate_functions(s, ustruct);

static const auto uscriptstruct_c = sdk::UScriptStruct::static_class();

if (auto c = ustruct->get_class(); c != nullptr && c->is_a(uscriptstruct_c)) {
auto uscriptstruct = (sdk::UScriptStruct*)ustruct;

if (uscriptstruct->get_struct_size() > 0) {
s->size(uscriptstruct->get_struct_size());
}
}

if (ustruct->get_properties_size() > s->size() && ustruct->get_properties_size() > 0) {
const auto ps = ustruct->get_properties_size();
const auto ma = ustruct->get_min_alignment();

if (ma > 1) {
s->size(((ps + ma - 1) / ma) * ma);
} else {
s->size(ps);
}
}

return s;
}

Expand Down

0 comments on commit e1c7cc5

Please sign in to comment.