├── 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