reboot living up to its name

This commit is contained in:
Milxnor
2023-06-19 10:11:30 -04:00
parent 5f51e034b0
commit 444af18b39
15 changed files with 115 additions and 50 deletions

View File

@@ -27,7 +27,10 @@ void ABuildingGameplayActorSpawnMachine::RebootingDelegateHook(ABuildingGameplay
LOG_INFO(LogDev, "RebootingDelegateHook!"); LOG_INFO(LogDev, "RebootingDelegateHook!");
if (!SpawnMachine->GetResurrectLocation()) if (!SpawnMachine->GetResurrectLocation())
{
LOG_WARN(LogRebooting, "Reboot van did not have a resurrection location!");
return; return;
}
LOG_INFO(LogDev, "PlayerIdsForResurrection.Num(): {}", SpawnMachine->GetPlayerIdsForResurrection().Num()); LOG_INFO(LogDev, "PlayerIdsForResurrection.Num(): {}", SpawnMachine->GetPlayerIdsForResurrection().Num());
@@ -61,8 +64,6 @@ void ABuildingGameplayActorSpawnMachine::RebootingDelegateHook(ABuildingGameplay
} }
} }
LOG_INFO(LogDev, "PlayerController: {}", __int64(PlayerController));
if (!PlayerController) if (!PlayerController)
return; return;
@@ -91,27 +92,24 @@ void ABuildingGameplayActorSpawnMachine::RebootingDelegateHook(ABuildingGameplay
if (!StrongResurrectionLocation) if (!StrongResurrectionLocation)
return; return;
// GameMode->RestartPlayerAtPlayerStart(PlayerController, StrongResurrectionLocation);
PlayerState->GetRespawnData()->IsRespawnDataAvailable() = false; PlayerState->GetRespawnData()->IsRespawnDataAvailable() = false;
PlayerController->SetPlayerIsWaiting(true); PlayerController->SetPlayerIsWaiting(true);
PlayerController->ServerRestartPlayer(); // PlayerController->ServerRestartPlayer();
/* static auto PawnClass = FindObject<UClass>("/Game/Athena/PlayerPawn_Athena.PlayerPawn_Athena_C"); bool bEnterSkydiving = false; // TODO get from like curve table iirc idk or the variable
auto NewPawn = GetWorld()->SpawnActor<AFortPlayerPawnAthena>(PawnClass, StrongResurrectionLocation->GetTransform()); PlayerController->RespawnPlayerAfterDeath(bEnterSkydiving);
PlayerController->Possess(NewPawn); */
AFortPlayerPawn* NewPawn = Cast<AFortPlayerPawn>(PlayerController->GetMyFortPawn()); AFortPlayerPawn* NewPawn = Cast<AFortPlayerPawn>(PlayerController->GetMyFortPawn());
LOG_INFO(LogDev, "NewPawn: {}", __int64(NewPawn)); LOG_INFO(LogDev, "NewPawn: {}", __int64(NewPawn));
if (!NewPawn) // Failed to restart player if (!NewPawn) // Failed to restart player
{
LOG_INFO(LogRebooting, "Failed to restart the player!");
return; return;
}
bool bEnterSkydiving = false; // TODO get from like curve table iirc idk or the variable
PlayerController->ClientClearDeathNotification(); PlayerController->ClientClearDeathNotification();
// PlayerController->RespawnPlayerAfterDeath(bEnterSkydiving);
NewPawn->SetHealth(100); NewPawn->SetHealth(100);
NewPawn->SetMaxHealth(100); NewPawn->SetMaxHealth(100);
@@ -122,6 +120,9 @@ void ABuildingGameplayActorSpawnMachine::RebootingDelegateHook(ABuildingGameplay
static auto OnRep_RebootCounterFn = FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerStateAthena.OnRep_RebootCounter"); static auto OnRep_RebootCounterFn = FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerStateAthena.OnRep_RebootCounter");
PlayerState->ProcessEvent(OnRep_RebootCounterFn); PlayerState->ProcessEvent(OnRep_RebootCounterFn);
auto OnPlayerPawnResurrectedFn = SpawnMachine->FindFunction("OnPlayerPawnResurrected");
SpawnMachine->ProcessEvent(OnPlayerPawnResurrectedFn, &NewPawn);
static void (*AddToAlivePlayersOriginal)(AFortGameModeAthena* GameMode, AFortPlayerControllerAthena* Player) = decltype(AddToAlivePlayersOriginal)(Addresses::AddToAlivePlayers); static void (*AddToAlivePlayersOriginal)(AFortGameModeAthena* GameMode, AFortPlayerControllerAthena* Player) = decltype(AddToAlivePlayersOriginal)(Addresses::AddToAlivePlayers);
if (AddToAlivePlayersOriginal) if (AddToAlivePlayersOriginal)
@@ -129,9 +130,6 @@ void ABuildingGameplayActorSpawnMachine::RebootingDelegateHook(ABuildingGameplay
AddToAlivePlayersOriginal(GameMode, PlayerController); AddToAlivePlayersOriginal(GameMode, PlayerController);
} }
auto OnPlayerPawnResurrectedFn = SpawnMachine->FindFunction("OnPlayerPawnResurrected");
SpawnMachine->ProcessEvent(OnPlayerPawnResurrectedFn, &NewPawn);
bool IsFinalPlayerToBeRebooted = true; bool IsFinalPlayerToBeRebooted = true;
if (IsFinalPlayerToBeRebooted) if (IsFinalPlayerToBeRebooted)

View File

@@ -687,6 +687,35 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
LOG_INFO(LogNet, "WorldLevel {}", GameState->GetWorldLevel()); LOG_INFO(LogNet, "WorldLevel {}", GameState->GetWorldLevel());
if (Globals::AmountOfListens == 1) // we only want to do this one time.
{
if (bEnableRebooting)
{
auto GameSessionDedicatedAthenaPatch = Memcury::Scanner::FindPattern("3B 41 38 7F ? 48 8B D0 48 8B 41 30 4C 39 04 D0 75 ? 48 8D 96", false).Get(); // todo check this sig more
if (GameSessionDedicatedAthenaPatch)
{
PatchBytes(GameSessionDedicatedAthenaPatch, { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 });
}
else
{
auto S19Patch = Memcury::Scanner::FindPattern("74 1A 48 8D 97 ? ? ? ? 49 8B CF E8 ? ? ? ? 88 87 ? ? ? ? E9").Get();
if (S19Patch)
{
PatchByte(S19Patch, 0x75);
}
}
if (bEnableRebooting)
{
HookInstruction(Addresses::RebootingDelegate, (PVOID)ABuildingGameplayActorSpawnMachine::RebootingDelegateHook, "/Script/Engine.PlayerController.SetVirtualJoystickVisibility", ERelativeOffsets::LEA, FindObject("/Script/FortniteGame.Default__BuildingGameplayActorSpawnMachine"));
}
LOG_INFO(LogDev, "Patched GameSession!");
}
}
if (auto TeamsArrayContainer = GameState->GetTeamsArrayContainer()) if (auto TeamsArrayContainer = GameState->GetTeamsArrayContainer())
{ {
GET_PLAYLIST(GameState); GET_PLAYLIST(GameState);
@@ -700,6 +729,7 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
LOG_INFO(LogDev, "TeamsArrayContainer->TeamsArray.Num() Before: {}", TeamsArrayContainer->TeamsArray.Num()); LOG_INFO(LogDev, "TeamsArrayContainer->TeamsArray.Num() Before: {}", TeamsArrayContainer->TeamsArray.Num());
LOG_INFO(LogDev, "TeamsArrayContainer->SquadsArray.Num() Before: {}", TeamsArrayContainer->SquadsArray.Num()); LOG_INFO(LogDev, "TeamsArrayContainer->SquadsArray.Num() Before: {}", TeamsArrayContainer->SquadsArray.Num());
/*
if (TeamsArrayContainer->TeamsArray.Num() != AllTeamsNum) if (TeamsArrayContainer->TeamsArray.Num() != AllTeamsNum)
{ {
LOG_INFO(LogDev, "Filling TeamsArray!"); LOG_INFO(LogDev, "Filling TeamsArray!");
@@ -713,6 +743,7 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
TeamsArrayContainer->SquadsArray.Free(); TeamsArrayContainer->SquadsArray.Free();
TeamsArrayContainer->SquadsArray.AddUninitialized(AllTeamsNum); TeamsArrayContainer->SquadsArray.AddUninitialized(AllTeamsNum);
} }
*/
for (int i = 0; i < TeamsArrayContainer->TeamsArray.Num(); i++) for (int i = 0; i < TeamsArrayContainer->TeamsArray.Num(); i++)
{ {
@@ -745,7 +776,7 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
{ {
auto CurrentRebootVan = (ABuildingGameplayActorSpawnMachine*)AllRebootVans.at(i); auto CurrentRebootVan = (ABuildingGameplayActorSpawnMachine*)AllRebootVans.at(i);
static auto FortPlayerStartClass = FindObject<UClass>(L"/Script/FortniteGame.FortPlayerStart"); static auto FortPlayerStartClass = FindObject<UClass>(L"/Script/FortniteGame.FortPlayerStart");
CurrentRebootVan->GetResurrectLocation() = CurrentRebootVan->GetClosestActor(FortPlayerStartClass, 100); CurrentRebootVan->GetResurrectLocation() = CurrentRebootVan->GetClosestActor(FortPlayerStartClass, 300);
} }
AllRebootVans.Free(); AllRebootVans.Free();

View File

@@ -294,7 +294,10 @@ void AFortGameStateAthena::OnRep_PlayersLeft()
TeamsArrayContainer* AFortGameStateAthena::GetTeamsArrayContainer() TeamsArrayContainer* AFortGameStateAthena::GetTeamsArrayContainer()
{ {
if (!bEnableRebooting) // todo (milxnor) remove // if (!bEnableRebooting) // todo (milxnor) remove when safer
// return nullptr;
if (Fortnite_Version < 8.0) // I'm pretty sure it got added on 7.40 but idk if it is structured differently.
return nullptr; return nullptr;
static auto FriendlyFireTypeOffset = GetOffset("FriendlyFireType"); static auto FriendlyFireTypeOffset = GetOffset("FriendlyFireType");
@@ -302,7 +305,8 @@ TeamsArrayContainer* AFortGameStateAthena::GetTeamsArrayContainer()
if (Offset == -1) if (Offset == -1)
{ {
Offset = FriendlyFireTypeOffset + 0x5; static int IncreaseBy = Engine_Version >= 424 ? 0x25 : 0x5;
Offset = FriendlyFireTypeOffset + IncreaseBy;
} }
return Offset != -1 ? (TeamsArrayContainer*)(__int64(this) + Offset) : nullptr; return Offset != -1 ? (TeamsArrayContainer*)(__int64(this) + Offset) : nullptr;

View File

@@ -323,6 +323,9 @@ void UFortKismetLibrary::K2_RemoveItemFromPlayerHook(UObject* Context, FFrame& S
LOG_INFO(LogDev, __FUNCTION__); LOG_INFO(LogDev, __FUNCTION__);
if(!PlayerController)
return K2_RemoveItemFromPlayerOriginal(Context, Stack, Ret);
auto WorldInventory = PlayerController->GetWorldInventory(); auto WorldInventory = PlayerController->GetWorldInventory();
if (!WorldInventory) if (!WorldInventory)

View File

@@ -1424,7 +1424,7 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo
LOG_INFO(LogDev, "PlayersLeft: {} IsDBNO: {}", GameState->GetPlayersLeft(), DeadPawn->IsDBNO()); LOG_INFO(LogDev, "PlayersLeft: {} IsDBNO: {}", GameState->GetPlayersLeft(), DeadPawn->IsDBNO());
if (!DeadPawn->IsDBNO()) if (bHandleDeath && !DeadPawn->IsDBNO())
{ {
if (Fortnite_Version > 1.8 || Fortnite_Version == 1.11) if (Fortnite_Version > 1.8 || Fortnite_Version == 1.11)
{ {
@@ -1513,7 +1513,7 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo
if (CurrentPlayerState->GetPlace() <= 1) if (CurrentPlayerState->GetPlace() <= 1)
{ {
// bDidSomeoneWin = true; bDidSomeoneWin = true;
break; break;
} }
} }

View File

@@ -334,7 +334,7 @@ void AFortPlayerControllerAthena::ServerRestartPlayerHook(AFortPlayerControllerA
static auto ZoneServerRestartPlayer = __int64(FortPlayerControllerZoneDefault->VFTable[GetFunctionIdxOrPtr(ServerRestartPlayerFn) / 8]); static auto ZoneServerRestartPlayer = __int64(FortPlayerControllerZoneDefault->VFTable[GetFunctionIdxOrPtr(ServerRestartPlayerFn) / 8]);
static void (*ZoneServerRestartPlayerOriginal)(AFortPlayerController*) = decltype(ZoneServerRestartPlayerOriginal)(__int64(ZoneServerRestartPlayer)); static void (*ZoneServerRestartPlayerOriginal)(AFortPlayerController*) = decltype(ZoneServerRestartPlayerOriginal)(__int64(ZoneServerRestartPlayer));
LOG_INFO(LogDev, "Call 0x{:x} returning with 0x{:x}!", ZoneServerRestartPlayer - __int64(_ReturnAddress()), __int64(ZoneServerRestartPlayerOriginal) - __int64(GetModuleHandleW(0))); LOG_INFO(LogDev, "ServerRestartPlayerHook Call 0x{:x} returning with 0x{:x}!", ZoneServerRestartPlayer - __int64(_ReturnAddress()), __int64(ZoneServerRestartPlayerOriginal) - __int64(GetModuleHandleW(0)));
return ZoneServerRestartPlayerOriginal(Controller); return ZoneServerRestartPlayerOriginal(Controller);
} }

View File

@@ -579,6 +579,7 @@ std::vector<uint64> Addresses::GetFunctionsToNull()
if (std::floor(Fortnite_Version) == 17) if (std::floor(Fortnite_Version) == 17)
{ {
toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 70 08 48 89 78 10 55 41 54 41 55 41 56 41 57 48 8D 68 A1 48 81 EC ? ? ? ? 45 33 ED").Get()); // collectgarbage toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 70 08 48 89 78 10 55 41 54 41 55 41 56 41 57 48 8D 68 A1 48 81 EC ? ? ? ? 45 33 ED").Get()); // collectgarbage
toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 48 89 70 10 48 89 78 18 4C 89 60 20 55 41 56 41 57 48 8B EC 48 83 EC 60 4D 8B F9 41 8A F0 4C 8B F2 48 8B F9 45 32 E4").Get()); // No Reserve
} }
if (Engine_Version == 500) if (Engine_Version == 500)

View File

@@ -7,11 +7,10 @@
#include "KismetStringLibrary.h" #include "KismetStringLibrary.h"
#include "DataTableFunctionLibrary.h" #include "DataTableFunctionLibrary.h"
#include "FortPlaysetItemDefinition.h" #include "FortPlaysetItemDefinition.h"
#include "gui.h"
static inline void (*SetZoneToIndexOriginal)(AFortGameModeAthena* GameModeAthena, int OverridePhaseMaybeIDFK); static inline void (*SetZoneToIndexOriginal)(AFortGameModeAthena* GameModeAthena, int OverridePhaseMaybeIDFK);
static void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int OverridePhaseMaybeIDFK) static inline void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int OverridePhaseMaybeIDFK)
{ {
static auto ZoneDurationsOffset = Fortnite_Version >= 15 && Fortnite_Version < 18 ? 0x258 static auto ZoneDurationsOffset = Fortnite_Version >= 15 && Fortnite_Version < 18 ? 0x258
: std::floor(Fortnite_Version) >= 18 ? 0x248 : std::floor(Fortnite_Version) >= 18 ? 0x248
@@ -103,7 +102,7 @@ static void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int Override
if (!FortGameData) if (!FortGameData)
FortGameData = FindObject<UCurveTable>(L"/Game/Balance/AthenaGameData.AthenaGameData"); FortGameData = FindObject<UCurveTable>(L"/Game/Balance/AthenaGameData.AthenaGameData");
LOG_INFO(LogDev, "FortGameData: {}", FortGameData ? FortGameData->GetFullName() : "InvalidObject"); // LOG_INFO(LogDev, "FortGameData: {}", FortGameData ? FortGameData->GetFullName() : "InvalidObject");
auto ShrinkTimeFName = UKismetStringLibrary::Conv_StringToName(L"Default.SafeZone.ShrinkTime"); auto ShrinkTimeFName = UKismetStringLibrary::Conv_StringToName(L"Default.SafeZone.ShrinkTime");
auto HoldTimeFName = UKismetStringLibrary::Conv_StringToName(L"Default.SafeZone.WaitTime"); auto HoldTimeFName = UKismetStringLibrary::Conv_StringToName(L"Default.SafeZone.WaitTime");
@@ -130,6 +129,7 @@ static void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int Override
ZoneHoldDurations.at(i) = FortGameData->GetValueOfKey(FortGameData->GetKey(HoldTimeFName, i)); ZoneHoldDurations.at(i) = FortGameData->GetValueOfKey(FortGameData->GetKey(HoldTimeFName, i));
} }
/*
for (int i = 0; i < ZoneDurations.Num(); i++) for (int i = 0; i < ZoneDurations.Num(); i++)
{ {
LOG_INFO(LogZone, "Move [{}] {}", i, ZoneDurations.at(i)); LOG_INFO(LogZone, "Move [{}] {}", i, ZoneDurations.at(i));
@@ -139,6 +139,8 @@ static void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int Override
{ {
LOG_INFO(LogZone, "Hold [{}] {}", i, ZoneHoldDurations.at(i)); LOG_INFO(LogZone, "Hold [{}] {}", i, ZoneHoldDurations.at(i));
} }
*/
} }
LOG_INFO(LogZone, "SafeZonePhase: {}", GameModeAthena->Get<int>(SafeZonePhaseOffset)); LOG_INFO(LogZone, "SafeZonePhase: {}", GameModeAthena->Get<int>(SafeZonePhaseOffset));
@@ -167,7 +169,7 @@ static void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int Override
SafeZoneIndicator->Get<float>(SafeZoneFinishShrinkTimeOffset) = SafeZoneIndicator->Get<float>(SafeZoneStartShrinkTimeOffset) + ZoneDuration; SafeZoneIndicator->Get<float>(SafeZoneFinishShrinkTimeOffset) = SafeZoneIndicator->Get<float>(SafeZoneStartShrinkTimeOffset) + ZoneDuration;
} }
void ProcessEventHook(UObject* Object, UFunction* Function, void* Parameters) static inline void ProcessEventHook(UObject* Object, UFunction* Function, void* Parameters)
{ {
if (!Object || !Function) if (!Object || !Function)
return; return;

View File

@@ -368,6 +368,7 @@ DWORD WINAPI Main(LPVOID)
Addresses::SetupVersion(); Addresses::SetupVersion();
NumElementsPerChunk = std::floor(Fortnite_Version) >= 5 && Fortnite_Version <= 6 ? 0x10400 : 0x10000; // Idk what version tbh NumElementsPerChunk = std::floor(Fortnite_Version) >= 5 && Fortnite_Version <= 6 ? 0x10400 : 0x10000; // Idk what version tbh
bEnableRebooting = Addresses::RebootingDelegate && Addresses::FinishResurrection;
Offsets::FindAll(); // We have to do this before because FindCantBuild uses FortAIController.CreateBuildingActor Offsets::FindAll(); // We have to do this before because FindCantBuild uses FortAIController.CreateBuildingActor
Offsets::Print(); Offsets::Print();
@@ -568,12 +569,6 @@ DWORD WINAPI Main(LPVOID)
VirtualProtect((PVOID)func, 1, dwProtection, &dwTemp); VirtualProtect((PVOID)func, 1, dwProtection, &dwTemp);
} }
if (bEnableRebooting)
{
auto GameSessionDedicatedAthenaPatch = Memcury::Scanner::FindPattern("3B 41 38 7F ? 48 8B D0 48 8B 41 30 4C 39 04 D0 75 ? 48 8D 96").Get(); // todo check this sig more
PatchBytes(GameSessionDedicatedAthenaPatch, { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 });
}
if (Fortnite_Version != 22.4) if (Fortnite_Version != 22.4)
{ {
auto matchmaking = Memcury::Scanner::FindPattern("83 BD ? ? ? ? 01 7F 18 49 8D 4D D8 48 8B D6 E8 ? ? ? ? 48", false).Get(); auto matchmaking = Memcury::Scanner::FindPattern("83 BD ? ? ? ? 01 7F 18 49 8D 4D D8 48 8B D6 E8 ? ? ? ? 48", false).Get();
@@ -683,10 +678,6 @@ DWORD WINAPI Main(LPVOID)
// HookInstruction(Addresses::UpdateTrackedAttributesLea, (PVOID)AFortPlayerControllerAthena::UpdateTrackedAttributesHook, "/Script/Engine.PlayerController.EnableCheats", ERelativeOffsets::LEA, FortPlayerControllerAthenaDefault); // HookInstruction(Addresses::UpdateTrackedAttributesLea, (PVOID)AFortPlayerControllerAthena::UpdateTrackedAttributesHook, "/Script/Engine.PlayerController.EnableCheats", ERelativeOffsets::LEA, FortPlayerControllerAthenaDefault);
// HookInstruction(Addresses::CombinePickupLea, (PVOID)AFortPickup::CombinePickupHook, "/Script/Engine.PlayerController.SetVirtualJoystickVisibility", ERelativeOffsets::LEA, FortPlayerControllerAthenaDefault); // HookInstruction(Addresses::CombinePickupLea, (PVOID)AFortPickup::CombinePickupHook, "/Script/Engine.PlayerController.SetVirtualJoystickVisibility", ERelativeOffsets::LEA, FortPlayerControllerAthenaDefault);
if (bEnableRebooting)
{
HookInstruction(Addresses::RebootingDelegate, (PVOID)ABuildingGameplayActorSpawnMachine::RebootingDelegateHook, "/Script/Engine.PlayerController.SetVirtualJoystickVisibility", ERelativeOffsets::LEA, FindObject("/Script/FortniteGame.Default__BuildingGameplayActorSpawnMachine"));
}
if (Fortnite_Version == 13.40) if (Fortnite_Version == 13.40)
{ {

View File

@@ -18,6 +18,12 @@ uint64 FindGetPlayerViewpoint()
FailedToSpawnPawnAddr = FailedToSpawnPawnStrRefAddr - i; FailedToSpawnPawnAddr = FailedToSpawnPawnStrRefAddr - i;
break; break;
} }
if (*(uint8_t*)(uint8_t*)(FailedToSpawnPawnStrRefAddr - i) == 0x48 && *(uint8_t*)(uint8_t*)(FailedToSpawnPawnStrRefAddr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(FailedToSpawnPawnStrRefAddr - i + 2) == 0x5C)
{
FailedToSpawnPawnAddr = FailedToSpawnPawnStrRefAddr - i;
break;
}
} }
if (!FailedToSpawnPawnAddr) if (!FailedToSpawnPawnAddr)

View File

@@ -171,14 +171,13 @@ static inline uint64 FindAddToAlivePlayers()
static inline uint64 FindFinishResurrection() static inline uint64 FindFinishResurrection()
{ {
auto Addrr = FindFunctionCall(L"OnResurrectionCompleted"); uintptr_t Addrr = Engine_Version >= 427 ? FindNameRef(L"OnResurrectionCompleted") : FindFunctionCall(L"OnResurrectionCompleted"); // Call is inlined
if (!Addrr) if (!Addrr)
return 0; return 0;
auto addr = Memcury::Scanner::FindPattern("40 53 48 83 EC 20 0F B6 81 ? ? ? ? 83 C2 03 48 8B D9 3B D0 0F 85").Get(); // auto addr = Memcury::Scanner::FindPattern("40 53 48 83 EC 20 0F B6 81 ? ? ? ? 83 C2 03 48 8B D9 3B D0 0F 85").Get();
// return addr;
return addr;
LOG_INFO(LogDev, "WTF: 0x{:x}", Addrr - __int64(GetModuleHandleW(0))); LOG_INFO(LogDev, "WTF: 0x{:x}", Addrr - __int64(GetModuleHandleW(0)));
@@ -188,6 +187,11 @@ static inline uint64 FindFinishResurrection()
{ {
return Addrr - i; return Addrr - i;
} }
if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(Addrr - i + 2) == 0x5C)
{
return Addrr - i;
}
} }
return 0; return 0;
@@ -654,8 +658,8 @@ static inline uint64 FindSpecConstructor()
if (Engine_Version == 427) if (Engine_Version == 427)
return Memcury::Scanner::FindPattern("80 61 31 FE 41 83 C9 FF 80 61 29 F0 48 8B 44 24 ? 48 89 41").Get(); return Memcury::Scanner::FindPattern("80 61 31 FE 41 83 C9 FF 80 61 29 F0 48 8B 44 24 ? 48 89 41").Get();
// if (Engine_Version == 500) if (Engine_Version == 500)
// return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 48 89 74 24 ? 57 48 83 EC 20 83 CD FF").Get(); return Memcury::Scanner::FindPattern("4C 8B C9 48 8B 44 24 ? 83 C9 FF 41 80 61 ? ? 41 80 61 ? ? 49 89 41 20 33 C0 41 88 41 30 49 89 41").Get();
return 0; return 0;
} }

View File

@@ -40,6 +40,7 @@
#include "FortAthenaMutator_Heist.h" #include "FortAthenaMutator_Heist.h"
#include "BGA.h" #include "BGA.h"
#include "vendingmachine.h" #include "vendingmachine.h"
#include "die.h"
#define GAME_TAB 1 #define GAME_TAB 1
#define PLAYERS_TAB 2 #define PLAYERS_TAB 2
@@ -61,6 +62,7 @@
#define LOADOUT_PLAYERTAB 4 #define LOADOUT_PLAYERTAB 4
#define FUN_PLAYERTAB 5 #define FUN_PLAYERTAB 5
extern inline bool bHandleDeath = true;
extern inline bool bUseCustomMap = false; extern inline bool bUseCustomMap = false;
extern inline std::string CustomMapName = ""; extern inline std::string CustomMapName = "";
extern inline int AmountToSubtractIndex = 1; extern inline int AmountToSubtractIndex = 1;
@@ -783,8 +785,12 @@ static inline void MainUI()
if (SafeZoneIndicator) if (SafeZoneIndicator)
{ {
SetZoneToIndexHook(GameMode, -1);
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startshrinksafezone", nullptr); UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startshrinksafezone", nullptr);
SafeZoneIndicator->SkipShrinkSafeZone(); SafeZoneIndicator->SkipShrinkSafeZone();
/*
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startshrinksafezone", nullptr); UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), L"startshrinksafezone", nullptr);
SafeZoneIndicator->SkipShrinkSafeZone(); SafeZoneIndicator->SkipShrinkSafeZone();
@@ -821,6 +827,8 @@ static inline void MainUI()
Sleep(1000); Sleep(1000);
SafeZoneIndicator->SkipShrinkSafeZone(); SafeZoneIndicator->SkipShrinkSafeZone();
} }
*/
} }
else else
{ {
@@ -1152,8 +1160,10 @@ static inline void MainUI()
static std::string ClassNameToDump; static std::string ClassNameToDump;
static std::string FunctionNameToDump; static std::string FunctionNameToDump;
ImGui::Checkbox("Handle Death", &bHandleDeath);
ImGui::Checkbox("Fill Vending Machines", &Globals::bFillVendingMachines); ImGui::Checkbox("Fill Vending Machines", &Globals::bFillVendingMachines);
ImGui::Checkbox("Enable Bot Tick", &bEnableBotTick); ImGui::Checkbox("Enable Bot Tick", &bEnableBotTick);
ImGui::Checkbox("Enable Rebooting", &bEnableRebooting);
ImGui::Checkbox("Enable Combine Pickup", &bEnableCombinePickup); ImGui::Checkbox("Enable Combine Pickup", &bEnableCombinePickup);
ImGui::InputInt("Amount To Subtract Index", &AmountToSubtractIndex); ImGui::InputInt("Amount To Subtract Index", &AmountToSubtractIndex);
ImGui::InputText("Class Name to mess with", &ClassNameToDump); ImGui::InputText("Class Name to mess with", &ClassNameToDump);

View File

@@ -20,6 +20,17 @@ struct FunctionHooks
static inline std::vector<FunctionHooks> AllFunctionHooks; static inline std::vector<FunctionHooks> AllFunctionHooks;
inline void PatchByte(uint64 addr, uint8_t byte)
{
DWORD dwProtection;
VirtualProtect((PVOID)addr, 1, PAGE_EXECUTE_READWRITE, &dwProtection);
*(uint8_t*)addr = byte;
DWORD dwTemp;
VirtualProtect((PVOID)addr, 1, dwProtection, &dwTemp);
}
inline void PatchBytes(uint64 addr, const std::vector<uint8_t>& Bytes) inline void PatchBytes(uint64 addr, const std::vector<uint8_t>& Bytes)
{ {
if (!addr) if (!addr)
@@ -27,7 +38,7 @@ inline void PatchBytes(uint64 addr, const std::vector<uint8_t>& Bytes)
for (int i = 0; i < Bytes.size(); i++) for (int i = 0; i < Bytes.size(); i++)
{ {
*(uint8_t*)(addr + i) = Bytes.at(i); PatchByte(addr + i, Bytes.at(i));
} }
} }

View File

@@ -85,6 +85,7 @@ inline void InitLogger()
MakeLogger("LogBots"); MakeLogger("LogBots");
MakeLogger("LogCosmetics"); MakeLogger("LogCosmetics");
MakeLogger("LogMatchmaker"); MakeLogger("LogMatchmaker");
MakeLogger("LogRebooting");
} }
#define LOG_DEBUG(loggerName, ...) \ #define LOG_DEBUG(loggerName, ...) \

21
vendor/memcury.h vendored
View File

@@ -1417,8 +1417,7 @@
VirtualProtect(&VTable[Idx], 8, dwProtection, &dwTemp); VirtualProtect(&VTable[Idx], 8, dwProtection, &dwTemp);
} }
// Finds a string ref, then goes searches xref of the function that it's in and returns that address. inline uintptr_t FindNameRef(const wchar_t* Name, int skip = 0, bool bWarnStringNotFound = true)
inline uintptr_t FindFunctionCall(const wchar_t* Name, const std::vector<uint8_t>& Bytes = std::vector<uint8_t>{ 0x48, 0x89, 0x5C }, int skip = 0) // credit ender & me
{ {
auto StringRef = Memcury::Scanner::FindStringRef(Name, true, skip); auto StringRef = Memcury::Scanner::FindStringRef(Name, true, skip);
@@ -1429,14 +1428,18 @@
auto PtrRef = Memcury::Scanner::FindPointerRef(FunctionPtr); auto PtrRef = Memcury::Scanner::FindPointerRef(FunctionPtr);
/* if (!PtrRef.Get() || PtrRef.Get() == __int64(FunctionPtr)) return PtrRef.Get();
{ }
std::wstring NameWStr = std::wstring(Name);
LOG_WARN(LogMemory, "Failed to find pointer reference for {}", std::string(NameWStr.begin(), NameWStr.end()));
return 0;
} */
return PtrRef.ScanFor(Bytes, false).Get(); // Finds a string ref, then goes searches xref of the function that it's in and returns that address.
inline uintptr_t FindFunctionCall(const wchar_t* Name, const std::vector<uint8_t>& Bytes = std::vector<uint8_t>{ 0x48, 0x89, 0x5C }, int skip = 0, bool bWarnStringNotFound = true) // credit ender & me
{
auto NameRef = FindNameRef(Name, skip, bWarnStringNotFound);
if (!NameRef)
return 0;
return Memcury::Scanner(NameRef).ScanFor(Bytes, false).Get();
} }
inline bool IsNullSub(uint64 Addr) inline bool IsNullSub(uint64 Addr)