Skip to content

Commit 8905c30

Browse files
committed
Merge branch 'uvtd-changes-martin-1'
2 parents 5ff1982 + bbd3f78 commit 8905c30

70 files changed

Lines changed: 51689 additions & 19689 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

UE4SS/generated_include/MacroSetter.hpp

Lines changed: 942 additions & 1430 deletions
Large diffs are not rendered by default.

UVTD/include/UVTD/Config.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ namespace RC::UVTD
2222
struct MemberRenameInfo
2323
{
2424
File::StringType mapped_name{};
25+
File::StringType mapped_type_name{};
2526
bool generate_alias_setter{false};
2627
File::StringType description{};
2728
};

UVTD/include/UVTD/ConfigUtil.hpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,5 +161,23 @@ namespace RC::UVTD
161161
// Fall back to auto-generated macro from PDBNameInfo
162162
return PDBNameInfo::suffix_to_macro(suffix);
163163
}
164+
165+
// Check if a specific suffix variant exists for a base version
166+
// Scans pdbs_to_dump looking for base_version_suffix pattern
167+
inline bool HasSuffixVariant(const File::StringType& base_version, const File::StringType& suffix)
168+
{
169+
// Look for a PDB named base_version_suffix (e.g., "4_27_CasePreserving")
170+
File::StringType target = base_version + STR("_") + suffix;
171+
172+
for (const auto& pdb_path : GetPDBsToDump())
173+
{
174+
File::StringType pdb_stem = pdb_path.filename().stem().wstring();
175+
if (pdb_stem == target)
176+
{
177+
return true;
178+
}
179+
}
180+
return false;
181+
}
164182
}
165183
}

UVTD/include/UVTD/PDBNameInfo.hpp

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@
1515

1616
namespace RC::UVTD
1717
{
18-
// PDB naming format: Major_Minor[-Suffix1][-Suffix2]
18+
// PDB naming format: Major_Minor[_Suffix1][_Suffix2]
1919
// Minor version is always 2 digits (e.g., 5_01, 4_27)
20-
// Examples: 4_27, 5_01-CasePreserving, 4_27-MyGame-Debug
20+
// Examples: 4_27, 5_01_CasePreserving, 4_27_MyGame_Debug
2121
struct PDBNameInfo
2222
{
2323
int32_t major_version{};
2424
int32_t minor_version{};
2525
std::array<File::StringType, 2> suffixes{};
2626
size_t suffix_count{};
2727

28-
// The full original name (e.g., "4_27-CasePreserving")
28+
// The full original name (e.g., "4_27_CasePreserving")
2929
File::StringType full_name{};
3030

3131
// Base version string without suffixes (e.g., "4_27")
@@ -40,62 +40,54 @@ namespace RC::UVTD
4040
PDBNameInfo info;
4141
info.full_name = pdb_name;
4242

43-
// Split by '-' to separate version from suffixes
43+
// Split by '_' - format is Major_Minor[_Suffix1][_Suffix2]
4444
std::vector<File::StringType> parts;
4545
size_t start = 0;
4646
size_t pos = 0;
4747

48-
while ((pos = pdb_name.find(STR('-'), start)) != File::StringType::npos)
48+
while ((pos = pdb_name.find(STR('_'), start)) != File::StringType::npos)
4949
{
5050
parts.push_back(pdb_name.substr(start, pos - start));
5151
start = pos + 1;
5252
}
5353
parts.push_back(pdb_name.substr(start));
5454

55-
if (parts.empty()) return std::nullopt;
56-
57-
// First part should be Major_Minor
58-
const auto& version_part = parts[0];
59-
info.base_version = version_part;
60-
61-
// Find the underscore separating major and minor
62-
auto underscore_pos = version_part.find(STR('_'));
63-
if (underscore_pos == File::StringType::npos) return std::nullopt;
64-
65-
// Parse major version
66-
auto major_str = version_part.substr(0, underscore_pos);
67-
if (major_str.empty()) return std::nullopt;
55+
// Need at least Major_Minor (2 parts)
56+
if (parts.size() < 2) return std::nullopt;
6857

58+
// Parse major version (first part)
59+
if (parts[0].empty()) return std::nullopt;
6960
try
7061
{
71-
info.major_version = std::stoi(to_string(major_str));
62+
info.major_version = std::stoi(to_string(parts[0]));
7263
}
7364
catch (...)
7465
{
7566
return std::nullopt;
7667
}
7768

78-
// Parse minor version
79-
auto minor_str = version_part.substr(underscore_pos + 1);
80-
if (minor_str.empty()) return std::nullopt;
81-
69+
// Parse minor version (second part)
70+
if (parts[1].empty()) return std::nullopt;
8271
try
8372
{
84-
info.minor_version = std::stoi(to_string(minor_str));
73+
info.minor_version = std::stoi(to_string(parts[1]));
8574
}
8675
catch (...)
8776
{
8877
return std::nullopt;
8978
}
9079

80+
// Base version is Major_Minor
81+
info.base_version = std::format(STR("{}_{}"), parts[0], parts[1]);
82+
9183
// Generate version_no_separator (for class names like UnrealVirtual427)
9284
info.version_no_separator = std::format(STR("{}{}"),
9385
info.major_version,
9486
info.minor_version < 10 ? std::format(STR("0{}"), info.minor_version) : std::format(STR("{}"), info.minor_version));
9587

96-
// Collect suffixes (max 2)
88+
// Collect suffixes (parts 2+ are suffixes, max 2)
9789
info.suffix_count = 0;
98-
for (size_t i = 1; i < parts.size() && info.suffix_count < 2; ++i)
90+
for (size_t i = 2; i < parts.size() && info.suffix_count < 2; ++i)
9991
{
10092
if (!parts[i].empty())
10193
{

UVTD/src/Config.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ namespace RC::UVTD
4444

4545
struct MemberRenameInfoJson {
4646
std::string mapped_name;
47+
std::string mapped_type_name;
4748
bool generate_alias_setter{false};
4849
std::string description;
4950
};
@@ -85,6 +86,7 @@ namespace glz {
8586
struct meta<RC::UVTD::MemberRenameInfoJson> {
8687
static constexpr auto value = glz::object(
8788
"mapped_name", &RC::UVTD::MemberRenameInfoJson::mapped_name,
89+
"mapped_type_name", &RC::UVTD::MemberRenameInfoJson::mapped_type_name,
8890
"generate_alias_setter", &RC::UVTD::MemberRenameInfoJson::generate_alias_setter,
8991
"description", &RC::UVTD::MemberRenameInfoJson::description
9092
);
@@ -151,8 +153,12 @@ namespace RC::UVTD
151153

152154
std::unordered_set<std::string> seen_names;
153155

154-
for (const auto& item : result.value())
156+
for (auto& item : result.value())
155157
{
158+
if (item.name == "FFixedUObjectArray" || item.name == "FChunkedFixedUObjectArray")
159+
{
160+
item.name = "TUObjectArray";
161+
}
156162
if (seen_names.insert(item.name).second)
157163
{
158164
// First time seeing this name, add it
@@ -345,6 +351,7 @@ namespace RC::UVTD
345351
{
346352
class_members[to_wstring(member_name)] = {
347353
to_wstring(info.mapped_name),
354+
to_wstring(info.mapped_type_name),
348355
info.generate_alias_setter,
349356
to_wstring(info.description)
350357
};

UVTD/src/MemberVarsDumper.cpp

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,11 @@ namespace RC::UVTD
107107
if (type_record->data.LF_CLASS.property.fwdref) continue;
108108

109109
const File::StringType class_name = Symbols::get_leaf_name(type_record->data.LF_CLASS.data, type_record->data.LF_CLASS.lfEasy.kind);
110-
if (!names.contains(class_name)) continue;
110+
auto class_name_final = class_name;
111+
unify_uobject_array_if_needed(class_name_final);
112+
if (!names.contains(class_name_final)) continue;
111113

112-
const auto name_info = names.find(class_name);
114+
const auto name_info = names.find(class_name_final);
113115
if (name_info == names.end()) continue;
114116

115117
process_class(tpi_stream, type_record, class_name, name_info->second);
@@ -141,6 +143,8 @@ namespace RC::UVTD
141143
const auto& pdb_base_version = pdb_info.base_version;
142144
// Use version_no_separator for class names (e.g., "427")
143145
const auto& pdb_name_no_underscore = pdb_info.version_no_separator;
146+
// Construct filename prefix: base_version + suffix_string (e.g., "4_27" or "4_27_CasePreserving")
147+
auto pdb_filename_prefix = pdb_base_version + pdb_info.get_suffix_string();
144148

145149
auto template_file = std::format(STR("MemberVariableLayout_{}_Template.ini"), pdb_full_name);
146150

@@ -181,9 +185,12 @@ namespace RC::UVTD
181185
continue;
182186
}
183187

184-
// Use full name for file (includes suffix like CasePreserving)
188+
File::StringType final_class_name_clean = class_entry.class_name_clean;
189+
unify_uobject_array_if_needed(final_class_name_clean);
190+
191+
// Use filename prefix for function body files (base_version + suffix with underscore)
185192
auto default_setter_src_file = member_variable_layouts_gen_function_bodies_path /
186-
std::format(STR("{}_MemberVariableLayout_DefaultSetter_{}.cpp"), pdb_full_name, class_entry.class_name_clean);
193+
std::format(STR("{}_MemberVariableLayout_DefaultSetter_{}.cpp"), pdb_filename_prefix, final_class_name_clean);
187194

188195
Output::send(STR("Generating file '{}'\n"), default_setter_src_file.wstring());
189196

@@ -194,7 +201,10 @@ namespace RC::UVTD
194201
return File::StringType{string};
195202
});
196203

197-
ini_dumper.send(STR("[{}]\n"), class_entry.class_name);
204+
File::StringType final_class_name = class_entry.class_name;
205+
unify_uobject_array_if_needed(final_class_name);
206+
207+
ini_dumper.send(STR("[{}]\n"), final_class_name);
198208
// Output total size as a comment at the top
199209
ini_dumper.send(STR("; Total Size: 0x{:X}\n"), class_entry.total_size);
200210

@@ -253,10 +263,6 @@ namespace RC::UVTD
253263
final_variable_name = rename_info->mapped_name;
254264
}
255265

256-
// But for code generation, use the internal variable name
257-
File::StringType final_class_name = class_entry.class_name;
258-
unify_uobject_array_if_needed(final_class_name);
259-
260266
// Skip if we've already processed this variable to avoid duplicates
261267
if (processed_variables.find(final_variable_name) != processed_variables.end())
262268
{
@@ -294,7 +300,7 @@ namespace RC::UVTD
294300

295301
// Add UEP_TotalSize to the default setter
296302
{
297-
File::StringType total_size_class_name = class_entry.class_name;
303+
File::StringType total_size_class_name = final_class_name;
298304
unify_uobject_array_if_needed(total_size_class_name);
299305
default_setter_src_dumper.send(STR("if (auto it = {}::MemberOffsets.find(STR(\"UEP_TotalSize\")); it == {}::MemberOffsets.end())\n"),
300306
total_size_class_name, total_size_class_name);

0 commit comments

Comments
 (0)