├── Changelog.hpp ├── CodeRedGenerator.sln ├── CodeRedGenerator.vcxproj ├── CodeRedGenerator.vcxproj.filters ├── CodeRedGenerator.vcxproj.user ├── Engine ├── Engine.cpp ├── Engine.hpp ├── RocketLeague │ ├── Configuration.cpp │ ├── Configuration.hpp │ ├── GameDefines.cpp │ ├── GameDefines.hpp │ ├── PiecesOfCode.cpp │ └── PiecesOfCode.hpp └── Template │ ├── Configuration.cpp │ ├── Configuration.hpp │ ├── GameDefines.cpp │ ├── GameDefines.hpp │ ├── PiecesOfCode.cpp │ └── PiecesOfCode.hpp ├── LICENSE ├── Member.cpp ├── Member.hpp ├── Printer.cpp ├── Printer.hpp ├── README.md ├── dllmain.cpp ├── dllmain.hpp ├── pch.cpp └── pch.hpp /Changelog.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | Changes in v1.0.2 4 | - Added a bool option called "UsingWindows" in the template "Configuration.cpp" file, when set to true it will include "Windows.h" along with removing windows macro functions from unreal ones. Note that this only makes changes in the final generated sdk. 5 | - Decided to replace the "ZeroMemory" macro with use memset instead, "ZeroMemory" calls this anyway. 6 | 7 | Changes in v1.0.1 8 | - Added an include for "Windows.h" in the generated "GameDefines.hpp" file, this is needed for the "ZeroMemory" maco. 9 | */ -------------------------------------------------------------------------------- /CodeRedGenerator.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.3.32929.385 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CodeRedGenerator", "CodeRedGenerator.vcxproj", "{A023646C-04F2-4DA2-8E90-7F7974D9B1F0}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | Release|x64 = Release|x64 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {A023646C-04F2-4DA2-8E90-7F7974D9B1F0}.Debug|x64.ActiveCfg = Debug|x64 17 | {A023646C-04F2-4DA2-8E90-7F7974D9B1F0}.Debug|x64.Build.0 = Debug|x64 18 | {A023646C-04F2-4DA2-8E90-7F7974D9B1F0}.Debug|x86.ActiveCfg = Debug|Win32 19 | {A023646C-04F2-4DA2-8E90-7F7974D9B1F0}.Debug|x86.Build.0 = Debug|Win32 20 | {A023646C-04F2-4DA2-8E90-7F7974D9B1F0}.Release|x64.ActiveCfg = Release|x64 21 | {A023646C-04F2-4DA2-8E90-7F7974D9B1F0}.Release|x64.Build.0 = Release|x64 22 | {A023646C-04F2-4DA2-8E90-7F7974D9B1F0}.Release|x86.ActiveCfg = Release|Win32 23 | {A023646C-04F2-4DA2-8E90-7F7974D9B1F0}.Release|x86.Build.0 = Release|Win32 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {9CCB137F-4105-4720-8D88-3D2E95DA465C} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /CodeRedGenerator.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 16.0 23 | Win32Proj 24 | {a023646c-04f2-4da2-8e90-7f7974d9b1f0} 25 | CodeRedGenerator 26 | 10.0 27 | 28 | 29 | 30 | Application 31 | true 32 | v143 33 | Unicode 34 | 35 | 36 | Application 37 | false 38 | v143 39 | true 40 | Unicode 41 | 42 | 43 | Application 44 | true 45 | v143 46 | Unicode 47 | 48 | 49 | DynamicLibrary 50 | false 51 | v143 52 | true 53 | Unicode 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | Level3 76 | true 77 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 78 | true 79 | 80 | 81 | Console 82 | true 83 | 84 | 85 | 86 | 87 | Level3 88 | true 89 | true 90 | true 91 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 92 | true 93 | 94 | 95 | Console 96 | true 97 | true 98 | true 99 | 100 | 101 | 102 | 103 | Level3 104 | true 105 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 106 | true 107 | 108 | 109 | Console 110 | true 111 | 112 | 113 | 114 | 115 | Level3 116 | true 117 | true 118 | true 119 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 120 | true 121 | stdcpp20 122 | 123 | 124 | Console 125 | true 126 | true 127 | true 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /CodeRedGenerator.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {648e9363-7c33-4996-9a3d-af04cd4ab306} 6 | 7 | 8 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 9 | cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx 10 | 11 | 12 | {7d231ced-cda7-4c6d-a2fb-53b16a91b865} 13 | 14 | 15 | {a20e86da-a02e-4059-b881-99b17e7ea477} 16 | 17 | 18 | 19 | 20 | Engine 21 | 22 | 23 | Engine\Template 24 | 25 | 26 | Engine\Template 27 | 28 | 29 | Engine\Template 30 | 31 | 32 | Source Files 33 | 34 | 35 | Source Files 36 | 37 | 38 | Source Files 39 | 40 | 41 | Source Files 42 | 43 | 44 | 45 | 46 | Engine 47 | 48 | 49 | Engine\Template 50 | 51 | 52 | Engine\Template 53 | 54 | 55 | Engine\Template 56 | 57 | 58 | Header Files 59 | 60 | 61 | Header Files 62 | 63 | 64 | Header Files 65 | 66 | 67 | Header Files 68 | 69 | 70 | Header Files 71 | 72 | 73 | -------------------------------------------------------------------------------- /CodeRedGenerator.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Engine/Engine.cpp: -------------------------------------------------------------------------------- 1 | #include "Engine.hpp" 2 | 3 | /* 4 | # ========================================================================================= # 5 | # Engine 6 | # ========================================================================================= # 7 | */ 8 | 9 | namespace Engine 10 | { 11 | std::string GeneratorName = "CodeRedGenerator"; 12 | std::string GeneratorVersion = "v1.0.2"; 13 | std::string GeneratorCredits = "TheFeckless, ItsBranK"; 14 | std::string GeneratorLinks = "www.github.com/CodeRedModding/CodeRed-Generator, www.twitter.com/ItsBranK"; 15 | } 16 | 17 | /* 18 | # ========================================================================================= # 19 | # 20 | # ========================================================================================= # 21 | */ -------------------------------------------------------------------------------- /Engine/Engine.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | // Here is where you include your custom engine files, only "GameDefines.hpp" and "PiecesOfCode.hpp" is needed. 4 | #include "RocketLeague/GameDefines.hpp" 5 | #include "RocketLeague/PiecesOfCode.hpp" 6 | 7 | /* 8 | # ========================================================================================= # 9 | # Engine 10 | # ========================================================================================= # 11 | */ 12 | 13 | // These are global variables for the generator, please do not change them! 14 | 15 | namespace Engine 16 | { 17 | extern std::string GeneratorName; 18 | extern std::string GeneratorVersion; 19 | extern std::string GeneratorCredits; 20 | extern std::string GeneratorLinks; 21 | } 22 | 23 | /* 24 | # ========================================================================================= # 25 | # 26 | # ========================================================================================= # 27 | */ -------------------------------------------------------------------------------- /Engine/RocketLeague/Configuration.cpp: -------------------------------------------------------------------------------- 1 | #include "Configuration.hpp" 2 | 3 | /* 4 | # ========================================================================================= # 5 | # Configuration 6 | # ========================================================================================= # 7 | */ 8 | 9 | namespace Configuration 10 | { 11 | const bool UsingWindows = true; // When set to true this will auto include "Windows.h" in your sdk, along with renaming some windows macro functions. 12 | const bool UsingConstants = false; // If you want to use class and function indexes instead of "FindClass/FindFunction". 13 | 14 | const bool UsingOffsets = true; // If you're using the offsets below or patterns to initialize globals. 15 | const bool UsingEventIndex = true; // If you want to use "ProcessEventIndex" change this to true, if not virutal voids will be generated from "ProcessEventPattern". 16 | 17 | const bool UsingEnumClasses = true; // If you want to use strongly typed enum classes over normal ones. 18 | const bool PrintFlagEnums = true; // If you want the EFunctionFlags, EPropertyFlags, and EObjectFlags enums so be included in the final sdk. 19 | const bool RemoveNativeIndex = true; // If you want to remove the "iNative" index on functions before calling process event. 20 | const bool RemoveNativeFlags = true; // If you want to remove the "FUNC_Native" flag on functions before calling process event. 21 | const std::string EnumClassType = "uint8_t"; // Underlying enum type if you set "UsingEnumClasses" to true. 22 | 23 | const int32_t CommentSpacer = 30; 24 | const int32_t ConstSpacer = 50; 25 | const int32_t EnumSpacer = 50; 26 | const int32_t StructSpacer = 50; 27 | const int32_t FunctionSpacer = 50; 28 | const int32_t ClassSpacer = 50; 29 | const int32_t GameAlignment = static_cast(EAlignment::NONE); // Used to calculate property sizes and missed offsets. 30 | const int32_t FinalAlignment = 0x1; // Forced alignment used in the final sdk, "UsingEnumClasses" is dependent on this value! 31 | 32 | const int32_t ProcessEventIndex = 67; // Position where the Process Event function is in "UObject"'s VfTable. 33 | const std::string ProcessEventString = ""; 34 | const uint8_t* ProcessEventPattern = (uint8_t*)""; 35 | const char* ProcessEventMask = (char*)""; 36 | 37 | const std::string GObjectsString = ""; 38 | const uint8_t* GObjectsPattern = (uint8_t*)""; 39 | const char* GObjectsMask = (char*)""; 40 | const uintptr_t GObjectsOffset = 0x246D738; 41 | 42 | const std::string GNamesString = ""; 43 | const uint8_t* GNamesPattern = (uint8_t*)""; 44 | const char* GNamesMask = (char*)""; 45 | const uintptr_t GNamesOffset = 0x246D6F0; 46 | 47 | const std::string GameName = "RocketLeague"; 48 | const std::string GameNameShort = "RLSDK"; 49 | const std::string GameVersion = "1.0.10897.0"; 50 | const std::filesystem::path Directory = "C:\\RLSDK\\"; 51 | } 52 | 53 | /* 54 | # ========================================================================================= # 55 | # 56 | # ========================================================================================= # 57 | */ -------------------------------------------------------------------------------- /Engine/RocketLeague/Configuration.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | /* 6 | # ========================================================================================= # 7 | # Configuration 8 | # ========================================================================================= # 9 | */ 10 | 11 | // Uncomment this if you want to disable file logging during generation! 12 | //#define NO_LOGGING 13 | 14 | // Uncomment this if your game uses wide characters (UTF16), the default is UTF8! 15 | #define UTF16 16 | 17 | enum class EAlignment : int32_t 18 | { 19 | NONE = 0x1, 20 | X32BIT = 0x4, 21 | X64BIT = 0x8 22 | }; 23 | 24 | // These are global variables below, make changes in the cpp file only! 25 | 26 | namespace Configuration 27 | { 28 | extern const bool UsingWindows; 29 | extern const bool UsingConstants; 30 | extern const bool UsingOffsets; 31 | extern const bool UsingEventIndex; 32 | extern const bool UsingEnumClasses; 33 | extern const bool PrintFlagEnums; 34 | extern const bool RemoveNativeIndex; 35 | extern const bool RemoveNativeFlags; 36 | extern const std::string EnumClassType; 37 | 38 | extern const int32_t CommentSpacer; 39 | extern const int32_t ConstSpacer; 40 | extern const int32_t EnumSpacer; 41 | extern const int32_t StructSpacer; 42 | extern const int32_t FunctionSpacer; 43 | extern const int32_t ClassSpacer; 44 | extern const int32_t GameAlignment; 45 | extern const int32_t FinalAlignment; 46 | 47 | extern const int32_t ProcessEventIndex; 48 | extern const std::string ProcessEventString; 49 | extern const uint8_t* ProcessEventPattern; 50 | extern const char* ProcessEventMask; 51 | 52 | extern const std::string GObjectsString; 53 | extern const uint8_t* GObjectsPattern; 54 | extern const char* GObjectsMask; 55 | extern const uintptr_t GObjectsOffset; 56 | 57 | extern const std::string GNamesString; 58 | extern const uint8_t* GNamesPattern; 59 | extern const char* GNamesMask; 60 | extern const uintptr_t GNamesOffset; 61 | 62 | extern const std::string GameName; 63 | extern const std::string GameNameShort; 64 | extern const std::string GameVersion; 65 | extern const std::filesystem::path Directory; 66 | } 67 | 68 | /* 69 | # ========================================================================================= # 70 | # 71 | # ========================================================================================= # 72 | */ -------------------------------------------------------------------------------- /Engine/RocketLeague/GameDefines.cpp: -------------------------------------------------------------------------------- 1 | #include "GameDefines.hpp" 2 | 3 | /* 4 | # ========================================================================================= # 5 | # Initialize Globals 6 | # ========================================================================================= # 7 | */ 8 | 9 | TArray* GObjects{}; 10 | TArray* GNames{}; 11 | 12 | /* 13 | # ========================================================================================= # 14 | # Class Functions 15 | # ========================================================================================= # 16 | */ 17 | 18 | TArray* UObject::GObjObjects() 19 | { 20 | TArray* recastedArray = reinterpret_cast*>(GObjects); 21 | return recastedArray; 22 | } 23 | 24 | std::string UObject::GetName() 25 | { 26 | return this->Name.ToString(); 27 | } 28 | 29 | std::string UObject::GetNameCPP() 30 | { 31 | std::string nameCPP; 32 | 33 | if (this->IsA()) 34 | { 35 | UClass* uClass = static_cast(this); 36 | 37 | while (uClass) 38 | { 39 | std::string className = uClass->GetName(); 40 | 41 | if (className == "Actor") 42 | { 43 | nameCPP += "A"; 44 | break; 45 | } 46 | else if (className == "Object") 47 | { 48 | nameCPP += "U"; 49 | break; 50 | } 51 | 52 | uClass = static_cast(uClass->SuperField); 53 | } 54 | } 55 | else 56 | { 57 | nameCPP += "F"; 58 | } 59 | 60 | nameCPP += this->GetName(); 61 | 62 | return nameCPP; 63 | } 64 | 65 | std::string UObject::GetFullName() 66 | { 67 | std::string fullName = this->GetName(); 68 | 69 | for (UObject* uOuter = this->Outer; uOuter; uOuter = uOuter->Outer) 70 | { 71 | fullName = (uOuter->GetName() + "." + fullName); 72 | } 73 | 74 | fullName = this->Class->GetName() + " " + fullName; 75 | 76 | return fullName; 77 | } 78 | 79 | std::string UObject::GetPackageName() 80 | { 81 | UObject* uPackageObj = this->GetPackageObj(); 82 | 83 | if (uPackageObj) 84 | { 85 | static std::string packageName = uPackageObj->GetName(); 86 | 87 | return packageName; 88 | } 89 | 90 | return "null"; 91 | } 92 | 93 | UObject* UObject::GetPackageObj() 94 | { 95 | UObject* uPackage = nullptr; 96 | 97 | for (UObject* uOuter = this->Outer; uOuter; uOuter = uOuter->Outer) 98 | { 99 | uPackage = uOuter; 100 | } 101 | 102 | return uPackage; 103 | } 104 | 105 | class UClass* UObject::FindClass(const std::string& classFullName) 106 | { 107 | static bool initialized = false; 108 | static std::map foundClasses{}; 109 | 110 | if (!initialized) 111 | { 112 | for (UObject* uObject : *UObject::GObjObjects()) 113 | { 114 | if (uObject) 115 | { 116 | std::string objectFullName = uObject->GetFullName(); 117 | 118 | if (objectFullName.find("Class") == 0) 119 | { 120 | foundClasses[objectFullName] = static_cast(uObject); 121 | } 122 | } 123 | } 124 | 125 | initialized = true; 126 | } 127 | 128 | if (foundClasses.find(classFullName) != foundClasses.end()) 129 | { 130 | return foundClasses[classFullName]; 131 | } 132 | 133 | return nullptr; 134 | } 135 | 136 | bool UObject::IsA(class UClass* uClass) 137 | { 138 | for (UClass* uSuperClass = this->Class; uSuperClass; uSuperClass = static_cast(uSuperClass->SuperField)) 139 | { 140 | if (uSuperClass == uClass) 141 | { 142 | return true; 143 | } 144 | } 145 | 146 | return false; 147 | } 148 | 149 | bool UObject::IsA(int32_t objInternalInteger) 150 | { 151 | UClass* uClass = UObject::GObjObjects()->at(objInternalInteger)->Class; 152 | 153 | if (uClass) 154 | { 155 | return this->IsA(uClass); 156 | } 157 | 158 | return false; 159 | } 160 | 161 | class UFunction* UFunction::FindFunction(const std::string& functionFullName) 162 | { 163 | static bool initialized = false; 164 | static std::map foundFunctions{}; 165 | 166 | if (!initialized) 167 | { 168 | for (UObject* uObject : *UObject::GObjObjects()) 169 | { 170 | if (uObject) 171 | { 172 | std::string objectFullName = uObject->GetFullName(); 173 | 174 | if (objectFullName.find("Function") == 0) 175 | { 176 | foundFunctions[objectFullName] = static_cast(uObject); 177 | } 178 | } 179 | } 180 | 181 | initialized = true; 182 | } 183 | 184 | if (foundFunctions.find(functionFullName) != foundFunctions.end()) 185 | { 186 | return foundFunctions[functionFullName]; 187 | } 188 | 189 | return nullptr; 190 | } 191 | 192 | /* 193 | # ========================================================================================= # 194 | # 195 | # ========================================================================================= # 196 | */ -------------------------------------------------------------------------------- /Engine/RocketLeague/PiecesOfCode.cpp: -------------------------------------------------------------------------------- 1 | #include "PiecesOfCode.hpp" 2 | 3 | /* 4 | # ========================================================================================= # 5 | # Pieces Of Code 6 | # ========================================================================================= # 7 | */ 8 | 9 | namespace PiecesOfCode 10 | { 11 | const std::string TArray_Iterator = 12 | "template\n" 13 | "class TIterator\n" 14 | "{\n" 15 | "public:\n" 16 | "\tusing ElementType = typename TArray::ElementType;\n" 17 | "\tusing ElementPointer = ElementType*;\n" 18 | "\tusing ElementReference = ElementType&;\n" 19 | "\tusing ElementConstReference = const ElementType&;\n" 20 | "\n" 21 | "private:\n" 22 | "\tElementPointer IteratorData;\n" 23 | "\n" 24 | "public:\n" 25 | "\tTIterator(ElementPointer inElementPointer) : IteratorData(inElementPointer) {}\n" 26 | "\n" 27 | "\t~TIterator() {}\n" 28 | "\n" 29 | "public:\n" 30 | "\tTIterator& operator++()\n" 31 | "\t{\n" 32 | "\t\tIteratorData++;\n" 33 | "\t\treturn *this;\n" 34 | "\t}\n" 35 | "\n" 36 | "\tTIterator operator++(int32_t)\n" 37 | "\t{\n" 38 | "\t\tTIterator iteratorCopy = *this;\n" 39 | "\t\t++(*this);\n" 40 | "\t\treturn iteratorCopy;\n" 41 | "\t}\n" 42 | "\n" 43 | "\tTIterator& operator--()\n" 44 | "\t{\n" 45 | "\t\tIteratorData--;\n" 46 | "\t\treturn *this;\n" 47 | "\t}\n" 48 | "\n" 49 | "\tTIterator operator--(int32_t)\n" 50 | "\t{\n" 51 | "\t\tTIterator iteratorCopy = *this;\n" 52 | "\t\t--(*this);\n" 53 | "\t\treturn iteratorCopy;\n" 54 | "\t}\n" 55 | "\n" 56 | "\tElementReference operator[](int32_t index)\n" 57 | "\t{\n" 58 | "\t\treturn *(IteratorData[index]);\n" 59 | "\t}\n" 60 | "\n" 61 | "\tElementPointer operator->()\n" 62 | "\t{\n" 63 | "\t\treturn IteratorData;\n" 64 | "\t}\n" 65 | "\n" 66 | "\tElementReference operator*()\n" 67 | "\t{\n" 68 | "\t\treturn *IteratorData;\n" 69 | "\t}\n" 70 | "\n" 71 | "public:\n" 72 | "\tbool operator==(const TIterator& other) const\n" 73 | "\t{\n" 74 | "\t\treturn (IteratorData == other.IteratorData);\n" 75 | "\t}\n" 76 | "\n" 77 | "\tbool operator!=(const TIterator& other) const\n" 78 | "\t{\n" 79 | "\t\treturn !(*this == other);\n" 80 | "\t}\n" 81 | "};\n"; 82 | 83 | const std::string TArray_Class = 84 | "template\n" 85 | "class TArray\n" 86 | "{\n" 87 | "public:\n" 88 | "\tusing ElementType = InElementType;\n" 89 | "\tusing ElementPointer = ElementType*;\n" 90 | "\tusing ElementReference = ElementType&;\n" 91 | "\tusing ElementConstPointer = const ElementType*;\n" 92 | "\tusing ElementConstReference = const ElementType&;\n" 93 | "\tusing Iterator = TIterator>;\n" 94 | "\n" 95 | "private:\n" 96 | "\tElementPointer ArrayData;\n" 97 | "\tint32_t ArrayCount;\n" 98 | "\tint32_t ArrayMax;\n" 99 | "\n" 100 | "public:\n" 101 | "\tTArray() : ArrayData(nullptr), ArrayCount(0), ArrayMax(0)\n" 102 | "\t{\n" 103 | "\t\t//ReAllocate(sizeof(ElementType));\n" 104 | "\t}\n" 105 | "\n" 106 | "\t~TArray()\n" 107 | "\t{\n" 108 | "\t\t//clear();\n" 109 | "\t\t//::operator delete(ArrayData, ArrayMax * sizeof(ElementType));\n" 110 | "\t}\n" 111 | "\n" 112 | "public:\n" 113 | "\tElementConstReference operator[](int32_t index) const\n" 114 | "\t{\n" 115 | "\t\treturn ArrayData[index];\n" 116 | "\t}\n" 117 | "\n" 118 | "\tElementReference operator[](int32_t index)\n" 119 | "\t{\n" 120 | "\t\treturn ArrayData[index];\n" 121 | "\t}\n" 122 | "\n" 123 | "\tElementConstReference at(int32_t index) const\n" 124 | "\t{\n" 125 | "\t\treturn ArrayData[index];\n" 126 | "\t}\n" 127 | "\n" 128 | "\tElementReference at(int32_t index)\n" 129 | "\t{\n" 130 | "\t\treturn ArrayData[index];\n" 131 | "\t}\n" 132 | "\n" 133 | "\tElementConstPointer data() const\n" 134 | "\t{\n" 135 | "\t\treturn ArrayData;\n" 136 | "\t}\n" 137 | "\n" 138 | "\tvoid push_back(ElementConstReference newElement)\n" 139 | "\t{\n" 140 | "\t\tif (ArrayCount >= ArrayMax)\n" 141 | "\t\t{\n" 142 | "\t\t\tReAllocate(sizeof(ElementType) * (ArrayCount + 1));\n" 143 | "\t\t}\n" 144 | "\n" 145 | "\t\tnew(&ArrayData[ArrayCount]) ElementType(newElement);\n" 146 | "\t\tArrayCount++;\n" 147 | "\t}\n" 148 | "\n" 149 | "\tvoid push_back(ElementReference& newElement)\n" 150 | "\t{\n" 151 | "\t\tif (ArrayCount >= ArrayMax)\n" 152 | "\t\t{\n" 153 | "\t\t\tReAllocate(sizeof(ElementType) * (ArrayCount + 1));\n" 154 | "\t\t}\n" 155 | "\n" 156 | "\t\tnew(&ArrayData[ArrayCount]) ElementType(newElement);\n" 157 | "\t\tArrayCount++;\n" 158 | "\t}\n" 159 | "\n" 160 | "\tvoid pop_back()\n" 161 | "\t{\n" 162 | "\t\tif (ArrayCount > 0)\n" 163 | "\t\t{\n" 164 | "\t\t\tArrayCount--;\n" 165 | "\t\t\tArrayData[ArrayCount].~ElementType();\n" 166 | "\t\t}\n" 167 | "\t}\n" 168 | "\n" 169 | "\tvoid clear()\n" 170 | "\t{\n" 171 | "\t\tfor (int32_t i = 0; i < ArrayCount; i++)\n" 172 | "\t\t{\n" 173 | "\t\t\tArrayData[i].~ElementType();\n" 174 | "\t\t}\n" 175 | "\n" 176 | "\t\tArrayCount = 0;\n" 177 | "\t}\n" 178 | "\n" 179 | "\tint32_t size() const\n" 180 | "\t{\n" 181 | "\t\treturn ArrayCount;\n" 182 | "\t}\n" 183 | "\n" 184 | "\tint32_t capacity() const\n" 185 | "\t{\n" 186 | "\t\treturn ArrayMax;\n" 187 | "\t}\n" 188 | "\n" 189 | "\tbool empty() const\n" 190 | "\t{\n" 191 | "\t\tif (ArrayData)\n" 192 | "\t\t{\n" 193 | "\t\t\treturn (size() == 0);\n" 194 | "\t\t}\n" 195 | "\n" 196 | "\t\treturn true;\n" 197 | "\t}\n" 198 | "\n" 199 | "\tIterator begin()\n" 200 | "\t{\n" 201 | "\t\treturn Iterator(ArrayData);\n" 202 | "\t}\n" 203 | "\n" 204 | "\tIterator end()\n" 205 | "\t{\n" 206 | "\t\treturn Iterator(ArrayData + ArrayCount);\n" 207 | "\t}\n" 208 | "\n" 209 | "private:\n" 210 | "\tvoid ReAllocate(int32_t newArrayMax)\n" 211 | "\t{\n" 212 | "\t\tElementPointer newArrayData = (ElementPointer)::operator new(newArrayMax * sizeof(ElementType));\n" 213 | "\t\tint32_t newNum = ArrayCount;\n" 214 | "\n" 215 | "\t\tif (newArrayMax < newNum)\n" 216 | "\t\t{\n" 217 | "\t\t\tnewNum = newArrayMax;\n" 218 | "\t\t}\n" 219 | "\n" 220 | "\t\tfor (int32_t i = 0; i < newNum; i++)\n" 221 | "\t\t{\n" 222 | "\t\t\tnew(newArrayData + i) ElementType(std::move(ArrayData[i]));\n" 223 | "\t\t}\n" 224 | "\n" 225 | "\t\tfor (int32_t i = 0; i < ArrayCount; i++)\n" 226 | "\t\t{\n" 227 | "\t\t\tArrayData[i].~ElementType();\n" 228 | "\t\t}\n" 229 | "\n" 230 | "\t\t::operator delete(ArrayData, ArrayMax * sizeof(ElementType));\n" 231 | "\t\tArrayData = newArrayData;\n" 232 | "\t\tArrayMax = newArrayMax;\n" 233 | "\t}\n" 234 | "};\n"; 235 | 236 | const std::string TMap_Class = 237 | "template\n" 238 | "class TMap\n" 239 | "{\n" 240 | "private:\n" 241 | "\tstruct TPair\n" 242 | "\t{\n" 243 | "\t\tTKey Key;\n" 244 | "\t\tTValue Value;\n" 245 | "\t};\n" 246 | "\n" 247 | "public:\n" 248 | "\tusing ElementType = TPair;\n" 249 | "\tusing ElementPointer = ElementType*;\n" 250 | "\tusing ElementReference = ElementType&;\n" 251 | "\tusing ElementConstReference = const ElementType&;\n" 252 | "\tusing Iterator = TIterator>;\n" 253 | "\n" 254 | "public:\n" 255 | "\tTArray Elements;\t\t\t\t\t\t\t\t\t// 0x0000 (0x0010)\n" 256 | "\tuintptr_t IndirectData;\t\t\t\t\t\t\t\t\t\t\t// 0x0010 (0x0008)\n" 257 | "\tint32_t InlineData[0x4];\t\t\t\t\t\t\t\t\t\t// 0x0018 (0x0010)\n" 258 | "\tint32_t NumBits;\t\t\t\t\t\t\t\t\t\t\t\t// 0x0028 (0x0004)\n" 259 | "\tint32_t MaxBits;\t\t\t\t\t\t\t\t\t\t\t\t// 0x002C (0x0004)\n" 260 | "\tint32_t FirstFreeIndex;\t\t\t\t\t\t\t\t\t\t\t// 0x0030 (0x0004)\n" 261 | "\tint32_t NumFreeIndices;\t\t\t\t\t\t\t\t\t\t\t// 0x0034 (0x0004)\n" 262 | "\tint64_t InlineHash;\t\t\t\t\t\t\t\t\t\t\t\t// 0x0038 (0x0008)\n" 263 | "\tint32_t* Hash;\t\t\t\t\t\t\t\t\t\t\t\t\t// 0x0040 (0x0008)\n" 264 | "\tint32_t HashCount;\t\t\t\t\t\t\t\t\t\t\t\t// 0x0048 (0x0004)\n" 265 | "\n" 266 | "public:\n" 267 | "\tTMap() :\n" 268 | "\t\tIndirectData(NULL),\n" 269 | "\t\tNumBits(0),\n" 270 | "\t\tMaxBits(0),\n" 271 | "\t\tFirstFreeIndex(0),\n" 272 | "\t\tNumFreeIndices(0),\n" 273 | "\t\tInlineHash(0),\n" 274 | "\t\tHash(nullptr),\n" 275 | "\t\tHashCount(0)\n" 276 | "\t{\n" 277 | "\n" 278 | "\t}\n" 279 | "\n" 280 | "\tTMap(struct FMap_Mirror& other) :\n" 281 | "\t\tIndirectData(NULL),\n" 282 | "\t\tNumBits(0),\n" 283 | "\t\tMaxBits(0),\n" 284 | "\t\tFirstFreeIndex(0),\n" 285 | "\t\tNumFreeIndices(0),\n" 286 | "\t\tInlineHash(0),\n" 287 | "\t\tHash(nullptr),\n" 288 | "\t\tHashCount(0)\n" 289 | "\t{\n" 290 | "\t\tassign(other);\n" 291 | "\t}\n" 292 | "\n" 293 | "\tTMap(const TMap& other) :\n" 294 | "\t\tIndirectData(NULL),\n" 295 | "\t\tNumBits(0),\n" 296 | "\t\tMaxBits(0),\n" 297 | "\t\tFirstFreeIndex(0),\n" 298 | "\t\tNumFreeIndices(0),\n" 299 | "\t\tInlineHash(0),\n" 300 | "\t\tHash(nullptr),\n" 301 | "\t\tHashCount(0)\n" 302 | "\t{\n" 303 | "\t\tassign(other);\n" 304 | "\t}\n" 305 | "\n" 306 | "\t~TMap() {}\n" 307 | "\n" 308 | "public:\n" 309 | "\tTMap& assign(struct FMap_Mirror& other)\n" 310 | "\t{\n" 311 | "\t\t*this = *reinterpret_cast*>(&other);\n" 312 | "\t\treturn *this;\n" 313 | "\t}\n" 314 | "\n" 315 | "\tTMap& assign(const TMap& other)\n" 316 | "\t{\n" 317 | "\t\tElements = other.Elements;\n" 318 | "\t\tIndirectData = other.IndirectData;\n" 319 | "\t\tInlineData[0] = other.InlineData[0];\n" 320 | "\t\tInlineData[1] = other.InlineData[1];\n" 321 | "\t\tInlineData[2] = other.InlineData[2];\n" 322 | "\t\tInlineData[3] = other.InlineData[3];\n" 323 | "\t\tNumBits = other.NumBits;\n" 324 | "\t\tMaxBits = other.MaxBits;\n" 325 | "\t\tFirstFreeIndex = other.FirstFreeIndex;\n" 326 | "\t\tNumFreeIndices = other.NumFreeIndices;\n" 327 | "\t\tInlineHash = other.InlineHash;\n" 328 | "\t\tHash = other.Hash;\n" 329 | "\t\tHashCount = other.HashCount;\n" 330 | "\t\treturn *this;\n" 331 | "\t}\n" 332 | "\n" 333 | "\tTValue& at(const TKey& key)\n" 334 | "\t{\n" 335 | "\t\tfor (TPair& pair : Elements)\n" 336 | "\t\t{\n" 337 | "\t\t\tif (pair.Key == key)\n" 338 | "\t\t\t{\n" 339 | "\t\t\t\treturn pair.Value;\n" 340 | "\t\t\t}\n" 341 | "\t\t}\n" 342 | "\t}\n" 343 | "\n" 344 | "\tconst TValue& at(const TKey& key) const\n" 345 | "\t{\n" 346 | "\t\tfor (const TPair& pair : Elements)\n" 347 | "\t\t{\n" 348 | "\t\t\tif (pair.Key == key)\n" 349 | "\t\t\t{\n" 350 | "\t\t\t\treturn pair.Value;\n" 351 | "\t\t\t}\n" 352 | "\t\t}\n" 353 | "\t}\n" 354 | "\n" 355 | "\tTPair& at_index(int32_t index)\n" 356 | "\t{\n" 357 | "\t\treturn Elements[index];\n" 358 | "\t}\n" 359 | "\n" 360 | "\tconst TPair& at_index(int32_t index) const\n" 361 | "\t{\n" 362 | "\t\treturn Elements[index];\n" 363 | "\t}\n" 364 | "\n" 365 | "\tint32_t size() const\n" 366 | "\t{\n" 367 | "\t\treturn Elements.size();\n" 368 | "\t}\n" 369 | "\n" 370 | "\tint32_t capacity() const\n" 371 | "\t{\n" 372 | "\t\treturn Elements.capacity();\n" 373 | "\t}\n" 374 | "\n" 375 | "\tbool empty() const\n" 376 | "\t{\n" 377 | "\t\treturn Elements.empty();\n" 378 | "\t}\n" 379 | "\n" 380 | "\tIterator begin()\n" 381 | "\t{\n" 382 | "\t\treturn Elements.begin();\n" 383 | "\t}\n" 384 | "\n" 385 | "\tIterator end()\n" 386 | "\t{\n" 387 | "\t\treturn Elements.end();\n" 388 | "\t}\n" 389 | "\n" 390 | "public:\n" 391 | "\tTValue& operator[](const TKey& key)\n" 392 | "\t{\n" 393 | "\t\treturn at(key);\n" 394 | "\t}\n" 395 | "\n" 396 | "\tconst TValue& operator[](const TKey& key) const\n" 397 | "\t{\n" 398 | "\t\treturn at(key);\n" 399 | "\t}\n" 400 | "\n" 401 | "\tTMap& operator=(const struct FMap_Mirror& other)\n" 402 | "\t{\n" 403 | "\t\treturn assign(other);\n" 404 | "\t}\n" 405 | "\n" 406 | "\tTMap& operator=(const TMap& other)\n" 407 | "\t{\n" 408 | "\t\treturn assign(other);\n" 409 | "\t}\n" 410 | "};\n"; 411 | 412 | const std::string FNameEntry_Struct = 413 | "struct FNameEntry\n" 414 | "{\n" 415 | "public:"; 416 | 417 | const std::string FNameEntry_Struct_UTF16 = 418 | "\npublic:\n" 419 | "\tFNameEntry() : Flags(0), Index(-1) {}\n" 420 | "\t~FNameEntry() {}\n" 421 | "\n" 422 | "public:\n" 423 | "\tuint64_t GetFlags() const\n" 424 | "\t{\n" 425 | "\t\treturn Flags;\n" 426 | "\t}\n" 427 | "\n" 428 | "\tint32_t GetIndex() const\n" 429 | "\t{\n" 430 | "\t\treturn Index;\n" 431 | "\t}\n" 432 | "\n" 433 | "\tconst wchar_t* GetWideName() const\n" 434 | "\t{\n" 435 | "\t\treturn Name;\n" 436 | "\t}\n" 437 | "\n" 438 | "\tstd::wstring ToWideString() const\n" 439 | "\t{\n" 440 | "\t\tconst wchar_t* wideName = GetWideName();\n" 441 | "\n" 442 | "\t\tif (wideName)\n" 443 | "\t\t{\n" 444 | "\t\t\treturn std::wstring(wideName);\n" 445 | "\t\t}\n" 446 | "\n" 447 | "\t\treturn L\"\";\n" 448 | "\t}\n" 449 | "\n" 450 | "\tstd::string ToString() const\n" 451 | "\t{\n" 452 | "\t\tstd::wstring wstr = ToWideString();\n" 453 | "\t\treturn std::string(wstr.begin(), wstr.end());\n" 454 | "\t}\n" 455 | "};\n"; 456 | 457 | const std::string FNameEntry_Struct_UTF8 = 458 | "\npublic:\n" 459 | "\tFNameEntry() : Flags(0), Index(-1) {}\n" 460 | "\t~FNameEntry() {}\n" 461 | "\n" 462 | "public:\n" 463 | "\tuint64_t GetFlags() const\n" 464 | "\t{\n" 465 | "\t\treturn Flags;\n" 466 | "\t}\n" 467 | "\n" 468 | "\tint32_t GetIndex() const\n" 469 | "\t{\n" 470 | "\t\treturn Index;\n" 471 | "\t}\n" 472 | "\n" 473 | "\tconst char* GetAnsiName() const\n" 474 | "\t{\n" 475 | "\t\treturn Name;\n" 476 | "\t}\n" 477 | "\n" 478 | "\tstd::string ToString() const\n" 479 | "\t{\n" 480 | "\t\treturn std::string(Name);\n" 481 | "\t}\n" 482 | "};\n"; 483 | 484 | const std::string FName_Struct_UTF16 = 485 | "struct FName\n" 486 | "{\n" 487 | "public:\n" 488 | "\tusing ElementType = const wchar_t;\n" 489 | "\tusing ElementPointer = ElementType*;\n" 490 | "\n" 491 | "private:\n" 492 | "\tint32_t\t\t\tFNameEntryId;\t\t\t\t\t\t\t\t\t// 0x0000 (0x04)\n" 493 | "\tint32_t\t\t\tInstanceNumber;\t\t\t\t\t\t\t\t\t// 0x0004 (0x04)\n" 494 | "\n" 495 | "public:\n" 496 | "\tFName() : FNameEntryId(-1), InstanceNumber(0) {}\n" 497 | "\n" 498 | "\tFName(int32_t id) : FNameEntryId(id), InstanceNumber(0) {}\n" 499 | "\n" 500 | "\tFName(const ElementPointer nameToFind) : FNameEntryId(-1), InstanceNumber(0)\n" 501 | "\t{\n" 502 | "\t\tstatic std::vector foundNames{};\n" 503 | "\n" 504 | "\t\tfor (int32_t entryId : foundNames)\n" 505 | "\t\t{\n" 506 | "\t\t\tif (Names()->at(entryId))\n" 507 | "\t\t\t{\n" 508 | "\t\t\t\tif (!wcscmp(Names()->at(entryId)->Name, nameToFind))\n" 509 | "\t\t\t\t{\n" 510 | "\t\t\t\t\tFNameEntryId = entryId;\n" 511 | "\t\t\t\t\treturn;\n" 512 | "\t\t\t\t}\n" 513 | "\t\t\t}\n" 514 | "\t\t}\n" 515 | "\n" 516 | "\t\tfor (int32_t i = 0; i < Names()->size(); i++)\n" 517 | "\t\t{\n" 518 | "\t\t\tif (Names()->at(i))\n" 519 | "\t\t\t{\n" 520 | "\t\t\t\tif (!wcscmp(Names()->at(i)->Name, nameToFind))\n" 521 | "\t\t\t\t{\n" 522 | "\t\t\t\t\tfoundNames.push_back(i);\n" 523 | "\t\t\t\t\tFNameEntryId = i;\n" 524 | "\t\t\t\t\treturn;\n" 525 | "\t\t\t\t}\n" 526 | "\t\t\t}\n" 527 | "\t\t}\n" 528 | "\t}\n" 529 | "\n" 530 | "\tFName(const FName& name) : FNameEntryId(name.FNameEntryId), InstanceNumber(name.InstanceNumber) {}\n" 531 | "\n" 532 | "\t~FName() {}\n" 533 | "\n" 534 | "public:\n" 535 | "\tstatic TArray* Names()\n" 536 | "\t{\n" 537 | "\t\tTArray* recastedArray = reinterpret_cast*>(GNames);\n" 538 | "\t\treturn recastedArray;\n" 539 | "\t}\n" 540 | "\n" 541 | "\tint32_t GetDisplayIndex() const\n" 542 | "\t{\n" 543 | "\t\treturn FNameEntryId;\n" 544 | "\t}\n" 545 | "\n" 546 | "\tconst FNameEntry GetDisplayNameEntry() const\n" 547 | "\t{\n" 548 | "\t\tif (IsValid())\n" 549 | "\t\t{\n" 550 | "\t\t\treturn *Names()->at(FNameEntryId);\n" 551 | "\t\t}\n" 552 | "\n" 553 | "\t\treturn FNameEntry();\n" 554 | "\t}\n" 555 | "\n" 556 | "\tFNameEntry* GetEntry()\n" 557 | "\t{\n" 558 | "\t\tif (IsValid())\n" 559 | "\t\t{\n" 560 | "\t\t\treturn Names()->at(FNameEntryId);\n" 561 | "\t\t}\n" 562 | "\n" 563 | "\t\treturn nullptr;\n" 564 | "\t}\n" 565 | "\n" 566 | "\tint32_t GetInstance() const\n" 567 | "\t{\n" 568 | "\t\treturn InstanceNumber;\n" 569 | "\t}\n" 570 | "\n" 571 | "\tvoid SetInstance(int32_t newNumber)\n" 572 | "\t{\n" 573 | "\t\tInstanceNumber = newNumber;\n" 574 | "\t}\n" 575 | "\n" 576 | "\tstd::string ToString() const\n" 577 | "\t{\n" 578 | "\t\tif (IsValid())\n" 579 | "\t\t{\n" 580 | "\t\t\treturn GetDisplayNameEntry().ToString();\n" 581 | "\t\t}\n" 582 | "\n" 583 | "\t\treturn \"UnknownName\";\n" 584 | "\t}\n" 585 | "\n" 586 | "\tbool IsValid() const\n" 587 | "\t{\n" 588 | "\t\tif ((FNameEntryId < 0 || FNameEntryId > Names()->size()))\n" 589 | "\t\t{\n" 590 | "\t\t\treturn false;\n" 591 | "\t\t}\n" 592 | "\n" 593 | "\t\treturn true;\n" 594 | "\t}\n" 595 | "\n" 596 | "public:\n" 597 | "\tFName& operator=(const FName& other)\n" 598 | "\t{\n" 599 | "\t\tFNameEntryId = other.FNameEntryId;\n" 600 | "\t\tInstanceNumber = other.InstanceNumber;\n" 601 | "\t\treturn *this;\n" 602 | "\t}\n" 603 | "\n" 604 | "\tbool operator==(const FName& other) const\n" 605 | "\t{\n" 606 | "\t\treturn (FNameEntryId == other.FNameEntryId);\n" 607 | "\t}\n" 608 | "\n" 609 | "\tbool operator!=(const FName& other) const\n" 610 | "\t{\n" 611 | "\t\treturn (FNameEntryId != other.FNameEntryId);\n" 612 | "\t}\n" 613 | "};\n"; 614 | 615 | const std::string FName_Struct_UTF8 = 616 | "struct FName\n" 617 | "{\n" 618 | "public:\n" 619 | "\tusing ElementType = const char;\n" 620 | "\tusing ElementPointer = ElementType*;\n" 621 | "\n" 622 | "private:\n" 623 | "\tint32_t\t\t\tFNameEntryId;\t\t\t\t\t\t\t\t\t// 0x0000 (0x04)\n" 624 | "\tint32_t\t\t\tInstanceNumber;\t\t\t\t\t\t\t\t\t// 0x0004 (0x04)\n" 625 | "\n" 626 | "public:\n" 627 | "\tFName() : FNameEntryId(-1), InstanceNumber(0) {}\n" 628 | "\n" 629 | "\tFName(int32_t id) : FNameEntryId(id), InstanceNumber(0) {}\n" 630 | "\n" 631 | "\tFName(ElementPointer nameToFind) : FNameEntryId(-1), InstanceNumber(0)\n" 632 | "\t{\n" 633 | "\t\tstatic std::vector nameCache{};\n" 634 | "\n" 635 | "\t\tfor (int32_t entryId : nameCache)\n" 636 | "\t\t{\n" 637 | "\t\t\tif (Names()->at(entryId))\n" 638 | "\t\t\t{\n" 639 | "\t\t\t\tif (!strcmp(Names()->at(entryId)->Name, nameToFind))\n" 640 | "\t\t\t\t{\n" 641 | "\t\t\t\t\tFNameEntryId = entryId;\n" 642 | "\t\t\t\t\treturn;\n" 643 | "\t\t\t\t}\n" 644 | "\t\t\t}\n" 645 | "\t\t}\n" 646 | "\n" 647 | "\t\tfor (int32_t i = 0; i < Names()->size(); i++)\n" 648 | "\t\t{\n" 649 | "\t\t\tif (Names()->at(i))\n" 650 | "\t\t\t{\n" 651 | "\t\t\t\tif (!strcmp(Names()->at(i)->Name, nameToFind))\n" 652 | "\t\t\t\t{\n" 653 | "\t\t\t\t\tnameCache.push_back(i);\n" 654 | "\t\t\t\t\tFNameEntryId = i;\n" 655 | "\t\t\t\t}\n" 656 | "\t\t\t}\n" 657 | "\t\t}\n" 658 | "\t}\n" 659 | "\n" 660 | "\tFName(const FName& name) : FNameEntryId(name.FNameEntryId), InstanceNumber(name.InstanceNumber) {}\n" 661 | "\n" 662 | "\t~FName() {}\n" 663 | "\n" 664 | "public:\n" 665 | "\tstatic TArray* Names()\n" 666 | "\t{\n" 667 | "\t\tTArray* recastedArray = reinterpret_cast*>(GNames);\n" 668 | "\t\treturn recastedArray;\n" 669 | "\t}\n" 670 | "\n" 671 | "\tint32_t GetDisplayIndex() const\n" 672 | "\t{\n" 673 | "\t\treturn FNameEntryId;\n" 674 | "\t}\n" 675 | "\n" 676 | "\tconst FNameEntry GetDisplayNameEntry() const\n" 677 | "\t{\n" 678 | "\t\tif (IsValid())\n" 679 | "\t\t{\n" 680 | "\t\t\treturn *Names()->at(FNameEntryId);\n" 681 | "\t\t}\n" 682 | "\n" 683 | "\t\treturn FNameEntry();\n" 684 | "\t}\n" 685 | "\n" 686 | "\tFNameEntry* GetEntry()\n" 687 | "\t{\n" 688 | "\t\tif (IsValid())\n" 689 | "\t\t{\n" 690 | "\t\t\treturn Names()->at(FNameEntryId);\n" 691 | "\t\t}\n" 692 | "\n" 693 | "\t\treturn nullptr;\n" 694 | "\t}\n" 695 | "\n" 696 | "\tint32_t GetInstance() const\n" 697 | "\t{\n" 698 | "\t\treturn InstanceNumber;\n" 699 | "\t}\n" 700 | "\n" 701 | "\tvoid SetInstance(int32_t newNumber)\n" 702 | "\t{\n" 703 | "\t\tInstanceNumber = newNumber;\n" 704 | "\t}\n" 705 | "\n" 706 | "\tstd::string ToString() const\n" 707 | "\t{\n" 708 | "\t\tif (IsValid())\n" 709 | "\t\t{\n" 710 | "\t\t\treturn GetDisplayNameEntry().ToString();\n" 711 | "\t\t}\n" 712 | "\n" 713 | "\t\treturn \"UnknownName\";\n" 714 | "\t}\n" 715 | "\n" 716 | "\tbool IsValid() const\n" 717 | "\t{\n" 718 | "\t\tif ((FNameEntryId < 0 || FNameEntryId > Names()->size()))\n" 719 | "\t\t{\n" 720 | "\t\t\treturn false;\n" 721 | "\t\t}\n" 722 | "\n" 723 | "\t\treturn true;\n" 724 | "\t}\n" 725 | "\n" 726 | "public:\n" 727 | "\tFName& operator=(const FName& other)\n" 728 | "\t{\n" 729 | "\t\tFNameEntryId = other.FNameEntryId;\n" 730 | "\t\tInstanceNumber = other.InstanceNumber;\n" 731 | "\t\treturn *this;\n" 732 | "\t}\n" 733 | "\n" 734 | "\tbool operator==(const FName& other) const\n" 735 | "\t{\n" 736 | "\t\treturn (FNameEntryId == other.FNameEntryId);\n" 737 | "\t}\n" 738 | "\n" 739 | "\tbool operator!=(const FName& other) const\n" 740 | "\t{\n" 741 | "\t\treturn (FNameEntryId != other.FNameEntryId);\n" 742 | "\t}\n" 743 | "};\n"; 744 | 745 | const std::string FString_Class_UTF16 = 746 | "class FString\n" 747 | "{\n" 748 | "public:\n" 749 | "\tusing ElementType = const wchar_t;\n" 750 | "\tusing ElementPointer = ElementType*;\n" 751 | "\n" 752 | "private:\n" 753 | "\tElementPointer\tArrayData;\t\t\t\t\t\t\t\t\t\t// 0x0000 (0x08)\n" 754 | "\tint32_t\t\t\tArrayCount;\t\t\t\t\t\t\t\t\t\t// 0x0008 (0x04)\n" 755 | "\tint32_t\t\t\tArrayMax;\t\t\t\t\t\t\t\t\t\t// 0x000C (0x04)\n" 756 | "\n" 757 | "public:\n" 758 | "\tFString() : ArrayData(nullptr), ArrayCount(0), ArrayMax(0) {}\n" 759 | "\n" 760 | "\tFString(ElementPointer other) : ArrayData(nullptr), ArrayCount(0), ArrayMax(0) { assign(other); }\n" 761 | "\n" 762 | "\t~FString() {}\n" 763 | "\n" 764 | "public:\n" 765 | "\tFString& assign(ElementPointer other)\n" 766 | "\t{\n" 767 | "\t\tArrayCount = (other ? (wcslen(other) + 1) : 0);\n" 768 | "\t\tArrayMax = ArrayCount;\n" 769 | "\t\tArrayData = (ArrayCount > 0 ? other : nullptr);\n" 770 | "\t\treturn *this;\n" 771 | "\t}\n" 772 | "\n" 773 | "\tstd::wstring ToWideString() const\n" 774 | "\t{\n" 775 | "\t\tif (!empty())\n" 776 | "\t\t{\n" 777 | "\t\t\treturn std::wstring(c_str());\n" 778 | "\t\t}\n" 779 | "\n" 780 | "\t\treturn L\"\";\n" 781 | "\t}\n" 782 | "\n" 783 | "\tstd::string ToString() const\n" 784 | "\t{\n" 785 | "\t\tif (!empty())\n" 786 | "\t\t{\n" 787 | "\t\t\tstd::wstring wstr = ToWideString();\n" 788 | "\t\t\treturn std::string(wstr.begin(), wstr.end());\n" 789 | "\t\t}\n" 790 | "\n" 791 | "\t\treturn \"\";\n" 792 | "\t}\n" 793 | "\n" 794 | "\tElementPointer c_str() const\n" 795 | "\t{\n" 796 | "\t\treturn ArrayData;\n" 797 | "\t}\n" 798 | "\n" 799 | "\tbool empty() const\n" 800 | "\t{\n" 801 | "\t\tif (ArrayData)\n" 802 | "\t\t{\n" 803 | "\t\t\treturn (ArrayCount == 0);\n" 804 | "\t\t}\n" 805 | "\n" 806 | "\t\treturn true;\n" 807 | "\t}\n" 808 | "\n" 809 | "\tint32_t length() const\n" 810 | "\t{\n" 811 | "\t\treturn ArrayCount;\n" 812 | "\t}\n" 813 | "\n" 814 | "\tint32_t size() const\n" 815 | "\t{\n" 816 | "\t\treturn ArrayMax;\n" 817 | "\t}\n" 818 | "\n" 819 | "public:\n" 820 | "\tFString& operator=(ElementPointer other)\n" 821 | "\t{\n" 822 | "\t\treturn assign(other);\n" 823 | "\t}\n" 824 | "\n" 825 | "\tFString& operator=(const FString& other)\n" 826 | "\t{\n" 827 | "\t\treturn assign(other.c_str());\n" 828 | "\t}\n" 829 | "\n" 830 | "\tbool operator==(const FString& other)\n" 831 | "\t{\n" 832 | "\t\treturn (!wcscmp(ArrayData, other.ArrayData));\n" 833 | "\t}\n" 834 | "\n" 835 | "\tbool operator!=(const FString& other)\n" 836 | "\t{\n" 837 | "\t\treturn (wcscmp(ArrayData, other.ArrayData));\n" 838 | "\t}\n" 839 | "};\n"; 840 | 841 | const std::string FString_Class_UTF8 = 842 | "class FString\n" 843 | "{\n" 844 | "public:\n" 845 | "\tusing ElementType = const char;\n" 846 | "\tusing ElementPointer = ElementType*;\n" 847 | "\n" 848 | "private:\n" 849 | "\tElementPointer\tArrayData;\t\t\t\t\t\t\t\t\t\t// 0x0000 (0x08)\n" 850 | "\tint32_t\t\t\tArrayCount;\t\t\t\t\t\t\t\t\t\t// 0x0008 (0x04)\n" 851 | "\tint32_t\t\t\tArrayMax;\t\t\t\t\t\t\t\t\t\t// 0x000C (0x04)\n" 852 | "\n" 853 | "public:\n" 854 | "\tFString() : ArrayData(nullptr), ArrayCount(0), ArrayMax(0) {}\n" 855 | "\n" 856 | "\tFString(ElementPointer other) : ArrayData(nullptr), ArrayCount(0), ArrayMax(0) { assign(other); }\n" 857 | "\n" 858 | "\t~FString() {}\n" 859 | "\n" 860 | "public:\n" 861 | "\tFString& assign(ElementPointer other)\n" 862 | "\t{\n" 863 | "\t\tArrayCount = (other ? (strlen(other) + 1) : 0);\n" 864 | "\t\tArrayMax = ArrayCount;\n" 865 | "\t\tArrayData = (ArrayCount > 0 ? other : nullptr);\n" 866 | "\t\treturn *this;\n" 867 | "\t}\n" 868 | "\n" 869 | "\tstd::string ToString() const\n" 870 | "\t{\n" 871 | "\t\tif (!empty())\n" 872 | "\t\t{\n" 873 | "\t\t\treturn std::string(c_str());\n" 874 | "\t\t}\n" 875 | "\n" 876 | "\t\treturn \"\";\n" 877 | "\t}\n" 878 | "\n" 879 | "\tElementPointer c_str() const\n" 880 | "\t{\n" 881 | "\t\treturn ArrayData;\n" 882 | "\t}\n" 883 | "\n" 884 | "\tbool empty() const\n" 885 | "\t{\n" 886 | "\t\tif (ArrayData)\n" 887 | "\t\t{\n" 888 | "\t\t\treturn (ArrayCount == 0);\n" 889 | "\t\t}\n" 890 | "\n" 891 | "\t\treturn true;\n" 892 | "\t}\n" 893 | "\n" 894 | "\tint32_t length() const\n" 895 | "\t{\n" 896 | "\t\treturn ArrayCount;\n" 897 | "\t}\n" 898 | "\n" 899 | "\tint32_t size() const\n" 900 | "\t{\n" 901 | "\t\treturn ArrayMax;\n" 902 | "\t}\n" 903 | "\n" 904 | "public:\n" 905 | "\tFString& operator=(ElementPointer other)\n" 906 | "\t{\n" 907 | "\t\treturn assign(other);\n" 908 | "\t}\n" 909 | "\n" 910 | "\tFString& operator=(const FString& other)\n" 911 | "\t{\n" 912 | "\t\treturn assign(other.c_str());\n" 913 | "\t}\n" 914 | "\n" 915 | "\tbool operator==(const FString& other)\n" 916 | "\t{\n" 917 | "\t\treturn (!strcmp(ArrayData, other.ArrayData));\n" 918 | "\t}\n" 919 | "\n" 920 | "\tbool operator!=(const FString& other)\n" 921 | "\t{\n" 922 | "\t\treturn (strcmp(ArrayData, other.ArrayData));\n" 923 | "\t}\n" 924 | "};\n"; 925 | 926 | const std::string FScriptDelegate_Struct = 927 | "struct FScriptDelegate\n" 928 | "{\n" 929 | "\tclass UObject* Object;\t\t\t\t\t\t\t\t\t\t// 0x0000 (0x08)\n" 930 | "};\n"; 931 | 932 | const std::string FPointer_Struct = 933 | "struct FPointer\n" 934 | "{\n" 935 | "\tuintptr_t Dummy;\n" 936 | "};\n"; 937 | 938 | const std::string FQWord_Struct = 939 | "struct FQWord\n" 940 | "{\n" 941 | "\tint32_t A;\n" 942 | "\tint32_t B;\n" 943 | "};\n"; 944 | 945 | const std::string UObject_FunctionDescriptions = 946 | "\tstatic TArray* GObjObjects();\n" 947 | "\n" 948 | "\tstd::string GetName();\n" 949 | "\tstd::string GetNameCPP();\n" 950 | "\tstd::string GetFullName();\n" 951 | "\tclass UObject* GetPackageObj();\n" 952 | "\ttemplate static T* FindObject(const std::string& objectFullName)\n" 953 | "\t{\n" 954 | "\t\tfor (UObject* uObject : *UObject::GObjObjects())\n" 955 | "\t\t{\n" 956 | "\t\t\tif (uObject && uObject->IsA())\n" 957 | "\t\t\t{\n" 958 | "\t\t\t\tif (uObject->GetFullName() == objectFullName)\n" 959 | "\t\t\t\t{\n" 960 | "\t\t\t\t\treturn static_cast(uObject);\n" 961 | "\t\t\t\t}\n" 962 | "\t\t\t}\n" 963 | "\t\t}\n" 964 | "\n" 965 | "\t\treturn nullptr;\n" 966 | "\t}\n" 967 | "\ttemplate static uint32_t CountObject(const std::string& objectName)\n" 968 | "\t{\n" 969 | "\t\tstatic std::map countCache;\n" 970 | "\n" 971 | "\t\tif (countCache.find(objectName) == countCache.end())\n" 972 | "\t\t{\n" 973 | "\t\t\tcountCache[objectName] = 0;\n" 974 | "\n" 975 | "\t\t\tfor (UObject* uObject : *UObject::GObjObjects())\n" 976 | "\t\t\t{\n" 977 | "\t\t\t\tif (uObject && uObject->IsA())\n" 978 | "\t\t\t\t{\n" 979 | "\t\t\t\t\tif (uObject->GetName() == objectName)\n" 980 | "\t\t\t\t\t{\n" 981 | "\t\t\t\t\t\tcountCache[uObject->GetName()]++;\n" 982 | "\t\t\t\t\t}\n" 983 | "\t\t\t\t}\n" 984 | "\t\t\t}\n" 985 | "\t\t}\n" 986 | "\n" 987 | "\t\treturn countCache[objectName];\n" 988 | "\t}\n" 989 | "\tstatic class UClass* FindClass(const std::string& classFullName);\n" 990 | "\ttemplate bool IsA()\n" 991 | "\t{\n" 992 | "\t\tif (std::is_base_of::value)\n" 993 | "\t\t{\n" 994 | "\t\t\treturn IsA(T::StaticClass());\n" 995 | "\t\t}\n" 996 | "\t}\n" 997 | "\tbool IsA(class UClass* uClass);\n" 998 | "\tbool IsA(int32_t objInternalInteger);\n\n"; 999 | 1000 | const std::string UObject_Functions = 1001 | "TArray* UObject::GObjObjects()\n" 1002 | "{\n" 1003 | "\tTArray* recastedArray = reinterpret_cast*>(GObjects);\n" 1004 | "\treturn recastedArray;\n" 1005 | "}\n" 1006 | "\n" 1007 | "std::string UObject::GetName()\n" 1008 | "{\n" 1009 | "\treturn this->Name.ToString();\n" 1010 | "}\n" 1011 | "\n" 1012 | "std::string UObject::GetNameCPP()\n" 1013 | "{\n" 1014 | "\tstd::string nameCPP;\n" 1015 | "\n" 1016 | "\tif (this->IsA())\n" 1017 | "\t{\n" 1018 | "\t\tUClass* uClass = static_cast(this);\n" 1019 | "\n" 1020 | "\t\twhile (uClass)\n" 1021 | "\t\t{\n" 1022 | "\t\t\tstd::string className = uClass->GetName();\n" 1023 | "\n" 1024 | "\t\t\tif (className == \"Actor\")\n" 1025 | "\t\t\t{\n" 1026 | "\t\t\t\tnameCPP += \"A\";\n" 1027 | "\t\t\t\tbreak;\n" 1028 | "\t\t\t}\n" 1029 | "\t\t\telse if (className == \"Object\")\n" 1030 | "\t\t\t{\n" 1031 | "\t\t\t\tnameCPP += \"U\";\n" 1032 | "\t\t\t\tbreak;\n" 1033 | "\t\t\t}\n" 1034 | "\n" 1035 | "\t\t\tuClass = static_cast(uClass->SuperField);\n" 1036 | "\t\t}\n" 1037 | "\t}\n" 1038 | "\telse\n" 1039 | "\t{\n" 1040 | "\t\tnameCPP += \"F\";\n" 1041 | "\t}\n" 1042 | "\n" 1043 | "\tnameCPP += this->GetName();\n" 1044 | "\n" 1045 | "\treturn nameCPP;\n" 1046 | "}\n" 1047 | "\n" 1048 | "std::string UObject::GetFullName()\n" 1049 | "{\n" 1050 | "\tstd::string fullName = this->GetName();\n" 1051 | "\n" 1052 | "\tfor (UObject* uOuter = this->Outer; uOuter; uOuter = uOuter->Outer)\n" 1053 | "\t{\n" 1054 | "\t\tfullName = (uOuter->GetName() + \".\" + fullName);\n" 1055 | "\t}\n" 1056 | "\n" 1057 | "\tfullName = (this->Class->GetName() + \" \" + fullName);\n" 1058 | "\n" 1059 | "\treturn fullName;\n" 1060 | "}\n" 1061 | "\n" 1062 | "UObject* UObject::GetPackageObj()\n" 1063 | "{\n" 1064 | "\tUObject* uPackage = nullptr;\n" 1065 | "\n" 1066 | "\tfor (UObject* uOuter = this->Outer; uOuter; uOuter = uOuter->Outer)\n" 1067 | "\t{\n" 1068 | "\t\tuPackage = uOuter;\n" 1069 | "\t}\n" 1070 | "\n" 1071 | "\treturn uPackage;\n" 1072 | "}\n" 1073 | "\n" 1074 | "UClass* UObject::FindClass(const const std::string& classFullName)\n" 1075 | "{\n" 1076 | "\tstatic bool initialized = false;\n" 1077 | "\tstatic std::map foundClasses{};\n" 1078 | "\n" 1079 | "\tif (!initialized)\n" 1080 | "\t{\n" 1081 | "\t\tfor (UObject* uObject : *UObject::GObjObjects())\n" 1082 | "\t\t{\n" 1083 | "\t\t\tif (uObject)\n" 1084 | "\t\t\t{\n" 1085 | "\t\t\t\tconst std::string objectFullName = uObject->GetFullName();\n" 1086 | "\n" 1087 | "\t\t\t\tif (objectFullName.find(\"Class\") == 0)\n" 1088 | "\t\t\t\t{\n" 1089 | "\t\t\t\t\tfoundClasses[objectFullName] = static_cast(uObject);\n" 1090 | "\t\t\t\t}\n" 1091 | "\t\t\t}\n" 1092 | "\t\t}\n" 1093 | "\n" 1094 | "\t\tinitialized = true;\n" 1095 | "\t}\n" 1096 | "\n" 1097 | "\tif (foundClasses.find(classFullName) != foundClasses.end())\n" 1098 | "\t{\n" 1099 | "\t\treturn foundClasses[classFullName];\n" 1100 | "\t}\n" 1101 | "\n" 1102 | "\treturn nullptr;\n" 1103 | "}\n" 1104 | "\n" 1105 | "bool UObject::IsA(class UClass* uClass)\n" 1106 | "{\n" 1107 | "\tfor (UClass* uSuperClass = this->Class; uSuperClass; uSuperClass = static_cast(uSuperClass->SuperField))\n" 1108 | "\t{\n" 1109 | "\t\tif (uSuperClass == uClass)\n" 1110 | "\t\t{\n" 1111 | "\t\t\treturn true;\n" 1112 | "\t\t}\n" 1113 | "\t}\n" 1114 | "\n" 1115 | "\treturn false;\n" 1116 | "}\n" 1117 | "\n" 1118 | "bool UObject::IsA(int32_t objInternalInteger)\n" 1119 | "{\n" 1120 | "\tUClass* uClass = UObject::GObjObjects()->at(objInternalInteger)->Class;\n" 1121 | "\n" 1122 | "\tif (uClass)\n" 1123 | "\t{\n" 1124 | "\t\treturn this->IsA(uClass);\n" 1125 | "\t}\n" 1126 | "\n" 1127 | "\treturn false;\n" 1128 | "}\n\n"; 1129 | 1130 | const std::string UFunction_Functions = 1131 | "UFunction* UFunction::FindFunction(const const std::string& functionFullName)\n" 1132 | "{\n" 1133 | "\tstatic bool initialized = false;\n" 1134 | "\tstatic std::map foundFunctions{};\n" 1135 | "\n" 1136 | "\tif (!initialized)\n" 1137 | "\t{\n" 1138 | "\t\tfor (UObject* uObject : *UObject::GObjObjects())\n" 1139 | "\t\t{\n" 1140 | "\t\t\tif (uObject)\n" 1141 | "\t\t\t{\n" 1142 | "\t\t\t\tconst std::string objectFullName = uObject->GetFullName();\n" 1143 | "\n" 1144 | "\t\t\t\tif (objectFullName.find(\"Function\") == 0)\n" 1145 | "\t\t\t\t{\n" 1146 | "\t\t\t\t\tfoundFunctions[objectFullName] = static_cast(uObject);\n" 1147 | "\t\t\t\t}\n" 1148 | "\t\t\t}\n" 1149 | "\t\t}\n" 1150 | "\n" 1151 | "\t\tinitialized = true;\n" 1152 | "\t}\n" 1153 | "\n" 1154 | "\tif (foundFunctions.find(functionFullName) != foundFunctions.end())\n" 1155 | "\t{\n" 1156 | "\t\treturn foundFunctions[functionFullName];\n" 1157 | "\t}\n" 1158 | "\n" 1159 | "\treturn nullptr;\n" 1160 | "}\n\n"; 1161 | 1162 | const std::string EEnumFlags = 1163 | "// Function Flags\n" 1164 | "// https://docs.unrealengine.com/en-US/API/Runtime/CoreUObject/UObject/EFunctionFlags/index.html\n" 1165 | "// https://github.com/EliotVU/Unreal-Library/blob/59a9774fd7c972d55810676521e4b874d7a242e8/src/UnrealFlags.cs\n" 1166 | "enum EFunctionFlags\n" 1167 | "{\n" 1168 | "\tFUNC_None =\t\t\t\t\t\t\t\t0x00000000,\n" 1169 | "\tFUNC_Final =\t\t\t\t\t\t\t0x00000001,\n" 1170 | "\tFUNC_Defined =\t\t\t\t\t\t\t0x00000002,\n" 1171 | "\tFUNC_Iterator =\t\t\t\t\t\t\t0x00000004,\n" 1172 | "\tFUNC_Latent =\t\t\t\t\t\t\t0x00000008,\n" 1173 | "\tFUNC_PreOperator =\t\t\t\t\t\t0x00000010,\n" 1174 | "\tFUNC_Singular =\t\t\t\t\t\t\t0x00000020,\n" 1175 | "\tFUNC_Net =\t\t\t\t\t\t\t\t0x00000040,\n" 1176 | "\tFUNC_NetReliable =\t\t\t\t\t\t0x00000080,\n" 1177 | "\tFUNC_Simulated =\t\t\t\t\t\t0x00000100,\n" 1178 | "\tFUNC_Exec =\t\t\t\t\t\t\t\t0x00000200,\n" 1179 | "\tFUNC_Native =\t\t\t\t\t\t\t0x00000400,\n" 1180 | "\tFUNC_Event =\t\t\t\t\t\t\t0x00000800,\n" 1181 | "\tFUNC_Operator =\t\t\t\t\t\t\t0x00001000,\n" 1182 | "\tFUNC_Static =\t\t\t\t\t\t\t0x00002000,\n" 1183 | "\tFUNC_NoExport =\t\t\t\t\t\t\t0x00004000,\n" 1184 | "\tFUNC_OptionalParm =\t\t\t\t\t\t0x00004000,\n" 1185 | "\tFUNC_Const =\t\t\t\t\t\t\t0x00008000,\n" 1186 | "\tFUNC_Invariant =\t\t\t\t\t\t0x00010000,\n" 1187 | "\tFUNC_Public =\t\t\t\t\t\t\t0x00020000,\n" 1188 | "\tFUNC_Private =\t\t\t\t\t\t\t0x00040000,\n" 1189 | "\tFUNC_Protected =\t\t\t\t\t\t0x00080000,\n" 1190 | "\tFUNC_Delegate =\t\t\t\t\t\t\t0x00100000,\n" 1191 | "\tFUNC_NetServer =\t\t\t\t\t\t0x00200000,\n" 1192 | "\tFUNC_HasOutParms =\t\t\t\t\t\t0x00400000,\n" 1193 | "\tFUNC_HasDefaults =\t\t\t\t\t\t0x00800000,\n" 1194 | "\tFUNC_NetClient =\t\t\t\t\t\t0x01000000,\n" 1195 | "\tFUNC_DLLImport =\t\t\t\t\t\t0x02000000,\n" 1196 | "\tFUNC_K2Call =\t\t\t\t\t\t\t0x04000000,\n" 1197 | "\tFUNC_K2Override =\t\t\t\t\t\t0x08000000,\n" 1198 | "\tFUNC_K2Pure =\t\t\t\t\t\t\t0x10000000,\n" 1199 | "\tFUNC_EditorOnly =\t\t\t\t\t\t0x20000000,\n" 1200 | "\tFUNC_Lambda =\t\t\t\t\t\t\t0x40000000,\n" 1201 | "\tFUNC_NetValidate =\t\t\t\t\t\t0x80000000,\n" 1202 | "\tFUNC_AllFlags =\t\t\t\t\t\t\t0xFFFFFFFF\n" 1203 | "};\n" 1204 | "\n" 1205 | "// Proprerty Flags\n" 1206 | "// https://docs.unrealengine.com/en-US/API/Runtime/CoreUObject/UObject/EPropertyFlags/index.html\n" 1207 | "enum EPropertyFlags\n" 1208 | "{\n" 1209 | "\tCPF_Edit =\t\t\t\t\t\t\t\t0x0000000000000001,\t// Property is user-settable in the editor.\n" 1210 | "\tCPF_Const =\t\t\t\t\t\t\t\t0x0000000000000002,\t// Actor\'s property always matches class\'s default actor property.\n" 1211 | "\tCPF_Input =\t\t\t\t\t\t\t\t0x0000000000000004,\t// Variable is writable by the input system.\n" 1212 | "\tCPF_ExportObject =\t\t\t\t\t\t0x0000000000000008,\t// Object can be exported with actor.\n" 1213 | "\tCPF_OptionalParm =\t\t\t\t\t\t0x0000000000000010,\t// Optional parameter (if CPF_Param is set).\n" 1214 | "\tCPF_Net =\t\t\t\t\t\t\t\t0x0000000000000020,\t// Property is relevant to network replication.\n" 1215 | "\tCPF_EditConstArray =\t\t\t\t\t0x0000000000000040,\t// Prevent adding/removing of items from dynamic a array in the editor.\n" 1216 | "\tCPF_Parm =\t\t\t\t\t\t\t\t0x0000000000000080,\t// Function/When call parameter.\n" 1217 | "\tCPF_OutParm =\t\t\t\t\t\t\t0x0000000000000100,\t// Value is copied out after function call.\n" 1218 | "\tCPF_SkipParm =\t\t\t\t\t\t\t0x0000000000000200,\t// Property is a short-circuitable evaluation function parm.\n" 1219 | "\tCPF_ReturnParm =\t\t\t\t\t\t0x0000000000000400,\t// Return value.\n" 1220 | "\tCPF_CoerceParm =\t\t\t\t\t\t0x0000000000000800,\t// Coerce args into this function parameter.\n" 1221 | "\tCPF_Native =\t\t\t\t\t\t\t0x0000000000001000,\t// Property is native: C++ code is responsible for serializing it.\n" 1222 | "\tCPF_Transient =\t\t\t\t\t\t\t0x0000000000002000,\t// Property is transient: shouldn\'t be saved, zero-filled at load time.\n" 1223 | "\tCPF_Config =\t\t\t\t\t\t\t0x0000000000004000,\t// Property should be loaded/saved as permanent profile.\n" 1224 | "\tCPF_Localized =\t\t\t\t\t\t\t0x0000000000008000,\t// Property should be loaded as localizable text.\n" 1225 | "\tCPF_Travel =\t\t\t\t\t\t\t0x0000000000010000,\t// Property travels across levels/servers.\n" 1226 | "\tCPF_EditConst =\t\t\t\t\t\t\t0x0000000000020000,\t// Property is uneditable in the editor.\n" 1227 | "\tCPF_GlobalConfig =\t\t\t\t\t\t0x0000000000040000,\t// Load config from base class, not subclass.\n" 1228 | "\tCPF_Component =\t\t\t\t\t\t\t0x0000000000080000,\t// Property containts component references.\n" 1229 | "\tCPF_NeedCtorLink =\t\t\t\t\t\t0x0000000000400000,\t// Fields need construction/destruction.\n" 1230 | "\tCPF_NoExport =\t\t\t\t\t\t\t0x0000000000800000,\t// Property should not be exported to the native class header file.\n" 1231 | "\tCPF_NoClear =\t\t\t\t\t\t\t0x0000000002000000,\t// Hide clear (and browse) button.\n" 1232 | "\tCPF_EditInline =\t\t\t\t\t\t0x0000000004000000,\t// Edit this object reference inline.\n" 1233 | "\tCPF_EdFindable =\t\t\t\t\t\t0x0000000008000000,\t// References are set by clicking on actors in the editor viewports.\n" 1234 | "\tCPF_EditInlineUse =\t\t\t\t\t\t0x0000000010000000,\t// EditInline with Use button.\n" 1235 | "\tCPF_Deprecated =\t\t\t\t\t\t0x0000000020000000,\t// Property is deprecated. Read it from an archive, but don\'t save it.\n" 1236 | "\tCPF_EditInlineNotify =\t\t\t\t\t0x0000000040000000,\t// EditInline, notify outer object on editor change.\n" 1237 | "\tCPF_RepNotify =\t\t\t\t\t\t\t0x0000000100000000,\t// Notify actors when a property is replicated\n" 1238 | "\tCPF_Interp =\t\t\t\t\t\t\t0x0000000200000000,\t// interpolatable property for use with matinee\n" 1239 | "\tCPF_NonTransactional =\t\t\t\t\t0x0000000400000000,\t// Property isn\'t transacted\n" 1240 | "\tCPF_EditorOnly =\t\t\t\t\t\t0x0000000800000000,\t// Property should only be loaded in the editor.\n" 1241 | "\tCPF_NoDestructor =\t\t\t\t\t\t0x0000001000000000,\t// No destructor.\n" 1242 | "\tCPF_AutoWeak =\t\t\t\t\t\t\t0x0000004000000000,\t// CPF_ = 0x0000002000000000, ///<.\n" 1243 | "\tCPF_ContainsInstancedReference =\t\t0x0000008000000000,\t// Property contains component refuerences.\n" 1244 | "\tCPF_AssetRegistrySearchable =\t\t\t0x0000010000000000,\t// Asset instances will add properties with this flag to the asset registry automatically\n" 1245 | "\tCPF_SimpleDisplay =\t\t\t\t\t\t0x0000020000000000,\t// The property is visible by default in the editor details view.\n" 1246 | "\tCPF_AdvancedDisplay =\t\t\t\t\t0x0000040000000000,\t// The property is advanced and not visible by default in the editor details view.\n" 1247 | "\tCPF_Protected =\t\t\t\t\t\t\t0x0000080000000000,\t// Property is protected from the perspective of scrip\n" 1248 | "\tCPF_BlueprintCallable =\t\t\t\t\t0x0000100000000000,\t// MC Delegates only. Property should be exposed for calling in blueprint code.\n" 1249 | "\tCPF_BlueprintAuthorityOnly =\t\t\t0x0000200000000000,\t// MC Delegates only. This delegate accepts (only in blueprint) only events with BlueprintAuthorityOnly.\n" 1250 | "\tCPF_TextExportTransient =\t\t\t\t0x0000400000000000,\t// Property shouldn\'t be exported to text format (e.g. copy/paste)\n" 1251 | "\tCPF_NonPIEDuplicateTransient =\t\t\t0x0000800000000000,\t// Property should only be copied in PIE.\n" 1252 | "\tCPF_ExposeOnSpawn =\t\t\t\t\t\t0x0001000000000000,\t// Property is exposed on spawn.\n" 1253 | "\tCPF_PersistentInstance =\t\t\t\t0x0002000000000000,\t// A object referenced by the property is duplicated like a component. (Each actor should have an own instance.)\n" 1254 | "\tCPF_UObjectWrapper =\t\t\t\t\t0x0004000000000000,\t// Property was parsed as a wrapper class like TSubclassOf , FScriptInterface etc., rather than a USomething*.\n" 1255 | "\tCPF_HasGetValueTypeHash =\t\t\t\t0x0008000000000000,\t// This property can generate a meaningful hash value.\n" 1256 | "\tCPF_NativeAccessSpecifierPublic =\t\t0x0010000000000000,\t// Public native access specifier.\n" 1257 | "\tCPF_NativeAccessSpecifierProtected =\t0x0020000000000000,\t// Protected native access specifier.\n" 1258 | "\tCPF_NativeAccessSpecifierPrivate =\t\t0x0040000000000000,\t// Private native access specifier.\n" 1259 | "\tCPF_SkipSerialization =\t\t\t\t\t0x0080000000000000\t// Property shouldn\'t be serialized, can still be exported to text.\n" 1260 | "};\n" 1261 | "\n" 1262 | "// Object Flags\n" 1263 | "// https://docs.unrealengine.com/4.26/en-US/API/Runtime/CoreUObject/UObject/EObjectFlags/\n" 1264 | "enum EObjectFlags\n" 1265 | "{\n" 1266 | "\tRF_NoFlags =\t\t\t\t\t\t\t0x00000000,\n" 1267 | "\tRF_Public =\t\t\t\t\t\t\t\t0x00000001,\n" 1268 | "\tRF_Standalone =\t\t\t\t\t\t\t0x00000002,\n" 1269 | "\tRF_MarkAsNative =\t\t\t\t\t\t0x00000004,\n" 1270 | "\tRF_Transactional =\t\t\t\t\t\t0x00000008,\n" 1271 | "\tRF_ClassDefaultObject =\t\t\t\t\t0x00000010,\n" 1272 | "\tRF_ArchetypeObject =\t\t\t\t\t0x00000020,\n" 1273 | "\tRF_Transient =\t\t\t\t\t\t\t0x00000040,\n" 1274 | "\tRF_MarkAsRootSet =\t\t\t\t\t\t0x00000080,\n" 1275 | "\tRF_TagGarbageTemp =\t\t\t\t\t\t0x00000100,\n" 1276 | "\tRF_NeedInitialization =\t\t\t\t\t0x00000200,\n" 1277 | "\tRF_NeedLoad =\t\t\t\t\t\t\t0x00000400,\n" 1278 | "\tRF_KeepForCooker =\t\t\t\t\t\t0x00000800,\n" 1279 | "\tRF_NeedPostLoad =\t\t\t\t\t\t0x00001000,\n" 1280 | "\tRF_NeedPostLoadSubobjects =\t\t\t\t0x00002000,\n" 1281 | "\tRF_NewerVersionExists =\t\t\t\t\t0x00004000,\n" 1282 | "\tRF_BeginDestroyed =\t\t\t\t\t\t0x00008000,\n" 1283 | "\tRF_FinishDestroyed =\t\t\t\t\t0x00010000,\n" 1284 | "\tRF_BeingRegenerated =\t\t\t\t\t0x00020000,\n" 1285 | "\tRF_DefaultSubObject =\t\t\t\t\t0x00040000,\n" 1286 | "\tRF_WasLoaded =\t\t\t\t\t\t\t0x00080000,\n" 1287 | "\tRF_TextExportTransient =\t\t\t\t0x00100000,\n" 1288 | "\tRF_LoadCompleted =\t\t\t\t\t\t0x00200000,\n" 1289 | "\tRF_InheritableComponentTemplate =\t\t0x00400000,\n" 1290 | "\tRF_DuplicateTransient =\t\t\t\t\t0x00800000,\n" 1291 | "\tRF_StrongRefOnFrame =\t\t\t\t\t0x01000000,\n" 1292 | "\tRF_NonPIEDuplicateTransient =\t\t\t0x02000000,\n" 1293 | "\tRF_Dynamic =\t\t\t\t\t\t\t0x04000000,\n" 1294 | "\tRF_WillBeLoaded =\t\t\t\t\t\t0x08000000,\n" 1295 | "};\n"; 1296 | } 1297 | 1298 | /* 1299 | # ========================================================================================= # 1300 | # 1301 | # ========================================================================================= # 1302 | */ -------------------------------------------------------------------------------- /Engine/RocketLeague/PiecesOfCode.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /* 5 | # ========================================================================================= # 6 | # Pieces Of Code 7 | # ========================================================================================= # 8 | */ 9 | 10 | // These are global variables for the generator, only change them if you know what you're doing! 11 | 12 | namespace PiecesOfCode 13 | { 14 | extern const std::string TArray_Iterator; 15 | extern const std::string TArray_Class; 16 | extern const std::string TMap_Class; 17 | extern const std::string FNameEntry_Struct; 18 | extern const std::string FNameEntry_Struct_UTF16; 19 | extern const std::string FNameEntry_Struct_UTF8; 20 | extern const std::string FName_Struct_UTF16; 21 | extern const std::string FName_Struct_UTF8; 22 | extern const std::string FString_Class_UTF16; 23 | extern const std::string FString_Class_UTF8; 24 | extern const std::string FScriptDelegate_Struct; 25 | extern const std::string FPointer_Struct; 26 | extern const std::string FQWord_Struct; 27 | extern const std::string UObject_FunctionDescriptions; 28 | extern const std::string UObject_Functions; 29 | extern const std::string UFunction_Functions; 30 | extern const std::string EEnumFlags; 31 | } 32 | 33 | /* 34 | # ========================================================================================= # 35 | # 36 | # ========================================================================================= # 37 | */ -------------------------------------------------------------------------------- /Engine/Template/Configuration.cpp: -------------------------------------------------------------------------------- 1 | #include "Configuration.hpp" 2 | 3 | /* 4 | # ========================================================================================= # 5 | # Configuration 6 | # ========================================================================================= # 7 | */ 8 | 9 | namespace Configuration 10 | { 11 | const bool UsingWindows = true; // When set to true this will auto include "Windows.h" in your sdk, along with renaming some windows macro functions. 12 | const bool UsingConstants = false; // If you want to use class and function indexes instead of "FindClass/FindFunction". 13 | const bool UsingOffsets = false; // If you're using the offsets below or patterns to initialize globals. 14 | const bool UsingEventIndex = false; // If you want to use "ProcessEventIndex" change this to true, if not virutal voids will be generated from "ProcessEventPattern". 15 | const bool UsingEnumClasses = true; // If you want to use strongly typed enum classes over normal ones. 16 | const bool PrintFlagEnums = true; // If you want the EFunctionFlags, EPropertyFlags, and EObjectFlags enums so be included in the final sdk. 17 | const bool RemoveNativeIndex = true; // If you want to remove the "iNative" index on functions before calling process event. 18 | const bool RemoveNativeFlags = true; // If you want to remove the "FUNC_Native" flag on functions before calling process event. 19 | const std::string EnumClassType = "uint8_t"; // Underlying enum type if you set "UsingEnumClasses" to true. 20 | 21 | const int32_t CommentSpacer = 30; 22 | const int32_t ConstSpacer = 50; 23 | const int32_t EnumSpacer = 50; 24 | const int32_t StructSpacer = 50; 25 | const int32_t FunctionSpacer = 50; 26 | const int32_t ClassSpacer = 50; 27 | const int32_t GameAlignment = static_cast(EAlignment::X32BIT); // Used to calculate property sizes and missed offsets. 28 | const int32_t FinalAlignment = 0x4; // Forced alignment used in the final sdk, "UsingEnumClasses" is dependent on this value! 29 | 30 | const int32_t ProcessEventIndex = -1; // Position where the Process Event function is in "UObject"'s VfTable. 31 | const std::string ProcessEventString = ""; 32 | const uint8_t* ProcessEventPattern = (uint8_t*)""; 33 | const char* ProcessEventMask = (char*)""; 34 | 35 | const std::string GObjectsString = ""; 36 | const uint8_t* GObjectsPattern = (uint8_t*)""; 37 | const char* GObjectsMask = (char*)""; 38 | const uintptr_t GObjectsOffset = 0x0; 39 | 40 | const std::string GNamesString = ""; 41 | const uint8_t* GNamesPattern = (uint8_t*)""; 42 | const char* GNamesMask = (char*)""; 43 | const uintptr_t GNamesOffset = 0x0; 44 | 45 | const std::string GameName = "Template"; 46 | const std::string GameNameShort = "TSDK"; 47 | const std::string GameVersion = "1.0.0.0"; 48 | const std::filesystem::path Directory = "I_FORGOT_TO_SET_A_PATH"; 49 | } 50 | 51 | /* 52 | # ========================================================================================= # 53 | # 54 | # ========================================================================================= # 55 | */ -------------------------------------------------------------------------------- /Engine/Template/Configuration.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | 5 | /* 6 | # ========================================================================================= # 7 | # Configuration 8 | # ========================================================================================= # 9 | */ 10 | 11 | // Uncomment this if you want to disable file logging during generation! 12 | //#define NO_LOGGING 13 | 14 | // Uncomment this if your game uses wide characters (UTF16), the default is UTF8! 15 | //#define UTF16 16 | 17 | enum class EAlignment : int32_t 18 | { 19 | NONE = 0x1, 20 | X32BIT = 0x4, 21 | X64BIT = 0x8 22 | }; 23 | 24 | // These are global variables below, make changes in the cpp file only! 25 | 26 | namespace Configuration 27 | { 28 | extern const bool UsingWindows; 29 | extern const bool UsingConstants; 30 | extern const bool UsingOffsets; 31 | extern const bool UsingEventIndex; 32 | extern const bool UsingEnumClasses; 33 | extern const bool PrintFlagEnums; 34 | extern const bool RemoveNativeIndex; 35 | extern const bool RemoveNativeFlags; 36 | extern const std::string EnumClassType; 37 | 38 | extern const int32_t CommentSpacer; 39 | extern const int32_t ConstSpacer; 40 | extern const int32_t EnumSpacer; 41 | extern const int32_t StructSpacer; 42 | extern const int32_t FunctionSpacer; 43 | extern const int32_t ClassSpacer; 44 | extern const int32_t GameAlignment; 45 | extern const int32_t FinalAlignment; 46 | 47 | extern const int32_t ProcessEventIndex; 48 | extern const std::string ProcessEventString; 49 | extern const uint8_t* ProcessEventPattern; 50 | extern const char* ProcessEventMask; 51 | 52 | extern const std::string GObjectsString; 53 | extern const uint8_t* GObjectsPattern; 54 | extern const char* GObjectsMask; 55 | extern const uintptr_t GObjectsOffset; 56 | 57 | extern const std::string GNamesString; 58 | extern const uint8_t* GNamesPattern; 59 | extern const char* GNamesMask; 60 | extern const uintptr_t GNamesOffset; 61 | 62 | extern const std::string GameName; 63 | extern const std::string GameNameShort; 64 | extern const std::string GameVersion; 65 | extern const std::filesystem::path Directory; 66 | } 67 | 68 | /* 69 | # ========================================================================================= # 70 | # 71 | # ========================================================================================= # 72 | */ -------------------------------------------------------------------------------- /Engine/Template/GameDefines.cpp: -------------------------------------------------------------------------------- 1 | #include "GameDefines.hpp" 2 | 3 | /* 4 | # ========================================================================================= # 5 | # Initialize Globals 6 | # ========================================================================================= # 7 | */ 8 | 9 | TArray* GObjects{}; 10 | TArray* GNames{}; 11 | 12 | /* 13 | # ========================================================================================= # 14 | # Class Functions 15 | # ========================================================================================= # 16 | */ 17 | 18 | TArray* UObject::GObjObjects() 19 | { 20 | TArray* recastedArray = reinterpret_cast*>(GObjects); 21 | return recastedArray; 22 | } 23 | 24 | std::string UObject::GetName() 25 | { 26 | return this->Name.ToString(); 27 | } 28 | 29 | std::string UObject::GetNameCPP() 30 | { 31 | std::string nameCPP; 32 | 33 | if (this->IsA()) 34 | { 35 | UClass* uClass = static_cast(this); 36 | 37 | while (uClass) 38 | { 39 | std::string className = uClass->GetName(); 40 | 41 | if (className == "Actor") 42 | { 43 | nameCPP += "A"; 44 | break; 45 | } 46 | else if (className == "Object") 47 | { 48 | nameCPP += "U"; 49 | break; 50 | } 51 | 52 | uClass = static_cast(uClass->SuperField); 53 | } 54 | } 55 | else 56 | { 57 | nameCPP += "F"; 58 | } 59 | 60 | nameCPP += this->GetName(); 61 | 62 | return nameCPP; 63 | } 64 | 65 | std::string UObject::GetFullName() 66 | { 67 | std::string fullName = this->GetName(); 68 | 69 | for (UObject* uOuter = this->Outer; uOuter; uOuter = uOuter->Outer) 70 | { 71 | fullName = (uOuter->GetName() + "." + fullName); 72 | } 73 | 74 | fullName = this->Class->GetName() + " " + fullName; 75 | 76 | return fullName; 77 | } 78 | 79 | std::string UObject::GetPackageName() 80 | { 81 | UObject* uPackageObj = this->GetPackageObj(); 82 | 83 | if (uPackageObj) 84 | { 85 | static std::string packageName = uPackageObj->GetName(); 86 | 87 | return packageName; 88 | } 89 | 90 | return "null"; 91 | } 92 | 93 | UObject* UObject::GetPackageObj() 94 | { 95 | UObject* uPackage = nullptr; 96 | 97 | for (UObject* uOuter = this->Outer; uOuter; uOuter = uOuter->Outer) 98 | { 99 | uPackage = uOuter; 100 | } 101 | 102 | return uPackage; 103 | } 104 | 105 | class UClass* UObject::FindClass(const std::string& classFullName) 106 | { 107 | static bool initialized = false; 108 | static std::map foundClasses{}; 109 | 110 | if (!initialized) 111 | { 112 | for (UObject* uObject : *UObject::GObjObjects()) 113 | { 114 | if (uObject) 115 | { 116 | std::string objectFullName = uObject->GetFullName(); 117 | 118 | if (objectFullName.find("Class") == 0) 119 | { 120 | foundClasses[objectFullName] = static_cast(uObject); 121 | } 122 | } 123 | } 124 | 125 | initialized = true; 126 | } 127 | 128 | if (foundClasses.find(classFullName) != foundClasses.end()) 129 | { 130 | return foundClasses[classFullName]; 131 | } 132 | 133 | return nullptr; 134 | } 135 | 136 | bool UObject::IsA(class UClass* uClass) 137 | { 138 | for (UClass* uSuperClass = this->Class; uSuperClass; uSuperClass = static_cast(uSuperClass->SuperField)) 139 | { 140 | if (uSuperClass == uClass) 141 | { 142 | return true; 143 | } 144 | } 145 | 146 | return false; 147 | } 148 | 149 | bool UObject::IsA(int32_t objInternalInteger) 150 | { 151 | UClass* uClass = UObject::GObjObjects()->at(objInternalInteger)->Class; 152 | 153 | if (uClass) 154 | { 155 | return this->IsA(uClass); 156 | } 157 | 158 | return false; 159 | } 160 | 161 | class UFunction* UFunction::FindFunction(const std::string& functionFullName) 162 | { 163 | static bool initialized = false; 164 | static std::map foundFunctions{}; 165 | 166 | if (!initialized) 167 | { 168 | for (UObject* uObject : *UObject::GObjObjects()) 169 | { 170 | if (uObject) 171 | { 172 | std::string objectFullName = uObject->GetFullName(); 173 | 174 | if (objectFullName.find("Function") == 0) 175 | { 176 | foundFunctions[objectFullName] = static_cast(uObject); 177 | } 178 | } 179 | } 180 | 181 | initialized = true; 182 | } 183 | 184 | if (foundFunctions.find(functionFullName) != foundFunctions.end()) 185 | { 186 | return foundFunctions[functionFullName]; 187 | } 188 | 189 | return nullptr; 190 | } 191 | 192 | /* 193 | # ========================================================================================= # 194 | # 195 | # ========================================================================================= # 196 | */ -------------------------------------------------------------------------------- /Engine/Template/GameDefines.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include "Configuration.hpp" 13 | #include "../../Member.hpp" 14 | 15 | /* 16 | # ========================================================================================= # 17 | # Flags 18 | # ========================================================================================= # 19 | */ 20 | 21 | // Function Flags 22 | // https://docs.unrealengine.com/en-US/API/Runtime/CoreUObject/UObject/EFunctionFlags/index.html 23 | // https://github.com/EliotVU/Unreal-Library/blob/59a9774fd7c972d55810676521e4b874d7a242e8/src/UnrealFlags.cs 24 | enum EFunctionFlags 25 | { 26 | FUNC_None = 0x00000000, 27 | FUNC_Final = 0x00000001, 28 | FUNC_Defined = 0x00000002, 29 | FUNC_Iterator = 0x00000004, 30 | FUNC_Latent = 0x00000008, 31 | FUNC_PreOperator = 0x00000010, 32 | FUNC_Singular = 0x00000020, 33 | FUNC_Net = 0x00000040, 34 | FUNC_NetReliable = 0x00000080, 35 | FUNC_Simulated = 0x00000100, 36 | FUNC_Exec = 0x00000200, 37 | FUNC_Native = 0x00000400, 38 | FUNC_Event = 0x00000800, 39 | FUNC_Operator = 0x00001000, 40 | FUNC_Static = 0x00002000, 41 | FUNC_NoExport = 0x00004000, 42 | FUNC_OptionalParm = 0x00004000, 43 | FUNC_Const = 0x00008000, 44 | FUNC_Invariant = 0x00010000, 45 | FUNC_Public = 0x00020000, 46 | FUNC_Private = 0x00040000, 47 | FUNC_Protected = 0x00080000, 48 | FUNC_Delegate = 0x00100000, 49 | FUNC_NetServer = 0x00200000, 50 | FUNC_HasOutParms = 0x00400000, 51 | FUNC_HasDefaults = 0x00800000, 52 | FUNC_NetClient = 0x01000000, 53 | FUNC_DLLImport = 0x02000000, 54 | FUNC_K2Call = 0x04000000, 55 | FUNC_K2Override = 0x08000000, 56 | FUNC_K2Pure = 0x10000000, 57 | FUNC_EditorOnly = 0x20000000, 58 | FUNC_Lambda = 0x40000000, 59 | FUNC_NetValidate = 0x80000000, 60 | FUNC_AllFlags = 0xFFFFFFFF 61 | }; 62 | 63 | // Proprerty Flags 64 | // https://docs.unrealengine.com/en-US/API/Runtime/CoreUObject/UObject/EPropertyFlags/index.html 65 | enum EPropertyFlags 66 | { 67 | CPF_Edit = 0x0000000000000001, // Property is user-settable in the editor. 68 | CPF_Const = 0x0000000000000002, // Actor's property always matches class's default actor property. 69 | CPF_Input = 0x0000000000000004, // Variable is writable by the input system. 70 | CPF_ExportObject = 0x0000000000000008, // Object can be exported with actor. 71 | CPF_OptionalParm = 0x0000000000000010, // Optional parameter (if CPF_Param is set). 72 | CPF_Net = 0x0000000000000020, // Property is relevant to network replication. 73 | CPF_EditConstArray = 0x0000000000000040, // Prevent adding/removing of items from dynamic a array in the editor. 74 | CPF_Parm = 0x0000000000000080, // Function/When call parameter. 75 | CPF_OutParm = 0x0000000000000100, // Value is copied out after function call. 76 | CPF_SkipParm = 0x0000000000000200, // Property is a short-circuitable evaluation function parm. 77 | CPF_ReturnParm = 0x0000000000000400, // Return value. 78 | CPF_CoerceParm = 0x0000000000000800, // Coerce args into this function parameter. 79 | CPF_Native = 0x0000000000001000, // Property is native: C++ code is responsible for serializing it. 80 | CPF_Transient = 0x0000000000002000, // Property is transient: shouldn't be saved, zero-filled at load time. 81 | CPF_Config = 0x0000000000004000, // Property should be loaded/saved as permanent profile. 82 | CPF_Localized = 0x0000000000008000, // Property should be loaded as localizable text. 83 | CPF_Travel = 0x0000000000010000, // Property travels across levels/servers. 84 | CPF_EditConst = 0x0000000000020000, // Property is uneditable in the editor. 85 | CPF_GlobalConfig = 0x0000000000040000, // Load config from base class, not subclass. 86 | CPF_Component = 0x0000000000080000, // Property containts component references. 87 | CPF_NeedCtorLink = 0x0000000000400000, // Fields need construction/destruction. 88 | CPF_NoExport = 0x0000000000800000, // Property should not be exported to the native class header file. 89 | CPF_NoClear = 0x0000000002000000, // Hide clear (and browse) button. 90 | CPF_EditInline = 0x0000000004000000, // Edit this object reference inline. 91 | CPF_EdFindable = 0x0000000008000000, // References are set by clicking on actors in the editor viewports. 92 | CPF_EditInlineUse = 0x0000000010000000, // EditInline with Use button. 93 | CPF_Deprecated = 0x0000000020000000, // Property is deprecated. Read it from an archive, but don't save it. 94 | CPF_EditInlineNotify = 0x0000000040000000, // EditInline, notify outer object on editor change. 95 | CPF_RepNotify = 0x0000000100000000, // Notify actors when a property is replicated 96 | CPF_Interp = 0x0000000200000000, // interpolatable property for use with matinee 97 | CPF_NonTransactional = 0x0000000400000000, // Property isn't transacted 98 | CPF_EditorOnly = 0x0000000800000000, // Property should only be loaded in the editor. 99 | CPF_NoDestructor = 0x0000001000000000, // No destructor. 100 | CPF_AutoWeak = 0x0000004000000000, // CPF_ = 0x0000002000000000, ///<. 101 | CPF_ContainsInstancedReference = 0x0000008000000000, // Property contains component refuerences. 102 | CPF_AssetRegistrySearchable = 0x0000010000000000, // Asset instances will add properties with this flag to the asset registry automatically 103 | CPF_SimpleDisplay = 0x0000020000000000, // The property is visible by default in the editor details view. 104 | CPF_AdvancedDisplay = 0x0000040000000000, // The property is advanced and not visible by default in the editor details view. 105 | CPF_Protected = 0x0000080000000000, // Property is protected from the perspective of scrip 106 | CPF_BlueprintCallable = 0x0000100000000000, // MC Delegates only. Property should be exposed for calling in blueprint code. 107 | CPF_BlueprintAuthorityOnly = 0x0000200000000000, // MC Delegates only. This delegate accepts (only in blueprint) only events with BlueprintAuthorityOnly. 108 | CPF_TextExportTransient = 0x0000400000000000, // Property shouldn't be exported to text format (e.g. copy/paste) 109 | CPF_NonPIEDuplicateTransient = 0x0000800000000000, // Property should only be copied in PIE. 110 | CPF_ExposeOnSpawn = 0x0001000000000000, // Property is exposed on spawn. 111 | CPF_PersistentInstance = 0x0002000000000000, // A object referenced by the property is duplicated like a component. (Each actor should have an own instance.) 112 | CPF_UObjectWrapper = 0x0004000000000000, // Property was parsed as a wrapper class like TSubclassOf , FScriptInterface etc., rather than a USomething*. 113 | CPF_HasGetValueTypeHash = 0x0008000000000000, // This property can generate a meaningful hash value. 114 | CPF_NativeAccessSpecifierPublic = 0x0010000000000000, // Public native access specifier. 115 | CPF_NativeAccessSpecifierProtected = 0x0020000000000000, // Protected native access specifier. 116 | CPF_NativeAccessSpecifierPrivate = 0x0040000000000000, // Private native access specifier. 117 | CPF_SkipSerialization = 0x0080000000000000 // Property shouldn't be serialized, can still be exported to text. 118 | }; 119 | 120 | // Object Flags 121 | // https://docs.unrealengine.com/4.26/en-US/API/Runtime/CoreUObject/UObject/EObjectFlags/ 122 | enum EObjectFlags 123 | { 124 | RF_NoFlags = 0x00000000, 125 | RF_Public = 0x00000001, 126 | RF_Standalone = 0x00000002, 127 | RF_MarkAsNative = 0x00000004, 128 | RF_Transactional = 0x00000008, 129 | RF_ClassDefaultObject = 0x00000010, 130 | RF_ArchetypeObject = 0x00000020, 131 | RF_Transient = 0x00000040, 132 | RF_MarkAsRootSet = 0x00000080, 133 | RF_TagGarbageTemp = 0x00000100, 134 | RF_NeedInitialization = 0x00000200, 135 | RF_NeedLoad = 0x00000400, 136 | RF_KeepForCooker = 0x00000800, 137 | RF_NeedPostLoad = 0x00001000, 138 | RF_NeedPostLoadSubobjects = 0x00002000, 139 | RF_NewerVersionExists = 0x00004000, 140 | RF_BeginDestroyed = 0x00008000, 141 | RF_FinishDestroyed = 0x00010000, 142 | RF_BeingRegenerated = 0x00020000, 143 | RF_DefaultSubObject = 0x00040000, 144 | RF_WasLoaded = 0x00080000, 145 | RF_TextExportTransient = 0x00100000, 146 | RF_LoadCompleted = 0x00200000, 147 | RF_InheritableComponentTemplate = 0x00400000, 148 | RF_DuplicateTransient = 0x00800000, 149 | RF_StrongRefOnFrame = 0x01000000, 150 | RF_NonPIEDuplicateTransient = 0x02000000, 151 | RF_Dynamic = 0x04000000, 152 | RF_WillBeLoaded = 0x08000000, 153 | }; 154 | 155 | // Property Types 156 | enum class EPropertyTypes : uint16_t 157 | { 158 | TYPE_UNKNOWN, 159 | TYPE_INT8, 160 | TYPE_INT16, 161 | TYPE_INT32, 162 | TYPE_INT64, 163 | TYPE_UINT8, 164 | TYPE_UINT16, 165 | TYPE_UINT32, 166 | TYPE_UINT64, 167 | TYPE_LONG, 168 | TYPE_ULONG, 169 | TYPE_DOUBLE, 170 | TYPE_FLOAT, 171 | TYPE_BOOL, 172 | TYPE_TARRAY, 173 | TYPE_TMAP, 174 | TYPE_FNAMEENTRY, 175 | TYPE_FNAME, 176 | TYPE_FSTRING, 177 | TYPE_FSCRIPTDELEGATE, 178 | TYPE_FPOINTER, 179 | TYPE_FSTRUCT, 180 | TYPE_UPOINTER 181 | }; 182 | 183 | /* 184 | # ========================================================================================= # 185 | # Classes 186 | # ========================================================================================= # 187 | */ 188 | 189 | template 190 | class TIterator 191 | { 192 | public: 193 | using ElementType = typename TArray::ElementType; 194 | using ElementPointer = ElementType*; 195 | using ElementReference = ElementType&; 196 | using ElementConstReference = const ElementType&; 197 | 198 | private: 199 | ElementPointer IteratorData; 200 | 201 | public: 202 | TIterator(ElementPointer inElementPointer) : IteratorData(inElementPointer) {} 203 | ~TIterator() {} 204 | 205 | public: 206 | TIterator& operator++() 207 | { 208 | IteratorData++; 209 | return *this; 210 | } 211 | 212 | TIterator operator++(int32_t) 213 | { 214 | TIterator iteratorCopy = *this; 215 | ++(*this); 216 | return iteratorCopy; 217 | } 218 | 219 | TIterator& operator--() 220 | { 221 | IteratorData--; 222 | return *this; 223 | } 224 | 225 | TIterator operator--(int32_t) 226 | { 227 | TIterator iteratorCopy = *this; 228 | --(*this); 229 | return iteratorCopy; 230 | } 231 | 232 | ElementReference operator[](int32_t index) 233 | { 234 | return *(IteratorData[index]); 235 | } 236 | 237 | ElementPointer operator->() 238 | { 239 | return IteratorData; 240 | } 241 | 242 | ElementReference operator*() 243 | { 244 | return *IteratorData; 245 | } 246 | 247 | public: 248 | bool operator==(const TIterator& other) const 249 | { 250 | return (IteratorData == other.IteratorData); 251 | } 252 | 253 | bool operator!=(const TIterator& other) const 254 | { 255 | return !(*this == other); 256 | } 257 | }; 258 | 259 | template 260 | class TArray 261 | { 262 | public: 263 | using ElementType = InElementType; 264 | using ElementPointer = ElementType*; 265 | using ElementReference = ElementType&; 266 | using ElementConstPointer = const ElementType*; 267 | using ElementConstReference = const ElementType&; 268 | using Iterator = TIterator>; 269 | 270 | private: 271 | ElementPointer ArrayData; 272 | int32_t ArrayCount; 273 | int32_t ArrayMax; 274 | 275 | public: 276 | TArray() : ArrayData(nullptr), ArrayCount(0), ArrayMax(0) 277 | { 278 | //ReAllocate(sizeof(ElementType)); 279 | } 280 | 281 | ~TArray() 282 | { 283 | //clear(); 284 | //::operator delete(ArrayData, ArrayMax * sizeof(ElementType)); 285 | } 286 | 287 | public: 288 | ElementConstReference operator[](int32_t index) const 289 | { 290 | return ArrayData[index]; 291 | } 292 | 293 | ElementReference operator[](int32_t index) 294 | { 295 | return ArrayData[index]; 296 | } 297 | 298 | ElementConstReference at(int32_t index) const 299 | { 300 | return ArrayData[index]; 301 | } 302 | 303 | ElementReference at(int32_t index) 304 | { 305 | return ArrayData[index]; 306 | } 307 | 308 | ElementConstPointer data() const 309 | { 310 | return ArrayData; 311 | } 312 | 313 | void push_back(ElementConstReference newElement) 314 | { 315 | if (ArrayCount >= ArrayMax) 316 | { 317 | ReAllocate(sizeof(ElementType) * (ArrayCount + 1)); 318 | } 319 | 320 | new(&ArrayData[ArrayCount]) ElementType(newElement); 321 | ArrayCount++; 322 | } 323 | 324 | void push_back(ElementReference& newElement) 325 | { 326 | if (ArrayCount >= ArrayMax) 327 | { 328 | ReAllocate(sizeof(ElementType) * (ArrayCount + 1)); 329 | } 330 | 331 | new(&ArrayData[ArrayCount]) ElementType(newElement); 332 | ArrayCount++; 333 | } 334 | 335 | void pop_back() 336 | { 337 | if (ArrayCount > 0) 338 | { 339 | ArrayCount--; 340 | ArrayData[ArrayCount].~ElementType(); 341 | } 342 | } 343 | 344 | void clear() 345 | { 346 | for (int32_t i = 0; i < ArrayCount; i++) 347 | { 348 | ArrayData[i].~ElementType(); 349 | } 350 | 351 | ArrayCount = 0; 352 | } 353 | 354 | int32_t size() const 355 | { 356 | return ArrayCount; 357 | } 358 | 359 | int32_t capacity() const 360 | { 361 | return ArrayMax; 362 | } 363 | 364 | bool empty() const 365 | { 366 | if (ArrayData) 367 | { 368 | return (size() == 0); 369 | } 370 | 371 | return true; 372 | } 373 | 374 | Iterator begin() 375 | { 376 | return Iterator(ArrayData); 377 | } 378 | 379 | Iterator end() 380 | { 381 | return Iterator(ArrayData + ArrayCount); 382 | } 383 | 384 | private: 385 | void ReAllocate(int32_t newArrayMax) 386 | { 387 | ElementPointer newArrayData = (ElementPointer)::operator new(newArrayMax * sizeof(ElementType)); 388 | int32_t newNum = ArrayCount; 389 | 390 | if (newArrayMax < newNum) 391 | { 392 | newNum = newArrayMax; 393 | } 394 | 395 | for (int32_t i = 0; i < newNum; i++) 396 | { 397 | new(newArrayData + i) ElementType(std::move(ArrayData[i])); 398 | } 399 | 400 | for (int32_t i = 0; i < ArrayCount; i++) 401 | { 402 | ArrayData[i].~ElementType(); 403 | } 404 | 405 | ::operator delete(ArrayData, ArrayMax * sizeof(ElementType)); 406 | ArrayData = newArrayData; 407 | ArrayMax = newArrayMax; 408 | } 409 | }; 410 | 411 | // THIS CLASS CAN BE GAME SPECIFIC, MOST GAMES WILL GENERATE A STRUCT MIRROR; JUST PASTE THE FIELDS HERE IF SO. 412 | template 413 | class TMap 414 | { 415 | private: 416 | struct TPair 417 | { 418 | TKey Key; 419 | TValue Value; 420 | int32_t* HashNext; 421 | }; 422 | 423 | public: 424 | using ElementType = TPair; 425 | using ElementPointer = ElementType*; 426 | using ElementReference = ElementType&; 427 | using ElementConstReference = const ElementType&; 428 | using Iterator = TIterator>; 429 | 430 | public: 431 | TArray Elements; // 0x0000 (0x0010) 432 | uintptr_t IndirectData; // 0x0010 (0x0008) 433 | int32_t InlineData[0x4]; // 0x0018 (0x0010) 434 | int32_t NumBits; // 0x0028 (0x0004) 435 | int32_t MaxBits; // 0x002C (0x0004) 436 | int32_t FirstFreeIndex; // 0x0030 (0x0004) 437 | int32_t NumFreeIndices; // 0x0034 (0x0004) 438 | int64_t InlineHash; // 0x0038 (0x0008) 439 | int32_t* Hash; // 0x0040 (0x0008) 440 | int32_t HashCount; // 0x0048 (0x0004) 441 | 442 | public: 443 | TMap() : 444 | IndirectData(NULL), 445 | NumBits(0), 446 | MaxBits(0), 447 | FirstFreeIndex(0), 448 | NumFreeIndices(0), 449 | InlineHash(0), 450 | Hash(nullptr), 451 | HashCount(0) 452 | { 453 | 454 | } 455 | 456 | TMap(struct FMap_Mirror& other) : 457 | IndirectData(NULL), 458 | NumBits(0), 459 | MaxBits(0), 460 | FirstFreeIndex(0), 461 | NumFreeIndices(0), 462 | InlineHash(0), 463 | Hash(nullptr), 464 | HashCount(0) 465 | { 466 | assign(other); 467 | } 468 | 469 | TMap(const TMap& other) : 470 | IndirectData(NULL), 471 | NumBits(0), 472 | MaxBits(0), 473 | FirstFreeIndex(0), 474 | NumFreeIndices(0), 475 | InlineHash(0), 476 | Hash(nullptr), 477 | HashCount(0) 478 | { 479 | assign(other); 480 | } 481 | 482 | ~TMap() {} 483 | 484 | public: 485 | TMap& assign(struct FMap_Mirror& other) 486 | { 487 | *this = *reinterpret_cast*>(&other); 488 | return *this; 489 | } 490 | 491 | TMap& assign(const TMap& other) 492 | { 493 | Elements = other.Elements; 494 | IndirectData = other.IndirectData; 495 | InlineData[0] = other.InlineData[0]; 496 | InlineData[1] = other.InlineData[1]; 497 | InlineData[2] = other.InlineData[2]; 498 | InlineData[3] = other.InlineData[3]; 499 | NumBits = other.NumBits; 500 | MaxBits = other.MaxBits; 501 | FirstFreeIndex = other.FirstFreeIndex; 502 | NumFreeIndices = other.NumFreeIndices; 503 | InlineHash = other.InlineHash; 504 | Hash = other.Hash; 505 | HashCount = other.HashCount; 506 | return *this; 507 | } 508 | 509 | TValue& at(const TKey& key) 510 | { 511 | for (TPair& pair : Elements) 512 | { 513 | if (pair.Key == key) 514 | { 515 | return pair.Value; 516 | } 517 | } 518 | } 519 | 520 | const TValue& at(const TKey& key) const 521 | { 522 | for (const TPair& pair : Elements) 523 | { 524 | if (pair.Key == key) 525 | { 526 | return pair.Value; 527 | } 528 | } 529 | } 530 | 531 | TPair& at_index(int32_t index) 532 | { 533 | return Elements[index]; 534 | } 535 | 536 | const TPair& at_index(int32_t index) const 537 | { 538 | return Elements[index]; 539 | } 540 | 541 | int32_t size() const 542 | { 543 | return Elements.size(); 544 | } 545 | 546 | int32_t capacity() const 547 | { 548 | return Elements.capacity(); 549 | } 550 | 551 | bool empty() const 552 | { 553 | return Elements.empty(); 554 | } 555 | 556 | Iterator begin() 557 | { 558 | return Elements.begin(); 559 | } 560 | 561 | Iterator end() 562 | { 563 | return Elements.end(); 564 | } 565 | 566 | public: 567 | TValue& operator[](const TKey& key) 568 | { 569 | return at(key); 570 | } 571 | 572 | const TValue& operator[](const TKey& key) const 573 | { 574 | return at(key); 575 | } 576 | 577 | TMap& operator=(const struct FMap_Mirror& other) 578 | { 579 | return assign(other); 580 | } 581 | 582 | TMap& operator=(const TMap& other) 583 | { 584 | return assign(other); 585 | } 586 | }; 587 | 588 | /* 589 | # ========================================================================================= # 590 | # Globals 591 | # ========================================================================================= # 592 | */ 593 | 594 | extern TArray* GObjects; 595 | extern TArray* GNames; 596 | 597 | /* 598 | # ========================================================================================= # 599 | # Structs 600 | # ========================================================================================= # 601 | */ 602 | 603 | // FNameEntry 604 | // (0x0000 - 0x000C) 605 | struct FNameEntry 606 | { 607 | public: 608 | uint64_t Flags; REGISTER_MEMBER(uint64_t, Flags, EMemberTypes::FNAMEENTRY_FLAGS) // 0x0000 (0x08) 609 | int32_t Index; REGISTER_MEMBER(int32_t, Index, EMemberTypes::FNAMEENTRY_INDEX) // 0x0008 (0x04) 610 | 611 | #ifdef UTF16 612 | wchar_t Name[0x400]; REGISTER_MEMBER(wchar_t, Name, EMemberTypes::FNAMEENTRY_NAME) // 0x000C (0x00) 613 | #else 614 | char Name[0x400]; REGISTER_MEMBER(char, Name, EMemberTypes::FNAMEENTRY_NAME) // 0x000C (0x00) 615 | #endif 616 | 617 | public: 618 | FNameEntry() : Flags(0), Index(-1) {} 619 | ~FNameEntry() {} 620 | 621 | public: 622 | uint64_t GetFlags() const 623 | { 624 | return Flags; 625 | } 626 | 627 | int32_t GetIndex() const 628 | { 629 | return Index; 630 | } 631 | 632 | #ifdef UTF16 633 | const wchar_t* GetWideName() const 634 | { 635 | return Name; 636 | } 637 | 638 | std::wstring ToWideString() const 639 | { 640 | const wchar_t* wideName = GetWideName(); 641 | 642 | if (wideName) 643 | { 644 | return std::wstring(wideName); 645 | } 646 | 647 | return L""; 648 | } 649 | 650 | std::string ToString() const 651 | { 652 | std::wstring wstr = ToWideString(); 653 | std::string str(wstr.begin(), wstr.end()); 654 | return str; 655 | } 656 | #else 657 | const char* GetAnsiName() const 658 | { 659 | return Name; 660 | } 661 | 662 | std::string ToString() const 663 | { 664 | return std::string(Name); 665 | } 666 | #endif 667 | }; 668 | 669 | // FName 670 | // (0x0000 - 0x0008) 671 | struct FName 672 | { 673 | public: 674 | #ifdef UTF16 675 | using ElementType = const wchar_t; 676 | #else 677 | using ElementType = const char; 678 | #endif 679 | using ElementPointer = ElementType*; 680 | 681 | private: 682 | int32_t FNameEntryId; // 0x0000 (0x04) 683 | int32_t InstanceNumber; // 0x0004 (0x04) 684 | 685 | public: 686 | FName() : FNameEntryId(-1), InstanceNumber(0) {} 687 | 688 | FName(int32_t id) : FNameEntryId(id), InstanceNumber(0) {} 689 | 690 | #ifdef UTF16 691 | FName(const ElementPointer nameToFind) : FNameEntryId(-1), InstanceNumber(0) 692 | { 693 | static std::vector foundNames{}; 694 | 695 | for (int32_t entryId : foundNames) 696 | { 697 | if (Names()->at(entryId)) 698 | { 699 | if (!wcscmp(Names()->at(entryId)->Name, nameToFind)) 700 | { 701 | FNameEntryId = entryId; 702 | return; 703 | } 704 | } 705 | } 706 | 707 | for (int32_t i = 0; i < Names()->size(); i++) 708 | { 709 | if (Names()->at(i)) 710 | { 711 | if (!wcscmp(Names()->at(i)->Name, nameToFind)) 712 | { 713 | foundNames.push_back(i); 714 | FNameEntryId = i; 715 | return; 716 | } 717 | } 718 | } 719 | } 720 | #else 721 | FName(ElementPointer nameToFind) : FNameEntryId(-1), InstanceNumber(0) 722 | { 723 | static std::vector nameCache{}; 724 | 725 | for (int32_t entryId : nameCache) 726 | { 727 | if (Names()->at(entryId)) 728 | { 729 | if (!strcmp(Names()->at(entryId)->Name, nameToFind)) 730 | { 731 | FNameEntryId = entryId; 732 | return; 733 | } 734 | } 735 | } 736 | 737 | for (int32_t i = 0; i < Names()->size(); i++) 738 | { 739 | if (Names()->at(i)) 740 | { 741 | if (!strcmp(Names()->at(i)->Name, nameToFind)) 742 | { 743 | nameCache.push_back(i); 744 | FNameEntryId = i; 745 | } 746 | } 747 | } 748 | } 749 | #endif 750 | 751 | FName(const FName& name) : FNameEntryId(name.FNameEntryId), InstanceNumber(name.InstanceNumber) {} 752 | 753 | ~FName() {} 754 | 755 | public: 756 | static TArray* Names() 757 | { 758 | TArray* recastedArray = reinterpret_cast*>(GNames); 759 | return recastedArray; 760 | } 761 | 762 | int32_t GetDisplayIndex() const 763 | { 764 | return FNameEntryId; 765 | } 766 | 767 | const FNameEntry GetDisplayNameEntry() const 768 | { 769 | if (IsValid()) 770 | { 771 | return *Names()->at(FNameEntryId); 772 | } 773 | 774 | return FNameEntry(); 775 | } 776 | 777 | FNameEntry* GetEntry() 778 | { 779 | if (IsValid()) 780 | { 781 | return Names()->at(FNameEntryId); 782 | } 783 | 784 | return nullptr; 785 | } 786 | 787 | int32_t GetInstance() const 788 | { 789 | return InstanceNumber; 790 | } 791 | 792 | void SetInstance(int32_t newNumber) 793 | { 794 | InstanceNumber = newNumber; 795 | } 796 | 797 | std::string ToString() const 798 | { 799 | if (IsValid()) 800 | { 801 | return GetDisplayNameEntry().ToString(); 802 | } 803 | 804 | return "UnknownName"; 805 | } 806 | 807 | bool IsValid() const 808 | { 809 | if ((FNameEntryId < 0 || FNameEntryId > Names()->size())) 810 | { 811 | return false; 812 | } 813 | 814 | return true; 815 | } 816 | 817 | public: 818 | FName& operator=(const FName& other) 819 | { 820 | FNameEntryId = other.FNameEntryId; 821 | InstanceNumber = other.InstanceNumber; 822 | return *this; 823 | } 824 | 825 | bool operator==(const FName& other) const 826 | { 827 | return (FNameEntryId == other.FNameEntryId); 828 | } 829 | 830 | bool operator!=(const FName& other) const 831 | { 832 | return (FNameEntryId != other.FNameEntryId); 833 | } 834 | }; 835 | 836 | // FString 837 | // (0x0000 - 0x0010) 838 | class FString 839 | { 840 | public: 841 | #ifdef UTF16 842 | using ElementType = const wchar_t; 843 | #else 844 | using ElementType = const char; 845 | #endif 846 | using ElementPointer = ElementType*; 847 | 848 | private: 849 | ElementPointer ArrayData; // 0x0000 (0x08) 850 | int32_t ArrayCount; // 0x0008 (0x04) 851 | int32_t ArrayMax; // 0x000C (0x04) 852 | 853 | public: 854 | FString() : ArrayData(nullptr), ArrayCount(0), ArrayMax(0) {} 855 | 856 | FString(ElementPointer other) : ArrayData(nullptr), ArrayCount(0), ArrayMax(0) { assign(other); } 857 | 858 | ~FString() {} 859 | 860 | public: 861 | #ifdef UTF16 862 | FString& assign(ElementPointer other) 863 | { 864 | ArrayCount = (other ? (wcslen(other) + 1) : 0); 865 | ArrayMax = ArrayCount; 866 | ArrayData = (ArrayCount > 0 ? other : nullptr); 867 | return *this; 868 | } 869 | 870 | std::wstring ToWideString() const 871 | { 872 | if (!empty()) 873 | { 874 | return std::wstring(c_str()); 875 | } 876 | 877 | return L""; 878 | } 879 | 880 | std::string ToString() const 881 | { 882 | if (!empty()) 883 | { 884 | std::wstring wstr = ToWideString(); 885 | return std::string(wstr.begin(), wstr.end()); 886 | } 887 | 888 | return ""; 889 | } 890 | #else 891 | FString& assign(ElementPointer other) 892 | { 893 | ArrayCount = (other ? (strlen(other) + 1) : 0); 894 | ArrayMax = ArrayCount; 895 | ArrayData = (ArrayCount > 0 ? other : nullptr); 896 | return *this; 897 | } 898 | 899 | std::string ToString() const 900 | { 901 | if (!empty()) 902 | { 903 | return std::string(ArrayData); 904 | } 905 | 906 | return ""; 907 | } 908 | #endif 909 | 910 | ElementPointer c_str() const 911 | { 912 | return ArrayData; 913 | } 914 | 915 | bool empty() const 916 | { 917 | if (ArrayData) 918 | { 919 | return (ArrayCount == 0); 920 | } 921 | 922 | return true; 923 | } 924 | 925 | int32_t length() const 926 | { 927 | return ArrayCount; 928 | } 929 | 930 | int32_t size() const 931 | { 932 | return ArrayMax; 933 | } 934 | 935 | public: 936 | FString& operator=(ElementPointer other) 937 | { 938 | return assign(other); 939 | } 940 | 941 | FString& operator=(const FString& other) 942 | { 943 | return assign(other.c_str()); 944 | } 945 | 946 | #ifdef UTF16 947 | bool operator==(const FString& other) 948 | { 949 | return (!wcscmp(ArrayData, other.ArrayData)); 950 | } 951 | 952 | bool operator!=(const FString& other) 953 | { 954 | return (wcscmp(ArrayData, other.ArrayData)); 955 | } 956 | #else 957 | bool operator==(const FString& other) 958 | { 959 | return (!strcmp(ArrayData, other.ArrayData)); 960 | } 961 | 962 | bool operator!=(const FString& other) 963 | { 964 | return (strcmp(ArrayData, other.ArrayData)); 965 | } 966 | #endif 967 | }; 968 | 969 | // FScriptDelegate [THIS STRUCT CAN BE GAME SPECIFIC, YOU'LL HAVE TO REVERSE IT BY HAND] 970 | // (0x0000 - 0x0009) 971 | struct FScriptDelegate 972 | { 973 | class UObject* Object; // 0x0000 (0x08) 974 | uint8_t UnknownData[0x1]; // 0x0008 (0x01) 975 | }; 976 | 977 | // FPointer 978 | // (0x0000 - 0x0008) 979 | struct FPointer 980 | { 981 | uintptr_t Dummy; 982 | }; 983 | 984 | // FQWord 985 | // (0x0000 - 0x0008) 986 | struct FQWord 987 | { 988 | int32_t A; 989 | int32_t B; 990 | }; 991 | 992 | /* 993 | # ========================================================================================= # 994 | # Classes 995 | # ========================================================================================= # 996 | */ 997 | 998 | // Class Core.Object 999 | // (0x0000 - 0x0034) 1000 | class UObject 1001 | { 1002 | public: 1003 | struct FPointer VfTableObject; REGISTER_MEMBER(FPointer, VfTableObject, EMemberTypes::UOBJECT_VFTABLE) // 0x0000 (0x08) 1004 | uint8_t UnknownData00[0x10]; // Example of padding, you do not need to register this because offsets are all automatically calculated. 1005 | int32_t ObjectInternalInteger; REGISTER_MEMBER(int32_t, ObjectInternalInteger, EMemberTypes::UOBJECT_INDEX) // 0x0018 (0x04) 1006 | class UObject* Outer; REGISTER_MEMBER(class UObject*, Outer, EMemberTypes::UOBJECT_OUTER) // 0x001C (0x08) 1007 | struct FName Name; REGISTER_MEMBER(FName, Name, EMemberTypes::UOBJECT_NAME) // 0x0024 (0x08) 1008 | class UClass* Class; REGISTER_MEMBER(class UClass*, Class, EMemberTypes::UOBJECT_CLASS) // 0x002C (0x08) 1009 | 1010 | public: 1011 | static UClass* StaticClass() 1012 | { 1013 | static UClass* uClassPointer = nullptr; 1014 | 1015 | if (!uClassPointer) 1016 | { 1017 | uClassPointer = UObject::FindClass("Class Core.Object"); 1018 | } 1019 | 1020 | return uClassPointer; 1021 | } 1022 | 1023 | static TArray* GObjObjects(); 1024 | 1025 | std::string GetName(); 1026 | std::string GetNameCPP(); 1027 | std::string GetFullName(); 1028 | std::string GetPackageName(); 1029 | class UObject* GetPackageObj(); 1030 | template static T* FindObject(const std::string& objectFullName) 1031 | { 1032 | for (UObject* uObject : *UObject::GObjObjects()) 1033 | { 1034 | if (uObject && uObject->IsA()) 1035 | { 1036 | if (uObject->GetFullName() == objectFullName) 1037 | { 1038 | return static_cast(uObject); 1039 | } 1040 | } 1041 | } 1042 | 1043 | return nullptr; 1044 | } 1045 | template static uint32_t CountObject(const std::string& objectName) 1046 | { 1047 | static std::map countCache; 1048 | 1049 | if (countCache.find(objectName) == countCache.end()) 1050 | { 1051 | countCache[objectName] = 0; 1052 | 1053 | for (UObject* uObject : *UObject::GObjObjects()) 1054 | { 1055 | if (uObject && uObject->IsA()) 1056 | { 1057 | if (uObject->GetName() == objectName) 1058 | { 1059 | countCache[uObject->GetName()]++; 1060 | } 1061 | } 1062 | } 1063 | } 1064 | 1065 | return countCache[objectName]; 1066 | } 1067 | static class UClass* FindClass(const std::string& classFullName); 1068 | template bool IsA() 1069 | { 1070 | if (std::is_base_of::value) 1071 | { 1072 | return IsA(T::StaticClass()); 1073 | } 1074 | } 1075 | bool IsA(class UClass* uClass); 1076 | bool IsA(int32_t objInternalInteger); 1077 | }; 1078 | 1079 | //Class Core.Field 1080 | // 0x0010 (0x0034 - 0x0044) 1081 | class UField : public UObject 1082 | { 1083 | public: 1084 | class UField* Next; REGISTER_MEMBER(class UField*, Next, EMemberTypes::UFIELD_NEXT) // 0x0034 (0x08) 1085 | class UField* SuperField; REGISTER_MEMBER(class UField*, SuperField, EMemberTypes::UFIELD_SUPERFIELD) // 0x003C (0x08) [SUPERFIELD CAN EITHER BE HERE, OR IN USTRUCT DPENDING ON THE GAME!] 1086 | 1087 | public: 1088 | static UClass* StaticClass() 1089 | { 1090 | static UClass* uClassPointer = nullptr; 1091 | 1092 | if (!uClassPointer) 1093 | { 1094 | uClassPointer = UObject::FindClass("Class Core.Field"); 1095 | } 1096 | 1097 | return uClassPointer; 1098 | }; 1099 | }; 1100 | 1101 | // Class Core.Enum 1102 | // 0x0010 (0x0044 - 0x0054) 1103 | class UEnum : public UField 1104 | { 1105 | public: 1106 | TArray Names; REGISTER_MEMBER(TArray, Names, EMemberTypes::UENUM_NAMES) // 0x0044 (0x10) 1107 | 1108 | public: 1109 | static UClass* StaticClass() 1110 | { 1111 | static UClass* uClassPointer = nullptr; 1112 | 1113 | if (!uClassPointer) 1114 | { 1115 | uClassPointer = UObject::FindClass("Class Core.Enum"); 1116 | } 1117 | 1118 | return uClassPointer; 1119 | }; 1120 | }; 1121 | 1122 | // Class Core.Const 1123 | // 0x0010 (0x0044 - 0x0054) 1124 | class UConst : public UField 1125 | { 1126 | public: 1127 | class FString Value; REGISTER_MEMBER(FString, Value, EMemberTypes::UCONST_VALUE) // 0x0044 (0x10) 1128 | 1129 | public: 1130 | static UClass* StaticClass() 1131 | { 1132 | static UClass* uClassPointer = nullptr; 1133 | 1134 | if (!uClassPointer) 1135 | { 1136 | uClassPointer = UObject::FindClass("Class Core.Const"); 1137 | } 1138 | 1139 | return uClassPointer; 1140 | }; 1141 | }; 1142 | 1143 | // Class Core.Property 1144 | // 0x0014 (0x0044 - 0x0058) 1145 | class UProperty : public UField 1146 | { 1147 | public: 1148 | uint32_t ArrayDim; REGISTER_MEMBER(uint32_t, ArrayDim, EMemberTypes::UPROPERTY_DIMENSION) // 0x0044 (0x04) 1149 | uint32_t ElementSize; REGISTER_MEMBER(uint32_t, ElementSize, EMemberTypes::UPROPERTY_SIZE) // 0x0048 (0x04) 1150 | uint64_t PropertyFlags; REGISTER_MEMBER(uint64_t, PropertyFlags, EMemberTypes::UPROPERTY_FLAGS) // 0x004C (0x08) 1151 | uint32_t Offset; REGISTER_MEMBER(uint32_t, Offset, EMemberTypes::UPROPERTY_OFFSET) // 0x0054 (0x04) 1152 | 1153 | public: 1154 | static UClass* StaticClass() 1155 | { 1156 | static UClass* uClassPointer = nullptr; 1157 | 1158 | if (!uClassPointer) 1159 | { 1160 | uClassPointer = UObject::FindClass("Class Core.Property"); 1161 | } 1162 | 1163 | return uClassPointer; 1164 | }; 1165 | }; 1166 | 1167 | // Class Core.Struct 1168 | // 0x0014 (0x0044 - 0x0058) 1169 | class UStruct : public UField 1170 | { 1171 | public: 1172 | //class UField* SuperField; REGISTER_MEMBER(class UField*, SuperField, EMemberTypes::USTRUCT_SUPERFIELD) // 0x0044 (0x08) [SUPERFIELD CAN EITHER BE HERE, OR IN UFIELD DPENDING ON THE GAME. COMMENT OUT ACCORDINGLY!] 1173 | class UField* Children; REGISTER_MEMBER(class UField*, Children, EMemberTypes::USTRUCT_CHILDREN) // 0x004C (0x08) 1174 | uint32_t PropertySize; REGISTER_MEMBER(uint32_t, PropertySize, EMemberTypes::USTRUCT_SIZE) // 0x0054 (0x04) 1175 | 1176 | public: 1177 | static UClass* StaticClass() 1178 | { 1179 | static UClass* uClassPointer = nullptr; 1180 | 1181 | if (!uClassPointer) 1182 | { 1183 | uClassPointer = UObject::FindClass("Class Core.Struct"); 1184 | } 1185 | 1186 | return uClassPointer; 1187 | }; 1188 | }; 1189 | 1190 | // Class Core.Function 1191 | // 0x000A (0x0058 - 0x0062) 1192 | class UFunction : public UStruct 1193 | { 1194 | public: 1195 | uint64_t FunctionFlags; REGISTER_MEMBER(uint64_t, FunctionFlags, EMemberTypes::UFUNCTION_FLAGS) // 0x0058 (0x08) 1196 | uint16_t iNative; REGISTER_MEMBER(uint16_t, iNative, EMemberTypes::UFUNCTION_NATIVE) // 0x0060 (0x02) 1197 | 1198 | public: 1199 | static UClass* StaticClass() 1200 | { 1201 | static UClass* uClassPointer = nullptr; 1202 | 1203 | if (!uClassPointer) 1204 | { 1205 | uClassPointer = UObject::FindClass("Class Core.Function"); 1206 | } 1207 | 1208 | return uClassPointer; 1209 | }; 1210 | 1211 | static UFunction* FindFunction(const std::string& functionFullName); 1212 | }; 1213 | 1214 | // Class Core.ScriptStruct 1215 | // 0x0001 (0x0058 - 0x0059) 1216 | class UScriptStruct : public UStruct 1217 | { 1218 | public: 1219 | uint8_t UnknownData00[0x01]; // 0x0058 (0x01) [USE THIS CLASSES PROPERTYSIZE IN RECLASS TO DETERMINE THE SIZE OF THE UNKNOWNDATA] 1220 | 1221 | public: 1222 | static UClass* StaticClass() 1223 | { 1224 | static UClass* uClassPointer = nullptr; 1225 | 1226 | if (!uClassPointer) 1227 | { 1228 | uClassPointer = UObject::FindClass("Class Core.ScriptStruct"); 1229 | } 1230 | 1231 | return uClassPointer; 1232 | }; 1233 | }; 1234 | 1235 | // Class Core.State 1236 | // 0x0001 (0x0058 - 0x0059) 1237 | class UState : public UStruct 1238 | { 1239 | public: 1240 | uint8_t UnknownData00[0x01]; // 0x0058 (0x01) [USE THIS CLASSES PROPERTYSIZE IN RECLASS TO DETERMINE THE SIZE OF THE UNKNOWNDATA] 1241 | 1242 | public: 1243 | static UClass* StaticClass() 1244 | { 1245 | static UClass* uClassPointer = nullptr; 1246 | 1247 | if (!uClassPointer) 1248 | { 1249 | uClassPointer = UObject::FindClass("Class Core.State"); 1250 | } 1251 | 1252 | return uClassPointer; 1253 | }; 1254 | }; 1255 | 1256 | // Class Core.Class 1257 | // 0x0001 (0x0058 - 0x0059) 1258 | class UClass : public UState 1259 | { 1260 | public: 1261 | uint8_t UnknownData00[0x01]; // 0x0058 (0x00) [USE THIS CLASSES PROPERTYSIZE IN RECLASS TO DETERMINE THE SIZE OF THE UNKNOWNDATA] 1262 | 1263 | public: 1264 | static UClass* StaticClass() 1265 | { 1266 | static UClass* uClassPointer = nullptr; 1267 | 1268 | if (!uClassPointer) 1269 | { 1270 | uClassPointer = UObject::FindClass("Class Core.Class"); 1271 | } 1272 | 1273 | return uClassPointer; 1274 | }; 1275 | }; 1276 | 1277 | /* 1278 | # ========================================================================================= # 1279 | # Property Sub Classes 1280 | # ========================================================================================= # 1281 | */ 1282 | 1283 | //Class Core.StructProperty 1284 | // 0x0008 (0x0058 - 0x0060) 1285 | class UStructProperty : public UProperty 1286 | { 1287 | public: 1288 | class UStruct* Struct; REGISTER_MEMBER(class UStruct*, Struct, EMemberTypes::USTRUCTPROPERTY_STRUCT) // 0x0058 (0x08) 1289 | 1290 | public: 1291 | static UClass* StaticClass() 1292 | { 1293 | static UClass* uClassPointer = nullptr; 1294 | 1295 | if (!uClassPointer) 1296 | { 1297 | uClassPointer = UObject::FindClass("Class Core.StructProperty"); 1298 | } 1299 | 1300 | return uClassPointer; 1301 | }; 1302 | }; 1303 | 1304 | // Class Core.StrProperty 1305 | // 0x0000 (0x0058 - 0x0058) 1306 | class UStrProperty : public UProperty 1307 | { 1308 | public: 1309 | static UClass* StaticClass() 1310 | { 1311 | static UClass* uClassPointer = nullptr; 1312 | 1313 | if (!uClassPointer) 1314 | { 1315 | uClassPointer = UObject::FindClass("Class Core.StrProperty"); 1316 | } 1317 | 1318 | return uClassPointer; 1319 | }; 1320 | }; 1321 | 1322 | // Class Core.QWordProperty 1323 | // 0x0000 (0x0058 - 0x0058) 1324 | class UQWordProperty : public UProperty 1325 | { 1326 | public: 1327 | static UClass* StaticClass() 1328 | { 1329 | static UClass* uClassPointer = nullptr; 1330 | 1331 | if (!uClassPointer) 1332 | { 1333 | uClassPointer = UObject::FindClass("Class Core.QWordProperty"); 1334 | } 1335 | 1336 | return uClassPointer; 1337 | }; 1338 | }; 1339 | 1340 | // Class Core.ObjectProperty 1341 | // 0x0008 (0x0058 - 0x0060) 1342 | class UObjectProperty : public UProperty 1343 | { 1344 | public: 1345 | class UClass* PropertyClass; REGISTER_MEMBER(class UClass*, PropertyClass, EMemberTypes::UOBJECTPROPERTY_PROPERTY) // 0x0058 (0x08) 1346 | 1347 | public: 1348 | static UClass* StaticClass() 1349 | { 1350 | static UClass* uClassPointer = nullptr; 1351 | 1352 | if (!uClassPointer) 1353 | { 1354 | uClassPointer = UObject::FindClass("Class Core.ObjectProperty"); 1355 | } 1356 | 1357 | return uClassPointer; 1358 | }; 1359 | }; 1360 | 1361 | // Class Core.ComponentProperty 1362 | // 0x0000 (0x0058 - 0x0058) 1363 | class UComponentProperty : public UObjectProperty 1364 | { 1365 | public: 1366 | static UClass* StaticClass() 1367 | { 1368 | static UClass* uClassPointer = nullptr; 1369 | 1370 | if (!uClassPointer) 1371 | { 1372 | uClassPointer = UObject::FindClass("Class Core.ComponentProperty"); 1373 | } 1374 | 1375 | return uClassPointer; 1376 | }; 1377 | }; 1378 | 1379 | // Class Core.ClassProperty 1380 | // 0x0008 (0x0058 - 0x0060) 1381 | class UClassProperty : public UObjectProperty 1382 | { 1383 | public: 1384 | class UClass* MetaClass; REGISTER_MEMBER(class UClass*, MetaClass, EMemberTypes::UCLASSPROPERTY_METACLASS) // 0x0058 (0x08) 1385 | 1386 | public: 1387 | static UClass* StaticClass() 1388 | { 1389 | static UClass* uClassPointer = nullptr; 1390 | 1391 | if (!uClassPointer) 1392 | { 1393 | uClassPointer = UObject::FindClass("Class Core.ClassProperty"); 1394 | } 1395 | 1396 | return uClassPointer; 1397 | }; 1398 | }; 1399 | 1400 | // Class Core.NameProperty 1401 | // 0x0000 (0x0058 - 0x0000) 1402 | class UNameProperty : public UProperty 1403 | { 1404 | public: 1405 | static UClass* StaticClass() 1406 | { 1407 | static UClass* uClassPointer = nullptr; 1408 | 1409 | if (!uClassPointer) 1410 | { 1411 | uClassPointer = UObject::FindClass("Class Core.NameProperty"); 1412 | } 1413 | 1414 | return uClassPointer; 1415 | }; 1416 | }; 1417 | 1418 | // Class Core.MapProperty 1419 | // 0x0010 (0x0058 - 0x0068) 1420 | class UMapProperty : public UProperty 1421 | { 1422 | public: 1423 | class UProperty* Key; REGISTER_MEMBER(class UProperty*, Key, EMemberTypes::UMAPPROPERTY_KEY) // 0x0058 (0x08) 1424 | class UProperty* Value; REGISTER_MEMBER(class UProperty*, Value, EMemberTypes::UMAPPROPERTY_VALUE) // 0x0060 (0x08) 1425 | 1426 | public: 1427 | static UClass* StaticClass() 1428 | { 1429 | static UClass* uClassPointer = nullptr; 1430 | 1431 | if (!uClassPointer) 1432 | { 1433 | uClassPointer = UObject::FindClass("Class Core.MapProperty"); 1434 | } 1435 | 1436 | return uClassPointer; 1437 | }; 1438 | }; 1439 | 1440 | // Class Core.IntProperty 1441 | // 0x0000 (0x0058 - 0x0058) 1442 | class UIntProperty : public UProperty 1443 | { 1444 | public: 1445 | public: 1446 | static UClass* StaticClass() 1447 | { 1448 | static UClass* uClassPointer = nullptr; 1449 | 1450 | if (!uClassPointer) 1451 | { 1452 | uClassPointer = UObject::FindClass("Class Core.IntProperty"); 1453 | } 1454 | 1455 | return uClassPointer; 1456 | }; 1457 | }; 1458 | 1459 | // Class Core.InterfaceProperty 1460 | // 0x0008 (0x0058 - 0x0060) 1461 | class UInterfaceProperty : public UProperty 1462 | { 1463 | public: 1464 | class UClass* InterfaceClass; REGISTER_MEMBER(class UClass*, InterfaceClass, EMemberTypes::UINTERFACEPROPERTY_CLASS) // 0x0058 (0x08) 1465 | 1466 | public: 1467 | static UClass* StaticClass() 1468 | { 1469 | static UClass* uClassPointer = nullptr; 1470 | 1471 | if (!uClassPointer) 1472 | { 1473 | uClassPointer = UObject::FindClass("Class Core.InterfaceProperty"); 1474 | } 1475 | 1476 | return uClassPointer; 1477 | }; 1478 | }; 1479 | 1480 | // Class Core.FloatProperty 1481 | // 0x0000 (0x0058 - 0x0058) 1482 | class UFloatProperty : public UProperty 1483 | { 1484 | public: 1485 | public: 1486 | static UClass* StaticClass() 1487 | { 1488 | static UClass* uClassPointer = nullptr; 1489 | 1490 | if (!uClassPointer) 1491 | { 1492 | uClassPointer = UObject::FindClass("Class Core.FloatProperty"); 1493 | } 1494 | 1495 | return uClassPointer; 1496 | }; 1497 | }; 1498 | 1499 | // Class Core.DelegateProperty 1500 | // 0x0010 (0x0058 - 0x0068) 1501 | class UDelegateProperty : public UProperty 1502 | { 1503 | public: 1504 | class UFuncton* DelegateFunction; REGISTER_MEMBER(class UFuncton*, Function, EMemberTypes::UDELEGATEPROPERTY_FUNCTION) // 0x0058 (0x08) 1505 | struct FName DelegateName; REGISTER_MEMBER(FName, DelegateName, EMemberTypes::UDELEGATEPROPERTY_NAME) // 0x0060 (0x08) 1506 | 1507 | public: 1508 | static UClass* StaticClass() 1509 | { 1510 | static UClass* uClassPointer = nullptr; 1511 | 1512 | if (!uClassPointer) 1513 | { 1514 | uClassPointer = UObject::FindClass("Class Core.DelegateProperty"); 1515 | } 1516 | 1517 | return uClassPointer; 1518 | }; 1519 | }; 1520 | 1521 | // Class Core.ByteProperty 1522 | // 0x0008 (0x0058 - 0x0060) 1523 | class UByteProperty : public UProperty 1524 | { 1525 | public: 1526 | class UEnum* Enum; REGISTER_MEMBER(class UEnum*, Enum, EMemberTypes::UBYTEPROPERTY_ENUM) // 0x0058 (0x08) 1527 | 1528 | public: 1529 | static UClass* StaticClass() 1530 | { 1531 | static UClass* uClassPointer = nullptr; 1532 | 1533 | if (!uClassPointer) 1534 | { 1535 | uClassPointer = UObject::FindClass("Class Core.ByteProperty"); 1536 | } 1537 | 1538 | return uClassPointer; 1539 | }; 1540 | }; 1541 | 1542 | // Class Core.BoolProperty 1543 | // 0x0008 (0x0058 - 0x0060) 1544 | class UBoolProperty : public UProperty 1545 | { 1546 | public: 1547 | uint64_t BitMask; REGISTER_MEMBER(uint64_t, BitMask, EMemberTypes::UBOOLPROPERTY_BITMASK) // 0x0058 (0x08) 1548 | 1549 | public: 1550 | static UClass* StaticClass() 1551 | { 1552 | static UClass* uClassPointer = nullptr; 1553 | 1554 | if (!uClassPointer) 1555 | { 1556 | uClassPointer = UObject::FindClass("Class Core.BoolProperty"); 1557 | } 1558 | 1559 | return uClassPointer; 1560 | }; 1561 | }; 1562 | 1563 | // Class Core.ArrayProperty 1564 | // 0x0008 (0x0058 - 0x0060) 1565 | class UArrayProperty : public UProperty 1566 | { 1567 | public: 1568 | class UProperty* Inner; REGISTER_MEMBER(class UProperty*, Inner, EMemberTypes::UARRAYPROPERTY_INNTER) // 0x0058 (0x08) 1569 | 1570 | public: 1571 | static UClass* StaticClass() 1572 | { 1573 | static UClass* uClassPointer = nullptr; 1574 | 1575 | if (!uClassPointer) 1576 | { 1577 | uClassPointer = UObject::FindClass("Class Core.ArrayProperty"); 1578 | } 1579 | 1580 | return uClassPointer; 1581 | }; 1582 | }; 1583 | 1584 | /* 1585 | # ========================================================================================= # 1586 | # 1587 | # ========================================================================================= # 1588 | */ -------------------------------------------------------------------------------- /Engine/Template/PiecesOfCode.cpp: -------------------------------------------------------------------------------- 1 | #include "PiecesOfCode.hpp" 2 | 3 | /* 4 | # ========================================================================================= # 5 | # Pieces Of Code 6 | # ========================================================================================= # 7 | */ 8 | 9 | namespace PiecesOfCode 10 | { 11 | const std::string TArray_Iterator = 12 | "template\n" 13 | "class TIterator\n" 14 | "{\n" 15 | "public:\n" 16 | "\tusing ElementType = typename TArray::ElementType;\n" 17 | "\tusing ElementPointer = ElementType*;\n" 18 | "\tusing ElementReference = ElementType&;\n" 19 | "\tusing ElementConstReference = const ElementType&;\n" 20 | "\n" 21 | "private:\n" 22 | "\tElementPointer IteratorData;\n" 23 | "\n" 24 | "public:\n" 25 | "\tTIterator(ElementPointer inElementPointer) : IteratorData(inElementPointer) {}\n" 26 | "\n" 27 | "\t~TIterator() {}\n" 28 | "\n" 29 | "public:\n" 30 | "\tTIterator& operator++()\n" 31 | "\t{\n" 32 | "\t\tIteratorData++;\n" 33 | "\t\treturn *this;\n" 34 | "\t}\n" 35 | "\n" 36 | "\tTIterator operator++(int32_t)\n" 37 | "\t{\n" 38 | "\t\tTIterator iteratorCopy = *this;\n" 39 | "\t\t++(*this);\n" 40 | "\t\treturn iteratorCopy;\n" 41 | "\t}\n" 42 | "\n" 43 | "\tTIterator& operator--()\n" 44 | "\t{\n" 45 | "\t\tIteratorData--;\n" 46 | "\t\treturn *this;\n" 47 | "\t}\n" 48 | "\n" 49 | "\tTIterator operator--(int32_t)\n" 50 | "\t{\n" 51 | "\t\tTIterator iteratorCopy = *this;\n" 52 | "\t\t--(*this);\n" 53 | "\t\treturn iteratorCopy;\n" 54 | "\t}\n" 55 | "\n" 56 | "\tElementReference operator[](int32_t index)\n" 57 | "\t{\n" 58 | "\t\treturn *(IteratorData[index]);\n" 59 | "\t}\n" 60 | "\n" 61 | "\tElementPointer operator->()\n" 62 | "\t{\n" 63 | "\t\treturn IteratorData;\n" 64 | "\t}\n" 65 | "\n" 66 | "\tElementReference operator*()\n" 67 | "\t{\n" 68 | "\t\treturn *IteratorData;\n" 69 | "\t}\n" 70 | "\n" 71 | "public:\n" 72 | "\tbool operator==(const TIterator& other) const\n" 73 | "\t{\n" 74 | "\t\treturn (IteratorData == other.IteratorData);\n" 75 | "\t}\n" 76 | "\n" 77 | "\tbool operator!=(const TIterator& other) const\n" 78 | "\t{\n" 79 | "\t\treturn !(*this == other);\n" 80 | "\t}\n" 81 | "};\n"; 82 | 83 | const std::string TArray_Class = 84 | "template\n" 85 | "class TArray\n" 86 | "{\n" 87 | "public:\n" 88 | "\tusing ElementType = InElementType;\n" 89 | "\tusing ElementPointer = ElementType*;\n" 90 | "\tusing ElementReference = ElementType&;\n" 91 | "\tusing ElementConstPointer = const ElementType*;\n" 92 | "\tusing ElementConstReference = const ElementType&;\n" 93 | "\tusing Iterator = TIterator>;\n" 94 | "\n" 95 | "private:\n" 96 | "\tElementPointer ArrayData;\n" 97 | "\tint32_t ArrayCount;\n" 98 | "\tint32_t ArrayMax;\n" 99 | "\n" 100 | "public:\n" 101 | "\tTArray() : ArrayData(nullptr), ArrayCount(0), ArrayMax(0)\n" 102 | "\t{\n" 103 | "\t\t//ReAllocate(sizeof(ElementType));\n" 104 | "\t}\n" 105 | "\n" 106 | "\t~TArray()\n" 107 | "\t{\n" 108 | "\t\t//clear();\n" 109 | "\t\t//::operator delete(ArrayData, ArrayMax * sizeof(ElementType));\n" 110 | "\t}\n" 111 | "\n" 112 | "public:\n" 113 | "\tElementConstReference operator[](int32_t index) const\n" 114 | "\t{\n" 115 | "\t\treturn ArrayData[index];\n" 116 | "\t}\n" 117 | "\n" 118 | "\tElementReference operator[](int32_t index)\n" 119 | "\t{\n" 120 | "\t\treturn ArrayData[index];\n" 121 | "\t}\n" 122 | "\n" 123 | "\tElementConstReference at(int32_t index) const\n" 124 | "\t{\n" 125 | "\t\treturn ArrayData[index];\n" 126 | "\t}\n" 127 | "\n" 128 | "\tElementReference at(int32_t index)\n" 129 | "\t{\n" 130 | "\t\treturn ArrayData[index];\n" 131 | "\t}\n" 132 | "\n" 133 | "\tElementConstPointer data() const\n" 134 | "\t{\n" 135 | "\t\treturn ArrayData;\n" 136 | "\t}\n" 137 | "\n" 138 | "\tvoid push_back(ElementConstReference newElement)\n" 139 | "\t{\n" 140 | "\t\tif (ArrayCount >= ArrayMax)\n" 141 | "\t\t{\n" 142 | "\t\t\tReAllocate(sizeof(ElementType) * (ArrayCount + 1));\n" 143 | "\t\t}\n" 144 | "\n" 145 | "\t\tnew(&ArrayData[ArrayCount]) ElementType(newElement);\n" 146 | "\t\tArrayCount++;\n" 147 | "\t}\n" 148 | "\n" 149 | "\tvoid push_back(ElementReference& newElement)\n" 150 | "\t{\n" 151 | "\t\tif (ArrayCount >= ArrayMax)\n" 152 | "\t\t{\n" 153 | "\t\t\tReAllocate(sizeof(ElementType) * (ArrayCount + 1));\n" 154 | "\t\t}\n" 155 | "\n" 156 | "\t\tnew(&ArrayData[ArrayCount]) ElementType(newElement);\n" 157 | "\t\tArrayCount++;\n" 158 | "\t}\n" 159 | "\n" 160 | "\tvoid pop_back()\n" 161 | "\t{\n" 162 | "\t\tif (ArrayCount > 0)\n" 163 | "\t\t{\n" 164 | "\t\t\tArrayCount--;\n" 165 | "\t\t\tArrayData[ArrayCount].~ElementType();\n" 166 | "\t\t}\n" 167 | "\t}\n" 168 | "\n" 169 | "\tvoid clear()\n" 170 | "\t{\n" 171 | "\t\tfor (int32_t i = 0; i < ArrayCount; i++)\n" 172 | "\t\t{\n" 173 | "\t\t\tArrayData[i].~ElementType();\n" 174 | "\t\t}\n" 175 | "\n" 176 | "\t\tArrayCount = 0;\n" 177 | "\t}\n" 178 | "\n" 179 | "\tint32_t size() const\n" 180 | "\t{\n" 181 | "\t\treturn ArrayCount;\n" 182 | "\t}\n" 183 | "\n" 184 | "\tint32_t capacity() const\n" 185 | "\t{\n" 186 | "\t\treturn ArrayMax;\n" 187 | "\t}\n" 188 | "\n" 189 | "\tbool empty() const\n" 190 | "\t{\n" 191 | "\t\tif (ArrayData)\n" 192 | "\t\t{\n" 193 | "\t\t\treturn (size() == 0);\n" 194 | "\t\t}\n" 195 | "\n" 196 | "\t\treturn true;\n" 197 | "\t}\n" 198 | "\n" 199 | "\tIterator begin()\n" 200 | "\t{\n" 201 | "\t\treturn Iterator(ArrayData);\n" 202 | "\t}\n" 203 | "\n" 204 | "\tIterator end()\n" 205 | "\t{\n" 206 | "\t\treturn Iterator(ArrayData + ArrayCount);\n" 207 | "\t}\n" 208 | "\n" 209 | "private:\n" 210 | "\tvoid ReAllocate(int32_t newArrayMax)\n" 211 | "\t{\n" 212 | "\t\tElementPointer newArrayData = (ElementPointer)::operator new(newArrayMax * sizeof(ElementType));\n" 213 | "\t\tint32_t newNum = ArrayCount;\n" 214 | "\n" 215 | "\t\tif (newArrayMax < newNum)\n" 216 | "\t\t{\n" 217 | "\t\t\tnewNum = newArrayMax;\n" 218 | "\t\t}\n" 219 | "\n" 220 | "\t\tfor (int32_t i = 0; i < newNum; i++)\n" 221 | "\t\t{\n" 222 | "\t\t\tnew(newArrayData + i) ElementType(std::move(ArrayData[i]));\n" 223 | "\t\t}\n" 224 | "\n" 225 | "\t\tfor (int32_t i = 0; i < ArrayCount; i++)\n" 226 | "\t\t{\n" 227 | "\t\t\tArrayData[i].~ElementType();\n" 228 | "\t\t}\n" 229 | "\n" 230 | "\t\t::operator delete(ArrayData, ArrayMax * sizeof(ElementType));\n" 231 | "\t\tArrayData = newArrayData;\n" 232 | "\t\tArrayMax = newArrayMax;\n" 233 | "\t}\n" 234 | "};\n"; 235 | 236 | const std::string TMap_Class = 237 | "template\n" 238 | "class TMap\n" 239 | "{\n" 240 | "private:\n" 241 | "\tstruct TPair\n" 242 | "\t{\n" 243 | "\t\tTKey Key;\n" 244 | "\t\tTValue Value;\n" 245 | "\t};\n" 246 | "\n" 247 | "public:\n" 248 | "\tusing ElementType = TPair;\n" 249 | "\tusing ElementPointer = ElementType*;\n" 250 | "\tusing ElementReference = ElementType&;\n" 251 | "\tusing ElementConstReference = const ElementType&;\n" 252 | "\tusing Iterator = TIterator>;\n" 253 | "\n" 254 | "public:\n" 255 | "\tTArray Elements;\t\t\t\t\t\t\t\t\t// 0x0000 (0x0010)\n" 256 | "\tuintptr_t IndirectData;\t\t\t\t\t\t\t\t\t\t\t// 0x0010 (0x0008)\n" 257 | "\tint32_t InlineData[0x4];\t\t\t\t\t\t\t\t\t\t// 0x0018 (0x0010)\n" 258 | "\tint32_t NumBits;\t\t\t\t\t\t\t\t\t\t\t\t// 0x0028 (0x0004)\n" 259 | "\tint32_t MaxBits;\t\t\t\t\t\t\t\t\t\t\t\t// 0x002C (0x0004)\n" 260 | "\tint32_t FirstFreeIndex;\t\t\t\t\t\t\t\t\t\t\t// 0x0030 (0x0004)\n" 261 | "\tint32_t NumFreeIndices;\t\t\t\t\t\t\t\t\t\t\t// 0x0034 (0x0004)\n" 262 | "\tint64_t InlineHash;\t\t\t\t\t\t\t\t\t\t\t\t// 0x0038 (0x0008)\n" 263 | "\tint32_t* Hash;\t\t\t\t\t\t\t\t\t\t\t\t\t// 0x0040 (0x0008)\n" 264 | "\tint32_t HashCount;\t\t\t\t\t\t\t\t\t\t\t\t// 0x0048 (0x0004)\n" 265 | "\n" 266 | "public:\n" 267 | "\tTMap() :\n" 268 | "\t\tIndirectData(NULL),\n" 269 | "\t\tNumBits(0),\n" 270 | "\t\tMaxBits(0),\n" 271 | "\t\tFirstFreeIndex(0),\n" 272 | "\t\tNumFreeIndices(0),\n" 273 | "\t\tInlineHash(0),\n" 274 | "\t\tHash(nullptr),\n" 275 | "\t\tHashCount(0)\n" 276 | "\t{\n" 277 | "\n" 278 | "\t}\n" 279 | "\n" 280 | "\tTMap(struct FMap_Mirror& other) :\n" 281 | "\t\tIndirectData(NULL),\n" 282 | "\t\tNumBits(0),\n" 283 | "\t\tMaxBits(0),\n" 284 | "\t\tFirstFreeIndex(0),\n" 285 | "\t\tNumFreeIndices(0),\n" 286 | "\t\tInlineHash(0),\n" 287 | "\t\tHash(nullptr),\n" 288 | "\t\tHashCount(0)\n" 289 | "\t{\n" 290 | "\t\tassign(other);\n" 291 | "\t}\n" 292 | "\n" 293 | "\tTMap(const TMap& other) :\n" 294 | "\t\tIndirectData(NULL),\n" 295 | "\t\tNumBits(0),\n" 296 | "\t\tMaxBits(0),\n" 297 | "\t\tFirstFreeIndex(0),\n" 298 | "\t\tNumFreeIndices(0),\n" 299 | "\t\tInlineHash(0),\n" 300 | "\t\tHash(nullptr),\n" 301 | "\t\tHashCount(0)\n" 302 | "\t{\n" 303 | "\t\tassign(other);\n" 304 | "\t}\n" 305 | "\n" 306 | "\t~TMap() {}\n" 307 | "\n" 308 | "public:\n" 309 | "\tTMap& assign(struct FMap_Mirror& other)\n" 310 | "\t{\n" 311 | "\t\t*this = *reinterpret_cast*>(&other);\n" 312 | "\t\treturn *this;\n" 313 | "\t}\n" 314 | "\n" 315 | "\tTMap& assign(const TMap& other)\n" 316 | "\t{\n" 317 | "\t\tElements = other.Elements;\n" 318 | "\t\tIndirectData = other.IndirectData;\n" 319 | "\t\tInlineData[0] = other.InlineData[0];\n" 320 | "\t\tInlineData[1] = other.InlineData[1];\n" 321 | "\t\tInlineData[2] = other.InlineData[2];\n" 322 | "\t\tInlineData[3] = other.InlineData[3];\n" 323 | "\t\tNumBits = other.NumBits;\n" 324 | "\t\tMaxBits = other.MaxBits;\n" 325 | "\t\tFirstFreeIndex = other.FirstFreeIndex;\n" 326 | "\t\tNumFreeIndices = other.NumFreeIndices;\n" 327 | "\t\tInlineHash = other.InlineHash;\n" 328 | "\t\tHash = other.Hash;\n" 329 | "\t\tHashCount = other.HashCount;\n" 330 | "\t\treturn *this;\n" 331 | "\t}\n" 332 | "\n" 333 | "\tTValue& at(const TKey& key)\n" 334 | "\t{\n" 335 | "\t\tfor (TPair& pair : Elements)\n" 336 | "\t\t{\n" 337 | "\t\t\tif (pair.Key == key)\n" 338 | "\t\t\t{\n" 339 | "\t\t\t\treturn pair.Value;\n" 340 | "\t\t\t}\n" 341 | "\t\t}\n" 342 | "\t}\n" 343 | "\n" 344 | "\tconst TValue& at(const TKey& key) const\n" 345 | "\t{\n" 346 | "\t\tfor (const TPair& pair : Elements)\n" 347 | "\t\t{\n" 348 | "\t\t\tif (pair.Key == key)\n" 349 | "\t\t\t{\n" 350 | "\t\t\t\treturn pair.Value;\n" 351 | "\t\t\t}\n" 352 | "\t\t}\n" 353 | "\t}\n" 354 | "\n" 355 | "\tTPair& at_index(int32_t index)\n" 356 | "\t{\n" 357 | "\t\treturn Elements[index];\n" 358 | "\t}\n" 359 | "\n" 360 | "\tconst TPair& at_index(int32_t index) const\n" 361 | "\t{\n" 362 | "\t\treturn Elements[index];\n" 363 | "\t}\n" 364 | "\n" 365 | "\tint32_t size() const\n" 366 | "\t{\n" 367 | "\t\treturn Elements.size();\n" 368 | "\t}\n" 369 | "\n" 370 | "\tint32_t capacity() const\n" 371 | "\t{\n" 372 | "\t\treturn Elements.capacity();\n" 373 | "\t}\n" 374 | "\n" 375 | "\tbool empty() const\n" 376 | "\t{\n" 377 | "\t\treturn Elements.empty();\n" 378 | "\t}\n" 379 | "\n" 380 | "\tIterator begin()\n" 381 | "\t{\n" 382 | "\t\treturn Elements.begin();\n" 383 | "\t}\n" 384 | "\n" 385 | "\tIterator end()\n" 386 | "\t{\n" 387 | "\t\treturn Elements.end();\n" 388 | "\t}\n" 389 | "\n" 390 | "public:\n" 391 | "\tTValue& operator[](const TKey& key)\n" 392 | "\t{\n" 393 | "\t\treturn at(key);\n" 394 | "\t}\n" 395 | "\n" 396 | "\tconst TValue& operator[](const TKey& key) const\n" 397 | "\t{\n" 398 | "\t\treturn at(key);\n" 399 | "\t}\n" 400 | "\n" 401 | "\tTMap& operator=(const struct FMap_Mirror& other)\n" 402 | "\t{\n" 403 | "\t\treturn assign(other);\n" 404 | "\t}\n" 405 | "\n" 406 | "\tTMap& operator=(const TMap& other)\n" 407 | "\t{\n" 408 | "\t\treturn assign(other);\n" 409 | "\t}\n" 410 | "};\n"; 411 | 412 | const std::string FNameEntry_Struct = 413 | "struct FNameEntry\n" 414 | "{\n" 415 | "public:"; 416 | 417 | const std::string FNameEntry_Struct_UTF16 = 418 | "\npublic:\n" 419 | "\tFNameEntry() : Flags(0), Index(-1) {}\n" 420 | "\t~FNameEntry() {}\n" 421 | "\n" 422 | "public:\n" 423 | "\tuint64_t GetFlags() const\n" 424 | "\t{\n" 425 | "\t\treturn Flags;\n" 426 | "\t}\n" 427 | "\n" 428 | "\tint32_t GetIndex() const\n" 429 | "\t{\n" 430 | "\t\treturn Index;\n" 431 | "\t}\n" 432 | "\n" 433 | "\tconst wchar_t* GetWideName() const\n" 434 | "\t{\n" 435 | "\t\treturn Name;\n" 436 | "\t}\n" 437 | "\n" 438 | "\tstd::wstring ToWideString() const\n" 439 | "\t{\n" 440 | "\t\tconst wchar_t* wideName = GetWideName();\n" 441 | "\n" 442 | "\t\tif (wideName)\n" 443 | "\t\t{\n" 444 | "\t\t\treturn std::wstring(wideName);\n" 445 | "\t\t}\n" 446 | "\n" 447 | "\t\treturn L\"\";\n" 448 | "\t}\n" 449 | "\n" 450 | "\tstd::string ToString() const\n" 451 | "\t{\n" 452 | "\t\tstd::wstring wstr = ToWideString();\n" 453 | "\t\treturn std::string(wstr.begin(), wstr.end());\n" 454 | "\t}\n" 455 | "};\n"; 456 | 457 | const std::string FNameEntry_Struct_UTF8 = 458 | "\npublic:\n" 459 | "\tFNameEntry() : Flags(0), Index(-1) {}\n" 460 | "\t~FNameEntry() {}\n" 461 | "\n" 462 | "public:\n" 463 | "\tuint64_t GetFlags() const\n" 464 | "\t{\n" 465 | "\t\treturn Flags;\n" 466 | "\t}\n" 467 | "\n" 468 | "\tint32_t GetIndex() const\n" 469 | "\t{\n" 470 | "\t\treturn Index;\n" 471 | "\t}\n" 472 | "\n" 473 | "\tconst char* GetAnsiName() const\n" 474 | "\t{\n" 475 | "\t\treturn Name;\n" 476 | "\t}\n" 477 | "\n" 478 | "\tstd::string ToString() const\n" 479 | "\t{\n" 480 | "\t\treturn std::string(Name);\n" 481 | "\t}\n" 482 | "};\n"; 483 | 484 | const std::string FName_Struct_UTF16 = 485 | "struct FName\n" 486 | "{\n" 487 | "public:\n" 488 | "\tusing ElementType = const wchar_t;\n" 489 | "\tusing ElementPointer = ElementType*;\n" 490 | "\n" 491 | "private:\n" 492 | "\tint32_t\t\t\tFNameEntryId;\t\t\t\t\t\t\t\t\t// 0x0000 (0x04)\n" 493 | "\tint32_t\t\t\tInstanceNumber;\t\t\t\t\t\t\t\t\t// 0x0004 (0x04)\n" 494 | "\n" 495 | "public:\n" 496 | "\tFName() : FNameEntryId(-1), InstanceNumber(0) {}\n" 497 | "\n" 498 | "\tFName(int32_t id) : FNameEntryId(id), InstanceNumber(0) {}\n" 499 | "\n" 500 | "\tFName(const ElementPointer nameToFind) : FNameEntryId(-1), InstanceNumber(0)\n" 501 | "\t{\n" 502 | "\t\tstatic std::vector foundNames{};\n" 503 | "\n" 504 | "\t\tfor (int32_t entryId : foundNames)\n" 505 | "\t\t{\n" 506 | "\t\t\tif (Names()->at(entryId))\n" 507 | "\t\t\t{\n" 508 | "\t\t\t\tif (!wcscmp(Names()->at(entryId)->Name, nameToFind))\n" 509 | "\t\t\t\t{\n" 510 | "\t\t\t\t\tFNameEntryId = entryId;\n" 511 | "\t\t\t\t\treturn;\n" 512 | "\t\t\t\t}\n" 513 | "\t\t\t}\n" 514 | "\t\t}\n" 515 | "\n" 516 | "\t\tfor (int32_t i = 0; i < Names()->size(); i++)\n" 517 | "\t\t{\n" 518 | "\t\t\tif (Names()->at(i))\n" 519 | "\t\t\t{\n" 520 | "\t\t\t\tif (!wcscmp(Names()->at(i)->Name, nameToFind))\n" 521 | "\t\t\t\t{\n" 522 | "\t\t\t\t\tfoundNames.push_back(i);\n" 523 | "\t\t\t\t\tFNameEntryId = i;\n" 524 | "\t\t\t\t\treturn;\n" 525 | "\t\t\t\t}\n" 526 | "\t\t\t}\n" 527 | "\t\t}\n" 528 | "\t}\n" 529 | "\n" 530 | "\tFName(const FName& name) : FNameEntryId(name.FNameEntryId), InstanceNumber(name.InstanceNumber) {}\n" 531 | "\n" 532 | "\t~FName() {}\n" 533 | "\n" 534 | "public:\n" 535 | "\tstatic TArray* Names()\n" 536 | "\t{\n" 537 | "\t\tTArray* recastedArray = reinterpret_cast*>(GNames);\n" 538 | "\t\treturn recastedArray;\n" 539 | "\t}\n" 540 | "\n" 541 | "\tint32_t GetDisplayIndex() const\n" 542 | "\t{\n" 543 | "\t\treturn FNameEntryId;\n" 544 | "\t}\n" 545 | "\n" 546 | "\tconst FNameEntry GetDisplayNameEntry() const\n" 547 | "\t{\n" 548 | "\t\tif (IsValid())\n" 549 | "\t\t{\n" 550 | "\t\t\treturn *Names()->at(FNameEntryId);\n" 551 | "\t\t}\n" 552 | "\n" 553 | "\t\treturn FNameEntry();\n" 554 | "\t}\n" 555 | "\n" 556 | "\tFNameEntry* GetEntry()\n" 557 | "\t{\n" 558 | "\t\tif (IsValid())\n" 559 | "\t\t{\n" 560 | "\t\t\treturn Names()->at(FNameEntryId);\n" 561 | "\t\t}\n" 562 | "\n" 563 | "\t\treturn nullptr;\n" 564 | "\t}\n" 565 | "\n" 566 | "\tint32_t GetInstance() const\n" 567 | "\t{\n" 568 | "\t\treturn InstanceNumber;\n" 569 | "\t}\n" 570 | "\n" 571 | "\tvoid SetInstance(int32_t newNumber)\n" 572 | "\t{\n" 573 | "\t\tInstanceNumber = newNumber;\n" 574 | "\t}\n" 575 | "\n" 576 | "\tstd::string ToString() const\n" 577 | "\t{\n" 578 | "\t\tif (IsValid())\n" 579 | "\t\t{\n" 580 | "\t\t\treturn GetDisplayNameEntry().ToString();\n" 581 | "\t\t}\n" 582 | "\n" 583 | "\t\treturn \"UnknownName\";\n" 584 | "\t}\n" 585 | "\n" 586 | "\tbool IsValid() const\n" 587 | "\t{\n" 588 | "\t\tif ((FNameEntryId < 0 || FNameEntryId > Names()->size()))\n" 589 | "\t\t{\n" 590 | "\t\t\treturn false;\n" 591 | "\t\t}\n" 592 | "\n" 593 | "\t\treturn true;\n" 594 | "\t}\n" 595 | "\n" 596 | "public:\n" 597 | "\tFName& operator=(const FName& other)\n" 598 | "\t{\n" 599 | "\t\tFNameEntryId = other.FNameEntryId;\n" 600 | "\t\tInstanceNumber = other.InstanceNumber;\n" 601 | "\t\treturn *this;\n" 602 | "\t}\n" 603 | "\n" 604 | "\tbool operator==(const FName& other) const\n" 605 | "\t{\n" 606 | "\t\treturn (FNameEntryId == other.FNameEntryId);\n" 607 | "\t}\n" 608 | "\n" 609 | "\tbool operator!=(const FName& other) const\n" 610 | "\t{\n" 611 | "\t\treturn (FNameEntryId != other.FNameEntryId);\n" 612 | "\t}\n" 613 | "};\n"; 614 | 615 | const std::string FName_Struct_UTF8 = 616 | "struct FName\n" 617 | "{\n" 618 | "public:\n" 619 | "\tusing ElementType = const char;\n" 620 | "\tusing ElementPointer = ElementType*;\n" 621 | "\n" 622 | "private:\n" 623 | "\tint32_t\t\t\tFNameEntryId;\t\t\t\t\t\t\t\t\t// 0x0000 (0x04)\n" 624 | "\tint32_t\t\t\tInstanceNumber;\t\t\t\t\t\t\t\t\t// 0x0004 (0x04)\n" 625 | "\n" 626 | "public:\n" 627 | "\tFName() : FNameEntryId(-1), InstanceNumber(0) {}\n" 628 | "\n" 629 | "\tFName(int32_t id) : FNameEntryId(id), InstanceNumber(0) {}\n" 630 | "\n" 631 | "\tFName(ElementPointer nameToFind) : FNameEntryId(-1), InstanceNumber(0)\n" 632 | "\t{\n" 633 | "\t\tstatic std::vector nameCache{};\n" 634 | "\n" 635 | "\t\tfor (int32_t entryId : nameCache)\n" 636 | "\t\t{\n" 637 | "\t\t\tif (Names()->at(entryId))\n" 638 | "\t\t\t{\n" 639 | "\t\t\t\tif (!strcmp(Names()->at(entryId)->Name, nameToFind))\n" 640 | "\t\t\t\t{\n" 641 | "\t\t\t\t\tFNameEntryId = entryId;\n" 642 | "\t\t\t\t\treturn;\n" 643 | "\t\t\t\t}\n" 644 | "\t\t\t}\n" 645 | "\t\t}\n" 646 | "\n" 647 | "\t\tfor (int32_t i = 0; i < Names()->size(); i++)\n" 648 | "\t\t{\n" 649 | "\t\t\tif (Names()->at(i))\n" 650 | "\t\t\t{\n" 651 | "\t\t\t\tif (!strcmp(Names()->at(i)->Name, nameToFind))\n" 652 | "\t\t\t\t{\n" 653 | "\t\t\t\t\tnameCache.push_back(i);\n" 654 | "\t\t\t\t\tFNameEntryId = i;\n" 655 | "\t\t\t\t}\n" 656 | "\t\t\t}\n" 657 | "\t\t}\n" 658 | "\t}\n" 659 | "\n" 660 | "\tFName(const FName& name) : FNameEntryId(name.FNameEntryId), InstanceNumber(name.InstanceNumber) {}\n" 661 | "\n" 662 | "\t~FName() {}\n" 663 | "\n" 664 | "public:\n" 665 | "\tstatic TArray* Names()\n" 666 | "\t{\n" 667 | "\t\tTArray* recastedArray = reinterpret_cast*>(GNames);\n" 668 | "\t\treturn recastedArray;\n" 669 | "\t}\n" 670 | "\n" 671 | "\tint32_t GetDisplayIndex() const\n" 672 | "\t{\n" 673 | "\t\treturn FNameEntryId;\n" 674 | "\t}\n" 675 | "\n" 676 | "\tconst FNameEntry GetDisplayNameEntry() const\n" 677 | "\t{\n" 678 | "\t\tif (IsValid())\n" 679 | "\t\t{\n" 680 | "\t\t\treturn *Names()->at(FNameEntryId);\n" 681 | "\t\t}\n" 682 | "\n" 683 | "\t\treturn FNameEntry();\n" 684 | "\t}\n" 685 | "\n" 686 | "\tFNameEntry* GetEntry()\n" 687 | "\t{\n" 688 | "\t\tif (IsValid())\n" 689 | "\t\t{\n" 690 | "\t\t\treturn Names()->at(FNameEntryId);\n" 691 | "\t\t}\n" 692 | "\n" 693 | "\t\treturn nullptr;\n" 694 | "\t}\n" 695 | "\n" 696 | "\tint32_t GetInstance() const\n" 697 | "\t{\n" 698 | "\t\treturn InstanceNumber;\n" 699 | "\t}\n" 700 | "\n" 701 | "\tvoid SetInstance(int32_t newNumber)\n" 702 | "\t{\n" 703 | "\t\tInstanceNumber = newNumber;\n" 704 | "\t}\n" 705 | "\n" 706 | "\tstd::string ToString() const\n" 707 | "\t{\n" 708 | "\t\tif (IsValid())\n" 709 | "\t\t{\n" 710 | "\t\t\treturn GetDisplayNameEntry().ToString();\n" 711 | "\t\t}\n" 712 | "\n" 713 | "\t\treturn \"UnknownName\";\n" 714 | "\t}\n" 715 | "\n" 716 | "\tbool IsValid() const\n" 717 | "\t{\n" 718 | "\t\tif ((FNameEntryId < 0 || FNameEntryId > Names()->size()))\n" 719 | "\t\t{\n" 720 | "\t\t\treturn false;\n" 721 | "\t\t}\n" 722 | "\n" 723 | "\t\treturn true;\n" 724 | "\t}\n" 725 | "\n" 726 | "public:\n" 727 | "\tFName& operator=(const FName& other)\n" 728 | "\t{\n" 729 | "\t\tFNameEntryId = other.FNameEntryId;\n" 730 | "\t\tInstanceNumber = other.InstanceNumber;\n" 731 | "\t\treturn *this;\n" 732 | "\t}\n" 733 | "\n" 734 | "\tbool operator==(const FName& other) const\n" 735 | "\t{\n" 736 | "\t\treturn (FNameEntryId == other.FNameEntryId);\n" 737 | "\t}\n" 738 | "\n" 739 | "\tbool operator!=(const FName& other) const\n" 740 | "\t{\n" 741 | "\t\treturn (FNameEntryId != other.FNameEntryId);\n" 742 | "\t}\n" 743 | "};\n"; 744 | 745 | const std::string FString_Class_UTF16 = 746 | "class FString\n" 747 | "{\n" 748 | "public:\n" 749 | "\tusing ElementType = const wchar_t;\n" 750 | "\tusing ElementPointer = ElementType*;\n" 751 | "\n" 752 | "private:\n" 753 | "\tElementPointer\tArrayData;\t\t\t\t\t\t\t\t\t\t// 0x0000 (0x08)\n" 754 | "\tint32_t\t\t\tArrayCount;\t\t\t\t\t\t\t\t\t\t// 0x0008 (0x04)\n" 755 | "\tint32_t\t\t\tArrayMax;\t\t\t\t\t\t\t\t\t\t// 0x000C (0x04)\n" 756 | "\n" 757 | "public:\n" 758 | "\tFString() : ArrayData(nullptr), ArrayCount(0), ArrayMax(0) {}\n" 759 | "\n" 760 | "\tFString(ElementPointer other) : ArrayData(nullptr), ArrayCount(0), ArrayMax(0) { assign(other); }\n" 761 | "\n" 762 | "\t~FString() {}\n" 763 | "\n" 764 | "public:\n" 765 | "\tFString& assign(ElementPointer other)\n" 766 | "\t{\n" 767 | "\t\tArrayCount = (other ? (wcslen(other) + 1) : 0);\n" 768 | "\t\tArrayMax = ArrayCount;\n" 769 | "\t\tArrayData = (ArrayCount > 0 ? other : nullptr);\n" 770 | "\t\treturn *this;\n" 771 | "\t}\n" 772 | "\n" 773 | "\tstd::wstring ToWideString() const\n" 774 | "\t{\n" 775 | "\t\tif (!empty())\n" 776 | "\t\t{\n" 777 | "\t\t\treturn std::wstring(c_str());\n" 778 | "\t\t}\n" 779 | "\n" 780 | "\t\treturn L\"\";\n" 781 | "\t}\n" 782 | "\n" 783 | "\tstd::string ToString() const\n" 784 | "\t{\n" 785 | "\t\tif (!empty())\n" 786 | "\t\t{\n" 787 | "\t\t\tstd::wstring wstr = ToWideString();\n" 788 | "\t\t\treturn std::string(wstr.begin(), wstr.end());\n" 789 | "\t\t}\n" 790 | "\n" 791 | "\t\treturn \"\";\n" 792 | "\t}\n" 793 | "\n" 794 | "\tElementPointer c_str() const\n" 795 | "\t{\n" 796 | "\t\treturn ArrayData;\n" 797 | "\t}\n" 798 | "\n" 799 | "\tbool empty() const\n" 800 | "\t{\n" 801 | "\t\tif (ArrayData)\n" 802 | "\t\t{\n" 803 | "\t\t\treturn (ArrayCount == 0);\n" 804 | "\t\t}\n" 805 | "\n" 806 | "\t\treturn true;\n" 807 | "\t}\n" 808 | "\n" 809 | "\tint32_t length() const\n" 810 | "\t{\n" 811 | "\t\treturn ArrayCount;\n" 812 | "\t}\n" 813 | "\n" 814 | "\tint32_t size() const\n" 815 | "\t{\n" 816 | "\t\treturn ArrayMax;\n" 817 | "\t}\n" 818 | "\n" 819 | "public:\n" 820 | "\tFString& operator=(ElementPointer other)\n" 821 | "\t{\n" 822 | "\t\treturn assign(other);\n" 823 | "\t}\n" 824 | "\n" 825 | "\tFString& operator=(const FString& other)\n" 826 | "\t{\n" 827 | "\t\treturn assign(other.c_str());\n" 828 | "\t}\n" 829 | "\n" 830 | "\tbool operator==(const FString& other)\n" 831 | "\t{\n" 832 | "\t\treturn (!wcscmp(ArrayData, other.ArrayData));\n" 833 | "\t}\n" 834 | "\n" 835 | "\tbool operator!=(const FString& other)\n" 836 | "\t{\n" 837 | "\t\treturn (wcscmp(ArrayData, other.ArrayData));\n" 838 | "\t}\n" 839 | "};\n"; 840 | 841 | const std::string FString_Class_UTF8 = 842 | "class FString\n" 843 | "{\n" 844 | "public:\n" 845 | "\tusing ElementType = const char;\n" 846 | "\tusing ElementPointer = ElementType*;\n" 847 | "\n" 848 | "private:\n" 849 | "\tElementPointer\tArrayData;\t\t\t\t\t\t\t\t\t\t// 0x0000 (0x08)\n" 850 | "\tint32_t\t\t\tArrayCount;\t\t\t\t\t\t\t\t\t\t// 0x0008 (0x04)\n" 851 | "\tint32_t\t\t\tArrayMax;\t\t\t\t\t\t\t\t\t\t// 0x000C (0x04)\n" 852 | "\n" 853 | "public:\n" 854 | "\tFString() : ArrayData(nullptr), ArrayCount(0), ArrayMax(0) {}\n" 855 | "\n" 856 | "\tFString(ElementPointer other) : ArrayData(nullptr), ArrayCount(0), ArrayMax(0) { assign(other); }\n" 857 | "\n" 858 | "\t~FString() {}\n" 859 | "\n" 860 | "public:\n" 861 | "\tFString& assign(ElementPointer other)\n" 862 | "\t{\n" 863 | "\t\tArrayCount = (other ? (strlen(other) + 1) : 0);\n" 864 | "\t\tArrayMax = ArrayCount;\n" 865 | "\t\tArrayData = (ArrayCount > 0 ? other : nullptr);\n" 866 | "\t\treturn *this;\n" 867 | "\t}\n" 868 | "\n" 869 | "\tstd::string ToString() const\n" 870 | "\t{\n" 871 | "\t\tif (!empty())\n" 872 | "\t\t{\n" 873 | "\t\t\treturn std::string(c_str());\n" 874 | "\t\t}\n" 875 | "\n" 876 | "\t\treturn \"\";\n" 877 | "\t}\n" 878 | "\n" 879 | "\tElementPointer c_str() const\n" 880 | "\t{\n" 881 | "\t\treturn ArrayData;\n" 882 | "\t}\n" 883 | "\n" 884 | "\tbool empty() const\n" 885 | "\t{\n" 886 | "\t\tif (ArrayData)\n" 887 | "\t\t{\n" 888 | "\t\t\treturn (ArrayCount == 0);\n" 889 | "\t\t}\n" 890 | "\n" 891 | "\t\treturn true;\n" 892 | "\t}\n" 893 | "\n" 894 | "\tint32_t length() const\n" 895 | "\t{\n" 896 | "\t\treturn ArrayCount;\n" 897 | "\t}\n" 898 | "\n" 899 | "\tint32_t size() const\n" 900 | "\t{\n" 901 | "\t\treturn ArrayMax;\n" 902 | "\t}\n" 903 | "\n" 904 | "public:\n" 905 | "\tFString& operator=(ElementPointer other)\n" 906 | "\t{\n" 907 | "\t\treturn assign(other);\n" 908 | "\t}\n" 909 | "\n" 910 | "\tFString& operator=(const FString& other)\n" 911 | "\t{\n" 912 | "\t\treturn assign(other.c_str());\n" 913 | "\t}\n" 914 | "\n" 915 | "\tbool operator==(const FString& other)\n" 916 | "\t{\n" 917 | "\t\treturn (!strcmp(ArrayData, other.ArrayData));\n" 918 | "\t}\n" 919 | "\n" 920 | "\tbool operator!=(const FString& other)\n" 921 | "\t{\n" 922 | "\t\treturn (strcmp(ArrayData, other.ArrayData));\n" 923 | "\t}\n" 924 | "};\n"; 925 | 926 | const std::string FScriptDelegate_Struct = 927 | "struct FScriptDelegate\n" 928 | "{\n" 929 | "\tclass UObject* Object;\t\t\t\t\t\t\t\t\t\t// 0x0000 (0x08)\n" 930 | "};\n"; 931 | 932 | const std::string FPointer_Struct = 933 | "struct FPointer\n" 934 | "{\n" 935 | "\tuintptr_t Dummy;\n" 936 | "};\n"; 937 | 938 | const std::string FQWord_Struct = 939 | "struct FQWord\n" 940 | "{\n" 941 | "\tint32_t A;\n" 942 | "\tint32_t B;\n" 943 | "};\n"; 944 | 945 | const std::string UObject_FunctionDescriptions = 946 | "\tstatic TArray* GObjObjects();\n" 947 | "\n" 948 | "\tstd::string GetName();\n" 949 | "\tstd::string GetNameCPP();\n" 950 | "\tstd::string GetFullName();\n" 951 | "\tclass UObject* GetPackageObj();\n" 952 | "\ttemplate static T* FindObject(const std::string& objectFullName)\n" 953 | "\t{\n" 954 | "\t\tfor (UObject* uObject : *UObject::GObjObjects())\n" 955 | "\t\t{\n" 956 | "\t\t\tif (uObject && uObject->IsA())\n" 957 | "\t\t\t{\n" 958 | "\t\t\t\tif (uObject->GetFullName() == objectFullName)\n" 959 | "\t\t\t\t{\n" 960 | "\t\t\t\t\treturn static_cast(uObject);\n" 961 | "\t\t\t\t}\n" 962 | "\t\t\t}\n" 963 | "\t\t}\n" 964 | "\n" 965 | "\t\treturn nullptr;\n" 966 | "\t}\n" 967 | "\ttemplate static uint32_t CountObject(const std::string& objectName)\n" 968 | "\t{\n" 969 | "\t\tstatic std::map countCache;\n" 970 | "\n" 971 | "\t\tif (countCache.find(objectName) == countCache.end())\n" 972 | "\t\t{\n" 973 | "\t\t\tcountCache[objectName] = 0;\n" 974 | "\n" 975 | "\t\t\tfor (UObject* uObject : *UObject::GObjObjects())\n" 976 | "\t\t\t{\n" 977 | "\t\t\t\tif (uObject && uObject->IsA())\n" 978 | "\t\t\t\t{\n" 979 | "\t\t\t\t\tif (uObject->GetName() == objectName)\n" 980 | "\t\t\t\t\t{\n" 981 | "\t\t\t\t\t\tcountCache[uObject->GetName()]++;\n" 982 | "\t\t\t\t\t}\n" 983 | "\t\t\t\t}\n" 984 | "\t\t\t}\n" 985 | "\t\t}\n" 986 | "\n" 987 | "\t\treturn countCache[objectName];\n" 988 | "\t}\n" 989 | "\tstatic class UClass* FindClass(const std::string& classFullName);\n" 990 | "\ttemplate bool IsA()\n" 991 | "\t{\n" 992 | "\t\tif (std::is_base_of::value)\n" 993 | "\t\t{\n" 994 | "\t\t\treturn IsA(T::StaticClass());\n" 995 | "\t\t}\n" 996 | "\t}\n" 997 | "\tbool IsA(class UClass* uClass);\n" 998 | "\tbool IsA(int32_t objInternalInteger);\n\n"; 999 | 1000 | const std::string UObject_Functions = 1001 | "TArray* UObject::GObjObjects()\n" 1002 | "{\n" 1003 | "\tTArray* recastedArray = reinterpret_cast*>(GObjects);\n" 1004 | "\treturn recastedArray;\n" 1005 | "}\n" 1006 | "\n" 1007 | "std::string UObject::GetName()\n" 1008 | "{\n" 1009 | "\treturn this->Name.ToString();\n" 1010 | "}\n" 1011 | "\n" 1012 | "std::string UObject::GetNameCPP()\n" 1013 | "{\n" 1014 | "\tstd::string nameCPP;\n" 1015 | "\n" 1016 | "\tif (this->IsA())\n" 1017 | "\t{\n" 1018 | "\t\tUClass* uClass = static_cast(this);\n" 1019 | "\n" 1020 | "\t\twhile (uClass)\n" 1021 | "\t\t{\n" 1022 | "\t\t\tstd::string className = uClass->GetName();\n" 1023 | "\n" 1024 | "\t\t\tif (className == \"Actor\")\n" 1025 | "\t\t\t{\n" 1026 | "\t\t\t\tnameCPP += \"A\";\n" 1027 | "\t\t\t\tbreak;\n" 1028 | "\t\t\t}\n" 1029 | "\t\t\telse if (className == \"Object\")\n" 1030 | "\t\t\t{\n" 1031 | "\t\t\t\tnameCPP += \"U\";\n" 1032 | "\t\t\t\tbreak;\n" 1033 | "\t\t\t}\n" 1034 | "\n" 1035 | "\t\t\tuClass = static_cast(uClass->SuperField);\n" 1036 | "\t\t}\n" 1037 | "\t}\n" 1038 | "\telse\n" 1039 | "\t{\n" 1040 | "\t\tnameCPP += \"F\";\n" 1041 | "\t}\n" 1042 | "\n" 1043 | "\tnameCPP += this->GetName();\n" 1044 | "\n" 1045 | "\treturn nameCPP;\n" 1046 | "}\n" 1047 | "\n" 1048 | "std::string UObject::GetFullName()\n" 1049 | "{\n" 1050 | "\tstd::string fullName = this->GetName();\n" 1051 | "\n" 1052 | "\tfor (UObject* uOuter = this->Outer; uOuter; uOuter = uOuter->Outer)\n" 1053 | "\t{\n" 1054 | "\t\tfullName = (uOuter->GetName() + \".\" + fullName);\n" 1055 | "\t}\n" 1056 | "\n" 1057 | "\tfullName = (this->Class->GetName() + \" \" + fullName);\n" 1058 | "\n" 1059 | "\treturn fullName;\n" 1060 | "}\n" 1061 | "\n" 1062 | "UObject* UObject::GetPackageObj()\n" 1063 | "{\n" 1064 | "\tUObject* uPackage = nullptr;\n" 1065 | "\n" 1066 | "\tfor (UObject* uOuter = this->Outer; uOuter; uOuter = uOuter->Outer)\n" 1067 | "\t{\n" 1068 | "\t\tuPackage = uOuter;\n" 1069 | "\t}\n" 1070 | "\n" 1071 | "\treturn uPackage;\n" 1072 | "}\n" 1073 | "\n" 1074 | "UClass* UObject::FindClass(const const std::string& classFullName)\n" 1075 | "{\n" 1076 | "\tstatic bool initialized = false;\n" 1077 | "\tstatic std::map foundClasses{};\n" 1078 | "\n" 1079 | "\tif (!initialized)\n" 1080 | "\t{\n" 1081 | "\t\tfor (UObject* uObject : *UObject::GObjObjects())\n" 1082 | "\t\t{\n" 1083 | "\t\t\tif (uObject)\n" 1084 | "\t\t\t{\n" 1085 | "\t\t\t\tconst std::string objectFullName = uObject->GetFullName();\n" 1086 | "\n" 1087 | "\t\t\t\tif (objectFullName.find(\"Class\") == 0)\n" 1088 | "\t\t\t\t{\n" 1089 | "\t\t\t\t\tfoundClasses[objectFullName] = static_cast(uObject);\n" 1090 | "\t\t\t\t}\n" 1091 | "\t\t\t}\n" 1092 | "\t\t}\n" 1093 | "\n" 1094 | "\t\tinitialized = true;\n" 1095 | "\t}\n" 1096 | "\n" 1097 | "\tif (foundClasses.find(classFullName) != foundClasses.end())\n" 1098 | "\t{\n" 1099 | "\t\treturn foundClasses[classFullName];\n" 1100 | "\t}\n" 1101 | "\n" 1102 | "\treturn nullptr;\n" 1103 | "}\n" 1104 | "\n" 1105 | "bool UObject::IsA(class UClass* uClass)\n" 1106 | "{\n" 1107 | "\tfor (UClass* uSuperClass = this->Class; uSuperClass; uSuperClass = static_cast(uSuperClass->SuperField))\n" 1108 | "\t{\n" 1109 | "\t\tif (uSuperClass == uClass)\n" 1110 | "\t\t{\n" 1111 | "\t\t\treturn true;\n" 1112 | "\t\t}\n" 1113 | "\t}\n" 1114 | "\n" 1115 | "\treturn false;\n" 1116 | "}\n" 1117 | "\n" 1118 | "bool UObject::IsA(int32_t objInternalInteger)\n" 1119 | "{\n" 1120 | "\tUClass* uClass = UObject::GObjObjects()->at(objInternalInteger)->Class;\n" 1121 | "\n" 1122 | "\tif (uClass)\n" 1123 | "\t{\n" 1124 | "\t\treturn this->IsA(uClass);\n" 1125 | "\t}\n" 1126 | "\n" 1127 | "\treturn false;\n" 1128 | "}\n\n"; 1129 | 1130 | const std::string UFunction_Functions = 1131 | "UFunction* UFunction::FindFunction(const const std::string& functionFullName)\n" 1132 | "{\n" 1133 | "\tstatic bool initialized = false;\n" 1134 | "\tstatic std::map foundFunctions{};\n" 1135 | "\n" 1136 | "\tif (!initialized)\n" 1137 | "\t{\n" 1138 | "\t\tfor (UObject* uObject : *UObject::GObjObjects())\n" 1139 | "\t\t{\n" 1140 | "\t\t\tif (uObject)\n" 1141 | "\t\t\t{\n" 1142 | "\t\t\t\tconst std::string objectFullName = uObject->GetFullName();\n" 1143 | "\n" 1144 | "\t\t\t\tif (objectFullName.find(\"Function\") == 0)\n" 1145 | "\t\t\t\t{\n" 1146 | "\t\t\t\t\tfoundFunctions[objectFullName] = static_cast(uObject);\n" 1147 | "\t\t\t\t}\n" 1148 | "\t\t\t}\n" 1149 | "\t\t}\n" 1150 | "\n" 1151 | "\t\tinitialized = true;\n" 1152 | "\t}\n" 1153 | "\n" 1154 | "\tif (foundFunctions.find(functionFullName) != foundFunctions.end())\n" 1155 | "\t{\n" 1156 | "\t\treturn foundFunctions[functionFullName];\n" 1157 | "\t}\n" 1158 | "\n" 1159 | "\treturn nullptr;\n" 1160 | "}\n\n"; 1161 | 1162 | const std::string EEnumFlags = 1163 | "// Function Flags\n" 1164 | "// https://docs.unrealengine.com/en-US/API/Runtime/CoreUObject/UObject/EFunctionFlags/index.html\n" 1165 | "// https://github.com/EliotVU/Unreal-Library/blob/59a9774fd7c972d55810676521e4b874d7a242e8/src/UnrealFlags.cs\n" 1166 | "enum EFunctionFlags\n" 1167 | "{\n" 1168 | "\tFUNC_None =\t\t\t\t\t\t\t\t0x00000000,\n" 1169 | "\tFUNC_Final =\t\t\t\t\t\t\t0x00000001,\n" 1170 | "\tFUNC_Defined =\t\t\t\t\t\t\t0x00000002,\n" 1171 | "\tFUNC_Iterator =\t\t\t\t\t\t\t0x00000004,\n" 1172 | "\tFUNC_Latent =\t\t\t\t\t\t\t0x00000008,\n" 1173 | "\tFUNC_PreOperator =\t\t\t\t\t\t0x00000010,\n" 1174 | "\tFUNC_Singular =\t\t\t\t\t\t\t0x00000020,\n" 1175 | "\tFUNC_Net =\t\t\t\t\t\t\t\t0x00000040,\n" 1176 | "\tFUNC_NetReliable =\t\t\t\t\t\t0x00000080,\n" 1177 | "\tFUNC_Simulated =\t\t\t\t\t\t0x00000100,\n" 1178 | "\tFUNC_Exec =\t\t\t\t\t\t\t\t0x00000200,\n" 1179 | "\tFUNC_Native =\t\t\t\t\t\t\t0x00000400,\n" 1180 | "\tFUNC_Event =\t\t\t\t\t\t\t0x00000800,\n" 1181 | "\tFUNC_Operator =\t\t\t\t\t\t\t0x00001000,\n" 1182 | "\tFUNC_Static =\t\t\t\t\t\t\t0x00002000,\n" 1183 | "\tFUNC_NoExport =\t\t\t\t\t\t\t0x00004000,\n" 1184 | "\tFUNC_OptionalParm =\t\t\t\t\t\t0x00004000,\n" 1185 | "\tFUNC_Const =\t\t\t\t\t\t\t0x00008000,\n" 1186 | "\tFUNC_Invariant =\t\t\t\t\t\t0x00010000,\n" 1187 | "\tFUNC_Public =\t\t\t\t\t\t\t0x00020000,\n" 1188 | "\tFUNC_Private =\t\t\t\t\t\t\t0x00040000,\n" 1189 | "\tFUNC_Protected =\t\t\t\t\t\t0x00080000,\n" 1190 | "\tFUNC_Delegate =\t\t\t\t\t\t\t0x00100000,\n" 1191 | "\tFUNC_NetServer =\t\t\t\t\t\t0x00200000,\n" 1192 | "\tFUNC_HasOutParms =\t\t\t\t\t\t0x00400000,\n" 1193 | "\tFUNC_HasDefaults =\t\t\t\t\t\t0x00800000,\n" 1194 | "\tFUNC_NetClient =\t\t\t\t\t\t0x01000000,\n" 1195 | "\tFUNC_DLLImport =\t\t\t\t\t\t0x02000000,\n" 1196 | "\tFUNC_K2Call =\t\t\t\t\t\t\t0x04000000,\n" 1197 | "\tFUNC_K2Override =\t\t\t\t\t\t0x08000000,\n" 1198 | "\tFUNC_K2Pure =\t\t\t\t\t\t\t0x10000000,\n" 1199 | "\tFUNC_EditorOnly =\t\t\t\t\t\t0x20000000,\n" 1200 | "\tFUNC_Lambda =\t\t\t\t\t\t\t0x40000000,\n" 1201 | "\tFUNC_NetValidate =\t\t\t\t\t\t0x80000000,\n" 1202 | "\tFUNC_AllFlags =\t\t\t\t\t\t\t0xFFFFFFFF\n" 1203 | "};\n" 1204 | "\n" 1205 | "// Proprerty Flags\n" 1206 | "// https://docs.unrealengine.com/en-US/API/Runtime/CoreUObject/UObject/EPropertyFlags/index.html\n" 1207 | "enum EPropertyFlags\n" 1208 | "{\n" 1209 | "\tCPF_Edit =\t\t\t\t\t\t\t\t0x0000000000000001,\t// Property is user-settable in the editor.\n" 1210 | "\tCPF_Const =\t\t\t\t\t\t\t\t0x0000000000000002,\t// Actor\'s property always matches class\'s default actor property.\n" 1211 | "\tCPF_Input =\t\t\t\t\t\t\t\t0x0000000000000004,\t// Variable is writable by the input system.\n" 1212 | "\tCPF_ExportObject =\t\t\t\t\t\t0x0000000000000008,\t// Object can be exported with actor.\n" 1213 | "\tCPF_OptionalParm =\t\t\t\t\t\t0x0000000000000010,\t// Optional parameter (if CPF_Param is set).\n" 1214 | "\tCPF_Net =\t\t\t\t\t\t\t\t0x0000000000000020,\t// Property is relevant to network replication.\n" 1215 | "\tCPF_EditConstArray =\t\t\t\t\t0x0000000000000040,\t// Prevent adding/removing of items from dynamic a array in the editor.\n" 1216 | "\tCPF_Parm =\t\t\t\t\t\t\t\t0x0000000000000080,\t// Function/When call parameter.\n" 1217 | "\tCPF_OutParm =\t\t\t\t\t\t\t0x0000000000000100,\t// Value is copied out after function call.\n" 1218 | "\tCPF_SkipParm =\t\t\t\t\t\t\t0x0000000000000200,\t// Property is a short-circuitable evaluation function parm.\n" 1219 | "\tCPF_ReturnParm =\t\t\t\t\t\t0x0000000000000400,\t// Return value.\n" 1220 | "\tCPF_CoerceParm =\t\t\t\t\t\t0x0000000000000800,\t// Coerce args into this function parameter.\n" 1221 | "\tCPF_Native =\t\t\t\t\t\t\t0x0000000000001000,\t// Property is native: C++ code is responsible for serializing it.\n" 1222 | "\tCPF_Transient =\t\t\t\t\t\t\t0x0000000000002000,\t// Property is transient: shouldn\'t be saved, zero-filled at load time.\n" 1223 | "\tCPF_Config =\t\t\t\t\t\t\t0x0000000000004000,\t// Property should be loaded/saved as permanent profile.\n" 1224 | "\tCPF_Localized =\t\t\t\t\t\t\t0x0000000000008000,\t// Property should be loaded as localizable text.\n" 1225 | "\tCPF_Travel =\t\t\t\t\t\t\t0x0000000000010000,\t// Property travels across levels/servers.\n" 1226 | "\tCPF_EditConst =\t\t\t\t\t\t\t0x0000000000020000,\t// Property is uneditable in the editor.\n" 1227 | "\tCPF_GlobalConfig =\t\t\t\t\t\t0x0000000000040000,\t// Load config from base class, not subclass.\n" 1228 | "\tCPF_Component =\t\t\t\t\t\t\t0x0000000000080000,\t// Property containts component references.\n" 1229 | "\tCPF_NeedCtorLink =\t\t\t\t\t\t0x0000000000400000,\t// Fields need construction/destruction.\n" 1230 | "\tCPF_NoExport =\t\t\t\t\t\t\t0x0000000000800000,\t// Property should not be exported to the native class header file.\n" 1231 | "\tCPF_NoClear =\t\t\t\t\t\t\t0x0000000002000000,\t// Hide clear (and browse) button.\n" 1232 | "\tCPF_EditInline =\t\t\t\t\t\t0x0000000004000000,\t// Edit this object reference inline.\n" 1233 | "\tCPF_EdFindable =\t\t\t\t\t\t0x0000000008000000,\t// References are set by clicking on actors in the editor viewports.\n" 1234 | "\tCPF_EditInlineUse =\t\t\t\t\t\t0x0000000010000000,\t// EditInline with Use button.\n" 1235 | "\tCPF_Deprecated =\t\t\t\t\t\t0x0000000020000000,\t// Property is deprecated. Read it from an archive, but don\'t save it.\n" 1236 | "\tCPF_EditInlineNotify =\t\t\t\t\t0x0000000040000000,\t// EditInline, notify outer object on editor change.\n" 1237 | "\tCPF_RepNotify =\t\t\t\t\t\t\t0x0000000100000000,\t// Notify actors when a property is replicated\n" 1238 | "\tCPF_Interp =\t\t\t\t\t\t\t0x0000000200000000,\t// interpolatable property for use with matinee\n" 1239 | "\tCPF_NonTransactional =\t\t\t\t\t0x0000000400000000,\t// Property isn\'t transacted\n" 1240 | "\tCPF_EditorOnly =\t\t\t\t\t\t0x0000000800000000,\t// Property should only be loaded in the editor.\n" 1241 | "\tCPF_NoDestructor =\t\t\t\t\t\t0x0000001000000000,\t// No destructor.\n" 1242 | "\tCPF_AutoWeak =\t\t\t\t\t\t\t0x0000004000000000,\t// CPF_ = 0x0000002000000000, ///<.\n" 1243 | "\tCPF_ContainsInstancedReference =\t\t0x0000008000000000,\t// Property contains component refuerences.\n" 1244 | "\tCPF_AssetRegistrySearchable =\t\t\t0x0000010000000000,\t// Asset instances will add properties with this flag to the asset registry automatically\n" 1245 | "\tCPF_SimpleDisplay =\t\t\t\t\t\t0x0000020000000000,\t// The property is visible by default in the editor details view.\n" 1246 | "\tCPF_AdvancedDisplay =\t\t\t\t\t0x0000040000000000,\t// The property is advanced and not visible by default in the editor details view.\n" 1247 | "\tCPF_Protected =\t\t\t\t\t\t\t0x0000080000000000,\t// Property is protected from the perspective of scrip\n" 1248 | "\tCPF_BlueprintCallable =\t\t\t\t\t0x0000100000000000,\t// MC Delegates only. Property should be exposed for calling in blueprint code.\n" 1249 | "\tCPF_BlueprintAuthorityOnly =\t\t\t0x0000200000000000,\t// MC Delegates only. This delegate accepts (only in blueprint) only events with BlueprintAuthorityOnly.\n" 1250 | "\tCPF_TextExportTransient =\t\t\t\t0x0000400000000000,\t// Property shouldn\'t be exported to text format (e.g. copy/paste)\n" 1251 | "\tCPF_NonPIEDuplicateTransient =\t\t\t0x0000800000000000,\t// Property should only be copied in PIE.\n" 1252 | "\tCPF_ExposeOnSpawn =\t\t\t\t\t\t0x0001000000000000,\t// Property is exposed on spawn.\n" 1253 | "\tCPF_PersistentInstance =\t\t\t\t0x0002000000000000,\t// A object referenced by the property is duplicated like a component. (Each actor should have an own instance.)\n" 1254 | "\tCPF_UObjectWrapper =\t\t\t\t\t0x0004000000000000,\t// Property was parsed as a wrapper class like TSubclassOf , FScriptInterface etc., rather than a USomething*.\n" 1255 | "\tCPF_HasGetValueTypeHash =\t\t\t\t0x0008000000000000,\t// This property can generate a meaningful hash value.\n" 1256 | "\tCPF_NativeAccessSpecifierPublic =\t\t0x0010000000000000,\t// Public native access specifier.\n" 1257 | "\tCPF_NativeAccessSpecifierProtected =\t0x0020000000000000,\t// Protected native access specifier.\n" 1258 | "\tCPF_NativeAccessSpecifierPrivate =\t\t0x0040000000000000,\t// Private native access specifier.\n" 1259 | "\tCPF_SkipSerialization =\t\t\t\t\t0x0080000000000000\t// Property shouldn\'t be serialized, can still be exported to text.\n" 1260 | "};\n" 1261 | "\n" 1262 | "// Object Flags\n" 1263 | "// https://docs.unrealengine.com/4.26/en-US/API/Runtime/CoreUObject/UObject/EObjectFlags/\n" 1264 | "enum EObjectFlags\n" 1265 | "{\n" 1266 | "\tRF_NoFlags =\t\t\t\t\t\t\t0x00000000,\n" 1267 | "\tRF_Public =\t\t\t\t\t\t\t\t0x00000001,\n" 1268 | "\tRF_Standalone =\t\t\t\t\t\t\t0x00000002,\n" 1269 | "\tRF_MarkAsNative =\t\t\t\t\t\t0x00000004,\n" 1270 | "\tRF_Transactional =\t\t\t\t\t\t0x00000008,\n" 1271 | "\tRF_ClassDefaultObject =\t\t\t\t\t0x00000010,\n" 1272 | "\tRF_ArchetypeObject =\t\t\t\t\t0x00000020,\n" 1273 | "\tRF_Transient =\t\t\t\t\t\t\t0x00000040,\n" 1274 | "\tRF_MarkAsRootSet =\t\t\t\t\t\t0x00000080,\n" 1275 | "\tRF_TagGarbageTemp =\t\t\t\t\t\t0x00000100,\n" 1276 | "\tRF_NeedInitialization =\t\t\t\t\t0x00000200,\n" 1277 | "\tRF_NeedLoad =\t\t\t\t\t\t\t0x00000400,\n" 1278 | "\tRF_KeepForCooker =\t\t\t\t\t\t0x00000800,\n" 1279 | "\tRF_NeedPostLoad =\t\t\t\t\t\t0x00001000,\n" 1280 | "\tRF_NeedPostLoadSubobjects =\t\t\t\t0x00002000,\n" 1281 | "\tRF_NewerVersionExists =\t\t\t\t\t0x00004000,\n" 1282 | "\tRF_BeginDestroyed =\t\t\t\t\t\t0x00008000,\n" 1283 | "\tRF_FinishDestroyed =\t\t\t\t\t0x00010000,\n" 1284 | "\tRF_BeingRegenerated =\t\t\t\t\t0x00020000,\n" 1285 | "\tRF_DefaultSubObject =\t\t\t\t\t0x00040000,\n" 1286 | "\tRF_WasLoaded =\t\t\t\t\t\t\t0x00080000,\n" 1287 | "\tRF_TextExportTransient =\t\t\t\t0x00100000,\n" 1288 | "\tRF_LoadCompleted =\t\t\t\t\t\t0x00200000,\n" 1289 | "\tRF_InheritableComponentTemplate =\t\t0x00400000,\n" 1290 | "\tRF_DuplicateTransient =\t\t\t\t\t0x00800000,\n" 1291 | "\tRF_StrongRefOnFrame =\t\t\t\t\t0x01000000,\n" 1292 | "\tRF_NonPIEDuplicateTransient =\t\t\t0x02000000,\n" 1293 | "\tRF_Dynamic =\t\t\t\t\t\t\t0x04000000,\n" 1294 | "\tRF_WillBeLoaded =\t\t\t\t\t\t0x08000000,\n" 1295 | "};\n"; 1296 | } 1297 | 1298 | /* 1299 | # ========================================================================================= # 1300 | # 1301 | # ========================================================================================= # 1302 | */ -------------------------------------------------------------------------------- /Engine/Template/PiecesOfCode.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | /* 5 | # ========================================================================================= # 6 | # Pieces Of Code 7 | # ========================================================================================= # 8 | */ 9 | 10 | // These are global variables for the generator, only change them if you know what you're doing! 11 | 12 | namespace PiecesOfCode 13 | { 14 | extern const std::string TArray_Iterator; 15 | extern const std::string TArray_Class; 16 | extern const std::string TMap_Class; 17 | extern const std::string FNameEntry_Struct; 18 | extern const std::string FNameEntry_Struct_UTF16; 19 | extern const std::string FNameEntry_Struct_UTF8; 20 | extern const std::string FName_Struct_UTF16; 21 | extern const std::string FName_Struct_UTF8; 22 | extern const std::string FString_Class_UTF16; 23 | extern const std::string FString_Class_UTF8; 24 | extern const std::string FScriptDelegate_Struct; 25 | extern const std::string FPointer_Struct; 26 | extern const std::string FQWord_Struct; 27 | extern const std::string UObject_FunctionDescriptions; 28 | extern const std::string UObject_Functions; 29 | extern const std::string UFunction_Functions; 30 | extern const std::string EEnumFlags; 31 | } 32 | 33 | /* 34 | # ========================================================================================= # 35 | # 36 | # ========================================================================================= # 37 | */ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 CodeRed 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Member.cpp: -------------------------------------------------------------------------------- 1 | #include "Engine/Engine.hpp" 2 | 3 | /* 4 | # ========================================================================================= # 5 | # Members 6 | # ========================================================================================= # 7 | */ 8 | 9 | Member::Member() : Type(EMemberTypes::UNKNOWN), Label(GetLabel(Type)), Offset(0x0), Size(1) {} 10 | 11 | Member::Member(EMemberTypes type, size_t size) : Type(type), Label(GetLabel(type)), Offset(GetOffset(type)), Size(size) {} 12 | 13 | Member::Member(const Member& member) : Type(member.Type), Label(member.Label), Offset(member.Offset), Size(member.Size) {} 14 | 15 | Member::~Member() {} 16 | 17 | std::string Member::GetLabel(EMemberTypes type) 18 | { 19 | switch (type) 20 | { 21 | case EMemberTypes::FNAMEENTRY_FLAGS: 22 | return "uint64_t Flags;"; 23 | case EMemberTypes::FNAMEENTRY_INDEX: 24 | return "int32_t Index;"; 25 | case EMemberTypes::FNAMEENTRY_NAME: 26 | #ifdef UTF16 27 | return "wchar_t Name[0x400];"; 28 | #else 29 | return "char Name[0x400];"; 30 | #endif 31 | case EMemberTypes::UOBJECT_VFTABLE: 32 | return "struct FPointer VfTableObject;"; 33 | case EMemberTypes::UOBJECT_INDEX: 34 | return "int32_t ObjectInternalInteger;"; 35 | case EMemberTypes::UOBJECT_OUTER: 36 | return "class UObject* Outer;"; 37 | case EMemberTypes::UOBJECT_NAME: 38 | return "struct FName Name;"; 39 | case EMemberTypes::UOBJECT_CLASS: 40 | return "class UClass* Class;"; 41 | case EMemberTypes::UFIELD_NEXT: 42 | return "class UField* Next;"; 43 | case EMemberTypes::UFIELD_SUPERFIELD: 44 | return "class UField* SuperField;"; 45 | case EMemberTypes::UENUM_NAMES: 46 | return "TArray Names;"; 47 | case EMemberTypes::UCONST_VALUE: 48 | return "class FString Value;"; 49 | case EMemberTypes::UPROPERTY_DIMENSION: 50 | return "uint32_t ArrayDim;"; 51 | case EMemberTypes::UPROPERTY_SIZE: 52 | return "uint32_t ElementSize;"; 53 | case EMemberTypes::UPROPERTY_FLAGS: 54 | return "uint64_t PropertyFlags;"; 55 | case EMemberTypes::UPROPERTY_OFFSET: 56 | return "uint32_t Offset;"; 57 | case EMemberTypes::USTRUCT_SUPERFIELD: 58 | return "class UField* SuperField;"; 59 | case EMemberTypes::USTRUCT_CHILDREN: 60 | return "class UField* Children;"; 61 | case EMemberTypes::USTRUCT_SIZE: 62 | return "uint32_t PropertySize;"; 63 | case EMemberTypes::UFUNCTION_FLAGS: 64 | return "uint64_t FunctionFlags;"; 65 | case EMemberTypes::UFUNCTION_NATIVE: 66 | return "uint16_t iNative;"; 67 | case EMemberTypes::USTRUCTPROPERTY_STRUCT: 68 | return "class UStruct* Struct;"; 69 | case EMemberTypes::UOBJECTPROPERTY_PROPERTY: 70 | return "class UClass* PropertyClass;"; 71 | case EMemberTypes::UCLASSPROPERTY_METACLASS: 72 | return "class UClass* MetaClass;"; 73 | case EMemberTypes::UMAPPROPERTY_KEY: 74 | return "class UProperty* Key;"; 75 | case EMemberTypes::UMAPPROPERTY_VALUE: 76 | return "class UProperty* Value;"; 77 | case EMemberTypes::UINTERFACEPROPERTY_CLASS: 78 | return "class UClass* InterfaceClass;"; 79 | case EMemberTypes::UDELEGATEPROPERTY_FUNCTION: 80 | return "class UFuncton* DelegateFunction;"; 81 | case EMemberTypes::UDELEGATEPROPERTY_NAME: 82 | return "struct FName DelegateName;"; 83 | case EMemberTypes::UBYTEPROPERTY_ENUM: 84 | return "class UEnum* Enum;"; 85 | case EMemberTypes::UBOOLPROPERTY_BITMASK: 86 | return "uint64_t BitMask;"; 87 | case EMemberTypes::UARRAYPROPERTY_INNTER: 88 | return "class UProperty* Inner;"; 89 | default: 90 | return "uint8_t UnknownMemberType[0x1];"; 91 | } 92 | } 93 | 94 | uintptr_t Member::GetOffset(EMemberTypes type) 95 | { 96 | switch (type) 97 | { 98 | case EMemberTypes::FNAMEENTRY_FLAGS: 99 | return offsetof(FNameEntry, Flags); 100 | case EMemberTypes::FNAMEENTRY_INDEX: 101 | return offsetof(FNameEntry, Index); 102 | case EMemberTypes::FNAMEENTRY_NAME: 103 | return offsetof(FNameEntry, Name); 104 | case EMemberTypes::UOBJECT_VFTABLE: 105 | return offsetof(UObject, VfTableObject); 106 | case EMemberTypes::UOBJECT_INDEX: 107 | return offsetof(UObject, ObjectInternalInteger); 108 | case EMemberTypes::UOBJECT_OUTER: 109 | return offsetof(UObject, Outer); 110 | case EMemberTypes::UOBJECT_NAME: 111 | return offsetof(UObject, Name); 112 | case EMemberTypes::UOBJECT_CLASS: 113 | return offsetof(UObject, Class); 114 | case EMemberTypes::UFIELD_NEXT: 115 | return offsetof(UField, Next); 116 | case EMemberTypes::UFIELD_SUPERFIELD: 117 | return offsetof(UStruct, SuperField); 118 | case EMemberTypes::UENUM_NAMES: 119 | return offsetof(UEnum, Names); 120 | case EMemberTypes::UCONST_VALUE: 121 | return offsetof(UConst, Value); 122 | case EMemberTypes::UPROPERTY_DIMENSION: 123 | return offsetof(UProperty, ArrayDim); 124 | case EMemberTypes::UPROPERTY_SIZE: 125 | return offsetof(UProperty, ElementSize); 126 | case EMemberTypes::UPROPERTY_FLAGS: 127 | return offsetof(UProperty, PropertyFlags); 128 | case EMemberTypes::UPROPERTY_OFFSET: 129 | return offsetof(UProperty, Offset); 130 | case EMemberTypes::USTRUCT_SUPERFIELD: 131 | return offsetof(UStruct, SuperField); 132 | case EMemberTypes::USTRUCT_CHILDREN: 133 | return offsetof(UStruct, Children); 134 | case EMemberTypes::USTRUCT_SIZE: 135 | return offsetof(UStruct, PropertySize); 136 | case EMemberTypes::UFUNCTION_FLAGS: 137 | return offsetof(UFunction, FunctionFlags); 138 | case EMemberTypes::UFUNCTION_NATIVE: 139 | return offsetof(UFunction, iNative); 140 | case EMemberTypes::USTRUCTPROPERTY_STRUCT: 141 | return offsetof(UStructProperty, Struct); 142 | case EMemberTypes::UOBJECTPROPERTY_PROPERTY: 143 | return offsetof(UObjectProperty, PropertyClass); 144 | case EMemberTypes::UCLASSPROPERTY_METACLASS: 145 | return offsetof(UClassProperty, MetaClass); 146 | case EMemberTypes::UMAPPROPERTY_KEY: 147 | return offsetof(UMapProperty, Key); 148 | case EMemberTypes::UMAPPROPERTY_VALUE: 149 | return offsetof(UMapProperty, Value); 150 | case EMemberTypes::UINTERFACEPROPERTY_CLASS: 151 | return offsetof(UInterfaceProperty, InterfaceClass); 152 | case EMemberTypes::UDELEGATEPROPERTY_FUNCTION: 153 | return offsetof(UDelegateProperty, DelegateFunction); 154 | case EMemberTypes::UDELEGATEPROPERTY_NAME: 155 | return offsetof(UDelegateProperty, DelegateName); 156 | case EMemberTypes::UBYTEPROPERTY_ENUM: 157 | return offsetof(UByteProperty, Enum); 158 | case EMemberTypes::UBOOLPROPERTY_BITMASK: 159 | return offsetof(UBoolProperty, BitMask); 160 | case EMemberTypes::UARRAYPROPERTY_INNTER: 161 | return offsetof(UArrayProperty, Inner); 162 | default: 163 | return 0x0; 164 | } 165 | } 166 | 167 | size_t Member::GetClassSize(EClassTypes type) 168 | { 169 | switch (type) 170 | { 171 | case EClassTypes::STRUCT_FNAMEENTRY: 172 | return sizeof(FNameEntry); 173 | case EClassTypes::CLASS_UOBJECT: 174 | return sizeof(UObject); 175 | case EClassTypes::CLASS_UFIELD: 176 | return sizeof(UField); 177 | case EClassTypes::CLASS_UENUM: 178 | return sizeof(UEnum); 179 | case EClassTypes::CLASS_UCONST: 180 | return sizeof(UConst); 181 | case EClassTypes::CLASS_UPROPERTY: 182 | return sizeof(UProperty); 183 | case EClassTypes::CLASS_USTRUCT: 184 | return sizeof(UStruct); 185 | case EClassTypes::CLASS_UFUNCTION: 186 | return sizeof(UFunction); 187 | case EClassTypes::CLASS_USTRUCTPROPERTY: 188 | return sizeof(UStructProperty); 189 | case EClassTypes::CLASS_UOBJECTPROPERTY: 190 | return sizeof(UObjectProperty); 191 | case EClassTypes::CLASS_UCLASSPROPERTY: 192 | return sizeof(UClassProperty); 193 | case EClassTypes::CLASS_UMAPPROPERTY: 194 | return sizeof(UMapProperty); 195 | case EClassTypes::CLASS_UINTERFACEPROPERTY: 196 | return sizeof(UInterfaceProperty); 197 | case EClassTypes::CLASS_UDELEGATEPROPERTY: 198 | return sizeof(UDelegateProperty); 199 | case EClassTypes::CLASS_UBYTEPROPERTY: 200 | return sizeof(UByteProperty); 201 | case EClassTypes::CLASS_UBOOLPROPERTY: 202 | return sizeof(UBoolProperty); 203 | case EClassTypes::CLASS_UARRAYPROPERTY: 204 | return sizeof(UArrayProperty); 205 | default: 206 | return 0; 207 | } 208 | } 209 | 210 | size_t Member::GetClassOffset(EClassTypes type) 211 | { 212 | switch (type) 213 | { 214 | case EClassTypes::STRUCT_FNAMEENTRY: 215 | return 0; 216 | case EClassTypes::CLASS_UOBJECT: 217 | return 0; 218 | case EClassTypes::CLASS_UFIELD: 219 | return sizeof(UObject); 220 | case EClassTypes::CLASS_UENUM: 221 | return sizeof(UField); 222 | case EClassTypes::CLASS_UCONST: 223 | return sizeof(UField); 224 | case EClassTypes::CLASS_UPROPERTY: 225 | return sizeof(UField); 226 | case EClassTypes::CLASS_USTRUCT: 227 | return sizeof(UField); 228 | case EClassTypes::CLASS_UFUNCTION: 229 | return sizeof(UStruct); 230 | case EClassTypes::CLASS_USTRUCTPROPERTY: 231 | return sizeof(UProperty); 232 | case EClassTypes::CLASS_UOBJECTPROPERTY: 233 | return sizeof(UProperty); 234 | case EClassTypes::CLASS_UCLASSPROPERTY: 235 | return sizeof(UProperty); 236 | case EClassTypes::CLASS_UMAPPROPERTY: 237 | return sizeof(UProperty); 238 | case EClassTypes::CLASS_UINTERFACEPROPERTY: 239 | return sizeof(UProperty); 240 | case EClassTypes::CLASS_UDELEGATEPROPERTY: 241 | return sizeof(UProperty); 242 | case EClassTypes::CLASS_UBYTEPROPERTY: 243 | return sizeof(UProperty); 244 | case EClassTypes::CLASS_UBOOLPROPERTY: 245 | return sizeof(UProperty); 246 | case EClassTypes::CLASS_UARRAYPROPERTY: 247 | return sizeof(UProperty); 248 | default: 249 | return 0; 250 | } 251 | } 252 | 253 | void Member::Register(EMemberTypes type, size_t size) 254 | { 255 | RegisteredMembers[type] = Member(type, size); 256 | } 257 | 258 | std::map Member::GetRegistered(EClassTypes type) 259 | { 260 | std::map returnMembers; 261 | 262 | switch (type) 263 | { 264 | case EClassTypes::STRUCT_FNAMEENTRY: 265 | returnMembers[RegisteredMembers[EMemberTypes::FNAMEENTRY_FLAGS].Offset] = RegisteredMembers[EMemberTypes::FNAMEENTRY_FLAGS]; 266 | returnMembers[RegisteredMembers[EMemberTypes::FNAMEENTRY_INDEX].Offset] = RegisteredMembers[EMemberTypes::FNAMEENTRY_INDEX]; 267 | returnMembers[RegisteredMembers[EMemberTypes::FNAMEENTRY_NAME].Offset] = RegisteredMembers[EMemberTypes::FNAMEENTRY_NAME]; 268 | break; 269 | case EClassTypes::CLASS_UOBJECT: 270 | returnMembers[RegisteredMembers[EMemberTypes::UOBJECT_VFTABLE].Offset] = RegisteredMembers[EMemberTypes::UOBJECT_VFTABLE]; 271 | returnMembers[RegisteredMembers[EMemberTypes::UOBJECT_INDEX].Offset] = RegisteredMembers[EMemberTypes::UOBJECT_INDEX]; 272 | returnMembers[RegisteredMembers[EMemberTypes::UOBJECT_OUTER].Offset] = RegisteredMembers[EMemberTypes::UOBJECT_OUTER]; 273 | returnMembers[RegisteredMembers[EMemberTypes::UOBJECT_NAME].Offset] = RegisteredMembers[EMemberTypes::UOBJECT_NAME]; 274 | returnMembers[RegisteredMembers[EMemberTypes::UOBJECT_CLASS].Offset] = RegisteredMembers[EMemberTypes::UOBJECT_CLASS]; 275 | break; 276 | case EClassTypes::CLASS_UFIELD: 277 | returnMembers[RegisteredMembers[EMemberTypes::UFIELD_NEXT].Offset] = RegisteredMembers[EMemberTypes::UFIELD_NEXT]; 278 | 279 | if (RegisteredMembers.find(EMemberTypes::UFIELD_SUPERFIELD) != RegisteredMembers.end()) 280 | { 281 | returnMembers[RegisteredMembers[EMemberTypes::UFIELD_SUPERFIELD].Offset] = RegisteredMembers[EMemberTypes::UFIELD_SUPERFIELD]; 282 | } 283 | 284 | break; 285 | case EClassTypes::CLASS_UENUM: 286 | returnMembers[RegisteredMembers[EMemberTypes::UENUM_NAMES].Offset] = RegisteredMembers[EMemberTypes::UENUM_NAMES]; 287 | break; 288 | case EClassTypes::CLASS_UCONST: 289 | returnMembers[RegisteredMembers[EMemberTypes::UCONST_VALUE].Offset] = RegisteredMembers[EMemberTypes::UCONST_VALUE]; 290 | break; 291 | case EClassTypes::CLASS_UPROPERTY: 292 | returnMembers[RegisteredMembers[EMemberTypes::UPROPERTY_DIMENSION].Offset] = RegisteredMembers[EMemberTypes::UPROPERTY_DIMENSION]; 293 | returnMembers[RegisteredMembers[EMemberTypes::UPROPERTY_SIZE].Offset] = RegisteredMembers[EMemberTypes::UPROPERTY_SIZE]; 294 | returnMembers[RegisteredMembers[EMemberTypes::UPROPERTY_FLAGS].Offset] = RegisteredMembers[EMemberTypes::UPROPERTY_FLAGS]; 295 | returnMembers[RegisteredMembers[EMemberTypes::UPROPERTY_OFFSET].Offset] = RegisteredMembers[EMemberTypes::UPROPERTY_OFFSET]; 296 | break; 297 | case EClassTypes::CLASS_USTRUCT: 298 | if (RegisteredMembers.find(EMemberTypes::USTRUCT_SUPERFIELD) != RegisteredMembers.end()) 299 | { 300 | returnMembers[RegisteredMembers[EMemberTypes::USTRUCT_SUPERFIELD].Offset] = RegisteredMembers[EMemberTypes::USTRUCT_SUPERFIELD]; 301 | } 302 | 303 | returnMembers[RegisteredMembers[EMemberTypes::USTRUCT_CHILDREN].Offset] = RegisteredMembers[EMemberTypes::USTRUCT_CHILDREN]; 304 | returnMembers[RegisteredMembers[EMemberTypes::USTRUCT_SIZE].Offset] = RegisteredMembers[EMemberTypes::USTRUCT_SIZE]; 305 | break; 306 | case EClassTypes::CLASS_UFUNCTION: 307 | returnMembers[RegisteredMembers[EMemberTypes::UFUNCTION_FLAGS].Offset] = RegisteredMembers[EMemberTypes::UFUNCTION_FLAGS]; 308 | returnMembers[RegisteredMembers[EMemberTypes::UFUNCTION_NATIVE].Offset] = RegisteredMembers[EMemberTypes::UFUNCTION_NATIVE]; 309 | break; 310 | case EClassTypes::CLASS_USTRUCTPROPERTY: 311 | returnMembers[RegisteredMembers[EMemberTypes::USTRUCTPROPERTY_STRUCT].Offset] = RegisteredMembers[EMemberTypes::USTRUCTPROPERTY_STRUCT]; 312 | break; 313 | case EClassTypes::CLASS_UOBJECTPROPERTY: 314 | returnMembers[RegisteredMembers[EMemberTypes::UOBJECTPROPERTY_PROPERTY].Offset] = RegisteredMembers[EMemberTypes::UOBJECTPROPERTY_PROPERTY]; 315 | break; 316 | case EClassTypes::CLASS_UCLASSPROPERTY: 317 | returnMembers[RegisteredMembers[EMemberTypes::UCLASSPROPERTY_METACLASS].Offset] = RegisteredMembers[EMemberTypes::UCLASSPROPERTY_METACLASS]; 318 | break; 319 | case EClassTypes::CLASS_UMAPPROPERTY: 320 | returnMembers[RegisteredMembers[EMemberTypes::UMAPPROPERTY_KEY].Offset] = RegisteredMembers[EMemberTypes::UMAPPROPERTY_KEY]; 321 | returnMembers[RegisteredMembers[EMemberTypes::UMAPPROPERTY_VALUE].Offset] = RegisteredMembers[EMemberTypes::UMAPPROPERTY_VALUE]; 322 | break; 323 | case EClassTypes::CLASS_UINTERFACEPROPERTY: 324 | returnMembers[RegisteredMembers[EMemberTypes::UINTERFACEPROPERTY_CLASS].Offset] = RegisteredMembers[EMemberTypes::UINTERFACEPROPERTY_CLASS]; 325 | break; 326 | case EClassTypes::CLASS_UDELEGATEPROPERTY: 327 | returnMembers[RegisteredMembers[EMemberTypes::UDELEGATEPROPERTY_FUNCTION].Offset] = RegisteredMembers[EMemberTypes::UDELEGATEPROPERTY_FUNCTION]; 328 | returnMembers[RegisteredMembers[EMemberTypes::UDELEGATEPROPERTY_NAME].Offset] = RegisteredMembers[EMemberTypes::UDELEGATEPROPERTY_NAME]; 329 | break; 330 | case EClassTypes::CLASS_UBYTEPROPERTY: 331 | returnMembers[RegisteredMembers[EMemberTypes::UBYTEPROPERTY_ENUM].Offset] = RegisteredMembers[EMemberTypes::UBYTEPROPERTY_ENUM]; 332 | break; 333 | case EClassTypes::CLASS_UBOOLPROPERTY: 334 | returnMembers[RegisteredMembers[EMemberTypes::UBOOLPROPERTY_BITMASK].Offset] = RegisteredMembers[EMemberTypes::UBOOLPROPERTY_BITMASK]; 335 | break; 336 | case EClassTypes::CLASS_UARRAYPROPERTY: 337 | returnMembers[RegisteredMembers[EMemberTypes::UARRAYPROPERTY_INNTER].Offset] = RegisteredMembers[EMemberTypes::UARRAYPROPERTY_INNTER]; 338 | break; 339 | } 340 | 341 | return returnMembers; 342 | } 343 | 344 | /* 345 | # ========================================================================================= # 346 | # 347 | # ========================================================================================= # 348 | */ -------------------------------------------------------------------------------- /Member.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | 4 | // Class Types 5 | enum class EClassTypes : uint8_t 6 | { 7 | UNKNOWN, 8 | STRUCT_FNAMEENTRY, 9 | STRUCT_FNAME, 10 | CLASS_UOBJECT, 11 | CLASS_UFIELD, 12 | CLASS_UENUM, 13 | CLASS_UCONST, 14 | CLASS_UPROPERTY, 15 | CLASS_USTRUCT, 16 | CLASS_UFUNCTION, 17 | CLASS_USCRIPTSTRUCT, 18 | CLASS_USTATE, 19 | CLASS_UCLASS, 20 | CLASS_USTRUCTPROPERTY, 21 | CLASS_USTRPROPERTY, 22 | CLASS_UQWORDPROPERTY, 23 | CLASS_UOBJECTPROPERTY, 24 | CLASS_UCOMPONENTPROPERTY, 25 | CLASS_UCLASSPROPERTY, 26 | CLASS_UNAMEPROPERTY, 27 | CLASS_UMAPPROPERTY, 28 | CLASS_UINTPROPERTY, 29 | CLASS_UINTERFACEPROPERTY, 30 | CLASS_UFLOATPROPERTY, 31 | CLASS_UDELEGATEPROPERTY, 32 | CLASS_UBYTEPROPERTY, 33 | CLASS_UBOOLPROPERTY, 34 | CLASS_UARRAYPROPERTY 35 | }; 36 | 37 | // Class Member Types 38 | enum class EMemberTypes : uint8_t 39 | { 40 | UNKNOWN, 41 | FNAMEENTRY_FLAGS, 42 | FNAMEENTRY_INDEX, 43 | FNAMEENTRY_NAME, 44 | UOBJECT_VFTABLE, 45 | UOBJECT_INDEX, 46 | UOBJECT_OUTER, 47 | UOBJECT_NAME, 48 | UOBJECT_CLASS, 49 | UFIELD_NEXT, 50 | UFIELD_SUPERFIELD, // Not needed if "SuperField" is in the "UStruct" class! 51 | UENUM_NAMES, 52 | UCONST_VALUE, 53 | UPROPERTY_DIMENSION, 54 | UPROPERTY_SIZE, 55 | UPROPERTY_FLAGS, 56 | UPROPERTY_OFFSET, 57 | USTRUCT_SUPERFIELD, // Not needed if "SuperField" is in the "UField" class! 58 | USTRUCT_CHILDREN, 59 | USTRUCT_SIZE, 60 | UFUNCTION_FLAGS, 61 | UFUNCTION_NATIVE, 62 | USTRUCTPROPERTY_STRUCT, 63 | UOBJECTPROPERTY_PROPERTY, 64 | UCLASSPROPERTY_METACLASS, 65 | UMAPPROPERTY_KEY, 66 | UMAPPROPERTY_VALUE, 67 | UINTERFACEPROPERTY_CLASS, 68 | UDELEGATEPROPERTY_FUNCTION, 69 | UDELEGATEPROPERTY_NAME, 70 | UBYTEPROPERTY_ENUM, 71 | UBOOLPROPERTY_BITMASK, 72 | UARRAYPROPERTY_INNTER 73 | }; 74 | 75 | /* 76 | # ========================================================================================= # 77 | # Members 78 | # ========================================================================================= # 79 | */ 80 | 81 | class Member 82 | { 83 | public: 84 | EMemberTypes Type; // Internal id used to tell which member this class is. 85 | std::string Label; // String label used for printing the member inside the class. 86 | uintptr_t Offset; // Member offset from the base of the class. 87 | size_t Size; // Size of the member at the given offset. 88 | 89 | public: 90 | Member(); 91 | Member(EMemberTypes type, size_t size); 92 | Member(const Member& member); 93 | ~Member(); 94 | 95 | public: // Global Utils 96 | static std::string GetLabel(EMemberTypes type); // Returns the string version of the member used for printing in the generated sdk. 97 | static uintptr_t GetOffset(EMemberTypes type); // Returns the members offset in its defined class. 98 | static size_t GetClassSize(EClassTypes type); // Returns the "sizeof" for the given class type. 99 | static size_t GetClassOffset(EClassTypes type); // Returns the start offset of the given type, taking into account its inherited classes. 100 | 101 | public: 102 | static void Register(EMemberTypes type, size_t size); // This should only be called by the "REGISTER_MEMBER" macro! 103 | static std::map GetRegistered(EClassTypes type); // Returns registered members for the given class type, ordered by their offsets. 104 | 105 | private: 106 | static inline std::unordered_map RegisteredMembers; 107 | }; 108 | 109 | #define REGISTER_MEMBER(memberVariable, memberName, memberType) static void Register_##memberName(){ Member::Register(memberType, sizeof(memberVariable)); } 110 | 111 | /* 112 | # ========================================================================================= # 113 | # 114 | # ========================================================================================= # 115 | */ -------------------------------------------------------------------------------- /Printer.cpp: -------------------------------------------------------------------------------- 1 | #include "Printer.hpp" 2 | #include "Engine/Engine.hpp" 3 | 4 | namespace Printer 5 | { 6 | void Empty(std::ostringstream& stream) 7 | { 8 | stream.str(std::string()); 9 | } 10 | 11 | void FillRight(std::ostringstream& stream, char fill, size_t width) 12 | { 13 | stream << std::setfill(fill) << std::setw(width) << std::right; 14 | } 15 | 16 | void FillLeft(std::ostringstream& stream, char fill, size_t width) 17 | { 18 | stream << std::setfill(fill) << std::setw(width) << std::left; 19 | } 20 | 21 | void FillRight(std::ofstream& stream, char fill, size_t width) 22 | { 23 | stream << std::setfill(fill) << std::setw(width) << std::right; 24 | } 25 | 26 | void FillLeft(std::ofstream& stream, char fill, size_t width) 27 | { 28 | stream << std::setfill(fill) << std::setw(width) << std::left; 29 | } 30 | 31 | std::string Hex(uint64_t decimal, size_t width) 32 | { 33 | std::ostringstream stream; 34 | stream << "0x" << std::setfill('0') << std::setw(width) << std::right << std::uppercase << std::hex << decimal; 35 | return stream.str(); 36 | } 37 | 38 | std::string Hex(uint64_t decimal, EWidthTypes width) 39 | { 40 | return Hex(decimal, static_cast(width)); 41 | } 42 | 43 | std::string Hex(void* pointer) 44 | { 45 | return Hex(reinterpret_cast(pointer), sizeof(uintptr_t)); 46 | } 47 | 48 | std::string Decimal(uint64_t hex, size_t width) 49 | { 50 | std::ostringstream stream; 51 | stream << std::setfill('0') << std::setw(width) << std::right << std::uppercase << std::dec << hex; 52 | return stream.str(); 53 | } 54 | 55 | std::string Decimal(uint64_t hex, EWidthTypes width) 56 | { 57 | return Decimal(hex, static_cast(width)); 58 | } 59 | 60 | std::string Precision(float value, size_t precision) 61 | { 62 | std::ostringstream stream; 63 | stream << std::setprecision(precision) << value; 64 | return stream.str(); 65 | } 66 | 67 | void Header(std::ostringstream& stream, const std::string& fileName, const std::string& fileExtension, bool bPragmaPush) 68 | { 69 | stream << "/*\n"; 70 | stream << "#############################################################################################\n"; 71 | stream << "# " << Configuration::GameName << " (" << Configuration::GameVersion + ") SDK\n"; 72 | stream << "# Generated with the " << Engine::GeneratorName << " " << Engine::GeneratorVersion << "\n"; 73 | stream << "# ========================================================================================= #\n"; 74 | stream << "# File: " << fileName << "." << fileExtension << "\n"; 75 | stream << "# ========================================================================================= #\n"; 76 | stream << "# Credits: " << Engine::GeneratorCredits << "\n"; 77 | stream << "# Links: " << Engine::GeneratorLinks << "\n"; 78 | stream << "#############################################################################################\n"; 79 | stream << "*/\n"; 80 | 81 | if ((fileName != "SdkHeaders") && (fileName != "GameDefines")) 82 | { 83 | if (fileExtension == "hpp") 84 | { 85 | stream << "#pragma once\n"; 86 | 87 | if (Configuration::UsingConstants) 88 | { 89 | stream << "#include \"../SdkConstants.hpp\"\n"; 90 | } 91 | } 92 | else if (fileExtension == "cpp") 93 | { 94 | stream << "#include \"../SdkHeaders.hpp\"\n"; 95 | } 96 | } 97 | 98 | if (bPragmaPush) 99 | { 100 | stream << "\n#ifdef _MSC_VER\n"; 101 | stream << "\t#pragma pack(push, 0x" + std::to_string(Configuration::FinalAlignment) + ")\n"; 102 | stream << "#endif\n"; 103 | } 104 | } 105 | 106 | void Header(std::ofstream& stream, const std::string& fileName, const std::string& fileExtension, bool bPragmaPush) 107 | { 108 | std::ostringstream sStream; 109 | Header(sStream, fileName, fileExtension, bPragmaPush); 110 | stream << sStream.str(); 111 | } 112 | 113 | void Section(std::ostringstream& stream, const std::string& sectionName) 114 | { 115 | stream << "\n/*\n"; 116 | stream << "# ========================================================================================= #\n"; 117 | stream << "# " << sectionName << "\n"; 118 | stream << "# ========================================================================================= #\n"; 119 | stream << "*/\n\n"; 120 | } 121 | 122 | void Section(std::ofstream& stream, const std::string& sectionName) 123 | { 124 | std::ostringstream sStream; 125 | Section(sStream, sectionName); 126 | stream << sStream.str(); 127 | } 128 | 129 | void Footer(std::ostringstream& stream, bool bPragmaPop) 130 | { 131 | stream << "/*\n"; 132 | stream << "# ========================================================================================= #\n"; 133 | stream << "#\n"; 134 | stream << "# ========================================================================================= #\n"; 135 | stream << "*/\n"; 136 | 137 | if (bPragmaPop) 138 | { 139 | stream << "\n#ifdef _MSC_VER\n"; 140 | stream << "\t#pragma pack(pop)\n"; 141 | stream << "#endif\n"; 142 | } 143 | } 144 | 145 | void Footer(std::ofstream& stream, bool bPragmaPop) 146 | { 147 | std::ostringstream sStream; 148 | Footer(sStream, bPragmaPop); 149 | stream << sStream.str(); 150 | } 151 | } -------------------------------------------------------------------------------- /Printer.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | // Printer Width Types 11 | enum class EWidthTypes : size_t 12 | { 13 | NONE = 0, 14 | BYTE = 2, 15 | SIZE = 4, 16 | BITMASK = 8, 17 | FUNCTION_FLAGS = 8, 18 | WIDTH_FIELD = 14, 19 | PROPERTY_FLAGS = 16 20 | }; 21 | 22 | namespace Printer 23 | { 24 | void Empty(std::ostringstream& stream); 25 | void FillRight(std::ostringstream& stream, char fill, size_t width); 26 | void FillLeft(std::ostringstream& stream, char fill, size_t width); 27 | void FillRight(std::ofstream& stream, char fill, size_t width); 28 | void FillLeft(std::ofstream& stream, char fill, size_t width); 29 | std::string Hex(uint64_t decimal, size_t width); 30 | std::string Hex(uint64_t decimal, EWidthTypes width); 31 | std::string Hex(void* pointer); 32 | std::string Decimal(uint64_t hex, size_t width); 33 | std::string Decimal(uint64_t hex, EWidthTypes width); 34 | std::string Precision(float value, size_t precision); 35 | 36 | void Header(std::ostringstream& stream, const std::string& fileName, const std::string& fileExtension, bool bPragmaPush); 37 | void Header(std::ofstream& stream, const std::string& fileName, const std::string& fileExtension, bool bPragmaPush); 38 | void Section(std::ostringstream& stream, const std::string& sectionName); 39 | void Section(std::ofstream& stream, const std::string& sectionName); 40 | void Footer(std::ostringstream& stream, bool bPragmaPop); 41 | void Footer(std::ofstream& stream, bool bPragmaPop); 42 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## CodeRed Generator 3 v1.0.2 2 | 3 | This is a C++20 Unreal Engine 3 SDK generator that was originally based off the source of [TheFeckless's UE3 SDK Generator](https://www.unknowncheats.me/forum/unreal-engine-3-a/71911-thefeckless-ue3-sdk-generator.html). It has since grown into its own project which utilizes C++20, strings, filesystem paths, and modern file streams; along with converting legacy UE3 features to more modern and user friendly ones while still being compatible with UE3. 4 | 5 | ### Features 6 | 7 | - **Accessibility** 8 | Final generated SDK is plug and play, just `#include "SdkHeaders.hpp"` in your project, initialize globals, and you're ready to go. 9 | 10 | - **Global Initialization** 11 | You have the option to generate an SDK using either offsets or patterns for GObjects and GNames. 12 | 13 | - **Class Alignment** 14 | Full support for both x32 bit and x64 bit games, just change the `Alignment` value in `Configuration.cpp`. 15 | 16 | - **Full Customization** 17 | You have full customization over the final generated SDK, use enum classes, remove native flags, class alignment, and even comment spacing. 18 | 19 | ### Requirements 20 | 21 | - ISO C++20 Standard. 22 | - Visual Studio or another Windows based compiler (For Windows header files, along with the PSAPI library). 23 | 24 | ## Getting Started 25 | 26 | Included in this project is a template folder located in `Engine/Template`, to get started copy and paste this folder and rename it to the game you would like to use. To generate from your newly created engine folder don't forget to change the includes in the `Engine.hpp` file. 27 | 28 | In the `Configuration.hpp` file there are two defines, one is `NO_LOGGING` which disables writing to a log file, and another define called `UTF16`. If your game is using wide characters you will need to uncomment this define out, if not `UTF8` will be used by default. 29 | 30 | Any further configuration **MUST BE DONE IN THE `Configuration.cpp` ONLY!** This file contains everything from class alignment, process event settings, global patterns and offsets, your games name and version, and most importantly the directory used for SDK generation. 31 | 32 | ![](https://i.imgur.com/q2tFJ7I.png) 33 | ![](https://i.imgur.com/YK4iRMg.png) 34 | 35 | ## Generation 36 | 37 | Once you have your custom engine folder setup, all that's left is to fill out your class and struct fields for your game. This generator uses a unique `REGISTER_MEMBER` macro to define class/struct members. This is very important for your final generated SDK as it's used to calculate offsets and unknown data all automatically, without needing to modify your `PiecesOfCode.cpp` unlike in Feckless's generator. 38 | 39 | Any class/struct member outside of whats in the `EMemberTypes` does NOT need to be registered with the `REGISTER_MEMBER` macro, so feel free to place padding or buffers in between. 40 | 41 | ![](https://i.imgur.com/k0ewmaC.png) 42 | Once all your classes are filled out and you've made the necessary changes in `Configuration.cpp`, double check you didn't forget to set a path in `Configuration::Directory` and have the right files included in `Engine.hpp`. After that just compile as a DLL and manually inject into your game, generation will start automatically and will prompt you when it is completed. 43 | 44 | ## Finalization 45 | 46 | After your SDK has been generated you might need to make a minor change to it. Depending on the game the header files in `SdkHeaders.hpp` could be placed out of order, if they are make sure to swap it out in the order of the includes to `Core` first, then `Engine`. I'm not sure why this happens in some games and not others so I am unable to automate this step without a guarantee of messing something up. 47 | 48 | Here is an example what it should look like: 49 | ```cpp 50 | #include "GameDefines.hpp" 51 | #include "SDK_HEADERS\Core_structs.hpp" 52 | #include "SDK_HEADERS\Core_classes.hpp" 53 | #include "SDK_HEADERS\Core_parameters.hpp" 54 | #include "SDK_HEADERS\Engine_structs.hpp" 55 | #include "SDK_HEADERS\Engine_classes.hpp" 56 | #include "SDK_HEADERS\Engine_parameters.hpp" 57 | ...etc... 58 | ``` 59 | -------------------------------------------------------------------------------- /dllmain.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "pch.hpp" 3 | #include "Printer.hpp" 4 | #include "Engine/Engine.hpp" 5 | 6 | namespace Utils 7 | { 8 | void Messagebox(const std::string& message, uint32_t flags); 9 | bool MapExists(std::multimap& map, const std::string& key, const std::string& value); 10 | bool SortProperty(class UProperty* uPropertyA, class UProperty* uPropertyB); 11 | bool SortPropertyPair(const std::pair& pairA, const std::pair& pairB); 12 | bool IsStructProperty(EPropertyTypes propertyType); 13 | bool IsBitField(EPropertyTypes propertyType); 14 | bool IsBitField(uint32_t arrayDim); 15 | 16 | std::string CreateValidName(std::string name); 17 | std::string CreateUniqueName(class UClass* uClass); 18 | std::string CreateUniqueName(class UFunction* uFunction, class UClass* uClass); 19 | void CreateWinFunction(std::string& functionName); // Some unreal functions can have the same name as windows macros, this renames some of them. 20 | } 21 | 22 | namespace Retrievers 23 | { 24 | void GetAllPropertyFlags(std::ostringstream& stream, uint64_t propertyFlags); 25 | void GetAllFunctionFlags(std::ostringstream& stream, uint64_t functionFlags); 26 | EPropertyTypes GetPropertyTypeInternal(class UProperty* uProperty, std::string& outPropertyType, bool bIgnoreEnum, bool bIsBitField = false); 27 | EPropertyTypes GetPropertyType(class UProperty* uProperty, std::string& outPropertyType, bool bIsBitField = false); 28 | size_t GetPropertySize(class UProperty* uProperty, bool bIsBitField = true); 29 | uintptr_t GetEntryPoint(); 30 | uintptr_t GetOffset(void* pointer); 31 | uintptr_t FindPattern(HMODULE hModule, const uint8_t* pattern, const char* mask); 32 | } 33 | 34 | namespace ConstGenerator 35 | { 36 | void GenerateConst(std::ofstream& file, class UConst* constant); 37 | void ProcessConsts(std::ofstream& file, class UObject* packageObj); 38 | } 39 | 40 | namespace EnumGenerator 41 | { 42 | extern std::unordered_map> mEnumCache; 43 | extern std::unordered_map mGeneratedNames; 44 | std::string GenerateEnumName(class UEnum* uEnum); 45 | void GenerateEnum(std::ofstream& file, class UEnum* uEnum); 46 | void ProcessEnums(std::ofstream& file, class UObject* packageObj); 47 | } 48 | 49 | namespace StructGenerator 50 | { 51 | extern std::vector vGeneratedStructs; 52 | class UScriptStruct* FindLargestStruct(const std::string& structFullName); 53 | void GenerateStructFields(std::ofstream& structStream, EClassTypes structType); 54 | void GenerateStruct(std::ofstream& file, class UScriptStruct* scriptStruct); 55 | void GenerateStructProperties(std::ofstream& file, class UScriptStruct* scriptStruct, class UObject* packageObj); 56 | void ProcessStructs(std::ofstream& file, class UObject* packageObj); 57 | } 58 | 59 | namespace ClassGenerator 60 | { 61 | extern std::unordered_map mGeneratedClasses; 62 | void GenerateClassFields(std::ostringstream& classStream, class UClass* uClass, EClassTypes classType); 63 | void GenerateClass(std::ofstream& file, class UClass* uClass); 64 | void GenerateClassProperties(std::ofstream& file, class UClass* uClass, class UObject* packageObj); 65 | void ProcessClasses(std::ofstream& file, class UObject* packageObj); 66 | } 67 | 68 | namespace ParameterGenerator 69 | { 70 | void GenerateParameter(std::ofstream& file, class UClass* uClass); 71 | void ProcessParameters(std::ofstream& file, class UObject* packageObj); 72 | } 73 | 74 | namespace FunctionGenerator 75 | { 76 | void GenerateVirtualFunctions(std::ofstream& file); 77 | void GenerateFunctionCode(std::ofstream& file, class UClass* uClass); 78 | void GenerateFunctionDescription(std::ofstream& file, class UClass* uClass); 79 | void ProcessFunctions(std::ofstream& file, class UObject* packageObj); 80 | } 81 | 82 | namespace Generator 83 | { 84 | extern bool GlobalsInitialized; 85 | extern std::ofstream LogFile; 86 | extern std::vector vPackages; 87 | extern std::vector vIncludes; 88 | extern std::vector> vConstants; 89 | 90 | std::string GenerateIndex(class UObject* uObject, bool bPushBack = true); 91 | void GenerateConstants(); 92 | void GenerateHeaders(); 93 | void GenerateDefines(); 94 | void ProcessPackages(const std::filesystem::path& directory); 95 | void GenerateSDK(); 96 | 97 | bool Initialize(bool bCreateLog); 98 | void DumpInstances(bool bNames, bool bObjects); 99 | void DumpObjects(); 100 | void DumpNames(); 101 | 102 | bool AreObjectsValid(); 103 | bool AreGNamesValid(); 104 | bool AreGlobalsValid(); 105 | } -------------------------------------------------------------------------------- /pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.hpp" -------------------------------------------------------------------------------- /pch.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | #pragma comment(lib, "Psapi.lib") --------------------------------------------------------------------------------