From cc6971442980e78f9053169cb49e19871e3c50a5 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 26 Jun 2024 22:23:20 +0200 Subject: [PATCH] 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) --- EscapeTheBackroomsGUiTest/Cheat.h | 993 +++++++++++------- EscapeTheBackroomsGUiTest/CheatDefines.h | 256 +++++ EscapeTheBackroomsGUiTest/Config.cpp | 415 ++++++++ EscapeTheBackroomsGUiTest/Config.h | 168 +++ .../EscapeTheBackroomsGUiTest.vcxproj | 8 +- .../EscapeTheBackroomsGUiTest.vcxproj.filters | 24 + EscapeTheBackroomsGUiTest/GUI/ZeroGUI.h | 138 ++- EscapeTheBackroomsGUiTest/GUI/ZeroInput.h | 10 +- EscapeTheBackroomsGUiTest/SDK/SDK.hpp | 20 +- EscapeTheBackroomsGUiTest/SDK/SDK/Basic.hpp | 1 + .../SDK/SDK/Engine_classes.hpp | 6 +- EscapeTheBackroomsGUiTest/Settings.h | 126 ++- EscapeTheBackroomsGUiTest/dllmain.cpp | 359 +++++-- 13 files changed, 2023 insertions(+), 501 deletions(-) create mode 100644 EscapeTheBackroomsGUiTest/CheatDefines.h create mode 100644 EscapeTheBackroomsGUiTest/Config.cpp create mode 100644 EscapeTheBackroomsGUiTest/Config.h diff --git a/EscapeTheBackroomsGUiTest/Cheat.h b/EscapeTheBackroomsGUiTest/Cheat.h index 8826247..a6df636 100644 --- a/EscapeTheBackroomsGUiTest/Cheat.h +++ b/EscapeTheBackroomsGUiTest/Cheat.h @@ -5,6 +5,7 @@ #include #include #include "Settings.h" +#include "CheatDefines.h" //#define DEBUG @@ -12,57 +13,6 @@ void RunMainHost(); -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(ptr)) == PAGE_NOACCESS) return false; - return true; - } - - template - - 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(ptr) = Value; - 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; - } - -} - namespace Cheat { SDK::UEngine* Engine = 0x0; @@ -79,75 +29,10 @@ namespace Cheat { SDK::APawn* Pawn = 0x0; bool Initialized = false; + bool LoadObjectValid_ = false; - 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 - { - public: - AudioData(std::vector 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 - ); - static fStaticConstructObject_Internal StaticConstructObject_Internal; - - 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(StaticConstructObject_Internal(¶ms)); - } + void Message(const char* msg, DWORD Color); + void Message(std::string msg, DWORD Color); bool Ini() { @@ -174,7 +59,26 @@ namespace Cheat { CWINGui::Font = SDK::UObject::FindObject("Font Roboto.Roboto"); StaticConstructObject_Internal = (fStaticConstructObject_Internal)((uintptr_t)GetModuleHandle(0) + Offsets::StaticConstructObject_Internal); + StaticLoadObject_Internal = (fStaticLoadObject_Internal)((uintptr_t)GetModuleHandle(0) + Offsets::StaticLoadObjectInternal); + FPlatformFileManager$$Get = (fFPlatformFileManager$$Get)((uintptr_t)GetModuleHandle(0) + Offsets::FPlatformFileManager$$Get); + FPakPlatformFile$$FindPlatformFile = (fFPakPlatformFile$$FindPlatformFile)((uintptr_t)GetModuleHandle(0) + Offsets::FPakPlatformFile$$FindPlatformFile); + FPakPlatformFile$$Mount = (fFPakPlatformFile$$Mount)((uintptr_t)GetModuleHandle(0) + Offsets::FPakPlatformFile$$Mount); + + std::vector FunctionSig_Static{0x4c, 0x89, 0x4c, 0x24, 0x20}; + + std::vector FunctionSig = Functions::GetFunctionSig(StaticLoadObject_Internal, 5); + + + if (FunctionSig.size() == 5) { + LoadObjectValid_ = (Functions::CompareFunctionSigs(FunctionSig, FunctionSig_Static) == 100); + +#ifdef DEBUG + Message(std::format("[DEBUG]: StaticloadObject Valid? {}", LoadObjectValid_ ? "false" : "true"), LoadObjectValid_ ? FOREGROUND_RED : FOREGROUND_GREEN); +#endif + } + + Initialized = true; return true; @@ -182,6 +86,7 @@ namespace Cheat { + bool IniConsoleHook; HANDLE hStdout; bool IsInput = false; @@ -431,26 +336,11 @@ namespace Cheat { } - //void GetInput(std::string Text, std::string& Output, bool& hasFinished) { - // IsInput = true; - - // std::cout << Text; - // std::cin >> Output; - - // size_t lengthLine = Text.length() + Output.length(); - - - // std::cout << "\r"; - // std::cout << "\033[K"; - - // EmptyQueue(); - - // hasFinished = true; - //} - - void GetInputW(std::string Text, std::wstring& Output, bool& hasFinished) { + void GetInput(std::string Text, std::string& Output, bool& hasFinished) { if (IsInput)return; + SetForegroundWindow(GetConsoleWindow()); + IsInput = true; std::cout.clear(); @@ -463,6 +353,45 @@ namespace Cheat { std::cout << Text; + std::getline(std::cin, Output); + + int lengthLine = Text.length() + Output.length(); + + MoveCursorConsole(0, -1); + MoveCursorConsole(-lengthLine, 0); + + + for (size_t i = 0; i < lengthLine; i++) + { + std::cout << " "; + } + + MoveCursorConsole(-lengthLine, 0); + + IsInput = false; + + EmptyQueue(); + + hasFinished = true; + } + + void GetInputW(std::string Text, std::wstring& Output, bool& hasFinished) { + if (IsInput)return; + + SetForegroundWindow(GetConsoleWindow()); + + IsInput = true; + + std::cout.clear(); + std::wcin.clear(); + + std::fflush(stdin); + + Text = "[Input] " + Text; + + std::cout << Text; + + std::getline(std::wcin, Output); int lengthLine = Text.length() + Output.length(); @@ -504,6 +433,10 @@ namespace Cheat { return true; } + bool IsKeyPressed(DWORD key, bool Holding = false) { + return (Holding ? (GetAsyncKeyState(key) & 1) : GetAsyncKeyState(key)) && ZeroGUI::isGameFocussed; + } + bool IniObjects() { Stages = 0; @@ -521,9 +454,33 @@ namespace Cheat { bool Changedlvl = false; + if (CurLevel != WorldP->PersistentLevel) { CurLevel = WorldP->PersistentLevel; + /*auto Instances = Cheat::FindInstances(SDK::APostProcessVolume::StaticClass()); + + for (size_t i = 0; i < Instances.size(); i++) + { + auto CurrentProcess = (SDK::APostProcessVolume*)Instances[i]; + + auto ProcessComponent = (SDK::UPostProcessComponent*)CurrentProcess->GetComponentByClass(SDK::UPostProcessComponent::StaticClass()); + + SDK::UMaterialInstance* blabla; + + SDK::TArray WeightedArray = ProcessComponent->Settings.WeightedBlendables.Array; + + ProcessComponent->Settings.WeightedBlendables.Array = SDK::TArray(ProcessComponent->Settings.WeightedBlendables.Array.Num() + 1); + + for (size_t i = 0; i < WeightedArray.Num(); i++) + { + ProcessComponent->Settings.WeightedBlendables.Array[i] = WeightedArray[i]; + } + + ProcessComponent->Settings.WeightedBlendables.Array[ProcessComponent->Settings.WeightedBlendables.Array.Num() - 1].Weight = 1.0f; + ProcessComponent->Settings.WeightedBlendables.Array[ProcessComponent->Settings.WeightedBlendables.Array.Num() - 1].Object = blabla; + }*/ + Changedlvl = true; for (size_t i = 0; i < sizeof(Settings::IniShitsLevel); i++) @@ -543,6 +500,7 @@ namespace Cheat { { WorldP->NetDriver->ConnectionTimeout = 10.0f; + Backend::HostID = WorldP->NetDriver->ServerConnection->URL_.Host.ToWString(); Backend::HostSteamID = WorldP->NetDriver->ServerConnection->URL_.Host.ToString(); Backend::CleanSteamID(); @@ -854,7 +812,7 @@ namespace Cheat { } SDK::UObject* FindInstance(SDK::UClass* Class) { - static SDK::UObject* Object = nullptr; + SDK::UObject* Object = nullptr; if (!Object) { @@ -878,7 +836,7 @@ namespace Cheat { std::vector FindInstances(SDK::UClass* Class) { - static std::vector Objects; + std::vector Objects; for (int i = 0; i < SDK::UObject::GObjects->Num(); i++) { @@ -897,6 +855,45 @@ namespace Cheat { return Objects; } + SDK::AActor* GetActorOfClass(SDK::UWorld* World, SDK::UClass* Class) { + SDK::AActor* ActorOut = nullptr; + + auto ActorArray = World->PersistentLevel->Actors; + + if (ActorArray.IsValid()) { + for (size_t i = 0; i < ActorArray.Num(); i++) + { + SDK::AActor* CurrentActor = ActorArray[i]; + + if (CurrentActor && CurrentActor->IsA(Class)) + { + ActorOut = CurrentActor; + break; + } + } + } + + return ActorOut; + } + + std::vector GetAllActorsOfClass(SDK::UWorld* World, SDK::UClass* Class) { + std::vector Objects; + + auto ActorArray = World->PersistentLevel->Actors; + + if (ActorArray.IsValid()) { + for (size_t i = 0; i < ActorArray.Num(); i++) + { + SDK::AActor* CurrentActor = ActorArray[i]; + + if (CurrentActor && CurrentActor->IsA(Class)) + Objects.push_back(CurrentActor); + } + } + + return Objects; + } + std::vector FuncsNames; void GodMode(SDK::UObject* Caller, SDK::UFunction* Func, void* Params) { @@ -936,8 +933,21 @@ namespace Cheat { + if (Stages >= defines::Pawn) { + + { + if (Settings::Open) { + Pawn->DisableInput(PlayerController); + } + else + { + Pawn->EnableInput(PlayerController); + } + } + } if (Stages >= defines::PlayerController) { + if (Settings::wtf_) { Settings::wtf_ = false; @@ -1048,11 +1058,6 @@ namespace Cheat { } #endif - if (Settings::ProtectCamServer && !Settings::IniShitsPlayer[0]) { - Settings::IniShitsPlayer[0] = true; - PlayerController->PlayerCameraManager->SetReplicates(false); - } - //static ULONGLONG TickCountGameModeCurrent = 0; //if (TickCount >= TickCountGameModeCurrent) { @@ -1122,21 +1127,16 @@ namespace Cheat { PlayerStuff::PlayerList.clear(); - SDK::TArray Players; - //SDK::TArray Characters; + auto Players = GetAllActorsOfClass(WorldP, SDK::APlayerState::StaticClass()); - - GPStatics->GetAllActorsOfClass(WorldP, SDK::APlayerState::StaticClass(), &Players); - //GPStatics->GetAllActorsOfClass(WorldP, SDK::ABPCharacter_Demo_C::StaticClass(), &Characters); - - if (Players.IsValid()) { + if (Players.size() > 0) { cleared = false; auto bpClass = SDK::ABPCharacter_Demo_C::StaticClass(); auto AMPGamemodeClass = SDK::AMP_GameMode_C::StaticClass(); auto SpectatorPawnClass = SDK::ASpectatorPawn::StaticClass(); - for (size_t i = 0; i < Players.Num(); i++) + for (size_t i = 0; i < Players.size(); i++) { auto State = (SDK::APlayerState*)Players[i]; @@ -1232,6 +1232,39 @@ namespace Cheat { } + if (Settings::SpawnRopeAtEventPlayer) { + Settings::Event_PlayerID = -1; + Settings::SpawnRopeAtEventPlayer = false; + + if (auto Char_ = (SDK::ABPCharacter_Demo_C*)PlayerController->Character; Char_ && Char_->IsA(SDK::ABPCharacter_Demo_C::StaticClass())) { + + auto ItemRep = Char_->CurrentItem_Rep; + + if (ItemRep) { + auto rope = (SDK::ABP_Rope_C*)SDK::ABP_Rope_C::GetDefaultObj(); + + if (ItemRep->ID == rope->ID) { + rope = (SDK::ABP_Rope_C*)ItemRep; + + + rope->SRV_TossRope((SDK::ABP_Rope_Floor_C*)Owner_, Owner_->K2_GetActorLocation() + Owner_->GetActorForwardVector() * 2 ); + rope->SRV_ShowRope(Owner_, Owner_->K2_GetActorLocation() + Owner_->GetActorForwardVector() * 2); + } + } + } + } + + if (Settings::SpectateEventPlayer) { + Settings::Event_PlayerID = -1; + Settings::SpectateEventPlayer = false; + + if (Settings::Freecam) { + if (Settings::IniShitsPlayer[Settings::PIsFreeCam]) { + PlayerController->K2_GetPawn()->K2_SetActorLocation(Owner_->K2_GetActorLocation(), false, 0, true); + } + } + } + if (Settings::UseItemEventPlayer) { Settings::Event_PlayerID = -1; Settings::UseItemEventPlayer = false; @@ -1255,6 +1288,20 @@ namespace Cheat { } + if (Settings::StealPawnEventPlayer) { + Settings::StealPawnEventPlayer = false; + Settings::Event_PlayerID = -1; + + if (Character_) { + auto char_ = (SDK::ABPCharacter_Demo_C*)(PlayerController->Character ? (PlayerController->Character->IsA(bpClass) ? PlayerController->Character : nullptr) : nullptr); + + if (char_) { + char_->StartPushingActor_SERVER((SDK::ABP_Pushable_C*)Character_, Pawn->K2_GetActorLocation(), Pawn->GetControlRotation()); + } + } + } + + //if (Settings::EventCollectDataPlayer) { // Settings::EventCollectDataPlayer = false; @@ -1310,6 +1357,7 @@ namespace Cheat { return a.PlayerID < b.PlayerID; }); } + } else { @@ -1364,11 +1412,10 @@ namespace Cheat { if (BoatClass) { - SDK::TArray BoatPawns; - GPStatics->GetAllActorsOfClass(WorldP, BoatClass, &BoatPawns); + auto BoatPawns = GetAllActorsOfClass(WorldP, BoatClass); - if (BoatPawns.IsValid()) { - for (size_t i = 0; i < BoatPawns.Num(); i++) + if (BoatPawns.size() > 0) { + for (size_t i = 0; i < BoatPawns.size(); i++) { auto BoatPawn = (SDK::ABP_RowBoat_C*)BoatPawns[i]; @@ -1387,6 +1434,7 @@ namespace Cheat { //BoatPawn->LaunchPawn(SDK::FVector(0, 0, 200.5f), false, false); if (Settings::BoatFly) { + auto DeltaTime = GPStatics->GetWorldDeltaSeconds(WorldP); BoatPawn->RootComponent->ComponentVelocity = { 0.0f, 0.0f, 0.0f }; BoatPawn->SceneComponent->ComponentVelocity = { 0.0f, 0.0f, 0.0f }; @@ -1394,7 +1442,7 @@ namespace Cheat { Settings::IniShitsLevel[5] = true; - if (GetAsyncKeyState(VK_LEFT)) { + if (UsefullFuncs::IsKeyPressed(VK_LEFT)) { SDK::FRotator rotation = BoatPawn->K2_GetActorRotation(); if (rotation.Yaw - 5.0f < -360.0f) { @@ -1409,7 +1457,7 @@ namespace Cheat { BoatPawn->K2_SetActorRotation(rotation, false); } - if (GetAsyncKeyState(VK_RIGHT)) { + if (UsefullFuncs::IsKeyPressed(VK_RIGHT)) { SDK::FRotator rotation = BoatPawn->K2_GetActorRotation(); if (rotation.Yaw + 5.0f > 360.0f) { @@ -1424,13 +1472,13 @@ namespace Cheat { BoatPawn->K2_SetActorRotation(rotation, false); } - if (GetAsyncKeyState(VK_SPACE)) { + if (UsefullFuncs::IsKeyPressed(VK_SPACE)) { auto BoatLoc = BoatPawn->K2_GetActorLocation(); auto Cam = PlayerController->PlayerCameraManager; - SDK::FVector ForwardCam = Cam->GetActorUpVector() * Settings::PlayerFlySpeedY; + SDK::FVector ForwardCam = (Cam->GetActorUpVector() * DeltaTime * 100) * Settings::PlayerFlySpeedY; SDK::FVector PositionOut = { BoatLoc.X + ForwardCam.X, BoatLoc.Y + ForwardCam.Y, BoatLoc.Z }; @@ -1440,13 +1488,13 @@ namespace Cheat { } - if (GetAsyncKeyState(VK_SHIFT)) { + if (UsefullFuncs::IsKeyPressed(VK_SHIFT)) { auto BoatLoc = BoatPawn->K2_GetActorLocation(); auto Cam = PlayerController->PlayerCameraManager; - SDK::FVector ForwardCam = Cam->GetActorUpVector() * Settings::PlayerFlySpeedY; + SDK::FVector ForwardCam = (Cam->GetActorUpVector() * DeltaTime * 100) * Settings::PlayerFlySpeedY; SDK::FVector PositionOut = { BoatLoc.X + ForwardCam.X, BoatLoc.Y + ForwardCam.Y, BoatLoc.Z}; @@ -1456,12 +1504,12 @@ namespace Cheat { } - if (GetAsyncKeyState('W')) { + if (UsefullFuncs::IsKeyPressed('W')) { auto BoatLoc = BoatPawn->K2_GetActorLocation(); auto Cam = PlayerController->PlayerCameraManager; - SDK::FVector ForwardCam = Cam->GetActorForwardVector() * Settings::PlayerFlySpeedY; + SDK::FVector ForwardCam = (Cam->GetActorForwardVector() * DeltaTime * 100) * Settings::PlayerFlySpeedY; SDK::FVector PositionOut = { BoatLoc.X + ForwardCam.X, BoatLoc.Y + ForwardCam.Y, BoatLoc.Z }; @@ -1469,24 +1517,24 @@ namespace Cheat { } - if (GetAsyncKeyState('S')) { + if (UsefullFuncs::IsKeyPressed('S')) { auto BoatLoc = BoatPawn->K2_GetActorLocation(); auto Cam = PlayerController->PlayerCameraManager; - SDK::FVector ForwardCam = Cam->GetActorForwardVector() * Settings::PlayerFlySpeedY; + SDK::FVector ForwardCam = (Cam->GetActorForwardVector() * DeltaTime * 100) * Settings::PlayerFlySpeedY; SDK::FVector PositionOut = { BoatLoc.X - ForwardCam.X, BoatLoc.Y - ForwardCam.Y, BoatLoc.Z}; BoatPawn->K2_SetActorLocation(PositionOut, false, 0, true); } - if (GetAsyncKeyState('A')) { + if (UsefullFuncs::IsKeyPressed('A')) { auto BoatLoc = BoatPawn->K2_GetActorLocation(); auto Cam = PlayerController->PlayerCameraManager; - SDK::FVector ForwardCam = Cam->GetActorRightVector() * Settings::PlayerFlySpeedY; + SDK::FVector ForwardCam = (Cam->GetActorRightVector() * DeltaTime * 100) * Settings::PlayerFlySpeedY; SDK::FVector PositionOut = { BoatLoc.X - ForwardCam.X, BoatLoc.Y - ForwardCam.Y, BoatLoc.Z}; @@ -1495,12 +1543,12 @@ namespace Cheat { - if (GetAsyncKeyState('D')) { + if (UsefullFuncs::IsKeyPressed('D')) { auto BoatLoc = BoatPawn->K2_GetActorLocation(); auto Cam = PlayerController->PlayerCameraManager; - SDK::FVector ForwardCam = Cam->GetActorRightVector() * Settings::PlayerFlySpeedY; + SDK::FVector ForwardCam = ( Cam->GetActorRightVector() * DeltaTime * 100) * Settings::PlayerFlySpeedY; SDK::FVector PositionOut = { BoatLoc.X + ForwardCam.X, BoatLoc.Y + ForwardCam.Y, BoatLoc.Z}; @@ -1541,11 +1589,10 @@ namespace Cheat { if (auto BoatClass = SDK::ABP_RowBoat_C::StaticClass(); BoatClass) { - SDK::TArray BoatPawns; - GPStatics->GetAllActorsOfClass(WorldP, BoatClass, &BoatPawns); + auto BoatPawns = GetAllActorsOfClass(WorldP, BoatClass); - if (BoatPawns.IsValid()) { - for (size_t i = 0; i < BoatPawns.Num(); i++) + if (BoatPawns.size() > 0) { + for (size_t i = 0; i < BoatPawns.size(); i++) { auto BoatPawn = (SDK::ABP_RowBoat_C*)BoatPawns[i]; @@ -1564,6 +1611,29 @@ namespace Cheat { if (BPCharacter) { + if (Settings::ProtectCamServer && !Settings::IniShitsPlayer[0]) { + Settings::IniShitsPlayer[0] = true; + BPCharacter->CameraComponent->SetIsReplicated(false); + } + +#ifdef DEBUG + { // Dont wanna pollute the main codeblock with static value, so own codeblock + + static SDK::FGuid MapPackageGuidCurrent = { 0,0,0,0 }; //use guid for whatever the fuck + + if (Settings::RejoinServer_Event) { + Settings::RejoinServer_Event = false; + + MapPackageGuidCurrent = { 0,0,0,0 }; + PlayerController->ClientTravelInternal(SDK::FString(Backend::HostID.c_str()), SDK::ETravelType::TRAVEL_Absolute, true, MapPackageGuidCurrent); + } + } +#endif + + /* + BPCharacter->Bob_Buoyancy_C74565444B6ED2300150BBA0C909B04A = 100.0f; + BPCharacter->OC_UpdateBuoyancy();*/ + if (Settings::OwnSelf) { Settings::OwnSelf = false; PlayerController->ServerAcknowledgePossession(BPCharacter); @@ -1597,40 +1667,117 @@ namespace Cheat { } -#ifdef DEBUG - //Spawn stuff inside your hand, that wasnt supposed to even Spawn in there (Exploit 1, Dangerous Exploit) - if (Settings::Spawner) { - if (GetAsyncKeyState('T') & 1) - { - SDK::UClass* SpawningThing = SDK::ABacteria_BP_C::StaticClass(); - - if (SpawningThing) - BPCharacter->SpawnEquipItem_SERVER(SpawningThing); - } - + if (Settings::Spawner_) { static ULONGLONG TickFindBoat = 0; - if (GetAsyncKeyState('U') & 1) - { + if (Settings::SpawnerEvent) { + Settings::SpawnerEvent = false; + SDK::UClass* SpawningThing = nullptr; + + switch (Settings::SpawnerValue) + { + case Settings::Spawner::Spawner_Stuff::None: + break; - SpawningThing = SDK::ABP_RowBoat_C::StaticClass(); + case Settings::Spawner::Spawner_Stuff::Boat: + SpawningThing = SDK::ABP_RowBoat_C::StaticClass(); - if (SpawningThing) - BPCharacter->SpawnEquipItem_SERVER(SpawningThing); + if (SpawningThing) { + BPCharacter->SpawnEquipItem_SERVER(SpawningThing); - Settings::IniShitsPlayer[5] = true; - TickFindBoat = TickCount + 100; + Settings::IniShitsPlayer[5] = true; + TickFindBoat = TickCount + 100; + } + break; + + case Settings::Spawner::Spawner_Stuff::Rope: + SpawningThing = SDK::ABP_Rope_C::StaticClass(); + + if (Functions::ShouldUsePointer64(SpawningThing)) { + BPCharacter->SpawnEquipItem_SERVER(SpawningThing); + } + else + { + Message("Couldnt Spawn Rope. Class Not Found"); + } + break; + + + case Settings::Spawner::Spawner_Stuff::BactiriaMonster: + SpawningThing = SDK::ABacteria_BP_C::StaticClass(); + + if (SpawningThing) + BPCharacter->SpawnEquipItem_SERVER(SpawningThing); + + break; + + + case Settings::Spawner::Spawner_Stuff::ExitZone: + SpawningThing = SDK::ABP_ExitZone_C::StaticClass(); + + if (Functions::ShouldUsePointer64(SpawningThing)) { + BPCharacter->SpawnEquipItem_SERVER(SpawningThing); + } + else + { + Message("Couldnt Spawn ExitZone. Class Not Found"); + } + break; + + + case Settings::Spawner::Spawner_Stuff::FireworkProj_Bugged: + SpawningThing = SDK::ABP_FireworkProjectile_C::StaticClass(); + + if (Functions::ShouldUsePointer64(SpawningThing)) { + BPCharacter->SpawnEquipItem_SERVER(SpawningThing); + Settings::IniShitsPlayer[3] = true; + Settings::IniShitsPlayer[4] = true; + + } + else + { + Message("Couldnt Spawn Firework. Class Not Found"); + } + break; + + case Settings::Spawner::Spawner_Stuff::Firework: + SpawningThing = SDK::ABP_Item_Firework_C::StaticClass(); + + if (Functions::ShouldUsePointer64(SpawningThing)) { + BPCharacter->SpawnEquipItem_SERVER(SpawningThing); + } + else + { + Message("Couldnt Spawn Firework. Class Not Found"); + } + break; + +#ifdef DEBUG + case Settings::Spawner::Spawner_Stuff::ExitZoneEndGame: + SpawningThing = SDK::UObject::FindClassFast(Settings::SpawningValue); + + if (Functions::ShouldUsePointer64(SpawningThing)) { + BPCharacter->SpawnEquipItem_SERVER(SpawningThing); + } + else + { + Message("Couldnt Spawn ExitZoneEndGame. Class Not Found"); + } + break; + +#endif // DEBUG + } } + if (Settings::IniShitsPlayer[5] && TickCount >= TickFindBoat) { TickFindBoat = TickCount + 100; - SDK::TArray Boats_2; - GPStatics->GetAllActorsOfClass(WorldP, SDK::ABoatPawn::StaticClass(), &Boats_2); + auto Boats_2 = GetAllActorsOfClass(WorldP, SDK::ABoatPawn::StaticClass()); - int Numb = Boats_2.Num(); + int Numb = Boats_2.size(); for (size_t i = 0; i < Numb; i++) { @@ -1649,86 +1796,7 @@ namespace Cheat { } } - //if (GetAsyncKeyState('O') & 1) - //{ - // //BPCharacter->CrouchAmount = -1000.0f; - // //BPCharacter->Crouch(false); - - // SDK::UClass* SpawningThing = SDK::::StaticClass(); - - // - - // if (SpawningThing) { - // auto Object = (SDK::ABP_DroppedItem_Glowstick_C*)SpawningThing->DefaultObject; - - // if (!Object) { - // Message("Default Object is null!"); - // } - - - // BPCharacter->SpawnEquipItem_SERVER(SpawningThing); - - // } - // else - // { - // Message("Class is null!"); - // } - - // //BPCharacter->CustomTimeDilation = 0.001f; - //} - - //Send people into the MainMenu by spawning an DefaultExitZone with no Parameters. No fallback from host, host has to restart game (Exploit 2, very severe, any level can be loaded with the right class) - if (GetAsyncKeyState('R') & 1) - { - //BPCharacter->CrouchAmount = -1000.0f; - //BPCharacter->Crouch(false); - SDK::UClass* SpawningThing = SDK::ABP_ExitZone_C::StaticClass(); - - if (Functions::ShouldUsePointer64(SpawningThing)) { - BPCharacter->SpawnEquipItem_SERVER(SpawningThing); - } - else - { - Message("Couldnt Spawn ExitZone. Class Not Found"); - } - //BPCharacter->CustomTimeDilation = 0.001f; - } - - if (GetAsyncKeyState('7') & 1) - { - //BPCharacter->CrouchAmount = -1000.0f; - //BPCharacter->Crouch(false); - SDK::UClass* SpawningThing = SDK::ABP_Rope_C::StaticClass(); - - if (Functions::ShouldUsePointer64(SpawningThing)) { - BPCharacter->SpawnEquipItem_SERVER(SpawningThing); - } - else - { - Message("Couldnt Spawn Rope. Class Not Found"); - } - //BPCharacter->CustomTimeDilation = 0.001f; - } - - if (GetAsyncKeyState('8') & 1) - { - //BPCharacter->CrouchAmount = -1000.0f; - //BPCharacter->Crouch(false); - SDK::UClass* SpawningThing = SDK::ABP_FireworkProjectile_C::StaticClass(); - - if (Functions::ShouldUsePointer64(SpawningThing)) { - BPCharacter->SpawnEquipItem_SERVER(SpawningThing); - Settings::IniShitsPlayer[3] = true; - Settings::IniShitsPlayer[4] = true; - - } - else - { - Message("Couldnt Spawn Firework. Class Not Found"); - } - //BPCharacter->CustomTimeDilation = 0.001f; - } - + if (Settings::IniShitsPlayer[3] && BPCharacter->CurrentItem_Rep) { @@ -1752,24 +1820,6 @@ namespace Cheat { BPCharacter->CurrentItem_Rep->K2_SetActorLocation(PlayerController->PlayerCameraManager->GetCameraLocation() + (PlayerController->PlayerCameraManager->GetActorForwardVector() * 2), false, 0, true); } } - else - { - static LONGLONG UpdateStatesTick = 0; - - if (TickCount >= UpdateStatesTick) { - UpdateStatesTick = TickCount + 10; - GetAsyncKeyState('T'); - GetAsyncKeyState('U'); - GetAsyncKeyState('O'); - GetAsyncKeyState('R'); - GetAsyncKeyState('7'); - GetAsyncKeyState('8'); - GetAsyncKeyState('9'); - } - - } - -#endif static SDK::FVector LastPos; @@ -1789,7 +1839,7 @@ namespace Cheat { } //FreeCam kinda - if (GetAsyncKeyState('J') & 1) + if (Settings::Freecam && UsefullFuncs::IsKeyPressed('J', true)) { //PlayerController->ServerPause(); //PlayerController->ClientReset(); @@ -1829,7 +1879,7 @@ namespace Cheat { //SDK::UWB_Chat_C //Become an Omega ultra sigma and live inside your own edit, while floating elegantly through the air - if (GetAsyncKeyState(VK_RSHIFT)) { + if (UsefullFuncs::IsKeyPressed(VK_RSHIFT)) { BPCharacter->CustomTimeDilation = 0.02f; } else @@ -1846,12 +1896,12 @@ namespace Cheat { } - //if (GetAsyncKeyState('P')) { + //if (UsefullFuncs::IsKeyPressed('P')) { // BPCharacter->PickUp_SERVER((SDK::ADroppedItem*)BPCharacter); // //Settings::ForceAdmin = true //} - if (GetAsyncKeyState('Z')) { + if (UsefullFuncs::IsKeyPressed('Z')) { Settings::TpEveryone = true; } @@ -1879,11 +1929,6 @@ namespace Cheat { //BPCharacter->SetCanCollide(false); - - - - - auto playerState = (SDK::AMP_PS_C*)BPCharacter->PlayerState; @@ -1996,10 +2041,156 @@ namespace Cheat { } -#ifdef DEBUG +#ifdef DEBUG //Load Chams, not working yet! working on it tho + + if (UsefullFuncs::IsKeyPressed(VK_F6, true)) + { + auto Materials = FindInstances(SDK::UObject::StaticClass()); + bool isMounted = false; + + + for (size_t i = 0; i < Materials.size(); i++) + { + if (Materials[i]->GetName().find("Chams_") != std::string::npos) { + isMounted = true; + Message(std::format("Found something!: {}", Materials[i]->GetFullName()), FOREGROUND_GREEN); + + auto Outer = Materials[i]->Outer; + + while (Outer) + { + Message(std::format("Outer {}!: {}",i, Outer->GetFullName()), FOREGROUND_GREEN); + Outer = Outer->Outer; + } + + + + // Correct path to the material without the .uasset extension + const wchar_t* AssetName = L"/Game/Materials/Chams_.Chams_"; // Name of the asset + + // Load the material using StaticLoadObject_Internal + SDK::UObject* OutObject = StaticLoadObject_Internal( + SDK::UObject::StaticClass(), // Class + nullptr, // InOuter_Optional + AssetName, // NameOfObject + nullptr, // FileName_Optional + 0, // LoadFlags + nullptr, // Sandbox_Needed + true, // AllowObjectReconciliation + nullptr // InstancingContext + ); + + if (OutObject) + Cheat::Message("Loaded Chams Material!"); + else + Cheat::Message("Couldn't Loaded Chams Material!"); + } + } + + if (!isMounted) { + + + Cheat::FPlatformFileManager* FileManager = Cheat::FPlatformFileManager$$Get(); + + if (FileManager) { + + + + void* PlatformFile = Cheat::FPakPlatformFile$$FindPlatformFile(FileManager, L"PakFile"); + + if (PlatformFile) { + + + + + if (Cheat::FPakPlatformFile$$Mount(PlatformFile, LR"(R:/SteamLibrary/steamapps/common/EscapeTheBackrooms/EscapeTheBackrooms/Content/Paks/TestAsset.pak)", 0, L"/fortnig/Content/Materials", true)) { + isMounted = true; + + // Correct path to the material without the .uasset extension + const wchar_t* AssetName = L"/fortnig/Content/Game/Materials/Chams_.Chams_"; // Name of the asset + + // Load the material using StaticLoadObject_Internal + SDK::UObject* OutObject = StaticLoadObject_Internal( + SDK::UObject::StaticClass(), // Class + nullptr, // InOuter_Optional + AssetName, // NameOfObject + nullptr, // FileName_Optional + 0, // LoadFlags + nullptr, // Sandbox_Needed + true, // AllowObjectReconciliation + nullptr // InstancingContext + ); + + if (OutObject) + Cheat::Message("Loaded Chams Material!"); + else + Cheat::Message("Couldn't Loaded Chams Material!"); + + + Materials = FindInstances(SDK::UObject::StaticClass()); + + + for (size_t i = 0; i < Materials.size(); i++) + { + if (Materials[i]->GetName().find("Chams_") != std::string::npos) { + Message(std::format("Found something!: {}", Materials[i]->GetFullName()), FOREGROUND_GREEN); + + auto Outer = Materials[i]->Outer; + + while (Outer) + { + Message(std::format("Outer {}!: {}", i, Outer->GetFullName()), FOREGROUND_GREEN); + Outer = Outer->Outer; + } + + + + // Correct path to the material without the .uasset extension + const wchar_t* AssetName = L"/fortnig/Content/Game/Materials/Chams_.Chams_"; // Name of the asset + + // Load the material using StaticLoadObject_Internal + SDK::UObject* OutObject = StaticLoadObject_Internal( + SDK::UObject::StaticClass(), // Class + nullptr, // InOuter_Optional + AssetName, // NameOfObject + nullptr, // FileName_Optional + 0, // LoadFlags + nullptr, // Sandbox_Needed + true, // AllowObjectReconciliation + nullptr // InstancingContext + ); + + if (OutObject) + Cheat::Message("Loaded Chams Material!"); + else + Cheat::Message("Couldn't Loaded Chams Material!"); + + break; + } + } + } + else + { + Message("Failed to Mount PakFile"); + } + + } + else + { + Message("PakPlatformFile was nullptr"); + } + } + else + { + Message("FileManager was nullptr"); + } + } + + } +#endif //Spawn ropes anywhere you want, how often you want also. (Exploit 3, severe) - if (GetAsyncKeyState(VK_F2)& 1 && BPCharacter->CurrentItem_Rep) { + if (UsefullFuncs::IsKeyPressed(VK_F2)& 1 && BPCharacter->CurrentItem_Rep) { auto rope = (SDK::ABP_Rope_C*)SDK::ABP_Rope_C::GetDefaultObj(); if (BPCharacter->CurrentItem_Rep->ID == rope->ID) { rope = (SDK::ABP_Rope_C*)BPCharacter->CurrentItem_Rep; @@ -2010,10 +2201,10 @@ namespace Cheat { } } -#endif // No real Frontend implementation for this, for now - if (GetAsyncKeyState(VK_F3) & 1) + + if (UsefullFuncs::IsKeyPressed(VK_F3, true)) { Settings::IniShitsPlayer[6] = !Settings::IniShitsPlayer[6]; } @@ -2036,7 +2227,7 @@ namespace Cheat { - //if (GetAsyncKeyState(VK_F3) & 1 && BPCharacter->CurrentItem_Rep) { // actual safe item + //if (UsefullFuncs::IsKeyPressed(VK_F3) & 1 && BPCharacter->CurrentItem_Rep) { // actual safe item // auto rope = (SDK::ABP_Scanner_C*)SDK::ABP_Scanner_C::GetDefaultObj(); // if (BPCharacter->CurrentItem_Rep->ID == rope->ID) { @@ -2220,7 +2411,7 @@ namespace Cheat { for (size_t i = 0; i < 300; i++) { BPCharacter->DropItem_SERVER(ItemClass->ID); - auto DeleteAbleClass = (SDK::ABP_DroppedItem_C*)GPStatics->GetActorOfClass(WorldP, SDK::ABP_DroppedItem_C::StaticClass()); + auto DeleteAbleClass = (SDK::ABP_DroppedItem_C*)GetActorOfClass(WorldP, SDK::ABP_DroppedItem_C::StaticClass()); if (DeleteAbleClass) { DeleteAbleClass->K2_DestroyActor(); } @@ -2234,12 +2425,12 @@ namespace Cheat { if (Settings::ClearItems) { - SDK::TArray Items; - GPStatics->GetAllActorsOfClass(WorldP, SDK::ABP_DroppedItem_C::StaticClass(), &Items); + auto Items = GetAllActorsOfClass(WorldP, SDK::ABP_DroppedItem_C::StaticClass()); + + if (Items.size() > 0) { - if (Items.IsValid()) { Settings::ClearItems = false; - for (size_t i = 0; i < Items.Num(); i++) + for (size_t i = 0; i < Items.size(); i++) { if (!Items[i])continue; @@ -2255,22 +2446,7 @@ namespace Cheat { if (Settings::UnpossePawns) { Settings::UnpossePawns = false; - SDK::TArray Pawns; - GPStatics->GetAllActorsOfClass(WorldP, SDK::AActor::StaticClass(), &Pawns); - - if (Pawns.IsValid()) { - for (size_t i = 0; i < Pawns.Num(); i++) - { - auto pawn = Pawns[i]; - - //BPCharacter->PickUp_SERVER((SDK::ADroppedItem*)Pawns[i]); - //BPCharacter->StartPushingActor_SERVER((SDK::ABP_Pushable_C*)Pawns[i], Pawns[i]->K2_GetActorLocation(), PlayerController->ControlRotation); - //BPCharacter->StopPushingActor_SERVER((SDK::ABP_Pushable_C*)Pawns[i]); - - - } - } - + } #endif @@ -2332,7 +2508,7 @@ namespace Cheat { if (Settings::VelocityFly) { - if (GetAsyncKeyState(VK_SPACE)) { + if (UsefullFuncs::IsKeyPressed(VK_SPACE)) { BPCharacter->SRV_Launch(Settings::PlayerFlySpeedY); BPCharacter->LaunchPawn(SDK::FVector(0, 0, Settings::PlayerFlySpeedY), false, true); } @@ -2341,74 +2517,87 @@ namespace Cheat { { WasFlying = true; BPCharacter->CharacterMovement->MovementMode = SDK::EMovementMode::MOVE_None; + auto DeltaTime = GPStatics->GetWorldDeltaSeconds(WorldP); - if (GetAsyncKeyState('W')) { + if (UsefullFuncs::IsKeyPressed('W')) { auto Cam = PlayerController->PlayerCameraManager; - SDK::FVector ForwardCam = Cam->GetActorForwardVector() * Settings::PlayerFlySpeedY; + SDK::FVector ForwardCam = (Cam->GetActorForwardVector() * DeltaTime * 100) * Settings::PlayerFlySpeedY; auto PlayerPos = PlayerController->AcknowledgedPawn->K2_GetActorLocation(); PlayerController->AcknowledgedPawn->K2_SetActorLocation(SDK::FVector(PlayerPos.X + ForwardCam.X, PlayerPos.Y + ForwardCam.Y, PlayerPos.Z + ForwardCam.Z), false, 0, true); } - if (GetAsyncKeyState('S')) { + if (UsefullFuncs::IsKeyPressed('S')) { auto Cam = PlayerController->PlayerCameraManager; - SDK::FVector ForwardCam = Cam->GetActorForwardVector() * Settings::PlayerFlySpeedY; + SDK::FVector ForwardCam = (Cam->GetActorForwardVector() * DeltaTime * 100) * Settings::PlayerFlySpeedY; auto PlayerPos = PlayerController->AcknowledgedPawn->K2_GetActorLocation(); PlayerController->AcknowledgedPawn->K2_SetActorLocation(SDK::FVector(PlayerPos.X - ForwardCam.X, PlayerPos.Y - ForwardCam.Y, PlayerPos.Z - ForwardCam.Z), false, 0, true); } - if (GetAsyncKeyState('A')) { + if (UsefullFuncs::IsKeyPressed('A')) { auto Cam = PlayerController->PlayerCameraManager; - SDK::FVector RightVector = Cam->GetActorRightVector() * Settings::PlayerFlySpeedY; + SDK::FVector RightVector = (Cam->GetActorRightVector() * DeltaTime * 100) * Settings::PlayerFlySpeedY; auto PlayerPos = PlayerController->AcknowledgedPawn->K2_GetActorLocation(); PlayerController->AcknowledgedPawn->K2_SetActorLocation(SDK::FVector(PlayerPos.X - RightVector.X, PlayerPos.Y - RightVector.Y, PlayerPos.Z - RightVector.Z), false, 0, true); } - if (GetAsyncKeyState('D')) { + if (UsefullFuncs::IsKeyPressed('D')) { auto Cam = PlayerController->PlayerCameraManager; - SDK::FVector RightVector = Cam->GetActorRightVector() * Settings::PlayerFlySpeedY; + SDK::FVector RightVector = (Cam->GetActorRightVector() * DeltaTime * 100) * Settings::PlayerFlySpeedY; auto PlayerPos = PlayerController->AcknowledgedPawn->K2_GetActorLocation(); PlayerController->AcknowledgedPawn->K2_SetActorLocation(SDK::FVector(PlayerPos.X + RightVector.X, PlayerPos.Y + RightVector.Y, PlayerPos.Z + RightVector.Z), false, 0, true); } - if (GetAsyncKeyState(VK_SPACE)) { + if (UsefullFuncs::IsKeyPressed(VK_SPACE)) { auto Cam = PlayerController->PlayerCameraManager; - SDK::FVector UPVector = Cam->GetActorUpVector() * Settings::PlayerFlySpeedY; + SDK::FVector UPVector = (Cam->GetActorUpVector() * DeltaTime * 100) * Settings::PlayerFlySpeedY; auto PlayerPos = PlayerController->AcknowledgedPawn->K2_GetActorLocation(); PlayerController->AcknowledgedPawn->K2_SetActorLocation(SDK::FVector(PlayerPos.X + UPVector.X, PlayerPos.Y + UPVector.Y, PlayerPos.Z + UPVector.Z), false, 0, true); } - if (GetAsyncKeyState(VK_SHIFT)) { + if (UsefullFuncs::IsKeyPressed(VK_SHIFT)) { auto Cam = PlayerController->PlayerCameraManager; - SDK::FVector UPVector = Cam->GetActorUpVector() * Settings::PlayerFlySpeedY; + SDK::FVector UPVector = (Cam->GetActorUpVector() * DeltaTime * 100) * Settings::PlayerFlySpeedY; auto PlayerPos = PlayerController->AcknowledgedPawn->K2_GetActorLocation(); PlayerController->AcknowledgedPawn->K2_SetActorLocation(SDK::FVector(PlayerPos.X - UPVector.X, PlayerPos.Y - UPVector.Y, PlayerPos.Z - UPVector.Z), false, 0, true); } -#ifdef DEBUG //no real frontend for this yet - if (GetAsyncKeyState(VK_F1)) { - BPCharacter->StartPushingActor_SERVER((SDK::ABP_Pushable_C*)PlayerController->AcknowledgedPawn, PlayerController->AcknowledgedPawn->K2_GetActorLocation(), PlayerController->ControlRotation); - BPCharacter->StopPushingActor_SERVER((SDK::ABP_Pushable_C*)PlayerController->AcknowledgedPawn); + if (Settings::Freecam && UsefullFuncs::IsKeyPressed(VK_F1)) { + BPCharacter->StartPushingActor_SERVER((SDK::ABP_Pushable_C*)nullptr, PlayerController->AcknowledgedPawn->K2_GetActorLocation(), PlayerController->ControlRotation); + BPCharacter->StopPushingActor_SERVER((SDK::ABP_Pushable_C*)nullptr); } -#endif +#ifdef DEBUG + static bool LoopTP = false; + + if(UsefullFuncs::IsKeyPressed(VK_F5, true)) { + LoopTP = !LoopTP; + } + + + if (Settings::Freecam && LoopTP) { + BPCharacter->StartPushingActor_SERVER((SDK::ABP_Pushable_C*)nullptr, PlayerController->AcknowledgedPawn->K2_GetActorLocation(), PlayerController->ControlRotation); + BPCharacter->StopPushingActor_SERVER((SDK::ABP_Pushable_C*)nullptr); + } + +#endif // DEBUG } } @@ -2477,17 +2666,16 @@ namespace Cheat { //if (true) { //Esp Start - SDK::TArray EnemyArray; - + if (Settings::InteractablesEsp || Settings::InteractAll || Settings::InteractEvent || Settings::BringAllItems) { - GPStatics->GetAllActorsOfClass(Engine->GameViewport->World, SDK::AInteractableActor::StaticClass(), &EnemyArray); + auto EnemyArray = GetAllActorsOfClass(Engine->GameViewport->World, SDK::AInteractableActor::StaticClass()); - if (EnemyArray.IsValid()) - for (size_t i = 0; i < EnemyArray.Num(); i++) + if (EnemyArray.size() > 0) + for (size_t i = 0; i < EnemyArray.size(); i++) { - if (!EnemyArray.IsValidIndex(i) || !EnemyArray[i])continue; + if (!EnemyArray[i])continue; auto CurrentInteractable = (SDK::AInteractableActor*)EnemyArray[i]; @@ -2531,12 +2719,12 @@ namespace Cheat { } } - GPStatics->GetAllActorsOfClass(Engine->GameViewport->World, SDK::AInteractablePawn::StaticClass(), &EnemyArray); + EnemyArray = GetAllActorsOfClass(Engine->GameViewport->World, SDK::AInteractablePawn::StaticClass()); - if (EnemyArray.IsValid()) { - for (size_t i = 0; i < EnemyArray.Num(); i++) + if (EnemyArray.size() > 0) { + for (size_t i = 0; i < EnemyArray.size(); i++) { - if (!EnemyArray.IsValidIndex(i) || !EnemyArray[i])continue; + if (!EnemyArray[i])continue; auto CurrentInteractable = (SDK::AInteractablePawn*)EnemyArray[i]; @@ -2574,9 +2762,8 @@ namespace Cheat { - if (EnemyArray.IsValid() && Settings::PeacefullMode || Settings::PlayerEsp || Settings::RandomName || Settings::Godmode || Settings::EnemyEsp || Settings::ForceAdmin || Settings::TpEveryone) { - - GPStatics->GetAllActorsOfClass(Engine->GameViewport->World, SDK::ACharacter::StaticClass(), &EnemyArray); + if (Settings::PeacefullMode || Settings::PlayerEsp || Settings::RandomName || Settings::Godmode || Settings::EnemyEsp || Settings::ForceAdmin || Settings::TpEveryone) { + auto EnemyArray = GetAllActorsOfClass(Engine->GameViewport->World, SDK::ACharacter::StaticClass()); SDK::UClass* StaticSkinMf = nullptr; SDK::UClass* StaticBacteriaMf = nullptr; @@ -2592,11 +2779,9 @@ namespace Cheat { if (Settings::RandomName) srand(time(NULL)); - - - for (size_t i = 0; i < EnemyArray.Num(); i++) + for (size_t i = 0; i < EnemyArray.size(); i++) { - if (!EnemyArray.IsValidIndex(i) || !EnemyArray[i] || EnemyArray[i] == PlayerController->Character)continue; + if (!EnemyArray[i] || EnemyArray[i] == PlayerController->Character)continue; auto CurrentEnemy = (SDK::ACharacter*)EnemyArray[i]; @@ -2606,29 +2791,6 @@ namespace Cheat { auto StateBP = (SDK::AMP_PS_C*)CharacterBP->PlayerState; if (CharacterBP) { -#ifdef Gatekeep - - if (Settings::ForceAdmin) - { - //BPCharacter->PickUp_SERVER((SDK::ADroppedItem*)CharacterBP); - //StateBP->SRV_AddSanity(-100.0f); - //CharacterBP->ShockedServer(); - if (BPCharacter->GetOwner() == StateBP) - PlayerController->ServerAcknowledgePossession(CharacterBP); - - //CharacterBP->ShockedClient(); - } - - - /*if (Settings::RandomName && StateBP) { - - auto numb = rand() % 50 + 1; - - if (numb == 25) { - PlayerController->ServerChangeName(StateBP->PlayerNamePrivate); - } - }*/ -#endif if (Settings::TpEveryone) { CharacterBP->Mesh->SetCollisionResponseToChannel(SDK::ECollisionChannel::ECC_Pawn, SDK::ECollisionResponse::ECR_Ignore); @@ -2639,7 +2801,7 @@ namespace Cheat { CharacterBP->K2_SetActorLocation(BPCharacter->K2_GetActorLocation(), false, 0, true); } - if (Settings::PlayerEsp) { + if (Settings::PlayerEsp && PlayerStuff::PlayerList.size() > 0 && PlayerController->PlayerState) { if (StateBP) { @@ -2674,8 +2836,47 @@ namespace Cheat { } } + + +#ifdef DEBUG + if (Settings::EnemyChams) { + auto EnemyMesh = CurrentEnemy->Mesh; + + if (EnemyMesh) { + if (!EnemyMesh->bRenderCustomDepth) { + + Message("Set RenderCustomDepth for Enemy!", FOREGROUND_GREEN); + + EnemyMesh->SetRenderCustomDepth(true); + EnemyMesh->SetCustomDepthStencilValue(1); + + + auto Mats = EnemyMesh->GetMaterials(); + auto Class_UMaterialInstanceDynamic = SDK::UMaterialInstanceDynamic::StaticClass(); + + for (size_t i = 0; i < Mats.Num(); i++) + { + auto MatInterface = Mats[i]; + + if (MatInterface) { + auto Material = (SDK::UMaterial*)MatInterface; + + if (Material) { + Material->BlendMode = SDK::EBlendMode::BLEND_Masked; + Material->TwoSided = true; + + auto MaterialInstance = EnemyMesh->CreateAndSetMaterialInstanceDynamicFromMaterial(0, Material); + + } + } + } + } + } + } + +#endif if (Settings::Godmode) { if (!Settings::IniShitsPlayer[7]) { @@ -2734,12 +2935,12 @@ namespace Cheat { if (Settings::ItemEsp) { - GPStatics->GetAllActorsOfClass(Engine->GameViewport->World, SDK::ABP_DroppedItem_C::StaticClass(), &EnemyArray); + auto EnemyArray = GetAllActorsOfClass(Engine->GameViewport->World, SDK::ABP_DroppedItem_C::StaticClass()); - if (EnemyArray.IsValid()) { - for (size_t i = 0; i < EnemyArray.Num(); i++) + if (EnemyArray.size() > 0) { + for (size_t i = 0; i < EnemyArray.size(); i++) { - if (!EnemyArray.IsValidIndex(i) || !EnemyArray[i])continue; + if (!EnemyArray[i])continue; auto CurrentThing = (SDK::ABP_DroppedItem_C*)EnemyArray[i]; @@ -2780,7 +2981,7 @@ namespace Cheat { if (Settings::TpToExit) { Settings::TpToExit = false; if (SDK::ABP_ExitZone_C::StaticClass()) { - auto ExitZone = GPStatics->GetActorOfClass(Engine->GameViewport->World, SDK::ABP_ExitZone_C::StaticClass()); + auto ExitZone = GetActorOfClass(Engine->GameViewport->World, SDK::ABP_ExitZone_C::StaticClass()); if (ExitZone && PlayerController->Pawn) { @@ -2803,15 +3004,15 @@ namespace Cheat { if (Settings::ActorEsp || Settings::ActorEvent || CamsOff) { - GPStatics->GetAllActorsOfClass(Engine->GameViewport->World, SDK::AActor::StaticClass(), &EnemyArray); + auto EnemyArray = GetAllActorsOfClass(Engine->GameViewport->World, SDK::AActor::StaticClass()); - if (EnemyArray.IsValid()) { + if (EnemyArray.size() > 0) { static bool WallsHidden = false; - for (size_t i = 0; i < EnemyArray.Num(); i++) + for (size_t i = 0; i < EnemyArray.size(); i++) { - if (!EnemyArray.IsValidIndex(i) || !UsefullFuncs::ShouldUsePtr(EnemyArray[i]))continue; + if (!UsefullFuncs::ShouldUsePtr(EnemyArray[i]))continue; auto CurrentEnemy = EnemyArray[i]; diff --git a/EscapeTheBackroomsGUiTest/CheatDefines.h b/EscapeTheBackroomsGUiTest/CheatDefines.h new file mode 100644 index 0000000..3182818 --- /dev/null +++ b/EscapeTheBackroomsGUiTest/CheatDefines.h @@ -0,0 +1,256 @@ +#pragma once + +#include "SDK/SDK.hpp" +#include + + +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(ptr)) == PAGE_NOACCESS) return false; + return true; + } + + template + + 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(ptr) = Value; + VirtualProtect((LPVOID)ptr, sizeof(Value), d, &ds); + return true; + } + + + template + + bool ReadMemW(uintptr_t ptr, T3& Value) { + if (ptr < 0x10000000 || ptr > 0x7fffffffffff || GetMemoryProtection(reinterpret_cast(ptr)) == PAGE_NOACCESS) return false; + DWORD d, ds; + int val2; + VirtualProtect((LPVOID)ptr, sizeof(Value), PAGE_EXECUTE_READWRITE, &d); + Value = *reinterpret_cast(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 GetFunctionSig(void* FunctionPtr, size_t sigsize) { + std::vector 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 source1, std::vector 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 + { + public: + AudioData(std::vector 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(StaticConstructObject_Internal(¶ms)); + } + +} \ No newline at end of file diff --git a/EscapeTheBackroomsGUiTest/Config.cpp b/EscapeTheBackroomsGUiTest/Config.cpp new file mode 100644 index 0000000..2381fdc --- /dev/null +++ b/EscapeTheBackroomsGUiTest/Config.cpp @@ -0,0 +1,415 @@ +#include "Config.h" +#include + +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 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 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 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 DataBuf; + + for (auto FieldRef : FieldReferences) { + auto FieldData = std::vector(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 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 ConfigSystem::GetLastErrors() +{ + std::vector 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 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 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(); +} + + +std::vector 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 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 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 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_; +} diff --git a/EscapeTheBackroomsGUiTest/Config.h b/EscapeTheBackroomsGUiTest/Config.h new file mode 100644 index 0000000..ccd4ba1 --- /dev/null +++ b/EscapeTheBackroomsGUiTest/Config.h @@ -0,0 +1,168 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +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 > FieldRefs; + +// +//#if Debug == true +//using EventHandler = std::function; +//EventHandler PrintOutError_Config; +//#endif + +struct ByteType { + size_t Size = 0; + std::vector Data; + + ByteType(ConfigSystemInternalSettings* configSettings, std::vector Data, size_t& Index); + + template + static std::vector TypeToByteType_Char(T type) { + const int size_ = sizeof(size_t); + + auto Size_ = sizeof(T); + auto Data_ = std::vector(size_ + Size_); + + std::memcpy(Data_.data(), &Size_, size_); + std::memcpy((void*)((uintptr_t)Data_.data() + size_), &type, Size_); + + + return Data_; + } + + template + 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 Data; + int ID = -1; + + Field_Config(ConfigSystemInternalSettings* configSettings, std::vector Data, size_t& Index); + std::vector 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 FieldToChars(); +}; + +class ConfigSystem +{ +private: + std::vector Fields; + std::vector Configs; + std::vector FieldReferences; + std::string LastPath = ""; + std::string LastConfigName = ""; + std::vector 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 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 + 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); + } +}; \ No newline at end of file diff --git a/EscapeTheBackroomsGUiTest/EscapeTheBackroomsGUiTest.vcxproj b/EscapeTheBackroomsGUiTest/EscapeTheBackroomsGUiTest.vcxproj index e4b7fb7..9345b7b 100644 --- a/EscapeTheBackroomsGUiTest/EscapeTheBackroomsGUiTest.vcxproj +++ b/EscapeTheBackroomsGUiTest/EscapeTheBackroomsGUiTest.vcxproj @@ -91,7 +91,7 @@ C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Include;$(IncludePath) C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;$(LibraryPath) - C:\Users\sonny\Downloads\backgroundpng\Out;$(ExternalIncludePath) + U:\DCInParis\EscapeTheBackroomsGUiTest\EscapeTheBackroomsGUiTest\Out;$(ExternalIncludePath) true @@ -185,6 +185,8 @@ + + @@ -2216,6 +2218,7 @@ + Create @@ -2287,6 +2290,9 @@ + + + diff --git a/EscapeTheBackroomsGUiTest/EscapeTheBackroomsGUiTest.vcxproj.filters b/EscapeTheBackroomsGUiTest/EscapeTheBackroomsGUiTest.vcxproj.filters index 3d8df3c..1652d0f 100644 --- a/EscapeTheBackroomsGUiTest/EscapeTheBackroomsGUiTest.vcxproj.filters +++ b/EscapeTheBackroomsGUiTest/EscapeTheBackroomsGUiTest.vcxproj.filters @@ -28,6 +28,12 @@ {95e8b4c8-8ffc-4072-bbbf-ccc60f9ec0d2} + + {bba920a8-d176-4373-8ff3-472ffccd2db0} + + + {139fb867-83d1-4ac8-9301-f256e8409a20} + @@ -6120,6 +6126,12 @@ Headerdateien\Data\ContainingImageData + + Headerdateien\Config + + + Headerdateien + @@ -6335,5 +6347,17 @@ Quelldateien\SDK + + Quelldateien\SDK + + + Quelldateien\SDK + + + Quelldateien\SDK + + + Quelldateien\Config + \ No newline at end of file diff --git a/EscapeTheBackroomsGUiTest/GUI/ZeroGUI.h b/EscapeTheBackroomsGUiTest/GUI/ZeroGUI.h index 1e53e62..37e4373 100644 --- a/EscapeTheBackroomsGUiTest/GUI/ZeroGUI.h +++ b/EscapeTheBackroomsGUiTest/GUI/ZeroGUI.h @@ -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); - // } + // } // } diff --git a/EscapeTheBackroomsGUiTest/GUI/ZeroInput.h b/EscapeTheBackroomsGUiTest/GUI/ZeroInput.h index bf241a3..0400ecf 100644 --- a/EscapeTheBackroomsGUiTest/GUI/ZeroInput.h +++ b/EscapeTheBackroomsGUiTest/GUI/ZeroInput.h @@ -1,8 +1,13 @@ #pragma once #include +#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; } diff --git a/EscapeTheBackroomsGUiTest/SDK/SDK.hpp b/EscapeTheBackroomsGUiTest/SDK/SDK.hpp index 3e3f4ed..526215a 100644 --- a/EscapeTheBackroomsGUiTest/SDK/SDK.hpp +++ b/EscapeTheBackroomsGUiTest/SDK/SDK.hpp @@ -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" diff --git a/EscapeTheBackroomsGUiTest/SDK/SDK/Basic.hpp b/EscapeTheBackroomsGUiTest/SDK/SDK/Basic.hpp index 8d076c6..92b1cb1 100644 --- a/EscapeTheBackroomsGUiTest/SDK/SDK/Basic.hpp +++ b/EscapeTheBackroomsGUiTest/SDK/SDK/Basic.hpp @@ -88,6 +88,7 @@ public: { } + inline T& operator[](uint32 Index) { return Data[Index]; diff --git a/EscapeTheBackroomsGUiTest/SDK/SDK/Engine_classes.hpp b/EscapeTheBackroomsGUiTest/SDK/SDK/Engine_classes.hpp index 85ecc4d..1e939a9 100644 --- a/EscapeTheBackroomsGUiTest/SDK/SDK/Engine_classes.hpp +++ b/EscapeTheBackroomsGUiTest/SDK/SDK/Engine_classes.hpp @@ -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 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 Actors; + TArray ActorsForGC; class UWorld* OwningWorld; // 0xB8(0x8)(ZeroConstructor, Transient, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class UModel* Model; // 0xC0(0x8)(ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) TArray ModelComponents; // 0xC8(0x10)(ExportObject, ZeroConstructor, ContainsInstancedReference, NativeAccessSpecifierPublic) diff --git a/EscapeTheBackroomsGUiTest/Settings.h b/EscapeTheBackroomsGUiTest/Settings.h index 2679f91..ea30071 100644 --- a/EscapeTheBackroomsGUiTest/Settings.h +++ b/EscapeTheBackroomsGUiTest/Settings.h @@ -3,6 +3,7 @@ #include #include #include +#include "Config.h" namespace Backend { using EventHandler = std::function; @@ -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; - - case L'u': - out += (hasChangedSize) ? L'Ú' : L'ú'; - break; - - default: - out += letternormal; - break; - } + wchar_t charNext = (letternormal == L'i' ? L'í' : + letternormal == L'u' ? L'ú' : + letternormal == L'I' ? L'Í' : + letternormal == L'U' ? L'Ú' : + letternormal); + + out += charNext; } return out; diff --git a/EscapeTheBackroomsGUiTest/dllmain.cpp b/EscapeTheBackroomsGUiTest/dllmain.cpp index 3ca90a8..c0df267 100644 --- a/EscapeTheBackroomsGUiTest/dllmain.cpp +++ b/EscapeTheBackroomsGUiTest/dllmain.cpp @@ -1,10 +1,12 @@ -#include "SDK/SDK.hpp" +#include "SDK/SDK.hpp" #include #include #include "Cheat.h" #include #include +#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 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); - - 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; - } + if (GetAsyncKeyState(VK_DELETE) & 1) + ExitCheat(); + } 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,7 +1343,9 @@ void MainThread() { MH_EnableHook(reinterpret_cast(fnProcessEventTarget)); + ZeroGUI::CurrentWindow = FindWindowA("UnrealWindow", "EscapeTheBackrooms "); + if (!origin_renderer || !fnProcessEventOrigin) { auto renderError = !origin_renderer ? "PostRender" : ""; std::string spacing = renderError != "" ? "," : ""; @@ -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 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;