fix some versions

fixed s18 (I think), did something to teams, reverted harvesting thing because it was buggy
This commit is contained in:
Milxnor
2023-06-20 08:36:24 -04:00
parent 6ec6815bbb
commit 779c932b3f
9 changed files with 46 additions and 15 deletions

View File

@@ -28,6 +28,8 @@ void ABuildingActor::OnDamageServerHook(ABuildingActor* BuildingActor, float Dam
if (BuildingSMActor->IsDestroyed()) if (BuildingSMActor->IsDestroyed())
return OnDamageServerOriginal(BuildingActor, Damage, DamageTags, Momentum, HitInfo, InstigatedBy, DamageCauser, EffectContext); return OnDamageServerOriginal(BuildingActor, Damage, DamageTags, Momentum, HitInfo, InstigatedBy, DamageCauser, EffectContext);
/*
static auto LastDamageAmountOffset = BuildingSMActor->GetOffset("LastDamageAmount"); static auto LastDamageAmountOffset = BuildingSMActor->GetOffset("LastDamageAmount");
static auto LastDamageHitOffset = BuildingSMActor->GetOffset("LastDamageHit", false) != -1 ? BuildingSMActor->GetOffset("LastDamageHit") : BuildingSMActor->GetOffset("LastDamageHitImpulseDir"); // idc static auto LastDamageHitOffset = BuildingSMActor->GetOffset("LastDamageHit", false) != -1 ? BuildingSMActor->GetOffset("LastDamageHit") : BuildingSMActor->GetOffset("LastDamageHitImpulseDir"); // idc
@@ -38,6 +40,8 @@ void ABuildingActor::OnDamageServerHook(ABuildingActor* BuildingActor, float Dam
BuildingSMActor->Get<float>(LastDamageAmountOffset) = Damage; BuildingSMActor->Get<float>(LastDamageAmountOffset) = Damage;
BuildingSMActor->Get<float>(LastDamageHitOffset) = CurrentBuildingHealth; BuildingSMActor->Get<float>(LastDamageHitOffset) = CurrentBuildingHealth;
*/
if (!PlayerController || !Weapon) if (!PlayerController || !Weapon)
return OnDamageServerOriginal(BuildingActor, Damage, DamageTags, Momentum, HitInfo, InstigatedBy, DamageCauser, EffectContext); return OnDamageServerOriginal(BuildingActor, Damage, DamageTags, Momentum, HitInfo, InstigatedBy, DamageCauser, EffectContext);
@@ -84,7 +88,7 @@ void ABuildingActor::OnDamageServerHook(ABuildingActor* BuildingActor, float Dam
// LOG_INFO(LogDev, "Out: {}", Out); // LOG_INFO(LogDev, "Out: {}", Out);
const float DamageThatWillAffect = PreviousLastDamageHit > 0 && Damage > PreviousLastDamageHit ? PreviousLastDamageHit : Damage; const float DamageThatWillAffect = /* PreviousLastDamageHit > 0 && Damage > PreviousLastDamageHit ? PreviousLastDamageHit : */ Damage;
float skid = Out / (BuildingActor->GetMaxHealth() / DamageThatWillAffect); float skid = Out / (BuildingActor->GetMaxHealth() / DamageThatWillAffect);

View File

@@ -699,12 +699,21 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
} }
else else
{ {
auto S19Patch = Memcury::Scanner::FindPattern("74 1A 48 8D 97 ? ? ? ? 49 8B CF E8 ? ? ? ? 88 87 ? ? ? ? E9").Get(); auto S19Patch = Memcury::Scanner::FindPattern("74 1A 48 8D 97 ? ? ? ? 49 8B CF E8 ? ? ? ? 88 87 ? ? ? ? E9", false).Get();
if (S19Patch) if (S19Patch)
{ {
PatchByte(S19Patch, 0x75); PatchByte(S19Patch, 0x75);
} }
else
{
auto S18Patch = Memcury::Scanner::FindPattern("75 02 33 F6 41 BE ? ? ? ? 48 85 F6 74 17 48 8D 93").Get();
if (S18Patch)
{
PatchByte(S18Patch, 0x74);
}
}
} }
if (bEnableRebooting) if (bEnableRebooting)
@@ -776,7 +785,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, 300); CurrentRebootVan->GetResurrectLocation() = CurrentRebootVan->GetClosestActor(FortPlayerStartClass, 450);
} }
AllRebootVans.Free(); AllRebootVans.Free();

View File

@@ -20,10 +20,16 @@ uint8 AFortGameSessionDedicatedAthena::GetSquadIdForCurrentPlayerHook(AFortGameS
if (!PlayerState) if (!PlayerState)
continue; continue;
// return PlayerState->GetTeamIndex() - NumToSubtractFromSquadId;
static auto UniqueIdOffset = PlayerState->GetOffset("UniqueId"); static auto UniqueIdOffset = PlayerState->GetOffset("UniqueId");
if (IsBadReadPtr(PlayerState->GetPtr<FUniqueNetIdRepl>(UniqueIdOffset)))
continue;
if (PlayerState->GetPtr<FUniqueNetIdRepl>(UniqueIdOffset)->IsIdentical((FUniqueNetIdRepl*)&UniqueId)) if (PlayerState->GetPtr<FUniqueNetIdRepl>(UniqueIdOffset)->IsIdentical((FUniqueNetIdRepl*)&UniqueId))
{ {
LOG_INFO(LogDev, "Found!");
return PlayerState->GetTeamIndex() - NumToSubtractFromSquadId; return PlayerState->GetTeamIndex() - NumToSubtractFromSquadId;
} }
} }

View File

@@ -645,7 +645,7 @@ bool UFortKismetLibrary::PickLootDropsHook(UObject* Context, FFrame& Stack, bool
LOG_INFO(LogDev, "Picking loot for {}.", TierGroupName.ComparisonIndex.Value ? TierGroupName.ToString() : "InvalidName"); LOG_INFO(LogDev, "Picking loot for {}.", TierGroupName.ComparisonIndex.Value ? TierGroupName.ToString() : "InvalidName");
auto LootDrops = PickLootDrops(TierGroupName, GameState->GetWorldLevel(), -1, true); auto LootDrops = PickLootDrops(TierGroupName, WorldLevel, ForcedLootTier);
for (int i = 0; i < LootDrops.size(); i++) for (int i = 0; i < LootDrops.size(); i++)
{ {

View File

@@ -8,7 +8,7 @@ struct FUniqueNetIdRepl // : public FUniqueNetIdWrapper
{ {
static UStruct* GetStruct() static UStruct* GetStruct()
{ {
static auto Struct = FindObject<UStruct>("/Script/Engine.UniqueNetIdRepl"); static auto Struct = FindObject<UStruct>(L"/Script/Engine.UniqueNetIdRepl");
return Struct; return Struct;
} }
@@ -30,9 +30,8 @@ struct FUniqueNetIdRepl // : public FUniqueNetIdWrapper
bool bTest = true; bool bTest = true;
if (this->GetReplicationBytes().Num() > this->GetReplicationBytes().Num()) // != ? if (this->GetReplicationBytes().Num() >= OtherUniqueId->GetReplicationBytes().Num())
bTest = false; {
for (int i = 0; i < this->GetReplicationBytes().Num(); i++) for (int i = 0; i < this->GetReplicationBytes().Num(); i++)
{ {
if (this->GetReplicationBytes().at(i) != OtherUniqueId->GetReplicationBytes().at(i)) if (this->GetReplicationBytes().at(i) != OtherUniqueId->GetReplicationBytes().at(i))
@@ -41,6 +40,11 @@ struct FUniqueNetIdRepl // : public FUniqueNetIdWrapper
break; break;
} }
} }
}
else
{
bTest = false;
}
// LOG_INFO(LogDev, "btest: {}", bTest); // LOG_INFO(LogDev, "btest: {}", bTest);

View File

@@ -367,6 +367,7 @@ DWORD WINAPI Main(LPVOID)
Addresses::SetupVersion(); Addresses::SetupVersion();
NumToSubtractFromSquadId = Engine_Version >= 424 ? 2 : 3; // TODO: check this
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
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

View File

@@ -9,7 +9,7 @@ uint64 FindGetPlayerViewpoint()
uint64 FailedToSpawnPawnAddr = 0; uint64 FailedToSpawnPawnAddr = 0;
auto FailedToSpawnPawnStrRefAddr = Memcury::Scanner::FindStringRef(L"%s failed to spawn a pawn", true, 0, Fortnite_Version >= 18).Get(); auto FailedToSpawnPawnStrRefAddr = Memcury::Scanner::FindStringRef(L"%s failed to spawn a pawn", true, 0, Fortnite_Version >= 19).Get();
for (int i = 0; i < 1000; i++) for (int i = 0; i < 1000; i++)
{ {

View File

@@ -220,7 +220,7 @@ static inline uint64 FindRebootingDelegate()
if (Fortnite_Version < 8.3) if (Fortnite_Version < 8.3)
return 0; return 0;
auto ServerOnAttemptInteractAddr = Memcury::Scanner::FindStringRef(L"[SCM] ABuildingGameplayActorSpawnMachine::ServerOnAttemptInteract - Start Rebooting").Get(); auto ServerOnAttemptInteractAddr = Memcury::Scanner::FindStringRef(L"[SCM] ABuildingGameplayActorSpawnMachine::ServerOnAttemptInteract - Start Rebooting", true, 0, Fortnite_Version >= 16).Get();
for (int i = 0; i < 10000; i++) for (int i = 0; i < 10000; i++)
{ {

View File

@@ -367,7 +367,14 @@ namespace Hooking
static inline void ChangeBytesThing(uint8_t* instrAddr, uint8_t* DetourAddr, int Offset) static inline void ChangeBytesThing(uint8_t* instrAddr, uint8_t* DetourAddr, int Offset)
{ {
int64_t delta = DetourAddr - (instrAddr + Offset + 4); int64_t delta = DetourAddr - (instrAddr + Offset + 4);
*(int32_t*)(instrAddr + Offset) = static_cast<int32_t>(delta); auto addr = (int32_t*)(instrAddr + Offset);
DWORD dwProtection;
VirtualProtect((PVOID)addr, 4, PAGE_EXECUTE_READWRITE, &dwProtection);
*addr = static_cast<int32_t>(delta);
DWORD dwTemp;
VirtualProtect((PVOID)addr, 1, dwProtection, &dwTemp);
} }
enum ERelativeOffsets enum ERelativeOffsets