Skip to content

Commit

Permalink
v1.1.4
Browse files Browse the repository at this point in the history
- Added a new engine folder for Dishonered, which contains all needed fields to generate an sdk for that game.
- Moved the "Printer.cpp/hpp" files to the "Framework" folder.
  • Loading branch information
ItsBranK committed May 5, 2024
1 parent 581f978 commit 79e18db
Show file tree
Hide file tree
Showing 18 changed files with 3,852 additions and 35 deletions.
4 changes: 2 additions & 2 deletions CodeRedGenerator.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@
<ClCompile Include="Engine\Template\GameDefines.cpp" />
<ClCompile Include="Engine\Template\PiecesOfCode.cpp" />
<ClCompile Include="Framework\Member.cpp" />
<ClCompile Include="Framework\Printer.cpp" />
<ClCompile Include="pch.cpp" />
<ClCompile Include="Printer.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="dllmain.hpp" />
Expand All @@ -157,8 +157,8 @@
<ClInclude Include="Engine\Template\GameDefines.hpp" />
<ClInclude Include="Engine\Template\PiecesOfCode.hpp" />
<ClInclude Include="Framework\Member.hpp" />
<ClInclude Include="Framework\Printer.hpp" />
<ClInclude Include="pch.hpp" />
<ClInclude Include="Printer.hpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
Expand Down
12 changes: 6 additions & 6 deletions CodeRedGenerator.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
<ClCompile Include="pch.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Printer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Framework\Member.cpp">
<Filter>Framework</Filter>
</ClCompile>
Expand All @@ -55,6 +52,9 @@
<ClCompile Include="Engine\Dishonered\Configuration.cpp">
<Filter>Engine\Dishonered</Filter>
</ClCompile>
<ClCompile Include="Framework\Printer.cpp">
<Filter>Framework</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Engine\Engine.hpp">
Expand All @@ -75,9 +75,6 @@
<ClInclude Include="pch.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Printer.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Framework\Member.hpp">
<Filter>Framework</Filter>
</ClInclude>
Expand All @@ -90,5 +87,8 @@
<ClInclude Include="Engine\Dishonered\PiecesOfCode.hpp">
<Filter>Engine\Dishonered</Filter>
</ClInclude>
<ClInclude Include="Framework\Printer.hpp">
<Filter>Framework</Filter>
</ClInclude>
</ItemGroup>
</Project>
328 changes: 328 additions & 0 deletions Engine/Dishonered/Configuration.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,328 @@
#include "Configuration.hpp"
#include "PiecesOfCode.hpp"

/*
# ========================================================================================= #
# Cosmetics
# ========================================================================================= #
*/

uint32_t GConfig::m_constantSpacing = 60;

uint32_t GConfig::m_commentSpacing = 30;

uint32_t GConfig::m_enumSpacing = 50;

uint32_t GConfig::m_classSpacing = 50;

uint32_t GConfig::m_structSpacing = 50;

uint32_t GConfig::m_functionSpacing = 50;

uint32_t GConfig::GetConstSpacing()
{
return m_constantSpacing;
}

uint32_t GConfig::GetCommentSpacing()
{
return m_commentSpacing;
}

uint32_t GConfig::GetEnumSpacing()
{
return m_enumSpacing;
}

uint32_t GConfig::GetClassSpacing()
{
return m_classSpacing;
}

uint32_t GConfig::GetStructSpacing()
{
return m_structSpacing;
}

uint32_t GConfig::GetFunctionSpacing()
{
return m_functionSpacing;
}

/*
# ========================================================================================= #
# Generator Settings
# ========================================================================================= #
*/

// If set to true this will auto include "Windows.h" in your sdk, along with renaming some windows functions that could conflict with windows macros.
bool GConfig::m_useWindows = true;

// If you want to use objects internal integer for finding static classes and functions, note that these will change every time the game updates.
bool GConfig::m_useConstants = false;

// If you want to remove the "iNative" index on functions before calling process event.
bool GConfig::m_removeNativeIndex = true;

// If you want to remove the "FUNC_Native" flag on functions before calling process event.
bool GConfig::m_removeNativeFlags = true;

// If you want the EFunctionFlags, EPropertyFlags, and EObjectFlags enums so be printed in the final sdk.
bool GConfig::m_printEnumFlags = true;

// If you want to use strongly typed enum classes over normal ones.
bool GConfig::m_useEnumClasses = true;

// Underlying enum type if you set "m_useEnumClasses" to true.
std::string GConfig::m_enumClassType = "uint8_t";

// Used to calculate property sizes and missed offsets.
uint32_t GConfig::m_gameAlignment = 0x4;

// Forced alignment used in the final sdk.
uint32_t GConfig::m_finalAlignment = 0x4;

// Names of classes or structs you don't want generated in the final sdk.
std::vector<std::string> GConfig::m_blacklistedTypes = { "FPointer", "FQWord", "FScriptDelegate" };

// Names of classes or structs you want to override with your own custom one.
std::map<std::string, std::string> GConfig::m_typeOverrides = {
//{ "FExampleStruct", PiecesOfTypes::Example_Struct }
};

bool GConfig::UsingWindows()
{
return m_useWindows;
}

bool GConfig::UsingConstants()
{
return m_useConstants;
}

bool GConfig::RemoveNativeIndex()
{
return m_removeNativeIndex;
}

bool GConfig::RemoveNativeFlags()
{
return m_removeNativeFlags;
}

bool GConfig::PrintEnumFlags()
{
return m_printEnumFlags;
}

bool GConfig::UsingEnumClasses()
{
return m_useEnumClasses;
}

const std::string& GConfig::GetEnumClassType()
{
return m_enumClassType;
}

uint32_t GConfig::GetGameAlignment()
{
return m_gameAlignment;
}

uint32_t GConfig::GetFinalAlignment()
{
return m_finalAlignment;
}

bool GConfig::IsTypeBlacklisted(const std::string& name)
{
if (!m_blacklistedTypes.empty() && !name.empty())
{
return (std::find(m_blacklistedTypes.begin(), m_blacklistedTypes.end(), name) != m_blacklistedTypes.end());
}

return false;
}

bool GConfig::IsTypeOveridden(const std::string& name)
{
if (!name.empty())
{
return m_typeOverrides.contains(name);
}

return false;
}

std::string GConfig::GetTypeOverride(const std::string& name)
{
if (IsTypeOveridden(name))
{
return m_typeOverrides[name];
}

return "";
}

/*
# ========================================================================================= #
# Process Event
# ========================================================================================= #
*/

// If you want to use "m_peIndex" change this to true, if not virutal voids will be generated from "m_peMask" and "m_pePattern".
bool GConfig::m_useIndex = true;

// Position where the process event function is in UObject's VfTable.
int32_t GConfig::m_peIndex = 59;

// Half byte mask, use question marks for unknown data.
std::string GConfig::m_peMask = "xxx???x";

// First value is the actual hex escaped pattern, second value is the string version of it printed in the final sdk.
std::pair<uint8_t*, std::string> GConfig::m_pePattern = { (uint8_t*)"\x10\x11\x12\x00\x00\x00\x13", "\\x10\\x11\\x12\\x00\\x00\\x00\\x13" };

bool GConfig::UsingProcessEventIndex()
{
return (m_useIndex && (m_peIndex != -1));
}

int32_t GConfig::GetProcessEventIndex()
{
return m_peIndex;
}

const std::string& GConfig::GetProcessEventMask()
{
return m_peMask;
}

uint8_t* GConfig::GetProcessEventPattern()
{
return m_pePattern.first;
}

const std::string& GConfig::GetProcessEventStr()
{
return m_pePattern.second;
}

/*
# ========================================================================================= #
# Global Objects & Names
# ========================================================================================= #
*/

// If want to use offsets or patterns to initialize global objects and names.
bool GConfig::m_useOffsets = true;

uintptr_t GConfig::m_gobjectOffset = 0x1023630;

// Half byte mask, use question marks for unknown data.
std::string GConfig::m_gobjectMask = "xxx???x";

// First value is the actual hex escaped pattern, second value is the string version of it printed in the final sdk.
std::pair<uint8_t*, std::string> GConfig::m_gobjectPattern = { (uint8_t*)"\x10\x11\x12\x00\x00\x00\x13", "\\x10\\x11\\x12\\x00\\x00\\x00\\x13" };

uintptr_t GConfig::m_gnameOffset = 0x1035674;

// Half byte mask, use question marks for unknown data.
std::string GConfig::m_gnameMask = "xxx???x";

// First value is the actual hex escaped pattern, second value is the string version of it printed in the final sdk.
std::pair<uint8_t*, std::string> GConfig::m_gnamePattern = { (uint8_t*)"\x10\x11\x12\x00\x00\x00\x13", "\\x10\\x11\\x12\\x00\\x00\\x00\\x13" };

bool GConfig::UsingOffsets()
{
return m_useOffsets;
}

uintptr_t GConfig::GetGObjectOffset()
{
return m_gobjectOffset;
}

uint8_t* GConfig::GetGObjectPattern()
{
return m_gobjectPattern.first;
}

const std::string& GConfig::GetGObjectStr()
{
return m_gobjectPattern.second;
}

const std::string& GConfig::GetGObjectMask()
{
return m_gobjectMask;
}

uintptr_t GConfig::GetGNameOffset()
{
return m_gnameOffset;
}

uint8_t* GConfig::GetGNamePattern()
{
return m_gnamePattern.first;
}

const std::string& GConfig::GetGNameStr()
{
return m_gnamePattern.second;
}

const std::string& GConfig::GetGNameMask()
{
return m_gnameMask;
}

/*
# ========================================================================================= #
# Game Info
# ========================================================================================= #
*/

// Mainly just used for the printed headers at the top of each generated file.
std::string GConfig::m_gameNameLong = "Dishonered";

// This is used for the output folder name, along with the printed headers at the top of each file.
std::string GConfig::m_gameNameShort = "DSDK";

// Optional, mainly for your own sake, like comparing sdks you generate or release to people.
std::string GConfig::m_gameVersion = "1.0.0.0";

// Directory folder that your want your sdk to be generated in.
std::filesystem::path GConfig::m_outputPath = "I_FORGOT_TO_SET_A_PATH";

const std::string& GConfig::GetGameNameLong()
{
return m_gameNameLong;
}

const std::string& GConfig::GetGameNameShort()
{
return m_gameNameShort;
}

const std::string& GConfig::GetGameVersion()
{
return m_gameVersion;
}

const std::filesystem::path& GConfig::GetOutputPath()
{
return m_outputPath;
}

bool GConfig::HasOutputPath()
{
return (!GetOutputPath().string().empty() && (GetOutputPath().string() != "I_FORGOT_TO_SET_A_PATH"));
}

/*
# ========================================================================================= #
#
# ========================================================================================= #
*/
Loading

0 comments on commit 79e18db

Please sign in to comment.