Revert "alright im not so happy"

This reverts commit bd87832147.
This commit is contained in:
Milxnor
2023-05-12 17:51:29 -04:00
parent bd87832147
commit 9be64d79ca
21 changed files with 38 additions and 394 deletions

View File

@@ -4,60 +4,22 @@
#include "FortGameModeAthena.h" #include "FortGameModeAthena.h"
#include "gui.h" #include "gui.h"
void ABuildingContainer::BuildingContainer_SetMeshSet(FMeshSet* MeshSet)
{
BuildingSMActor_SetMeshSet(MeshSet);
// if (!NewSearchedMesh && !BuildingContainer->ShouldDestroyOnSearch()) error
this->GetSearchedMesh() = MeshSet->GetSearchedMesh();
if (!IsAlreadySearched())
{
// todo clear StaticMeshComponent->OverrideMaterials
// todo reapply StaticMaterials
}
static auto SearchSpeedOffset = GetOffset("SearchSpeed");
Get<FCurveTableRowHandle>(SearchSpeedOffset) = MeshSet->GetSearchSpeed();
if (MeshSet->GetLootNoiseLoudness() < 0)
{
this->GetLootNoiseRange() = MeshSet->GetLootNoiseRange();
}
else
{
this->GetLootNoiseRange() = MeshSet->GetLootNoiseLoudness() * 1000;
// MeshSet->GetLootNoiseLoudness() = // IDKK;
}
this->GetLootSpawnLocation() = MeshSet->GetLootSpawnLocation();
}
__m128 ToM128(const FVector& Vec)
{
std::array<float, 4> Arr = { Vec.X, Vec.Y, Vec.Z, 0.0f };
return _mm_loadu_ps(Arr.data());
}
bool ABuildingContainer::SpawnLoot(AFortPawn* Pawn) bool ABuildingContainer::SpawnLoot(AFortPawn* Pawn)
{ {
if (!Pawn)
return false;
this->ForceNetUpdate();
auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode()); auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState()); auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState());
FVector LocationToSpawnLoot = this->GetActorLocation() + this->GetActorRightVector() * 70.f + FVector{ 0, 0, 50 }; // proper? FVector LocationToSpawnLoot = this->GetActorLocation() + this->GetActorRightVector() * 70.f + FVector{ 0, 0, 50 };
static auto SearchLootTierGroupOffset = this->GetOffset("SearchLootTierGroup"); static auto SearchLootTierGroupOffset = this->GetOffset("SearchLootTierGroup");
auto RedirectedLootTier = GameMode->RedirectLootTier(this->Get<FName>(SearchLootTierGroupOffset)); auto RedirectedLootTier = GameMode->RedirectLootTier(this->Get<FName>(SearchLootTierGroupOffset));
// LOG_INFO(LogInteraction, "RedirectedLootTier: {}", RedirectedLootTier.ToString());
auto LootDrops = PickLootDrops(RedirectedLootTier, GameState->GetWorldLevel(), -1, bDebugPrintLooting); auto LootDrops = PickLootDrops(RedirectedLootTier, GameState->GetWorldLevel(), -1, bDebugPrintLooting);
// LOG_INFO(LogInteraction, "LootDrops.size(): {}", LootDrops.size());
for (auto& LootDrop : LootDrops) for (auto& LootDrop : LootDrops)
{ {
PickupCreateData CreateData{}; PickupCreateData CreateData{};
@@ -72,66 +34,17 @@ bool ABuildingContainer::SpawnLoot(AFortPawn* Pawn)
auto NewPickup = AFortPickup::SpawnPickup(CreateData); auto NewPickup = AFortPickup::SpawnPickup(CreateData);
} }
if (this->GetLootNoiseRange() > 0)
{
}
if (!this->IsDestroyed())
{
this->ForceNetUpdate();
// a buncha other stuff
}
static auto SearchAnimationCountOffset = FindOffsetStruct("/Script/FortniteGame.FortSearchBounceData", "SearchAnimationCount"); static auto SearchAnimationCountOffset = FindOffsetStruct("/Script/FortniteGame.FortSearchBounceData", "SearchAnimationCount");
static auto BounceNormalOffset = FindOffsetStruct("/Script/FortniteGame.FortSearchBounceData", "BounceNormal");
static auto SearchBounceDataOffset = this->GetOffset("SearchBounceData"); static auto SearchBounceDataOffset = this->GetOffset("SearchBounceData");
auto SearchBounceData = this->GetPtr<void>(SearchBounceDataOffset); auto SearchBounceData = this->GetPtr<void>(SearchBounceDataOffset);
auto PawnLocation = Pawn->GetActorLocation();
// thanks openai
__m128 v149 = ToM128(PawnLocation);
FVector BuildingContainerLocation = this->GetActorLocation();
__m128 v150 = ToM128(BuildingContainerLocation);
// Calculate v150 and v149 as before
v150.m128_f32[0] = PawnLocation.X - BuildingContainerLocation.X;
v149.m128_f32[0] = PawnLocation.Y - BuildingContainerLocation.Y;
// Use the unpacklo_ps intrinsic to interleave the two __m128 vectors
__m128 result = _mm_unpacklo_ps(v150, v149);
// Convert the result to a uint64_t using a union
union {
__m128i m128i;
uint64_t u64;
} data{};
data.m128i = _mm_castps_si128(result);
*(uint64*)(__int64(SearchBounceData) + BounceNormalOffset) = data.u64; // this will set x and y
(*(FVector*)(__int64(SearchBounceData) + BounceNormalOffset)).Z = 0;
auto BounceNormalSquared = (*(FVector*)(__int64(SearchBounceData) + BounceNormalOffset)).SizeSquared();
if (BounceNormalSquared > 0.0000000099999999)
{
float v155 = FMath::InvSqrt(BounceNormalSquared);
float v156 = v155 + (float)(v155 * (float)(0.5 - (float)((float)(BounceNormalSquared * 0.5) * (float)(v155 * v155))));
float idk = v156 + (float)(v156 * (float)(0.5 - (float)((float)(BounceNormalSquared * 0.5) * (float)(v156 * v156))));
float v157 = (*(FVector*)(__int64(SearchBounceData) + BounceNormalOffset)).Y * idk;
float v158 = (*(FVector*)(__int64(SearchBounceData) + BounceNormalOffset)).Z * idk;
(*(FVector*)(__int64(SearchBounceData) + BounceNormalOffset)).X = (*(FVector*)(__int64(SearchBounceData) + BounceNormalOffset)).X * idk;
(*(FVector*)(__int64(SearchBounceData) + BounceNormalOffset)).Y = v157;
(*(FVector*)(__int64(SearchBounceData) + BounceNormalOffset)).Z = v158;
}
(*(int*)(__int64(SearchBounceData) + SearchAnimationCountOffset))++; (*(int*)(__int64(SearchBounceData) + SearchAnimationCountOffset))++;
static auto BounceContainerFn = FindObject<UFunction>("/Script/FortniteGame.BuildingContainer.BounceContainer"); static auto OnRep_bAlreadySearchedFn = FindObject<UFunction>(L"/Script/FortniteGame.BuildingContainer.OnRep_bAlreadySearched");
this->ProcessEvent(BounceContainerFn); this->ProcessEvent(OnRep_bAlreadySearchedFn);
// Now there is some function called here but idk what it is, it calls OnLoot though.
return true; return true;
} }

View File

@@ -13,52 +13,6 @@ public:
return this->ReadBitfieldValue(bDestroyContainerOnSearchOffset, bDestroyContainerOnSearchFieldMask); return this->ReadBitfieldValue(bDestroyContainerOnSearchOffset, bDestroyContainerOnSearchFieldMask);
} }
UStaticMesh*& GetSearchedMesh()
{
static auto SearchedMeshOffset = GetOffset("SearchedMesh");
return Get<UStaticMesh*>(SearchedMeshOffset);
}
UStaticMesh*& GetStaticMesh()
{
static auto StaticMeshOffset = GetOffset("StaticMesh");
return Get<UStaticMesh*>(StaticMeshOffset);
}
void BuildingContainer_SetMeshSet(FMeshSet* MeshSet);
bool IsAlreadySearched()
{
static auto bAlreadySearchedOffset = this->GetOffset("bAlreadySearched");
static auto bAlreadySearchedFieldMask = GetFieldMask(this->GetProperty("bAlreadySearched"));
return this->ReadBitfieldValue(bAlreadySearchedOffset, bAlreadySearchedFieldMask);
}
void SetAlreadySearched(bool bNewValue, bool bOnRep = true)
{
static auto bAlreadySearchedOffset = this->GetOffset("bAlreadySearched");
static auto bAlreadySearchedFieldMask = GetFieldMask(this->GetProperty("bAlreadySearched"));
this->SetBitfieldValue(bAlreadySearchedOffset, bAlreadySearchedFieldMask, bNewValue);
if (bOnRep)
{
static auto OnRep_bAlreadySearchedFn = FindObject<UFunction>(L"/Script/FortniteGame.BuildingContainer.OnRep_bAlreadySearched");
this->ProcessEvent(OnRep_bAlreadySearchedFn);
}
}
FVector& GetLootSpawnLocation()
{
static auto LootSpawnLocationOffset = GetOffset("LootSpawnLocation");
return Get<FVector>(LootSpawnLocationOffset);
}
float& GetLootNoiseRange()
{
static auto LootNoiseRangeOffset = GetOffset("LootNoiseRange");
return Get<float>(LootNoiseRangeOffset);
}
bool SpawnLoot(AFortPawn* Pawn); bool SpawnLoot(AFortPawn* Pawn);
static UClass* StaticClass() static UClass* StaticClass()

View File

@@ -1,14 +1,5 @@
#include "BuildingSMActor.h" #include "BuildingSMActor.h"
void ABuildingSMActor::BuildingSMActor_SetMeshSet(FMeshSet* MeshSet)
{
static auto BreakEffectOffset = GetOffset("BreakEffect");
Get<UParticleSystem*>(BreakEffectOffset) = MeshSet->GetBreakEffect();
static auto ConstructedEffectOffset = GetOffset("ConstructedEffect");
Get<UParticleSystem*>(ConstructedEffectOffset) = MeshSet->GetConstructedEffect();
}
UClass* ABuildingSMActor::StaticClass() UClass* ABuildingSMActor::StaticClass()
{ {
static auto Class = FindObject<UClass>(L"/Script/FortniteGame.BuildingSMActor"); static auto Class = FindObject<UClass>(L"/Script/FortniteGame.BuildingSMActor");

View File

@@ -2,7 +2,6 @@
#include "BuildingActor.h" #include "BuildingActor.h"
#include "PlayerState.h" #include "PlayerState.h"
#include "CurveTable.h"
enum class EFortResourceType : uint8_t enum class EFortResourceType : uint8_t
{ {
@@ -14,90 +13,6 @@ enum class EFortResourceType : uint8_t
EFortResourceType_MAX = 5 EFortResourceType_MAX = 5
}; };
using UStaticMesh = UObject;
using UStaticMeshComponent = UObject;
using UParticleSystem = UObject;
struct FMeshSet
{
static UStruct* GetStruct()
{
static auto Struct = FindObject<UStruct>(L"/Script/FortniteGame.MeshSet");
return Struct;
}
static int GetPropertiesSize() { return GetStruct()->GetPropertiesSize(); }
UStaticMesh* GetBaseMesh()
{
static auto BaseMeshOffset = FindOffsetStruct("/Script/FortniteGame.MeshSet", "BaseMesh");
return *(UStaticMesh**)(__int64(this) + BaseMeshOffset);
}
UStaticMesh* GetSearchedMesh()
{
static auto SearchedMeshOffset = FindOffsetStruct("/Script/FortniteGame.MeshSet", "SearchedMesh");
return *(UStaticMesh**)(__int64(this) + SearchedMeshOffset);
}
EFortResourceType& GetResourceType()
{
static auto ResourceTypeOffset = FindOffsetStruct("/Script/FortniteGame.MeshSet", "ResourceType");
return *(EFortResourceType*)(__int64(this) + ResourceTypeOffset);
}
float& GetLootNoiseRange()
{
static auto LootNoiseRangeOffset = FindOffsetStruct("/Script/FortniteGame.MeshSet", "LootNoiseRange");
return *(float*)(__int64(this) + LootNoiseRangeOffset);
}
FVector& GetLootSpawnLocation()
{
static auto LootSpawnLocationOffset = FindOffsetStruct("/Script/FortniteGame.MeshSet", "LootSpawnLocation");
return *(FVector*)(__int64(this) + LootSpawnLocationOffset);
}
float& GetLootNoiseLoudness()
{
static auto LootNoiseLoudnessOffset = FindOffsetStruct("/Script/FortniteGame.MeshSet", "LootNoiseLoudness");
return *(float*)(__int64(this) + LootNoiseLoudnessOffset);
}
FCurveTableRowHandle& GetSearchSpeed()
{
static auto SearchSpeedOffset = FindOffsetStruct("/Script/FortniteGame.MeshSet", "SearchSpeed");
return *(FCurveTableRowHandle*)(__int64(this) + SearchSpeedOffset);
}
UParticleSystem*& GetConstructedEffect()
{
static auto ConstructedEffectOffset = FindOffsetStruct("/Script/FortniteGame.MeshSet", "ConstructedEffect");
return *(UParticleSystem**)(__int64(this) + ConstructedEffectOffset);
}
UParticleSystem*& GetBreakEffect()
{
static auto BreakEffectOffset = FindOffsetStruct("/Script/FortniteGame.MeshSet", "BreakEffect");
return *(UParticleSystem**)(__int64(this) + BreakEffectOffset);
}
};
struct FTierMeshSets
{
int32& GetTier()
{
static auto TierOffset = FindOffsetStruct("/Script/FortniteGame.TierMeshSets", "Tier");
return *(int32*)(__int64(this) + TierOffset);
}
TArray<FMeshSet>& GetMeshSets()
{
static auto MeshSetsOffset = FindOffsetStruct("/Script/FortniteGame.TierMeshSets", "MeshSets");
return *(TArray<FMeshSet>*)(__int64(this) + MeshSetsOffset);
}
};
class ABuildingSMActor : public ABuildingActor class ABuildingSMActor : public ABuildingActor
{ {
public: public:
@@ -108,20 +23,6 @@ public:
return ReadBitfieldValue(bPlayerPlacedOffset, bPlayerPlacedFieldMask); return ReadBitfieldValue(bPlayerPlacedOffset, bPlayerPlacedFieldMask);
} }
TArray<FTierMeshSets>& GetAlternateMeshes()
{
static auto AlternateMeshesOffset = GetOffset("AlternateMeshes");
return Get<TArray<FTierMeshSets>>(AlternateMeshesOffset);
}
int32& GetAltMeshIdx()
{
static auto AltMeshIdxOffset = GetOffset("AltMeshIdx");
return Get<int32>(AltMeshIdxOffset);
}
void BuildingSMActor_SetMeshSet(FMeshSet* MeshSet);
void SetPlayerPlaced(bool NewValue) void SetPlayerPlaced(bool NewValue)
{ {
static auto bPlayerPlacedOffset = GetOffset("bPlayerPlaced"); static auto bPlayerPlacedOffset = GetOffset("bPlayerPlaced");
@@ -141,12 +42,6 @@ public:
return Get<int>(CurrentBuildingLevelOffset); return Get<int>(CurrentBuildingLevelOffset);
} }
UStaticMeshComponent*& GetStaticMeshComponent()
{
static auto StaticMeshComponentOffset = GetOffset("StaticMeshComponent");
return Get<UStaticMeshComponent*>(StaticMeshComponentOffset);
}
EFortResourceType& GetResourceType() EFortResourceType& GetResourceType()
{ {
static auto ResourceTypeOffset = GetOffset("ResourceType"); static auto ResourceTypeOffset = GetOffset("ResourceType");

View File

@@ -98,7 +98,7 @@ public:
if (LoadoutTeam.TeamIndex == TeamIndex) if (LoadoutTeam.TeamIndex == TeamIndex)
{ {
if (LoadoutTeam.UpdateOverrideType != EAthenaInventorySpawnOverride::NoOverride) if (LoadoutTeam.UpdateOverrideType != EAthenaInventorySpawnOverride::NoOverride)
return LoadoutTeam.UpdateOverrideType; // this is temporary! return LoadoutTeam.UpdateOverrideType;
} }
} }
@@ -115,7 +115,7 @@ public:
if (LoadoutTeam.TeamIndex == TeamIndex) if (LoadoutTeam.TeamIndex == TeamIndex)
{ {
if (LoadoutTeam.DropAllItemsOverride != EAthenaLootDropOverride::NoOverride) if (LoadoutTeam.DropAllItemsOverride != EAthenaLootDropOverride::NoOverride)
return LoadoutTeam.DropAllItemsOverride; // this is temporary! return LoadoutTeam.DropAllItemsOverride;
} }
} }

View File

@@ -31,7 +31,6 @@
#include "calendar.h" #include "calendar.h"
#include "gui.h" #include "gui.h"
#include <random> #include <random>
#include "die.h"
static UFortPlaylist* GetPlaylistToUse() static UFortPlaylist* GetPlaylistToUse()
{ {
@@ -166,8 +165,8 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
if (currentBasePlaylist) if (currentBasePlaylist)
{ {
// GameMode->SetCurrentPlaylistName(currentBasePlaylist); GameMode->SetCurrentPlaylistName(currentBasePlaylist);
// GameState->SetPlaylistId(currentBasePlaylist); GameState->SetPlaylistId(currentBasePlaylist);
} }
} }
else else
@@ -180,8 +179,8 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
if (GameState->Get(CurrentPlaylistDataOffset)) if (GameState->Get(CurrentPlaylistDataOffset))
{ {
// GameMode->SetCurrentPlaylistName(GameState->Get<UFortPlaylist*>(CurrentPlaylistDataOffset)); GameMode->SetCurrentPlaylistName(GameState->Get<UFortPlaylist*>(CurrentPlaylistDataOffset));
// GameState->SetPlaylistId(GameState->Get<UFortPlaylist*>(CurrentPlaylistDataOffset)); GameState->SetPlaylistId(GameState->Get<UFortPlaylist*>(CurrentPlaylistDataOffset));
} }
} }
} }
@@ -417,8 +416,7 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
} }
static auto bWorldIsReadyOffset = GameMode->GetOffset("bWorldIsReady"); static auto bWorldIsReadyOffset = GameMode->GetOffset("bWorldIsReady");
static auto bWorldIsReadyFieldMask = GetFieldMask(GameMode->GetProperty("bWorldIsReady")); SetBitfield(GameMode->GetPtr<PlaceholderBitfield>(bWorldIsReadyOffset), 1, true); // idk when we actually set this
GameMode->SetBitfieldValue(bWorldIsReadyOffset, bWorldIsReadyFieldMask, true); // idk when we actually set this
// Calendar::SetSnow(1000); // Calendar::SetSnow(1000);
@@ -555,15 +553,10 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
GetWorld()->Listen(); GetWorld()->Listen();
FixBuildingContainers();
LOG_INFO(LogDev, "WorldLevel: {}", GameState->GetWorldLevel()); LOG_INFO(LogDev, "WorldLevel: {}", GameState->GetWorldLevel());
if (false) SetupAIDirector();
{ SetupServerBotManager();
SetupAIDirector();
SetupServerBotManager();
}
bool bPrintCommonObjectPaths = true; bool bPrintCommonObjectPaths = true;
@@ -642,7 +635,7 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
{ {
if (CurrentObject->GetFullName().contains(WorldNamesToStreamAllFoundationsIn.at(z))) if (CurrentObject->GetFullName().contains(WorldNamesToStreamAllFoundationsIn.at(z)))
{ {
// I think we only have to set bServerStreamedInLevel but whatever. // I think we only have to set bServerStreamedInLevel.
ShowFoundation((AActor*)CurrentObject); ShowFoundation((AActor*)CurrentObject);
continue; continue;
} }
@@ -651,7 +644,6 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
} }
Globals::bStartedListening = true; Globals::bStartedListening = true;
// LOG_INFO(LogDev, "Finished listening!");
} }
bool Ret = false; bool Ret = false;

View File

@@ -406,7 +406,7 @@ std::vector<LootDrop> PickLootDrops(FName TierGroupName, int WorldLevel, int For
// LTDTables.push_back(LoadObject<UDataTable>(L"/Game/Athena/Playlists/Playground/AthenaLootTierData_Client.AthenaLootTierData_Client")); // LTDTables.push_back(LoadObject<UDataTable>(L"/Game/Athena/Playlists/Playground/AthenaLootTierData_Client.AthenaLootTierData_Client"));
// LPTables.push_back(LoadObject<UDataTable>(L"/Game/Athena/Playlists/Playground/AthenaLootPackages_Client.AthenaLootPackages_Client")); // LPTables.push_back(LoadObject<UDataTable>(L"/Game/Athena/Playlists/Playground/AthenaLootPackages_Client.AthenaLootPackages_Client"));
static auto FortGameFeatureDataClass = FindObject<UClass>(L"/Script/FortniteGame.FortGameFeatureData"); static auto FortGameFeatureDataClass = FindObject<UClass>("/Script/FortniteGame.FortGameFeatureData");
if (FortGameFeatureDataClass) if (FortGameFeatureDataClass)
{ {

View File

@@ -433,12 +433,17 @@ void AFortPlayerController::ServerAttemptInteractHook(UObject* Context, FFrame*
if (auto BuildingContainer = Cast<ABuildingContainer>(ReceivingActor)) if (auto BuildingContainer = Cast<ABuildingContainer>(ReceivingActor))
{ {
if (BuildingContainer->IsAlreadySearched()) static auto bAlreadySearchedOffset = BuildingContainer->GetOffset("bAlreadySearched");
static auto bAlreadySearchedFieldMask = GetFieldMask(BuildingContainer->GetProperty("bAlreadySearched"));
if (BuildingContainer->ReadBitfieldValue(bAlreadySearchedOffset, bAlreadySearchedFieldMask))
return; return;
BuildingContainer->SpawnLoot(PlayerController->GetMyFortPawn()); // LOG_INFO(LogInteraction, "bAlreadySearchedFieldMask: {}", bAlreadySearchedFieldMask);
BuildingContainer->SetAlreadySearched(true); BuildingContainer->SetBitfieldValue(bAlreadySearchedOffset, bAlreadySearchedFieldMask, true);
BuildingContainer->SpawnLoot(PlayerController->GetMyFortPawn());
// if (BuildingContainer->ShouldDestroyOnSearch()) // if (BuildingContainer->ShouldDestroyOnSearch())
// BuildingContainer->K2_DestroyActor(); // BuildingContainer->K2_DestroyActor();
@@ -1469,7 +1474,6 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo
} }
return ClientOnPawnDiedOriginal(PlayerController, DeathReport); return ClientOnPawnDiedOriginal(PlayerController, DeathReport);
return ClientOnPawnDiedOriginal(PlayerController, DeathReport);
} }
bool IsBuildingOkForEditing(ABuildingSMActor* BuildingActorToEdit) bool IsBuildingOkForEditing(ABuildingSMActor* BuildingActorToEdit)

View File

@@ -21,11 +21,6 @@ public:
return (A <= B) ? A : B; return (A <= B) ? A : B;
} }
static FORCEINLINE float InvSqrt(float F)
{
return 1.0f / sqrtf(F);
}
static FORCENOINLINE float Fmod(float X, float Y); static FORCENOINLINE float Fmod(float X, float Y);
static FORCEINLINE int32 FloorToInt(float F) static FORCEINLINE int32 FloorToInt(float F)

View File

@@ -250,7 +250,6 @@
<ClCompile Include="Object.cpp" /> <ClCompile Include="Object.cpp" />
<ClCompile Include="PlayerController.cpp" /> <ClCompile Include="PlayerController.cpp" />
<ClCompile Include="PlayerState.cpp" /> <ClCompile Include="PlayerState.cpp" />
<ClCompile Include="reboot.cpp" />
<ClCompile Include="SavePackage.cpp" /> <ClCompile Include="SavePackage.cpp" />
<ClCompile Include="UnrealMath.cpp" /> <ClCompile Include="UnrealMath.cpp" />
<ClCompile Include="UnrealNames.cpp" /> <ClCompile Include="UnrealNames.cpp" />

View File

@@ -274,9 +274,6 @@
<ClCompile Include="FortLootLevel.cpp"> <ClCompile Include="FortLootLevel.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter> <Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="reboot.cpp">
<Filter>Reboot\Private</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="log.h" /> <ClInclude Include="log.h" />

View File

@@ -32,14 +32,6 @@ public:
} }
} }
T* GetByWeakObject()
{
if (SoftObjectPtr.ObjectID.AssetPathName.ComparisonIndex.Value <= 0)
return nullptr;
return GetObjectByIndex(SoftObjectPtr.WeakPtr.ObjectIndex);
}
T* Get(UClass* ClassToLoad = nullptr, bool bTryToLoad = false) T* Get(UClass* ClassToLoad = nullptr, bool bTryToLoad = false)
{ {
if (Engine_Version <= 416) if (Engine_Version <= 416)

View File

@@ -20,9 +20,6 @@ public:
return FVector{ this->X - A.X, this->Y - A.Y, this->Z - A.Z }; return FVector{ this->X - A.X, this->Y - A.Y, this->Z - A.Z };
} }
FORCEINLINE FVector operator*(float Scale) const;
FORCEINLINE float SizeSquared() const FORCEINLINE float SizeSquared() const
{ {
return X * X + Y * Y + Z * Z; return X * X + Y * Y + Z * Z;
@@ -53,8 +50,3 @@ public:
*this = *this - A; *this = *this - A;
} }
}; };
FORCEINLINE FVector FVector::operator*(float Scale) const
{
return FVector(X * Scale, Y * Scale, Z * Scale);
}

View File

@@ -291,9 +291,6 @@ void Addresses::FindAll()
LOG_INFO(LogDev, "Finding PickSupplyDropLocation"); LOG_INFO(LogDev, "Finding PickSupplyDropLocation");
Addresses::PickSupplyDropLocation = FindPickSupplyDropLocation(); Addresses::PickSupplyDropLocation = FindPickSupplyDropLocation();
LOG_INFO(LogDev, "Finding LoadAsset");
Addresses::LoadAsset = FindLoadAsset();
LOG_INFO(LogDev, "Finished finding!"); LOG_INFO(LogDev, "Finished finding!");
} }
@@ -362,7 +359,6 @@ void Addresses::Print()
LOG_INFO(LogDev, "CombinePickupLea: 0x{:x}", CombinePickupLea - Base); LOG_INFO(LogDev, "CombinePickupLea: 0x{:x}", CombinePickupLea - Base);
LOG_INFO(LogDev, "CreateBuildingActorCallForDeco: 0x{:x}", CreateBuildingActorCallForDeco - Base); LOG_INFO(LogDev, "CreateBuildingActorCallForDeco: 0x{:x}", CreateBuildingActorCallForDeco - Base);
LOG_INFO(LogDev, "PickSupplyDropLocation: 0x{:x}", PickSupplyDropLocation - Base); LOG_INFO(LogDev, "PickSupplyDropLocation: 0x{:x}", PickSupplyDropLocation - Base);
LOG_INFO(LogDev, "LoadAsset: 0x{:x}", LoadAsset - Base);
} }
void Offsets::FindAll() void Offsets::FindAll()

View File

@@ -69,7 +69,6 @@ namespace Addresses
extern inline uint64 CombinePickupLea = 0; extern inline uint64 CombinePickupLea = 0;
extern inline uint64 CreateBuildingActorCallForDeco = 0; extern inline uint64 CreateBuildingActorCallForDeco = 0;
extern inline uint64 PickSupplyDropLocation = 0; extern inline uint64 PickSupplyDropLocation = 0;
extern inline uint64 LoadAsset = 0;
void SetupVersion(); // Finds Engine Version void SetupVersion(); // Finds Engine Version
void FindAll(); void FindAll();

View File

@@ -76,7 +76,7 @@ static void SetupServerBotManager()
auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState()); auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState());
auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode()); auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
static auto FortServerBotManagerClass = FindObject<UClass>(L"/Script/FortniteGame.FortServerBotManagerAthena"); // Is there a BP for this? // GameMode->ServerBotManagerClass static auto FortServerBotManagerClass = FindObject<UClass>("/Script/FortniteGame.FortServerBotManagerAthena"); // Is there a BP for this? // GameMode->ServerBotManagerClass
if (!FortServerBotManagerClass) if (!FortServerBotManagerClass)
return; return;
@@ -92,13 +92,11 @@ static void SetupServerBotManager()
static auto CachedGameModeOffset = ServerBotManager->GetOffset("CachedGameMode"); static auto CachedGameModeOffset = ServerBotManager->GetOffset("CachedGameMode");
ServerBotManager->Get(CachedGameModeOffset) = GameMode; ServerBotManager->Get(CachedGameModeOffset) = GameMode;
static auto CachedGameStateOffset = ServerBotManager->GetOffset("CachedGameState", false); static auto CachedGameStateOffset = ServerBotManager->GetOffset("CachedGameState");
ServerBotManager->Get(CachedGameStateOffset) = GameState;
if (CachedGameStateOffset != -1)
ServerBotManager->Get(CachedGameStateOffset) = GameState;
static auto CachedBotMutatorOffset = ServerBotManager->GetOffset("CachedBotMutator"); static auto CachedBotMutatorOffset = ServerBotManager->GetOffset("CachedBotMutator");
ServerBotManager->Get(CachedBotMutatorOffset) = FindFirstMutator(FindObject<UClass>(L"/Script/FortniteGame.FortAthenaMutator_Bots")); ServerBotManager->Get(CachedBotMutatorOffset) = FindFirstMutator(FindObject<UClass>("/Script/FortniteGame.FortAthenaMutator_Bots"));
} }
} }
@@ -107,7 +105,7 @@ static void SetupAIDirector()
auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState()); auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState());
auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode()); auto GameMode = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
static auto AIDirectorClass = FindObject<UClass>(L"/Script/FortniteGame.AthenaAIDirector"); // Probably wrong class static auto AIDirectorClass = FindObject<UClass>("/Script/FortniteGame.AthenaAIDirector"); // Probably wrong class
if (!AIDirectorClass) if (!AIDirectorClass)
return; return;

View File

@@ -174,7 +174,7 @@ static void SetZoneToIndexHook(AFortGameModeAthena* GameModeAthena, int Override
SafeZoneIndicator->Get<float>(SafeZoneFinishShrinkTimeOffset) = SafeZoneIndicator->Get<float>(SafeZoneStartShrinkTimeOffset) + ZoneDuration; SafeZoneIndicator->Get<float>(SafeZoneFinishShrinkTimeOffset) = SafeZoneIndicator->Get<float>(SafeZoneStartShrinkTimeOffset) + ZoneDuration;
} }
static inline void ProcessEventHook(UObject* Object, UFunction* Function, void* Parameters) void ProcessEventHook(UObject* Object, UFunction* Function, void* Parameters)
{ {
if (!Object || !Function) if (!Object || !Function)
return; return;
@@ -331,22 +331,3 @@ static inline void ProcessEventHook(UObject* Object, UFunction* Function, void*
return Object->ProcessEvent(Function, Parameters); return Object->ProcessEvent(Function, Parameters);
} }
static inline void FixBuildingContainers()
{
if (Fortnite_Version > 2)
return;
auto AllBuildingContainers = UGameplayStatics::GetAllActorsOfClass(GetWorld(), ABuildingContainer::StaticClass());
for (int i = 0; i < AllBuildingContainers.size(); i++)
{
auto BuildingContainer = (ABuildingContainer*)AllBuildingContainers.at(i);
// TODO Figure it out proper (i think its something like this)
// BuildingContainer->GetAltMeshIdx() = BuildingContainer->GetAlternateMeshes().Num() > 0 ? BuildingContainer->GetAlternateMeshes().Num() - 1 : 0;
}
AllBuildingContainers.Free();
}

View File

@@ -403,7 +403,7 @@ DWORD WINAPI Main(LPVOID)
} }
Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameMode.ReadyToStartMatch"), AFortGameModeAthena::Athena_ReadyToStartMatchHook, Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameMode.ReadyToStartMatch"), AFortGameModeAthena::Athena_ReadyToStartMatchHook,
(PVOID*)&AFortGameModeAthena::Athena_ReadyToStartMatchOriginal, false, false, true); (PVOID*)&AFortGameModeAthena::Athena_ReadyToStartMatchOriginal, false, false, true);
Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameModeBase.SpawnDefaultPawnFor"), Hooking::MinHook::Hook(GameModeDefault, FindObject<UFunction>(L"/Script/Engine.GameModeBase.SpawnDefaultPawnFor"),
AGameModeBase::SpawnDefaultPawnForHook, nullptr, false); AGameModeBase::SpawnDefaultPawnForHook, nullptr, false);
@@ -442,11 +442,8 @@ DWORD WINAPI Main(LPVOID)
// Hooking::MinHook::Hook(FortPlayerControllerZoneDefault->VFTable[0xD0 / 8], CanCreateInCurrentContextHook, (PVOID*)&CanCreateInCurrentContextOriginal); // Hooking::MinHook::Hook(FortPlayerControllerZoneDefault->VFTable[0xD0 / 8], CanCreateInCurrentContextHook, (PVOID*)&CanCreateInCurrentContextOriginal);
if (false) HookInstruction(Addresses::UpdateTrackedAttributesLea, (PVOID)UFortGadgetItemDefinition::UpdateTrackedAttributesHook, "/Script/FortniteGame.FortPlayerController.Suicide", ERelativeOffsets::LEA, FortPlayerControllerAthenaDefault);
{ HookInstruction(Addresses::CombinePickupLea, (PVOID)AFortPickup::CombinePickupHook, "/Script/Engine.PlayerController.SetVirtualJoystickVisibility", ERelativeOffsets::LEA, FortPlayerControllerAthenaDefault);
HookInstruction(Addresses::UpdateTrackedAttributesLea, (PVOID)UFortGadgetItemDefinition::UpdateTrackedAttributesHook, "/Script/FortniteGame.FortPlayerController.Suicide", ERelativeOffsets::LEA, FortPlayerControllerAthenaDefault);
HookInstruction(Addresses::CombinePickupLea, (PVOID)AFortPickup::CombinePickupHook, "/Script/Engine.PlayerController.SetVirtualJoystickVisibility", ERelativeOffsets::LEA, FortPlayerControllerAthenaDefault);
}
Hooking::MinHook::Hook(FortWeaponDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortWeapon.ServerReleaseWeaponAbility"), Hooking::MinHook::Hook(FortWeaponDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortWeapon.ServerReleaseWeaponAbility"),
AFortWeapon::ServerReleaseWeaponAbilityHook, (PVOID*)&AFortWeapon::ServerReleaseWeaponAbilityOriginal, false, true); AFortWeapon::ServerReleaseWeaponAbilityHook, (PVOID*)&AFortWeapon::ServerReleaseWeaponAbilityOriginal, false, true);

View File

@@ -165,22 +165,6 @@ static inline uint64 FindPickupInitialize()
return 0; return 0;
} }
static inline uint64 FindLoadAsset()
{
auto Addrr = Memcury::Scanner::FindStringRef(L"Loaded delay-load asset %s").Get();
for (int i = 0; i < 2000; i++)
{
if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x89 &&
(*(uint8_t*)(uint8_t*)(Addrr - i + 2) == 0x74 || *(uint8_t*)(uint8_t*)(Addrr - i + 2) == 0x6C))
{
return Addrr - i;
}
}
return 0;
}
static inline uint64 FindCreateNetDriver() static inline uint64 FindCreateNetDriver()
{ {
return 0; return 0;

View File

@@ -1,29 +0,0 @@
#include "reboot.h"
#include "SoftObjectPtr.h"
#include "KismetStringLibrary.h"
inline UObject* Assets::LoadAsset(FName Name, bool ShowDelayTimes)
{
static UObject* (*LoadAssetOriginal)(FName a1, bool a2);
return LoadAssetOriginal(Name, ShowDelayTimes);
}
inline UObject* Assets::LoadSoftObject(void* SoftObjectPtr)
{
if (Engine_Version == 416)
{
auto tAssetPtr = (TAssetPtr<UObject>*)SoftObjectPtr;
// return LoadAsset(tAssetPtr->AssetPtr.ObjectID.AssetLongPathname.);
return nullptr; // later
}
auto tSoftObjectPtr = (TSoftObjectPtr<UObject>*)SoftObjectPtr;
// if (auto WeakObject = tSoftObjectPtr->GetByWeakObject())
// return WeakObject;
return LoadAsset(tSoftObjectPtr->SoftObjectPtr.ObjectID.AssetPathName);
}

View File

@@ -384,12 +384,6 @@ static void CopyStruct(void* Dest, void* Src, size_t Size, UStruct* Struct = nul
} }
} }
class Assets
{
static inline UObject* LoadAsset(FName Name, bool ShowDelayTimes = false);
static inline UObject* LoadSoftObject(void* SoftObjectPtr);
};
template <typename T = __int64> template <typename T = __int64>
static T* Alloc(size_t Size = sizeof(T), bool bUseFMemoryRealloc = false) static T* Alloc(size_t Size = sizeof(T), bool bUseFMemoryRealloc = false)
{ {