From be83a14ed2ff76dae8d046e00872728428b97139 Mon Sep 17 00:00:00 2001 From: Milxnor Date: Mon, 27 Mar 2023 19:47:48 -0400 Subject: [PATCH] fixed mcp on s1-s7 --- Project Reboot 3.0/FortGameModeAthena.cpp | 5 ++++- Project Reboot 3.0/FortPlayerController.cpp | 10 +++++++++- Project Reboot 3.0/dllmain.cpp | 14 +++++++------- Project Reboot 3.0/finder.h | 10 ++++++++++ 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/Project Reboot 3.0/FortGameModeAthena.cpp b/Project Reboot 3.0/FortGameModeAthena.cpp index e55ef2a..daf3f49 100644 --- a/Project Reboot 3.0/FortGameModeAthena.cpp +++ b/Project Reboot 3.0/FortGameModeAthena.cpp @@ -568,7 +568,7 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game int AFortGameModeAthena::Athena_PickTeamHook(AFortGameModeAthena* GameMode, uint8 preferredTeam, AActor* Controller) { - LOG_INFO(LogTeam, "PickTeam called!"); + LOG_INFO(LogTeams, "PickTeam called!"); auto GameState = Cast(GameMode->GetGameState()); @@ -583,6 +583,7 @@ int AFortGameModeAthena::Athena_PickTeamHook(AFortGameModeAthena* GameMode, uint CurrentTeamMembers = 0; static int Current = 3; CurrentTeamMembers++; + LOG_INFO(LogTeams, "Player is going on team {} with {} members (No Playlist).", Current, CurrentTeamMembers); return Current++; } @@ -602,6 +603,8 @@ int AFortGameModeAthena::Athena_PickTeamHook(AFortGameModeAthena* GameMode, uint CurrentTeamMembers++; + LOG_INFO(LogTeams, "Player is going on team {} with {} members.", NextTeamIndex, CurrentTeamMembers); + return NextTeamIndex; } diff --git a/Project Reboot 3.0/FortPlayerController.cpp b/Project Reboot 3.0/FortPlayerController.cpp index 4fb2d1a..c615ea4 100644 --- a/Project Reboot 3.0/FortPlayerController.cpp +++ b/Project Reboot 3.0/FortPlayerController.cpp @@ -667,8 +667,14 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo if (MemberOffsets::FortPlayerState::PawnDeathLocation != 0) DeadPlayerState->Get(MemberOffsets::FortPlayerState::PawnDeathLocation) = DeathLocation; + LOG_INFO(LogDev, "Calling OnRep_DeathInfo."); + static auto OnRep_DeathInfoFn = FindObject("/Script/FortniteGame.FortPlayerStateAthena.OnRep_DeathInfo"); - DeadPlayerState->ProcessEvent(OnRep_DeathInfoFn); + + if (OnRep_DeathInfoFn) + DeadPlayerState->ProcessEvent(OnRep_DeathInfoFn); + + LOG_INFO(LogDev, "Called OnRep_DeathInfo."); if (KillerPlayerState && KillerPlayerState != DeadPlayerState) { @@ -681,6 +687,8 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo // KillerPlayerState->OnRep_Kills(); } + LOG_INFO(LogDev, "Reported kill."); + if (KillerPawn && KillerPawn != DeadPawn) { KillerPawn->SetHealth(100); diff --git a/Project Reboot 3.0/dllmain.cpp b/Project Reboot 3.0/dllmain.cpp index 29cc7d7..aa4c4d5 100644 --- a/Project Reboot 3.0/dllmain.cpp +++ b/Project Reboot 3.0/dllmain.cpp @@ -46,17 +46,17 @@ static void NoMCPHook() { return; } static void CollectGarbageHook() { return; } static __int64 (*DispatchRequestOriginal)(__int64 a1, __int64* a2, int a3); -static __int64 DispatchRequestHook(__int64 a1, __int64* a2, int a3) { return DispatchRequestOriginal(a1, a2, 3); } -double GetServerDeltaTimeFromObjectHook(UObject* Object) + +static __int64 DispatchRequestHook(__int64 a1, __int64* a2, int a3) { - auto World = GetWorld(); + if (Engine_Version >= 423) + return DispatchRequestOriginal(a1, a2, 3); - auto GameState = Cast(((AFortGameMode*)World->GetGameMode())->GetGameState()); + static auto Offset = FindMcpIsDedicatedServerOffset(); - if (!GameState) - return 0; + *(int*)(__int64(a2) + Offset) = 3; - return GameState->GetServerWorldTimeSeconds(); + return DispatchRequestOriginal(a1, a2, 3); } DWORD WINAPI Main(LPVOID) diff --git a/Project Reboot 3.0/finder.h b/Project Reboot 3.0/finder.h index 28920af..2cea296 100644 --- a/Project Reboot 3.0/finder.h +++ b/Project Reboot 3.0/finder.h @@ -823,6 +823,16 @@ static inline uint64 FindDispatchRequest() return FindBytes(Addr, std::floor(Fortnite_Version) == 18 ? std::vector{0x48, 0x8B, 0xC4 } : std::vector{ 0x48, 0x89, 0x5C }, 300, 0, true); } +static inline uint64 FindMcpIsDedicatedServerOffset() +{ + if (Engine_Version == 421 || Engine_Version == 422) // checked on 5.41 & 6.21 & 7.30 + return 0x28; + + return 0x60; // 1.7.2 & 4.1 + + return 0; +} + static inline uint64 FindGIsClient() { // if (Fortnite_Version == 2.5)