Added much stuff, including working Config System and Test System to Mount pak files and then Load its Content. (Loads Pak File and Mounts it but couldnt load any stuff from my Custom Pak yet)

This commit is contained in:
Unknown 2024-06-26 22:23:20 +02:00
parent f785e17b48
commit cc69714429
13 changed files with 2023 additions and 501 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,256 @@
#pragma once
#include "SDK/SDK.hpp"
#include <vector>
namespace Functions {
static void memcpy_(void* _Dst, void const* _Src, size_t _Size)
{
auto csrc = (char*)_Src;
auto cdest = (char*)_Dst;
for (int i = 0; i < _Size; i++)
{
cdest[i] = csrc[i];
}
}
//Generally just for checking dont call raw
DWORD GetMemoryProtection(LPVOID address)
{
MEMORY_BASIC_INFORMATION memInfo;
VirtualQuery(address, &memInfo, sizeof(memInfo));
return memInfo.Protect;
}
bool ShouldUsePointer64(void* ptrF) {
uintptr_t ptr = (uintptr_t)ptrF;
if (ptr == 0x0 || ptr < 0x10000000 || ptr > 0x7fffffffffff || GetMemoryProtection(reinterpret_cast<LPVOID>(ptr)) == PAGE_NOACCESS) return false;
return true;
}
template<typename T4>
bool WriteMemW(uintptr_t ptr, T4 const& Value) {
if (ptr < 0x10000000 || ptr > 0x7fffffffffff) return false;
DWORD d, ds;
int val2;
VirtualProtect((LPVOID)ptr, sizeof(Value), PAGE_EXECUTE_READWRITE, &d);
*reinterpret_cast<T4*>(ptr) = Value;
VirtualProtect((LPVOID)ptr, sizeof(Value), d, &ds);
return true;
}
template<typename T3>
bool ReadMemW(uintptr_t ptr, T3& Value) {
if (ptr < 0x10000000 || ptr > 0x7fffffffffff || GetMemoryProtection(reinterpret_cast<LPVOID>(ptr)) == PAGE_NOACCESS) return false;
DWORD d, ds;
int val2;
VirtualProtect((LPVOID)ptr, sizeof(Value), PAGE_EXECUTE_READWRITE, &d);
Value = *reinterpret_cast<T3*>(ptr);
VirtualProtect((LPVOID)ptr, sizeof(Value), d, &ds);
return true;
}
uintptr_t ChangePointer(uintptr_t ptr, int Index, uintptr_t Value) {
uintptr_t ptrAddr = ptr + (0x8 * Index);
uintptr_t* blabla = (uintptr_t*)ptrAddr;
uintptr_t AddressBefore = *blabla;
WriteMemW(ptrAddr, Value);
return AddressBefore;
}
std::vector<byte> GetFunctionSig(void* FunctionPtr, size_t sigsize) {
std::vector<byte> FunctionSig(sigsize);
if (FunctionSig.size() == sigsize && Functions::ShouldUsePointer64(FunctionPtr)) {
for (size_t i = 0; i < sigsize; i++)
{
auto FunctionAddress = (uintptr_t)(FunctionPtr)+i;
if (!Functions::ShouldUsePointer64((void*)(FunctionAddress)))break;
Functions::ReadMemW(FunctionAddress, FunctionSig[i]);
}
}
else
FunctionSig.empty(); //return empty vector to indicate no data could be read
return FunctionSig;
}
//returns a number from 0-100 indicating how much the sig is the same from the one comparing
int CompareFunctionSigs(std::vector<byte> source1, std::vector<byte> source2) {
int procentage = 0;
size_t sigLength = (source1.size() >= source2.size() ? source1.size() : source2.size());
for (size_t i = 0; i < sigLength; i++)
{
if (source1[i] == source2[i])
procentage++;
}
return ((procentage / sigLength) * 100);
}
}
namespace Cheat {
class FPlatformFileManager
{
/** Currently used platform file. */
void* TopmostPlatformFile;
public:
/** Constructor. */
virtual FPlatformFileManager* construct();
/**
* Gets the currently used platform file.
*
* @return Reference to the currently used platform file.
*/
virtual void GetPlatformFile();
/**
* Sets the current platform file.
*
* @param NewTopmostPlatformFile Platform file to be used.
*/
virtual void SetPlatformFile(void* NewTopmostPlatformFile);
/**
* Finds a platform file in the chain of active platform files.
*
* @param Name of the platform file.
* @return Pointer to the active platform file or nullptr if the platform file was not found.
*/
virtual void* FindPlatformFile(const wchar_t* Name);
/**
* Creates a new platform file instance.
*
* @param Name of the platform file to create.
* @return Platform file instance of the platform file type was found, nullptr otherwise.
*/
virtual void* GetPlatformFile(const wchar_t* Name);
/**
* calls Tick on the platform files in the TopmostPlatformFile chain
*/
virtual void TickActivePlatformFile();
/**
* Performs additional initialization when the new async IO is enabled.
*/
virtual void InitializeNewAsyncIO();
/**
* Removes the specified file wrapper from the platform file wrapper chain.
*
* THIS IS EXTREMELY DANGEROUS AFTER THE ENGINE HAS BEEN INITIALIZED AS WE MAY BE MODIFYING
* THE WRAPPER CHAIN WHILE THINGS ARE BEING LOADED
*
* @param The platform file to remove.
*/
virtual void RemovePlatformFile(void* PlatformFileToRemove);
/**
* Inserts a new platform file into the platform file wrapper chain.
* The file is inserted before NewPlatformFile->GetLowerLevel().
*
* THIS IS EXTREMELY DANGEROUS AFTER THE ENGINE HAS BEEN INITIALIZED AS WE MAY BE MODIFYING
* THE WRAPPER CHAIN WHILE THINGS ARE BEING LOADED
*
* @param The platform file to insert.
* @return true if the platform file was inserted.
*/
virtual bool InsertPlatformFile(void* NewPlatformFile);
};
struct FStaticConstructObjectParameters
{
/** The class of the object to create */
const SDK::UClass* Class;
/** The object to create this object within (the Outer property for the new object will be set to the value specified here). */
SDK::UObject* Outer;
/** The name to give the new object.If no value(NAME_None) is specified, the object will be given a unique name in the form of ClassName_#. */
SDK::FName Name;
/** The ObjectFlags to assign to the new object. some flags can affect the behavior of constructing the object. */
int SetFlags;
/** The InternalObjectFlags to assign to the new object. some flags can affect the behavior of constructing the object. */
unsigned int InternalSetFlags;
/** If true, copy transient from the class defaults instead of the pass in archetype ptr(often these are the same) */
bool bCopyTransientsFromClassDefaults = false;
/** If true, Template is guaranteed to be an archetype */
bool bAssumeTemplateIsArchetype = false;
/**
* If specified, the property values from this object will be copied to the new object, and the new object's ObjectArchetype value will be set to this object.
* If nullptr, the class default object is used instead.
*/
SDK::UObject* Template = nullptr;
/** Contains the mappings of instanced objects and components to their templates */
void* InstanceGraph = nullptr;
/** Assign an external Package to the created object if non-null */
SDK::UPackage* ExternalPackage = nullptr;
};
class AudioData : public SDK::TArray<int8>
{
public:
AudioData(std::vector<int8> Bytes) {
TArray(Bytes.size());
if (Data) {
std::memcpy(Data, Bytes.data(), (sizeof(int8) * this->MaxElements));
}
}
~AudioData() {
if (Data)
delete[] Data;
}
};
typedef SDK::UObject* (__fastcall* fStaticConstructObject_Internal)(FStaticConstructObjectParameters* Params);
typedef SDK::UObject* (__fastcall* fStaticLoadObject_Internal)(SDK::UClass* Class, SDK::UObject* InOuter_Optional, const wchar_t* NameOfObject, const wchar_t* FileName_Optional, uint32 LoadFlags, SDK::UPackageMap* Sandbox_Needed, bool AllowObjectReconciliation, void* InstancingContext);
typedef FPlatformFileManager* (__fastcall* fFPlatformFileManager$$Get)();
typedef void* (__fastcall* fFPakPlatformFile$$FindPlatformFile)(FPlatformFileManager* this_, const wchar_t* FileName);
typedef bool(__fastcall* fFPakPlatformFile$$Mount)(void* this_, const wchar_t* PakFilename, int32 PakOrder, const wchar_t* MountPoint, bool bLoadIndex);
static fStaticConstructObject_Internal StaticConstructObject_Internal;
static fStaticLoadObject_Internal StaticLoadObject_Internal;
static fFPlatformFileManager$$Get FPlatformFileManager$$Get;
static fFPakPlatformFile$$FindPlatformFile FPakPlatformFile$$FindPlatformFile;
static fFPakPlatformFile$$Mount FPakPlatformFile$$Mount;
static SDK::UConsole* ConstructConsole(SDK::UClass* ConsoleClass, SDK::UObject* outer)
{
FStaticConstructObjectParameters params = { ConsoleClass, outer, SDK::FName{0,0}, 0, 0, false, false, nullptr, nullptr, nullptr };
return reinterpret_cast<SDK::UConsole*>(StaticConstructObject_Internal(&params));
}
}

View File

@ -0,0 +1,415 @@
#include "Config.h"
#include <iostream>
bool ConfigSystem::InternalConfigSystem(std::string ConfigName, std::string Path) {
this->ConfigSettingsInternal = new ConfigSystemInternalSettings();
if (Path == "")
Path = this->ConfigSettingsInternal->ConfigPath;
this->failed = false;
this->LastErrors.clear();
if (!std::filesystem::exists(Path))
{
FailConfig("Couldn't finish Internal Config System, Input Path doesn't Exist!");
return false;
}
try {
std::filesystem::create_directory(Path);
// Get existing config files
for (const auto& entry : std::filesystem::directory_iterator(Path)) {
if (entry.path().extension() == ConfigSettingsInternal->ExtensionConfig) {
Configs.push_back(entry);
}
}
return ActivateConfig(ConfigName, Path);
}
catch (const std::exception& e) {
#if Debug
std::cerr << "Error in InternalConfigSystem: " << e.what() << std::endl;
#endif
return false;
}
}
#if Debug
std::vector<unsigned char> ByteArray;
#endif
bool ConfigSystem::ActivateConfig(std::string ConfigName,std::string Path) {
if (!std::filesystem::exists(Path))
{
FailConfig("Failed to ActivateConfig, Input Path doesn't Exist!");
return false;
}
std::string ConfigFileName = ConfigName + "." + ConfigSettingsInternal->ExtensionConfig;
std::string ConfigPath_ = Path + "/" + ConfigFileName;
std::ifstream ConfigOut(ConfigPath_, std::ios::binary);
std::vector<Field_Config> Fields;
bool result = false;
LastConfigName.clear();
LastPath.clear();
FieldReferences.clear();
if (ConfigOut.is_open()) {
// Get file size
ConfigOut.seekg(0, std::ios::end);
auto ByteNumb = ConfigOut.tellg();
ConfigOut.seekg(0, std::ios::beg);
std::vector<unsigned char> buffer(ByteNumb);
if (!buffer.empty()) {
ConfigOut.read((char*)buffer.data(), ByteNumb);
#if Debug
for (size_t i = 0; i < ByteArray.size(); i++)
{
if (ByteArray[i] != buffer[i]) {
std::cout << "Byte is not the same! At: " << i << "\n";
break;
}
}
std::cout << "Read out Data size of: " << ByteNumb << " Bytes!\n";
#endif
size_t FieldStructSize = sizeof(Field_Config);
size_t BuffSize = buffer.size();
for (size_t i = 0, b_ = 0; i < BuffSize && b_ < ConfigSettingsInternal->MaxFieldCount; b_++) {
try {
Fields.push_back(Field_Config(this->ConfigSettingsInternal, buffer, i));
} catch (const std::exception& e) {
#if Debug
std::cerr << "Error: " << e.what() << "\n";
#endif
break;
}
}
}
ConfigOut.close();
result = true;
}
if (!result) {
std::ofstream some_(ConfigPath_);
if (some_.is_open())
result = true;
some_.close();
}
if (result) {
LastConfigName = ConfigFileName;
LastPath = Path;
this->Fields = Fields;
}
return result;
}
//Writes Data retrieved from Config File to corresponding Fields
bool ConfigSystem::WriteToFields() {
bool wroteField = false;
for (auto& FieldCurrent : FieldReferences) {
if (FieldCurrent.OwningConfigField) {
wroteField = true;
std::memcpy(FieldCurrent.PtrToOwningField, FieldCurrent.OwningConfigField->Data.data(), FieldCurrent.TypeSize);
}
else {
for (const auto& FieldRealCurrent : Fields) {
if (FieldCurrent.ID == FieldRealCurrent.ID) {
wroteField = true;
std::memcpy(FieldCurrent.PtrToOwningField, FieldRealCurrent.Data.data(), FieldCurrent.TypeSize);
break;
}
}
}
}
return wroteField;
}
//Writes Fields to the Config Files
void ConfigSystem::WriteToConfigFile() {
if (LastPath.empty() || failed)
return;
std::ofstream Config(LastPath + "/" + LastConfigName, std::ios::binary);
if (Config.is_open()) {
std::vector<char> DataBuf;
for (auto FieldRef : FieldReferences) {
auto FieldData = std::vector<unsigned char>(FieldRef.FieldToChars());
#if Debug
bool DataValid = false;
try
{
size_t index = 0;
Field_Config test_(FieldData, index);
DataValid = true;
}
catch (const std::exception&)
{
}
std::cout << "Data check: " << (DataValid ? "true" : "false") << "\n";
#endif
DataBuf.insert(DataBuf.begin(), FieldData.begin(), FieldData.end());
}
#if Debug
ByteArray.insert(ByteArray.begin(), DataBuf.begin(), DataBuf.end());
std::cout << "Wrote " << DataBuf.size() << " Bytes to File!\n";
std::cout << std::to_string(DataBuf[352]) << "\n";
std::cout << std::to_string(DataBuf[353]) << "\n";
#endif
Config.clear();
for (size_t i = 0; i < DataBuf.size(); i++)
{
Config << DataBuf[i];
}
//Config.write(DataBuf.data(), DataBuf.size());
Config.close();
}
}
//Call this Function only after Adding the Fields and having all Fields inside a File, else this function just does nothing except write back already existing data to the Config ._.
void ConfigSystem::WriteToConfigFile(int ID) {
if (LastPath.empty())
return;
std::ofstream Config(LastPath + "/" + LastConfigName,std::ios::binary);
if (Config.is_open()) {
std::vector<char> DataBuf;
for (auto Field_ : Fields) {
if (Field_.ID == ID)
continue;
if (DataBuf.size() > 300) {
Config.write(DataBuf.data(), DataBuf.size());
DataBuf.clear();
}
try {
auto out_ = Field_.ToCharType(this->ConfigSettingsInternal);
DataBuf.insert(DataBuf.begin(), out_.begin(), out_.end());
}
catch (const std::exception&) {
}
}
for (auto FieldRef : FieldReferences) {
if (FieldRef.ID == ID) {
auto FieldData = FieldRef.FieldToChars();
DataBuf.insert(DataBuf.begin(), FieldData.begin(), FieldData.end());
break;
}
}
Config.write(DataBuf.data(), DataBuf.size());
Config.close();
}
}
//Resizes the Field that got added to the System. (use for Types that are Dynamically Sized)
void ConfigSystem::ResizeField(size_t Size, int ID)
{
for (auto& RefField : FieldReferences)
{
if (RefField.ID == ID)
{
RefField.TypeSize = Size;
return;
}
}
}
//Returns an list of Errors that happened on the System. (Use this to find out what went wrong to the Config System)
std::vector<std::string> ConfigSystem::GetLastErrors()
{
std::vector<std::string> Errors = LastErrors;
if (LastErrors.size() > 0)
LastErrors.clear();
return Errors;
}
//Checks if from Config Loaded Field exists
bool ConfigSystem::IsFieldExisting(int ID)
{
auto FieldListSize = this->Fields.size();
for (size_t i = 0; i < FieldListSize; i++)
{
if (this->Fields[i].ID == ID) return true;
}
return false;
}
//Calls when something goes wrong and the System cant continue
void ConfigSystem::FailConfig(std::string Reason, bool FailConfigSystem)
{
if(FailConfigSystem)
this->failed = true;
#if Debug == true
std::cout << "[~Error] : " << Reason << "\n";
#else
this->LastErrors.push_back(Reason);
#endif
}
ConfigSystem::ConfigSystem(std::string ConfigName) {
if (!InternalConfigSystem(ConfigName, ""));
FailConfig("Internal ConfigSystem failed!");
}
ConfigSystem::ConfigSystem(std::string ConfigName, std::string path) {
if (!InternalConfigSystem(ConfigName, path));
FailConfig("Internal ConfigSystem failed!");
}
std::wstring ConfigSystem::GetCurrentConfigNameW() {
std::wstring wstr(LastConfigName.length(), L' ');
std::copy(LastConfigName.begin(), LastConfigName.end(), wstr.begin());
return wstr;
}
std::string ConfigSystem::GetCurrentConfigName() {
return LastConfigName;
}
ByteType::ByteType(ConfigSystemInternalSettings* configSettings, std::vector<unsigned char> Data, size_t& Index) {
const int Size_t_Size = sizeof(size_t);
std::string Message = "Couldn't Create ByteType, because ";
unsigned char* Data_Copy = nullptr;
size_t FieldSize = 0;
Data_Copy = (unsigned char*)&FieldSize;
// Check if there's enough data to read
if (Data.size() - Index < Size_t_Size) {
throw std::exception((Message + "Not enough data to read size").c_str());
}
//Get Size of Field
for (size_t i = 0; i < Size_t_Size; i++, Index++) {
Data_Copy[i] = Data[Index];
}
if (FieldSize > configSettings->MaxTypeSize) {
throw std::exception((Message + "Data was Bigger than allowed Size!").c_str());
}
else if (FieldSize <= 0) {
throw std::exception((Message + "Data was Invalid!").c_str());
}
Size = FieldSize;
// Get Data of Field
for (size_t i = 0; i < FieldSize; i++, Index++) {
this->Data.push_back(Data[Index]);
}
}
//Dont call Directly, Internal Config System uses Protection and fail checks, calling raw doesnt use these Checks
Field_Config::Field_Config(ConfigSystemInternalSettings* configSettings, std::vector<unsigned char> Data, size_t& Index)
{
if (Data.size() - 1 < Index + sizeof(size_t) + 1)
throw std::exception(std::string("Data was Invalid, ini" + std::to_string(Data.size()) + ", max:" + std::to_string(Index + sizeof(size_t) + 1)).c_str()); // Throwing a proper exception
ByteType normalType = ByteType(configSettings, Data, Index);
ByteType idType = ByteType(configSettings, Data, Index);
this->Data = normalType.Data;
this->FieldSize = normalType.Size;
this->ID = idType.GetType<int>();
}
std::vector<char> Field_Config::ToCharType(ConfigSystemInternalSettings* configSettings)
{
if (this->FieldSize >= configSettings->MaxTypeSize || this->Data.size() != (this->FieldSize + 1))
throw std::exception("Field Data was faulty, couldnt create Data!");
size_t size_size_t = sizeof(size_t);
size_t size_int = sizeof(int);
size_t total_size = size_size_t + this->FieldSize + size_size_t + size_int;
// Allocate vector with the correct size
std::vector<char> Data_(total_size);
// Copy the TypeSize
std::memcpy(Data_.data(), &this->FieldSize, size_size_t);
// Copy the field data pointed by PtrToOwningField
std::memcpy(Data_.data() + size_size_t, this->Data.data(), this->FieldSize);
// Copy the size of int (though this seems unnecessary)
std::memcpy(Data_.data() + size_size_t + this->FieldSize, &size_int, size_size_t);
// Copy the ID
std::memcpy(Data_.data() + size_size_t + this->FieldSize + size_size_t, &ID, size_int);
return Data_;
}
std::vector<unsigned char> FieldOwning::FieldToChars()
{
size_t size_size_t = sizeof(size_t);
size_t size_int = sizeof(int);
size_t total_size = size_size_t + TypeSize + size_size_t + size_int;
// Allocate vector with the correct size
std::vector<unsigned char> Data_(total_size);
// Copy the TypeSize
std::memcpy(Data_.data(), &TypeSize, size_size_t);
// Copy the field data pointed by PtrToOwningField
std::memcpy(Data_.data() + size_size_t, PtrToOwningField, TypeSize);
// Copy the size of int (though this seems unnecessary)
std::memcpy(Data_.data() + size_size_t + TypeSize, &size_int, size_size_t);
// Copy the ID
std::memcpy(Data_.data() + size_size_t + TypeSize + size_size_t, &ID, size_int);
return Data_;
}

View File

@ -0,0 +1,168 @@
#pragma once
#include <iostream>
#include <filesystem>
#include <string>
#include <vector>
#include <fstream>
#include <functional>
struct ConfigSystemInternalSettings {
//Adjust Values how ever is needed!
int MaxTypeSize = 25; //The Max Byte Size of an Type that can be added and used
int MaxFieldCount = 70; //The Max amount of Fields that get Loaded
std::string ConfigPath = R"(C:/EscapeInternal)"; //The Directory that stores the Safefiles and reads them from
std::string ExtensionConfig = "escp"; //the extension of the file we wanna make. (if you wanna ignore some values or some
};
//for debugging Purposes obviously
#define Debug false
//if your scared of fucking something up make this to true
#define IdkMode false
inline std::vector < std::pair<void*, int> > FieldRefs;
//
//#if Debug == true
//using EventHandler = std::function<void(std::string Error)>;
//EventHandler PrintOutError_Config;
//#endif
struct ByteType {
size_t Size = 0;
std::vector<unsigned char> Data;
ByteType(ConfigSystemInternalSettings* configSettings, std::vector<unsigned char> Data, size_t& Index);
template <typename T>
static std::vector<unsigned char> TypeToByteType_Char(T type) {
const int size_ = sizeof(size_t);
auto Size_ = sizeof(T);
auto Data_ = std::vector<unsigned char>(size_ + Size_);
std::memcpy(Data_.data(), &Size_, size_);
std::memcpy((void*)((uintptr_t)Data_.data() + size_), &type, Size_);
return Data_;
}
template <typename T>
T GetType() {
T typeOut = T();
auto TypeSize = sizeof(T);
if (Size >= TypeSize && Size <= TypeSize)
std::memcpy(&typeOut, Data.data(), Size);
return typeOut;
}
};
struct Field_Config {
size_t FieldSize = 0;
std::vector<unsigned char> Data;
int ID = -1;
Field_Config(ConfigSystemInternalSettings* configSettings, std::vector<unsigned char> Data, size_t& Index);
std::vector<char> ToCharType(ConfigSystemInternalSettings* configSettings);
};
struct FieldOwning {
size_t TypeSize = 0;
void* PtrToOwningField = nullptr;
Field_Config* OwningConfigField = nullptr;
int ID = -1;
FieldOwning(size_t TypeSize, void* FieldPtr, int ID) {
this->TypeSize = TypeSize;
this->ID = ID;
this->PtrToOwningField = FieldPtr;
}
std::vector<unsigned char> FieldToChars();
};
class ConfigSystem
{
private:
std::vector<Field_Config> Fields;
std::vector<std::filesystem::directory_entry> Configs;
std::vector<FieldOwning> FieldReferences;
std::string LastPath = "";
std::string LastConfigName = "";
std::vector<std::string> LastErrors;
bool failed = false;
ConfigSystemInternalSettings* ConfigSettingsInternal = nullptr;
bool InternalConfigSystem(std::string ConfigName, std::string Path);
bool IsFieldExisting(int ID);
void FailConfig(std::string Reason, bool FailConfigSystem = false);
public:
ConfigSystem(std::string ConfigName);
ConfigSystem(std::string ConfigName, std::string Path);
~ConfigSystem() {
delete ConfigSettingsInternal;
}
std::vector<std::string> GetLastErrors();
//See if the Config System has failed anywhere
bool hasConfigFailed() { return failed; };
//Call when switching Configs
bool ActivateConfig(std::string ConfigName, std::string Path);
bool WriteToFields();
void WriteToConfigFile();
void WriteToConfigFile(int ID);
void ResizeField(size_t Size, int ID);
std::wstring GetCurrentConfigNameW();
std::string GetCurrentConfigName();
//Settings shit
std::string GetSettingsPath() { return this->ConfigSettingsInternal->ConfigPath; };
std::string GetSettingsExtension() { return this->ConfigSettingsInternal->ExtensionConfig;};
int GetSettingsMaxTypeSize() { return this->ConfigSettingsInternal->MaxTypeSize; };
int GetSettingsMaxFieldCount() { return this->ConfigSettingsInternal->MaxFieldCount; };
void SetSettingsPath(std::string Path) { this->ConfigSettingsInternal->ConfigPath = Path; };
void SetSettingsExtension(std::string Extension) { this->ConfigSettingsInternal->ExtensionConfig = Extension; };
void SetSettingsMaxTypeSize(int MaxTypeSize) { this->ConfigSettingsInternal->MaxTypeSize = MaxTypeSize; };
void SetSettingsMaxFieldCount(int MaxFieldCount) { this->ConfigSettingsInternal->MaxFieldCount = MaxFieldCount; };
//void* FindConfigField
//Adding Fields with the Same ID will result in weird behaviour
template <typename T>
void AddField(T* type, int ID) {
#if Babymode == true
for (auto& RefField : FieldReferences)
{
if (RefField.ID == ID)
{
#if Debug == true
std::cout << "AddField failed! An Field with the Same ID was already Added. ID: " << ID << "\n";
#endif
return;
}
}
#endif
FieldOwning in(sizeof(T), type, ID);
for (auto& field : Fields) {
if (field.ID == ID) {
in.OwningConfigField = &field;
break;
}
}
FieldReferences.push_back(in);
}
};

View File

@ -91,7 +91,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;$(LibraryPath)</LibraryPath>
<ExternalIncludePath>C:\Users\sonny\Downloads\backgroundpng\Out;$(ExternalIncludePath)</ExternalIncludePath>
<ExternalIncludePath>U:\DCInParis\EscapeTheBackroomsGUiTest\EscapeTheBackroomsGUiTest\Out;$(ExternalIncludePath)</ExternalIncludePath>
</PropertyGroup>
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<VcpkgUseStatic>true</VcpkgUseStatic>
@ -185,6 +185,8 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="Cheat.h" />
<ClInclude Include="CheatDefines.h" />
<ClInclude Include="Config.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="HostModifiers.h" />
<ClInclude Include="Out\File0.h" />
@ -2216,6 +2218,7 @@
<ClInclude Include="Settings.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Config.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
@ -2287,6 +2290,9 @@
<ClCompile Include="SDK\SDK\MP_PlayerController_functions.cpp" />
<ClCompile Include="SDK\SDK\MP_PoolRooms_functions.cpp" />
<ClCompile Include="SDK\SDK\MP_PS_functions.cpp" />
<ClCompile Include="SDK\SDK\MP_Thallasophobia_functions.cpp" />
<ClCompile Include="SDK\SDK\Paper2D_functions.cpp" />
<ClCompile Include="SDK\SDK\SubtitleTextWB_functions.cpp" />
<ClCompile Include="SDK\SDK\UMG_functions.cpp" />
<ClCompile Include="SDK\SDK\WB_ChatMessage_functions.cpp" />
<ClCompile Include="SDK\SDK\WB_Chat_functions.cpp" />

View File

@ -28,6 +28,12 @@
<Filter Include="Headerdateien\Data\ContainingImageData">
<UniqueIdentifier>{95e8b4c8-8ffc-4072-bbbf-ccc60f9ec0d2}</UniqueIdentifier>
</Filter>
<Filter Include="Quelldateien\Config">
<UniqueIdentifier>{bba920a8-d176-4373-8ff3-472ffccd2db0}</UniqueIdentifier>
</Filter>
<Filter Include="Headerdateien\Config">
<UniqueIdentifier>{139fb867-83d1-4ac8-9301-f256e8409a20}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="framework.h">
@ -6120,6 +6126,12 @@
<ClInclude Include="Out\File118.h">
<Filter>Headerdateien\Data\ContainingImageData</Filter>
</ClInclude>
<ClInclude Include="Config.h">
<Filter>Headerdateien\Config</Filter>
</ClInclude>
<ClInclude Include="CheatDefines.h">
<Filter>Headerdateien</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
@ -6335,5 +6347,17 @@
<ClCompile Include="SDK\SDK\UMG_functions.cpp">
<Filter>Quelldateien\SDK</Filter>
</ClCompile>
<ClCompile Include="SDK\SDK\SubtitleTextWB_functions.cpp">
<Filter>Quelldateien\SDK</Filter>
</ClCompile>
<ClCompile Include="SDK\SDK\MP_Thallasophobia_functions.cpp">
<Filter>Quelldateien\SDK</Filter>
</ClCompile>
<ClCompile Include="SDK\SDK\Paper2D_functions.cpp">
<Filter>Quelldateien\SDK</Filter>
</ClCompile>
<ClCompile Include="Config.cpp">
<Filter>Quelldateien\Config</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -131,11 +131,15 @@ namespace CWINGui
UCanvas* canvas;
bool hover_element = false;
FVector2D menu_pos = FVector2D{ 0, 0 };
float offset_x = 0.0f;
float offset_y = 0.0f;
float DeltaTimeWindow = 0.0f;
char ChangeWindowSizeState = 0; // 0 = false, 1 = true, 2 = true + custom SizeChange Speed
float SizeChangeWindowSizeSpeed = 0.0f;
FVector2D menu_size_target = { 0,0 };
FVector2D first_element_pos = FVector2D{ 0, 0 };
@ -155,6 +159,7 @@ namespace CWINGui
void SetupCanvas(UCanvas* _canvas)
{
canvas = _canvas;
DeltaTimeWindow = 0.0f;
if (GetAsyncKeyState(VK_LBUTTON)) {
current_element = 0;
@ -410,17 +415,110 @@ namespace CWINGui
return Texture_;
}
SDK::UTexture2D* GetLastImage() {
return TextureArray[CurrentIndex];
}
};
void DrawTexture(SDK::UTexture2D* texture, SDK::FVector2D ScreenPos, SDK::FVector2D ScreenSize, float rotation = 0.0f, SDK::FLinearColor color = {1.0f, 1.0f, 1.0f, 1.0f}, SDK::EBlendMode BlendMode = SDK::EBlendMode::BLEND_Masked);
bool Window(const char* name, FVector2D* pos, FVector2D size, bool isOpen, GifData* Gif = nullptr)
float GetDistanceVector2(FVector2D vector1, FVector2D vector2) {
FVector2D Distance = { vector2.X - vector1.X, vector2.Y - vector1.Y };
return std::sqrt( (Distance.X * Distance.X) + (Distance.Y * Distance.Y) );
}
float GetMagnitudeVector2(FVector2D vector) {
return std::sqrt( (vector.X * vector.X) + (vector.Y * vector.Y) );
}
bool isInRange(float x, float min, float max) {
float xmin = x - min;
float xmax = x + max;
return (x >= xmin && x <= xmax);
}
FVector2D GetNormalizedVector2(FVector2D vector) {
float Length = GetMagnitudeVector2(vector);
if (std::floorf(Length) < 0.1f) {
return FVector2D(0.0f, 0.0f);
}
return FVector2D(vector.X / Length, vector.Y / Length);
}
const float NormalizedAnimationSpeed = 0.3f;//in seconds
FVector2D LastAnimationVector = { 0, 0 };
bool Window(const char* name, FVector2D* pos, FVector2D& size, bool isOpen, GifData* Gif = nullptr)
{
static ULONGLONG LastUpdateTick = GetTickCount64();
static float CurrentAnimationTime = 0.0f;
elements_count = 0;
if (!isOpen)
return false;
auto TickCount = GetTickCount64();
DeltaTimeWindow = (TickCount - LastUpdateTick) / 1000.0f;
DeltaTimeWindow = (DeltaTimeWindow < 0.001f ? 0.014f : DeltaTimeWindow);
LastUpdateTick = TickCount;
switch (ChangeWindowSizeState)
{
case 0:
break;
case 1:
// Calculate the normalized time that has passed relative to the total animation duration
CurrentAnimationTime += DeltaTimeWindow;
if (float TimeCurrent = CurrentAnimationTime / NormalizedAnimationSpeed; TimeCurrent >= 1.0f) {
// Animation is complete
ChangeWindowSizeState = 0;
size = menu_size_target;
LastAnimationVector = { 0, 0 };
ZeroGUI::isInputLocked = false;
CurrentAnimationTime = 0.0f;
}
else {
size.X += ( (menu_size_target.X - LastAnimationVector.X) / NormalizedAnimationSpeed) * DeltaTimeWindow;
size.Y += ( (menu_size_target.Y - LastAnimationVector.Y) / NormalizedAnimationSpeed) * DeltaTimeWindow;
}
break;
//case 2:
// if (auto normalizednext = NormalizeVector2(menu_size_target - size); normalizednext.X < 0.01f && normalizednext.Y < 0.01f) { // Increased threshold
// ChangeWindowSizeState = 0;
// size = menu_size_target;
// }
// else
// {
// if (GetDistanceVector2(normalizednext) > 0.0f) {
// normalizednext = normalizednext * DeltaTimeWindow;
// }
// // Debugging output to ensure calculations are correct
// printf("Size change: (%f, %f)\n", normalizednext.X * NormalizedAnimationSpeed * 20, normalizednext.Y * NormalizedAnimationSpeed * 20);
// size.X += (normalizednext.X * NormalizedAnimationSpeed) * 20;
// size.Y += (normalizednext.Y * NormalizedAnimationSpeed) * 20;
// }
// break;
default:
break;
}
bool isHovered = MouseInZone(FVector2D{ pos->X, pos->Y }, size);
//Drop last element
@ -498,6 +596,21 @@ namespace CWINGui
return true;
}
void ChangeWindowSize(FVector2D lastSize, FVector2D TargetSize, float Speed = 0.0f) {
ZeroGUI::isInputLocked = true; //Lock buttons so no accidental Click happens
LastAnimationVector = lastSize;
SizeChangeWindowSizeSpeed = Speed * NormalizedAnimationSpeed;
menu_size_target = TargetSize;
if (Speed > 0.0f) {
ChangeWindowSizeState = 2;
}
else
{
ChangeWindowSizeState = 1;
}
}
class Thunder {
public:
FVector2D LinesToDraw[14];
@ -684,7 +797,7 @@ namespace CWINGui
if (first_element_pos.X == 0.0f)
first_element_pos = pos;
if (isHovered && ZeroGUI::Input::IsMouseClicked(0, elements_count, false))
if (isHovered && ChangeWindowSizeState == 0 && ZeroGUI::Input::IsMouseClicked(0, elements_count, false))
return true;
return false;
@ -1053,17 +1166,20 @@ namespace CWINGui
// if (current_element == elements_count)
// {
// std::string strd = "";
// for (size_t i = 'A'; i < 'z'; i++)
// {
// if (GetAsyncKeyState(i) & 1) {
// strd += (char)i;
// auto PlayerController = Cheat::PlayerController;
// if (PlayerController) {
// std::string strd = "";
// for (size_t i = '0'; i < 'z'; i++)
// {
// if (PlayerController->IsInputKeyDown(SDK::FKey::)) {
// namePtr += (wchar_t)i;
// }
// }
// }
// if (strd != "") {
// mbstowcs((wchar_t*)namePtr, strd.c_str(), 1000);
// }
// }
// }

View File

@ -1,8 +1,13 @@
#pragma once
#include <Windows.h>
#include "../Cheat.h"
namespace ZeroGUI
{
bool isGameFocussed = false;
bool isInputLocked = false;
HWND CurrentWindow = NULL;
namespace Input
{
bool mouseDown[5];
@ -61,7 +66,10 @@ namespace ZeroGUI
void Handle()
{
if (GetAsyncKeyState(0x01))
isGameFocussed = GetActiveWindow() == CurrentWindow;
if (GetAsyncKeyState(0x01) && !isInputLocked && isGameFocussed)
{
mouseDown[0] = true;
}

View File

@ -25,13 +25,19 @@ typedef unsigned __int64 uint64;
namespace Offsets
{
constexpr int32 GObjects = 0x04B1FA90;
constexpr int32 AppendString = 0x01162410;
constexpr int32 GNames = 0x00000000;
constexpr int32 ProcessEvent = 0x013522E0;
constexpr int32 ProcessEventIdx = 0x00000044;
constexpr int32 PostRenderIdx = 0x00000064;
constexpr int32 StaticConstructObject_Internal = 0x1359C70;
constexpr int32 GObjects = 0x04B1FA90;
constexpr int32 AppendString = 0x01162410;
constexpr int32 GNames = 0x00000000;
constexpr int32 ProcessEvent = 0x013522E0;
constexpr int32 ProcessEventIdx = 0x00000044;
constexpr int32 PostRenderIdx = 0x00000064;
constexpr int32 StaticConstructObject_Internal = 0x01359C70; // 48 89 5c 24 ? 48 89 74 24 ? 55 57 41 54 41 56 41 57 48 8d ac 24 ? ? ? ? 48 81 ec ? ? ? ? 48 8b 05 ? ? ? ? 48 33 c4 48 89 85 ? ? ? ? 48 8b 39
constexpr int32 StaticLoadObjectInternal = 0x0135BE10; // 4c 89 4c 24 ? 48 89 54 24 ? 48 89 4c 24 ? 55 53 56 57 41 54 41 55 41 56 41 57 48 8b ec
constexpr int32 FPakPlatformFile$$Mount = 0x0272C690; // 4c 8b dc 55 53 57 49 8d ab ? ? ? ? 48 81 ec ? ? ? ? 48 8b 05 ? ? ? ? 48 33 c4 48 89 85 ? ? ? ? 49 89 73 ? 49 8b f1
constexpr int32 FPlatformFileManager$$Get = 0x01068D00; // Not directly sig of Function, Function this finds has a call to FPlatformFileManager::Get. 40 53 41 54 41 55 41 57 48 83 ec ? 49 8b d8
constexpr int32 FPakPlatformFile$$FindPlatformFile = 0x01067CD0; // 48 89 5c 24 ? 57 48 83 ec ? 48 8b 19 48 8b fa 48 85 db 74 ? 48 8b 03 48 8b cb Or use Sig from above also get called in Function!
}
#include "PropertyFixup.hpp"

View File

@ -88,6 +88,7 @@ public:
{
}
inline T& operator[](uint32 Index)
{
return Data[Index];

View File

@ -4610,7 +4610,7 @@ public:
class UAssetManager : public UObject
{
public:
uint8 Pad_7A4[0x2B8]; // Fixing Size After Last Property [ Dumper-7 ]
uint8 Pad_99B[0x2B8]; // Fixing Size After Last Property [ Dumper-7 ]
TArray<class UObject*> ObjectReferenceList; // 0x2E0(0x10)(ZeroConstructor, Protected, NativeAccessSpecifierProtected)
bool bIsGlobalAsyncScanEnvironment; // 0x2F0(0x1)(ZeroConstructor, IsPlainOldData, NoDestructor, Protected, HasGetValueTypeHash, NativeAccessSpecifierProtected)
bool bShouldGuessTypeAndName; // 0x2F1(0x1)(ZeroConstructor, IsPlainOldData, NoDestructor, Protected, HasGetValueTypeHash, NativeAccessSpecifierProtected)
@ -11006,7 +11006,9 @@ public:
class ULevel : public UObject
{
public:
uint8 Pad_11E2[0x90]; // Fixing Size After Last Property [ Dumper-7 ]
uint8 Pad_11E2[0x70];
TArray<class AActor*> Actors;
TArray<class AActor*> ActorsForGC;
class UWorld* OwningWorld; // 0xB8(0x8)(ZeroConstructor, Transient, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
class UModel* Model; // 0xC0(0x8)(ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
TArray<class UModelComponent*> ModelComponents; // 0xC8(0x10)(ExportObject, ZeroConstructor, ContainsInstancedReference, NativeAccessSpecifierPublic)

View File

@ -3,6 +3,7 @@
#include <unordered_map>
#include <format>
#include <functional>
#include "Config.h"
namespace Backend {
using EventHandler = std::function<void()>;
@ -47,6 +48,7 @@ namespace Backend {
std::string LevelName = "";
std::string HostSteamID = "";
std::wstring HostID = L""; //Ip for uses
std::string HostSteamID_Clean = "";
Level_ LevelCurrent = Level_::MainLvl;
@ -220,6 +222,19 @@ namespace PlayerStuff {
}
namespace Settings {
namespace Spawner {
enum Spawner_Stuff {
None = -1,
Boat,
Rope,
BactiriaMonster,
ExitZone,
ExitZoneEndGame,
FireworkProj_Bugged,
Firework
};
}
void SetName_NameChanger(std::wstring name);
enum Items
@ -251,13 +266,26 @@ namespace Settings {
SelfPawn
};
enum Spawner_Stuff {
Boat,
Player,
BactiriaMonster,
ExitZone
enum PlayerDynamic {
PIsCameraReplicated,
PIsFreeCam,
PSpoofChatMessage,
PDetachFirework,
PTeleportDetachedFirework,
PInteractWithSpawnedBoat,
PFlaregunSpammer,
PGodMode,
PUnlimitedSanity,
PUnlimitedStamina
};
const float CheatVersion = 2.0f;
double TimeSpendCheating = 0.0f;
ULONGLONG TickCountCheatTime = 0;
bool NewVersion_ = false;
bool Open = true;
bool Esp = false;
bool EnemyEsp = false;
@ -266,6 +294,7 @@ namespace Settings {
bool ItemEsp = false;
bool ActorEsp = false;
bool InteractablesEsp = false;
bool EnemyChams = true;
bool SpectatorList = false;
@ -277,9 +306,12 @@ namespace Settings {
bool TeleportEventPlayer = false;
bool TeleportToEventPlayer = false;
bool SpawnRopeAtEventPlayer = false;
bool SpectateEventPlayer = false;
bool EventRespawnPlayer = false;
bool UseItemEventPlayer = false;
bool EventCollectDataPlayer = false;
bool StealPawnEventPlayer = false;
int Event_PlayerID = 0;
@ -299,6 +331,10 @@ namespace Settings {
//Misc
bool Freecam = false;
bool RejoinServer_Event = false,
bool ClickTpPawn = false;
bool UsedSpawnTest = false;
bool ProtectCamServer = true;
bool TestEvent_PrintSteamIDS = false;
bool UnlockPlayers = false;
@ -331,7 +367,7 @@ namespace Settings {
bool HideWalls = false;
bool PlayerFly = false;
bool PeacefullMode = false;
bool Spawner = false;
bool Spawner_ = false;
bool SilentItemSpawner = false;
bool LoadLevel_ = false;
bool Godmode = false;
@ -346,6 +382,10 @@ namespace Settings {
bool SpawnItem = false;
Items ItemToSpawn;
bool SpawnerEvent = false;
Spawner::Spawner_Stuff SpawnerValue = Spawner::Spawner_Stuff::None;
std::string SpawningValue = "";
float PlayerFlySpeedY = 100.0f;
float Fov = 90.0f;
float Speed = 1000.0f;
@ -361,7 +401,7 @@ namespace Settings {
//For Name Changer
std::wstring LevelToLoad = L"";
std::wstring NameTo_set = L"Nizi7010"; //GWorld:0x04C67430
std::wstring NameTo_set = L"EagerPlayer_420";
std::wstring OriginalName = L"";
std::wstring MessageSpoof = L"";
std::wstring NameOfVictim = L"";
@ -369,6 +409,47 @@ namespace Settings {
SDK::FVector2D WindowPos{ 500.0f, 475.0f };
SDK::FVector LastServerPosition;
//For Saving reasons
//byte CurrentName_Saved[ConfigSystemInternalSettings::MaxTypeSize * 2];
std::thread* CurrentInputThread_Config = nullptr;
void AddFieldsToConfig(ConfigSystem* configsys) {
configsys->AddField(&PeacefullMode, 0);
configsys->AddField(&NoCams, 1);
configsys->AddField(&Noclip, 2);
configsys->AddField(&PlayerFly, 3);
configsys->AddField(&VelocityFly, 4);
configsys->AddField(&SpectatorList, 5);
configsys->AddField(&EnemyEsp, 6);
configsys->AddField(&PlayerEsp, 7);
configsys->AddField(&ItemEsp, 8);
configsys->AddField(&InteractablesEsp, 9);
configsys->AddField(&BoatEsp, 10);
configsys->AddField(&ActorEsp, 11);
configsys->AddField(&RGBFlashlight, 12);
configsys->AddField(&EnviromentRGB, 13);
configsys->AddField(&Freecam, 14);
configsys->AddField(&Spawner_, 15);
configsys->AddField(&ShowWatermark, 16);
configsys->AddField(&BoatFly,17);
configsys->AddField(&Rapidfire,18);
configsys->AddField(&InfiniteStamina,19);
configsys->AddField(&InfiniteSanity, 20);
configsys->AddField(&NoStumble, 21);
configsys->AddField(&Godmode, 22);
configsys->AddField(&SpeedHack, 23);
configsys->AddField(&NameChanger, 24);
configsys->AddField(&BoatSpeedhack, 25);
configsys->AddField(&FovChanger, 26);
configsys->AddField(&Fov, 27);
configsys->AddField(&Speed, 28);
configsys->AddField(&BoatSpeed, 29);
configsys->AddField(&PlayerFlySpeedY, 30);
//configsys->AddField(&CurrentName_Saved, 31);
}
}
@ -382,7 +463,13 @@ void Backend::CallbackNewLevel()
}
void Settings::SetName_NameChanger(std::wstring name) {
//const int SizeName = sizeof(CurrentName_Saved);
NameTo_set = name;
//int NameSize = (NameTo_set.size() > SizeName ? SizeName : NameTo_set.size());
//std::memcpy((void*)CurrentName_Saved, NameTo_set.data(), NameSize);
Settings::IniShitsLevel[3] = false;
}
@ -390,26 +477,19 @@ void Settings::SetName_NameChanger(std::wstring name) {
std::wstring Algorithm_(std::wstring input) {
std::wstring out = L"";
out.reserve(input.size());
for (size_t i = 0; i < input.size(); i++)
{
auto letternormal = input[i];
auto letterLower = (wchar_t)std::tolower(letternormal, std::locale());
bool hasChangedSize = (letternormal != letterLower);
switch (letterLower)
{
case L'i':
out += (hasChangedSize) ? L'Í' : L'í';
break;
wchar_t charNext = (letternormal == L'i' ? L'í' :
letternormal == L'u' ? L'ú' :
letternormal == L'I' ? L'Í' :
letternormal == L'U' ? L'Ú' :
letternormal);
case L'u':
out += (hasChangedSize) ? L'Ú' : L'ú';
break;
default:
out += letternormal;
break;
}
out += charNext;
}
return out;

View File

@ -1,10 +1,12 @@
#include "SDK/SDK.hpp"
#include "SDK/SDK.hpp"
#include <thread>
#include <algorithm>
#include "Cheat.h"
#include <MinHook.h>
#include <IncludeFile.h>
#include "Config.h"
FILE* ConsoleFile = nullptr;
typedef void (*PostRender_t)(SDK::UObject* pObject, SDK::UCanvas* pCanvas);
PostRender_t origin_renderer;
@ -14,9 +16,12 @@ fnProcessEvent fnProcessEventOrigin;
fnProcessEvent fnProcessEventTarget;
std::vector<ByteData> Datas;
ConfigSystem* configsys;
CWINGui::GifData* GifBackground;
void ExitCheat();
std::wstring stringToWideString(const std::string& str)
{
std::wstring wstr(str.length(), L' ');
@ -43,10 +48,9 @@ namespace FunctionPtrsProcessEvent {
Lobby_PlayerController_C_ReceiveEndPlay
};
void* FunctionHooks[8];
void* FunctionHooks[9];
const size_t FunctionHookSize = sizeof(FunctionHooks) / 8;
void NullObjects() {
for (size_t i = 0; i < FunctionHookSize; i++)
@ -56,7 +60,7 @@ namespace FunctionPtrsProcessEvent {
}
};
//SDK::APlayerController::IsInputKeyDown
void ProcessEventHook(SDK::UObject* Obj, SDK::UFunction* Function, void* Parms) {
using namespace FunctionPtrsProcessEvent;
@ -243,10 +247,10 @@ void ProcessEventHook(SDK::UObject* Obj, SDK::UFunction* Function, void* Parms)
}
}
}
#pragma endregion
if (execF == FunctionHooks[Lobby_PlayerController_COC_KickedFromLobby] || execF == FunctionHooks[MP_PlayerController_COC_KickedFromLobby]) {
Cheat::MainRun(nullptr);
@ -387,13 +391,15 @@ void ProcessEventHook(SDK::UObject* Obj, SDK::UFunction* Function, void* Parms)
}
}
return fnProcessEventOrigin(Obj, Function, Parms);
}
SDK::UTexture2D* ImageTexture = nullptr;
void MainRender(SDK::UObject* object, SDK::UCanvas* Canvas) {
static bool ShowHelp = true;
if (Canvas) {
//init menu
@ -402,7 +408,7 @@ void MainRender(SDK::UObject* object, SDK::UCanvas* Canvas) {
static Cheat::UsefullFuncs::RGBA RGBShit = { 0, 0, 0, 255 };
static SDK::FLinearColor RGBLinear = SDK::FLinearColor(Cheat::UsefullFuncs::RGBATOFLinear(RGBShit.R, RGBShit.G, RGBShit.B, RGBShit.A));
Cheat::UsefullFuncs::Rainbowify(&RGBShit);
Cheat::UsefullFuncs::Rainbowify(&RGBShit); //follows RGBA Rainbow values
RGBLinear = SDK::FLinearColor(Cheat::UsefullFuncs::RGBATOFLinear(RGBShit.R, RGBShit.G, RGBShit.B, RGBShit.A));
if (Settings::ShowWatermark) {
@ -455,22 +461,76 @@ void MainRender(SDK::UObject* object, SDK::UCanvas* Canvas) {
static SDK::FVector2D WindowSize = { 500.0f, 555.0f };
if (ShowHelp || Settings::NewVersion_) {
static SDK::FVector2D WindowPos = { 500.0f, 475.0f };
if (ShowHelp) {
if (CWINGui::Window("?", &WindowPos, WindowSize, ShowHelp)) {
CWINGui::Text(L"This Trainer was Originally Uploaded to Unknowncheats.");
CWINGui::Text(L"If you didnt Download it from Unknowncheats i would be carefull");
CWINGui::Text(L""), CWINGui::SameLine();
if (CWINGui::Button(L"Okay blud", SDK::FVector2D{ 110, 35 })) {
ShowHelp = false;
}
}
}
else
{
if (CWINGui::Window("?", &WindowPos, WindowSize, Settings::NewVersion_)) {
CWINGui::Text(std::format(L"New Version {}!!!", Settings::CheatVersion).c_str());
CWINGui::Text(L"* Added Server Sided Teleporting!");
CWINGui::Text(L"* Added Server Sided Object Spawner!");
CWINGui::Text(L"* Added Boat to Object Spawner.");
CWINGui::Text(L"* Added Config System");
CWINGui::Text(L"* Added Rope on Player to Player Options.");
CWINGui::Text(L"* Added Freecam and Server Sided Teleporter in Freecam.");
CWINGui::Text(L"* Added Freecam and Server Sided Teleporter in Freecam.");
CWINGui::Text(L"* Added some new Menu Designing.");
CWINGui::Text(L"* Added Chat Spoofer.");
CWINGui::Text(L""), CWINGui::SameLine();
if (CWINGui::Button(L"Okay blud....", SDK::FVector2D{ 110, 35 })) {
Settings::NewVersion_ = false;
}
}
}
CWINGui::Draw_Cursor(ShowHelp);
CWINGui::Render();
if (GetAsyncKeyState(VK_DELETE) & 1)
ExitCheat();
return origin_renderer(object, Canvas);
}
const SDK::FVector2D DefaultValue = { 500.0f, 620.0f };
if (CWINGui::Window("Escape The Backrooms Internal", &Settings::WindowPos, WindowSize, Settings::Open, GifBackground))
{
static int tab = 1;
if (CWINGui::ButtonTab(L"Game Shit", SDK::FVector2D{ 110, 35 }, tab == 0)) { tab = 0; WindowSize = { 500.0f, 640.0f }; }
if (CWINGui::ButtonTab(L"World Visuals", SDK::FVector2D{ 110, 35 }, tab == 1)) { tab = 1; WindowSize = { 500.0f, 555.0f }; }
if (CWINGui::ButtonTab(L"Miscellaneous", SDK::FVector2D{ 110, 35 }, tab == 2)) { tab = 2; WindowSize = { 500.0f, 680.0f }; }
if (CWINGui::ButtonTab(L"Item Spawner", SDK::FVector2D{ 110, 35 }, tab == 3)) { tab = 3; WindowSize = { 500.0f, 620.0f }; }
if (CWINGui::ButtonTab(L"Level Miscs", SDK::FVector2D{ 110, 35 }, tab == 4)) { tab = 4; WindowSize = { 500.0f, 555.0f }; }
if (CWINGui::ButtonTab(L"Host Info", SDK::FVector2D{ 110, 35 }, tab == 5)) { tab = 5; WindowSize = { 500.0f, 555.0f }; }
if (CWINGui::ButtonTab(L"Game Shit", SDK::FVector2D{ 110, 35 }, tab == 0)) { tab = 0; CWINGui::ChangeWindowSize(WindowSize, { 500.0f, 640.0f }); }
if (CWINGui::ButtonTab(L"World Visuals", SDK::FVector2D{ 110, 35 }, tab == 1)) { tab = 1; CWINGui::ChangeWindowSize(WindowSize, DefaultValue); }
if (CWINGui::ButtonTab(L"Miscellaneous", SDK::FVector2D{ 110, 35 }, tab == 2)) { tab = 2; CWINGui::ChangeWindowSize(WindowSize, DefaultValue); }
if (CWINGui::ButtonTab(L"Item Spawner", SDK::FVector2D{ 110, 35 }, tab == 3)) { tab = 3; CWINGui::ChangeWindowSize(WindowSize, DefaultValue); }
if (CWINGui::ButtonTab(L"Level Miscs", SDK::FVector2D{ 110, 35 }, tab == 4)) { tab = 4; CWINGui::ChangeWindowSize(WindowSize, DefaultValue); }
if (CWINGui::ButtonTab(L"Host Info", SDK::FVector2D{ 110, 35 }, tab == 5)) { tab = 5; CWINGui::ChangeWindowSize(WindowSize, DefaultValue); }
#ifdef Gatekeep
if (CWINGui::ButtonTab(L"Chat Spoofer", SDK::FVector2D{ 110, 35 }, tab == 6)) { tab = 6; WindowSize = { 540.0f, 625.0f }; }
if (CWINGui::ButtonTab(L"Chat Spoofer", SDK::FVector2D{ 110, 35 }, tab == 6)) { tab = 6; CWINGui::ChangeWindowSize(WindowSize, { 540.0f, 625.0f }); }
#endif
if (CWINGui::ButtonTab(L"Level Loader", SDK::FVector2D{ 110, 35 }, tab == 7)) { tab = 7; WindowSize = { 740.0f, 575.0f }; }
if (CWINGui::ButtonTab(L"Level Loader", SDK::FVector2D{ 110, 35 }, tab == 7)) { tab = 7; CWINGui::ChangeWindowSize(WindowSize, { 740.0f, 575.0f }); }
if (CWINGui::ButtonTab(L"Players", SDK::FVector2D{ 110, 35 }, tab == 8)) { tab = 8; WindowSize = { 600.0f, 555.0f }; }
if (CWINGui::ButtonTab(L"Hosting Options", SDK::FVector2D{ 110, 35 }, tab == 10)) { tab = 10; WindowSize = { 600.0f, 555.0f }; }
if (CWINGui::ButtonTab(L"Players", SDK::FVector2D{ 110, 35 }, tab == 8)) { tab = 8; CWINGui::ChangeWindowSize(WindowSize, DefaultValue);}
if (CWINGui::ButtonTab(L"Hosting Options", SDK::FVector2D{ 110, 35 }, tab == 10)) { tab = 10; CWINGui::ChangeWindowSize(WindowSize, DefaultValue); }
if (CWINGui::ButtonTab(L"Config", SDK::FVector2D{ 110, 35 }, tab == 12)) { tab = 12; CWINGui::ChangeWindowSize(WindowSize, DefaultValue); }
if (Settings::Spawner_ && CWINGui::ButtonTab(L"Spawner Options", SDK::FVector2D{ 110, 35 }, tab == 11)) { tab = 11; CWINGui::ChangeWindowSize(WindowSize, DefaultValue);}
CWINGui::NextColumn(140.0f);
CWINGui::Text(L"");
@ -483,7 +543,7 @@ void MainRender(SDK::UObject* object, SDK::UCanvas* Canvas) {
CWINGui::Checkbox(std::wstring(LR"(Player "Fly" (Press Space))" + FlyText).c_str(), &Settings::PlayerFly);
CWINGui::Checkbox(LR"(Velocity Fly)", &Settings::VelocityFly);
CWINGui::SliderFloat(L"Flyspeed", &Settings::PlayerFlySpeedY, 0.01f, 1000.0f);
CWINGui::SliderFloat(L"Flyspeed (Boat & Player)", &Settings::PlayerFlySpeedY, 0.01f, 1000.0f);
if (CWINGui::Button(L"Hide Doors", SDK::FVector2D{ 110, 35 })) {
Settings::ActorEvent = true;
Settings::HideWalls = true;
@ -540,15 +600,19 @@ void MainRender(SDK::UObject* object, SDK::UCanvas* Canvas) {
CWINGui::Checkbox(L"Interactables Esp", &Settings::InteractablesEsp);
CWINGui::Checkbox(L"Boat Esp", &Settings::BoatEsp);
CWINGui::Checkbox(L"Actor Esp", &Settings::ActorEsp);
#ifdef DEBUG
CWINGui::Checkbox(L"Enemy Chams", &Settings::EnemyChams);
#endif
CWINGui::Checkbox(L"Flashlight RGB", &Settings::RGBFlashlight);
CWINGui::Checkbox(L"Enviroment RGB", &Settings::EnviromentRGB);
break;
case 2:
CWINGui::Checkbox(L"Unlock Playercounter (100 Players)", RGBLinear, &Settings::UnlockPlayers);
CWINGui::Checkbox(L"Freecam (Activate with J, Teleport with F1)", SDK::FLinearColor{ 0.0f, 1.0f, 0.0f, 1.0f }, &Settings::Freecam);
CWINGui::Checkbox(L"Spawner (Lets you Spawn stuff!)", SDK::FLinearColor{ 0.92f, 0.22f, 0.91f, 1.0f }, &Settings::Spawner_);
CWINGui::Checkbox(L"Watermark", &Settings::ShowWatermark);
CWINGui::Checkbox(L"Boat Fly", &Settings::BoatFly);
CWINGui::Checkbox(L"Boat Speedhack", &Settings::BoatSpeedhack);
CWINGui::Checkbox(L"RapidFire", &Settings::Rapidfire);
CWINGui::Checkbox(L"Infinite Stamina", &Settings::InfiniteStamina);
CWINGui::Checkbox(L"Infinite Sanity", &Settings::InfiniteSanity);
@ -558,11 +622,10 @@ void MainRender(SDK::UObject* object, SDK::UCanvas* Canvas) {
CWINGui::Checkbox(L"Interactables always on", &Settings::InteractAll);
CWINGui::Checkbox(L"NameChanger", &Settings::NameChanger);
/*CWINGui::Checkbox(L"NameChanger Random", &Settings::RandomName);*/
CWINGui::Checkbox(L"Spawner", &Settings::Spawner);
CWINGui::Checkbox(L"Fov Changer", &Settings::FovChanger);
CWINGui::SliderFloat(L"Fov", &Settings::Fov, 10.0f, 200.0f);
CWINGui::SliderFloat(L"Speed", &Settings::Speed, 100, 10000);
CWINGui::SliderFloat(L"Boat Speed", &Settings::BoatSpeed, 100, 10000);
CWINGui::Checkbox(L"Boat Speedhack", &Settings::BoatSpeedhack); CWINGui::SameLine(); CWINGui::last_element_pos.X += 20.0f, CWINGui::last_element_pos.Y -= 20.0f; CWINGui::SliderFloat(L"Boat Speed", &Settings::BoatSpeed, 100, 10000);
CWINGui::Checkbox(L"Speedhack", &Settings::SpeedHack); CWINGui::SameLine(); CWINGui::last_element_pos.X -= 80.0f, CWINGui::last_element_pos.Y -= 10.0f; CWINGui::SliderFloat(L"Speed", &Settings::Speed, 100, 10000);
CWINGui::Checkbox(L"Fov Changer", &Settings::FovChanger); CWINGui::SameLine(); CWINGui::last_element_pos.X -= 80.0f; CWINGui::SliderFloat(L"Fov", &Settings::Fov, 10.0f, 200.0f);
//{
// static bool hasfinishedConsole = false;
@ -1045,6 +1108,16 @@ void MainRender(SDK::UObject* object, SDK::UCanvas* Canvas) {
Settings::EventRespawnPlayer = true;
}
if (CWINGui::Button(L"Spectate FCam Player", SDK::FVector2D{ 110, 35 })) {
Settings::Event_PlayerID = player.PlayerID;
Settings::SpectateEventPlayer = true;
}
if (CWINGui::Button(L"Spawn Rope Player", SDK::FVector2D{ 110, 35 })) {
Settings::Event_PlayerID = player.PlayerID;
Settings::SpawnRopeAtEventPlayer = true;
}
if (CWINGui::Button(L"Use item as Player", SDK::FVector2D{ 110, 35 })) {
Settings::Event_PlayerID = player.PlayerID;
Settings::UseItemEventPlayer = true;
@ -1055,6 +1128,10 @@ void MainRender(SDK::UObject* object, SDK::UCanvas* Canvas) {
Settings::EventCollectDataPlayer = true;
}
if (CWINGui::Button(L"Steal Pawn", SDK::FVector2D{ 110, 35 })) {
Settings::Event_PlayerID = player.PlayerID;
Settings::StealPawnEventPlayer = !Settings::StealPawnEventPlayer;
}
}
else
{
@ -1076,13 +1153,97 @@ void MainRender(SDK::UObject* object, SDK::UCanvas* Canvas) {
break;
case 11:
using namespace Settings;
if (CWINGui::Button(L"Spawn Boat", SDK::FVector2D{ 125, 35 })) {
Settings::SpawnerEvent = true;
Settings::SpawnerValue = Settings::Spawner::Spawner_Stuff::Boat;
}
if (CWINGui::Button(L"Spawn Rope", SDK::FVector2D{ 125, 35 })) {
Settings::SpawnerEvent = true;
Settings::SpawnerValue = Settings::Spawner::Spawner_Stuff::Rope;
}
if (CWINGui::Button(L"Spawn Exitzone", SDK::FVector2D{ 125, 35 })) {
Settings::SpawnerEvent = true;
Settings::SpawnerValue = Settings::Spawner::Spawner_Stuff::ExitZone;
}
if (CWINGui::Button(L"Spawn Bactiria", SDK::FVector2D{ 125, 35 })) {
Settings::SpawnerEvent = true;
Settings::SpawnerValue = Settings::Spawner::Spawner_Stuff::BactiriaMonster;
}
break;
case 12:
{
static std::wstring CurrentConfigFileName = L"";
if (CurrentConfigFileName == L"") {
CurrentConfigFileName = configsys->GetCurrentConfigNameW();
}
CWINGui::Text((L"Current Config File: " + CurrentConfigFileName).c_str());
if (CWINGui::Button(L"Load Current Config", SDK::FVector2D{ 125, 35 })) {
configsys->ActivateConfig(configsys->GetCurrentConfigName().substr (0, configsys->GetCurrentConfigName().find(".escp")), configsys->GetSettingsPath());
Settings::AddFieldsToConfig(configsys);
configsys->WriteToFields();
//SetName_NameChanger((wchar_t*)Settings::CurrentName_Saved);
}
if (CWINGui::Button(L"Create/Change Config", SDK::FVector2D{ 125, 35 })) {
if (!CurrentInputThread_Config)
{
std::thread::id mainThreadId = std::this_thread::get_id();
std::thread t([mainThreadId]() {
if (std::this_thread::get_id() != mainThreadId) {
std::string Out__ = "";
bool finished = false;
Cheat::GetInput("Enter the Name for the Config File:", Out__, finished);
if (!configsys->ActivateConfig(Out__, configsys->GetSettingsPath())) {
Cheat::Message("Failed to Change Config File!, Changing to Default");
if (!configsys->ActivateConfig("config1", configsys->GetSettingsPath()))
Cheat::Message("Failed to Change to Default Config File. Fuck you tbh");
}
Settings::AddFieldsToConfig(configsys);
CurrentInputThread_Config = nullptr;
CurrentConfigFileName = L"";
}
});
CurrentInputThread_Config = &t;
t.detach();
}
}
if (CWINGui::Button(L"Save to Current Config", SDK::FVector2D{ 125, 35 })) {
configsys->WriteToConfigFile();
}
}
break;
default:
break;
}
}
}
CWINGui::Draw_Cursor(Settings::Open); //draw ugly ass cursor
@ -1093,42 +1254,70 @@ void MainRender(SDK::UObject* object, SDK::UCanvas* Canvas) {
if (GetAsyncKeyState(VK_INSERT) & 1)Settings::Open = !Settings::Open;
if (GetAsyncKeyState(VK_DELETE) & 1) {
SDK::UWorld* World = SDK::UWorld::GetWorld();
auto GameInstance = World->OwningGameInstance;
auto LocalPlayer = GameInstance->LocalPlayers[0];
auto ViewportClient = LocalPlayer->ViewportClient;
auto vTable = *(void***)(ViewportClient);
auto vTableWorld = *(void***)(World);
Functions::ChangePointer((uintptr_t)vTable, Offsets::PostRenderIdx, (uintptr_t)origin_renderer);
if (GetAsyncKeyState(VK_DELETE) & 1)
ExitCheat();
MH_DisableHook(MH_ALL_HOOKS);
MH_RemoveHook(fnProcessEventTarget);
Backend::NewLevelEvent.UnregisterHandlers();
//Functions::ChangePointer((uintptr_t)vTableWorld, Offsets::ProcessEventIdx, (uintptr_t)fnProcessEventOrigin);
MH_Uninitialize();
std::cout << "[*] Unhooked Renderfunc\n[*] Freeing Console!\n";
ConsoleExit();
delete GifBackground;
}
}
return origin_renderer(object, Canvas);
}
void ExitCheat() {
SDK::UWorld* World = SDK::UWorld::GetWorld();
auto GameInstance = World->OwningGameInstance;
auto LocalPlayer = GameInstance->LocalPlayers[0];
SDK::APlayerController* PlayerController = LocalPlayer->PlayerController;
auto ViewportClient = LocalPlayer->ViewportClient;
auto vTable = *(void***)(ViewportClient);
auto vTableWorld = *(void***)(World);
Functions::ChangePointer((uintptr_t)vTable, Offsets::PostRenderIdx, (uintptr_t)origin_renderer);
MH_DisableHook(MH_ALL_HOOKS);
MH_RemoveHook(fnProcessEventTarget);
Backend::NewLevelEvent.UnregisterHandlers();
//Functions::ChangePointer((uintptr_t)vTableWorld, Offsets::ProcessEventIdx, (uintptr_t)fnProcessEventOrigin);
MH_Uninitialize();
//Not Working! Fix else keep massive memory leak!
for (SDK::UTexture2D* texture : GifBackground->TextureArray)
{
//Mark Textures as Garbage then set to nullptr
texture->Flags |= (1 << 21);
texture = nullptr;
}
if (PlayerController) //Clean Up stuff
{
if (!Settings::Open)
PlayerController->AcknowledgedPawn->EnableInput(LocalPlayer->PlayerController);
}
std::cout << "[*] Unhooked Renderfunc\n[*] Freeing Console!\n";
ConsoleExit();
configsys->ActivateConfig("menu_data", configsys->GetSettingsPath());
Settings::TimeSpendCheating += (GetTickCount64() - Settings::TickCountCheatTime);
configsys->AddField(&Settings::TimeSpendCheating, -1);
configsys->WriteToConfigFile(-1);
delete GifBackground;
delete configsys;
}
void MainThread() {
if (!Cheat::Ini()) {
Cheat::Message("Cheat needs to be Updated. Im up to Updating probly already ;)", FOREGROUND_GREEN);
Cheat::Message("Cheat needs to be Updated. Im up to Updating probly already", FOREGROUND_GREEN);
return;
}
@ -1154,6 +1343,8 @@ void MainThread() {
MH_EnableHook(reinterpret_cast<LPVOID*>(fnProcessEventTarget));
ZeroGUI::CurrentWindow = FindWindowA("UnrealWindow", "EscapeTheBackrooms ");
if (!origin_renderer || !fnProcessEventOrigin) {
auto renderError = !origin_renderer ? "PostRender" : "";
@ -1165,6 +1356,55 @@ void MainThread() {
}
else
{
configsys = new ConfigSystem("menu_data");
float CheatVersion = Settings::CheatVersion;
configsys->AddField(&CheatVersion, -2);
configsys->AddField(&Settings::TimeSpendCheating, -1);
if (!configsys->WriteToFields()) {
configsys->WriteToConfigFile();
Settings::NewVersion_ = true;
}
else
{
if (CheatVersion != Settings::CheatVersion)
Settings::NewVersion_ = true;
auto val = Settings::TimeSpendCheating / 1000;
const char* TimeFormats[] = { "seconds", "minutes", "hours", "days" };
double TimeSplitValue[] = { 1000, 60000, 3600000, 86400000 };
// 0 = Seconds, 1 = Minutes, 2 = Hours, 3 = Days
int state = (val >= 60.0 ? (val /= 60.0, val >= 60.0 ? (val /= 24.0, val >= 24.0 ? 3 : 2) : 1) : 0);
auto Time = Settings::TimeSpendCheating / TimeSplitValue[state];
{ //Calculate the Comma Values too into the time;
int FormatCalculation[] = {0.4, 0.4, 0.4, 0.9};
double a_ = std::round(Time);
double Lösung = Time - (a_ - FormatCalculation[state]);
if (Lösung > 0.0) {
Time = a_ + Lösung;
}
}
Cheat::Message(std::format("Already spent Time Cheating: {:.2f} {}", Time, TimeFormats[state]));
}
Settings::TickCountCheatTime = GetTickCount64();
configsys->ActivateConfig("config1", configsys->GetSettingsPath());
Settings::AddFieldsToConfig(configsys);
Datas = GetBytes();
std::vector<SDK::UTexture2D*> TexturesCopy;
@ -1191,14 +1431,13 @@ BOOL APIENTRY DllMain( HMODULE hModule,
{
case DLL_PROCESS_ATTACH:
AllocConsole();
FILE* fileptr;
freopen_s(&fileptr, "CONOUT$", "w", stdout);
freopen_s(&fileptr, "CONOUT$", "w", stderr);
freopen_s(&fileptr, "CONIN$", "r", stdin);
freopen_s(&ConsoleFile, "CONOUT$", "w", stdout);
freopen_s(&ConsoleFile, "CONOUT$", "w", stderr);
freopen_s(&ConsoleFile, "CONIN$", "r", stdin);
MainThread();
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
default:
break;
}
return TRUE;