├── .gitignore ├── CreateNewProject.bat ├── CreateNewProject.ps1 ├── Engine ├── IGenerator.hpp ├── Logger.cpp ├── Logger.hpp ├── Main.cpp ├── NameValidator.cpp ├── NameValidator.hpp ├── NamesStore.cpp ├── NamesStore.hpp ├── ObjectsStore.cpp ├── ObjectsStore.hpp ├── Package.cpp ├── Package.hpp ├── PatternFinder.cpp ├── PatternFinder.hpp ├── PrintHelper.cpp ├── PrintHelper.hpp ├── UE1 │ ├── FunctionFlags.cpp │ ├── FunctionFlags.hpp │ ├── GenericTypes.cpp │ ├── GenericTypes.hpp │ ├── Package.cpp │ ├── PropertyFlags.cpp │ └── PropertyFlags.hpp ├── UE2 │ ├── FunctionFlags.cpp │ ├── FunctionFlags.hpp │ ├── GenericTypes.cpp │ ├── GenericTypes.hpp │ ├── Package.cpp │ ├── PropertyFlags.cpp │ └── PropertyFlags.hpp ├── UE3 │ ├── FunctionFlags.cpp │ ├── FunctionFlags.hpp │ ├── GenericTypes.cpp │ ├── GenericTypes.hpp │ ├── Package.cpp │ ├── PropertyFlags.cpp │ └── PropertyFlags.hpp ├── UE4 │ ├── FunctionFlags.cpp │ ├── FunctionFlags.hpp │ ├── GenericTypes.cpp │ ├── GenericTypes.hpp │ ├── Package.cpp │ ├── PropertyFlags.cpp │ └── PropertyFlags.hpp ├── cpplinq.hpp └── tinyformat.h ├── LICENSE ├── README.md ├── Target ├── UnrealEngine1 │ ├── EngineClasses.hpp │ ├── Generator.cpp │ ├── GenericTypes.cpp │ ├── NamesStore.cpp │ └── ObjectsStore.cpp ├── UnrealEngine2 │ ├── EngineClasses.hpp │ ├── Generator.cpp │ ├── GenericTypes.cpp │ ├── NamesStore.cpp │ └── ObjectsStore.cpp ├── UnrealEngine3 │ ├── EngineClasses.hpp │ ├── Generator.cpp │ ├── GenericTypes.cpp │ ├── NamesStore.cpp │ └── ObjectsStore.cpp └── UnrealEngine4 │ ├── EngineClasses.hpp │ ├── Generator.cpp │ ├── GenericTypes.cpp │ ├── NamesStore.cpp │ └── ObjectsStore.cpp ├── UnrealEngine1.vcxproj ├── UnrealEngine1.vcxproj.filters ├── UnrealEngine2.vcxproj ├── UnrealEngine2.vcxproj.filters ├── UnrealEngine3.vcxproj ├── UnrealEngine3.vcxproj.filters ├── UnrealEngine4.vcxproj ├── UnrealEngine4.vcxproj.filters └── UnrealEngineSdkGenerator.sln /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | *.VC.db 84 | *.VC.VC.opendb 85 | 86 | # Visual Studio profiler 87 | *.psess 88 | *.vsp 89 | *.vspx 90 | *.sap 91 | 92 | # TFS 2012 Local Workspace 93 | $tf/ 94 | 95 | # Guidance Automation Toolkit 96 | *.gpState 97 | 98 | # ReSharper is a .NET coding add-in 99 | _ReSharper*/ 100 | *.[Rr]e[Ss]harper 101 | *.DotSettings.user 102 | 103 | # JustCode is a .NET coding add-in 104 | .JustCode 105 | 106 | # TeamCity is a build add-in 107 | _TeamCity* 108 | 109 | # DotCover is a Code Coverage Tool 110 | *.dotCover 111 | 112 | # NCrunch 113 | _NCrunch_* 114 | .*crunch*.local.xml 115 | nCrunchTemp_* 116 | 117 | # MightyMoose 118 | *.mm.* 119 | AutoTest.Net/ 120 | 121 | # Web workbench (sass) 122 | .sass-cache/ 123 | 124 | # Installshield output folder 125 | [Ee]xpress/ 126 | 127 | # DocProject is a documentation generator add-in 128 | DocProject/buildhelp/ 129 | DocProject/Help/*.HxT 130 | DocProject/Help/*.HxC 131 | DocProject/Help/*.hhc 132 | DocProject/Help/*.hhk 133 | DocProject/Help/*.hhp 134 | DocProject/Help/Html2 135 | DocProject/Help/html 136 | 137 | # Click-Once directory 138 | publish/ 139 | 140 | # Publish Web Output 141 | *.[Pp]ublish.xml 142 | *.azurePubxml 143 | # TODO: Comment the next line if you want to checkin your web deploy settings 144 | # but database connection strings (with potential passwords) will be unencrypted 145 | *.pubxml 146 | *.publishproj 147 | 148 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 149 | # checkin your Azure Web App publish settings, but sensitive information contained 150 | # in these scripts will be unencrypted 151 | PublishScripts/ 152 | 153 | # NuGet Packages 154 | *.nupkg 155 | # The packages folder can be ignored because of Package Restore 156 | **/packages/* 157 | # except build/, which is used as an MSBuild target. 158 | !**/packages/build/ 159 | # Uncomment if necessary however generally it will be regenerated when needed 160 | #!**/packages/repositories.config 161 | # NuGet v3's project.json files produces more ignoreable files 162 | *.nuget.props 163 | *.nuget.targets 164 | 165 | # Microsoft Azure Build Output 166 | csx/ 167 | *.build.csdef 168 | 169 | # Microsoft Azure Emulator 170 | ecf/ 171 | rcf/ 172 | 173 | # Windows Store app package directories and files 174 | AppPackages/ 175 | BundleArtifacts/ 176 | Package.StoreAssociation.xml 177 | _pkginfo.txt 178 | 179 | # Visual Studio cache files 180 | # files ending in .cache can be ignored 181 | *.[Cc]ache 182 | # but keep track of directories ending in .cache 183 | !*.[Cc]ache/ 184 | 185 | # Others 186 | ClientBin/ 187 | ~$* 188 | *~ 189 | *.dbmdl 190 | *.dbproj.schemaview 191 | *.pfx 192 | *.publishsettings 193 | node_modules/ 194 | orleans.codegen.cs 195 | 196 | # Since there are multiple workflows, uncomment next line to ignore bower_components 197 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 198 | #bower_components/ 199 | 200 | # RIA/Silverlight projects 201 | Generated_Code/ 202 | 203 | # Backup & report files from converting an old project file 204 | # to a newer Visual Studio version. Backup files are not needed, 205 | # because we have git ;-) 206 | _UpgradeReport_Files/ 207 | Backup*/ 208 | UpgradeLog*.XML 209 | UpgradeLog*.htm 210 | 211 | # SQL Server files 212 | *.mdf 213 | *.ldf 214 | 215 | # Business Intelligence projects 216 | *.rdl.data 217 | *.bim.layout 218 | *.bim_*.settings 219 | 220 | # Microsoft Fakes 221 | FakesAssemblies/ 222 | 223 | # GhostDoc plugin setting file 224 | *.GhostDoc.xml 225 | 226 | # Node.js Tools for Visual Studio 227 | .ntvs_analysis.dat 228 | 229 | # Visual Studio 6 build log 230 | *.plg 231 | 232 | # Visual Studio 6 workspace options file 233 | *.opt 234 | 235 | # Visual Studio LightSwitch build output 236 | **/*.HTMLClient/GeneratedArtifacts 237 | **/*.DesktopClient/GeneratedArtifacts 238 | **/*.DesktopClient/ModelManifest.xml 239 | **/*.Server/GeneratedArtifacts 240 | **/*.Server/ModelManifest.xml 241 | _Pvt_Extensions 242 | 243 | # Paket dependency manager 244 | .paket/paket.exe 245 | paket-files/ 246 | 247 | # FAKE - F# Make 248 | .fake/ 249 | 250 | # JetBrains Rider 251 | .idea/ 252 | *.sln.iml 253 | -------------------------------------------------------------------------------- /CreateNewProject.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | echo copy from: 4 | set /p from= 5 | echo new name: 6 | set /p to= 7 | 8 | powershell -executionpolicy unrestricted ./CreateNewProject.ps1 %from% %to% -------------------------------------------------------------------------------- /CreateNewProject.ps1: -------------------------------------------------------------------------------- 1 | Write-Host "Create $($args[1]) from $($args[0])" 2 | 3 | $source = @" 4 | using System.IO; 5 | 6 | namespace UnrealEngineSDKGenerator 7 | { 8 | public class Program 9 | { 10 | public static void Create(string oldname, string newname) 11 | { 12 | DirectoryInfo newdir = new DirectoryInfo(Path.Combine("./Target", newname)); 13 | newdir.Create(); 14 | CopyFilesRecursively(new DirectoryInfo(Path.Combine("./Target", oldname)), newdir); 15 | 16 | File.WriteAllText(newname + ".vcxproj", File.ReadAllText(oldname + ".vcxproj").Replace(oldname, newname)); 17 | File.WriteAllText(newname + ".vcxproj.filters", File.ReadAllText(oldname + ".vcxproj.filters").Replace(oldname, newname)); 18 | } 19 | 20 | public static void CopyFilesRecursively(DirectoryInfo source, DirectoryInfo target) 21 | { 22 | foreach (DirectoryInfo dir in source.GetDirectories()) 23 | CopyFilesRecursively(dir, target.CreateSubdirectory(dir.Name)); 24 | foreach (FileInfo file in source.GetFiles()) 25 | file.CopyTo(Path.Combine(target.FullName, file.Name)); 26 | } 27 | } 28 | } 29 | "@ 30 | 31 | Add-Type -TypeDefinition $Source -Language CSharp 32 | 33 | [UnrealEngineSDKGenerator.Program]::Create($args[0], $args[1]) -------------------------------------------------------------------------------- /Engine/Logger.cpp: -------------------------------------------------------------------------------- 1 | #include "Logger.hpp" 2 | 3 | std::ostream* Logger::stream = nullptr; 4 | 5 | void Logger::SetStream(std::ostream* _stream) 6 | { 7 | stream = _stream; 8 | } 9 | 10 | void Logger::Log(const std::string& message) 11 | { 12 | if (stream != nullptr) 13 | { 14 | (*stream) << message << '\n' << std::flush; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Engine/Logger.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "tinyformat.h" 8 | 9 | class Logger 10 | { 11 | public: 12 | 13 | /// 14 | /// Sets the stream where the output goes to. 15 | /// 16 | /// [in] The stream. 17 | static void SetStream(std::ostream* stream); 18 | 19 | /// 20 | /// Logs the given message. 21 | /// 22 | /// The message. 23 | static void Log(const std::string& message); 24 | 25 | /// 26 | /// Formats and logs the given message. 27 | /// 28 | /// Type of the arguments. 29 | /// Describes the format to use. 30 | /// Variable arguments providing the arguments. 31 | template 32 | static void Log(const char* fmt, const Args&... args) 33 | { 34 | Log(tfm::format(fmt, args...)); 35 | } 36 | 37 | private: 38 | static std::ostream *stream; 39 | }; 40 | -------------------------------------------------------------------------------- /Engine/Main.cpp: -------------------------------------------------------------------------------- 1 | // Unreal Engine SDK Generator 2 | // by KN4CK3R 3 | // https://www.oldschoolhack.me 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | namespace fs = std::experimental::filesystem; 14 | #include "cpplinq.hpp" 15 | 16 | #include "Logger.hpp" 17 | 18 | #include "IGenerator.hpp" 19 | #include "ObjectsStore.hpp" 20 | #include "NamesStore.hpp" 21 | #include "Package.hpp" 22 | #include "NameValidator.hpp" 23 | #include "PrintHelper.hpp" 24 | 25 | extern IGenerator* generator; 26 | 27 | /// 28 | /// Dumps the objects and names to files. 29 | /// 30 | /// The path where to create the dumps. 31 | void Dump(const fs::path& path) 32 | { 33 | { 34 | std::ofstream o(path / "ObjectsDump.txt"); 35 | tfm::format(o, "Address: 0x%P\n\n", ObjectsStore::GetAddress()); 36 | 37 | for (auto obj : ObjectsStore()) 38 | { 39 | tfm::format(o, "[%06i] %-100s 0x%P\n", obj.GetIndex(), obj.GetFullName(), obj.GetAddress()); 40 | } 41 | } 42 | 43 | { 44 | std::ofstream o(path / "NamesDump.txt"); 45 | tfm::format(o, "Address: 0x%P\n\n", NamesStore::GetAddress()); 46 | 47 | for (auto name : NamesStore()) 48 | { 49 | tfm::format(o, "[%06i] %s\n", name.Index, name.Name); 50 | } 51 | } 52 | } 53 | 54 | /// 55 | /// Generates the sdk header. 56 | /// 57 | /// The path where to create the sdk header. 58 | /// The list of processed objects. 59 | /// The package order info. 60 | void SaveSDKHeader(const fs::path& path, const std::unordered_map& processedObjects, const std::vector& packages) 61 | { 62 | std::ofstream os(path / "SDK.hpp"); 63 | 64 | os << "#pragma once\n\n" 65 | << tfm::format("// %s (%s) SDK\n\n", generator->GetGameName(), generator->GetGameVersion()); 66 | 67 | //include the basics 68 | { 69 | { 70 | std::ofstream os2(path / "SDK" / tfm::format("%s_Basic.hpp", generator->GetGameNameShort())); 71 | 72 | std::vector includes{ { "" }, { "" } }; 73 | 74 | auto&& generatorIncludes = generator->GetIncludes(); 75 | includes.insert(includes.end(), std::begin(generatorIncludes), std::end(generatorIncludes)); 76 | 77 | PrintFileHeader(os2, includes, true); 78 | 79 | os2 << generator->GetBasicDeclarations() << "\n"; 80 | 81 | PrintFileFooter(os2); 82 | 83 | os << "\n#include \"SDK/" << tfm::format("%s_Basic.hpp", generator->GetGameNameShort()) << "\"\n"; 84 | } 85 | { 86 | std::ofstream os2(path / "SDK" / tfm::format("%s_Basic.cpp", generator->GetGameNameShort())); 87 | 88 | PrintFileHeader(os2, { "../SDK.hpp" }, false); 89 | 90 | os2 << generator->GetBasicDefinitions() << "\n"; 91 | 92 | PrintFileFooter(os2); 93 | } 94 | } 95 | 96 | using namespace cpplinq; 97 | 98 | //check for missing structs 99 | const auto missing = from(processedObjects) >> where([](auto&& kv) { return kv.second == false; }); 100 | if (missing >> any()) 101 | { 102 | std::ofstream os2(path / "SDK" / tfm::format("%s_MISSING.hpp", generator->GetGameNameShort())); 103 | 104 | PrintFileHeader(os2, true); 105 | 106 | for (auto&& s : missing >> select([](auto&& kv) { return kv.first.Cast(); }) >> experimental::container()) 107 | { 108 | os2 << "// " << s.GetFullName() << "\n// "; 109 | os2 << tfm::format("0x%04X\n", s.GetPropertySize()); 110 | 111 | os2 << "struct " << MakeValidName(s.GetNameCPP()) << "\n{\n"; 112 | os2 << "\tunsigned char UnknownData[0x" << tfm::format("%X", s.GetPropertySize()) << "];\n};\n\n"; 113 | } 114 | 115 | PrintFileFooter(os2); 116 | 117 | os << "\n#include \"SDK/" << tfm::format("%s_MISSING.hpp", generator->GetGameNameShort()) << "\"\n"; 118 | } 119 | 120 | os << "\n"; 121 | 122 | for (auto&& package : packages) 123 | { 124 | os << R"(#include "SDK/)" << GenerateFileName(FileContentType::Classes, package) << "\"\n"; 125 | } 126 | } 127 | 128 | /// 129 | /// Process the packages. 130 | /// 131 | /// The path where to create the package files. 132 | void ProcessPackages(const fs::path& path) 133 | { 134 | using namespace cpplinq; 135 | 136 | const auto sdkPath = path / "SDK"; 137 | fs::create_directories(sdkPath); 138 | 139 | std::vector packages; 140 | 141 | std::unordered_map processedObjects; 142 | 143 | auto packageObjects = from(ObjectsStore()) 144 | >> select([](auto&& o) { return o.GetPackageObject(); }) 145 | >> where([](auto&& o) { return o.IsValid(); }) 146 | >> distinct() 147 | >> to_vector(); 148 | 149 | for (auto obj : packageObjects) 150 | { 151 | Package package(obj); 152 | 153 | package.Process(processedObjects); 154 | if (package.Save(sdkPath)) 155 | { 156 | packages.emplace_back(std::move(package)); 157 | } 158 | } 159 | 160 | SaveSDKHeader(path, processedObjects, packages); 161 | } 162 | 163 | DWORD WINAPI OnAttach(LPVOID lpParameter) 164 | { 165 | if (!ObjectsStore::Initialize()) 166 | { 167 | MessageBoxA(nullptr, "ObjectsStore::Initialize failed", "Error", 0); 168 | return -1; 169 | } 170 | if (!NamesStore::Initialize()) 171 | { 172 | MessageBoxA(nullptr, "NamesStore::Initialize failed", "Error", 0); 173 | return -1; 174 | } 175 | 176 | if (!generator->Initialize(lpParameter)) 177 | { 178 | MessageBoxA(nullptr, "Initialize failed", "Error", 0); 179 | return -1; 180 | } 181 | 182 | fs::path outputDirectory(generator->GetOutputDirectory()); 183 | if (!outputDirectory.is_absolute()) 184 | { 185 | char buffer[2048]; 186 | if (GetModuleFileNameA(static_cast(lpParameter), buffer, sizeof(buffer)) == 0) 187 | { 188 | MessageBoxA(nullptr, "GetModuleFileName failed", "Error", 0); 189 | return -1; 190 | } 191 | 192 | outputDirectory = fs::path(buffer).remove_filename() / outputDirectory; 193 | } 194 | 195 | outputDirectory /= generator->GetGameNameShort(); 196 | fs::create_directories(outputDirectory); 197 | 198 | std::ofstream log(outputDirectory / "Generator.log"); 199 | Logger::SetStream(&log); 200 | 201 | if (generator->ShouldDumpArrays()) 202 | { 203 | Dump(outputDirectory); 204 | } 205 | 206 | fs::create_directories(outputDirectory); 207 | 208 | const auto begin = std::chrono::system_clock::now(); 209 | 210 | ProcessPackages(outputDirectory); 211 | 212 | Logger::Log("Finished, took %d seconds.", std::chrono::duration_cast(std::chrono::system_clock::now() - begin).count()); 213 | 214 | Logger::SetStream(nullptr); 215 | 216 | MessageBoxA(nullptr, "Finished!", "Info", 0); 217 | 218 | return 0; 219 | } 220 | 221 | BOOL WINAPI DllMain(HMODULE hModule, DWORD dwReason, LPVOID lpReserved) 222 | { 223 | switch (dwReason) 224 | { 225 | case DLL_PROCESS_ATTACH: 226 | DisableThreadLibraryCalls(hModule); 227 | 228 | CreateThread(nullptr, 0, OnAttach, hModule, 0, nullptr); 229 | 230 | return TRUE; 231 | } 232 | 233 | return FALSE; 234 | } 235 | -------------------------------------------------------------------------------- /Engine/NameValidator.cpp: -------------------------------------------------------------------------------- 1 | #include "NameValidator.hpp" 2 | 3 | #include 4 | 5 | #include "ObjectsStore.hpp" 6 | 7 | std::string MakeValidName(std::string&& name) 8 | { 9 | std::string valid(name); 10 | 11 | for (auto i = 0u; i < name.length(); ++i) 12 | { 13 | if (valid[i] == ' ' 14 | || valid[i] == '?' 15 | || valid[i] == '+' 16 | || valid[i] == '-' 17 | || valid[i] == ':' 18 | || valid[i] == '/' 19 | || valid[i] == '^' 20 | || valid[i] == '(' 21 | || valid[i] == ')' 22 | || valid[i] == '[' 23 | || valid[i] == ']' 24 | || valid[i] == '<' 25 | || valid[i] == '>' 26 | || valid[i] == '&' 27 | || valid[i] == '.' 28 | || valid[i] == '#' 29 | || valid[i] == '\'' 30 | || valid[i] == '"' 31 | || valid[i] == '%') 32 | { 33 | valid[i] = '_'; 34 | } 35 | } 36 | 37 | if (!valid.empty()) 38 | { 39 | if (std::isdigit(valid[0])) 40 | { 41 | valid = '_' + valid; 42 | } 43 | } 44 | 45 | return valid; 46 | } 47 | 48 | std::string SimplifyEnumName(std::string&& name) 49 | { 50 | const auto index = name.find_last_of(':'); 51 | if (index == std::string::npos) 52 | { 53 | return name; 54 | } 55 | 56 | return name.substr(index + 1); 57 | } 58 | 59 | template 60 | std::string MakeUniqueCppNameImpl(const T& t) 61 | { 62 | std::string name; 63 | if (ObjectsStore().CountObjects(t.GetName()) > 1) 64 | { 65 | name += MakeValidName(t.GetOuter().GetName()) + "_"; 66 | } 67 | return name + MakeValidName(t.GetName()); 68 | } 69 | 70 | std::string MakeUniqueCppName(const UEConst& c) 71 | { 72 | return MakeUniqueCppNameImpl(c); 73 | } 74 | 75 | std::string MakeUniqueCppName(const UEEnum& e) 76 | { 77 | auto name = MakeUniqueCppNameImpl(e); 78 | if (!name.empty() && name[0] != 'E') 79 | { 80 | name = 'E' + name; 81 | } 82 | return name; 83 | } 84 | 85 | std::string MakeUniqueCppName(const UEStruct& ss) 86 | { 87 | std::string name; 88 | if (ObjectsStore().CountObjects(ss.GetName()) > 1) 89 | { 90 | name += MakeValidName(ss.GetOuter().GetNameCPP()) + "_"; 91 | } 92 | return name + MakeValidName(ss.GetNameCPP()); 93 | } 94 | -------------------------------------------------------------------------------- /Engine/NameValidator.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | class UEConst; 6 | class UEEnum; 7 | class UEStruct; 8 | 9 | /// 10 | /// Makes valid C++ name from the given name. 11 | /// 12 | /// The name to process. 13 | /// A valid C++ name. 14 | std::string MakeValidName(std::string&& name); 15 | 16 | std::string SimplifyEnumName(std::string&& name); 17 | 18 | std::string MakeUniqueCppName(const UEConst& c); 19 | std::string MakeUniqueCppName(const UEEnum& e); 20 | std::string MakeUniqueCppName(const UEStruct& ss); 21 | -------------------------------------------------------------------------------- /Engine/NamesStore.cpp: -------------------------------------------------------------------------------- 1 | #include "NamesStore.hpp" 2 | 3 | NamesIterator NamesStore::begin() 4 | { 5 | return NamesIterator(*this, 0); 6 | } 7 | 8 | NamesIterator NamesStore::begin() const 9 | { 10 | return NamesIterator(*this, 0); 11 | } 12 | 13 | NamesIterator NamesStore::end() 14 | { 15 | return NamesIterator(*this); 16 | } 17 | 18 | NamesIterator NamesStore::end() const 19 | { 20 | return NamesIterator(*this); 21 | } 22 | 23 | NamesIterator::NamesIterator(const NamesStore& _store) 24 | : store(_store), 25 | index(_store.GetNamesNum()) 26 | { 27 | } 28 | 29 | NamesIterator::NamesIterator(const NamesStore& _store, size_t _index) 30 | : store(_store), 31 | index(_index) 32 | { 33 | } 34 | 35 | void NamesIterator::swap(NamesIterator& other) noexcept 36 | { 37 | std::swap(index, other.index); 38 | } 39 | 40 | NamesIterator& NamesIterator::operator++() 41 | { 42 | for (++index; index < store.GetNamesNum(); ++index) 43 | { 44 | if (store.IsValid(index)) 45 | { 46 | break; 47 | } 48 | } 49 | return *this; 50 | } 51 | 52 | NamesIterator NamesIterator::operator++ (int) 53 | { 54 | auto tmp(*this); 55 | ++(*this); 56 | return tmp; 57 | } 58 | 59 | bool NamesIterator::operator==(const NamesIterator& rhs) const 60 | { 61 | return index == rhs.index; 62 | } 63 | 64 | bool NamesIterator::operator!=(const NamesIterator& rhs) const 65 | { 66 | return index != rhs.index; 67 | } 68 | 69 | UENameInfo NamesIterator::operator*() const 70 | { 71 | return { index, store.GetById(index) }; 72 | } 73 | 74 | UENameInfo NamesIterator::operator->() const 75 | { 76 | return { index, store.GetById(index) }; 77 | } -------------------------------------------------------------------------------- /Engine/NamesStore.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "GenericTypes.hpp" 6 | 7 | class NamesIterator; 8 | 9 | class NamesStore 10 | { 11 | friend NamesIterator; 12 | 13 | public: 14 | 15 | /// 16 | /// Initializes this object. 17 | /// 18 | /// true if it succeeds, false if it fails. 19 | static bool Initialize(); 20 | 21 | /// Gets the address of the global names store. 22 | /// The address of the global names store. 23 | static void* GetAddress(); 24 | 25 | NamesIterator begin(); 26 | 27 | NamesIterator begin() const; 28 | 29 | NamesIterator end(); 30 | 31 | NamesIterator end() const; 32 | 33 | /// 34 | /// Gets the number of available names. 35 | /// 36 | /// The number of names. 37 | size_t GetNamesNum() const; 38 | 39 | /// 40 | /// Test if the given id is valid. 41 | /// 42 | /// The identifier. 43 | /// true if valid, false if not. 44 | bool IsValid(size_t id) const; 45 | 46 | /// 47 | /// Gets a name by id. 48 | /// 49 | /// The identifier. 50 | /// The name. 51 | std::string GetById(size_t id) const; 52 | }; 53 | 54 | struct UENameInfo 55 | { 56 | size_t Index; 57 | std::string Name; 58 | }; 59 | 60 | class NamesIterator : public std::iterator 61 | { 62 | const NamesStore& store; 63 | size_t index; 64 | 65 | public: 66 | NamesIterator(const NamesStore& store); 67 | 68 | explicit NamesIterator(const NamesStore& store, size_t index); 69 | 70 | void swap(NamesIterator& other) noexcept; 71 | 72 | NamesIterator& operator++(); 73 | 74 | NamesIterator operator++ (int); 75 | 76 | bool operator==(const NamesIterator& rhs) const; 77 | 78 | bool operator!=(const NamesIterator& rhs) const; 79 | 80 | UENameInfo operator*() const; 81 | 82 | UENameInfo operator->() const; 83 | }; 84 | -------------------------------------------------------------------------------- /Engine/ObjectsStore.cpp: -------------------------------------------------------------------------------- 1 | #include "ObjectsStore.hpp" 2 | #include 3 | 4 | ObjectsIterator ObjectsStore::begin() 5 | { 6 | return ObjectsIterator(*this, 0); 7 | } 8 | 9 | ObjectsIterator ObjectsStore::begin() const 10 | { 11 | return ObjectsIterator(*this, 0); 12 | } 13 | 14 | ObjectsIterator ObjectsStore::end() 15 | { 16 | return ObjectsIterator(*this); 17 | } 18 | 19 | ObjectsIterator ObjectsStore::end() const 20 | { 21 | return ObjectsIterator(*this); 22 | } 23 | 24 | UEClass ObjectsStore::FindClass(const std::string& name) const 25 | { 26 | for (auto obj : *this) 27 | { 28 | if (obj.GetFullName() == name) 29 | { 30 | return obj.Cast(); 31 | } 32 | } 33 | return UEClass(nullptr); 34 | } 35 | 36 | ObjectsIterator::ObjectsIterator(const ObjectsStore& _store) 37 | : store(_store), 38 | index(_store.GetObjectsNum()) 39 | { 40 | } 41 | 42 | ObjectsIterator::ObjectsIterator(const ObjectsStore& _store, size_t _index) 43 | : store(_store), 44 | index(_index), 45 | current(_store.GetById(_index)) 46 | { 47 | } 48 | 49 | ObjectsIterator::ObjectsIterator(const ObjectsIterator& other) 50 | : store(other.store), 51 | index(other.index), 52 | current(other.current) 53 | { 54 | } 55 | 56 | ObjectsIterator::ObjectsIterator(ObjectsIterator&& other) noexcept 57 | : store(other.store), 58 | index(other.index), 59 | current(other.current) 60 | { 61 | } 62 | 63 | ObjectsIterator& ObjectsIterator::operator=(const ObjectsIterator& rhs) 64 | { 65 | index = rhs.index; 66 | current = rhs.current; 67 | return *this; 68 | } 69 | 70 | void ObjectsIterator::swap(ObjectsIterator& other) noexcept 71 | { 72 | std::swap(index, other.index); 73 | std::swap(current, other.current); 74 | } 75 | 76 | ObjectsIterator& ObjectsIterator::operator++() 77 | { 78 | current = UEObject(); 79 | 80 | for (++index; index < store.GetObjectsNum(); ++index) 81 | { 82 | current = store.GetById(index); 83 | if (current.IsValid()) 84 | { 85 | break; 86 | } 87 | } 88 | return *this; 89 | } 90 | 91 | ObjectsIterator ObjectsIterator::operator++(int) 92 | { 93 | auto tmp(*this); 94 | ++(*this); 95 | return tmp; 96 | } 97 | 98 | bool ObjectsIterator::operator==(const ObjectsIterator& rhs) const 99 | { 100 | return index == rhs.index; 101 | } 102 | 103 | bool ObjectsIterator::operator!=(const ObjectsIterator& rhs) const 104 | { 105 | return index != rhs.index; 106 | } 107 | 108 | UEObject ObjectsIterator::operator*() const 109 | { 110 | assert(current.IsValid() && "ObjectsIterator::current is not valid!"); 111 | 112 | return current; 113 | } 114 | 115 | UEObject ObjectsIterator::operator->() const 116 | { 117 | return operator*(); 118 | } -------------------------------------------------------------------------------- /Engine/ObjectsStore.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "GenericTypes.hpp" 6 | 7 | class ObjectsIterator; 8 | 9 | class ObjectsStore 10 | { 11 | public: 12 | 13 | /// 14 | /// Initializes this object. 15 | /// 16 | /// 17 | /// true if it succeeds, false if it fails. 18 | /// 19 | static bool Initialize(); 20 | 21 | /// Gets the address of the global objects store. 22 | /// The address of the global objects store. 23 | static void* GetAddress(); 24 | 25 | ObjectsIterator begin(); 26 | 27 | ObjectsIterator begin() const; 28 | 29 | ObjectsIterator end(); 30 | 31 | ObjectsIterator end() const; 32 | 33 | /// 34 | /// Gets the number of available objects. 35 | /// 36 | /// The number of objects. 37 | size_t GetObjectsNum() const; 38 | 39 | /// 40 | /// Gets the object by id. 41 | /// 42 | /// The identifier. 43 | /// The object. 44 | UEObject GetById(size_t id) const; 45 | 46 | /// 47 | /// Searches for the first class with the given name. 48 | /// 49 | /// The name of the class. 50 | /// The found class which is not valid if no class could be found. 51 | UEClass FindClass(const std::string& name) const; 52 | 53 | /// Count objects which have the same name and type. 54 | /// Type of the object. 55 | /// The name to search for. 56 | /// The number of objects which share a name. 57 | template 58 | size_t CountObjects(const std::string& name) const 59 | { 60 | static std::unordered_map cache; 61 | 62 | auto it = cache.find(name); 63 | if (it != std::end(cache)) 64 | { 65 | return it->second; 66 | } 67 | 68 | size_t count = 0; 69 | for (auto obj : *this) 70 | { 71 | if (obj.IsA() && obj.GetName() == name) 72 | { 73 | ++count; 74 | } 75 | } 76 | 77 | cache[name] = count; 78 | 79 | return count; 80 | } 81 | }; 82 | 83 | /// Holds information about an object. 84 | struct UEObjectInfo 85 | { 86 | /// Zero-based index of the object in the global objects store. 87 | size_t Index; 88 | 89 | /// The object. 90 | UEObject Object; 91 | }; 92 | 93 | /// An iterator for objects. 94 | class ObjectsIterator : public std::iterator 95 | { 96 | const ObjectsStore& store; 97 | size_t index; 98 | UEObject current; 99 | 100 | public: 101 | 102 | /// Constructor. 103 | /// The store to iterate. 104 | ObjectsIterator(const ObjectsStore& store); 105 | 106 | /// Constructor. 107 | /// The store to iterate. 108 | /// Zero-based start index. 109 | explicit ObjectsIterator(const ObjectsStore& store, size_t index); 110 | 111 | ObjectsIterator(const ObjectsIterator& other); 112 | ObjectsIterator(ObjectsIterator&& other) noexcept; 113 | 114 | ObjectsIterator& operator=(const ObjectsIterator& rhs); 115 | 116 | void swap(ObjectsIterator& other) noexcept; 117 | 118 | ObjectsIterator& operator++(); 119 | 120 | ObjectsIterator operator++ (int); 121 | 122 | bool operator==(const ObjectsIterator& rhs) const; 123 | 124 | bool operator!=(const ObjectsIterator& rhs) const; 125 | 126 | UEObject operator*() const; 127 | 128 | UEObject operator->() const; 129 | }; 130 | -------------------------------------------------------------------------------- /Engine/Package.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | namespace fs = std::experimental::filesystem; 8 | 9 | #include "GenericTypes.hpp" 10 | 11 | class Package 12 | { 13 | friend struct std::hash; 14 | friend struct PackageDependencyComparer; 15 | friend bool operator==(const Package& lhs, const Package& rhs); 16 | 17 | public: 18 | /// 19 | /// Constructor. 20 | /// 21 | /// The package object. 22 | Package(const UEObject& packageObj); 23 | 24 | std::string GetName() const { return packageObj.GetName(); } 25 | 26 | /// 27 | /// Process the classes the package contains. 28 | /// 29 | void Process(std::unordered_map& processedObjects); 30 | 31 | /// 32 | /// Saves the package classes as C++ code. 33 | /// Files are only generated if there is code present or the generator forces the genertion of empty files. 34 | /// 35 | /// The path to save to. 36 | /// true if files got saved, else false. 37 | bool Save(const fs::path& path) const; 38 | 39 | private: 40 | bool AddDependency(const UEObject& package) const; 41 | 42 | /// 43 | /// Checks and generates the prerequisites of the object. 44 | /// Should be a UEClass or UEScriptStruct. 45 | /// 46 | /// The object. 47 | void GeneratePrerequisites(const UEObject& obj, std::unordered_map& processedObjects); 48 | 49 | /// 50 | /// Checks and generates the prerequisites of the members. 51 | /// 52 | /// The first member in the chain. 53 | void GenerateMemberPrerequisites(const UEProperty& first, std::unordered_map& processedObjects); 54 | 55 | /// 56 | /// Generates a script structure. 57 | /// 58 | /// The script structure object. 59 | void GenerateScriptStruct(const UEScriptStruct& scriptStructObj); 60 | 61 | /// 62 | /// Generates a constant. 63 | /// 64 | /// The constant object. 65 | void GenerateConst(const UEConst& constObj); 66 | 67 | /// 68 | /// Generates an enum. 69 | /// 70 | /// The enum object. 71 | void GenerateEnum(const UEEnum& enumObj); 72 | 73 | /// 74 | /// Generates the class. 75 | /// 76 | /// The class object. 77 | void GenerateClass(const UEClass& classObj); 78 | 79 | /// 80 | /// Writes all structs into the appropriate file. 81 | /// 82 | /// The path to save to. 83 | void SaveStructs(const fs::path& path) const; 84 | 85 | /// 86 | /// Writes all classes into the appropriate file. 87 | /// 88 | /// The path to save to. 89 | void SaveClasses(const fs::path& path) const; 90 | 91 | /// 92 | /// Writes all functions into the appropriate file. 93 | /// 94 | /// The path to save to. 95 | void SaveFunctions(const fs::path& path) const; 96 | 97 | /// 98 | /// Writes all function parameters into the appropriate file. 99 | /// 100 | /// The path to save to. 101 | void SaveFunctionParameters(const fs::path& path) const; 102 | 103 | UEObject packageObj; 104 | mutable std::unordered_set dependencies; 105 | 106 | /// 107 | /// Prints the c++ code of the constant. 108 | /// 109 | /// [in] The stream to print to. 110 | /// The constant to print. 111 | void PrintConstant(std::ostream& os, const std::pair& c) const; 112 | 113 | std::unordered_map constants; 114 | 115 | struct Enum 116 | { 117 | std::string Name; 118 | std::string FullName; 119 | std::vector Values; 120 | }; 121 | 122 | /// 123 | /// Prints the c++ code of the enum. 124 | /// 125 | /// [in] The stream to print to. 126 | /// The enum to print. 127 | void PrintEnum(std::ostream& os, const Enum& e) const; 128 | 129 | std::vector enums; 130 | 131 | struct Member 132 | { 133 | std::string Name; 134 | std::string Type; 135 | 136 | size_t Offset; 137 | size_t Size; 138 | 139 | size_t Flags; 140 | std::string FlagsString; 141 | 142 | std::string Comment; 143 | }; 144 | 145 | /// 146 | /// Generates a padding member. 147 | /// 148 | /// The unique name identifier. 149 | /// The offset. 150 | /// The size. 151 | /// The reason. 152 | /// A padding member. 153 | static Member CreatePadding(size_t id, size_t offset, size_t size, std::string reason); 154 | 155 | /// 156 | /// Generates a padding member. 157 | /// 158 | /// The unique name identifier. 159 | /// The offset. 160 | /// The size. 161 | /// The reason. 162 | /// A padding member. 163 | static Member CreateBitfieldPadding(size_t id, size_t offset, std::string type, size_t bits); 164 | 165 | /// 166 | /// Generates the members of a struct or class. 167 | /// 168 | /// The structure object. 169 | /// The start offset. 170 | /// The properties describing the members. 171 | /// [out] The members of the struct or class. 172 | void GenerateMembers(const UEStruct& structObj, size_t offset, const std::vector& properties, std::vector& members) const; 173 | 174 | struct ScriptStruct 175 | { 176 | std::string Name; 177 | std::string FullName; 178 | std::string NameCpp; 179 | std::string NameCppFull; 180 | 181 | size_t Size; 182 | size_t InheritedSize; 183 | 184 | std::vector Members; 185 | 186 | std::vector PredefinedMethods; 187 | }; 188 | 189 | /// 190 | /// Print the C++ code of the structure. 191 | /// 192 | /// [in] The stream to print to. 193 | /// The structure to print. 194 | void PrintStruct(std::ostream& os, const ScriptStruct& ss) const; 195 | 196 | std::vector scriptStructs; 197 | 198 | struct Method 199 | { 200 | struct Parameter 201 | { 202 | enum class Type 203 | { 204 | Default, 205 | Out, 206 | Return 207 | }; 208 | 209 | Type ParamType; 210 | bool PassByReference; 211 | std::string CppType; 212 | std::string Name; 213 | std::string FlagsString; 214 | 215 | /// 216 | /// Generates a valid type of the property flags. 217 | /// 218 | /// The property flags. 219 | /// [out] The parameter type. 220 | /// true if it is a valid type, else false. 221 | static bool MakeType(UEPropertyFlags flags, Type& type); 222 | }; 223 | 224 | size_t Index; 225 | std::string Name; 226 | std::string FullName; 227 | std::vector Parameters; 228 | std::string FlagsString; 229 | bool IsNative; 230 | bool IsStatic; 231 | }; 232 | 233 | /// 234 | /// Generates the methods of a class. 235 | /// 236 | /// The class object. 237 | /// [out] The methods of the class. 238 | void GenerateMethods(const UEClass& classObj, std::vector& methods) const; 239 | 240 | struct Class : ScriptStruct 241 | { 242 | std::vector VirtualFunctions; 243 | std::vector Methods; 244 | }; 245 | 246 | /// 247 | /// Builds the C++ method signature. 248 | /// 249 | /// The Method to process. 250 | /// Name of the class. 251 | /// true if the signature is used as decleration. 252 | /// The method signature. 253 | std::string BuildMethodSignature(const Method& m, const Class& c, bool inHeader) const; 254 | 255 | /// 256 | /// Builds the c++ method body. 257 | /// 258 | /// The Method to process. 259 | /// The method body. 260 | std::string BuildMethodBody(const Class& c, const Method& m) const; 261 | 262 | /// 263 | /// Print the C++ code of the class. 264 | /// 265 | /// [in] The stream to print to. 266 | /// The class to print. 267 | void PrintClass(std::ostream& os, const Class& c) const; 268 | 269 | std::vector classes; 270 | }; 271 | 272 | namespace std 273 | { 274 | template<> 275 | struct hash 276 | { 277 | size_t operator()(const Package& package) const 278 | { 279 | return std::hash()(package.packageObj.GetAddress()); 280 | } 281 | }; 282 | } 283 | 284 | inline bool operator==(const Package& lhs, const Package& rhs) { return rhs.packageObj.GetAddress() == lhs.packageObj.GetAddress(); } 285 | inline bool operator!=(const Package& lhs, const Package& rhs) { return !(lhs == rhs); } 286 | -------------------------------------------------------------------------------- /Engine/PatternFinder.cpp: -------------------------------------------------------------------------------- 1 | #include "PatternFinder.hpp" 2 | 3 | #include 4 | #include 5 | 6 | uintptr_t FindPattern(HMODULE module, const unsigned char* pattern, const char* mask) 7 | { 8 | MODULEINFO info = { }; 9 | GetModuleInformation(GetCurrentProcess(), module, &info, sizeof(MODULEINFO)); 10 | 11 | return FindPattern(reinterpret_cast(module), info.SizeOfImage, pattern, mask); 12 | } 13 | 14 | uintptr_t FindPattern(uintptr_t start, size_t length, const unsigned char* pattern, const char* mask) 15 | { 16 | size_t pos = 0; 17 | auto maskLength = std::strlen(mask) - 1; 18 | 19 | auto startAdress = start; 20 | for (auto it = startAdress; it < startAdress + length; ++it) 21 | { 22 | if (*reinterpret_cast(it) == pattern[pos] || mask[pos] == '?') 23 | { 24 | if (mask[pos + 1] == '\0') 25 | { 26 | return it - maskLength; 27 | } 28 | 29 | pos++; 30 | } 31 | else 32 | { 33 | pos = 0; 34 | } 35 | } 36 | 37 | return -1; 38 | } 39 | -------------------------------------------------------------------------------- /Engine/PatternFinder.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | /// 7 | /// Searches for the first pattern in the module. 8 | /// 9 | /// The module to scan. 10 | /// The pattern (Example: "\x12\xAB\x34") 11 | /// The mask (Example: "x?x") 12 | /// The address of the found pattern or -1 if the pattern was not found. 13 | uintptr_t FindPattern(HMODULE module, const unsigned char* pattern, const char* mask); 14 | 15 | /// 16 | /// Searches for the first pattern in the memory region. 17 | /// 18 | /// The start address of the memory region to scan. 19 | /// The length of the memory region. 20 | /// The pattern (Example: "\x12\xAB\x34") 21 | /// The mask (Example: "x?x") 22 | /// The address of the found pattern or -1 if the pattern was not found. 23 | uintptr_t FindPattern(uintptr_t start, size_t length, const unsigned char* pattern, const char* mask); 24 | -------------------------------------------------------------------------------- /Engine/PrintHelper.cpp: -------------------------------------------------------------------------------- 1 | #include "PrintHelper.hpp" 2 | 3 | #include 4 | 5 | #include "IGenerator.hpp" 6 | #include "Package.hpp" 7 | 8 | void PrintFileHeader(std::ostream& os, const std::vector& includes, const bool isHeaderFile) 9 | { 10 | extern IGenerator* generator; 11 | 12 | if (isHeaderFile) 13 | { 14 | os << "#pragma once\n\n"; 15 | } 16 | 17 | os << tfm::format("// %s (%s) SDK\n\n", generator->GetGameName(), generator->GetGameVersion()) 18 | << tfm::format("#ifdef _MSC_VER\n\t#pragma pack(push, 0x%X)\n#endif\n\n", generator->GetGlobalMemberAlignment()); 19 | 20 | if (!includes.empty()) 21 | { 22 | for (auto&& i : includes) 23 | { 24 | if (i[0] != '<' && i[0] != '"') 25 | { 26 | os << "#include \"" << i << "\"\n"; 27 | } 28 | else 29 | { 30 | os << "#include " << i << "\n"; 31 | } 32 | } 33 | os << "\n"; 34 | } 35 | 36 | if (!generator->GetNamespaceName().empty()) 37 | { 38 | os << "namespace " << generator->GetNamespaceName() << "\n{\n"; 39 | } 40 | } 41 | 42 | void PrintFileHeader(std::ostream& os, const bool isHeaderFile) 43 | { 44 | extern IGenerator* generator; 45 | 46 | PrintFileHeader(os, std::vector(), isHeaderFile); 47 | } 48 | 49 | void PrintFileFooter(std::ostream& os) 50 | { 51 | extern IGenerator* generator; 52 | 53 | if (!generator->GetNamespaceName().empty()) 54 | { 55 | os << "}\n\n"; 56 | } 57 | 58 | os << "#ifdef _MSC_VER\n\t#pragma pack(pop)\n#endif\n"; 59 | } 60 | 61 | void PrintSectionHeader(std::ostream& os, const char* name) 62 | { 63 | os << "//---------------------------------------------------------------------------\n" 64 | << "//" << name << "\n" 65 | << "//---------------------------------------------------------------------------\n\n"; 66 | } 67 | 68 | std::string GenerateFileName(const FileContentType type, const Package& package) 69 | { 70 | extern IGenerator* generator; 71 | 72 | const char* name; 73 | switch (type) 74 | { 75 | case FileContentType::Structs: 76 | name = "%s_%s_structs.hpp"; 77 | break; 78 | case FileContentType::Classes: 79 | name = "%s_%s_classes.hpp"; 80 | break; 81 | case FileContentType::Functions: 82 | name = "%s_%s_functions.cpp"; 83 | break; 84 | case FileContentType::FunctionParameters: 85 | name = "%s_%s_parameters.hpp"; 86 | break; 87 | default: 88 | assert(false); 89 | } 90 | 91 | return tfm::format(name, generator->GetGameNameShort(), package.GetName()); 92 | } 93 | -------------------------------------------------------------------------------- /Engine/PrintHelper.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | void PrintFileHeader(std::ostream& os, const std::vector& includes, const bool isHeaderFile); 7 | 8 | void PrintFileHeader(std::ostream& os, const bool isHeaderFile); 9 | 10 | void PrintFileFooter(std::ostream& os); 11 | 12 | void PrintSectionHeader(std::ostream& os, const char* name); 13 | 14 | enum class FileContentType 15 | { 16 | Structs, 17 | Classes, 18 | Functions, 19 | FunctionParameters 20 | }; 21 | 22 | /// 23 | /// Generates a file name composed by the game name and the package object. 24 | /// 25 | /// The type of the file. 26 | /// 27 | /// The generated file name. 28 | /// 29 | std::string GenerateFileName(const FileContentType type, const class Package& package); 30 | -------------------------------------------------------------------------------- /Engine/UE1/FunctionFlags.cpp: -------------------------------------------------------------------------------- 1 | #include "FunctionFlags.hpp" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | std::string StringifyFlags(const UEFunctionFlags flags) 8 | { 9 | std::vector buffer; 10 | 11 | if (flags & UEFunctionFlags::Final) { buffer.push_back("Final"); } 12 | if (flags & UEFunctionFlags::Defined) { buffer.push_back("Defined"); } 13 | if (flags & UEFunctionFlags::Iterator) { buffer.push_back("Iterator"); } 14 | if (flags & UEFunctionFlags::Latent) { buffer.push_back("Latent"); } 15 | if (flags & UEFunctionFlags::PreOperator) { buffer.push_back("PreOperator"); } 16 | if (flags & UEFunctionFlags::Singular) { buffer.push_back("Singular"); } 17 | if (flags & UEFunctionFlags::Net) { buffer.push_back("Net"); } 18 | if (flags & UEFunctionFlags::NetReliable) { buffer.push_back("NetReliable"); } 19 | if (flags & UEFunctionFlags::Simulated) { buffer.push_back("Simulated"); } 20 | if (flags & UEFunctionFlags::Exec) { buffer.push_back("Exec"); } 21 | if (flags & UEFunctionFlags::Native) { buffer.push_back("Native"); } 22 | if (flags & UEFunctionFlags::Event) { buffer.push_back("Event"); } 23 | if (flags & UEFunctionFlags::Operator) { buffer.push_back("Operator"); } 24 | if (flags & UEFunctionFlags::Static) { buffer.push_back("Static"); } 25 | if (flags & UEFunctionFlags::HasOptionalParms) { buffer.push_back("HasOptionalParms"); } 26 | if (flags & UEFunctionFlags::Const) { buffer.push_back("Const"); } 27 | if (flags & UEFunctionFlags::Public) { buffer.push_back("Public"); } 28 | if (flags & UEFunctionFlags::Private) { buffer.push_back("Private"); } 29 | if (flags & UEFunctionFlags::Protected) { buffer.push_back("Protected"); } 30 | if (flags & UEFunctionFlags::Delegate) { buffer.push_back("Delegate"); } 31 | if (flags & UEFunctionFlags::NetServer) { buffer.push_back("NetServer"); } 32 | if (flags & UEFunctionFlags::HasOutParms) { buffer.push_back("HasOutParms"); } 33 | if (flags & UEFunctionFlags::HasDefaults) { buffer.push_back("HasDefaults"); } 34 | if (flags & UEFunctionFlags::NetClient) { buffer.push_back("NetClient"); } 35 | if (flags & UEFunctionFlags::DLLImport) { buffer.push_back("DLLImport"); } 36 | if (flags & UEFunctionFlags::K2Call) { buffer.push_back("K2Call"); } 37 | if (flags & UEFunctionFlags::K2Override) { buffer.push_back("K2Override"); } 38 | if (flags & UEFunctionFlags::K2Pure) { buffer.push_back("K2Pure"); } 39 | 40 | switch (buffer.size()) 41 | { 42 | case 0: 43 | return std::string(); 44 | case 1: 45 | return std::string(buffer[0]); 46 | default: 47 | std::ostringstream os; 48 | std::copy(buffer.begin(), buffer.end() - 1, std::ostream_iterator(os, ", ")); 49 | os << *buffer.rbegin(); 50 | return os.str(); 51 | } 52 | } -------------------------------------------------------------------------------- /Engine/UE1/FunctionFlags.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | enum class UEFunctionFlags : uint32_t 7 | { 8 | Final = 0x00000001, 9 | Defined = 0x00000002, 10 | Iterator = 0x00000004, 11 | Latent = 0x00000008, 12 | PreOperator = 0x00000010, 13 | Singular = 0x00000020, 14 | Net = 0x00000040, 15 | NetReliable = 0x00000080, 16 | Simulated = 0x00000100, 17 | Exec = 0x00000200, 18 | Native = 0x00000400, 19 | Event = 0x00000800, 20 | Operator = 0x00001000, 21 | Static = 0x00002000, 22 | HasOptionalParms = 0x00004000, 23 | Const = 0x00008000, 24 | Public = 0x00020000, 25 | Private = 0x00040000, 26 | Protected = 0x00080000, 27 | Delegate = 0x00100000, 28 | NetServer = 0x00200000, 29 | HasOutParms = 0x00400000, 30 | HasDefaults = 0x00800000, 31 | NetClient = 0x01000000, 32 | DLLImport = 0x02000000, 33 | K2Call = 0x04000000, 34 | K2Override = 0x08000000, 35 | K2Pure = 0x10000000 36 | }; 37 | 38 | inline bool operator&(UEFunctionFlags lhs, UEFunctionFlags rhs) 39 | { 40 | return (static_cast>(lhs) & static_cast>(rhs)) == static_cast>(rhs); 41 | } 42 | 43 | std::string StringifyFlags(const UEFunctionFlags flags); 44 | -------------------------------------------------------------------------------- /Engine/UE1/GenericTypes.cpp: -------------------------------------------------------------------------------- 1 | #include "GenericTypes.hpp" 2 | 3 | void* UEObject::GetAddress() const 4 | { 5 | return object; 6 | } 7 | 8 | UEObject UEObject::GetPackageObject() const 9 | { 10 | UEObject package(nullptr); 11 | 12 | for (auto outer = GetOuter(); outer.IsValid(); outer = outer.GetOuter()) 13 | { 14 | package = outer; 15 | } 16 | 17 | return package; 18 | } 19 | 20 | std::string UEObject::GetFullName() const 21 | { 22 | if (GetClass().IsValid()) 23 | { 24 | std::string temp; 25 | 26 | for (auto outer = GetOuter(); outer.IsValid(); outer = outer.GetOuter()) 27 | { 28 | temp = outer.GetName() + "." + temp; 29 | } 30 | 31 | std::string name = GetClass().GetName(); 32 | name += " "; 33 | name += temp; 34 | name += GetName(); 35 | 36 | return name; 37 | } 38 | 39 | return std::string("(null)"); 40 | } 41 | 42 | std::string UEObject::GetNameCPP() const 43 | { 44 | std::string name; 45 | 46 | if (IsA()) 47 | { 48 | auto c = Cast(); 49 | while (c.IsValid()) 50 | { 51 | auto className = c.GetName(); 52 | if (className == "Actor") 53 | { 54 | name += "A"; 55 | break; 56 | } 57 | if (className == "Object") 58 | { 59 | name += "U"; 60 | break; 61 | } 62 | 63 | c = c.GetSuper().Cast(); 64 | } 65 | } 66 | else 67 | { 68 | name += "F"; 69 | } 70 | 71 | name += GetName(); 72 | 73 | return name; 74 | } 75 | 76 | UEProperty::Info UEProperty::GetInfo() const 77 | { 78 | if (IsValid()) 79 | { 80 | if (IsA()) 81 | { 82 | return Cast().GetInfo(); 83 | } 84 | if (IsA()) 85 | { 86 | return Cast().GetInfo(); 87 | } 88 | if (IsA()) 89 | { 90 | return Cast().GetInfo(); 91 | } 92 | if (IsA()) 93 | { 94 | return Cast().GetInfo(); 95 | } 96 | if (IsA()) 97 | { 98 | return Cast().GetInfo(); 99 | } 100 | if (IsA()) 101 | { 102 | return Cast().GetInfo(); 103 | } 104 | if (IsA()) 105 | { 106 | return Cast().GetInfo(); 107 | } 108 | if (IsA()) 109 | { 110 | return Cast().GetInfo(); 111 | } 112 | if (IsA()) 113 | { 114 | return Cast().GetInfo(); 115 | } 116 | if (IsA()) 117 | { 118 | return Cast().GetInfo(); 119 | } 120 | if (IsA()) 121 | { 122 | return Cast().GetInfo(); 123 | } 124 | if (IsA()) 125 | { 126 | return Cast().GetInfo(); 127 | } 128 | if (IsA()) 129 | { 130 | return Cast().GetInfo(); 131 | } 132 | if (IsA()) 133 | { 134 | return Cast().GetInfo(); 135 | } 136 | } 137 | return { PropertyType::Unknown }; 138 | } 139 | 140 | //--------------------------------------------------------------------------- 141 | //UEByteProperty 142 | //--------------------------------------------------------------------------- 143 | bool UEByteProperty::IsEnum() const 144 | { 145 | return GetEnum().IsValid(); 146 | } 147 | //--------------------------------------------------------------------------- 148 | //UEScriptStruct 149 | //--------------------------------------------------------------------------- 150 | UEClass UEScriptStruct::StaticClass() 151 | { 152 | //Unreal Engine 1 doesn't have the ScriptStruct class 153 | return nullptr; 154 | } 155 | //--------------------------------------------------------------------------- 156 | //UEEnumProperty 157 | //--------------------------------------------------------------------------- 158 | UEEnum UEEnumProperty::GetEnum() const 159 | { 160 | return UEEnum(nullptr); 161 | } 162 | //--------------------------------------------------------------------------- 163 | UEClass UEEnumProperty::StaticClass() 164 | { 165 | //Unreal Engine 1 doesn't have the EnumProperty class 166 | return nullptr; 167 | } 168 | //--------------------------------------------------------------------------- 169 | //UEBoolProperty 170 | //--------------------------------------------------------------------------- 171 | int GetBitPosition(uint32_t value) 172 | { 173 | int i16 = !(value & 0xffff) << 4; 174 | value >>= i16; 175 | 176 | int i8 = !(value & 0xff) << 3; 177 | value >>= i8; 178 | 179 | int i4 = !(value & 0xf) << 2; 180 | value >>= i4; 181 | 182 | int i2 = !(value & 0x3) << 1; 183 | value >>= i2; 184 | 185 | int i1 = !(value & 0x1); 186 | 187 | int i0 = (value >> i1) & 1 ? 0 : -32; 188 | 189 | return i16 + i8 + i4 + i2 + i1 + i0; 190 | } 191 | //--------------------------------------------------------------------------- 192 | std::array UEBoolProperty::GetMissingBitsCount(const UEBoolProperty& other) const 193 | { 194 | // If there is no previous bitfield member, just calculate the missing bits. 195 | if (!other.IsValid()) 196 | { 197 | return { GetBitPosition(GetBitMask()), -1 }; 198 | } 199 | 200 | // If both bitfield member belong to the same int, calculate the bit position difference. 201 | if (GetOffset() == other.GetOffset()) 202 | { 203 | return { GetBitPosition(GetBitMask()) - GetBitPosition(other.GetBitMask()) - 1, -1 }; 204 | } 205 | 206 | // If they have different offsets, we need two distances 207 | // |0000...1000|0010...0000| 208 | // 1. ^---^ 209 | // 2. ^--^ 210 | 211 | return { std::numeric_limits::digits - GetBitPosition(other.GetBitMask()) - 1, GetBitPosition(GetBitMask()) }; 212 | } 213 | //--------------------------------------------------------------------------- -------------------------------------------------------------------------------- /Engine/UE1/GenericTypes.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "PropertyFlags.hpp" 8 | #include "FunctionFlags.hpp" 9 | #include "../IGenerator.hpp" 10 | 11 | class UObject; 12 | class UEClass; 13 | 14 | class UEObject 15 | { 16 | public: 17 | UEObject() 18 | : object(nullptr) 19 | { 20 | } 21 | UEObject(UObject *_object) 22 | : object(_object) 23 | { 24 | } 25 | 26 | bool IsValid() const 27 | { 28 | return object != nullptr; 29 | } 30 | 31 | size_t GetIndex() const; 32 | 33 | UEClass GetClass() const; 34 | 35 | UEObject GetOuter() const; 36 | 37 | std::string GetName() const; 38 | 39 | std::string GetFullName() const; 40 | 41 | std::string GetNameCPP() const; 42 | 43 | UEObject GetPackageObject() const; 44 | 45 | void* GetAddress() const; 46 | 47 | template 48 | Base Cast() const 49 | { 50 | return Base(object); 51 | } 52 | 53 | template 54 | bool IsA() const; 55 | 56 | static UEClass StaticClass(); 57 | 58 | protected: 59 | UObject* object; 60 | }; 61 | 62 | namespace std 63 | { 64 | template<> 65 | struct hash 66 | { 67 | size_t operator()(const UEObject& obj) const 68 | { 69 | return std::hash()(obj.GetAddress()); 70 | } 71 | }; 72 | } 73 | 74 | inline bool operator==(const UEObject& lhs, const UEObject& rhs) { return rhs.GetAddress() == lhs.GetAddress(); } 75 | inline bool operator!=(const UEObject& lhs, const UEObject& rhs) { return !(lhs == rhs); } 76 | 77 | class UEField : public UEObject 78 | { 79 | public: 80 | using UEObject::UEObject; 81 | 82 | UEField GetNext() const; 83 | 84 | static UEClass StaticClass(); 85 | }; 86 | 87 | class UEEnum : public UEField 88 | { 89 | public: 90 | using UEField::UEField; 91 | 92 | std::vector GetNames() const; 93 | 94 | static UEClass StaticClass(); 95 | }; 96 | 97 | class UEConst : public UEField 98 | { 99 | public: 100 | using UEField::UEField; 101 | 102 | std::string GetValue() const; 103 | 104 | static UEClass StaticClass(); 105 | }; 106 | 107 | class UEStruct : public UEField 108 | { 109 | public: 110 | using UEField::UEField; 111 | 112 | UEStruct GetSuper() const; 113 | 114 | UEField GetChildren() const; 115 | 116 | size_t GetPropertySize() const; 117 | 118 | static UEClass StaticClass(); 119 | }; 120 | 121 | class UEScriptStruct : public UEStruct 122 | { 123 | public: 124 | using UEStruct::UEStruct; 125 | 126 | static UEClass StaticClass(); 127 | }; 128 | 129 | class UEFunction : public UEStruct 130 | { 131 | public: 132 | using UEStruct::UEStruct; 133 | 134 | UEFunctionFlags GetFunctionFlags() const; 135 | 136 | static UEClass StaticClass(); 137 | }; 138 | 139 | class UEState : public UEStruct 140 | { 141 | public: 142 | using UEStruct::UEStruct; 143 | 144 | static UEClass StaticClass(); 145 | }; 146 | 147 | class UEClass : public UEState 148 | { 149 | public: 150 | using UEState::UEState; 151 | 152 | static UEClass StaticClass(); 153 | }; 154 | 155 | class UEProperty : public UEField 156 | { 157 | public: 158 | using UEField::UEField; 159 | 160 | size_t GetArrayDim() const; 161 | 162 | size_t GetElementSize() const; 163 | 164 | UEPropertyFlags GetPropertyFlags() const; 165 | 166 | size_t GetOffset() const; 167 | 168 | enum class PropertyType 169 | { 170 | Unknown, 171 | Primitive, 172 | PredefinedStruct, 173 | CustomStruct, 174 | Container 175 | }; 176 | 177 | struct Info 178 | { 179 | PropertyType Type; 180 | size_t Size; 181 | bool CanBeReference; 182 | std::string CppType; 183 | 184 | static Info Create(PropertyType type, size_t size, bool reference, std::string&& cppType) 185 | { 186 | extern IGenerator* generator; 187 | 188 | return { type, size, reference, generator->GetOverrideType(cppType) }; 189 | } 190 | }; 191 | 192 | Info GetInfo() const; 193 | 194 | static UEClass StaticClass(); 195 | }; 196 | 197 | class UEPointerProperty : public UEProperty 198 | { 199 | public: 200 | using UEProperty::UEProperty; 201 | 202 | UEProperty::Info GetInfo() const; 203 | 204 | static UEClass StaticClass(); 205 | }; 206 | 207 | class UEByteProperty : public UEProperty 208 | { 209 | public: 210 | using UEProperty::UEProperty; 211 | 212 | bool IsEnum() const; 213 | 214 | UEEnum GetEnum() const; 215 | 216 | UEProperty::Info GetInfo() const; 217 | 218 | static UEClass StaticClass(); 219 | }; 220 | 221 | class UEIntProperty : public UEProperty 222 | { 223 | public: 224 | using UEProperty::UEProperty; 225 | 226 | UEProperty::Info GetInfo() const; 227 | 228 | static UEClass StaticClass(); 229 | }; 230 | 231 | class UEFloatProperty : public UEProperty 232 | { 233 | public: 234 | using UEProperty::UEProperty; 235 | 236 | UEProperty::Info GetInfo() const; 237 | 238 | static UEClass StaticClass(); 239 | }; 240 | 241 | class UEBoolProperty : public UEProperty 242 | { 243 | public: 244 | using UEProperty::UEProperty; 245 | 246 | bool IsNativeBool() const { return false; } 247 | 248 | bool IsBitfield() const { return !IsNativeBool(); } 249 | 250 | size_t GetBitMask() const; 251 | 252 | std::array GetMissingBitsCount(const UEBoolProperty& other) const; 253 | 254 | UEProperty::Info GetInfo() const; 255 | 256 | static UEClass StaticClass(); 257 | }; 258 | 259 | inline bool operator<(const UEBoolProperty& lhs, const UEBoolProperty& rhs) 260 | { 261 | return lhs.GetBitMask() < rhs.GetBitMask(); 262 | } 263 | 264 | class UEObjectProperty : public UEProperty 265 | { 266 | public: 267 | using UEProperty::UEProperty; 268 | 269 | UEProperty::Info GetInfo() const; 270 | 271 | static UEClass StaticClass(); 272 | }; 273 | 274 | class UEClassProperty : public UEObjectProperty 275 | { 276 | public: 277 | using UEObjectProperty::UEObjectProperty; 278 | 279 | UEClass GetMetaClass() const; 280 | 281 | UEProperty::Info GetInfo() const; 282 | 283 | static UEClass StaticClass(); 284 | }; 285 | 286 | class UEInterfaceProperty : public UEProperty 287 | { 288 | public: 289 | using UEProperty::UEProperty; 290 | 291 | UEClass GetInterfaceClass() const; 292 | 293 | UEProperty::Info GetInfo() const; 294 | 295 | static UEClass StaticClass(); 296 | }; 297 | 298 | class UENameProperty : public UEProperty 299 | { 300 | public: 301 | using UEProperty::UEProperty; 302 | 303 | UEProperty::Info GetInfo() const; 304 | 305 | static UEClass StaticClass(); 306 | }; 307 | 308 | class UEStructProperty : public UEProperty 309 | { 310 | public: 311 | using UEProperty::UEProperty; 312 | 313 | UEScriptStruct GetStruct() const; 314 | 315 | UEProperty::Info GetInfo() const; 316 | 317 | static UEClass StaticClass(); 318 | }; 319 | 320 | class UEStrProperty : public UEProperty 321 | { 322 | public: 323 | using UEProperty::UEProperty; 324 | 325 | UEProperty::Info GetInfo() const; 326 | 327 | static UEClass StaticClass(); 328 | }; 329 | 330 | class UEArrayProperty : public UEProperty 331 | { 332 | public: 333 | using UEProperty::UEProperty; 334 | 335 | UEProperty GetInner() const; 336 | 337 | UEProperty::Info GetInfo() const; 338 | 339 | static UEClass StaticClass(); 340 | }; 341 | 342 | class UEMapProperty : public UEProperty 343 | { 344 | public: 345 | using UEProperty::UEProperty; 346 | 347 | UEProperty GetKeyProperty() const; 348 | UEProperty GetValueProperty() const; 349 | 350 | UEProperty::Info GetInfo() const; 351 | 352 | static UEClass StaticClass(); 353 | }; 354 | 355 | class UEDelegateProperty : public UEProperty 356 | { 357 | public: 358 | using UEProperty::UEProperty; 359 | 360 | UEFunction GetSignatureFunction() const; 361 | 362 | UEProperty::Info GetInfo() const; 363 | 364 | static UEClass StaticClass(); 365 | }; 366 | 367 | class UEEnumProperty : public UEProperty 368 | { 369 | public: 370 | using UEProperty::UEProperty; 371 | 372 | UEEnum GetEnum() const; 373 | 374 | static UEClass StaticClass(); 375 | }; 376 | 377 | template 378 | bool UEObject::IsA() const 379 | { 380 | auto cmp = T::StaticClass(); 381 | if (!cmp.IsValid()) 382 | { 383 | return false; 384 | } 385 | 386 | for (auto super = GetClass(); super.IsValid(); super = super.GetSuper().Cast()) 387 | { 388 | if (super.object == cmp.object) 389 | { 390 | return true; 391 | } 392 | } 393 | 394 | return false; 395 | } 396 | 397 | template<> 398 | inline bool UEObject::IsA() const 399 | { 400 | //UE1 doesn't have ScriptStruct so we need to check a little bit more 401 | if (IsA()) 402 | { 403 | return !IsA() && !IsA(); 404 | } 405 | 406 | return false; 407 | } 408 | 409 | template<> 410 | inline bool UEObject::IsA() const 411 | { 412 | //UE1 doesn't have an EnumProperty. 413 | 414 | return false; 415 | } 416 | -------------------------------------------------------------------------------- /Engine/UE1/Package.cpp: -------------------------------------------------------------------------------- 1 | #include "../Package.hpp" 2 | 3 | bool Package::Method::Parameter::MakeType(UEPropertyFlags flags, Type& type) 4 | { 5 | if (flags & UEPropertyFlags::ReturnParm) 6 | { 7 | type = Type::Return; 8 | } 9 | else if (flags & UEPropertyFlags::OutParm) 10 | { 11 | type = Type::Out; 12 | } 13 | else if (flags & UEPropertyFlags::Parm) 14 | { 15 | type = Type::Default; 16 | } 17 | else 18 | { 19 | return false; 20 | } 21 | 22 | return true; 23 | } -------------------------------------------------------------------------------- /Engine/UE1/PropertyFlags.cpp: -------------------------------------------------------------------------------- 1 | #include "PropertyFlags.hpp" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | std::string StringifyFlags(const UEPropertyFlags flags) 8 | { 9 | std::vector buffer; 10 | 11 | if (flags & UEPropertyFlags::Edit) { buffer.push_back("Edit"); } 12 | if (flags & UEPropertyFlags::Const) { buffer.push_back("Const"); } 13 | if (flags & UEPropertyFlags::Input) { buffer.push_back("Input"); } 14 | if (flags & UEPropertyFlags::ExportObject) { buffer.push_back("ExportObject"); } 15 | if (flags & UEPropertyFlags::OptionalParm) { buffer.push_back("OptionalParm"); } 16 | if (flags & UEPropertyFlags::Net) { buffer.push_back("Net"); } 17 | if (flags & UEPropertyFlags::EditFixedSize) { buffer.push_back("EditFixedSize"); } 18 | if (flags & UEPropertyFlags::Parm) { buffer.push_back("Parm"); } 19 | if (flags & UEPropertyFlags::OutParm) { buffer.push_back("OutParm"); } 20 | if (flags & UEPropertyFlags::SkipParm) { buffer.push_back("SkipParm"); } 21 | if (flags & UEPropertyFlags::ReturnParm) { buffer.push_back("ReturnParm"); } 22 | if (flags & UEPropertyFlags::CoerceParm) { buffer.push_back("CoerceParm"); } 23 | if (flags & UEPropertyFlags::Native) { buffer.push_back("Native"); } 24 | if (flags & UEPropertyFlags::Transient) { buffer.push_back("Transient"); } 25 | if (flags & UEPropertyFlags::Config) { buffer.push_back("Config"); } 26 | if (flags & UEPropertyFlags::Localized) { buffer.push_back("Localized"); } 27 | if (flags & UEPropertyFlags::EditConst) { buffer.push_back("EditConst"); } 28 | if (flags & UEPropertyFlags::GlobalConfig) { buffer.push_back("GlobalConfig"); } 29 | if (flags & UEPropertyFlags::Component) { buffer.push_back("Component"); } 30 | if (flags & UEPropertyFlags::AlwaysInit) { buffer.push_back("AlwaysInit"); } 31 | if (flags & UEPropertyFlags::DuplicateTransient) { buffer.push_back("DuplicateTransient"); } 32 | if (flags & UEPropertyFlags::NeedCtorLink) { buffer.push_back("NeedCtorLink"); } 33 | if (flags & UEPropertyFlags::NoExport) { buffer.push_back("NoExport"); } 34 | if (flags & UEPropertyFlags::NoImport) { buffer.push_back("NoImport"); } 35 | if (flags & UEPropertyFlags::NoClear) { buffer.push_back("NoClear"); } 36 | if (flags & UEPropertyFlags::EditInline) { buffer.push_back("EditInline"); } 37 | if (flags & UEPropertyFlags::EditInlineUse) { buffer.push_back("EditInlineUse"); } 38 | if (flags & UEPropertyFlags::Deprecated) { buffer.push_back("Deprecated"); } 39 | if (flags & UEPropertyFlags::DataBinding) { buffer.push_back("DataBinding"); } 40 | if (flags & UEPropertyFlags::SerializeText) { buffer.push_back("SerializeText"); } 41 | if (flags & UEPropertyFlags::RepNotify) { buffer.push_back("RepNotify"); } 42 | if (flags & UEPropertyFlags::Interp) { buffer.push_back("Interp"); } 43 | if (flags & UEPropertyFlags::NonTransactional) { buffer.push_back("NonTransactional"); } 44 | if (flags & UEPropertyFlags::EditorOnly) { buffer.push_back("EditorOnly"); } 45 | if (flags & UEPropertyFlags::NotForConsole) { buffer.push_back("NotForConsole"); } 46 | if (flags & UEPropertyFlags::RepRetry) { buffer.push_back("RepRetry"); } 47 | if (flags & UEPropertyFlags::PrivateWrite) { buffer.push_back("PrivateWrite"); } 48 | if (flags & UEPropertyFlags::ProtectedWrite) { buffer.push_back("ProtectedWrite"); } 49 | if (flags & UEPropertyFlags::ArchetypeProperty) { buffer.push_back("ArchetypeProperty"); } 50 | if (flags & UEPropertyFlags::EditHide) { buffer.push_back("EditHide"); } 51 | if (flags & UEPropertyFlags::EditTextBox) { buffer.push_back("EditTextBox"); } 52 | if (flags & UEPropertyFlags::CrossLevelPassive) { buffer.push_back("CrossLevelPassive"); } 53 | if (flags & UEPropertyFlags::CrossLevelActive) { buffer.push_back("CrossLevelActive"); } 54 | 55 | switch (buffer.size()) 56 | { 57 | case 0: 58 | return std::string(); 59 | case 1: 60 | return std::string(buffer[0]); 61 | default: 62 | std::ostringstream os; 63 | std::copy(buffer.begin(), buffer.end() - 1, std::ostream_iterator(os, ", ")); 64 | os << *buffer.rbegin(); 65 | return os.str(); 66 | } 67 | } -------------------------------------------------------------------------------- /Engine/UE1/PropertyFlags.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | enum class UEPropertyFlags : uint64_t 7 | { 8 | Edit = 0x0000000000000001, 9 | Const = 0x0000000000000002, 10 | Input = 0x0000000000000004, 11 | ExportObject = 0x0000000000000008, 12 | OptionalParm = 0x0000000000000010, 13 | Net = 0x0000000000000020, 14 | EditFixedSize = 0x0000000000000040, 15 | Parm = 0x0000000000000080, 16 | OutParm = 0x0000000000000100, 17 | SkipParm = 0x0000000000000200, 18 | ReturnParm = 0x0000000000000400, 19 | CoerceParm = 0x0000000000000800, 20 | Native = 0x0000000000001000, 21 | Transient = 0x0000000000002000, 22 | Config = 0x0000000000004000, 23 | Localized = 0x0000000000008000, 24 | EditConst = 0x0000000000020000, 25 | GlobalConfig = 0x0000000000040000, 26 | Component = 0x0000000000080000, 27 | AlwaysInit = 0x0000000000100000, 28 | DuplicateTransient = 0x0000000000200000, 29 | NeedCtorLink = 0x0000000000400000, 30 | NoExport = 0x0000000000800000, 31 | NoImport = 0x0000000001000000, 32 | NoClear = 0x0000000002000000, 33 | EditInline = 0x0000000004000000, 34 | EditInlineUse = 0x0000000010000000, 35 | Deprecated = 0x0000000020000000, 36 | DataBinding = 0x0000000040000000, 37 | SerializeText = 0x0000000080000000, 38 | RepNotify = 0x0000000100000000, 39 | Interp = 0x0000000200000000, 40 | NonTransactional = 0x0000000400000000, 41 | EditorOnly = 0x0000000800000000, 42 | NotForConsole = 0x0000001000000000, 43 | RepRetry = 0x0000002000000000, 44 | PrivateWrite = 0x0000004000000000, 45 | ProtectedWrite = 0x0000008000000000, 46 | ArchetypeProperty = 0x0000010000000000, 47 | EditHide = 0x0000020000000000, 48 | EditTextBox = 0x0000040000000000, 49 | CrossLevelPassive = 0x0000100000000000, 50 | CrossLevelActive = 0x0000200000000000 51 | }; 52 | 53 | inline bool operator&(UEPropertyFlags lhs, UEPropertyFlags rhs) 54 | { 55 | return (static_cast>(lhs) & static_cast>(rhs)) == static_cast>(rhs); 56 | } 57 | 58 | std::string StringifyFlags(const UEPropertyFlags flags); -------------------------------------------------------------------------------- /Engine/UE2/FunctionFlags.cpp: -------------------------------------------------------------------------------- 1 | #include "FunctionFlags.hpp" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | std::string StringifyFlags(const UEFunctionFlags flags) 8 | { 9 | std::vector buffer; 10 | 11 | if (flags & UEFunctionFlags::Final) { buffer.push_back("Final"); } 12 | if (flags & UEFunctionFlags::Defined) { buffer.push_back("Defined"); } 13 | if (flags & UEFunctionFlags::Iterator) { buffer.push_back("Iterator"); } 14 | if (flags & UEFunctionFlags::Latent) { buffer.push_back("Latent"); } 15 | if (flags & UEFunctionFlags::PreOperator) { buffer.push_back("PreOperator"); } 16 | if (flags & UEFunctionFlags::Singular) { buffer.push_back("Singular"); } 17 | if (flags & UEFunctionFlags::Net) { buffer.push_back("Net"); } 18 | if (flags & UEFunctionFlags::NetReliable) { buffer.push_back("NetReliable"); } 19 | if (flags & UEFunctionFlags::Simulated) { buffer.push_back("Simulated"); } 20 | if (flags & UEFunctionFlags::Exec) { buffer.push_back("Exec"); } 21 | if (flags & UEFunctionFlags::Native) { buffer.push_back("Native"); } 22 | if (flags & UEFunctionFlags::Event) { buffer.push_back("Event"); } 23 | if (flags & UEFunctionFlags::Operator) { buffer.push_back("Operator"); } 24 | if (flags & UEFunctionFlags::Static) { buffer.push_back("Static"); } 25 | if (flags & UEFunctionFlags::HasOptionalParms) { buffer.push_back("HasOptionalParms"); } 26 | if (flags & UEFunctionFlags::Const) { buffer.push_back("Const"); } 27 | if (flags & UEFunctionFlags::Public) { buffer.push_back("Public"); } 28 | if (flags & UEFunctionFlags::Private) { buffer.push_back("Private"); } 29 | if (flags & UEFunctionFlags::Protected) { buffer.push_back("Protected"); } 30 | if (flags & UEFunctionFlags::Delegate) { buffer.push_back("Delegate"); } 31 | if (flags & UEFunctionFlags::NetServer) { buffer.push_back("NetServer"); } 32 | if (flags & UEFunctionFlags::HasOutParms) { buffer.push_back("HasOutParms"); } 33 | if (flags & UEFunctionFlags::HasDefaults) { buffer.push_back("HasDefaults"); } 34 | if (flags & UEFunctionFlags::NetClient) { buffer.push_back("NetClient"); } 35 | if (flags & UEFunctionFlags::DLLImport) { buffer.push_back("DLLImport"); } 36 | if (flags & UEFunctionFlags::K2Call) { buffer.push_back("K2Call"); } 37 | if (flags & UEFunctionFlags::K2Override) { buffer.push_back("K2Override"); } 38 | if (flags & UEFunctionFlags::K2Pure) { buffer.push_back("K2Pure"); } 39 | 40 | switch (buffer.size()) 41 | { 42 | case 0: 43 | return std::string(); 44 | case 1: 45 | return std::string(buffer[0]); 46 | default: 47 | std::ostringstream os; 48 | std::copy(buffer.begin(), buffer.end() - 1, std::ostream_iterator(os, ", ")); 49 | os << *buffer.rbegin(); 50 | return os.str(); 51 | } 52 | } -------------------------------------------------------------------------------- /Engine/UE2/FunctionFlags.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | enum class UEFunctionFlags : uint32_t 7 | { 8 | Final = 0x00000001, 9 | Defined = 0x00000002, 10 | Iterator = 0x00000004, 11 | Latent = 0x00000008, 12 | PreOperator = 0x00000010, 13 | Singular = 0x00000020, 14 | Net = 0x00000040, 15 | NetReliable = 0x00000080, 16 | Simulated = 0x00000100, 17 | Exec = 0x00000200, 18 | Native = 0x00000400, 19 | Event = 0x00000800, 20 | Operator = 0x00001000, 21 | Static = 0x00002000, 22 | HasOptionalParms = 0x00004000, 23 | Const = 0x00008000, 24 | Public = 0x00020000, 25 | Private = 0x00040000, 26 | Protected = 0x00080000, 27 | Delegate = 0x00100000, 28 | NetServer = 0x00200000, 29 | HasOutParms = 0x00400000, 30 | HasDefaults = 0x00800000, 31 | NetClient = 0x01000000, 32 | DLLImport = 0x02000000, 33 | K2Call = 0x04000000, 34 | K2Override = 0x08000000, 35 | K2Pure = 0x10000000 36 | }; 37 | 38 | inline bool operator&(UEFunctionFlags lhs, UEFunctionFlags rhs) 39 | { 40 | return (static_cast>(lhs) & static_cast>(rhs)) == static_cast>(rhs); 41 | } 42 | 43 | std::string StringifyFlags(const UEFunctionFlags flags); 44 | -------------------------------------------------------------------------------- /Engine/UE2/GenericTypes.cpp: -------------------------------------------------------------------------------- 1 | #include "GenericTypes.hpp" 2 | 3 | void* UEObject::GetAddress() const 4 | { 5 | return object; 6 | } 7 | 8 | UEObject UEObject::GetPackageObject() const 9 | { 10 | UEObject package(nullptr); 11 | 12 | for (auto outer = GetOuter(); outer.IsValid(); outer = outer.GetOuter()) 13 | { 14 | package = outer; 15 | } 16 | 17 | return package; 18 | } 19 | 20 | std::string UEObject::GetFullName() const 21 | { 22 | if (GetClass().IsValid()) 23 | { 24 | std::string temp; 25 | 26 | for (auto outer = GetOuter(); outer.IsValid(); outer = outer.GetOuter()) 27 | { 28 | temp = outer.GetName() + "." + temp; 29 | } 30 | 31 | std::string name = GetClass().GetName(); 32 | name += " "; 33 | name += temp; 34 | name += GetName(); 35 | 36 | return name; 37 | } 38 | 39 | return std::string("(null)"); 40 | } 41 | 42 | std::string UEObject::GetNameCPP() const 43 | { 44 | std::string name; 45 | 46 | if (IsA()) 47 | { 48 | auto c = Cast(); 49 | while (c.IsValid()) 50 | { 51 | auto className = c.GetName(); 52 | if (className == "Actor") 53 | { 54 | name += "A"; 55 | break; 56 | } 57 | if (className == "Object") 58 | { 59 | name += "U"; 60 | break; 61 | } 62 | 63 | c = c.GetSuper().Cast(); 64 | } 65 | } 66 | else 67 | { 68 | name += "F"; 69 | } 70 | 71 | name += GetName(); 72 | 73 | return name; 74 | } 75 | 76 | UEProperty::Info UEProperty::GetInfo() const 77 | { 78 | if (IsValid()) 79 | { 80 | if (IsA()) 81 | { 82 | return Cast().GetInfo(); 83 | } 84 | if (IsA()) 85 | { 86 | return Cast().GetInfo(); 87 | } 88 | if (IsA()) 89 | { 90 | return Cast().GetInfo(); 91 | } 92 | if (IsA()) 93 | { 94 | return Cast().GetInfo(); 95 | } 96 | if (IsA()) 97 | { 98 | return Cast().GetInfo(); 99 | } 100 | if (IsA()) 101 | { 102 | return Cast().GetInfo(); 103 | } 104 | if (IsA()) 105 | { 106 | return Cast().GetInfo(); 107 | } 108 | if (IsA()) 109 | { 110 | return Cast().GetInfo(); 111 | } 112 | if (IsA()) 113 | { 114 | return Cast().GetInfo(); 115 | } 116 | if (IsA()) 117 | { 118 | return Cast().GetInfo(); 119 | } 120 | if (IsA()) 121 | { 122 | return Cast().GetInfo(); 123 | } 124 | if (IsA()) 125 | { 126 | return Cast().GetInfo(); 127 | } 128 | if (IsA()) 129 | { 130 | return Cast().GetInfo(); 131 | } 132 | if (IsA()) 133 | { 134 | return Cast().GetInfo(); 135 | } 136 | } 137 | return { PropertyType::Unknown }; 138 | } 139 | 140 | //--------------------------------------------------------------------------- 141 | //UEByteProperty 142 | //--------------------------------------------------------------------------- 143 | bool UEByteProperty::IsEnum() const 144 | { 145 | return GetEnum().IsValid(); 146 | } 147 | //--------------------------------------------------------------------------- 148 | //UEScriptStruct 149 | //--------------------------------------------------------------------------- 150 | UEClass UEScriptStruct::StaticClass() 151 | { 152 | //Unreal Engine 2 doesn't have the ScriptStruct class 153 | return nullptr; 154 | } 155 | //--------------------------------------------------------------------------- 156 | //UEEnumProperty 157 | //--------------------------------------------------------------------------- 158 | UEEnum UEEnumProperty::GetEnum() const 159 | { 160 | return UEEnum(nullptr); 161 | } 162 | //--------------------------------------------------------------------------- 163 | UEClass UEEnumProperty::StaticClass() 164 | { 165 | //Unreal Engine 2 doesn't have the EnumProperty class 166 | return nullptr; 167 | } 168 | //--------------------------------------------------------------------------- 169 | //UEBoolProperty 170 | //--------------------------------------------------------------------------- 171 | int GetBitPosition(uint32_t value) 172 | { 173 | int i16 = !(value & 0xffff) << 4; 174 | value >>= i16; 175 | 176 | int i8 = !(value & 0xff) << 3; 177 | value >>= i8; 178 | 179 | int i4 = !(value & 0xf) << 2; 180 | value >>= i4; 181 | 182 | int i2 = !(value & 0x3) << 1; 183 | value >>= i2; 184 | 185 | int i1 = !(value & 0x1); 186 | 187 | int i0 = (value >> i1) & 1 ? 0 : -32; 188 | 189 | return i16 + i8 + i4 + i2 + i1 + i0; 190 | } 191 | //--------------------------------------------------------------------------- 192 | std::array UEBoolProperty::GetMissingBitsCount(const UEBoolProperty& other) const 193 | { 194 | // If there is no previous bitfield member, just calculate the missing bits. 195 | if (!other.IsValid()) 196 | { 197 | return { GetBitPosition(GetBitMask()), -1 }; 198 | } 199 | 200 | // If both bitfield member belong to the same int, calculate the bit position difference. 201 | if (GetOffset() == other.GetOffset()) 202 | { 203 | return { GetBitPosition(GetBitMask()) - GetBitPosition(other.GetBitMask()) - 1, -1 }; 204 | } 205 | 206 | // If they have different offsets, we need two distances 207 | // |0000...1000|0010...0000| 208 | // 1. ^---^ 209 | // 2. ^--^ 210 | 211 | return { std::numeric_limits::digits - GetBitPosition(other.GetBitMask()) - 1, GetBitPosition(GetBitMask()) }; 212 | } 213 | //--------------------------------------------------------------------------- -------------------------------------------------------------------------------- /Engine/UE2/GenericTypes.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "PropertyFlags.hpp" 8 | #include "FunctionFlags.hpp" 9 | #include "../IGenerator.hpp" 10 | 11 | class UObject; 12 | class UEClass; 13 | 14 | class UEObject 15 | { 16 | public: 17 | UEObject() 18 | : object(nullptr) 19 | { 20 | } 21 | UEObject(UObject *_object) 22 | : object(_object) 23 | { 24 | } 25 | 26 | bool IsValid() const 27 | { 28 | return object != nullptr; 29 | } 30 | 31 | size_t GetIndex() const; 32 | 33 | UEClass GetClass() const; 34 | 35 | UEObject GetOuter() const; 36 | 37 | std::string GetName() const; 38 | 39 | std::string GetFullName() const; 40 | 41 | std::string GetNameCPP() const; 42 | 43 | UEObject GetPackageObject() const; 44 | 45 | void* GetAddress() const; 46 | 47 | template 48 | Base Cast() const 49 | { 50 | return Base(object); 51 | } 52 | 53 | template 54 | bool IsA() const; 55 | 56 | static UEClass StaticClass(); 57 | 58 | protected: 59 | UObject* object; 60 | }; 61 | 62 | namespace std 63 | { 64 | template<> 65 | struct hash 66 | { 67 | size_t operator()(const UEObject& obj) const 68 | { 69 | return std::hash()(obj.GetAddress()); 70 | } 71 | }; 72 | } 73 | 74 | inline bool operator==(const UEObject& lhs, const UEObject& rhs) { return rhs.GetAddress() == lhs.GetAddress(); } 75 | inline bool operator!=(const UEObject& lhs, const UEObject& rhs) { return !(lhs == rhs); } 76 | 77 | class UEField : public UEObject 78 | { 79 | public: 80 | using UEObject::UEObject; 81 | 82 | UEField GetNext() const; 83 | 84 | static UEClass StaticClass(); 85 | }; 86 | 87 | class UEEnum : public UEField 88 | { 89 | public: 90 | using UEField::UEField; 91 | 92 | std::vector GetNames() const; 93 | 94 | static UEClass StaticClass(); 95 | }; 96 | 97 | class UEConst : public UEField 98 | { 99 | public: 100 | using UEField::UEField; 101 | 102 | std::string GetValue() const; 103 | 104 | static UEClass StaticClass(); 105 | }; 106 | 107 | class UEStruct : public UEField 108 | { 109 | public: 110 | using UEField::UEField; 111 | 112 | UEStruct GetSuper() const; 113 | 114 | UEField GetChildren() const; 115 | 116 | size_t GetPropertySize() const; 117 | 118 | static UEClass StaticClass(); 119 | }; 120 | 121 | class UEScriptStruct : public UEStruct 122 | { 123 | public: 124 | using UEStruct::UEStruct; 125 | 126 | static UEClass StaticClass(); 127 | }; 128 | 129 | class UEFunction : public UEStruct 130 | { 131 | public: 132 | using UEStruct::UEStruct; 133 | 134 | UEFunctionFlags GetFunctionFlags() const; 135 | 136 | static UEClass StaticClass(); 137 | }; 138 | 139 | class UEState : public UEStruct 140 | { 141 | public: 142 | using UEStruct::UEStruct; 143 | 144 | static UEClass StaticClass(); 145 | }; 146 | 147 | class UEClass : public UEState 148 | { 149 | public: 150 | using UEState::UEState; 151 | 152 | static UEClass StaticClass(); 153 | }; 154 | 155 | class UEProperty : public UEField 156 | { 157 | public: 158 | using UEField::UEField; 159 | 160 | size_t GetArrayDim() const; 161 | 162 | size_t GetElementSize() const; 163 | 164 | UEPropertyFlags GetPropertyFlags() const; 165 | 166 | size_t GetOffset() const; 167 | 168 | enum class PropertyType 169 | { 170 | Unknown, 171 | Primitive, 172 | PredefinedStruct, 173 | CustomStruct, 174 | Container 175 | }; 176 | 177 | struct Info 178 | { 179 | PropertyType Type; 180 | size_t Size; 181 | bool CanBeReference; 182 | std::string CppType; 183 | 184 | static Info Create(PropertyType type, size_t size, bool reference, std::string&& cppType) 185 | { 186 | extern IGenerator* generator; 187 | 188 | return { type, size, reference, generator->GetOverrideType(cppType) }; 189 | } 190 | }; 191 | 192 | Info GetInfo() const; 193 | 194 | static UEClass StaticClass(); 195 | }; 196 | 197 | class UEPointerProperty : public UEProperty 198 | { 199 | public: 200 | using UEProperty::UEProperty; 201 | 202 | UEProperty::Info GetInfo() const; 203 | 204 | static UEClass StaticClass(); 205 | }; 206 | 207 | class UEByteProperty : public UEProperty 208 | { 209 | public: 210 | using UEProperty::UEProperty; 211 | 212 | bool IsEnum() const; 213 | 214 | UEEnum GetEnum() const; 215 | 216 | UEProperty::Info GetInfo() const; 217 | 218 | static UEClass StaticClass(); 219 | }; 220 | 221 | class UEIntProperty : public UEProperty 222 | { 223 | public: 224 | using UEProperty::UEProperty; 225 | 226 | UEProperty::Info GetInfo() const; 227 | 228 | static UEClass StaticClass(); 229 | }; 230 | 231 | class UEFloatProperty : public UEProperty 232 | { 233 | public: 234 | using UEProperty::UEProperty; 235 | 236 | UEProperty::Info GetInfo() const; 237 | 238 | static UEClass StaticClass(); 239 | }; 240 | 241 | class UEBoolProperty : public UEProperty 242 | { 243 | public: 244 | using UEProperty::UEProperty; 245 | 246 | bool IsNativeBool() const { return false; } 247 | 248 | bool IsBitfield() const { return !IsNativeBool(); } 249 | 250 | size_t GetBitMask() const; 251 | 252 | std::array GetMissingBitsCount(const UEBoolProperty& other) const; 253 | 254 | UEProperty::Info GetInfo() const; 255 | 256 | static UEClass StaticClass(); 257 | }; 258 | 259 | inline bool operator<(const UEBoolProperty& lhs, const UEBoolProperty& rhs) 260 | { 261 | return lhs.GetBitMask() < rhs.GetBitMask(); 262 | } 263 | 264 | class UEObjectProperty : public UEProperty 265 | { 266 | public: 267 | using UEProperty::UEProperty; 268 | 269 | UEProperty::Info GetInfo() const; 270 | 271 | static UEClass StaticClass(); 272 | }; 273 | 274 | class UEClassProperty : public UEObjectProperty 275 | { 276 | public: 277 | using UEObjectProperty::UEObjectProperty; 278 | 279 | UEClass GetMetaClass() const; 280 | 281 | UEProperty::Info GetInfo() const; 282 | 283 | static UEClass StaticClass(); 284 | }; 285 | 286 | class UEInterfaceProperty : public UEProperty 287 | { 288 | public: 289 | using UEProperty::UEProperty; 290 | 291 | UEClass GetInterfaceClass() const; 292 | 293 | UEProperty::Info GetInfo() const; 294 | 295 | static UEClass StaticClass(); 296 | }; 297 | 298 | class UENameProperty : public UEProperty 299 | { 300 | public: 301 | using UEProperty::UEProperty; 302 | 303 | UEProperty::Info GetInfo() const; 304 | 305 | static UEClass StaticClass(); 306 | }; 307 | 308 | class UEStructProperty : public UEProperty 309 | { 310 | public: 311 | using UEProperty::UEProperty; 312 | 313 | UEScriptStruct GetStruct() const; 314 | 315 | UEProperty::Info GetInfo() const; 316 | 317 | static UEClass StaticClass(); 318 | }; 319 | 320 | class UEStrProperty : public UEProperty 321 | { 322 | public: 323 | using UEProperty::UEProperty; 324 | 325 | UEProperty::Info GetInfo() const; 326 | 327 | static UEClass StaticClass(); 328 | }; 329 | 330 | class UEArrayProperty : public UEProperty 331 | { 332 | public: 333 | using UEProperty::UEProperty; 334 | 335 | UEProperty GetInner() const; 336 | 337 | UEProperty::Info GetInfo() const; 338 | 339 | static UEClass StaticClass(); 340 | }; 341 | 342 | class UEMapProperty : public UEProperty 343 | { 344 | public: 345 | using UEProperty::UEProperty; 346 | 347 | UEProperty GetKeyProperty() const; 348 | UEProperty GetValueProperty() const; 349 | 350 | UEProperty::Info GetInfo() const; 351 | 352 | static UEClass StaticClass(); 353 | }; 354 | 355 | class UEDelegateProperty : public UEProperty 356 | { 357 | public: 358 | using UEProperty::UEProperty; 359 | 360 | UEFunction GetSignatureFunction() const; 361 | 362 | UEProperty::Info GetInfo() const; 363 | 364 | static UEClass StaticClass(); 365 | }; 366 | 367 | class UEEnumProperty : public UEProperty 368 | { 369 | public: 370 | using UEProperty::UEProperty; 371 | 372 | UEEnum GetEnum() const; 373 | 374 | static UEClass StaticClass(); 375 | }; 376 | 377 | template 378 | bool UEObject::IsA() const 379 | { 380 | auto cmp = T::StaticClass(); 381 | if (!cmp.IsValid()) 382 | { 383 | return false; 384 | } 385 | 386 | for (auto super = GetClass(); super.IsValid(); super = super.GetSuper().Cast()) 387 | { 388 | if (super.object == cmp.object) 389 | { 390 | return true; 391 | } 392 | } 393 | 394 | return false; 395 | } 396 | 397 | template<> 398 | inline bool UEObject::IsA() const 399 | { 400 | //UE2 doesn't have ScriptStruct so we need to check a little bit more 401 | if (IsA()) 402 | { 403 | return !IsA() && !IsA(); 404 | } 405 | 406 | return false; 407 | } 408 | 409 | template<> 410 | inline bool UEObject::IsA() const 411 | { 412 | //UE2 doesn't have an EnumProperty. 413 | 414 | return false; 415 | } 416 | -------------------------------------------------------------------------------- /Engine/UE2/Package.cpp: -------------------------------------------------------------------------------- 1 | #include "../Package.hpp" 2 | 3 | bool Package::Method::Parameter::MakeType(UEPropertyFlags flags, Type& type) 4 | { 5 | if (flags & UEPropertyFlags::ReturnParm) 6 | { 7 | type = Type::Return; 8 | } 9 | else if (flags & UEPropertyFlags::OutParm) 10 | { 11 | type = Type::Out; 12 | } 13 | else if (flags & UEPropertyFlags::Parm) 14 | { 15 | type = Type::Default; 16 | } 17 | else 18 | { 19 | return false; 20 | } 21 | 22 | return true; 23 | } -------------------------------------------------------------------------------- /Engine/UE2/PropertyFlags.cpp: -------------------------------------------------------------------------------- 1 | #include "PropertyFlags.hpp" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | std::string StringifyFlags(const UEPropertyFlags flags) 8 | { 9 | std::vector buffer; 10 | 11 | if (flags & UEPropertyFlags::Edit) { buffer.push_back("Edit"); } 12 | if (flags & UEPropertyFlags::Const) { buffer.push_back("Const"); } 13 | if (flags & UEPropertyFlags::Input) { buffer.push_back("Input"); } 14 | if (flags & UEPropertyFlags::ExportObject) { buffer.push_back("ExportObject"); } 15 | if (flags & UEPropertyFlags::OptionalParm) { buffer.push_back("OptionalParm"); } 16 | if (flags & UEPropertyFlags::Net) { buffer.push_back("Net"); } 17 | if (flags & UEPropertyFlags::EditFixedSize) { buffer.push_back("EditFixedSize"); } 18 | if (flags & UEPropertyFlags::Parm) { buffer.push_back("Parm"); } 19 | if (flags & UEPropertyFlags::OutParm) { buffer.push_back("OutParm"); } 20 | if (flags & UEPropertyFlags::SkipParm) { buffer.push_back("SkipParm"); } 21 | if (flags & UEPropertyFlags::ReturnParm) { buffer.push_back("ReturnParm"); } 22 | if (flags & UEPropertyFlags::CoerceParm) { buffer.push_back("CoerceParm"); } 23 | if (flags & UEPropertyFlags::Native) { buffer.push_back("Native"); } 24 | if (flags & UEPropertyFlags::Transient) { buffer.push_back("Transient"); } 25 | if (flags & UEPropertyFlags::Config) { buffer.push_back("Config"); } 26 | if (flags & UEPropertyFlags::Localized) { buffer.push_back("Localized"); } 27 | if (flags & UEPropertyFlags::EditConst) { buffer.push_back("EditConst"); } 28 | if (flags & UEPropertyFlags::GlobalConfig) { buffer.push_back("GlobalConfig"); } 29 | if (flags & UEPropertyFlags::Component) { buffer.push_back("Component"); } 30 | if (flags & UEPropertyFlags::AlwaysInit) { buffer.push_back("AlwaysInit"); } 31 | if (flags & UEPropertyFlags::DuplicateTransient) { buffer.push_back("DuplicateTransient"); } 32 | if (flags & UEPropertyFlags::NeedCtorLink) { buffer.push_back("NeedCtorLink"); } 33 | if (flags & UEPropertyFlags::NoExport) { buffer.push_back("NoExport"); } 34 | if (flags & UEPropertyFlags::NoImport) { buffer.push_back("NoImport"); } 35 | if (flags & UEPropertyFlags::NoClear) { buffer.push_back("NoClear"); } 36 | if (flags & UEPropertyFlags::EditInline) { buffer.push_back("EditInline"); } 37 | if (flags & UEPropertyFlags::EditInlineUse) { buffer.push_back("EditInlineUse"); } 38 | if (flags & UEPropertyFlags::Deprecated) { buffer.push_back("Deprecated"); } 39 | if (flags & UEPropertyFlags::DataBinding) { buffer.push_back("DataBinding"); } 40 | if (flags & UEPropertyFlags::SerializeText) { buffer.push_back("SerializeText"); } 41 | if (flags & UEPropertyFlags::RepNotify) { buffer.push_back("RepNotify"); } 42 | if (flags & UEPropertyFlags::Interp) { buffer.push_back("Interp"); } 43 | if (flags & UEPropertyFlags::NonTransactional) { buffer.push_back("NonTransactional"); } 44 | if (flags & UEPropertyFlags::EditorOnly) { buffer.push_back("EditorOnly"); } 45 | if (flags & UEPropertyFlags::NotForConsole) { buffer.push_back("NotForConsole"); } 46 | if (flags & UEPropertyFlags::RepRetry) { buffer.push_back("RepRetry"); } 47 | if (flags & UEPropertyFlags::PrivateWrite) { buffer.push_back("PrivateWrite"); } 48 | if (flags & UEPropertyFlags::ProtectedWrite) { buffer.push_back("ProtectedWrite"); } 49 | if (flags & UEPropertyFlags::ArchetypeProperty) { buffer.push_back("ArchetypeProperty"); } 50 | if (flags & UEPropertyFlags::EditHide) { buffer.push_back("EditHide"); } 51 | if (flags & UEPropertyFlags::EditTextBox) { buffer.push_back("EditTextBox"); } 52 | if (flags & UEPropertyFlags::CrossLevelPassive) { buffer.push_back("CrossLevelPassive"); } 53 | if (flags & UEPropertyFlags::CrossLevelActive) { buffer.push_back("CrossLevelActive"); } 54 | 55 | switch (buffer.size()) 56 | { 57 | case 0: 58 | return std::string(); 59 | case 1: 60 | return std::string(buffer[0]); 61 | default: 62 | std::ostringstream os; 63 | std::copy(buffer.begin(), buffer.end() - 1, std::ostream_iterator(os, ", ")); 64 | os << *buffer.rbegin(); 65 | return os.str(); 66 | } 67 | } -------------------------------------------------------------------------------- /Engine/UE2/PropertyFlags.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | enum class UEPropertyFlags : uint64_t 7 | { 8 | Edit = 0x0000000000000001, 9 | Const = 0x0000000000000002, 10 | Input = 0x0000000000000004, 11 | ExportObject = 0x0000000000000008, 12 | OptionalParm = 0x0000000000000010, 13 | Net = 0x0000000000000020, 14 | EditFixedSize = 0x0000000000000040, 15 | Parm = 0x0000000000000080, 16 | OutParm = 0x0000000000000100, 17 | SkipParm = 0x0000000000000200, 18 | ReturnParm = 0x0000000000000400, 19 | CoerceParm = 0x0000000000000800, 20 | Native = 0x0000000000001000, 21 | Transient = 0x0000000000002000, 22 | Config = 0x0000000000004000, 23 | Localized = 0x0000000000008000, 24 | EditConst = 0x0000000000020000, 25 | GlobalConfig = 0x0000000000040000, 26 | Component = 0x0000000000080000, 27 | AlwaysInit = 0x0000000000100000, 28 | DuplicateTransient = 0x0000000000200000, 29 | NeedCtorLink = 0x0000000000400000, 30 | NoExport = 0x0000000000800000, 31 | NoImport = 0x0000000001000000, 32 | NoClear = 0x0000000002000000, 33 | EditInline = 0x0000000004000000, 34 | EditInlineUse = 0x0000000010000000, 35 | Deprecated = 0x0000000020000000, 36 | DataBinding = 0x0000000040000000, 37 | SerializeText = 0x0000000080000000, 38 | RepNotify = 0x0000000100000000, 39 | Interp = 0x0000000200000000, 40 | NonTransactional = 0x0000000400000000, 41 | EditorOnly = 0x0000000800000000, 42 | NotForConsole = 0x0000001000000000, 43 | RepRetry = 0x0000002000000000, 44 | PrivateWrite = 0x0000004000000000, 45 | ProtectedWrite = 0x0000008000000000, 46 | ArchetypeProperty = 0x0000010000000000, 47 | EditHide = 0x0000020000000000, 48 | EditTextBox = 0x0000040000000000, 49 | CrossLevelPassive = 0x0000100000000000, 50 | CrossLevelActive = 0x0000200000000000 51 | }; 52 | 53 | inline bool operator&(UEPropertyFlags lhs, UEPropertyFlags rhs) 54 | { 55 | return (static_cast>(lhs) & static_cast>(rhs)) == static_cast>(rhs); 56 | } 57 | 58 | std::string StringifyFlags(const UEPropertyFlags flags); -------------------------------------------------------------------------------- /Engine/UE3/FunctionFlags.cpp: -------------------------------------------------------------------------------- 1 | #include "FunctionFlags.hpp" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | std::string StringifyFlags(const UEFunctionFlags flags) 8 | { 9 | std::vector buffer; 10 | 11 | if (flags & UEFunctionFlags::Final) { buffer.push_back("Final"); } 12 | if (flags & UEFunctionFlags::Defined) { buffer.push_back("Defined"); } 13 | if (flags & UEFunctionFlags::Iterator) { buffer.push_back("Iterator"); } 14 | if (flags & UEFunctionFlags::Latent) { buffer.push_back("Latent"); } 15 | if (flags & UEFunctionFlags::PreOperator) { buffer.push_back("PreOperator"); } 16 | if (flags & UEFunctionFlags::Singular) { buffer.push_back("Singular"); } 17 | if (flags & UEFunctionFlags::Net) { buffer.push_back("Net"); } 18 | if (flags & UEFunctionFlags::NetReliable) { buffer.push_back("NetReliable"); } 19 | if (flags & UEFunctionFlags::Simulated) { buffer.push_back("Simulated"); } 20 | if (flags & UEFunctionFlags::Exec) { buffer.push_back("Exec"); } 21 | if (flags & UEFunctionFlags::Native) { buffer.push_back("Native"); } 22 | if (flags & UEFunctionFlags::Event) { buffer.push_back("Event"); } 23 | if (flags & UEFunctionFlags::Operator) { buffer.push_back("Operator"); } 24 | if (flags & UEFunctionFlags::Static) { buffer.push_back("Static"); } 25 | if (flags & UEFunctionFlags::HasOptionalParms) { buffer.push_back("HasOptionalParms"); } 26 | if (flags & UEFunctionFlags::Const) { buffer.push_back("Const"); } 27 | if (flags & UEFunctionFlags::Public) { buffer.push_back("Public"); } 28 | if (flags & UEFunctionFlags::Private) { buffer.push_back("Private"); } 29 | if (flags & UEFunctionFlags::Protected) { buffer.push_back("Protected"); } 30 | if (flags & UEFunctionFlags::Delegate) { buffer.push_back("Delegate"); } 31 | if (flags & UEFunctionFlags::NetServer) { buffer.push_back("NetServer"); } 32 | if (flags & UEFunctionFlags::HasOutParms) { buffer.push_back("HasOutParms"); } 33 | if (flags & UEFunctionFlags::HasDefaults) { buffer.push_back("HasDefaults"); } 34 | if (flags & UEFunctionFlags::NetClient) { buffer.push_back("NetClient"); } 35 | if (flags & UEFunctionFlags::DLLImport) { buffer.push_back("DLLImport"); } 36 | if (flags & UEFunctionFlags::K2Call) { buffer.push_back("K2Call"); } 37 | if (flags & UEFunctionFlags::K2Override) { buffer.push_back("K2Override"); } 38 | if (flags & UEFunctionFlags::K2Pure) { buffer.push_back("K2Pure"); } 39 | 40 | switch (buffer.size()) 41 | { 42 | case 0: 43 | return std::string(); 44 | case 1: 45 | return std::string(buffer[0]); 46 | default: 47 | std::ostringstream os; 48 | std::copy(buffer.begin(), buffer.end() - 1, std::ostream_iterator(os, ", ")); 49 | os << *buffer.rbegin(); 50 | return os.str(); 51 | } 52 | } -------------------------------------------------------------------------------- /Engine/UE3/FunctionFlags.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | enum class UEFunctionFlags : uint32_t 7 | { 8 | Final = 0x00000001, 9 | Defined = 0x00000002, 10 | Iterator = 0x00000004, 11 | Latent = 0x00000008, 12 | PreOperator = 0x00000010, 13 | Singular = 0x00000020, 14 | Net = 0x00000040, 15 | NetReliable = 0x00000080, 16 | Simulated = 0x00000100, 17 | Exec = 0x00000200, 18 | Native = 0x00000400, 19 | Event = 0x00000800, 20 | Operator = 0x00001000, 21 | Static = 0x00002000, 22 | HasOptionalParms = 0x00004000, 23 | Const = 0x00008000, 24 | Public = 0x00020000, 25 | Private = 0x00040000, 26 | Protected = 0x00080000, 27 | Delegate = 0x00100000, 28 | NetServer = 0x00200000, 29 | HasOutParms = 0x00400000, 30 | HasDefaults = 0x00800000, 31 | NetClient = 0x01000000, 32 | DLLImport = 0x02000000, 33 | K2Call = 0x04000000, 34 | K2Override = 0x08000000, 35 | K2Pure = 0x10000000 36 | }; 37 | 38 | inline bool operator&(UEFunctionFlags lhs, UEFunctionFlags rhs) 39 | { 40 | return (static_cast>(lhs) & static_cast>(rhs)) == static_cast>(rhs); 41 | } 42 | 43 | std::string StringifyFlags(const UEFunctionFlags flags); 44 | -------------------------------------------------------------------------------- /Engine/UE3/GenericTypes.cpp: -------------------------------------------------------------------------------- 1 | #include "GenericTypes.hpp" 2 | 3 | void* UEObject::GetAddress() const 4 | { 5 | return object; 6 | } 7 | 8 | UEObject UEObject::GetPackageObject() const 9 | { 10 | UEObject package(nullptr); 11 | 12 | for (auto outer = GetOuter(); outer.IsValid(); outer = outer.GetOuter()) 13 | { 14 | package = outer; 15 | } 16 | 17 | return package; 18 | } 19 | 20 | std::string UEObject::GetFullName() const 21 | { 22 | if (GetClass().IsValid()) 23 | { 24 | std::string temp; 25 | 26 | for (auto outer = GetOuter(); outer.IsValid(); outer = outer.GetOuter()) 27 | { 28 | temp = outer.GetName() + "." + temp; 29 | } 30 | 31 | std::string name = GetClass().GetName(); 32 | name += " "; 33 | name += temp; 34 | name += GetName(); 35 | 36 | return name; 37 | } 38 | 39 | return std::string("(null)"); 40 | } 41 | 42 | std::string UEObject::GetNameCPP() const 43 | { 44 | std::string name; 45 | 46 | if (IsA()) 47 | { 48 | auto c = Cast(); 49 | while (c.IsValid()) 50 | { 51 | auto className = c.GetName(); 52 | if (className == "Actor") 53 | { 54 | name += "A"; 55 | break; 56 | } 57 | if (className == "Object") 58 | { 59 | name += "U"; 60 | break; 61 | } 62 | 63 | c = c.GetSuper().Cast(); 64 | } 65 | } 66 | else 67 | { 68 | name += "F"; 69 | } 70 | 71 | name += GetName(); 72 | 73 | return name; 74 | } 75 | 76 | UEProperty::Info UEProperty::GetInfo() const 77 | { 78 | if (IsValid()) 79 | { 80 | if (IsA()) 81 | { 82 | return Cast().GetInfo(); 83 | } 84 | if (IsA()) 85 | { 86 | return Cast().GetInfo(); 87 | } 88 | if (IsA()) 89 | { 90 | return Cast().GetInfo(); 91 | } 92 | if (IsA()) 93 | { 94 | return Cast().GetInfo(); 95 | } 96 | if (IsA()) 97 | { 98 | return Cast().GetInfo(); 99 | } 100 | if (IsA()) 101 | { 102 | return Cast().GetInfo(); 103 | } 104 | if (IsA()) 105 | { 106 | return Cast().GetInfo(); 107 | } 108 | if (IsA()) 109 | { 110 | return Cast().GetInfo(); 111 | } 112 | if (IsA()) 113 | { 114 | return Cast().GetInfo(); 115 | } 116 | if (IsA()) 117 | { 118 | return Cast().GetInfo(); 119 | } 120 | if (IsA()) 121 | { 122 | return Cast().GetInfo(); 123 | } 124 | if (IsA()) 125 | { 126 | return Cast().GetInfo(); 127 | } 128 | if (IsA()) 129 | { 130 | return Cast().GetInfo(); 131 | } 132 | if (IsA()) 133 | { 134 | return Cast().GetInfo(); 135 | } 136 | } 137 | return { PropertyType::Unknown }; 138 | } 139 | 140 | //--------------------------------------------------------------------------- 141 | //UEByteProperty 142 | //--------------------------------------------------------------------------- 143 | bool UEByteProperty::IsEnum() const 144 | { 145 | return GetEnum().IsValid(); 146 | } 147 | //--------------------------------------------------------------------------- 148 | //UEEnumProperty 149 | //--------------------------------------------------------------------------- 150 | UEEnum UEEnumProperty::GetEnum() const 151 | { 152 | return UEEnum(nullptr); 153 | } 154 | //--------------------------------------------------------------------------- 155 | UEClass UEEnumProperty::StaticClass() 156 | { 157 | //Unreal Engine 3 doesn't have the EnumProperty class 158 | return nullptr; 159 | } 160 | //--------------------------------------------------------------------------- 161 | //UEBoolProperty 162 | //--------------------------------------------------------------------------- 163 | int GetBitPosition(uint32_t value) 164 | { 165 | int i16 = !(value & 0xffff) << 4; 166 | value >>= i16; 167 | 168 | int i8 = !(value & 0xff) << 3; 169 | value >>= i8; 170 | 171 | int i4 = !(value & 0xf) << 2; 172 | value >>= i4; 173 | 174 | int i2 = !(value & 0x3) << 1; 175 | value >>= i2; 176 | 177 | int i1 = !(value & 0x1); 178 | 179 | int i0 = (value >> i1) & 1 ? 0 : -32; 180 | 181 | return i16 + i8 + i4 + i2 + i1 + i0; 182 | } 183 | //--------------------------------------------------------------------------- 184 | std::array UEBoolProperty::GetMissingBitsCount(const UEBoolProperty& other) const 185 | { 186 | // If there is no previous bitfield member, just calculate the missing bits. 187 | if (!other.IsValid()) 188 | { 189 | return { GetBitPosition(GetBitMask()), -1 }; 190 | } 191 | 192 | // If both bitfield member belong to the same int, calculate the bit position difference. 193 | if (GetOffset() == other.GetOffset()) 194 | { 195 | return { GetBitPosition(GetBitMask()) - GetBitPosition(other.GetBitMask()) - 1, -1 }; 196 | } 197 | 198 | // If they have different offsets, we need two distances 199 | // |0000...1000|0010...0000| 200 | // 1. ^---^ 201 | // 2. ^--^ 202 | 203 | return { std::numeric_limits::digits - GetBitPosition(other.GetBitMask()) - 1, GetBitPosition(GetBitMask()) }; 204 | } 205 | //--------------------------------------------------------------------------- -------------------------------------------------------------------------------- /Engine/UE3/GenericTypes.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "PropertyFlags.hpp" 8 | #include "FunctionFlags.hpp" 9 | #include "../IGenerator.hpp" 10 | 11 | class UObject; 12 | class UEClass; 13 | 14 | class UEObject 15 | { 16 | public: 17 | UEObject() 18 | : object(nullptr) 19 | { 20 | } 21 | UEObject(UObject *_object) 22 | : object(_object) 23 | { 24 | } 25 | 26 | bool IsValid() const 27 | { 28 | return object != nullptr; 29 | } 30 | 31 | size_t GetIndex() const; 32 | 33 | UEClass GetClass() const; 34 | 35 | UEObject GetOuter() const; 36 | 37 | std::string GetName() const; 38 | 39 | std::string GetFullName() const; 40 | 41 | std::string GetNameCPP() const; 42 | 43 | UEObject GetPackageObject() const; 44 | 45 | void* GetAddress() const; 46 | 47 | template 48 | Base Cast() const 49 | { 50 | return Base(object); 51 | } 52 | 53 | template 54 | bool IsA() const; 55 | 56 | static UEClass StaticClass(); 57 | 58 | protected: 59 | UObject* object; 60 | }; 61 | 62 | namespace std 63 | { 64 | template<> 65 | struct hash 66 | { 67 | size_t operator()(const UEObject& obj) const 68 | { 69 | return std::hash()(obj.GetAddress()); 70 | } 71 | }; 72 | } 73 | 74 | inline bool operator==(const UEObject& lhs, const UEObject& rhs) { return rhs.GetAddress() == lhs.GetAddress(); } 75 | inline bool operator!=(const UEObject& lhs, const UEObject& rhs) { return !(lhs == rhs); } 76 | 77 | class UEField : public UEObject 78 | { 79 | public: 80 | using UEObject::UEObject; 81 | 82 | UEField GetNext() const; 83 | 84 | static UEClass StaticClass(); 85 | }; 86 | 87 | class UEEnum : public UEField 88 | { 89 | public: 90 | using UEField::UEField; 91 | 92 | std::vector GetNames() const; 93 | 94 | static UEClass StaticClass(); 95 | }; 96 | 97 | class UEConst : public UEField 98 | { 99 | public: 100 | using UEField::UEField; 101 | 102 | std::string GetValue() const; 103 | 104 | static UEClass StaticClass(); 105 | }; 106 | 107 | class UEStruct : public UEField 108 | { 109 | public: 110 | using UEField::UEField; 111 | 112 | UEStruct GetSuper() const; 113 | 114 | UEField GetChildren() const; 115 | 116 | size_t GetPropertySize() const; 117 | 118 | static UEClass StaticClass(); 119 | }; 120 | 121 | class UEScriptStruct : public UEStruct 122 | { 123 | public: 124 | using UEStruct::UEStruct; 125 | 126 | static UEClass StaticClass(); 127 | }; 128 | 129 | class UEFunction : public UEStruct 130 | { 131 | public: 132 | using UEStruct::UEStruct; 133 | 134 | UEFunctionFlags GetFunctionFlags() const; 135 | 136 | static UEClass StaticClass(); 137 | }; 138 | 139 | class UEState : public UEStruct 140 | { 141 | public: 142 | using UEStruct::UEStruct; 143 | 144 | static UEClass StaticClass(); 145 | }; 146 | 147 | class UEClass : public UEState 148 | { 149 | public: 150 | using UEState::UEState; 151 | 152 | static UEClass StaticClass(); 153 | }; 154 | 155 | class UEProperty : public UEField 156 | { 157 | public: 158 | using UEField::UEField; 159 | 160 | size_t GetArrayDim() const; 161 | 162 | size_t GetElementSize() const; 163 | 164 | UEPropertyFlags GetPropertyFlags() const; 165 | 166 | size_t GetOffset() const; 167 | 168 | enum class PropertyType 169 | { 170 | Unknown, 171 | Primitive, 172 | PredefinedStruct, 173 | CustomStruct, 174 | Container 175 | }; 176 | 177 | struct Info 178 | { 179 | PropertyType Type; 180 | size_t Size; 181 | bool CanBeReference; 182 | std::string CppType; 183 | 184 | static Info Create(PropertyType type, size_t size, bool reference, std::string&& cppType) 185 | { 186 | extern IGenerator* generator; 187 | 188 | return { type, size, reference, generator->GetOverrideType(cppType) }; 189 | } 190 | }; 191 | 192 | Info GetInfo() const; 193 | 194 | static UEClass StaticClass(); 195 | }; 196 | 197 | class UEByteProperty : public UEProperty 198 | { 199 | public: 200 | using UEProperty::UEProperty; 201 | 202 | bool IsEnum() const; 203 | 204 | UEEnum GetEnum() const; 205 | 206 | UEProperty::Info GetInfo() const; 207 | 208 | static UEClass StaticClass(); 209 | }; 210 | 211 | class UEIntProperty : public UEProperty 212 | { 213 | public: 214 | using UEProperty::UEProperty; 215 | 216 | UEProperty::Info GetInfo() const; 217 | 218 | static UEClass StaticClass(); 219 | }; 220 | 221 | class UEFloatProperty : public UEProperty 222 | { 223 | public: 224 | using UEProperty::UEProperty; 225 | 226 | UEProperty::Info GetInfo() const; 227 | 228 | static UEClass StaticClass(); 229 | }; 230 | 231 | class UEBoolProperty : public UEProperty 232 | { 233 | public: 234 | using UEProperty::UEProperty; 235 | 236 | bool IsNativeBool() const { return false; } 237 | 238 | bool IsBitfield() const { return !IsNativeBool(); } 239 | 240 | size_t GetBitMask() const; 241 | 242 | std::array GetMissingBitsCount(const UEBoolProperty& other) const; 243 | 244 | UEProperty::Info GetInfo() const; 245 | 246 | static UEClass StaticClass(); 247 | }; 248 | 249 | inline bool operator<(const UEBoolProperty& lhs, const UEBoolProperty& rhs) 250 | { 251 | return lhs.GetBitMask() < rhs.GetBitMask(); 252 | } 253 | 254 | class UEObjectProperty : public UEProperty 255 | { 256 | public: 257 | using UEProperty::UEProperty; 258 | 259 | UEClass GetPropertyClass() const; 260 | 261 | UEProperty::Info GetInfo() const; 262 | 263 | static UEClass StaticClass(); 264 | }; 265 | 266 | class UEComponentProperty : public UEObjectProperty 267 | { 268 | public: 269 | using UEObjectProperty::UEObjectProperty; 270 | 271 | UEProperty::Info GetInfo() const; 272 | 273 | static UEClass StaticClass(); 274 | }; 275 | 276 | class UEClassProperty : public UEObjectProperty 277 | { 278 | public: 279 | using UEObjectProperty::UEObjectProperty; 280 | 281 | UEClass GetMetaClass() const; 282 | 283 | UEProperty::Info GetInfo() const; 284 | 285 | static UEClass StaticClass(); 286 | }; 287 | 288 | class UEInterfaceProperty : public UEProperty 289 | { 290 | public: 291 | using UEProperty::UEProperty; 292 | 293 | UEClass GetInterfaceClass() const; 294 | 295 | UEProperty::Info GetInfo() const; 296 | 297 | static UEClass StaticClass(); 298 | }; 299 | 300 | class UENameProperty : public UEProperty 301 | { 302 | public: 303 | using UEProperty::UEProperty; 304 | 305 | UEProperty::Info GetInfo() const; 306 | 307 | static UEClass StaticClass(); 308 | }; 309 | 310 | class UEStructProperty : public UEProperty 311 | { 312 | public: 313 | using UEProperty::UEProperty; 314 | 315 | UEScriptStruct GetStruct() const; 316 | 317 | UEProperty::Info GetInfo() const; 318 | 319 | static UEClass StaticClass(); 320 | }; 321 | 322 | class UEStrProperty : public UEProperty 323 | { 324 | public: 325 | using UEProperty::UEProperty; 326 | 327 | UEProperty::Info GetInfo() const; 328 | 329 | static UEClass StaticClass(); 330 | }; 331 | 332 | class UEArrayProperty : public UEProperty 333 | { 334 | public: 335 | using UEProperty::UEProperty; 336 | 337 | UEProperty GetInner() const; 338 | 339 | UEProperty::Info GetInfo() const; 340 | 341 | static UEClass StaticClass(); 342 | }; 343 | 344 | class UEMapProperty : public UEProperty 345 | { 346 | public: 347 | using UEProperty::UEProperty; 348 | 349 | UEProperty GetKeyProperty() const; 350 | UEProperty GetValueProperty() const; 351 | 352 | UEProperty::Info GetInfo() const; 353 | 354 | static UEClass StaticClass(); 355 | }; 356 | 357 | class UEDelegateProperty : public UEProperty 358 | { 359 | public: 360 | using UEProperty::UEProperty; 361 | 362 | UEFunction GetSignatureFunction() const; 363 | 364 | UEProperty::Info GetInfo() const; 365 | 366 | static UEClass StaticClass(); 367 | }; 368 | 369 | class UEEnumProperty : public UEProperty 370 | { 371 | public: 372 | using UEProperty::UEProperty; 373 | 374 | UEEnum GetEnum() const; 375 | 376 | static UEClass StaticClass(); 377 | }; 378 | 379 | template 380 | bool UEObject::IsA() const 381 | { 382 | auto cmp = T::StaticClass(); 383 | if (!cmp.IsValid()) 384 | { 385 | return false; 386 | } 387 | 388 | for (auto super = GetClass(); super.IsValid(); super = super.GetSuper().Cast()) 389 | { 390 | if (super.object == cmp.object) 391 | { 392 | return true; 393 | } 394 | } 395 | 396 | return false; 397 | } 398 | 399 | template<> 400 | inline bool UEObject::IsA() const 401 | { 402 | //UE3 doesn't have an EnumProperty. 403 | 404 | return false; 405 | } -------------------------------------------------------------------------------- /Engine/UE3/Package.cpp: -------------------------------------------------------------------------------- 1 | #include "../Package.hpp" 2 | 3 | bool Package::Method::Parameter::MakeType(UEPropertyFlags flags, Type& type) 4 | { 5 | if (flags & UEPropertyFlags::ReturnParm) 6 | { 7 | type = Type::Return; 8 | } 9 | else if (flags & UEPropertyFlags::OutParm) 10 | { 11 | type = Type::Out; 12 | } 13 | else if (flags & UEPropertyFlags::Parm) 14 | { 15 | type = Type::Default; 16 | } 17 | else 18 | { 19 | return false; 20 | } 21 | 22 | return true; 23 | } -------------------------------------------------------------------------------- /Engine/UE3/PropertyFlags.cpp: -------------------------------------------------------------------------------- 1 | #include "PropertyFlags.hpp" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | std::string StringifyFlags(const UEPropertyFlags flags) 8 | { 9 | std::vector buffer; 10 | 11 | if (flags & UEPropertyFlags::Edit) { buffer.push_back("Edit"); } 12 | if (flags & UEPropertyFlags::Const) { buffer.push_back("Const"); } 13 | if (flags & UEPropertyFlags::Input) { buffer.push_back("Input"); } 14 | if (flags & UEPropertyFlags::ExportObject) { buffer.push_back("ExportObject"); } 15 | if (flags & UEPropertyFlags::OptionalParm) { buffer.push_back("OptionalParm"); } 16 | if (flags & UEPropertyFlags::Net) { buffer.push_back("Net"); } 17 | if (flags & UEPropertyFlags::EditFixedSize) { buffer.push_back("EditFixedSize"); } 18 | if (flags & UEPropertyFlags::Parm) { buffer.push_back("Parm"); } 19 | if (flags & UEPropertyFlags::OutParm) { buffer.push_back("OutParm"); } 20 | if (flags & UEPropertyFlags::SkipParm) { buffer.push_back("SkipParm"); } 21 | if (flags & UEPropertyFlags::ReturnParm) { buffer.push_back("ReturnParm"); } 22 | if (flags & UEPropertyFlags::CoerceParm) { buffer.push_back("CoerceParm"); } 23 | if (flags & UEPropertyFlags::Native) { buffer.push_back("Native"); } 24 | if (flags & UEPropertyFlags::Transient) { buffer.push_back("Transient"); } 25 | if (flags & UEPropertyFlags::Config) { buffer.push_back("Config"); } 26 | if (flags & UEPropertyFlags::Localized) { buffer.push_back("Localized"); } 27 | if (flags & UEPropertyFlags::EditConst) { buffer.push_back("EditConst"); } 28 | if (flags & UEPropertyFlags::GlobalConfig) { buffer.push_back("GlobalConfig"); } 29 | if (flags & UEPropertyFlags::Component) { buffer.push_back("Component"); } 30 | if (flags & UEPropertyFlags::AlwaysInit) { buffer.push_back("AlwaysInit"); } 31 | if (flags & UEPropertyFlags::DuplicateTransient) { buffer.push_back("DuplicateTransient"); } 32 | if (flags & UEPropertyFlags::NeedCtorLink) { buffer.push_back("NeedCtorLink"); } 33 | if (flags & UEPropertyFlags::NoExport) { buffer.push_back("NoExport"); } 34 | if (flags & UEPropertyFlags::NoImport) { buffer.push_back("NoImport"); } 35 | if (flags & UEPropertyFlags::NoClear) { buffer.push_back("NoClear"); } 36 | if (flags & UEPropertyFlags::EditInline) { buffer.push_back("EditInline"); } 37 | if (flags & UEPropertyFlags::EditInlineUse) { buffer.push_back("EditInlineUse"); } 38 | if (flags & UEPropertyFlags::Deprecated) { buffer.push_back("Deprecated"); } 39 | if (flags & UEPropertyFlags::DataBinding) { buffer.push_back("DataBinding"); } 40 | if (flags & UEPropertyFlags::SerializeText) { buffer.push_back("SerializeText"); } 41 | if (flags & UEPropertyFlags::RepNotify) { buffer.push_back("RepNotify"); } 42 | if (flags & UEPropertyFlags::Interp) { buffer.push_back("Interp"); } 43 | if (flags & UEPropertyFlags::NonTransactional) { buffer.push_back("NonTransactional"); } 44 | if (flags & UEPropertyFlags::EditorOnly) { buffer.push_back("EditorOnly"); } 45 | if (flags & UEPropertyFlags::NotForConsole) { buffer.push_back("NotForConsole"); } 46 | if (flags & UEPropertyFlags::RepRetry) { buffer.push_back("RepRetry"); } 47 | if (flags & UEPropertyFlags::PrivateWrite) { buffer.push_back("PrivateWrite"); } 48 | if (flags & UEPropertyFlags::ProtectedWrite) { buffer.push_back("ProtectedWrite"); } 49 | if (flags & UEPropertyFlags::ArchetypeProperty) { buffer.push_back("ArchetypeProperty"); } 50 | if (flags & UEPropertyFlags::EditHide) { buffer.push_back("EditHide"); } 51 | if (flags & UEPropertyFlags::EditTextBox) { buffer.push_back("EditTextBox"); } 52 | if (flags & UEPropertyFlags::CrossLevelPassive) { buffer.push_back("CrossLevelPassive"); } 53 | if (flags & UEPropertyFlags::CrossLevelActive) { buffer.push_back("CrossLevelActive"); } 54 | 55 | switch (buffer.size()) 56 | { 57 | case 0: 58 | return std::string(); 59 | case 1: 60 | return std::string(buffer[0]); 61 | default: 62 | std::ostringstream os; 63 | std::copy(buffer.begin(), buffer.end() - 1, std::ostream_iterator(os, ", ")); 64 | os << *buffer.rbegin(); 65 | return os.str(); 66 | } 67 | } -------------------------------------------------------------------------------- /Engine/UE3/PropertyFlags.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | enum class UEPropertyFlags : uint64_t 7 | { 8 | Edit = 0x0000000000000001, 9 | Const = 0x0000000000000002, 10 | Input = 0x0000000000000004, 11 | ExportObject = 0x0000000000000008, 12 | OptionalParm = 0x0000000000000010, 13 | Net = 0x0000000000000020, 14 | EditFixedSize = 0x0000000000000040, 15 | Parm = 0x0000000000000080, 16 | OutParm = 0x0000000000000100, 17 | SkipParm = 0x0000000000000200, 18 | ReturnParm = 0x0000000000000400, 19 | CoerceParm = 0x0000000000000800, 20 | Native = 0x0000000000001000, 21 | Transient = 0x0000000000002000, 22 | Config = 0x0000000000004000, 23 | Localized = 0x0000000000008000, 24 | EditConst = 0x0000000000020000, 25 | GlobalConfig = 0x0000000000040000, 26 | Component = 0x0000000000080000, 27 | AlwaysInit = 0x0000000000100000, 28 | DuplicateTransient = 0x0000000000200000, 29 | NeedCtorLink = 0x0000000000400000, 30 | NoExport = 0x0000000000800000, 31 | NoImport = 0x0000000001000000, 32 | NoClear = 0x0000000002000000, 33 | EditInline = 0x0000000004000000, 34 | EditInlineUse = 0x0000000010000000, 35 | Deprecated = 0x0000000020000000, 36 | DataBinding = 0x0000000040000000, 37 | SerializeText = 0x0000000080000000, 38 | RepNotify = 0x0000000100000000, 39 | Interp = 0x0000000200000000, 40 | NonTransactional = 0x0000000400000000, 41 | EditorOnly = 0x0000000800000000, 42 | NotForConsole = 0x0000001000000000, 43 | RepRetry = 0x0000002000000000, 44 | PrivateWrite = 0x0000004000000000, 45 | ProtectedWrite = 0x0000008000000000, 46 | ArchetypeProperty = 0x0000010000000000, 47 | EditHide = 0x0000020000000000, 48 | EditTextBox = 0x0000040000000000, 49 | CrossLevelPassive = 0x0000100000000000, 50 | CrossLevelActive = 0x0000200000000000 51 | }; 52 | 53 | inline bool operator&(UEPropertyFlags lhs, UEPropertyFlags rhs) 54 | { 55 | return (static_cast>(lhs) & static_cast>(rhs)) == static_cast>(rhs); 56 | } 57 | 58 | std::string StringifyFlags(const UEPropertyFlags flags); -------------------------------------------------------------------------------- /Engine/UE4/FunctionFlags.cpp: -------------------------------------------------------------------------------- 1 | #include "FunctionFlags.hpp" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | std::string StringifyFlags(const UEFunctionFlags flags) 8 | { 9 | std::vector buffer; 10 | 11 | if (flags & UEFunctionFlags::Final) { buffer.push_back("Final"); } 12 | if (flags & UEFunctionFlags::RequiredAPI) { buffer.push_back("RequiredAPI"); } 13 | if (flags & UEFunctionFlags::BlueprintAuthorityOnly) { buffer.push_back("BlueprintAuthorityOnly"); } 14 | if (flags & UEFunctionFlags::BlueprintCosmetic) { buffer.push_back("BlueprintCosmetic"); } 15 | if (flags & UEFunctionFlags::Net) { buffer.push_back("Net"); } 16 | if (flags & UEFunctionFlags::NetReliable) { buffer.push_back("NetReliable"); } 17 | if (flags & UEFunctionFlags::NetRequest) { buffer.push_back("NetRequest"); } 18 | if (flags & UEFunctionFlags::Exec) { buffer.push_back("Exec"); } 19 | if (flags & UEFunctionFlags::Native) { buffer.push_back("Native"); } 20 | if (flags & UEFunctionFlags::Event) { buffer.push_back("Event"); } 21 | if (flags & UEFunctionFlags::NetResponse) { buffer.push_back("NetResponse"); } 22 | if (flags & UEFunctionFlags::Static) { buffer.push_back("Static"); } 23 | if (flags & UEFunctionFlags::NetMulticast) { buffer.push_back("NetMulticast"); } 24 | if (flags & UEFunctionFlags::MulticastDelegate) { buffer.push_back("MulticastDelegate"); } 25 | if (flags & UEFunctionFlags::Public) { buffer.push_back("Public"); } 26 | if (flags & UEFunctionFlags::Private) { buffer.push_back("Private"); } 27 | if (flags & UEFunctionFlags::Protected) { buffer.push_back("Protected"); } 28 | if (flags & UEFunctionFlags::Delegate) { buffer.push_back("Delegate"); } 29 | if (flags & UEFunctionFlags::NetServer) { buffer.push_back("NetServer"); } 30 | if (flags & UEFunctionFlags::HasOutParms) { buffer.push_back("HasOutParms"); } 31 | if (flags & UEFunctionFlags::HasDefaults) { buffer.push_back("HasDefaults"); } 32 | if (flags & UEFunctionFlags::NetClient) { buffer.push_back("NetClient"); } 33 | if (flags & UEFunctionFlags::DLLImport) { buffer.push_back("DLLImport"); } 34 | if (flags & UEFunctionFlags::BlueprintCallable) { buffer.push_back("BlueprintCallable"); } 35 | if (flags & UEFunctionFlags::BlueprintEvent) { buffer.push_back("BlueprintEvent"); } 36 | if (flags & UEFunctionFlags::BlueprintPure) { buffer.push_back("BlueprintPure"); } 37 | if (flags & UEFunctionFlags::Const) { buffer.push_back("Const"); } 38 | if (flags & UEFunctionFlags::NetValidate) { buffer.push_back("NetValidate"); } 39 | 40 | switch (buffer.size()) 41 | { 42 | case 0: 43 | return std::string(); 44 | case 1: 45 | return std::string(buffer[0]); 46 | default: 47 | std::ostringstream os; 48 | std::copy(buffer.begin(), buffer.end() - 1, std::ostream_iterator(os, ", ")); 49 | os << *buffer.rbegin(); 50 | return os.str(); 51 | } 52 | } -------------------------------------------------------------------------------- /Engine/UE4/FunctionFlags.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | enum class UEFunctionFlags : uint32_t 7 | { 8 | Final = 0x00000001, 9 | RequiredAPI = 0x00000002, 10 | BlueprintAuthorityOnly = 0x00000004, 11 | BlueprintCosmetic = 0x00000008, 12 | Net = 0x00000040, 13 | NetReliable = 0x00000080, 14 | NetRequest = 0x00000100, 15 | Exec = 0x00000200, 16 | Native = 0x00000400, 17 | Event = 0x00000800, 18 | NetResponse = 0x00001000, 19 | Static = 0x00002000, 20 | NetMulticast = 0x00004000, 21 | MulticastDelegate = 0x00010000, 22 | Public = 0x00020000, 23 | Private = 0x00040000, 24 | Protected = 0x00080000, 25 | Delegate = 0x00100000, 26 | NetServer = 0x00200000, 27 | HasOutParms = 0x00400000, 28 | HasDefaults = 0x00800000, 29 | NetClient = 0x01000000, 30 | DLLImport = 0x02000000, 31 | BlueprintCallable = 0x04000000, 32 | BlueprintEvent = 0x08000000, 33 | BlueprintPure = 0x10000000, 34 | Const = 0x40000000, 35 | NetValidate = 0x80000000 36 | }; 37 | 38 | inline bool operator&(UEFunctionFlags lhs, UEFunctionFlags rhs) 39 | { 40 | return (static_cast>(lhs) & static_cast>(rhs)) == static_cast>(rhs); 41 | } 42 | 43 | std::string StringifyFlags(const UEFunctionFlags flags); 44 | -------------------------------------------------------------------------------- /Engine/UE4/GenericTypes.cpp: -------------------------------------------------------------------------------- 1 | #include "GenericTypes.hpp" 2 | 3 | void* UEObject::GetAddress() const 4 | { 5 | return object; 6 | } 7 | 8 | UEObject UEObject::GetPackageObject() const 9 | { 10 | UEObject package(nullptr); 11 | 12 | for (auto outer = GetOuter(); outer.IsValid(); outer = outer.GetOuter()) 13 | { 14 | package = outer; 15 | } 16 | 17 | return package; 18 | } 19 | 20 | std::string UEObject::GetFullName() const 21 | { 22 | if (GetClass().IsValid()) 23 | { 24 | std::string temp; 25 | 26 | for (auto outer = GetOuter(); outer.IsValid(); outer = outer.GetOuter()) 27 | { 28 | temp = outer.GetName() + "." + temp; 29 | } 30 | 31 | std::string name = GetClass().GetName(); 32 | name += " "; 33 | name += temp; 34 | name += GetName(); 35 | 36 | return name; 37 | } 38 | 39 | return std::string("(null)"); 40 | } 41 | 42 | std::string UEObject::GetNameCPP() const 43 | { 44 | std::string name; 45 | 46 | if (IsA()) 47 | { 48 | auto c = Cast(); 49 | while (c.IsValid()) 50 | { 51 | const auto className = c.GetName(); 52 | if (className == "Actor") 53 | { 54 | name += "A"; 55 | break; 56 | } 57 | if (className == "Object") 58 | { 59 | name += "U"; 60 | break; 61 | } 62 | 63 | c = c.GetSuper().Cast(); 64 | } 65 | } 66 | else 67 | { 68 | name += "F"; 69 | } 70 | 71 | name += GetName(); 72 | 73 | return name; 74 | } 75 | 76 | UEProperty::Info UEProperty::GetInfo() const 77 | { 78 | if (IsValid()) 79 | { 80 | if (IsA()) 81 | { 82 | return Cast().GetInfo(); 83 | } 84 | if (IsA()) 85 | { 86 | return Cast().GetInfo(); 87 | } 88 | if (IsA()) 89 | { 90 | return Cast().GetInfo(); 91 | } 92 | if (IsA()) 93 | { 94 | return Cast().GetInfo(); 95 | } 96 | if (IsA()) 97 | { 98 | return Cast().GetInfo(); 99 | } 100 | if (IsA()) 101 | { 102 | return Cast().GetInfo(); 103 | } 104 | if (IsA()) 105 | { 106 | return Cast().GetInfo(); 107 | } 108 | if (IsA()) 109 | { 110 | return Cast().GetInfo(); 111 | } 112 | if (IsA()) 113 | { 114 | return Cast().GetInfo(); 115 | } 116 | if (IsA()) 117 | { 118 | return Cast().GetInfo(); 119 | } 120 | if (IsA()) 121 | { 122 | return Cast().GetInfo(); 123 | } 124 | if (IsA()) 125 | { 126 | return Cast().GetInfo(); 127 | } 128 | if (IsA()) 129 | { 130 | return Cast().GetInfo(); 131 | } 132 | if (IsA()) 133 | { 134 | return Cast().GetInfo(); 135 | } 136 | if (IsA()) 137 | { 138 | return Cast().GetInfo(); 139 | } 140 | if (IsA()) 141 | { 142 | return Cast().GetInfo(); 143 | } 144 | if (IsA()) 145 | { 146 | return Cast().GetInfo(); 147 | } 148 | if (IsA()) 149 | { 150 | return Cast().GetInfo(); 151 | } 152 | if (IsA()) 153 | { 154 | return Cast().GetInfo(); 155 | } 156 | if (IsA()) 157 | { 158 | return Cast().GetInfo(); 159 | } 160 | if (IsA()) 161 | { 162 | return Cast().GetInfo(); 163 | } 164 | if (IsA()) 165 | { 166 | return Cast().GetInfo(); 167 | } 168 | if (IsA()) 169 | { 170 | return Cast().GetInfo(); 171 | } 172 | if (IsA()) 173 | { 174 | return Cast().GetInfo(); 175 | } 176 | if (IsA()) 177 | { 178 | return Cast().GetInfo(); 179 | } 180 | if (IsA()) 181 | { 182 | return Cast().GetInfo(); 183 | } 184 | if (IsA()) 185 | { 186 | return Cast().GetInfo(); 187 | } 188 | if (IsA()) 189 | { 190 | return Cast().GetInfo(); 191 | } 192 | } 193 | return { PropertyType::Unknown }; 194 | } 195 | 196 | //--------------------------------------------------------------------------- 197 | //UEByteProperty 198 | //--------------------------------------------------------------------------- 199 | bool UEByteProperty::IsEnum() const 200 | { 201 | return GetEnum().IsValid(); 202 | } 203 | //--------------------------------------------------------------------------- 204 | //UEBoolProperty 205 | //--------------------------------------------------------------------------- 206 | 207 | int GetBitPosition(uint8_t value) 208 | { 209 | int i4 = !(value & 0xf) << 2; 210 | value >>= i4; 211 | 212 | int i2 = !(value & 0x3) << 1; 213 | value >>= i2; 214 | 215 | int i1 = !(value & 0x1); 216 | 217 | int i0 = (value >> i1) & 1 ? 0 : -8; 218 | 219 | return i4 + i2 + i1 + i0; 220 | } 221 | 222 | std::array UEBoolProperty::GetMissingBitsCount(const UEBoolProperty& other) const 223 | { 224 | // If there is no previous bitfield member, just calculate the missing bits. 225 | if (!other.IsValid()) 226 | { 227 | return { GetBitPosition(GetByteMask()), -1 }; 228 | } 229 | 230 | // If both bitfield member belong to the same byte, calculate the bit position difference. 231 | if (GetOffset() == other.GetOffset()) 232 | { 233 | return { GetBitPosition(GetByteMask()) - GetBitPosition(other.GetByteMask()) - 1, -1 }; 234 | } 235 | 236 | // If they have different offsets, we need two distances 237 | // |00001000|00100000| 238 | // 1. ^---^ 239 | // 2. ^--^ 240 | 241 | return { std::numeric_limits::digits - GetBitPosition(other.GetByteMask()) - 1, GetBitPosition(GetByteMask()) }; 242 | } -------------------------------------------------------------------------------- /Engine/UE4/Package.cpp: -------------------------------------------------------------------------------- 1 | #include "../Package.hpp" 2 | 3 | bool Package::Method::Parameter::MakeType(UEPropertyFlags flags, Type& type) 4 | { 5 | if (flags & UEPropertyFlags::ReturnParm) 6 | { 7 | type = Type::Return; 8 | } 9 | else if (flags & UEPropertyFlags::OutParm) 10 | { 11 | //if it is a const parameter make it a default parameter 12 | if (flags & UEPropertyFlags::ConstParm) 13 | { 14 | type = Type::Default; 15 | } 16 | else 17 | { 18 | type = Type::Out; 19 | } 20 | } 21 | else if (flags & UEPropertyFlags::Parm) 22 | { 23 | type = Type::Default; 24 | } 25 | else 26 | { 27 | return false; 28 | } 29 | 30 | return true; 31 | } -------------------------------------------------------------------------------- /Engine/UE4/PropertyFlags.cpp: -------------------------------------------------------------------------------- 1 | #include "PropertyFlags.hpp" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | std::string StringifyFlags(const UEPropertyFlags flags) 8 | { 9 | std::vector buffer; 10 | 11 | if (flags & UEPropertyFlags::Edit) { buffer.push_back("Edit"); } 12 | if (flags & UEPropertyFlags::ConstParm) { buffer.push_back("ConstParm"); } 13 | if (flags & UEPropertyFlags::BlueprintVisible) { buffer.push_back("BlueprintVisible"); } 14 | if (flags & UEPropertyFlags::ExportObject) { buffer.push_back("ExportObject"); } 15 | if (flags & UEPropertyFlags::BlueprintReadOnly) { buffer.push_back("BlueprintReadOnly"); } 16 | if (flags & UEPropertyFlags::Net) { buffer.push_back("Net"); } 17 | if (flags & UEPropertyFlags::EditFixedSize) { buffer.push_back("EditFixedSize"); } 18 | if (flags & UEPropertyFlags::Parm) { buffer.push_back("Parm"); } 19 | if (flags & UEPropertyFlags::OutParm) { buffer.push_back("OutParm"); } 20 | if (flags & UEPropertyFlags::ZeroConstructor) { buffer.push_back("ZeroConstructor"); } 21 | if (flags & UEPropertyFlags::ReturnParm) { buffer.push_back("ReturnParm"); } 22 | if (flags & UEPropertyFlags::DisableEditOnTemplate) { buffer.push_back("DisableEditOnTemplate"); } 23 | if (flags & UEPropertyFlags::Transient) { buffer.push_back("Transient"); } 24 | if (flags & UEPropertyFlags::Config) { buffer.push_back("Config"); } 25 | if (flags & UEPropertyFlags::DisableEditOnInstance) { buffer.push_back("DisableEditOnInstance"); } 26 | if (flags & UEPropertyFlags::EditConst) { buffer.push_back("EditConst"); } 27 | if (flags & UEPropertyFlags::GlobalConfig) { buffer.push_back("GlobalConfig"); } 28 | if (flags & UEPropertyFlags::InstancedReference) { buffer.push_back("InstancedReference"); } 29 | if (flags & UEPropertyFlags::DuplicateTransient) { buffer.push_back("DuplicateTransient"); } 30 | if (flags & UEPropertyFlags::SubobjectReference) { buffer.push_back("SubobjectReference"); } 31 | if (flags & UEPropertyFlags::SaveGame) { buffer.push_back("SaveGame"); } 32 | if (flags & UEPropertyFlags::NoClear) { buffer.push_back("NoClear"); } 33 | if (flags & UEPropertyFlags::ReferenceParm) { buffer.push_back("ReferenceParm"); } 34 | if (flags & UEPropertyFlags::BlueprintAssignable) { buffer.push_back("BlueprintAssignable"); } 35 | if (flags & UEPropertyFlags::Deprecated) { buffer.push_back("Deprecated"); } 36 | if (flags & UEPropertyFlags::IsPlainOldData) { buffer.push_back("IsPlainOldData"); } 37 | if (flags & UEPropertyFlags::RepSkip) { buffer.push_back("RepSkip"); } 38 | if (flags & UEPropertyFlags::RepNotify) { buffer.push_back("RepNotify"); } 39 | if (flags & UEPropertyFlags::Interp) { buffer.push_back("Interp"); } 40 | if (flags & UEPropertyFlags::NonTransactional) { buffer.push_back("NonTransactional"); } 41 | if (flags & UEPropertyFlags::EditorOnly) { buffer.push_back("EditorOnly"); } 42 | if (flags & UEPropertyFlags::NoDestructor) { buffer.push_back("NoDestructor"); } 43 | if (flags & UEPropertyFlags::AutoWeak) { buffer.push_back("AutoWeak"); } 44 | if (flags & UEPropertyFlags::ContainsInstancedReference) { buffer.push_back("ContainsInstancedReference"); } 45 | if (flags & UEPropertyFlags::AssetRegistrySearchable) { buffer.push_back("AssetRegistrySearchable"); } 46 | if (flags & UEPropertyFlags::SimpleDisplay) { buffer.push_back("SimpleDisplay"); } 47 | if (flags & UEPropertyFlags::AdvancedDisplay) { buffer.push_back("AdvancedDisplay"); } 48 | if (flags & UEPropertyFlags::Protected) { buffer.push_back("Protected"); } 49 | if (flags & UEPropertyFlags::BlueprintCallable) { buffer.push_back("BlueprintCallable"); } 50 | if (flags & UEPropertyFlags::BlueprintAuthorityOnly) { buffer.push_back("BlueprintAuthorityOnly"); } 51 | if (flags & UEPropertyFlags::TextExportTransient) { buffer.push_back("TextExportTransient"); } 52 | if (flags & UEPropertyFlags::NonPIEDuplicateTransient) { buffer.push_back("NonPIEDuplicateTransient"); } 53 | if (flags & UEPropertyFlags::ExposeOnSpawn) { buffer.push_back("ExposeOnSpawn"); } 54 | if (flags & UEPropertyFlags::PersistentInstance) { buffer.push_back("PersistentInstance"); } 55 | if (flags & UEPropertyFlags::UObjectWrapper) { buffer.push_back("UObjectWrapper"); } 56 | if (flags & UEPropertyFlags::HasGetValueTypeHash) { buffer.push_back("HasGetValueTypeHash"); } 57 | if (flags & UEPropertyFlags::NativeAccessSpecifierPublic) { buffer.push_back("NativeAccessSpecifierPublic"); } 58 | if (flags & UEPropertyFlags::NativeAccessSpecifierProtected) { buffer.push_back("NativeAccessSpecifierProtected"); } 59 | if (flags & UEPropertyFlags::NativeAccessSpecifierPrivate) { buffer.push_back("NativeAccessSpecifierPrivate"); } 60 | 61 | switch (buffer.size()) 62 | { 63 | case 0: 64 | return std::string(); 65 | case 1: 66 | return std::string(buffer[0]); 67 | default: 68 | std::ostringstream os; 69 | std::copy(buffer.begin(), buffer.end() - 1, std::ostream_iterator(os, ", ")); 70 | os << *buffer.rbegin(); 71 | return os.str(); 72 | } 73 | } -------------------------------------------------------------------------------- /Engine/UE4/PropertyFlags.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | enum class UEPropertyFlags : uint64_t 7 | { 8 | Edit = 0x0000000000000001, 9 | ConstParm = 0x0000000000000002, 10 | BlueprintVisible = 0x0000000000000004, 11 | ExportObject = 0x0000000000000008, 12 | BlueprintReadOnly = 0x0000000000000010, 13 | Net = 0x0000000000000020, 14 | EditFixedSize = 0x0000000000000040, 15 | Parm = 0x0000000000000080, 16 | OutParm = 0x0000000000000100, 17 | ZeroConstructor = 0x0000000000000200, 18 | ReturnParm = 0x0000000000000400, 19 | DisableEditOnTemplate = 0x0000000000000800, 20 | Transient = 0x0000000000002000, 21 | Config = 0x0000000000004000, 22 | DisableEditOnInstance = 0x0000000000010000, 23 | EditConst = 0x0000000000020000, 24 | GlobalConfig = 0x0000000000040000, 25 | InstancedReference = 0x0000000000080000, 26 | DuplicateTransient = 0x0000000000200000, 27 | SubobjectReference = 0x0000000000400000, 28 | SaveGame = 0x0000000001000000, 29 | NoClear = 0x0000000002000000, 30 | ReferenceParm = 0x0000000008000000, 31 | BlueprintAssignable = 0x0000000010000000, 32 | Deprecated = 0x0000000020000000, 33 | IsPlainOldData = 0x0000000040000000, 34 | RepSkip = 0x0000000080000000, 35 | RepNotify = 0x0000000100000000, 36 | Interp = 0x0000000200000000, 37 | NonTransactional = 0x0000000400000000, 38 | EditorOnly = 0x0000000800000000, 39 | NoDestructor = 0x0000001000000000, 40 | AutoWeak = 0x0000004000000000, 41 | ContainsInstancedReference = 0x0000008000000000, 42 | AssetRegistrySearchable = 0x0000010000000000, 43 | SimpleDisplay = 0x0000020000000000, 44 | AdvancedDisplay = 0x0000040000000000, 45 | Protected = 0x0000080000000000, 46 | BlueprintCallable = 0x0000100000000000, 47 | BlueprintAuthorityOnly = 0x0000200000000000, 48 | TextExportTransient = 0x0000400000000000, 49 | NonPIEDuplicateTransient = 0x0000800000000000, 50 | ExposeOnSpawn = 0x0001000000000000, 51 | PersistentInstance = 0x0002000000000000, 52 | UObjectWrapper = 0x0004000000000000, 53 | HasGetValueTypeHash = 0x0008000000000000, 54 | NativeAccessSpecifierPublic = 0x0010000000000000, 55 | NativeAccessSpecifierProtected = 0x0020000000000000, 56 | NativeAccessSpecifierPrivate = 0x0040000000000000 57 | }; 58 | 59 | inline bool operator&(UEPropertyFlags lhs, UEPropertyFlags rhs) 60 | { 61 | return (static_cast>(lhs) & static_cast>(rhs)) == static_cast>(rhs); 62 | } 63 | 64 | std::string StringifyFlags(const UEPropertyFlags flags); -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 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 | -------------------------------------------------------------------------------- /Target/UnrealEngine1/EngineClasses.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | // This file contains the needed classes as they are present in the game memory. 8 | // To get these classes use a helper application like ReClass.NET (https://github.com/KN4CK3R/ReClass.NET) 9 | 10 | struct FPointer 11 | { 12 | uintptr_t Dummy; 13 | }; 14 | 15 | struct FQWord 16 | { 17 | int A; 18 | int B; 19 | }; 20 | 21 | struct FName 22 | { 23 | int32_t Index; 24 | }; 25 | 26 | template 27 | class TArray 28 | { 29 | friend class FString; 30 | 31 | public: 32 | TArray() 33 | { 34 | Data = nullptr; 35 | Count = Max = 0; 36 | }; 37 | 38 | size_t Num() const 39 | { 40 | return Count; 41 | }; 42 | 43 | T& operator[](size_t i) 44 | { 45 | return Data[i]; 46 | }; 47 | 48 | const T& operator[](size_t i) const 49 | { 50 | return Data[i]; 51 | }; 52 | 53 | bool IsValidIndex(size_t i) const 54 | { 55 | return i < Num(); 56 | } 57 | 58 | private: 59 | T* Data; 60 | int32_t Count; 61 | int32_t Max; 62 | }; 63 | 64 | class FString : public TArray 65 | { 66 | public: 67 | std::string ToString() const 68 | { 69 | const int size = WideCharToMultiByte(CP_UTF8, 0, Data, Count - 1, nullptr, 0, nullptr, nullptr); 70 | std::string str(size, 0); 71 | WideCharToMultiByte(CP_UTF8, 0, Data, Count - 1, &str[0], size, nullptr, nullptr); 72 | return str; 73 | } 74 | }; 75 | 76 | struct FScriptDelegate 77 | { 78 | unsigned char UnknownData[0x0C]; 79 | }; 80 | 81 | class UClass; 82 | 83 | class UObject 84 | { 85 | public: 86 | FPointer VfTableObject; 87 | int InternalIndex; 88 | char UnknownData00[0x10]; 89 | UObject* Outer; 90 | char UnknownData01[0x4]; 91 | FName Name; 92 | UClass* Class; 93 | }; 94 | 95 | class UField : public UObject 96 | { 97 | public: 98 | UField* SuperField; 99 | UField* Next; 100 | UField* HashNext; 101 | }; 102 | 103 | class UEnum : public UField 104 | { 105 | public: 106 | TArray Names; 107 | }; 108 | 109 | class UConst : public UField 110 | { 111 | public: 112 | FString Value; 113 | }; 114 | 115 | class UStruct : public UField 116 | { 117 | public: 118 | char UnknownData00[0x04]; 119 | UField* Children; 120 | unsigned long PropertySize; 121 | char UnknownData01[0x2C]; 122 | }; 123 | 124 | class UScriptStruct : public UStruct 125 | { 126 | public: 127 | 128 | }; 129 | 130 | class UFunction : public UStruct 131 | { 132 | public: 133 | unsigned long FunctionFlags; 134 | unsigned short iNative; 135 | unsigned short RepOffset; 136 | FName FriendlyName; 137 | unsigned short NumParms; 138 | unsigned short ParmsSize; 139 | unsigned short ReturnValueOffset; 140 | char UnknownData00[0x04]; 141 | void* Func; 142 | }; 143 | 144 | class UState : public UStruct 145 | { 146 | public: 147 | char UnknownData00[0x418]; 148 | }; 149 | 150 | class UClass : public UState 151 | { 152 | public: 153 | char UnknownData00[0x64]; 154 | }; 155 | 156 | class UProperty : public UField 157 | { 158 | public: 159 | unsigned long ArrayDim; 160 | unsigned long ElementSize; 161 | unsigned long PropertyFlags; 162 | unsigned long PropertySize; 163 | char UnknownData01[0x4]; 164 | unsigned long Offset; 165 | char UnknownData02[0x10]; 166 | }; 167 | 168 | class UPointerProperty : public UProperty 169 | { 170 | public: 171 | 172 | }; 173 | 174 | class UByteProperty : public UProperty 175 | { 176 | public: 177 | UEnum* Enum; 178 | }; 179 | 180 | class UIntProperty : public UProperty 181 | { 182 | public: 183 | 184 | }; 185 | 186 | class UFloatProperty : public UProperty 187 | { 188 | public: 189 | 190 | }; 191 | 192 | class UBoolProperty : public UProperty 193 | { 194 | public: 195 | unsigned long BitMask; 196 | }; 197 | 198 | class UObjectProperty : public UProperty 199 | { 200 | public: 201 | UClass* PropertyClass; 202 | UObjectProperty* NextReference; 203 | }; 204 | 205 | class UClassProperty : public UObjectProperty 206 | { 207 | public: 208 | UClass* MetaClass; 209 | }; 210 | 211 | class UInterfaceProperty : public UProperty 212 | { 213 | public: 214 | UClass* InterfaceClass; 215 | }; 216 | 217 | class UNameProperty : public UProperty 218 | { 219 | public: 220 | 221 | }; 222 | 223 | class UStructProperty : public UProperty 224 | { 225 | public: 226 | UStruct* Struct; 227 | }; 228 | 229 | class UStrProperty : public UProperty 230 | { 231 | public: 232 | 233 | }; 234 | 235 | class UArrayProperty : public UProperty 236 | { 237 | public: 238 | UProperty* Inner; 239 | }; 240 | 241 | class UMapProperty : public UProperty 242 | { 243 | public: 244 | UProperty* KeyProp; 245 | UProperty* ValueProp; 246 | }; 247 | 248 | class UDelegateProperty : public UProperty 249 | { 250 | public: 251 | UFunction* SignatureFunction; 252 | }; 253 | -------------------------------------------------------------------------------- /Target/UnrealEngine1/Generator.cpp: -------------------------------------------------------------------------------- 1 | #include "IGenerator.hpp" 2 | #include "ObjectsStore.hpp" 3 | 4 | // This file contains the specific implementation for a game. For more informations can be found in the readme. 5 | 6 | class Generator : public IGenerator 7 | { 8 | public: 9 | bool Initialize(void* module) override 10 | { 11 | predefinedStaticMembers["Class Core.Object"] = { 12 | { "TArray*", "GObjects" } 13 | }; 14 | predefinedMembers["Class Core.Field"] = { 15 | { "class UField*", "SuperField" }, 16 | { "class UField*", "Next" }, 17 | { "class UField*", "HashNext" } 18 | }; 19 | predefinedMembers["Class Core.Struct"] = { 20 | { "unsigned char", "UnknownData00[0x04]" }, 21 | { "class UField*", "Children" }, 22 | { "unsigned long", "PropertySize" }, 23 | { "unsigned char", "UnknownData01[0x2C]" } 24 | }; 25 | predefinedMembers["Class Core.Function"] = { 26 | { "uint32_t", "FunctionFlags" }, 27 | { "uint16_t", "iNative" }, 28 | { "uint16_t", "RepOffset" }, 29 | { "uint8_t", "OperPrecedence" }, 30 | { "uint8_t", "NumParms" }, 31 | { "uint16_t", "ParmsSize" }, 32 | { "uint16_t", "ReturnValueOffset" }, 33 | { "char", "UnknownData00[0x02]" }, 34 | { "void*", "Func" } 35 | }; 36 | 37 | predefinedMethods["Struct Core.Object.Color"] = { 38 | PredefinedMethod::Inline(R"( FColor() 39 | : R(0), G(0), B(0), A(0) 40 | { })"), 41 | PredefinedMethod::Inline(R"( FColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a) 42 | : R(r), 43 | G(g), 44 | B(b), 45 | A(a) 46 | { })") 47 | }; 48 | 49 | predefinedMethods["Class Core.Object"] = { 50 | PredefinedMethod::Default("static TArray& GetGlobalObjects()", R"(TArray& UObject::GetGlobalObjects() 51 | { 52 | return *GObjects; 53 | })"), 54 | PredefinedMethod::Inline(R"( inline std::string UObject::GetName() const 55 | { 56 | return Name.GetName(); 57 | })"), 58 | PredefinedMethod::Default("std::string GetFullName() const", R"(std::string UObject::GetFullName() const 59 | { 60 | std::string name; 61 | 62 | if (Class != nullptr) 63 | { 64 | std::string temp; 65 | for (auto p = Outer; p; p = p->Outer) 66 | { 67 | temp = p->GetName() + "." + temp; 68 | } 69 | 70 | name = Class->GetName(); 71 | name += " "; 72 | name += temp; 73 | name += GetName(); 74 | } 75 | 76 | return name; 77 | })"), 78 | PredefinedMethod::Inline(R"( template 79 | static T* FindObject(const std::string& name) 80 | { 81 | for (auto i = 0u; i < GetGlobalObjects().Num(); ++i) 82 | { 83 | auto object = GetGlobalObjects().GetByIndex(i); 84 | 85 | if (object == nullptr) 86 | { 87 | continue; 88 | } 89 | 90 | if (object->GetFullName() == name) 91 | { 92 | return static_cast(object); 93 | } 94 | } 95 | return nullptr; 96 | })"), 97 | PredefinedMethod::Inline(R"( static UClass* FindClass(const std::string& name) 98 | { 99 | return FindObject(name); 100 | })"), 101 | PredefinedMethod::Inline(R"( template 102 | static T* GetObjectCasted(std::size_t index) 103 | { 104 | return static_cast(GetGlobalObjects().GetByIndex(index)); 105 | })"), 106 | PredefinedMethod::Default("bool IsA(UClass* cmp) const", R"(bool UObject::IsA(UClass* cmp) const 107 | { 108 | for (auto super = Class; super; super = static_cast(super->SuperField)) 109 | { 110 | if (super == cmp) 111 | { 112 | return true; 113 | } 114 | } 115 | 116 | return false; 117 | })"), 118 | PredefinedMethod::Inline(R"( void ProcessEvent(class UFunction* function, void* parms) 119 | { 120 | using Fn = void(__thiscall *)(UObject*, class UFunction*, void*, void*); 121 | //UObject::ProcessEvent can be found with the sig 122 | //8B 03 8B CB FF 50 2C 123 | static Fn fn = nullptr; 124 | 125 | return fn(this, function, parms, nullptr); 126 | })") 127 | }; 128 | predefinedMethods["Class Core.Class"] = { 129 | PredefinedMethod::Inline(R"( template 130 | T* CreateDefaultObject() 131 | { 132 | return static_cast(CreateDefaultObject()); 133 | })"), 134 | PredefinedMethod::Inline(R"( UObject* CreateDefaultObject() 135 | { 136 | using Fn = UObject*(__thiscall *)(UClass*); 137 | //UClass::GetDefaultObject can be found with the sig 138 | //56 8B F1 57 8B 06 8B BE 139 | static Fn fn = nullptr; 140 | 141 | return fn(this); 142 | })") 143 | }; 144 | 145 | return true; 146 | } 147 | 148 | std::string GetGameName() const override 149 | { 150 | return "Unreal Engine 1"; 151 | } 152 | 153 | std::string GetGameNameShort() const override 154 | { 155 | return "UE1"; 156 | } 157 | 158 | std::string GetGameVersion() const override 159 | { 160 | return "1"; 161 | } 162 | 163 | std::string GetNamespaceName() const override 164 | { 165 | return "SDK"; 166 | } 167 | 168 | std::vector GetIncludes() const override 169 | { 170 | return { }; 171 | } 172 | 173 | std::string GetBasicDeclarations() const override 174 | { 175 | return R"(template 176 | inline Fn GetVFunction(const void *instance, std::size_t index) 177 | { 178 | auto vtable = *reinterpret_cast(const_cast(instance)); 179 | return reinterpret_cast(vtable[index]); 180 | } 181 | 182 | template 183 | class TArray 184 | { 185 | friend class FString; 186 | 187 | public: 188 | inline TArray() 189 | { 190 | Data = nullptr; 191 | Count = Max = 0; 192 | }; 193 | 194 | inline size_t Num() const 195 | { 196 | return Count; 197 | }; 198 | 199 | inline T& operator[](size_t i) 200 | { 201 | return Data[i]; 202 | }; 203 | 204 | inline const T& operator[](size_t i) const 205 | { 206 | return Data[i]; 207 | }; 208 | 209 | inline bool IsValidIndex(size_t i) const 210 | { 211 | return i < Num(); 212 | } 213 | 214 | inline T& GetByIndex(size_t i) 215 | { 216 | return Data[i]; 217 | } 218 | 219 | inline const T& GetByIndex(size_t i) const 220 | { 221 | return Data[i]; 222 | } 223 | 224 | private: 225 | T* Data; 226 | int32_t Count; 227 | int32_t Max; 228 | }; 229 | 230 | class FString : public TArray 231 | { 232 | public: 233 | inline FString() 234 | { 235 | } 236 | 237 | FString(const wchar_t* other) 238 | { 239 | Max = Count = *other ? std::wcslen(other) + 1 : 0; 240 | 241 | if (Count) 242 | { 243 | Data = const_cast(other); 244 | } 245 | }; 246 | 247 | inline bool IsValid() const 248 | { 249 | return Data != nullptr; 250 | } 251 | 252 | inline const wchar_t* c_str() const 253 | { 254 | return Data; 255 | } 256 | 257 | std::string ToString() const 258 | { 259 | const auto length = std::wcslen(Data); 260 | 261 | std::string str(length, '\0'); 262 | 263 | std::use_facet>(std::locale()).narrow(Data, Data + length, '?', &str[0]); 264 | 265 | return str; 266 | } 267 | }; 268 | 269 | template 270 | class TEnumAsByte 271 | { 272 | public: 273 | inline TEnumAsByte() 274 | { 275 | } 276 | 277 | inline TEnumAsByte(TEnum _value) 278 | : value(static_cast(_value)) 279 | { 280 | } 281 | 282 | explicit inline TEnumAsByte(int32_t _value) 283 | : value(static_cast(_value)) 284 | { 285 | } 286 | 287 | explicit inline TEnumAsByte(uint8_t _value) 288 | : value(_value) 289 | { 290 | } 291 | 292 | inline operator TEnum() const 293 | { 294 | return (TEnum)value; 295 | } 296 | 297 | inline TEnum GetValue() const 298 | { 299 | return (TEnum)value; 300 | } 301 | 302 | private: 303 | uint8_t value; 304 | }; 305 | 306 | struct FNameEntry 307 | { 308 | char UnknownData00[0xC]; 309 | wchar_t Data[0x10]; 310 | 311 | std::string GetName() 312 | { 313 | const auto length = std::wcslen(Data); 314 | 315 | std::string str(length, '\0'); 316 | 317 | std::use_facet>(std::locale()).narrow(Data, Data + length, '?', &str[0]); 318 | 319 | return str; 320 | } 321 | }; 322 | 323 | struct FName 324 | { 325 | int32_t Index; 326 | 327 | FName() 328 | : Index(0) 329 | { 330 | }; 331 | 332 | FName(int32_t i) 333 | : Index(i) 334 | { 335 | }; 336 | 337 | FName(const char* nameToFind) 338 | : Index(0) 339 | { 340 | static std::unordered_set cache; 341 | 342 | for (auto i : cache) 343 | { 344 | if (GetGlobalNames()[i]->GetName() == nameToFind) 345 | { 346 | Index = i; 347 | 348 | return; 349 | } 350 | } 351 | 352 | for (auto i = 0u; i < GetGlobalNames().Num(); ++i) 353 | { 354 | if (GetGlobalNames()[i] != nullptr) 355 | { 356 | if (GetGlobalNames()[i]->GetName() == nameToFind) 357 | { 358 | cache.insert(i); 359 | 360 | Index = i; 361 | 362 | return; 363 | } 364 | } 365 | } 366 | }; 367 | 368 | static TArray* GNames; 369 | static inline TArray& GetGlobalNames() 370 | { 371 | return *GNames; 372 | }; 373 | 374 | inline std::string GetName() const 375 | { 376 | return GetGlobalNames()[Index]->GetName(); 377 | }; 378 | 379 | inline bool operator==(const FName &other) const 380 | { 381 | return Index == other.Index; 382 | }; 383 | }; 384 | 385 | struct FPointer 386 | { 387 | int Dummy; 388 | }; 389 | 390 | struct FScriptDelegate 391 | { 392 | unsigned char UnknownData[0x0C]; 393 | };)"; 394 | } 395 | }; 396 | 397 | Generator _generator; 398 | IGenerator* generator = &_generator; 399 | -------------------------------------------------------------------------------- /Target/UnrealEngine1/NamesStore.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "PatternFinder.hpp" 4 | #include "NamesStore.hpp" 5 | 6 | #include "EngineClasses.hpp" 7 | 8 | // This class contains the class which allows the generator access to global names list. 9 | 10 | struct FNameEntry 11 | { 12 | char UnknownData00[0xC]; 13 | wchar_t Data[0x10]; 14 | 15 | std::string GetName() const 16 | { 17 | const auto length = std::wcslen(Data); 18 | const auto neededLength = WideCharToMultiByte(CP_UTF8, 0, Data, length, nullptr, 0, nullptr, nullptr); 19 | std::string str(neededLength, 0); 20 | WideCharToMultiByte(CP_UTF8, 0, Data, length, &str[0], neededLength, nullptr, nullptr); 21 | return str; 22 | } 23 | }; 24 | 25 | TArray* GlobalNames = nullptr; 26 | 27 | bool NamesStore::Initialize() 28 | { 29 | // TODO: Here you need to tell the class where the global names list is. You can use the function 'FindPattern()' to make this dynamic. 30 | 31 | GlobalNames = reinterpret_cast(0x12341234); 32 | 33 | return true; 34 | } 35 | 36 | void* NamesStore::GetAddress() 37 | { 38 | return GlobalNames; 39 | } 40 | 41 | size_t NamesStore::GetNamesNum() const 42 | { 43 | return GlobalNames->Num(); 44 | } 45 | 46 | bool NamesStore::IsValid(size_t id) const 47 | { 48 | return GlobalNames->IsValidIndex(id) && (*GlobalNames)[id] != nullptr; 49 | } 50 | 51 | std::string NamesStore::GetById(size_t id) const 52 | { 53 | return (*GlobalNames)[id]->GetName(); 54 | } 55 | -------------------------------------------------------------------------------- /Target/UnrealEngine1/ObjectsStore.cpp: -------------------------------------------------------------------------------- 1 | #include "PatternFinder.hpp" 2 | #include "ObjectsStore.hpp" 3 | 4 | #include "EngineClasses.hpp" 5 | 6 | // This class contains the class which allows the generator access to global objects list. 7 | 8 | TArray* GlobalObjects = nullptr; 9 | 10 | bool ObjectsStore::Initialize() 11 | { 12 | // TODO: Here you need to tell the class where the global object list is. You can use the function 'FindPattern()' to make this dynamic. 13 | 14 | GlobalObjects = reinterpret_cast(0x12341234); 15 | 16 | return true; 17 | } 18 | 19 | void* ObjectsStore::GetAddress() 20 | { 21 | return GlobalObjects; 22 | } 23 | 24 | size_t ObjectsStore::GetObjectsNum() const 25 | { 26 | return GlobalObjects->Num(); 27 | } 28 | 29 | UEObject ObjectsStore::GetById(size_t id) const 30 | { 31 | return (*GlobalObjects)[id]; 32 | } 33 | -------------------------------------------------------------------------------- /Target/UnrealEngine2/EngineClasses.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | // This file contains the needed classes as they are present in the game memory. 8 | // To get these classes use a helper application like ReClass.NET (https://github.com/KN4CK3R/ReClass.NET) 9 | 10 | struct FPointer 11 | { 12 | uintptr_t Dummy; 13 | }; 14 | 15 | struct FQWord 16 | { 17 | int A; 18 | int B; 19 | }; 20 | 21 | struct FName 22 | { 23 | int32_t Index; 24 | }; 25 | 26 | template 27 | class TArray 28 | { 29 | friend class FString; 30 | 31 | public: 32 | TArray() 33 | { 34 | Data = nullptr; 35 | Count = Max = 0; 36 | }; 37 | 38 | size_t Num() const 39 | { 40 | return Count; 41 | }; 42 | 43 | T& operator[](size_t i) 44 | { 45 | return Data[i]; 46 | }; 47 | 48 | const T& operator[](size_t i) const 49 | { 50 | return Data[i]; 51 | }; 52 | 53 | bool IsValidIndex(size_t i) const 54 | { 55 | return i < Num(); 56 | } 57 | 58 | private: 59 | T* Data; 60 | int32_t Count; 61 | int32_t Max; 62 | }; 63 | 64 | class FString : public TArray 65 | { 66 | public: 67 | std::string ToString() const 68 | { 69 | int size = WideCharToMultiByte(CP_UTF8, 0, Data, Count - 1, nullptr, 0, nullptr, nullptr); 70 | std::string str(size, 0); 71 | WideCharToMultiByte(CP_UTF8, 0, Data, Count - 1, &str[0], size, nullptr, nullptr); 72 | return str; 73 | } 74 | }; 75 | 76 | struct FScriptDelegate 77 | { 78 | unsigned char UnknownData[0x0C]; 79 | }; 80 | 81 | class UClass; 82 | 83 | class UObject 84 | { 85 | public: 86 | FPointer VfTableObject; 87 | int InternalIndex; 88 | char UnknownData00[0x10]; 89 | UObject* Outer; 90 | char UnknownData01[0x4]; 91 | FName Name; 92 | UClass* Class; 93 | }; 94 | 95 | class UField : public UObject 96 | { 97 | public: 98 | UField* SuperField; 99 | UField* Next; 100 | UField* HashNext; 101 | }; 102 | 103 | class UEnum : public UField 104 | { 105 | public: 106 | TArray Names; 107 | }; 108 | 109 | class UConst : public UField 110 | { 111 | public: 112 | FString Value; 113 | }; 114 | 115 | class UStruct : public UField 116 | { 117 | public: 118 | char UnknownData00[0x08]; 119 | UField* Children; 120 | unsigned long PropertySize; 121 | char UnknownData01[0x2C]; 122 | }; 123 | 124 | class UScriptStruct : public UStruct 125 | { 126 | public: 127 | 128 | }; 129 | 130 | class UFunction : public UStruct 131 | { 132 | public: 133 | uint32_t FunctionFlags; 134 | uint16_t iNative; 135 | char UnknownData00[2]; 136 | uint8_t OperPrecedence; 137 | uint8_t NumParms; 138 | uint16_t ParmsSize; 139 | uint16_t ReturnValueOffset; 140 | char UnknownData01[2]; 141 | void* Func; 142 | }; 143 | 144 | class UState : public UStruct 145 | { 146 | public: 147 | char UnknownData00[0x418]; 148 | }; 149 | 150 | class UClass : public UState 151 | { 152 | public: 153 | char UnknownData00[0x8C]; 154 | }; 155 | 156 | class UProperty : public UField 157 | { 158 | public: 159 | unsigned long ArrayDim; 160 | unsigned long ElementSize; 161 | unsigned long PropertyFlags; 162 | unsigned long PropertySize; 163 | char UnknownData01[0x4]; 164 | unsigned long Offset; 165 | char UnknownData02[0x20]; 166 | }; 167 | 168 | class UPointerProperty : public UProperty 169 | { 170 | public: 171 | 172 | }; 173 | 174 | class UByteProperty : public UProperty 175 | { 176 | public: 177 | UEnum* Enum; 178 | }; 179 | 180 | class UIntProperty : public UProperty 181 | { 182 | public: 183 | 184 | }; 185 | 186 | class UFloatProperty : public UProperty 187 | { 188 | public: 189 | 190 | }; 191 | 192 | class UBoolProperty : public UProperty 193 | { 194 | public: 195 | unsigned long BitMask; 196 | }; 197 | 198 | class UObjectProperty : public UProperty 199 | { 200 | public: 201 | UClass* PropertyClass; 202 | UObjectProperty* NextReference; 203 | }; 204 | 205 | class UClassProperty : public UObjectProperty 206 | { 207 | public: 208 | UClass* MetaClass; 209 | }; 210 | 211 | class UInterfaceProperty : public UProperty 212 | { 213 | public: 214 | UClass* InterfaceClass; 215 | }; 216 | 217 | class UNameProperty : public UProperty 218 | { 219 | public: 220 | 221 | }; 222 | 223 | class UStructProperty : public UProperty 224 | { 225 | public: 226 | UStruct* Struct; 227 | }; 228 | 229 | class UStrProperty : public UProperty 230 | { 231 | public: 232 | 233 | }; 234 | 235 | class UArrayProperty : public UProperty 236 | { 237 | public: 238 | UProperty* Inner; 239 | }; 240 | 241 | class UMapProperty : public UProperty 242 | { 243 | public: 244 | UProperty* KeyProp; 245 | UProperty* ValueProp; 246 | }; 247 | 248 | class UDelegateProperty : public UProperty 249 | { 250 | public: 251 | UFunction* SignatureFunction; 252 | }; 253 | -------------------------------------------------------------------------------- /Target/UnrealEngine2/NamesStore.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "PatternFinder.hpp" 4 | #include "NamesStore.hpp" 5 | 6 | #include "EngineClasses.hpp" 7 | 8 | // This class contains the class which allows the generator access to global names list. 9 | 10 | struct FNameEntry 11 | { 12 | char UnknownData00[0xC]; 13 | wchar_t Data[0x10]; 14 | 15 | std::string GetName() const 16 | { 17 | const auto length = std::wcslen(Data); 18 | const auto neededLength = WideCharToMultiByte(CP_UTF8, 0, Data, length, nullptr, 0, nullptr, nullptr); 19 | std::string str(neededLength, 0); 20 | WideCharToMultiByte(CP_UTF8, 0, Data, length, &str[0], neededLength, nullptr, nullptr); 21 | return str; 22 | } 23 | }; 24 | 25 | TArray* GlobalNames = nullptr; 26 | 27 | bool NamesStore::Initialize() 28 | { 29 | // TODO: Here you need to tell the class where the global names list is. You can use the function 'FindPattern()' to make this dynamic. 30 | 31 | GlobalNames = reinterpret_cast(0x12341234); 32 | 33 | return true; 34 | } 35 | 36 | void* NamesStore::GetAddress() 37 | { 38 | return GlobalNames; 39 | } 40 | 41 | size_t NamesStore::GetNamesNum() const 42 | { 43 | return GlobalNames->Num(); 44 | } 45 | 46 | bool NamesStore::IsValid(size_t id) const 47 | { 48 | return GlobalNames->IsValidIndex(id) && (*GlobalNames)[id] != nullptr; 49 | } 50 | 51 | std::string NamesStore::GetById(size_t id) const 52 | { 53 | return (*GlobalNames)[id]->GetName(); 54 | } 55 | -------------------------------------------------------------------------------- /Target/UnrealEngine2/ObjectsStore.cpp: -------------------------------------------------------------------------------- 1 | #include "PatternFinder.hpp" 2 | #include "ObjectsStore.hpp" 3 | 4 | #include "EngineClasses.hpp" 5 | 6 | // This class contains the class which allows the generator access to global objects list. 7 | 8 | TArray* GlobalObjects = nullptr; 9 | 10 | bool ObjectsStore::Initialize() 11 | { 12 | // TODO: Here you need to tell the class where the global object list is. You can use the function 'FindPattern()' to make this dynamic. 13 | 14 | GlobalObjects = reinterpret_cast(0x12341234); 15 | 16 | return true; 17 | } 18 | 19 | void* ObjectsStore::GetAddress() 20 | { 21 | return GlobalObjects; 22 | } 23 | 24 | size_t ObjectsStore::GetObjectsNum() const 25 | { 26 | return GlobalObjects->Num(); 27 | } 28 | 29 | UEObject ObjectsStore::GetById(size_t id) const 30 | { 31 | return (*GlobalObjects)[id]; 32 | } 33 | -------------------------------------------------------------------------------- /Target/UnrealEngine3/EngineClasses.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | // This file contains the needed classes as they are present in the game memory. 8 | // To get these classes use a helper application like ReClass.NET (https://github.com/KN4CK3R/ReClass.NET) 9 | 10 | struct FPointer 11 | { 12 | uintptr_t Dummy; 13 | }; 14 | 15 | struct FQWord 16 | { 17 | int A; 18 | int B; 19 | }; 20 | 21 | struct FName 22 | { 23 | int32_t Index; 24 | int32_t Number; 25 | }; 26 | 27 | template 28 | class TArray 29 | { 30 | friend class FString; 31 | 32 | public: 33 | TArray() 34 | { 35 | Data = nullptr; 36 | Count = Max = 0; 37 | }; 38 | 39 | size_t Num() const 40 | { 41 | return Count; 42 | }; 43 | 44 | T& operator[](size_t i) 45 | { 46 | return Data[i]; 47 | }; 48 | 49 | const T& operator[](size_t i) const 50 | { 51 | return Data[i]; 52 | }; 53 | 54 | bool IsValidIndex(size_t i) const 55 | { 56 | return i < Num(); 57 | } 58 | 59 | private: 60 | T* Data; 61 | int32_t Count; 62 | int32_t Max; 63 | }; 64 | 65 | class FString : public TArray 66 | { 67 | public: 68 | std::string ToString() const 69 | { 70 | int size = WideCharToMultiByte(CP_UTF8, 0, Data, Count - 1, nullptr, 0, nullptr, nullptr); 71 | std::string str(size, 0); 72 | WideCharToMultiByte(CP_UTF8, 0, Data, Count - 1, &str[0], size, nullptr, nullptr); 73 | return str; 74 | } 75 | }; 76 | 77 | class FScriptInterface 78 | { 79 | private: 80 | UObject* ObjectPointer; 81 | void* InterfacePointer; 82 | 83 | public: 84 | UObject* GetObject() const 85 | { 86 | return ObjectPointer; 87 | } 88 | 89 | UObject*& GetObjectRef() 90 | { 91 | return ObjectPointer; 92 | } 93 | 94 | void* GetInterface() const 95 | { 96 | return ObjectPointer != nullptr ? InterfacePointer : nullptr; 97 | } 98 | }; 99 | 100 | template 101 | class TScriptInterface : public FScriptInterface 102 | { 103 | public: 104 | InterfaceType* operator->() const 105 | { 106 | return (InterfaceType*)GetInterface(); 107 | } 108 | 109 | InterfaceType& operator*() const 110 | { 111 | return *((InterfaceType*)GetInterface()); 112 | } 113 | 114 | operator bool() const 115 | { 116 | return GetInterface() != nullptr; 117 | } 118 | }; 119 | 120 | struct FScriptDelegate 121 | { 122 | unsigned char UnknownData[0x0C]; 123 | }; 124 | 125 | class UClass; 126 | 127 | class UObject 128 | { 129 | public: 130 | FPointer VTableObject; 131 | uint32_t InternalIndex; 132 | char UnknownData00[0x20]; 133 | UObject* Outer; 134 | FName Name; 135 | UObject* Class; 136 | char UnknownData01[0x04]; 137 | }; 138 | 139 | class UField : public UObject 140 | { 141 | public: 142 | UField* SuperField; 143 | UField* Next; 144 | }; 145 | 146 | class UEnum : public UField 147 | { 148 | public: 149 | TArray Names; 150 | }; 151 | 152 | class UConst : public UField 153 | { 154 | public: 155 | FString Value; 156 | }; 157 | 158 | class UStruct : public UField 159 | { 160 | public: 161 | char UnknownData00[0x08]; 162 | UField* Children; 163 | uint32_t PropertySize; 164 | char UnknownData01[0x3C]; 165 | }; 166 | 167 | class UScriptStruct : public UStruct 168 | { 169 | public: 170 | char UnknownData00[0x1C]; 171 | }; 172 | 173 | class UFunction : public UStruct 174 | { 175 | public: 176 | uint32_t FunctionFlags; 177 | uint16_t iNative; 178 | uint16_t RepOffset; 179 | FName FriendlyName; 180 | uint8_t OperPrecendence; 181 | uint8_t NumParms; 182 | uint16_t ParmsSize; 183 | uint16_t ReturnValueOffset; 184 | class UStructProperty* FirstStructWithDefaults; 185 | void* Func; 186 | }; 187 | 188 | class UState : public UStruct 189 | { 190 | public: 191 | char UnknownData00[0x2C]; 192 | }; 193 | 194 | class UClass : public UStruct 195 | { 196 | public: 197 | char UnknownData00[0x60]; 198 | UObject* ClassDefaultObject; 199 | char UnknownData01[0x5C]; 200 | }; 201 | 202 | class UProperty : public UField 203 | { 204 | public: 205 | uint32_t ArrayDim; 206 | uint32_t ElementSize; 207 | uint32_t PropertyFlags; 208 | uint32_t PropertySize; 209 | FName Category; 210 | char UnknownData00[0x08]; 211 | uint32_t Offset; 212 | UProperty* PropertyLinkNext; 213 | char UnknownData01[0x18]; 214 | }; 215 | 216 | class UByteProperty : public UProperty 217 | { 218 | public: 219 | UEnum* Enum; 220 | }; 221 | 222 | class UIntProperty : public UProperty 223 | { 224 | public: 225 | 226 | }; 227 | 228 | class UFloatProperty : public UProperty 229 | { 230 | public: 231 | 232 | }; 233 | 234 | class UDoubleProperty : public UProperty 235 | { 236 | public: 237 | 238 | }; 239 | 240 | class UBoolProperty : public UProperty 241 | { 242 | public: 243 | unsigned long BitMask; 244 | }; 245 | 246 | class UObjectProperty : public UProperty 247 | { 248 | public: 249 | UClass* PropertyClass; 250 | }; 251 | 252 | class UComponentProperty : public UObjectProperty 253 | { 254 | public: 255 | 256 | }; 257 | 258 | class UClassProperty : public UObjectProperty 259 | { 260 | public: 261 | UClass* MetaClass; 262 | }; 263 | 264 | class UInterfaceProperty : public UProperty 265 | { 266 | public: 267 | UClass* InterfaceClass; 268 | }; 269 | 270 | class UNameProperty : public UProperty 271 | { 272 | public: 273 | 274 | }; 275 | 276 | class UStructProperty : public UProperty 277 | { 278 | public: 279 | UStruct* Struct; 280 | }; 281 | 282 | class UStrProperty : public UProperty 283 | { 284 | public: 285 | 286 | }; 287 | 288 | class UArrayProperty : public UProperty 289 | { 290 | public: 291 | UProperty* Inner; 292 | }; 293 | 294 | class UMapProperty : public UProperty 295 | { 296 | public: 297 | UProperty* KeyProp; 298 | UProperty* ValueProp; 299 | }; 300 | 301 | class UDelegateProperty : public UProperty 302 | { 303 | public: 304 | UFunction* SignatureFunction; 305 | }; 306 | -------------------------------------------------------------------------------- /Target/UnrealEngine3/NamesStore.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "PatternFinder.hpp" 4 | #include "NamesStore.hpp" 5 | 6 | #include "EngineClasses.hpp" 7 | 8 | // This class contains the class which allows the generator access to global names list. 9 | 10 | class FNameEntry 11 | { 12 | public: 13 | uint32_t Index; 14 | char UnknownData00[0x0C]; 15 | wchar_t WideName[1024]; 16 | 17 | int32_t GetIndex() const 18 | { 19 | return Index; 20 | } 21 | 22 | const wchar_t* GetWideName() const 23 | { 24 | return WideName; 25 | } 26 | 27 | std::string GetName() const 28 | { 29 | const auto length = std::wcslen(WideName); 30 | 31 | std::string str(length, '\0'); 32 | 33 | std::use_facet>(std::locale()).narrow(WideName, WideName + length, '?', &str[0]); 34 | 35 | return str; 36 | } 37 | }; 38 | 39 | TArray* GlobalNames = nullptr; 40 | 41 | bool NamesStore::Initialize() 42 | { 43 | // TODO: Here you need to tell the class where the global names list is. You can use the function 'FindPattern()' to make this dynamic. 44 | 45 | GlobalNames = reinterpret_cast(0x12341234); 46 | 47 | return true; 48 | } 49 | 50 | void* NamesStore::GetAddress() 51 | { 52 | return GlobalNames; 53 | } 54 | 55 | size_t NamesStore::GetNamesNum() const 56 | { 57 | return GlobalNames->Num(); 58 | } 59 | 60 | bool NamesStore::IsValid(size_t id) const 61 | { 62 | return GlobalNames->IsValidIndex(id) && (*GlobalNames)[id] != nullptr; 63 | } 64 | 65 | std::string NamesStore::GetById(size_t id) const 66 | { 67 | return (*GlobalNames)[id]->GetName(); 68 | } 69 | -------------------------------------------------------------------------------- /Target/UnrealEngine3/ObjectsStore.cpp: -------------------------------------------------------------------------------- 1 | #include "PatternFinder.hpp" 2 | #include "ObjectsStore.hpp" 3 | 4 | #include "EngineClasses.hpp" 5 | 6 | // This class contains the class which allows the generator access to global objects list. 7 | 8 | TArray* GlobalObjects = nullptr; 9 | 10 | bool ObjectsStore::Initialize() 11 | { 12 | // TODO: Here you need to tell the class where the global object list is. You can use the function 'FindPattern()' to make this dynamic. 13 | 14 | GlobalObjects = reinterpret_cast(0x12341234); 15 | 16 | return true; 17 | } 18 | 19 | void* ObjectsStore::GetAddress() 20 | { 21 | return GlobalObjects; 22 | } 23 | 24 | size_t ObjectsStore::GetObjectsNum() const 25 | { 26 | return GlobalObjects->Num(); 27 | } 28 | 29 | UEObject ObjectsStore::GetById(size_t id) const 30 | { 31 | return (*GlobalObjects)[id]; 32 | } 33 | -------------------------------------------------------------------------------- /Target/UnrealEngine4/EngineClasses.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | // This file contains the needed classes as they are present in the game memory. 8 | // To get these classes use a helper application like ReClass.NET (https://github.com/KN4CK3R/ReClass.NET) 9 | 10 | struct FPointer 11 | { 12 | uintptr_t Dummy; 13 | }; 14 | 15 | struct FQWord 16 | { 17 | int A; 18 | int B; 19 | }; 20 | 21 | struct FName 22 | { 23 | int32_t ComparisonIndex; 24 | int32_t Number; 25 | }; 26 | 27 | template 28 | class TArray 29 | { 30 | friend class FString; 31 | 32 | public: 33 | TArray() 34 | { 35 | Data = nullptr; 36 | Count = Max = 0; 37 | }; 38 | 39 | size_t Num() const 40 | { 41 | return Count; 42 | }; 43 | 44 | T& operator[](size_t i) 45 | { 46 | return Data[i]; 47 | }; 48 | 49 | const T& operator[](size_t i) const 50 | { 51 | return Data[i]; 52 | }; 53 | 54 | bool IsValidIndex(size_t i) const 55 | { 56 | return i < Num(); 57 | } 58 | 59 | private: 60 | T* Data; 61 | int32_t Count; 62 | int32_t Max; 63 | }; 64 | 65 | template 66 | class TPair 67 | { 68 | public: 69 | KeyType Key; 70 | ValueType Value; 71 | }; 72 | 73 | class FString : public TArray 74 | { 75 | public: 76 | std::string ToString() const 77 | { 78 | const int size = WideCharToMultiByte(CP_UTF8, 0, Data, Count, nullptr, 0, nullptr, nullptr); 79 | std::string str(size, 0); 80 | WideCharToMultiByte(CP_UTF8, 0, Data, Count, &str[0], size, nullptr, nullptr); 81 | return str; 82 | } 83 | }; 84 | 85 | class FScriptInterface 86 | { 87 | private: 88 | UObject* ObjectPointer; 89 | void* InterfacePointer; 90 | 91 | public: 92 | UObject* GetObject() const 93 | { 94 | return ObjectPointer; 95 | } 96 | 97 | UObject*& GetObjectRef() 98 | { 99 | return ObjectPointer; 100 | } 101 | 102 | void* GetInterface() const 103 | { 104 | return ObjectPointer != nullptr ? InterfacePointer : nullptr; 105 | } 106 | }; 107 | 108 | template 109 | class TScriptInterface : public FScriptInterface 110 | { 111 | public: 112 | InterfaceType* operator->() const 113 | { 114 | return (InterfaceType*)GetInterface(); 115 | } 116 | 117 | InterfaceType& operator*() const 118 | { 119 | return *((InterfaceType*)GetInterface()); 120 | } 121 | 122 | operator bool() const 123 | { 124 | return GetInterface() != nullptr; 125 | } 126 | }; 127 | 128 | struct FText 129 | { 130 | char UnknownData[0x18]; 131 | }; 132 | 133 | struct FWeakObjectPtr 134 | { 135 | int32_t ObjectIndex; 136 | int32_t ObjectSerialNumber; 137 | }; 138 | 139 | struct FStringAssetReference 140 | { 141 | FString AssetLongPathname; 142 | }; 143 | 144 | template 145 | class TPersistentObjectPtr 146 | { 147 | public: 148 | FWeakObjectPtr WeakPtr; 149 | int32_t TagAtLastTest; 150 | TObjectID ObjectID; 151 | }; 152 | 153 | class FAssetPtr : public TPersistentObjectPtr 154 | { 155 | 156 | }; 157 | 158 | struct FSoftObjectPath 159 | { 160 | FName AssetPathName; 161 | FString SubPathString; 162 | }; 163 | 164 | class FSoftObjectPtr : public TPersistentObjectPtr 165 | { 166 | 167 | }; 168 | 169 | struct FGuid 170 | { 171 | uint32_t A; 172 | uint32_t B; 173 | uint32_t C; 174 | uint32_t D; 175 | }; 176 | 177 | struct FUniqueObjectGuid 178 | { 179 | FGuid Guid; 180 | }; 181 | 182 | class FLazyObjectPtr : public TPersistentObjectPtr 183 | { 184 | 185 | }; 186 | 187 | struct FScriptDelegate 188 | { 189 | unsigned char UnknownData[20]; 190 | }; 191 | 192 | struct FScriptMulticastDelegate 193 | { 194 | unsigned char UnknownData[16]; 195 | }; 196 | 197 | class UClass; 198 | 199 | class UObject 200 | { 201 | public: 202 | FPointer VTableObject; 203 | int32_t ObjectFlags; 204 | int32_t InternalIndex; 205 | UClass* Class; 206 | FName Name; 207 | UObject* Outer; 208 | }; 209 | 210 | class UField : public UObject 211 | { 212 | public: 213 | UField* Next; 214 | }; 215 | 216 | class UEnum : public UField 217 | { 218 | public: 219 | FString CppType; //0x0030 220 | TArray> Names; //0x0040 221 | __int64 CppForm; //0x0050 222 | }; 223 | 224 | class UStruct : public UField 225 | { 226 | public: 227 | UStruct* SuperField; 228 | UField* Children; 229 | int32_t PropertySize; 230 | int32_t MinAlignment; 231 | char pad_0x0048[0x40]; 232 | }; 233 | 234 | class UScriptStruct : public UStruct 235 | { 236 | public: 237 | char pad_0x0088[0x10]; //0x0088 238 | }; 239 | 240 | class UFunction : public UStruct 241 | { 242 | public: 243 | __int32 FunctionFlags; //0x0088 244 | __int16 RepOffset; //0x008C 245 | __int8 NumParms; //0x008E 246 | char pad_0x008F[0x1]; //0x008F 247 | __int16 ParmsSize; //0x0090 248 | __int16 ReturnValueOffset; //0x0092 249 | __int16 RPCId; //0x0094 250 | __int16 RPCResponseId; //0x0096 251 | class UProperty* FirstPropertyToInit; //0x0098 252 | UFunction* EventGraphFunction; //0x00A0 253 | __int32 EventGraphCallOffset; //0x00A8 254 | char pad_0x00AC[0x4]; //0x00AC 255 | void* Func; //0x00B0 256 | }; 257 | 258 | class UClass : public UStruct 259 | { 260 | public: 261 | char pad_0x0088[0x198]; //0x0088 262 | }; 263 | 264 | class UProperty : public UField 265 | { 266 | public: 267 | __int32 ArrayDim; //0x0030 268 | __int32 ElementSize; //0x0034 269 | FQWord PropertyFlags; //0x0038 270 | __int32 PropertySize; //0x0040 271 | char pad_0x0044[0xC]; //0x0044 272 | __int32 Offset; //0x0050 273 | char pad_0x0054[0x24]; //0x0054 274 | }; 275 | 276 | class UNumericProperty : public UProperty 277 | { 278 | public: 279 | 280 | }; 281 | 282 | class UByteProperty : public UNumericProperty 283 | { 284 | public: 285 | UEnum* Enum; 286 | }; 287 | 288 | class UUInt16Property : public UNumericProperty 289 | { 290 | public: 291 | 292 | }; 293 | 294 | class UUInt32Property : public UNumericProperty 295 | { 296 | public: 297 | 298 | }; 299 | 300 | class UUInt64Property : public UNumericProperty 301 | { 302 | public: 303 | 304 | }; 305 | 306 | class UInt8Property : public UNumericProperty 307 | { 308 | public: 309 | 310 | }; 311 | 312 | class UInt16Property : public UNumericProperty 313 | { 314 | public: 315 | 316 | }; 317 | 318 | class UIntProperty : public UNumericProperty 319 | { 320 | public: 321 | 322 | }; 323 | 324 | class UInt64Property : public UNumericProperty 325 | { 326 | public: 327 | 328 | }; 329 | 330 | class UFloatProperty : public UNumericProperty 331 | { 332 | public: 333 | 334 | }; 335 | 336 | class UDoubleProperty : public UNumericProperty 337 | { 338 | public: 339 | 340 | }; 341 | 342 | class UBoolProperty : public UProperty 343 | { 344 | public: 345 | uint8_t FieldSize; 346 | uint8_t ByteOffset; 347 | uint8_t ByteMask; 348 | uint8_t FieldMask; 349 | }; 350 | 351 | class UObjectPropertyBase : public UProperty 352 | { 353 | public: 354 | UClass* PropertyClass; 355 | }; 356 | 357 | class UObjectProperty : public UObjectPropertyBase 358 | { 359 | public: 360 | 361 | }; 362 | 363 | class UClassProperty : public UObjectProperty 364 | { 365 | public: 366 | UClass* MetaClass; 367 | }; 368 | 369 | class UInterfaceProperty : public UProperty 370 | { 371 | public: 372 | UClass* InterfaceClass; 373 | }; 374 | 375 | class UWeakObjectProperty : public UObjectPropertyBase 376 | { 377 | public: 378 | 379 | }; 380 | 381 | class ULazyObjectProperty : public UObjectPropertyBase 382 | { 383 | public: 384 | 385 | }; 386 | 387 | class UAssetObjectProperty : public UObjectPropertyBase 388 | { 389 | public: 390 | 391 | }; 392 | 393 | class UAssetClassProperty : public UAssetObjectProperty 394 | { 395 | public: 396 | UClass* MetaClass; 397 | }; 398 | 399 | class UNameProperty : public UProperty 400 | { 401 | public: 402 | 403 | }; 404 | 405 | class UStructProperty : public UProperty 406 | { 407 | public: 408 | UScriptStruct* Struct; 409 | }; 410 | 411 | class UStrProperty : public UProperty 412 | { 413 | public: 414 | 415 | }; 416 | 417 | class UTextProperty : public UProperty 418 | { 419 | public: 420 | 421 | }; 422 | 423 | class UArrayProperty : public UProperty 424 | { 425 | public: 426 | UProperty* Inner; 427 | }; 428 | 429 | class UMapProperty : public UProperty 430 | { 431 | public: 432 | UProperty* KeyProp; 433 | UProperty* ValueProp; 434 | }; 435 | 436 | class UDelegateProperty : public UProperty 437 | { 438 | public: 439 | UFunction* SignatureFunction; 440 | }; 441 | 442 | class UMulticastDelegateProperty : public UProperty 443 | { 444 | public: 445 | UFunction* SignatureFunction; 446 | }; 447 | 448 | class UEnumProperty : public UProperty 449 | { 450 | public: 451 | class UNumericProperty* UnderlyingProp; 452 | class UEnum* Enum; 453 | }; -------------------------------------------------------------------------------- /Target/UnrealEngine4/NamesStore.cpp: -------------------------------------------------------------------------------- 1 | #include "PatternFinder.hpp" 2 | #include "NamesStore.hpp" 3 | 4 | #include "EngineClasses.hpp" 5 | 6 | // This class contains the class which allows the generator access to global names list. 7 | 8 | class FNameEntry 9 | { 10 | public: 11 | int32_t Index; 12 | char pad_0x0004[0x4]; 13 | FNameEntry* HashNext; 14 | union 15 | { 16 | char AnsiName[1024]; 17 | wchar_t WideName[1024]; 18 | }; 19 | 20 | const char* GetName() const 21 | { 22 | return AnsiName; 23 | } 24 | }; 25 | 26 | template 27 | class TStaticIndirectArrayThreadSafeRead 28 | { 29 | public: 30 | int32_t Num() const 31 | { 32 | return numElements; 33 | } 34 | 35 | bool IsValidIndex(int32_t index) const 36 | { 37 | return index >= 0 && index < Num() && GetById(index) != nullptr; 38 | } 39 | 40 | ElementType const* const& GetById(int32_t index) const 41 | { 42 | return *GetItemPtr(index); 43 | } 44 | 45 | private: 46 | ElementType const* const* GetItemPtr(int32_t Index) const 47 | { 48 | const int32_t ChunkIndex = Index / ElementsPerChunk; 49 | const int32_t WithinChunkIndex = Index % ElementsPerChunk; 50 | const auto Chunk = chunks[ChunkIndex]; 51 | return Chunk + WithinChunkIndex; 52 | } 53 | 54 | enum 55 | { 56 | ChunkTableSize = (MaxTotalElements + ElementsPerChunk - 1) / ElementsPerChunk 57 | }; 58 | 59 | ElementType** chunks[ChunkTableSize]; 60 | int32_t numElements; 61 | int32_t numChunks; 62 | }; 63 | 64 | using TNameEntryArray = TStaticIndirectArrayThreadSafeRead; 65 | 66 | TNameEntryArray* GlobalNames = nullptr; 67 | 68 | bool NamesStore::Initialize() 69 | { 70 | // TODO: Here you need to tell the class where the global names list is. You can use the function 'FindPattern()' to make this dynamic. 71 | 72 | GlobalNames = reinterpret_cast(0x12341234); 73 | 74 | return true; 75 | } 76 | 77 | void* NamesStore::GetAddress() 78 | { 79 | return GlobalNames; 80 | } 81 | 82 | size_t NamesStore::GetNamesNum() const 83 | { 84 | return GlobalNames->Num(); 85 | } 86 | 87 | bool NamesStore::IsValid(size_t id) const 88 | { 89 | return GlobalNames->IsValidIndex(static_cast(id)); 90 | } 91 | 92 | std::string NamesStore::GetById(size_t id) const 93 | { 94 | return GlobalNames->GetById(static_cast(id))->GetName(); 95 | } 96 | -------------------------------------------------------------------------------- /Target/UnrealEngine4/ObjectsStore.cpp: -------------------------------------------------------------------------------- 1 | #include "PatternFinder.hpp" 2 | #include "ObjectsStore.hpp" 3 | 4 | #include "EngineClasses.hpp" 5 | 6 | // This class contains the class which allows the generator access to global objects list. 7 | 8 | class FUObjectItem 9 | { 10 | public: 11 | UObject* Object; 12 | int32_t Flags; 13 | int32_t ClusterIndex; 14 | int32_t SerialNumber; 15 | }; 16 | 17 | class TUObjectArray 18 | { 19 | public: 20 | FUObjectItem* Objects; 21 | int32_t MaxElements; 22 | int32_t NumElements; 23 | }; 24 | 25 | class FUObjectArray 26 | { 27 | public: 28 | int32_t Dummy1; 29 | int32_t Dummy2; 30 | int32_t Dummy3; 31 | int32_t Dummy4; 32 | 33 | TUObjectArray ObjObjects; 34 | }; 35 | 36 | FUObjectArray* GlobalObjects = nullptr; 37 | 38 | bool ObjectsStore::Initialize() 39 | { 40 | // TODO: Here you need to tell the class where the global object list is. You can use the function 'FindPattern()' to make this dynamic. 41 | 42 | GlobalObjects = reinterpret_cast(0x12341234); 43 | 44 | return true; 45 | } 46 | 47 | void* ObjectsStore::GetAddress() 48 | { 49 | return GlobalObjects; 50 | } 51 | 52 | size_t ObjectsStore::GetObjectsNum() const 53 | { 54 | return GlobalObjects->ObjObjects.NumElements; 55 | } 56 | 57 | UEObject ObjectsStore::GetById(size_t id) const 58 | { 59 | return GlobalObjects->ObjObjects.Objects[id].Object; 60 | } 61 | -------------------------------------------------------------------------------- /UnrealEngine1.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {17BAE508-B078-477A-9FC4-5A5B6F6EC2F4} 15 | Win32Proj 16 | UnrealEngine1 17 | 10.0.14393.0 18 | 19 | 20 | 21 | DynamicLibrary 22 | true 23 | v141 24 | Unicode 25 | 26 | 27 | DynamicLibrary 28 | false 29 | v141 30 | true 31 | Unicode 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | true 47 | $(SolutionDir)x86\$(Configuration)\Intermediate\$(ProjectName)\ 48 | $(SolutionDir)x86\$(Configuration)\ 49 | 50 | 51 | false 52 | $(SolutionDir)x86\$(Configuration)\Intermediate\$(ProjectName)\ 53 | $(SolutionDir)x86\$(Configuration)\ 54 | 55 | 56 | 57 | 58 | 59 | Level3 60 | Disabled 61 | _DEBUG;_WINDOWS;_USRDLL;UNREALENGINESDKGENERATOR_EXPORTS;NOMINMAX;WIN32_LEAN_AND_MEAN;UNREALENGINE_VERSION=0100;%(PreprocessorDefinitions) 62 | $(IntDir)%(RelativeDir)\ 63 | .\Engine;.\Engine\UE1 64 | 65 | 66 | Windows 67 | true 68 | 69 | 70 | 71 | 72 | Level3 73 | 74 | 75 | MaxSpeed 76 | true 77 | true 78 | NDEBUG;_WINDOWS;_USRDLL;UNREALENGINESDKGENERATOR_EXPORTS;NOMINMAX;WIN32_LEAN_AND_MEAN;UNREALENGINE_VERSION=0100;%(PreprocessorDefinitions) 79 | $(IntDir)%(RelativeDir)\ 80 | .\Engine;.\Engine\UE1 81 | 82 | 83 | Windows 84 | true 85 | true 86 | true 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /UnrealEngine1.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Engine 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Engine 17 | 18 | 19 | Engine 20 | 21 | 22 | Engine 23 | 24 | 25 | Engine 26 | 27 | 28 | Engine\UE1 29 | 30 | 31 | Engine 32 | 33 | 34 | Engine 35 | 36 | 37 | Engine\UE1 38 | 39 | 40 | Engine 41 | 42 | 43 | Engine\UE1 44 | 45 | 46 | Engine\UE1 47 | 48 | 49 | 50 | 51 | {5fb70966-5939-4bcf-b096-6b909315ed0d} 52 | 53 | 54 | {77ff275a-574c-4908-9ae5-345300346f41} 55 | 56 | 57 | 58 | 59 | 60 | 61 | Engine\UE1 62 | 63 | 64 | Engine 65 | 66 | 67 | Engine 68 | 69 | 70 | Engine 71 | 72 | 73 | Engine 74 | 75 | 76 | Engine 77 | 78 | 79 | Engine 80 | 81 | 82 | Engine 83 | 84 | 85 | Engine 86 | 87 | 88 | Engine 89 | 90 | 91 | Engine 92 | 93 | 94 | Engine\UE1 95 | 96 | 97 | Engine\UE1 98 | 99 | 100 | -------------------------------------------------------------------------------- /UnrealEngine2.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {CE6021C4-A719-47D2-9A4E-FD26404AC34F} 15 | Win32Proj 16 | UnrealEngine2 17 | 10.0.14393.0 18 | 19 | 20 | 21 | DynamicLibrary 22 | true 23 | v141 24 | Unicode 25 | 26 | 27 | DynamicLibrary 28 | false 29 | v141 30 | true 31 | Unicode 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | true 47 | $(SolutionDir)x86\$(Configuration)\Intermediate\$(ProjectName)\ 48 | $(SolutionDir)x86\$(Configuration)\ 49 | 50 | 51 | false 52 | $(SolutionDir)x86\$(Configuration)\Intermediate\$(ProjectName)\ 53 | $(SolutionDir)x86\$(Configuration)\ 54 | 55 | 56 | 57 | 58 | 59 | Level3 60 | Disabled 61 | _DEBUG;_WINDOWS;_USRDLL;UNREALENGINESDKGENERATOR_EXPORTS;NOMINMAX;WIN32_LEAN_AND_MEAN;UNREALENGINE_VERSION=0200;%(PreprocessorDefinitions) 62 | $(IntDir)%(RelativeDir)\ 63 | .\Engine;.\Engine\UE2 64 | 65 | 66 | Windows 67 | true 68 | 69 | 70 | 71 | 72 | Level3 73 | 74 | 75 | MaxSpeed 76 | true 77 | true 78 | NDEBUG;_WINDOWS;_USRDLL;UNREALENGINESDKGENERATOR_EXPORTS;NOMINMAX;WIN32_LEAN_AND_MEAN;UNREALENGINE_VERSION=0200;%(PreprocessorDefinitions) 79 | $(IntDir)%(RelativeDir)\ 80 | .\Engine;.\Engine\UE2 81 | 82 | 83 | Windows 84 | true 85 | true 86 | true 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /UnrealEngine2.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Engine 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Engine 17 | 18 | 19 | Engine 20 | 21 | 22 | Engine 23 | 24 | 25 | Engine 26 | 27 | 28 | Engine\UE2 29 | 30 | 31 | Engine 32 | 33 | 34 | Engine 35 | 36 | 37 | Engine\UE2 38 | 39 | 40 | Engine\UE2 41 | 42 | 43 | Engine\UE2 44 | 45 | 46 | Engine 47 | 48 | 49 | 50 | 51 | {5fb70966-5939-4bcf-b096-6b909315ed0d} 52 | 53 | 54 | {77ff275a-574c-4908-9ae5-345300346f41} 55 | 56 | 57 | 58 | 59 | 60 | 61 | Engine\UE2 62 | 63 | 64 | Engine 65 | 66 | 67 | Engine 68 | 69 | 70 | Engine 71 | 72 | 73 | Engine 74 | 75 | 76 | Engine 77 | 78 | 79 | Engine 80 | 81 | 82 | Engine\UE2 83 | 84 | 85 | Engine\UE2 86 | 87 | 88 | Engine 89 | 90 | 91 | Engine 92 | 93 | 94 | Engine 95 | 96 | 97 | Engine 98 | 99 | 100 | -------------------------------------------------------------------------------- /UnrealEngine3.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {41C536B5-2F0E-4232-8D0E-4B3CD17F69BB} 15 | Win32Proj 16 | UnrealEngine3 17 | 10.0.14393.0 18 | 19 | 20 | 21 | DynamicLibrary 22 | true 23 | v141 24 | Unicode 25 | 26 | 27 | DynamicLibrary 28 | false 29 | v141 30 | true 31 | Unicode 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | true 47 | $(SolutionDir)x86\$(Configuration)\Intermediate\$(ProjectName)\ 48 | $(SolutionDir)x86\$(Configuration)\ 49 | 50 | 51 | false 52 | $(SolutionDir)x86\$(Configuration)\Intermediate\$(ProjectName)\ 53 | $(SolutionDir)x86\$(Configuration)\ 54 | 55 | 56 | 57 | 58 | 59 | Level3 60 | Disabled 61 | _DEBUG;_WINDOWS;_USRDLL;UNREALENGINESDKGENERATOR_EXPORTS;NOMINMAX;WIN32_LEAN_AND_MEAN;UNREALENGINE_VERSION=0300;%(PreprocessorDefinitions) 62 | $(IntDir)%(RelativeDir)\ 63 | .\Engine;.\Engine\UE3 64 | 65 | 66 | Windows 67 | true 68 | 69 | 70 | 71 | 72 | Level3 73 | 74 | 75 | MaxSpeed 76 | true 77 | true 78 | NDEBUG;_WINDOWS;_USRDLL;UNREALENGINESDKGENERATOR_EXPORTS;NOMINMAX;WIN32_LEAN_AND_MEAN;UNREALENGINE_VERSION=0300;%(PreprocessorDefinitions) 79 | $(IntDir)%(RelativeDir)\ 80 | .\Engine;.\Engine\UE3 81 | 82 | 83 | Windows 84 | true 85 | true 86 | true 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /UnrealEngine3.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Engine 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Engine 17 | 18 | 19 | Engine 20 | 21 | 22 | Engine 23 | 24 | 25 | Engine 26 | 27 | 28 | Engine\UE3 29 | 30 | 31 | Engine 32 | 33 | 34 | Engine 35 | 36 | 37 | Engine\UE3 38 | 39 | 40 | Engine 41 | 42 | 43 | Engine\UE3 44 | 45 | 46 | Engine\UE3 47 | 48 | 49 | 50 | 51 | {5fb70966-5939-4bcf-b096-6b909315ed0d} 52 | 53 | 54 | {77ff275a-574c-4908-9ae5-345300346f41} 55 | 56 | 57 | 58 | 59 | 60 | 61 | Engine\UE3 62 | 63 | 64 | Engine 65 | 66 | 67 | Engine 68 | 69 | 70 | Engine 71 | 72 | 73 | Engine 74 | 75 | 76 | Engine 77 | 78 | 79 | Engine 80 | 81 | 82 | Engine 83 | 84 | 85 | Engine 86 | 87 | 88 | Engine 89 | 90 | 91 | Engine 92 | 93 | 94 | Engine\UE3 95 | 96 | 97 | Engine\UE3 98 | 99 | 100 | -------------------------------------------------------------------------------- /UnrealEngine4.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | x64 7 | 8 | 9 | Release 10 | x64 11 | 12 | 13 | 14 | {8421CC8C-A3DB-4F2F-9672-4DDAA9C9D391} 15 | Win32Proj 16 | UnrealEngine4 17 | 10.0.14393.0 18 | 19 | 20 | 21 | DynamicLibrary 22 | true 23 | v141 24 | Unicode 25 | 26 | 27 | DynamicLibrary 28 | false 29 | v141 30 | true 31 | Unicode 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | true 47 | $(SolutionDir)$(Platform)\$(Configuration)\Intermediate\$(ProjectName)\ 48 | 49 | 50 | false 51 | $(SolutionDir)$(Platform)\$(Configuration)\Intermediate\$(ProjectName)\ 52 | 53 | 54 | 55 | 56 | 57 | Level3 58 | Disabled 59 | _DEBUG;_WINDOWS;_USRDLL;UNREALENGINESDKGENERATOR_EXPORTS;NOMINMAX;WIN32_LEAN_AND_MEAN;UNREALENGINE_VERSION=0400;%(PreprocessorDefinitions) 60 | $(IntDir)%(RelativeDir)\ 61 | .\Engine;.\Engine\UE4 62 | 63 | 64 | Windows 65 | true 66 | 67 | 68 | 69 | 70 | Level3 71 | 72 | 73 | MaxSpeed 74 | true 75 | true 76 | NDEBUG;_WINDOWS;_USRDLL;UNREALENGINESDKGENERATOR_EXPORTS;NOMINMAX;WIN32_LEAN_AND_MEAN;UNREALENGINE_VERSION=0400;%(PreprocessorDefinitions) 77 | $(IntDir)%(RelativeDir)\ 78 | .\Engine;.\Engine\UE4 79 | 80 | 81 | Windows 82 | true 83 | true 84 | true 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /UnrealEngine4.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Engine 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | Engine 17 | 18 | 19 | Engine 20 | 21 | 22 | Engine 23 | 24 | 25 | Engine 26 | 27 | 28 | Engine\UE4 29 | 30 | 31 | Engine 32 | 33 | 34 | Engine 35 | 36 | 37 | Engine\UE4 38 | 39 | 40 | Engine\UE4 41 | 42 | 43 | Engine\UE4 44 | 45 | 46 | Engine 47 | 48 | 49 | 50 | 51 | {5fb70966-5939-4bcf-b096-6b909315ed0d} 52 | 53 | 54 | {77ff275a-574c-4908-9ae5-345300346f41} 55 | 56 | 57 | 58 | 59 | 60 | 61 | Engine\UE4 62 | 63 | 64 | Engine 65 | 66 | 67 | Engine 68 | 69 | 70 | Engine 71 | 72 | 73 | Engine 74 | 75 | 76 | Engine 77 | 78 | 79 | Engine 80 | 81 | 82 | Engine\UE4 83 | 84 | 85 | Engine\UE4 86 | 87 | 88 | Engine 89 | 90 | 91 | Engine 92 | 93 | 94 | Engine 95 | 96 | 97 | Engine 98 | 99 | 100 | -------------------------------------------------------------------------------- /UnrealEngineSdkGenerator.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27130.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnrealEngine1", "UnrealEngine1.vcxproj", "{17BAE508-B078-477A-9FC4-5A5B6F6EC2F4}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnrealEngine2", "UnrealEngine2.vcxproj", "{CE6021C4-A719-47D2-9A4E-FD26404AC34F}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnrealEngine3", "UnrealEngine3.vcxproj", "{41C536B5-2F0E-4232-8D0E-4B3CD17F69BB}" 11 | EndProject 12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnrealEngine4", "UnrealEngine4.vcxproj", "{8421CC8C-A3DB-4F2F-9672-4DDAA9C9D391}" 13 | EndProject 14 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7F7ABE9F-865E-4A84-A00B-41DA5014DBF6}" 15 | ProjectSection(SolutionItems) = preProject 16 | README.md = README.md 17 | EndProjectSection 18 | EndProject 19 | Global 20 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 21 | Debug|x64 = Debug|x64 22 | Debug|x86 = Debug|x86 23 | Release|x64 = Release|x64 24 | Release|x86 = Release|x86 25 | EndGlobalSection 26 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 27 | {17BAE508-B078-477A-9FC4-5A5B6F6EC2F4}.Debug|x64.ActiveCfg = Debug|Win32 28 | {17BAE508-B078-477A-9FC4-5A5B6F6EC2F4}.Debug|x86.ActiveCfg = Debug|Win32 29 | {17BAE508-B078-477A-9FC4-5A5B6F6EC2F4}.Debug|x86.Build.0 = Debug|Win32 30 | {17BAE508-B078-477A-9FC4-5A5B6F6EC2F4}.Release|x64.ActiveCfg = Release|Win32 31 | {17BAE508-B078-477A-9FC4-5A5B6F6EC2F4}.Release|x86.ActiveCfg = Release|Win32 32 | {17BAE508-B078-477A-9FC4-5A5B6F6EC2F4}.Release|x86.Build.0 = Release|Win32 33 | {CE6021C4-A719-47D2-9A4E-FD26404AC34F}.Debug|x64.ActiveCfg = Debug|Win32 34 | {CE6021C4-A719-47D2-9A4E-FD26404AC34F}.Debug|x86.ActiveCfg = Debug|Win32 35 | {CE6021C4-A719-47D2-9A4E-FD26404AC34F}.Debug|x86.Build.0 = Debug|Win32 36 | {CE6021C4-A719-47D2-9A4E-FD26404AC34F}.Release|x64.ActiveCfg = Release|Win32 37 | {CE6021C4-A719-47D2-9A4E-FD26404AC34F}.Release|x86.ActiveCfg = Release|Win32 38 | {CE6021C4-A719-47D2-9A4E-FD26404AC34F}.Release|x86.Build.0 = Release|Win32 39 | {41C536B5-2F0E-4232-8D0E-4B3CD17F69BB}.Debug|x64.ActiveCfg = Debug|Win32 40 | {41C536B5-2F0E-4232-8D0E-4B3CD17F69BB}.Debug|x86.ActiveCfg = Debug|Win32 41 | {41C536B5-2F0E-4232-8D0E-4B3CD17F69BB}.Debug|x86.Build.0 = Debug|Win32 42 | {41C536B5-2F0E-4232-8D0E-4B3CD17F69BB}.Release|x64.ActiveCfg = Release|Win32 43 | {41C536B5-2F0E-4232-8D0E-4B3CD17F69BB}.Release|x86.ActiveCfg = Release|Win32 44 | {41C536B5-2F0E-4232-8D0E-4B3CD17F69BB}.Release|x86.Build.0 = Release|Win32 45 | {8421CC8C-A3DB-4F2F-9672-4DDAA9C9D391}.Debug|x64.ActiveCfg = Debug|x64 46 | {8421CC8C-A3DB-4F2F-9672-4DDAA9C9D391}.Debug|x64.Build.0 = Debug|x64 47 | {8421CC8C-A3DB-4F2F-9672-4DDAA9C9D391}.Debug|x86.ActiveCfg = Debug|x64 48 | {8421CC8C-A3DB-4F2F-9672-4DDAA9C9D391}.Release|x64.ActiveCfg = Release|x64 49 | {8421CC8C-A3DB-4F2F-9672-4DDAA9C9D391}.Release|x64.Build.0 = Release|x64 50 | {8421CC8C-A3DB-4F2F-9672-4DDAA9C9D391}.Release|x86.ActiveCfg = Release|x64 51 | EndGlobalSection 52 | GlobalSection(SolutionProperties) = preSolution 53 | HideSolutionNode = FALSE 54 | EndGlobalSection 55 | GlobalSection(ExtensibilityGlobals) = postSolution 56 | SolutionGuid = {DBF820D7-5EAF-47F1-B1A1-6EE94E84AAD3} 57 | EndGlobalSection 58 | EndGlobal 59 | --------------------------------------------------------------------------------