fixed mcp on s1-s7

This commit is contained in:
Milxnor
2023-03-27 19:47:48 -04:00
parent b4e88117a4
commit be83a14ed2
4 changed files with 30 additions and 9 deletions

View File

@@ -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<AFortGameStateAthena>(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;
}

View File

@@ -667,8 +667,14 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo
if (MemberOffsets::FortPlayerState::PawnDeathLocation != 0)
DeadPlayerState->Get<FVector>(MemberOffsets::FortPlayerState::PawnDeathLocation) = DeathLocation;
LOG_INFO(LogDev, "Calling OnRep_DeathInfo.");
static auto OnRep_DeathInfoFn = FindObject<UFunction>("/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);

View File

@@ -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<AFortGameStateAthena>(((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)

View File

@@ -823,6 +823,16 @@ static inline uint64 FindDispatchRequest()
return FindBytes(Addr, std::floor(Fortnite_Version) == 18 ? std::vector<uint8_t>{0x48, 0x8B, 0xC4 } : std::vector<uint8_t>{ 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)