fix ls drop bug

This commit is contained in:
Milxnor
2023-06-21 14:51:42 -04:00
parent 5e2a74764a
commit e049e870dc
7 changed files with 85 additions and 48 deletions

View File

@@ -596,6 +596,8 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
if (ActorsNum == 0) if (ActorsNum == 0)
return false; return false;
// I don't think this map info check is proper.. We can loop through the Actors in the World's PersistentLevel and check if there is a MapInfo, if there is then we can wait, else don't.
auto MapInfo = GameState->GetMapInfo(); auto MapInfo = GameState->GetMapInfo();
if (!bUseCustomMap) if (!bUseCustomMap)
@@ -884,9 +886,9 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
if (GameState->GetPlayersLeft() >= GameMode->Get<int>(WarmupRequiredPlayerCountOffset)) if (GameState->GetPlayersLeft() >= GameMode->Get<int>(WarmupRequiredPlayerCountOffset))
{ {
if (MapInfo) // if (MapInfo)
{ {
static auto FlightInfosOffset = MapInfo->GetOffset("FlightInfos"); // static auto FlightInfosOffset = MapInfo->GetOffset("FlightInfos");
// if (MapInfo->Get<TArray<__int64>>(FlightInfosOffset).ArrayNum > 0) // if (MapInfo->Get<TArray<__int64>>(FlightInfosOffset).ArrayNum > 0)
{ {

View File

@@ -312,6 +312,9 @@ void Addresses::FindAll()
LOG_INFO(LogDev, "Finding AddToAlivePlayers"); LOG_INFO(LogDev, "Finding AddToAlivePlayers");
Addresses::AddToAlivePlayers = FindAddToAlivePlayers(); Addresses::AddToAlivePlayers = FindAddToAlivePlayers();
// LOG_INFO(LogDev, "Finding GetSessionInterface");
// Addresses::GetSessionInterface = FindGetSessionInterface();
LOG_INFO(LogDev, "Applying GameSessionPatch"); LOG_INFO(LogDev, "Applying GameSessionPatch");
ApplyGameSessionPatch(); ApplyGameSessionPatch();
@@ -388,6 +391,7 @@ void Addresses::Print()
LOG_INFO(LogDev, "GetSquadIdForCurrentPlayer: 0x{:x}", GetSquadIdForCurrentPlayer - Base); LOG_INFO(LogDev, "GetSquadIdForCurrentPlayer: 0x{:x}", GetSquadIdForCurrentPlayer - Base);
LOG_INFO(LogDev, "FinishResurrection: 0x{:x}", FinishResurrection - Base); LOG_INFO(LogDev, "FinishResurrection: 0x{:x}", FinishResurrection - Base);
LOG_INFO(LogDev, "AddToAlivePlayers: 0x{:x}", AddToAlivePlayers - Base); LOG_INFO(LogDev, "AddToAlivePlayers: 0x{:x}", AddToAlivePlayers - Base);
LOG_INFO(LogDev, "GetSessionInterface: 0x{:x}", GetSessionInterface - Base);
} }
void Offsets::FindAll() void Offsets::FindAll()
@@ -519,6 +523,33 @@ void Addresses::Init()
else UnchunkedObjects = decltype(UnchunkedObjects)(ObjectArray); else UnchunkedObjects = decltype(UnchunkedObjects)(ObjectArray);
} }
std::vector<uint64> Addresses::GetFunctionsToReturnTrue()
{
std::vector<uint64> toReturnTrue;
if (Fortnite_Version == 1.11 || Fortnite_Version >= 2.2 && Fortnite_Version <= 2.4)
{
toReturnTrue.push_back(Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 57 41 56 41 57 48 81 EC ? ? ? ? 48 8B 01 49 8B E9 45 0F B6 F8").Get()); // No Reserve
}
if (std::floor(Fortnite_Version) == 17)
{
toReturnTrue.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 (Fortnite_Version >= 19)
{
// toReturnTrue.push_back(Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 48 8B 01 49 8B F0 33 DB FF 50 20 48 8B F8").Get()); // funny session thingy
}
if (Engine_Version >= 426)
{
toReturnTrue.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 49 8B D9 45 8A").Get()); // No reserve
}
return toReturnTrue;
}
std::vector<uint64> Addresses::GetFunctionsToNull() std::vector<uint64> Addresses::GetFunctionsToNull()
{ {
std::vector<uint64> toNull; std::vector<uint64> toNull;
@@ -528,11 +559,6 @@ std::vector<uint64> Addresses::GetFunctionsToNull()
toNull.push_back(Memcury::Scanner::FindPattern("48 89 54 24 ? 48 89 4C 24 ? 55 53 57 48 8D 6C 24 ? 48 81 EC ? ? ? ? 8B 41 08 C1 E8 05").Get()); // Widget class toNull.push_back(Memcury::Scanner::FindPattern("48 89 54 24 ? 48 89 4C 24 ? 55 53 57 48 8D 6C 24 ? 48 81 EC ? ? ? ? 8B 41 08 C1 E8 05").Get()); // Widget class
} }
if (Fortnite_Version == 1.11 || Fortnite_Version >= 2.2 && Fortnite_Version <= 2.4)
{
toNull.push_back(Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 6C 24 ? 57 41 56 41 57 48 81 EC ? ? ? ? 48 8B 01 49 8B E9 45 0F B6 F8").Get()); // No Reserve
}
if (Fortnite_Version > 2.5 && Engine_Version == 420) if (Fortnite_Version > 2.5 && Engine_Version == 420)
{ {
toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 57 48 81 EC ? ? ? ? 4C 8B 82 ? ? ? ? 48 8B F9 0F 29 70 E8 0F 29 78 D8").Get()); // Pawn Overlap toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 57 48 81 EC ? ? ? ? 4C 8B 82 ? ? ? ? 48 8B F9 0F 29 70 E8 0F 29 78 D8").Get()); // Pawn Overlap
@@ -580,7 +606,6 @@ 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)
@@ -591,11 +616,6 @@ std::vector<uint64> Addresses::GetFunctionsToNull()
toNull.push_back(Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 55 41 55 41 56 48 8B EC 48 83 EC 50 83 65 28 00 40 B6 05 40 38 35 ? ? ? ? 4C").Get()); // InitializeUI toNull.push_back(Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 48 89 7C 24 ? 55 41 55 41 56 48 8B EC 48 83 EC 50 83 65 28 00 40 B6 05 40 38 35 ? ? ? ? 4C").Get()); // InitializeUI
} }
if (Engine_Version >= 426)
{
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 49 8B D9 45 8A").Get()); // No reserve
}
toNull.push_back(Addresses::ChangeGameSessionId); toNull.push_back(Addresses::ChangeGameSessionId);
return toNull; return toNull;

View File

@@ -75,12 +75,14 @@ namespace Addresses
extern inline uint64 FinishResurrection = 0; extern inline uint64 FinishResurrection = 0;
extern inline uint64 AddToAlivePlayers = 0; extern inline uint64 AddToAlivePlayers = 0;
extern inline uint64 GameSessionPatch = 0; extern inline uint64 GameSessionPatch = 0;
extern inline uint64 GetSessionInterface = 0; // Matchmaking
void SetupVersion(); // Finds Engine Version void SetupVersion(); // Finds Engine Version
void FindAll(); void FindAll();
void Print(); void Print();
void Init(); void Init();
std::vector<uint64> GetFunctionsToReturnTrue();
std::vector<uint64> GetFunctionsToNull(); std::vector<uint64> GetFunctionsToNull();
} }

View File

@@ -549,6 +549,7 @@ DWORD WINAPI Main(LPVOID)
LOG_INFO(LogDev, "Switch levels."); LOG_INFO(LogDev, "Switch levels.");
auto AddressesToNull = Addresses::GetFunctionsToNull(); auto AddressesToNull = Addresses::GetFunctionsToNull();
const auto AddressesToReturnTrue = Addresses::GetFunctionsToReturnTrue();
auto ServerCheatAllIndex = GetFunctionIdxOrPtr(FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerCheatAll")); auto ServerCheatAllIndex = GetFunctionIdxOrPtr(FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerController.ServerCheatAll"));
@@ -571,6 +572,17 @@ DWORD WINAPI Main(LPVOID)
VirtualProtect((PVOID)func, 1, dwProtection, &dwTemp); VirtualProtect((PVOID)func, 1, dwProtection, &dwTemp);
} }
for (auto func : AddressesToReturnTrue)
{
if (func == 0)
continue;
LOG_INFO(LogDev, "Forcing return true on 0x{:x}", func - __int64(GetModuleHandleW(0)));
MH_CreateHook((PVOID)func, ReturnTrueHook, nullptr);
MH_EnableHook((PVOID)func);
}
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();

View File

@@ -3,6 +3,32 @@
#include "reboot.h" #include "reboot.h"
#include "FortPlayerControllerAthena.h" #include "FortPlayerControllerAthena.h"
uint64 FindGetSessionInterface()
{
auto strRef = Memcury::Scanner::FindStringRef(L"OnDestroyReservedSessionComplete %s bSuccess: %d", true, 0, Fortnite_Version >= 19).Get();
LOG_INFO(LogDev, "strRef: 0x{:x}", strRef - __int64(GetModuleHandleW(0)));
int NumCalls = 0;
NumCalls -= Fortnite_Version >= 19;
for (int i = 0; i < 2000; i++)
{
if (*(uint8_t*)(strRef + i) == 0xE8)
{
LOG_INFO(LogDev, "Found call 0x{:x}", __int64(strRef + i) - __int64(GetModuleHandleW(0)));
NumCalls++;
if (NumCalls == 2) // First is a FMemory::Free
{
return Memcury::Scanner(strRef + i).RelativeOffset(1).Get();
}
}
}
return 0;
}
uint64 FindGetPlayerViewpoint() uint64 FindGetPlayerViewpoint()
{ {
// We find FailedToSpawnPawn and then go back on VFT by 1. // We find FailedToSpawnPawn and then go back on VFT by 1.

View File

@@ -495,6 +495,7 @@ static inline uint64 FindGetMaxTickRate() // UEngine::getmaxtickrate
// return FindBytes(stringRef, Fortnite_Version <= 4.1 ? std::vector<uint8_t>{ 0x40, 0x53 } : std::vector<uint8_t>{ 0x48, 0x89, 0x5C }, 1000, 0, true); // return FindBytes(stringRef, Fortnite_Version <= 4.1 ? std::vector<uint8_t>{ 0x40, 0x53 } : std::vector<uint8_t>{ 0x48, 0x89, 0x5C }, 1000, 0, true);
} }
uint64 FindGetSessionInterface();
uint64 FindGetPlayerViewpoint(); uint64 FindGetPlayerViewpoint();
uint64 ApplyGameSessionPatch(); uint64 ApplyGameSessionPatch();

View File

@@ -572,7 +572,7 @@ static inline void MainUI()
} }
*/ */
if (!bIsInAutoRestart && (Engine_Version < 424 && ImGui::Button("Restart"))) if (!bIsInAutoRestart && Engine_Version < 424 && ImGui::Button("Restart"))
{ {
if (Engine_Version < 424) if (Engine_Version < 424)
{ {
@@ -586,42 +586,16 @@ static inline void MainUI()
} }
/* /*
if (ImGui::Button("TEST")) if (ImGui::Button("Test bruh"))
{ {
auto GameMode = (AFortGameMode*)GetWorld()->GetGameMode(); __int64 bruh;
auto GameState = GameMode->GetGameState(); __int64* (*sub_7FF7476F4458)(__int64* a1, UWorld* a2, __int64 a3) = decltype(sub_7FF7476F4458)(Addresses::GetSessionInterface);
static auto mutatorClass = FindObject<UClass>("/Script/FortniteGame.FortAthenaMutator"); sub_7FF7476F4458(&bruh, GetWorld(), 0);
auto AllMutators = UGameplayStatics::GetAllActorsOfClass(GetWorld(), mutatorClass);
for (int i = 0; i < AllMutators.Num(); ++i) LOG_INFO(LogDev, "bruh: 0x{:x}", bruh);
{ auto VFT = *(__int64*)bruh;
auto Mutator = AllMutators.at(i); LOG_INFO(LogDev, "VFT: 0x{:x}", VFT - __int64(GetModuleHandleW(0)));
LOG_INFO(LogDev, "[{}] Mutator: {}", i, Mutator->GetFullName());
if (auto DiscoMutator = Cast<AFortAthenaMutator_Disco>(Mutator))
{
auto& ControlPointSpawnData = DiscoMutator->GetControlPointSpawnData();
LOG_INFO(LogDev, "ControlPointSpawnData.Num(): {}", ControlPointSpawnData.Num());
}
else if (auto HeistMutator = Cast<AFortAthenaMutator_Heist>(Mutator))
{
auto& HeistExitCraftSpawnData = HeistMutator->GetHeistExitCraftSpawnData();
LOG_INFO(LogDev, "HeistExitCraftSpawnData.Num(): {}", HeistExitCraftSpawnData.Num());
for (int j = 0; j < HeistExitCraftSpawnData.Num(); j++)
{
auto& CurrentHeistExitCraftSpawnData = HeistExitCraftSpawnData.at(j);
auto CurveTable = CurrentHeistExitCraftSpawnData.SpawnDelayTime.GetCurve().CurveTable;
// LOG_INFO(LogDev, "{} {}", CurveTable ? CurveTable->GetFullName() : "InvalidTable",
// CurrentHeistExitCraftSpawnData.SpawnDelayTime.GetCurve().RowName.IsValid() ? CurrentHeistExitCraftSpawnData.SpawnDelayTime.GetCurve().RowName.ToString() : "InvalidName");
}
}
}
} }
*/ */