Skip to content

Commit

Permalink
Merge pull request #39 from Spuckwaffel/development
Browse files Browse the repository at this point in the history
version 1.8 Beta release
  • Loading branch information
Spuckwaffel authored Jan 22, 2024
2 parents 4f67a01 + a47f401 commit b35b04c
Show file tree
Hide file tree
Showing 26 changed files with 1,327 additions and 645 deletions.
344 changes: 234 additions & 110 deletions UEDumper/Engine/Core/Core.cpp

Large diffs are not rendered by default.

63 changes: 7 additions & 56 deletions UEDumper/Engine/Core/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,55 +35,6 @@ namespace EngineStructs

ENGINE_CORE EngineCore
{
public:



//objectinfo struct that holds the info of a defined struct/class/enum/function
struct ObjectInfo
{

enum ObjectType
{
OI_Struct,
OI_Class,
OI_Enum,
OI_Function,
OI_MAX
};

bool valid = false;

ObjectType type;

void* target = nullptr;;

operator bool() const { return valid; }

//converts the struct to a JSON object
nlohmann::json toJson() const
{
nlohmann::json j;
j["type"] = type;
j["valid"] = valid;
//j["packageIndex"] = packageIndex;
//j["objectIndex"] = objectIndex;
return j;
}

//returns a valid object from a JSON object
static ObjectInfo fromJson(nlohmann::json& json)
{
ObjectInfo j;
j.type = json["type"];
j.valid = json["valid"];
//j.packageIndex = json["packageIndex"];
//j.objectIndex = json["objectIndex"];
return j;
}
};


private:
#if UE_VERSION < UE_4_25
//pointer to GNames on heap
Expand Down Expand Up @@ -131,7 +82,7 @@ ENGINE_CORE EngineCore

//vector of all offsets that got defined by the user
inline static std::vector<Offset> offsets{};


/**
* \brief generates all the members for the specific struct or class
Expand Down Expand Up @@ -166,7 +117,7 @@ ENGINE_CORE EngineCore
* \param eStruct the struct where the cookedmembers array should be (re)generated
*/
static void cookMemberArray(EngineStructs::Struct& eStruct);

public:

/// constructors
Expand Down Expand Up @@ -205,13 +156,14 @@ ENGINE_CORE EngineCore
* \param CName CName of the UObject
* \return ObjectInfo of the UObject
*/
static ObjectInfo getInfoOfObject(const std::string& CName);
static const ObjectInfo* getInfoOfObject(const std::string& CName);



/**
* \brief USE ONLY AFTER PACKAGE GENERATION!
* This function lists all types that were used in structs but were never defined. (e.g TArray or TMap)
* This function lists all types that were used in structs but were never defined. (e.g TArray or TMap). Calling getInfoOfObject
* is fine too, this does the same but actually return a entire list
* \return vector of all unknown types
*/
static const std::vector<std::string>& getAllUnknownTypes();
Expand All @@ -227,7 +179,7 @@ ENGINE_CORE EngineCore

/**
* \brief USE ONLY BEFORE PACKAGE GENERATION! Creates a new struct that gets added to the BasicTypes package.
* Use this to create structs the game has but arent present in the SDK.
* Use this to create structs the game has but arent present in the SDK.
* \param eStruct the struct that gets created
*/
static void createStruct(const EngineStructs::Struct& eStruct);
Expand All @@ -253,7 +205,7 @@ ENGINE_CORE EngineCore

/**
* \brief ONLY AFTER FULL PACKAGE GENERATION!
* Saves all the states and data to disk into a .uedproj file that can get loaded
* Saves all the states and data to disk into a .uedproj file that can get loaded
*/
static void saveToDisk(int& progressDone, int& totalProgress);

Expand Down Expand Up @@ -300,4 +252,3 @@ ENGINE_CORE EngineCore
static bool generateFNameFile(int& progressDone, int& totalProgress);

};

99 changes: 93 additions & 6 deletions UEDumper/Engine/Core/EngineStructs.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,57 @@
#include <set>

#include "../structs.h"
#include "Engine/Userdefined/Datatypes.h"

//objectinfo struct that holds the info of a defined struct/class/enum/function
struct ObjectInfo
{

enum ObjectType
{
OI_Struct,
OI_Class,
OI_Enum,
OI_Function,
OI_MAX
};

bool valid = false;

ObjectType type;

void* target = nullptr;;

operator bool() const { return valid; }

//converts the struct to a JSON object
nlohmann::json toJson() const
{
nlohmann::json j;
j["type"] = type;
j["valid"] = valid;
//j["packageIndex"] = packageIndex;
//j["objectIndex"] = objectIndex;
return j;
}

//returns a valid object from a JSON object
static ObjectInfo fromJson(nlohmann::json& json)
{
ObjectInfo j;
j.type = json["type"];
j.valid = json["valid"];
//j.packageIndex = json["packageIndex"];
//j.objectIndex = json["objectIndex"];
return j;
}
};

//type struct that is used for a field in the package
struct fieldType
{
//linked info if valid
const ObjectInfo* info = nullptr;
//clickable if redirection is supported
bool clickable = false;
//typedef of the type
Expand All @@ -22,6 +69,23 @@ struct fieldType
//it makes it possible to click objects e.g in a TArray<x,y> for redirection
std::vector<fieldType> subTypes = {};

fieldType() {}

fieldType(bool clickable, PropertyType propertyType, const std::string& name)
{
this->clickable = clickable;
this->propertyType = propertyType;
this->name = name;
}

fieldType(bool clickable, PropertyType propertyType, const std::string& name, const std::vector<fieldType>& subTypes)
{
this->clickable = clickable;
this->propertyType = propertyType;
this->name = name;
this->subTypes = subTypes;
}

/**
* \brief essentially for dumpspace, gets the short type
* \return returns the short type of the fieldType (S, C, E, D)
Expand Down Expand Up @@ -63,10 +127,36 @@ struct fieldType
return arr;
}

//essentially for dumps.host
std::string stringify() const
{
std::string typeStr = name;

auto generateValidVarName = [](const std::string& str)
{
//hacky way to ignore shit like unsigned char get to unsigned_char
if (getSize(str) != -1)
return str;
std::string result = "";

for (const char c : str)
{
if (static_cast<int>(c) < 0 || !std::isalnum(c))
result += '_';
else
result += c;

}
//guaranteed 0 termination
return result;
};


std::string typeStr = generateValidVarName(name);

if ((propertyType == PropertyType::ObjectProperty || propertyType == PropertyType::ClassProperty) && (info && info->valid))
{
const std::string prefix = info->type == ObjectInfo::OI_Class ? "class " : "struct ";
typeStr = prefix + typeStr;
}

if (subTypes.size() > 0)
{
Expand All @@ -75,10 +165,7 @@ struct fieldType

for (int i = 0; i < subTypes.size(); i++)
{
typeStr += subTypes[i].name;

if (subTypes[i].propertyType == PropertyType::ObjectProperty || subTypes[i].propertyType == PropertyType::ClassProperty)
typeStr += "*";
typeStr += subTypes[i].stringify();

if (i < subTypes.size() - 1)
typeStr += ", ";
Expand Down
8 changes: 3 additions & 5 deletions UEDumper/Engine/Core/ObjectsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,10 @@ void ObjectsManager::copyUBigObjects(int64_t& finishedBytes, int64_t& totalBytes
uint64_t UObjectAddress = *reinterpret_cast<uint64_t*>(gUObjectManager.pGObjectPtrArray + i * 24);
//this happens quite often, those objects just got deleted
//the array is like a block of cheese with holes
if (!UObjectAddress)
{
windows::LogWindow::Log(windows::LogWindow::log_1, "ENGINECORE", "Could not resolve address for object %d!", i);
if (!UObjectAddress) {
windows::LogWindow::Log(windows::LogWindow::log_1, "ENGINECORE", "Could not resolve address for obect %d!", i);
}
else
{
else {
//gets the memory address where the objects gonna be
UObjectManager::UBigObject* newBigObject = reinterpret_cast<UObjectManager::UBigObject*>(gUObjectManager.pUBigObjectArray + i * sizeof(UObjectManager::UBigObject));
newBigObject->readSize = sizeof(UObject);
Expand Down
Loading

0 comments on commit b35b04c

Please sign in to comment.