Skip to content

Commit

Permalink
Merge pull request #708 from UE4SS-RE/505Support
Browse files Browse the repository at this point in the history
Add 5.05 support; fix FOptionalProperty support for 5.4
  • Loading branch information
narknon authored Dec 6, 2024
2 parents 1aa51fb + 6326bf9 commit f4a775e
Show file tree
Hide file tree
Showing 58 changed files with 8,738 additions and 4,603 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Lua scripting system platform, C++ Modding API, SDK generator, blueprint mod loa
- [UMAP Recreation Dumper](https://docs.ue4ss.com/dev/feature-overview/dumpers.html#umap-recreation-dumper): Dump all loaded actors to file to generate `.umaps` in-editor
- Other Features, including [Experimental](https://docs.ue4ss.com/dev/feature-overview/experimental.html) features at times

## Targeting UE Versions: From 4.12 To 5.3
## Targeting UE Versions: From 4.12 To 5.5

The goal of UE4SS is not to be a plug-n-play solution that always works with every game.
The goal is to have an underlying system that works for most games.
Expand Down
19 changes: 19 additions & 0 deletions UE4SS/src/SDKGenerator/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <Unreal/Property/FMapProperty.hpp>
#include <Unreal/Property/FMulticastInlineDelegateProperty.hpp>
#include <Unreal/Property/FMulticastSparseDelegateProperty.hpp>
#include <Unreal/Property/FOptionalProperty.hpp>
#include <Unreal/Property/FObjectProperty.hpp>
#include <Unreal/Property/FSetProperty.hpp>
#include <Unreal/Property/FSoftClassProperty.hpp>
Expand Down Expand Up @@ -464,6 +465,14 @@ namespace RC::UEGenerator
return fmt::format(STR("TMap<{}, {}>"), key_type, value_type);
}

if (property->IsA<FOptionalProperty>())
{
FOptionalProperty* optional_property = static_cast<FOptionalProperty*>(property);
FProperty* value_property = optional_property->GetValueProperty();
StringType value_property_type = generate_property_cxx_name(value_property, is_top_level_declaration, class_context);
return fmt::format(STR("TOptional<{}>"), value_property_type);
}

// Standard properties that do not have any special attributes
if (property->IsA<FNameProperty>())
{
Expand All @@ -477,6 +486,7 @@ namespace RC::UEGenerator
{
return STR("FText");
}

throw std::runtime_error(RC::fmt("Unsupported property class %S", field_class_name.c_str()));
}

Expand Down Expand Up @@ -772,6 +782,14 @@ namespace RC::UEGenerator
return fmt::format(STR("TMap<{}, {}>"), key_type, value_type);
}

if (property->IsA<FOptionalProperty>())
{
FOptionalProperty* optional_property = static_cast<FOptionalProperty*>(property);
FProperty* value_property = optional_property->GetValueProperty();
StringType value_property_type = generate_property_lua_name(value_property, is_top_level_declaration, class_context);
return fmt::format(STR("TOptional<{}>"), value_property_type);
}

// Standard properties that do not have any special attributes
if (field_class_name == STR("NameProperty"))
{
Expand All @@ -785,6 +803,7 @@ namespace RC::UEGenerator
{
return STR("FText");
}

throw std::runtime_error(RC::fmt("Unsupported property class %S", field_class_name.c_str()));
}

Expand Down
45 changes: 35 additions & 10 deletions UE4SS/src/SDKGenerator/UEHeaderGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <Unreal/Property/FStructProperty.hpp>
#include <Unreal/Property/FTextProperty.hpp>
#include <Unreal/Property/FWeakObjectProperty.hpp>
#include <Unreal/Property/FOptionalProperty.hpp>
#include <Unreal/Property/NumericPropertyTypes.hpp>
#include <Unreal/UActorComponent.hpp>
#include <Unreal/UClass.hpp>
Expand Down Expand Up @@ -1143,6 +1144,22 @@ namespace RC::UEGenerator
super_property = super->GetPropertyByNameInChain(FromCharTypePtr<TCHAR>(property_name.data()));
}
}

// TODO: Support collection/map properties initialization later
if (property->IsA<FSetProperty>())
{
return;
}
if (property->IsA<FMapProperty>())
{
return;
}

// TODO: Support optional properties initialization later
if (property->IsA<FOptionalProperty>())
{
return;
}

// Byte Property
if (property->IsA<FByteProperty>())
Expand Down Expand Up @@ -1715,16 +1732,6 @@ namespace RC::UEGenerator
return;
}

// TODO: Support collection/map properties initialization later
if (property->IsA<FSetProperty>())
{
return;
}
if (property->IsA<FMapProperty>())
{
return;
}

if (property->IsA<FNumericProperty>())
{
FNumericProperty* numeric_property = static_cast<FNumericProperty*>(property);
Expand Down Expand Up @@ -2661,6 +2668,14 @@ namespace RC::UEGenerator
return fmt::format(STR("TMap<{}, {}>"), key_type, value_type);
}

if (property->IsA<FOptionalProperty>())
{
FOptionalProperty* optional_property = static_cast<FOptionalProperty*>(property);
FProperty* value_property = optional_property->GetValueProperty();
StringType value_property_type = generate_property_type_declaration(value_property, context.inner_context());
return fmt::format(STR("TOptional<{}>"), value_property_type);
}

// Standard properties that do not have any special attributes
if (property->IsA<FNameProperty>())
{
Expand All @@ -2674,6 +2689,7 @@ namespace RC::UEGenerator
{
return STR("FText");
}

throw std::runtime_error(RC::fmt("[generate_property_type_declaration] Unsupported property class '%S', full name: '%S'",
field_class_name.c_str(),
property->GetFullName().c_str()));
Expand Down Expand Up @@ -3367,6 +3383,14 @@ namespace RC::UEGenerator

return fmt::format(STR("TMap<{}, {}>()"), key_type, value_type);
}

if (field_class_name == STR("OptionalProperty"))
{
FOptionalProperty* optional_property = static_cast<FOptionalProperty*>(property);
FProperty* value_property = optional_property->GetValueProperty();
StringType value_property_type = generate_property_type_declaration(value_property, context);
return fmt::format(STR("TOptional<{}>()"), value_property_type);
}

// Various string, name and text properties
if (field_class_name == STR("NameProperty"))
Expand All @@ -3381,6 +3405,7 @@ namespace RC::UEGenerator
{
return STR("FText::GetEmpty()");
}

throw std::runtime_error(RC::fmt("[generate_default_property_value] Unsupported property class '%S', full name: '%S'",
field_class_name.c_str(),
property->GetFullName().c_str()));
Expand Down
7 changes: 4 additions & 3 deletions UVTD/include/UVTD/Helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,9 @@ namespace RC::UVTD
{STR("FObjectPropertyBase"), ValidForVTable::Yes, ValidForMemberVars::Yes},
{STR("UObjectPropertyBase"), ValidForVTable::Yes, ValidForMemberVars::Yes},
{STR("FWorldContext"), ValidForVTable::No, ValidForMemberVars::Yes},
/*{STR("FConsoleManager"), ValidForVTable::Yes, ValidForMemberVars::Yes},
{STR("UDataTable"), ValidForVTable::Yes, ValidForMemberVars::Yes},
/*{STR("FConsoleManager"), ValidForVTable::Yes, ValidForMemberVars::Yes},
{STR("FConsoleVariableBase"), ValidForVTable::Yes, ValidForMemberVars::Yes},
{STR("FConsoleCommandBase"), ValidForVTable::Yes, ValidForMemberVars::Yes},*/

Expand Down Expand Up @@ -100,10 +101,10 @@ namespace RC::UVTD
{STR("FSetProperty"), ValidForVTable::No, ValidForMemberVars::Yes},
{STR("USetProperty"), ValidForVTable::No, ValidForMemberVars::Yes},
{STR("ITextData"), ValidForVTable::Yes, ValidForMemberVars::No},
{STR("FUObjectArray"), ValidForVTable::No, ValidForMemberVars::Yes},
/*{STR("FUObjectArray"), ValidForVTable::No, ValidForMemberVars::Yes},
{STR("FChunkedFixedUObjectArray"), ValidForVTable::No, ValidForMemberVars::Yes},
{STR("FFixedUObjectArray"), ValidForVTable::No, ValidForMemberVars::Yes},
{STR("FUObjectItem"), ValidForVTable::No, ValidForMemberVars::Yes}};
{STR("FUObjectItem"), ValidForVTable::No, ValidForMemberVars::Yes}*/};

static inline std::unordered_map<File::StringType, std::unordered_set<File::StringType>> s_private_variables{
{STR("FField"),
Expand Down
1 change: 0 additions & 1 deletion UVTD/src/MemberVarsDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ namespace RC::UVTD
STR("UContentBundleManager"),
STR("FIrisSystemHolder"),
STR("TSet"),
STR("TOptional"),
STR("FWorldPartitionInitializedEvent"),
STR("FWorldPartitionUninitializedEvent"),
STR("TIntVector3"),
Expand Down
1 change: 1 addition & 0 deletions UVTD/src/UVTD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ namespace RC::UVTD
"PDBs/5_02.pdb",
"PDBs/5_03.pdb",
"PDBs/5_04.pdb",
"PDBs/5_05.pdb",
};

UnrealVirtualGenerator::output_cleanup();
Expand Down
1 change: 1 addition & 0 deletions assets/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ some notes about most important changes such as:
- linux port

## New
Added support for UE Version 5.5 - ([UE4SS #708](https://github.com/UE4SS-RE/RE-UE4SS/pull/708))
Added support for UE Version 5.4 - ([UE4SS #503](https://github.com/UE4SS-RE/RE-UE4SS/pull/503))
Added basic support for Development/Debug/Test built Unreal Engine games ([UE4SS #607](https://github.com/UE4SS-RE/RE-UE4SS/pull/607))
- To use this functionality, set DebugBuild to true in UE4SS-Settings.ini
Expand Down
Loading

0 comments on commit f4a775e

Please sign in to comment.