mirror of
https://github.com/Milxnor/Project-Reboot-3.0.git
synced 2026-01-13 02:42:22 +01:00
fixed some ltm stuff
This commit is contained in:
@@ -2,6 +2,13 @@
|
||||
|
||||
void AFortAthenaMutator_Barrier::OnGamePhaseStepChangedHook(UObject* Context, FFrame& Stack, void* Ret)
|
||||
{
|
||||
auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState());
|
||||
|
||||
if (!GameState)
|
||||
return OnGamePhaseStepChangedOriginal(Context, Stack, Ret);
|
||||
|
||||
LOG_INFO(LogDev, "OnGamePhaseStepChangedHook gamepadsl gwrigjsafjob fs: {}", (int)GameState->GetGamePhaseStep());
|
||||
|
||||
/*
|
||||
TScriptInterface<UObject> SafeZoneInterface;
|
||||
EAthenaGamePhaseStep GamePhaseStep;
|
||||
|
||||
@@ -151,63 +151,45 @@ float GetAmountOfLootPackagesToDrop(FFortLootTierData* LootTierData, int Origina
|
||||
std::vector<FFortItemEntry> ItemEntries;
|
||||
}; */
|
||||
|
||||
bool PickRowForLootTier(FName* OutName, FFortLootTierData** OutLTD, float RandMultiplier, const LOOTING_MAP_TYPE<FName, FFortLootTierData*>& Rows)
|
||||
{
|
||||
float Rand = RandomFloatForLoot(RandMultiplier);
|
||||
|
||||
if (!Rows.size())
|
||||
return false;
|
||||
|
||||
for (auto& currentPair : Rows)
|
||||
{
|
||||
float currentWeight = currentPair.second->GetWeight();
|
||||
|
||||
if (Rand <= currentWeight)
|
||||
{
|
||||
*OutName = currentPair.first;
|
||||
*OutLTD = currentPair.second;
|
||||
return true;
|
||||
}
|
||||
|
||||
Rand -= currentWeight;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
FFortLootTierData* PickLootTierData(const std::vector<UDataTable*>& LTDTables, FName LootTierGroup, int ForcedLootTier = -1, FName* OutRowName = nullptr, int* OutLootTierDataTier = nullptr) // Fortnite returns the row name and then finds the tier data again, but I really don't see the point of this.
|
||||
FFortLootTierData* PickLootTierData(const std::vector<UDataTable*>& LTDTables, FName LootTierGroup, int ForcedLootTier = -1, FName* OutRowName = nullptr) // Fortnite returns the row name and then finds the tier data again, but I really don't see the point of this.
|
||||
{
|
||||
// This like isn't right, at all.
|
||||
|
||||
float TotalWeight = 0;
|
||||
float LootTier = ForcedLootTier;
|
||||
|
||||
LOOTING_MAP_TYPE<FName, FFortLootTierData*> TierGroupLTDs;
|
||||
|
||||
if (ForcedLootTier == -1)
|
||||
if (LootTier == -1)
|
||||
{
|
||||
CollectDataTablesRows<FFortLootTierData>(LTDTables, &TierGroupLTDs, [&](FName RowName, FFortLootTierData* TierData) -> bool {
|
||||
if (LootTierGroup == TierData->GetTierGroup())
|
||||
{
|
||||
TotalWeight += TierData->GetWeight();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
// LootTier = ??
|
||||
}
|
||||
else
|
||||
{
|
||||
// buncha code im too lazy to reverse
|
||||
}
|
||||
|
||||
if (fabs(TotalWeight) <= 0.0000000099999999)
|
||||
return 0;
|
||||
// if (fabs(LootTier) <= 0.0000000099999999)
|
||||
// return 0;
|
||||
|
||||
int Multiplier = LootTier == -1 ? 1 : LootTier; // Idk i think we need to fill out the code above for this to work properly maybe
|
||||
|
||||
LOOTING_MAP_TYPE<FName, FFortLootTierData*> TierGroupLTDs;
|
||||
|
||||
CollectDataTablesRows<FFortLootTierData>(LTDTables, &TierGroupLTDs, [&](FName RowName, FFortLootTierData* TierData) -> bool {
|
||||
if (LootTierGroup == TierData->GetTierGroup())
|
||||
{
|
||||
if ((LootTier == -1 ? true : LootTier == TierData->GetLootTier()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// LOG_INFO(LogDev, "TierGroupLTDs.size(): {}", TierGroupLTDs.size());
|
||||
|
||||
FFortLootTierData* ChosenRowLootTierData = nullptr;
|
||||
|
||||
PickRowForLootTier(OutRowName, &ChosenRowLootTierData, TotalWeight, TierGroupLTDs);
|
||||
FFortLootTierData* ChosenRowLootTierData = PickWeightedElement<FName, FFortLootTierData*>(TierGroupLTDs,
|
||||
[](FFortLootTierData* LootTierData) -> float { return LootTierData->GetWeight(); }, RandomFloatForLoot, -1,
|
||||
true, Multiplier, OutRowName);
|
||||
|
||||
return ChosenRowLootTierData;
|
||||
}
|
||||
@@ -678,8 +660,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, int WorldLevel, int For
|
||||
}
|
||||
|
||||
FName LootTierRowName;
|
||||
int ltdLootTier = 0;
|
||||
auto ChosenRowLootTierData = PickLootTierData(LTDTables, TierGroupName, ForcedLootTier, &LootTierRowName, <dLootTier);
|
||||
auto ChosenRowLootTierData = PickLootTierData(LTDTables, TierGroupName, ForcedLootTier, &LootTierRowName);
|
||||
|
||||
if (!ChosenRowLootTierData)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
void AGameModeBase::RestartPlayerAtTransform(AController* NewPlayer, FTransform SpawnTransform)
|
||||
{
|
||||
static auto RestartPlayerAtTransformFn = FindObject<UFunction>("/Script/Engine.GameModeBase.RestartPlayerAtTransform");
|
||||
static auto RestartPlayerAtTransformFn = FindObject<UFunction>(L"/Script/Engine.GameModeBase.RestartPlayerAtTransform");
|
||||
|
||||
struct
|
||||
{
|
||||
@@ -24,7 +24,7 @@ void AGameModeBase::RestartPlayerAtTransform(AController* NewPlayer, FTransform
|
||||
|
||||
void AGameModeBase::RestartPlayerAtPlayerStart(AController* NewPlayer, AActor* StartSpot)
|
||||
{
|
||||
static auto RestartPlayerAtPlayerStartFn = FindObject<UFunction>("/Script/Engine.GameModeBase.RestartPlayerAtPlayerStart");
|
||||
static auto RestartPlayerAtPlayerStartFn = FindObject<UFunction>(L"/Script/Engine.GameModeBase.RestartPlayerAtPlayerStart");
|
||||
|
||||
struct
|
||||
{
|
||||
@@ -37,13 +37,13 @@ void AGameModeBase::RestartPlayerAtPlayerStart(AController* NewPlayer, AActor* S
|
||||
|
||||
void AGameModeBase::RestartPlayer(AController* NewPlayer)
|
||||
{
|
||||
static auto RestartPlayerFn = FindObject<UFunction>("/Script/Engine.GameModeBase.RestartPlayer");
|
||||
static auto RestartPlayerFn = FindObject<UFunction>(L"/Script/Engine.GameModeBase.RestartPlayer");
|
||||
this->ProcessEvent(RestartPlayerFn, &NewPlayer);
|
||||
}
|
||||
|
||||
UClass* AGameModeBase::GetDefaultPawnClassForController(AController* InController)
|
||||
{
|
||||
static auto GetDefaultPawnClassForControllerFn = FindObject<UFunction>("/Script/Engine.GameModeBase.GetDefaultPawnClassForController");
|
||||
static auto GetDefaultPawnClassForControllerFn = FindObject<UFunction>(L"/Script/Engine.GameModeBase.GetDefaultPawnClassForController");
|
||||
struct
|
||||
{
|
||||
AController* InController; // (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
|
||||
@@ -57,7 +57,7 @@ UClass* AGameModeBase::GetDefaultPawnClassForController(AController* InControlle
|
||||
|
||||
void AGameModeBase::ChangeName(AController* Controller, const FString& NewName, bool bNameChange)
|
||||
{
|
||||
static auto ChangeNameFn = FindObject<UFunction>("/Script/Engine.GameModeBase.ChangeName");
|
||||
static auto ChangeNameFn = FindObject<UFunction>(L"/Script/Engine.GameModeBase.ChangeName");
|
||||
|
||||
struct
|
||||
{
|
||||
@@ -71,7 +71,7 @@ void AGameModeBase::ChangeName(AController* Controller, const FString& NewName,
|
||||
|
||||
AActor* AGameModeBase::K2_FindPlayerStart(AController* Player, FString IncomingName)
|
||||
{
|
||||
static auto K2_FindPlayerStartFn = FindObject<UFunction>("/Script/Engine.GameModeBase.K2_FindPlayerStart");
|
||||
static auto K2_FindPlayerStartFn = FindObject<UFunction>(L"/Script/Engine.GameModeBase.K2_FindPlayerStart");
|
||||
|
||||
struct
|
||||
{
|
||||
|
||||
@@ -312,6 +312,9 @@ void Addresses::FindAll()
|
||||
LOG_INFO(LogDev, "Finding AddToAlivePlayers");
|
||||
Addresses::AddToAlivePlayers = FindAddToAlivePlayers();
|
||||
|
||||
LOG_INFO(LogDev, "Applying GameSessionPatch");
|
||||
ApplyGameSessionPatch();
|
||||
|
||||
LOG_INFO(LogDev, "Finished finding!");
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ namespace Addresses
|
||||
extern inline uint64 GetSquadIdForCurrentPlayer = 0;
|
||||
extern inline uint64 FinishResurrection = 0;
|
||||
extern inline uint64 AddToAlivePlayers = 0;
|
||||
extern inline uint64 GameSessionPatch = 0;
|
||||
|
||||
void SetupVersion(); // Finds Engine Version
|
||||
void FindAll();
|
||||
|
||||
@@ -47,56 +47,84 @@ uint64 FindGetPlayerViewpoint()
|
||||
}
|
||||
|
||||
return __int64(PlayerControllerVFT[FailedToSpawnPawnIdx - 1]);
|
||||
}
|
||||
|
||||
// LITERALLY KMS BRO
|
||||
uint64 ApplyGameSessionPatch()
|
||||
{
|
||||
auto GamePhaseStepStringAddr = Memcury::Scanner::FindStringRef(L"Gamephase Step: %s", false).Get();
|
||||
|
||||
if (Engine_Version == 420 && Fortnite_Version < 4.5)
|
||||
uint64 BeginningOfGamePhaseStepFn = 0;
|
||||
uint8_t* ByteToPatch = 0;
|
||||
|
||||
if (!GamePhaseStepStringAddr)
|
||||
{
|
||||
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 55 41 56 41 57 48 8B EC 48 83 EC 50").Get(); // idk why finder doesnt work and cba to debug
|
||||
}
|
||||
LOG_WARN(LogFinder, "Unable to find GamePhaseStepString!");
|
||||
// return 0;
|
||||
|
||||
auto Addrr = Memcury::Scanner::FindStringRef(L"APlayerController::GetPlayerViewPoint: out_Location, ViewTarget=%s").Get();
|
||||
BeginningOfGamePhaseStepFn = Memcury::Scanner::FindPattern("48 89 5C 24 ? 57 48 83 EC 20 E8 ? ? ? ? 48 8B D8 48 85 C0 0F 84 ? ? ? ? E8").Get(); // not actually the func but its fine
|
||||
|
||||
LOG_INFO(LogDev, "GetPlayerViewpoint StringRef: 0x{:x}", __int64(Addrr) - __int64(GetModuleHandleW(0)));
|
||||
|
||||
for (int i = 0; i < Fortnite_Version >= 20 ? 2000 : 1000; i++)
|
||||
{
|
||||
if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x55)
|
||||
if (!BeginningOfGamePhaseStepFn)
|
||||
{
|
||||
LOG_INFO(LogDev, "GetPlayerViewpoint1!");
|
||||
return Addrr - i;
|
||||
}
|
||||
|
||||
if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x8B && *(uint8_t*)(uint8_t*)(Addrr - i + 2) == 0xC4)
|
||||
{
|
||||
LOG_INFO(LogDev, "GetPlayerViewpoint2!");
|
||||
return Addrr - i;
|
||||
}
|
||||
|
||||
if (Fortnite_Version == 7.20 && *(uint8_t*)(uint8_t*)(Addrr - i) == 0xC3) // hmm scuffed lmfao
|
||||
{
|
||||
LOG_INFO(LogDev, "Hit C3!");
|
||||
break;
|
||||
LOG_WARN(LogFinder, "Unable to find fallback sig for gamephase step! Report to Milxnor immediately.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 1000; i++)
|
||||
if (!BeginningOfGamePhaseStepFn && !ByteToPatch)
|
||||
{
|
||||
if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(Addrr - i + 2) == 0x74)
|
||||
for (int i = 0; i < 3000; i++)
|
||||
{
|
||||
LOG_INFO(LogDev, "GetPlayerViewpoint3!");
|
||||
return Addrr - i;
|
||||
if (*(uint8_t*)(uint8_t*)(GamePhaseStepStringAddr - i) == 0x40 && *(uint8_t*)(uint8_t*)(GamePhaseStepStringAddr - i + 1) == 0x55)
|
||||
{
|
||||
BeginningOfGamePhaseStepFn = GamePhaseStepStringAddr - i;
|
||||
break;
|
||||
}
|
||||
|
||||
if (*(uint8_t*)(uint8_t*)(GamePhaseStepStringAddr - i) == 0x48 && *(uint8_t*)(uint8_t*)(GamePhaseStepStringAddr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(GamePhaseStepStringAddr - i + 2) == 0x5C)
|
||||
{
|
||||
BeginningOfGamePhaseStepFn = GamePhaseStepStringAddr - i;
|
||||
break;
|
||||
}
|
||||
|
||||
if (*(uint8_t*)(uint8_t*)(GamePhaseStepStringAddr - i) == 0x48 && *(uint8_t*)(uint8_t*)(GamePhaseStepStringAddr - i + 1) == 0x8B && *(uint8_t*)(uint8_t*)(GamePhaseStepStringAddr - i + 2) == 0xC4)
|
||||
{
|
||||
BeginningOfGamePhaseStepFn = GamePhaseStepStringAddr - i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 1000; i++)
|
||||
if (!BeginningOfGamePhaseStepFn && !ByteToPatch)
|
||||
{
|
||||
if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(Addrr - i + 2) == 0x5C)
|
||||
LOG_WARN(LogFinder, "Unable to find beginning of GamePhaseStep! Report to Milxnor immediately.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!ByteToPatch)
|
||||
{
|
||||
for (int i = 0; i < 500; i++)
|
||||
{
|
||||
LOG_INFO(LogDev, "GetPlayerViewpoint4!");
|
||||
return Addrr - i;
|
||||
if (*(uint8_t*)(uint8_t*)(BeginningOfGamePhaseStepFn + i) == 0x0F && *(uint8_t*)(uint8_t*)(BeginningOfGamePhaseStepFn + i + 1) == 0x84)
|
||||
{
|
||||
ByteToPatch = (uint8_t*)(uint8_t*)(BeginningOfGamePhaseStepFn + i + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!ByteToPatch)
|
||||
{
|
||||
LOG_WARN(LogFinder, "Unable to find byte to patch for GamePhaseStep!");
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD dwProtection;
|
||||
VirtualProtect((PVOID)ByteToPatch, 1, PAGE_EXECUTE_READWRITE, &dwProtection);
|
||||
|
||||
*ByteToPatch = 0x85;
|
||||
|
||||
DWORD dwTemp;
|
||||
VirtualProtect((PVOID)ByteToPatch, 1, dwProtection, &dwTemp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -492,6 +492,7 @@ static inline uint64 FindGetMaxTickRate() // UEngine::getmaxtickrate
|
||||
}
|
||||
|
||||
uint64 FindGetPlayerViewpoint();
|
||||
uint64 ApplyGameSessionPatch();
|
||||
|
||||
static inline uint64 FindFree()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user