fix 3.0, 3.1, 3.2, and add cube spawning event, mybe fix s19 crash?

This commit is contained in:
Milxnor
2023-04-26 21:44:16 -04:00
parent 93d18a3fe9
commit be0873d5d7
12 changed files with 166 additions and 20 deletions

View File

@@ -5,7 +5,7 @@
#include "FortLootPackage.h" #include "FortLootPackage.h"
#include "FortPickup.h" #include "FortPickup.h"
void SpawnBGAs() void SpawnBGAs() // hahah not "proper", there's a function that we can hook and it gets called on each spawner whenever playlist gets set, but it's fine.
{ {
static auto BGAConsumableSpawnerClass = FindObject<UClass>("/Script/FortniteGame.BGAConsumableSpawner"); static auto BGAConsumableSpawnerClass = FindObject<UClass>("/Script/FortniteGame.BGAConsumableSpawner");
@@ -30,10 +30,10 @@ void SpawnBGAs()
for (auto& LootDrop : LootDrops) for (auto& LootDrop : LootDrops)
{ {
static auto ConsumableClassOffset = LootDrop.ItemDefinition->GetOffset("ConsumableClass"); static auto ConsumableClassOffset = LootDrop.ItemDefinition->GetOffset("ConsumableClass");
auto& ConsumableClassSoft = LootDrop.ItemDefinition->Get<TSoftObjectPtr<UClass>>(ConsumableClassOffset); auto ConsumableClassSoft = LootDrop.ItemDefinition->GetPtr<TSoftObjectPtr<UClass>>(ConsumableClassOffset);
static auto BlueprintGeneratedClassClass = FindObject<UClass>("/Script/Engine.BlueprintGeneratedClass"); static auto BlueprintGeneratedClassClass = FindObject<UClass>("/Script/Engine.BlueprintGeneratedClass");
auto StrongConsumableClass = ConsumableClassSoft.Get(BlueprintGeneratedClassClass, true); auto StrongConsumableClass = ConsumableClassSoft->Get(BlueprintGeneratedClassClass, true);
if (!StrongConsumableClass) if (!StrongConsumableClass)
{ {
@@ -46,4 +46,6 @@ void SpawnBGAs()
} }
AllBGAConsumableSpawners.Free(); AllBGAConsumableSpawners.Free();
LOG_INFO(LogDev, "Spawned BGAS!");
} }

View File

@@ -160,7 +160,10 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
} }
else else
{ {
GameState->Get("CurrentPlaylistData") = Playlist; static auto CurrentPlaylistDataOffset = GameState->GetOffset("CurrentPlaylistData", false);
if (CurrentPlaylistDataOffset != -1)
GameState->Get(CurrentPlaylistDataOffset) = Playlist;
} }
if (bOnRep) if (bOnRep)
@@ -553,6 +556,22 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
// return false; // return false;
static auto NewFn = FindObject<UFunction>("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C.New");
if (NewFn && (Fortnite_Version == 5.30 ? !Globals::bGoingToPlayEvent : true))
{
auto Loader = GetEventLoader("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C");
LOG_INFO(LogDev, "Loader: {}", __int64(Loader));
if (Loader)
{
int32 NewParam = 1;
// Loader->ProcessEvent(NextFn, &NewParam);
Loader->ProcessEvent(NewFn, &NewParam);
}
}
LoopMutators([&](AFortAthenaMutator* Mutator) { LOG_INFO(LogGame, "Mutator {}", Mutator->GetPathName()); }); LoopMutators([&](AFortAthenaMutator* Mutator) { LOG_INFO(LogGame, "Mutator {}", Mutator->GetPathName()); });
Globals::AmountOfListens++; Globals::AmountOfListens++;

View File

@@ -98,6 +98,8 @@ static bool ApplyCID(AFortPlayerPawn* Pawn, UObject* CID, bool bUseServerChooseP
static auto HeroTypeOffset = PlayerState->GetOffset("HeroType"); static auto HeroTypeOffset = PlayerState->GetOffset("HeroType");
// PlayerState->Get(HeroTypeOffset) = HeroDefinition; // PlayerState->Get(HeroTypeOffset) = HeroDefinition;
return true;
} }
struct FGhostModeRepData struct FGhostModeRepData

View File

@@ -1,7 +1,7 @@
#include "NetConnection.h" #include "NetConnection.h"
bool UNetConnection::ClientHasInitializedLevelFor(const AActor* TestActor) const { bool UNetConnection::ClientHasInitializedLevelFor(const AActor* TestActor) const {
// return true; return true;
static auto ClientHasInitializedLevelForAddr = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 48 8B 5A 20 48 8B F1 4C 8B C3").Get(); static auto ClientHasInitializedLevelForAddr = Memcury::Scanner::FindPattern("48 89 5C 24 ? 48 89 74 24 ? 57 48 83 EC 20 48 8B 5A 20 48 8B F1 4C 8B C3").Get();
if (!ClientHasInitializedLevelForAddr) if (!ClientHasInitializedLevelForAddr)

View File

@@ -344,12 +344,16 @@ static FORCEINLINE bool IsActorDormant(FNetworkObjectInfo* ActorInfo, const TWea
bool UNetDriver::IsLevelInitializedForActor(const AActor* InActor, const UNetConnection* InConnection) const bool UNetDriver::IsLevelInitializedForActor(const AActor* InActor, const UNetConnection* InConnection) const
{ {
if (Fortnite_Version >= 2.42) // idk if (Fortnite_Version >= 2.42) // idk
{
return true; return true;
}
/* #if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
if (!InActor || !InConnection) if (!InActor || !InConnection)
return false; return false;
// check(World == InActor->GetWorld()); // check(World == InActor->GetWorld());
#endif */
// return true; // damn // return true; // damn
const bool bCorrectWorld = (InConnection->GetClientWorldPackageName() == GetWorldPackage()->NamePrivate && InConnection->ClientHasInitializedLevelFor(InActor)); const bool bCorrectWorld = (InConnection->GetClientWorldPackageName() == GetWorldPackage()->NamePrivate && InConnection->ClientHasInitializedLevelFor(InActor));

View File

@@ -386,6 +386,7 @@
<ClInclude Include="Map.h" /> <ClInclude Include="Map.h" />
<ClInclude Include="MegaStormManager.h" /> <ClInclude Include="MegaStormManager.h" />
<ClInclude Include="MemoryOps.h" /> <ClInclude Include="MemoryOps.h" />
<ClInclude Include="moderation.h" />
<ClInclude Include="NameTypes.h" /> <ClInclude Include="NameTypes.h" />
<ClInclude Include="NetDriver.h" /> <ClInclude Include="NetDriver.h" />
<ClInclude Include="NetSerialization.h" /> <ClInclude Include="NetSerialization.h" />

View File

@@ -79,7 +79,6 @@
<ClCompile Include="ActorComponent.cpp"> <ClCompile Include="ActorComponent.cpp">
<Filter>Engine\Source\Runtime\Engine\Private\Components</Filter> <Filter>Engine\Source\Runtime\Engine\Private\Components</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="FortLootPackage.cpp"> <ClCompile Include="FortLootPackage.cpp">
<Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter> <Filter>FortniteGame\Source\FortniteGame\Private\Items</Filter>
</ClCompile> </ClCompile>
@@ -254,6 +253,9 @@
<ClCompile Include="NetConnection.cpp"> <ClCompile Include="NetConnection.cpp">
<Filter>Engine\Source\Runtime\Engine\Private</Filter> <Filter>Engine\Source\Runtime\Engine\Private</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="dllmain.cpp">
<Filter>Reboot\Public</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="log.h" /> <ClInclude Include="log.h" />
@@ -809,6 +811,9 @@
<ClInclude Include="FortGameModePickup.h"> <ClInclude Include="FortGameModePickup.h">
<Filter>FortniteGame\Source\FortniteGame\Public\Items</Filter> <Filter>FortniteGame\Source\FortniteGame\Public\Items</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="moderation.h">
<Filter>Reboot\Public</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Filter Include="Engine"> <Filter Include="Engine">

View File

@@ -406,11 +406,16 @@ void Offsets::FindAll()
{ {
Offsets::ClientWorldPackageName = 0x17F8; Offsets::ClientWorldPackageName = 0x17F8;
} }
if (Fortnite_Version == 2.5) if (Fortnite_Version >= 2.5 && Fortnite_Version <= 3.1) // checked 2.5, 3.0, 3.1
{ {
Offsets::NetworkObjectList = 0x4F0; Offsets::NetworkObjectList = 0x4F0;
Offsets::ReplicationFrame = 0x328; Offsets::ReplicationFrame = 0x328;
} }
if (Fortnite_Version == 3.1 || Fortnite_Version == 3.2)
{
Offsets::NetworkObjectList = 0x4F8;
Offsets::ClientWorldPackageName = 0x1818;
}
if (Engine_Version == 419) // checked 2.4.2 & 1.11 if (Engine_Version == 419) // checked 2.4.2 & 1.11
{ {
Offsets::NetworkObjectList = 0x490; Offsets::NetworkObjectList = 0x490;
@@ -531,7 +536,7 @@ std::vector<uint64> Addresses::GetFunctionsToNull()
if (Engine_Version == 500) if (Engine_Version == 500)
{ {
// toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 55 53 56 57 41 54 41 55 41 56 41 57 48 8D 68 A1 48 81 EC ? ? ? ? 45 33 F6 0F 29 70 A8 44 38 35").Get()); // zone // toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 55 53 56 57 41 54 41 55 41 56 41 57 48 8D 68 A1 48 81 EC ? ? ? ? 45 33 F6 0F 29 70 A8 44 38 35").Get()); // zone
// toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 55 56 57 41 54 41 55 41 56 41 57 48 8D 68 A8 48 81 EC ? ? ? ? 45 33 FF").Get()); // Garbage collection toNull.push_back(Memcury::Scanner::FindPattern("48 8B C4 48 89 58 08 55 56 57 41 54 41 55 41 56 41 57 48 8D 68 A8 48 81 EC ? ? ? ? 45").Get()); // GC
} }
toNull.push_back(Addresses::ChangeGameSessionId); toNull.push_back(Addresses::ChangeGameSessionId);

View File

@@ -50,6 +50,64 @@ static inline std::vector<Event> Events =
false false
), ),
Event Event
(
"Crack Closure",
"/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C",
"",
0,
{
},
{
{
{
false,
"/Game/Athena/Events/BP_Athena_Event_Components.BP_Athena_Event_Components_C.Final"
},
0
},
{
{
true,
"/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C.Final"
},
0
},
},
"/Game/Athena/Events/BP_Athena_Event_Components.BP_Athena_Event_Components_C",
"/Game/Athena/Playlists/Playlist_DefaultSolo.Playlist_DefaultSolo",
5.30,
false
),
/* Event
(
"Impact Lake",
"/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C",
"",
0,
{
},
{
{
{
true,
"/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C.PlayFinalSink"
},
0
},
},
"/Game/Athena/Events/BP_Athena_Event_Components.BP_Athena_Event_Components_C",
"/Game/Athena/Playlists/Playlist_DefaultSolo.Playlist_DefaultSolo",
5.41,
false
), */
Event
( (
"Butterfly", "Butterfly",
"/Game/Athena/Prototype/Blueprints/Island/BP_Butterfly.BP_Butterfly_C", "/Game/Athena/Prototype/Blueprints/Island/BP_Butterfly.BP_Butterfly_C",
@@ -411,7 +469,7 @@ static inline UObject* GetEventScripting()
return AllScripters.at(0); return AllScripters.at(0);
} }
static inline UObject* GetEventLoader() static inline UObject* GetEventLoader(const std::string& OverrideLoaderName = "NULL")
{ {
Event OurEvent; Event OurEvent;
@@ -427,7 +485,7 @@ static inline UObject* GetEventLoader()
if (!OurEvent.Version) if (!OurEvent.Version)
return nullptr; return nullptr;
auto LoaderClass = FindObject<UClass>(OurEvent.LoaderClass); auto LoaderClass = FindObject<UClass>(OverrideLoaderName == "NULL" ? OurEvent.LoaderClass : OverrideLoaderName);
if (!LoaderClass) if (!LoaderClass)
{ {

View File

@@ -398,7 +398,7 @@ static inline uint64 FindIsNetRelevantForOffset()
{ {
if (Engine_Version == 416) // checked on 1.7.2 & 1.8 if (Engine_Version == 416) // checked on 1.7.2 & 1.8
return 0x420 / 8; return 0x420 / 8;
if (Fortnite_Version == 1.11 || Fortnite_Version == 2.42 || Fortnite_Version == 2.5) if (Fortnite_Version == 1.11 || (Fortnite_Version >= 2.42 && Fortnite_Version <= 3.2)) // checked 1.11, 2.4.2, 2.5, 3.0, 3.1
return 0x418 / 8; return 0x418 / 8;
return 0; return 0;
@@ -426,7 +426,7 @@ static inline uint64 FindSpawnActor()
auto Addr = Memcury::Scanner::FindStringRef(L"SpawnActor failed because no class was specified"); auto Addr = Memcury::Scanner::FindStringRef(L"SpawnActor failed because no class was specified");
if (Engine_Version >= 416 && Fortnite_Version <= 2.5) if (Engine_Version >= 416 && Fortnite_Version <= 3.2)
return FindBytes(Addr, { 0x40, 0x55 }, 3000, 0, true); return FindBytes(Addr, { 0x40, 0x55 }, 3000, 0, true);
return FindBytes(Addr, { 0x4C, 0x8B, 0xDC }, 3000, 0, true); return FindBytes(Addr, { 0x4C, 0x8B, 0xDC }, 3000, 0, true);
@@ -552,7 +552,14 @@ static inline uint64 FindCompletePickupAnimation()
return Memcury::Scanner::FindPattern("4C 8B DC 53 55 56 48 83 EC 60 48 8B F1 48 8B 89 ? ? ? ? 48 85 C9").Get(); return Memcury::Scanner::FindPattern("4C 8B DC 53 55 56 48 83 EC 60 48 8B F1 48 8B 89 ? ? ? ? 48 85 C9").Get();
if (Engine_Version == 420) if (Engine_Version == 420)
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 57 48 83 EC 20 48 8B D9 48 8B 89 ? ? ? ? 48 85 C9 74 20 48 8D 44 24").Get(); {
auto addy = Memcury::Scanner::FindPattern("4C 8B DC 53 55 56 48 83 EC 60 48 8B F1 48 8B 89", false).Get(); // 3.1
if (!addy)
addy = Memcury::Scanner::FindPattern("48 89 5C 24 ? 57 48 83 EC 20 48 8B D9 48 8B 89 ? ? ? ? 48 85 C9 74 20 48 8D 44 24").Get();
return addy;
}
if (Engine_Version == 421) if (Engine_Version == 421)
{ {
@@ -920,7 +927,7 @@ static inline uint64 FindTickFlush()
return addr; return addr;
} }
auto Addr = Memcury::Scanner::FindStringRef(L"STAT_NetTickFlush"); auto Addr = Memcury::Scanner::FindStringRef(L"STAT_NetTickFlush", false);
if (!Addr.Get()) if (!Addr.Get())
{ {
@@ -1516,7 +1523,7 @@ static inline uint64 FindReplaceBuildingActor()
static inline uint64 FindSendClientAdjustment() static inline uint64 FindSendClientAdjustment()
{ {
if (Fortnite_Version <= 2.5) if (Fortnite_Version <= 3.2)
return Memcury::Scanner::FindPattern("40 53 48 83 EC 20 48 8B 99 ? ? ? ? 48 39 99 ? ? ? ? 74 0A 48 83 B9").Get(); return Memcury::Scanner::FindPattern("40 53 48 83 EC 20 48 8B 99 ? ? ? ? 48 39 99 ? ? ? ? 74 0A 48 83 B9").Get();
return 0; return 0;
@@ -1526,15 +1533,22 @@ static inline uint64 FindReplicateActor()
{ {
if (Engine_Version == 416) if (Engine_Version == 416)
return Memcury::Scanner::FindPattern("40 55 53 57 41 56 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 48 8D 59 68 4C 8B F1 48 8B").Get(); return Memcury::Scanner::FindPattern("40 55 53 57 41 56 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 48 8D 59 68 4C 8B F1 48 8B").Get();
if (Engine_Version >= 419 && Fortnite_Version <= 2.5) if (Engine_Version >= 419 && Fortnite_Version <= 3.2)
return Memcury::Scanner::FindPattern("40 55 56 41 54 41 55 41 56 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 4C 8B E9 48 8B 49 68 48").Get(); {
auto addr = Memcury::Scanner::FindPattern("40 55 56 57 41 54 41 55 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 4C", false).Get(); // 3.0, we could just use this sig for everything?
if (!addr)
addr = Memcury::Scanner::FindPattern("40 55 56 41 54 41 55 41 56 48 8D AC 24 ? ? ? ? 48 81 EC ? ? ? ? 4C 8B E9 48 8B 49 68 48").Get();
return addr;
}
return 0; return 0;
} }
static inline uint64 FindCreateChannel() static inline uint64 FindCreateChannel()
{ {
if (Fortnite_Version <= 2.5) if (Fortnite_Version <= 3.2)
return Memcury::Scanner::FindPattern("40 56 57 41 54 41 55 41 57 48 83 EC 60 48 8B 01 41 8B F9 45 0F B6 E0").Get(); return Memcury::Scanner::FindPattern("40 56 57 41 54 41 55 41 57 48 83 EC 60 48 8B 01 41 8B F9 45 0F B6 E0").Get();
return 0; return 0;
@@ -1544,7 +1558,7 @@ static inline uint64 FindSetChannelActor()
{ {
if (Engine_Version == 416) if (Engine_Version == 416)
return Memcury::Scanner::FindPattern("4C 8B DC 55 53 57 41 54 49 8D AB ? ? ? ? 48 81 EC ? ? ? ? 45 33").Get(); return Memcury::Scanner::FindPattern("4C 8B DC 55 53 57 41 54 49 8D AB ? ? ? ? 48 81 EC ? ? ? ? 45 33").Get();
if (Engine_Version >= 419 && Fortnite_Version <= 2.5) if (Engine_Version >= 419 && Fortnite_Version <= 3.2)
{ {
auto aa = Memcury::Scanner::FindPattern("48 8B C4 55 53 57 41 54 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 45 33 E4 48 89 70", false).Get(); auto aa = Memcury::Scanner::FindPattern("48 8B C4 55 53 57 41 54 48 8D A8 ? ? ? ? 48 81 EC ? ? ? ? 45 33 E4 48 89 70", false).Get();
@@ -1563,7 +1577,7 @@ static inline uint64 FindCallPreReplication()
return Memcury::Scanner::FindPattern("48 85 D2 0F 84 ? ? ? ? 48 8B C4 55 57 41 57 48 8D 68 A1 48 81 EC").Get(); return Memcury::Scanner::FindPattern("48 85 D2 0F 84 ? ? ? ? 48 8B C4 55 57 41 57 48 8D 68 A1 48 81 EC").Get();
if (Engine_Version == 419) if (Engine_Version == 419)
return Memcury::Scanner::FindPattern("48 85 D2 0F 84 ? ? ? ? 48 8B C4 55 57 41 54 48 8D 68 A1 48 81 EC ? ? ? ? 48 89 58 08 4C").Get(); return Memcury::Scanner::FindPattern("48 85 D2 0F 84 ? ? ? ? 48 8B C4 55 57 41 54 48 8D 68 A1 48 81 EC ? ? ? ? 48 89 58 08 4C").Get();
if (Fortnite_Version == 2.5) if (Fortnite_Version >= 2.5 && Fortnite_Version <= 3.2)
return Memcury::Scanner::FindPattern("48 85 D2 0F 84 ? ? ? ? 56 41 56 48 83 EC 38 4C 8B F2").Get(); return Memcury::Scanner::FindPattern("48 85 D2 0F 84 ? ? ? ? 56 41 56 48 83 EC 38 4C 8B F2").Get();
return 0; return 0;

View File

@@ -406,6 +406,40 @@ void MainUI()
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), cmd, nullptr); UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), cmd, nullptr);
} }
/*
if (ImGui::Button("New"))
{
static auto NextFn = FindObject<UFunction>("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C.Next");
static auto NewFn = FindObject<UFunction>("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C.New");
auto Loader = GetEventLoader("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C");
LOG_INFO(LogDev, "Loader: {}", __int64(Loader));
if (Loader)
{
int32 NewParam = 1;
// Loader->ProcessEvent(NextFn, &NewParam);
Loader->ProcessEvent(NewFn, &NewParam);
}
}
if (ImGui::Button("Next"))
{
static auto NextFn = FindObject<UFunction>("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C.Next");
static auto NewFn = FindObject<UFunction>("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C.New");
auto Loader = GetEventLoader("/Game/Athena/Prototype/Blueprints/Cube/CUBE.CUBE_C");
LOG_INFO(LogDev, "Loader: {}", __int64(Loader));
if (Loader)
{
int32 NewParam = 1;
Loader->ProcessEvent(NextFn, &NewParam);
// Loader->ProcessEvent(NewFn, &NewParam);
}
}
*/
if (Engine_Version < 424 && ImGui::Button("Restart")) if (Engine_Version < 424 && ImGui::Button("Restart"))
{ {
if (Engine_Version < 424) if (Engine_Version < 424)

View File

@@ -0,0 +1,2 @@
#pragma once