Skip to content

Commit

Permalink
Update readme, remove map of types, add exception handler for Decrypt…
Browse files Browse the repository at this point in the history
…_ANSI
  • Loading branch information
guttir14 committed Aug 7, 2021
1 parent 57dd571 commit 6ec3f9e
Show file tree
Hide file tree
Showing 8 changed files with 228 additions and 378 deletions.
3 changes: 2 additions & 1 deletion Dumper/Dumper.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
<LanguageStandard>stdcpplatest</LanguageStandard>
<CallingConvention>FastCall</CallingConvention>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ExceptionHandling>Async</ExceptionHandling>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
Expand All @@ -87,7 +88,7 @@
<CallingConvention>FastCall</CallingConvention>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BufferSecurityCheck>false</BufferSecurityCheck>
<ExceptionHandling>Sync</ExceptionHandling>
<ExceptionHandling>Async</ExceptionHandling>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<StringPooling>true</StringPooling>
<StructMemberAlignment>Default</StructMemberAlignment>
Expand Down
13 changes: 2 additions & 11 deletions Dumper/defs.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#include <types.h>

#ifdef GetObject
#undef GetObject
Expand All @@ -18,14 +19,4 @@ enum class STATUS {
INVALID_IMAGE,
FILE_NOT_OPEN,
ZERO_PACKAGES
};

typedef signed char int8;
typedef short int16;
typedef int int32;
typedef long long int64;

typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;
};
209 changes: 49 additions & 160 deletions Dumper/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,64 +10,6 @@ Offsets offsets;
ansi_fn Decrypt_ANSI = nullptr;
// wide_fn Decrypt_WIDE = nullptr;

struct {
uint16 Stride = 4;
struct {
uint16 Size = 24;
} FUObjectItem;
struct {
uint16 Number = 8;
} FName;
struct {
uint16 Info = 4;
uint16 WideBit = 0;
uint16 LenBit = 1;
uint16 HeaderSize = 6;
} FNameEntry;
struct {
uint16 Index = 0xC;
uint16 Class = 0x10;
uint16 Name = 0x18;
uint16 Outer = 0x28;
} UObject;
struct {
uint16 Next = 0x30;
} UField;
struct {
uint16 SuperStruct = 0x48;
uint16 Children = 0x50;
uint16 ChildProperties = 0x58;
uint16 PropertiesSize = 0x60;
} UStruct;
struct {
uint16 Names = 0x48;
} UEnum;
struct {
uint16 FunctionFlags = 0xB8;
uint16 Func = 0xB8 + 0x28; // ue3-ue4, always +0x28 from flags location.
} UFunction;
struct {
uint16 Class = 0x8;
uint16 Next = 0x20;
uint16 Name = 0x28;
} FField;
struct {
uint16 ArrayDim = 0x38;
uint16 ElementSize = 0x3C;
uint16 PropertyFlags = 0x40;
uint16 Offset = 0x4C;
uint16 Size = 0x80;
} FProperty;
struct {
uint16 ArrayDim = 0;
uint16 ElementSize = 0;
uint16 PropertyFlags = 0;
uint16 Offset = 0;
uint16 Size = 0; // sizeof(UProperty)
} UProperty;
} DeadByDaylight;
static_assert(sizeof(DeadByDaylight) == sizeof(Offsets));

struct {
uint16 Stride = 2;
struct {
Expand Down Expand Up @@ -123,44 +65,44 @@ struct {
uint16 Offset = 0;
uint16 Size = 0; // sizeof(UProperty)
} UProperty;
} RogueCompany;
static_assert(sizeof(RogueCompany) == sizeof(Offsets));
} Default;
static_assert(sizeof(Default) == sizeof(Offsets));

struct {
uint16 Stride = 2;
uint16 Stride = 4;
struct {
uint16 Size = 24;
} FUObjectItem;
struct {
uint16 Number = 4;
uint16 Number = 8;
} FName;
struct {
uint16 Info = 0;
uint16 Info = 4;
uint16 WideBit = 0;
uint16 LenBit = 6;
uint16 HeaderSize = 2;
uint16 LenBit = 1;
uint16 HeaderSize = 6;
} FNameEntry;
struct {
uint16 Index = 0xC;
uint16 Class = 0x10;
uint16 Name = 0x18;
uint16 Outer = 0x20;
uint16 Outer = 0x28;
} UObject;
struct {
uint16 Next = 0x28;
uint16 Next = 0x30;
} UField;
struct {
uint16 SuperStruct = 0x40;
uint16 Children = 0x48;
uint16 ChildProperties = 0x50;
uint16 PropertiesSize = 0x58;
uint16 SuperStruct = 0x48;
uint16 Children = 0x50;
uint16 ChildProperties = 0x58;
uint16 PropertiesSize = 0x60;
} UStruct;
struct {
uint16 Names = 0x40;
uint16 Names = 0x48;
} UEnum;
struct {
uint16 FunctionFlags = 0xB0;
uint16 Func = 0xB0 + 0x30;
uint16 FunctionFlags = 0xB8;
uint16 Func = 0xB8 + 0x28; // ue3-ue4, always +0x28 from flags location.
} UFunction;
struct {
uint16 Class = 0x8;
Expand All @@ -172,7 +114,7 @@ struct {
uint16 ElementSize = 0x3C;
uint16 PropertyFlags = 0x40;
uint16 Offset = 0x4C;
uint16 Size = 0x78;
uint16 Size = 0x80;
} FProperty;
struct {
uint16 ArrayDim = 0;
Expand All @@ -181,13 +123,13 @@ struct {
uint16 Offset = 0;
uint16 Size = 0; // sizeof(UProperty)
} UProperty;
} Scavengers;
static_assert(sizeof(Scavengers) == sizeof(Offsets));
} DeadByDaylight;
static_assert(sizeof(DeadByDaylight) == sizeof(Offsets));

struct {
uint16 Stride = 2;
struct {
uint16 Size = 32;
uint16 Size = 24;
} FUObjectItem;
struct {
uint16 Number = 4;
Expand Down Expand Up @@ -218,7 +160,7 @@ struct {
} UEnum;
struct {
uint16 FunctionFlags = 0xB0;
uint16 Func = 0xB0 + 0x28;
uint16 Func = 0xB0 + 0x30;
} UFunction;
struct {
uint16 Class = 0x8;
Expand All @@ -239,13 +181,13 @@ struct {
uint16 Offset = 0;
uint16 Size = 0; // sizeof(UProperty)
} UProperty;
} Brickadia;
static_assert(sizeof(Brickadia) == sizeof(Offsets));
} Scavengers;
static_assert(sizeof(Scavengers) == sizeof(Offsets));

struct {
uint16 Stride = 2;
struct {
uint16 Size = 24;
uint16 Size = 32;
} FUObjectItem;
struct {
uint16 Number = 4;
Expand Down Expand Up @@ -297,67 +239,8 @@ struct {
uint16 Offset = 0;
uint16 Size = 0; // sizeof(UProperty)
} UProperty;
} Fortnite;
static_assert(sizeof(Fortnite) == sizeof(Offsets));


struct {
uint16 Stride = 2;
struct {
uint16 Size = 24;
} FUObjectItem;
struct {
uint16 Number = 4;
} FName;
struct {
uint16 Info = 0;
uint16 WideBit = 0;
uint16 LenBit = 6;
uint16 HeaderSize = 2;
} FNameEntry;
struct {
uint16 Index = 0xC;
uint16 Class = 0x10;
uint16 Name = 0x18;
uint16 Outer = 0x20;
} UObject;
struct {
uint16 Next = 0x28;
} UField;
struct {
uint16 SuperStruct = 0x40;
uint16 Children = 0x48;
uint16 ChildProperties = 0x50;
uint16 PropertiesSize = 0x58;
} UStruct;
struct {
uint16 Names = 0x40;
} UEnum;
struct {
uint16 FunctionFlags = 0xB0;
uint16 Func = 0xB0 + 0x28;
} UFunction;
struct {
uint16 Class = 0x8;
uint16 Next = 0x20;
uint16 Name = 0x28;
} FField;
struct {
uint16 ArrayDim = 0x38;
uint16 ElementSize = 0x3C;
uint16 PropertyFlags = 0x40;
uint16 Offset = 0x4C;
uint16 Size = 0x78;
} FProperty;
struct {
uint16 ArrayDim = 0;
uint16 ElementSize = 0;
uint16 PropertyFlags = 0;
uint16 Offset = 0;
uint16 Size = 0; // sizeof(UProperty)
} UProperty;
} TheIsle;
static_assert(sizeof(TheIsle) == sizeof(Offsets));
} Brickadia;
static_assert(sizeof(Brickadia) == sizeof(Offsets));

struct {
void* offsets; // address to filled offsets structure
Expand All @@ -366,7 +249,7 @@ struct {
std::function<bool(std::pair<uint8*, uint8*>*)> callback;
} engines[] = {
{ // RogueCompany | PropWitchHuntModule-Win64-Shipping | Scum
&RogueCompany,
&Default,
{"\x48\x8D\x0D\x00\x00\x00\x00\xE8\x00\x00\x00\x00\xC6\x05\x00\x00\x00\x00\x01\x0F\x10\x03\x4C\x8D\x44\x24\x20\x48\x8B\xC8", 30},
{"\x48\x8B\x05\x00\x00\x00\x00\x48\x8B\x0C\xC8\x48\x8D\x04\xD1\xEB", 16},
nullptr
Expand All @@ -390,13 +273,13 @@ struct {
nullptr
},
{ // POLYGON-Win64-Shipping
&RogueCompany,
&Default,
{"\x48\x8D\x35\x00\x00\x00\x00\xEB\x16", 9},
{"\x48\x8d\x1d\x00\x00\x00\x00\x39\x44\x24\x68", 11},
nullptr
},
{ // FortniteClient-Win64-Shipping
&Fortnite,
&Default,
{"\x4C\x8D\x35\x00\x00\x00\x00\x0F\x10\x07\x83\xFB\x01", 13},
{"\x48\x8B\x05\x00\x00\x00\x00\x48\x8B\x0C\xC8\x48\x8D\x04\xD1\xEB", 16},
[](std::pair<uint8*, uint8*>* s) {
Expand Down Expand Up @@ -424,26 +307,25 @@ struct {
return false;
}
},
{
// TheIsleClient-Win64-Shipping
&TheIsle,
{ // TheIsleClient-Win64-Shipping
&Default,
{"\x48\x8D\x05\x00\x00\x00\x00\xEB\x13", 9},
{"\x48\x8B\x05\x00\x00\x00\x00\x48\x8B\x0C\xC8\x48\x8D\x04\xD1\xEB\x03", 17},
nullptr
}
};

std::unordered_map<std::string, decltype(&engines[0])> games = {
{"RogueCompany", &engines[0]},
{"SCUM", &engines[0]},
{"PropWitchHuntModule-Win64-Shipping", &engines[0]},
{"HLL-Win64-Shipping", &engines[0]},
{"Scavenger-Win64-Shipping", &engines[1]},
{"DeadByDaylight-Win64-Shipping", &engines[2]},
{"Brickadia-Win64-Shipping", &engines[3]},
{"POLYGON-Win64-Shipping", &engines[4]},
{"FortniteClient-Win64-Shipping", &engines[5]},
{"TheIsleClient-Win64-Shipping", &engines[6]}
{"RogueCompany", &engines[0]},
{"SCUM", &engines[0]},
{"PropWitchHuntModule-Win64-Shipping", &engines[0]},
{"HLL-Win64-Shipping", &engines[0]},
{"Scavenger-Win64-Shipping", &engines[1]},
{"DeadByDaylight-Win64-Shipping", &engines[2]},
{"Brickadia-Win64-Shipping", &engines[3]},
{"POLYGON-Win64-Shipping", &engines[4]},
{"FortniteClient-Win64-Shipping", &engines[5]},
{"TheIsleClient-Win64-Shipping", &engines[6]}
};

STATUS EngineInit(std::string game, void* image) {
Expand Down Expand Up @@ -478,7 +360,14 @@ STATUS EngineInit(std::string game, void* image) {
ObjObjects = *(decltype(ObjObjects)*)objects;

auto entry = UE_FNameEntry(NamePoolData.GetEntry(0));
if (*(uint32*)entry.String().data() != 'enoN') return STATUS::ENGINE_FAILED;

// exception handler exclusively for Decrypt_ANSI
try {
if (*(uint32*)entry.String().data() != 'enoN') return STATUS::ENGINE_FAILED;
}
catch (...) {
return STATUS::ENGINE_FAILED;
}

return STATUS::SUCCESS;
}
4 changes: 2 additions & 2 deletions Dumper/generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ void FNamePool::DumpBlock(uint32 blockId, uint32 blockSize, std::function<void(s
}

void FNamePool::Dump(std::function<void(std::string_view, uint32)> callback) const {
for (uint32 i = 0u; i < CurrentBlock; i++) {
for (uint32 i = 0; i < CurrentBlock; i++) {
DumpBlock(i, offsets.Stride * 65536, callback);
}
DumpBlock(CurrentBlock, CurrentByteCursor, callback);
Expand Down Expand Up @@ -73,7 +73,7 @@ void TUObjectArray::ForEachObjectOfClass(const UE_UClass cmp, std::function<bool
}

bool TUObjectArray::IsObject(UE_UObject address) const {
for (uint32 i = 0u; i < NumElements; i++) {
for (uint32 i = 0; i < NumElements; i++) {
UE_UObject object = GetObjectPtr(i);
if (address == object) {
return true;
Expand Down
Loading

0 comments on commit 6ec3f9e

Please sign in to comment.