Skip to content

Commit

Permalink
feat(UVTD): add UEngine + FWorldContext dumping
Browse files Browse the repository at this point in the history
  • Loading branch information
localcc committed Feb 2, 2024
1 parent c053439 commit 811ed75
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 64 deletions.
116 changes: 59 additions & 57 deletions UVTD/include/UVTD/Helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ namespace RC::UVTD
{STR("AGameMode"), ValidForVTable::Yes, ValidForMemberVars::Yes},
{STR("AActor"), ValidForVTable::Yes, ValidForMemberVars::Yes},
{STR("UPlayer"), ValidForVTable::Yes, ValidForMemberVars::Yes},
{STR("UEngine"), ValidForVTable::Yes, ValidForMemberVars::No},
{STR("ULocalPlayer"), ValidForVTable::Yes, ValidForMemberVars::Yes},
{STR("FField"), ValidForVTable::Yes, ValidForMemberVars::Yes},
{STR("UField"), ValidForVTable::Yes, ValidForMemberVars::Yes},
Expand All @@ -64,6 +65,7 @@ namespace RC::UVTD
{STR("UMulticastDelegateProperty"), ValidForVTable::Yes, ValidForMemberVars::Yes},
{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("FConsoleVariableBase"), ValidForVTable::Yes, ValidForMemberVars::Yes},
Expand Down Expand Up @@ -122,62 +124,62 @@ namespace RC::UVTD
};

static inline std::unordered_set<File::StringType> s_valid_udt_names{STR("UScriptStruct::ICppStructOps"),
STR("UObjectBase"),
STR("UObjectBaseUtility"),
STR("UObject"),
STR("UStruct"),
STR("UGameViewportClient"),
STR("UScriptStruct"),
STR("FOutputDevice"),
// STR("UConsole"),
STR("FMalloc"),
STR("FArchive"),
STR("FArchiveState"),
STR("AGameModeBase"),
STR("AGameMode"),
STR("AActor"),
STR("AHUD"),
STR("UPlayer"),
STR("ULocalPlayer"),
STR("FExec"),
STR("UField"),
STR("FField"),
STR("FProperty"),
STR("UProperty"),
STR("FNumericProperty"),
STR("UNumericProperty"),
STR("FMulticastDelegateProperty"),
STR("UMulticastDelegateProperty"),
STR("FObjectPropertyBase"),
STR("UObjectPropertyBase"),
STR("UStructProperty"),
STR("FStructProperty"),
STR("UArrayProperty"),
STR("FArrayProperty"),
STR("UMapProperty"),
STR("FMapProperty"),
STR("UWorld"),
STR("UFunction"),
STR("FBoolProperty"),
STR("UClass"),
STR("UEnum"),
STR("UBoolProperty"),
STR("FByteProperty"),
STR("UByteProperty"),
STR("FEnumProperty"),
STR("UEnumProperty"),
STR("FClassProperty"),
STR("UClassProperty"),
STR("FSoftClassProperty"),
STR("USoftClassProperty"),
STR("FDelegateProperty"),
STR("UDelegateProperty"),
STR("FInterfaceProperty"),
STR("UInterfaceProperty"),
STR("FFieldPathProperty"),
STR("FSetProperty"),
STR("USetProperty"),
STR("FFrame")};
STR("UObjectBase"),
STR("UObjectBaseUtility"),
STR("UObject"),
STR("UStruct"),
STR("UGameViewportClient"),
STR("UScriptStruct"),
STR("FOutputDevice"),
// STR("UConsole"),
STR("FMalloc"),
STR("FArchive"),
STR("FArchiveState"),
STR("AGameModeBase"),
STR("AGameMode"),
STR("AActor"),
STR("AHUD"),
STR("UPlayer"),
STR("ULocalPlayer"),
STR("FExec"),
STR("UField"),
STR("FField"),
STR("FProperty"),
STR("UProperty"),
STR("FNumericProperty"),
STR("UNumericProperty"),
STR("FMulticastDelegateProperty"),
STR("UMulticastDelegateProperty"),
STR("FObjectPropertyBase"),
STR("UObjectPropertyBase"),
STR("UStructProperty"),
STR("FStructProperty"),
STR("UArrayProperty"),
STR("FArrayProperty"),
STR("UMapProperty"),
STR("FMapProperty"),
STR("UWorld"),
STR("UFunction"),
STR("FBoolProperty"),
STR("UClass"),
STR("UEnum"),
STR("UBoolProperty"),
STR("FByteProperty"),
STR("UByteProperty"),
STR("FEnumProperty"),
STR("UEnumProperty"),
STR("FClassProperty"),
STR("UClassProperty"),
STR("FSoftClassProperty"),
STR("USoftClassProperty"),
STR("FDelegateProperty"),
STR("UDelegateProperty"),
STR("FInterfaceProperty"),
STR("UInterfaceProperty"),
STR("FFieldPathProperty"),
STR("FSetProperty"),
STR("USetProperty"),
STR("FFrame")};

static inline std::vector<File::StringType> s_uprefix_to_fprefix{
STR("UProperty"),
Expand Down Expand Up @@ -211,4 +213,4 @@ namespace RC::UVTD
auto unify_uobject_array_if_needed(StringType& out_variable_type) -> bool;
} // namespace RC::UVTD

#endif
#endif
13 changes: 8 additions & 5 deletions UVTD/src/MemberVarsDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ namespace RC::UVTD
STR("FOnPlatformUserIdChanged"),
STR("FObjectSubsystemCollection"),
STR("FSceneViewStateReference"),
STR("UPendingNetGame"),
STR("FFullyLoadedPackagesInfo"),
STR("UObjectReferencer"),
STR("FNamedNetDriver"),
STR("FSeamlessTravelHandler"),
STR("FLevelStreamingStatus"),
};

auto MemberVarsDumper::process_class(const PDB::TPIStream& tpi_stream,
Expand Down Expand Up @@ -260,10 +266,7 @@ namespace RC::UVTD
final_variable_name,
final_class_name);
default_setter_src_dumper.send(STR("{\n"));
default_setter_src_dumper.send(STR(" {}::MemberOffsets.emplace(STR(\"{}\"), 0x{:X});\n"),
final_class_name,
final_variable_name,
variable.offset);
default_setter_src_dumper.send(STR(" {}::MemberOffsets.emplace(STR(\"{}\"), 0x{:X});\n"), final_class_name, final_variable_name, variable.offset);
default_setter_src_dumper.send(STR("}\n\n"));
}

Expand Down Expand Up @@ -308,4 +311,4 @@ namespace RC::UVTD
}
}
}
} // namespace RC::UVTD
} // namespace RC::UVTD
4 changes: 3 additions & 1 deletion UVTD/src/UVTD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include <UVTD/UnrealVirtualGenerator.hpp>
#include <UVTD/VTableDumper.hpp>

#include <Windows.h>
#include <Psapi.h>
#include <Windows.h>
#include <dbghelp.h>

namespace RC::UVTD
Expand All @@ -39,6 +39,7 @@ namespace RC::UVTD
auto main(DumpSettings dump_settings) -> void
{
static std::vector<std::filesystem::path> pdbs_to_dump{
"PDBs/4_10.pdb",
"PDBs/4_11.pdb",
"PDBs/4_12.pdb",
"PDBs/4_13.pdb",
Expand All @@ -61,6 +62,7 @@ namespace RC::UVTD
"PDBs/5_00.pdb",
"PDBs/5_01.pdb",
"PDBs/5_02.pdb",
"PDBs/5_03.pdb",
};

UnrealVirtualGenerator::output_cleanup();
Expand Down
5 changes: 4 additions & 1 deletion UVTD/src/UnrealVirtualGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ namespace RC::UVTD
virtual_src_dumper.send(STR("#include <functional>\n\n"));
virtual_src_dumper.send(STR("// These are all the structs that have virtuals that need to have their offset set\n"));
virtual_src_dumper.send(STR("#include <Unreal/UObject.hpp>\n"));
virtual_src_dumper.send(STR("#include <Unreal/UEngine.hpp>\n"));
virtual_src_dumper.send(STR("#include <Unreal/UScriptStruct.hpp>\n"));
virtual_src_dumper.send(STR("#include <Unreal/FOutputDevice.hpp>\n"));
virtual_src_dumper.send(STR("#include <Unreal/FField.hpp>\n"));
Expand All @@ -75,6 +76,8 @@ namespace RC::UVTD
virtual_src_dumper.send(STR("#include <Unreal/UClass.hpp>\n"));
virtual_src_dumper.send(STR("#include <Unreal/World.hpp>\n"));
virtual_src_dumper.send(STR("#include <Unreal/UEnum.hpp>\n"));
virtual_src_dumper.send(STR("#include <Unreal/UEngine.hpp>\n"));
virtual_src_dumper.send(STR("#include <Unreal/FWorldContext.hpp>\n"));
virtual_src_dumper.send(STR("#include <Unreal/FArchive.hpp>\n"));
virtual_src_dumper.send(STR("#include <Unreal/AGameModeBase.hpp>\n"));
virtual_src_dumper.send(STR("#include <Unreal/AGameMode.hpp>\n"));
Expand Down Expand Up @@ -179,4 +182,4 @@ namespace RC::UVTD
}
}
}
} // namespace RC::UVTD
} // namespace RC::UVTD

0 comments on commit 811ed75

Please sign in to comment.