performance, cheat setpickaxe (untested), cheat load, auto restart (untested),
This commit is contained in:
Milxnor
2023-04-29 08:55:57 -04:00
parent 9f0990a696
commit cda077d6f8
18 changed files with 25023 additions and 81 deletions

View File

@@ -102,7 +102,7 @@ void UAthenaMarkerComponent::ServerAddMapMarkerHook(UAthenaMarkerComponent* Mark
if (!CurrentTeamMemberMarkerComponent) if (!CurrentTeamMemberMarkerComponent)
continue; continue;
static auto ClientAddMarkerFn = FindObject<UFunction>("/Script/FortniteGame.AthenaMarkerComponent.ClientAddMarker"); static auto ClientAddMarkerFn = FindObject<UFunction>(L"/Script/FortniteGame.AthenaMarkerComponent.ClientAddMarker");
if (ClientAddMarkerFn) if (ClientAddMarkerFn)
{ {

View File

@@ -26,6 +26,7 @@
#include "vendingmachine.h" #include "vendingmachine.h"
#include "FortAthenaMutator.h" #include "FortAthenaMutator.h"
#include "calendar.h" #include "calendar.h"
#include "gui.h"
static UFortPlaylist* GetPlaylistToUse() static UFortPlaylist* GetPlaylistToUse()
{ {
@@ -1157,14 +1158,15 @@ void AFortGameModeAthena::Athena_HandleStartingNewPlayerHook(AFortGameModeAthena
static auto OwnedPortalOffset = NewPlayer->GetOffset("OwnedPortal"); static auto OwnedPortalOffset = NewPlayer->GetOffset("OwnedPortal");
NewPlayer->Get<AFortAthenaCreativePortal*>(OwnedPortalOffset) = Portal; NewPlayer->Get<AFortAthenaCreativePortal*>(OwnedPortalOffset) = Portal;
static auto CreativePlotLinkedVolumeOffset = NewPlayer->GetOffset("CreativePlotLinkedVolume"); NewPlayer->GetCreativePlotLinkedVolume() = Portal->GetLinkedVolume();
NewPlayer->Get<AFortVolume*>(CreativePlotLinkedVolumeOffset) = Portal->GetLinkedVolume();
// OnRep_CreativePlotLinkedVolume ?
Portal->GetLinkedVolume()->GetVolumeState() = EVolumeState::Ready; Portal->GetLinkedVolume()->GetVolumeState() = EVolumeState::Ready;
static auto IslandPlayset = FindObject<UFortPlaysetItemDefinition>("/Game/Playsets/PID_Playset_60x60_Composed.PID_Playset_60x60_Composed"); static auto IslandPlayset = FindObject<UFortPlaysetItemDefinition>("/Game/Playsets/PID_Playset_60x60_Composed.PID_Playset_60x60_Composed");
if (auto Volume = NewPlayer->Get<AFortVolume*>(CreativePlotLinkedVolumeOffset)) if (auto Volume = NewPlayer->GetCreativePlotLinkedVolume())
{ {
// if (IslandPlayset) // if (IslandPlayset)
// Volume->UpdateSize({ (float)IslandPlayset->Get<int>("SizeX"), (float)IslandPlayset->Get<int>("SizeY"), (float)IslandPlayset->Get<int>("SizeZ") }); // Volume->UpdateSize({ (float)IslandPlayset->Get<int>("SizeX"), (float)IslandPlayset->Get<int>("SizeY"), (float)IslandPlayset->Get<int>("SizeZ") });

View File

@@ -130,7 +130,7 @@ bool AFortGameStateAthena::IsPlayerBuildableClass(UClass* Class)
bool AFortGameStateAthena::IsRespawningAllowed(AFortPlayerState* PlayerState) bool AFortGameStateAthena::IsRespawningAllowed(AFortPlayerState* PlayerState)
{ {
auto GameModeAthena = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode()); auto GameModeAthena = Cast<AFortGameModeAthena>(GetWorld()->GetGameMode());
static auto IsRespawningAllowedFn = FindObject<UFunction>("/Script/FortniteGame.FortGameStateZone.IsRespawningAllowed"); static auto IsRespawningAllowedFn = FindObject<UFunction>(L"/Script/FortniteGame.FortGameStateZone.IsRespawningAllowed");
LOG_INFO(LogDev, "IsRespawningAllowedFn: {}", __int64(IsRespawningAllowedFn)); LOG_INFO(LogDev, "IsRespawningAllowedFn: {}", __int64(IsRespawningAllowedFn));
@@ -196,13 +196,13 @@ void AFortGameStateAthena::OnRep_GamePhase()
{ {
EAthenaGamePhase OldGamePhase = GetGamePhase(); EAthenaGamePhase OldGamePhase = GetGamePhase();
static auto OnRep_GamePhase = FindObject<UFunction>("/Script/FortniteGame.FortGameStateAthena.OnRep_GamePhase"); static auto OnRep_GamePhase = FindObject<UFunction>(L"/Script/FortniteGame.FortGameStateAthena.OnRep_GamePhase");
this->ProcessEvent(OnRep_GamePhase, &OldGamePhase); this->ProcessEvent(OnRep_GamePhase, &OldGamePhase);
} }
void AFortGameStateAthena::OnRep_CurrentPlaylistInfo() void AFortGameStateAthena::OnRep_CurrentPlaylistInfo()
{ {
static auto OnRep_CurrentPlaylistData = FindObject<UFunction>("/Script/FortniteGame.FortGameStateAthena.OnRep_CurrentPlaylistData"); static auto OnRep_CurrentPlaylistData = FindObject<UFunction>(L"/Script/FortniteGame.FortGameStateAthena.OnRep_CurrentPlaylistData");
if (OnRep_CurrentPlaylistData) if (OnRep_CurrentPlaylistData)
{ {
@@ -210,7 +210,7 @@ void AFortGameStateAthena::OnRep_CurrentPlaylistInfo()
} }
else else
{ {
static auto OnRep_CurrentPlaylistInfo = FindObject<UFunction>("/Script/FortniteGame.FortGameStateAthena.OnRep_CurrentPlaylistInfo"); static auto OnRep_CurrentPlaylistInfo = FindObject<UFunction>(L"/Script/FortniteGame.FortGameStateAthena.OnRep_CurrentPlaylistInfo");
if (OnRep_CurrentPlaylistInfo) if (OnRep_CurrentPlaylistInfo)
this->ProcessEvent(OnRep_CurrentPlaylistInfo); this->ProcessEvent(OnRep_CurrentPlaylistInfo);

View File

@@ -395,12 +395,13 @@ bool AFortInventory::RemoveItem(const FGuid& ItemGuid, bool* bShouldUpdate, int
if (QuickBars) if (QuickBars)
{ {
auto SlotIndex = QuickBars->GetSlotIndex(ItemGuid); auto ItemDefinitionQuickBars = IsPrimaryQuickbar(ItemDefinition) ? EFortQuickBars::Primary : EFortQuickBars::Secondary;
auto SlotIndex = QuickBars->GetSlotIndex(ItemGuid, ItemDefinitionQuickBars);
if (SlotIndex != -1) if (SlotIndex != -1)
{ {
QuickBars->ServerRemoveItemInternal(ItemGuid, false, true); QuickBars->ServerRemoveItemInternal(ItemGuid, false, true);
QuickBars->EmptySlot(IsPrimaryQuickbar(ItemDefinition) ? EFortQuickBars::Primary : EFortQuickBars::Secondary, SlotIndex); QuickBars->EmptySlot(ItemDefinitionQuickBars, SlotIndex);
} }
} }
} }

View File

@@ -21,6 +21,7 @@
#include "FortAbilitySet.h" #include "FortAbilitySet.h"
#include "vendingmachine.h" #include "vendingmachine.h"
#include "KismetSystemLibrary.h" #include "KismetSystemLibrary.h"
#include "gui.h"
void AFortPlayerController::ClientReportDamagedResourceBuilding(ABuildingSMActor* BuildingSMActor, EFortResourceType PotentialResourceType, int PotentialResourceCount, bool bDestroyed, bool bJustHitWeakspot) void AFortPlayerController::ClientReportDamagedResourceBuilding(ABuildingSMActor* BuildingSMActor, EFortResourceType PotentialResourceType, int PotentialResourceCount, bool bDestroyed, bool bJustHitWeakspot)
{ {
@@ -1099,6 +1100,23 @@ DWORD WINAPI SpectateThread(LPVOID)
return 0; return 0;
} }
DWORD WINAPI RestartThread(LPVOID)
{
// We should probably use unreal engine's timing system for this.
// There is no way to restart that I know of without closing the connection to the clients.
bIsInAutoRestart = true;
float SecondsBeforeRestart = 10;
Sleep(SecondsBeforeRestart * 1000);
Restart();
bIsInAutoRestart = false;
return 0;
}
void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerController, void* DeathReport) void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerController, void* DeathReport)
{ {
auto GameState = Cast<AFortGameStateAthena>(((AFortGameMode*)GetWorld()->GetGameMode())->GetGameState()); auto GameState = Cast<AFortGameStateAthena>(((AFortGameMode*)GetWorld()->GetGameMode())->GetGameState());
@@ -1302,6 +1320,11 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo
} }
} }
} }
if (GameState->GetGamePhase() == EAthenaGamePhase::EndGame)
{
CreateThread(0, 0, RestartThread, 0, 0, 0);
}
} }
} }

View File

@@ -149,6 +149,12 @@ public:
return Get<UAthenaMarkerComponent*>(MarkerComponentOffset); return Get<UAthenaMarkerComponent*>(MarkerComponentOffset);
} }
AFortVolume*& GetCreativePlotLinkedVolume()
{
static auto CreativePlotLinkedVolumeOffset = GetOffset("CreativePlotLinkedVolume");
return Get<AFortVolume*>(CreativePlotLinkedVolumeOffset);
}
static void StartGhostModeHook(UObject* Context, FFrame* Stack, void* Ret); // we could native hook this but eh static void StartGhostModeHook(UObject* Context, FFrame* Stack, void* Ret); // we could native hook this but eh
static void EndGhostModeHook(AFortPlayerControllerAthena* PlayerController); static void EndGhostModeHook(AFortPlayerControllerAthena* PlayerController);
static void EnterAircraftHook(UObject* PC, AActor* Aircraft); static void EnterAircraftHook(UObject* PC, AActor* Aircraft);

View File

@@ -284,6 +284,7 @@
<ClInclude Include="commands.h" /> <ClInclude Include="commands.h" />
<ClInclude Include="ContainerAllocationPolicies.h" /> <ClInclude Include="ContainerAllocationPolicies.h" />
<ClInclude Include="Controller.h" /> <ClInclude Include="Controller.h" />
<ClInclude Include="creative.h" />
<ClInclude Include="CurveTable.h" /> <ClInclude Include="CurveTable.h" />
<ClInclude Include="DataTable.h" /> <ClInclude Include="DataTable.h" />
<ClInclude Include="DataTableFunctionLibrary.h" /> <ClInclude Include="DataTableFunctionLibrary.h" />

View File

@@ -814,6 +814,9 @@
<ClInclude Include="moderation.h"> <ClInclude Include="moderation.h">
<Filter>Reboot\Public</Filter> <Filter>Reboot\Public</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="creative.h">
<Filter>Reboot\Public</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Filter Include="Engine"> <Filter Include="Engine">

View File

@@ -5,6 +5,8 @@
#include "KismetSystemLibrary.h" #include "KismetSystemLibrary.h"
#include "AthenaBarrierObjective.h" #include "AthenaBarrierObjective.h"
#include "FortAthenaMutator_Barrier.h" #include "FortAthenaMutator_Barrier.h"
#include "FortWeaponMeleeItemDefinition.h"
#include "creative.h"
bool IsOperator(APlayerState* PlayerState, AFortPlayerController* PlayerController) bool IsOperator(APlayerState* PlayerState, AFortPlayerController* PlayerController)
{ {
@@ -198,6 +200,90 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
SendMessageToConsole(PlayerController, L"Granted item!"); SendMessageToConsole(PlayerController, L"Granted item!");
} }
else if (Command == "setpickaxe")
{
if (NumArgs < 1)
{
SendMessageToConsole(PlayerController, L"Please provide a pickaxe!");
return;
}
auto WorldInventory = ReceivingController->GetWorldInventory();
if (!WorldInventory)
{
SendMessageToConsole(PlayerController, L"No world inventory!");
return;
}
auto& pickaxeName = Arguments[1];
static auto AthenaPickaxeItemDefinitionClass = FindObject<UClass>("/Script/FortniteGame.AthenaPickaxeItemDefinition");
auto Pickaxe1 = FindObject(pickaxeName + "." + pickaxeName, nullptr, ANY_PACKAGE);
UFortWeaponMeleeItemDefinition* NewPickaxeItemDefinition = nullptr;
if (Pickaxe1)
{
if (Pickaxe1->IsA(AthenaPickaxeItemDefinitionClass))
{
static auto WeaponDefinitionOffset = Pickaxe1->GetOffset("WeaponDefinition");
NewPickaxeItemDefinition = Pickaxe1->Get<UFortWeaponMeleeItemDefinition*>(WeaponDefinitionOffset);
}
else
{
NewPickaxeItemDefinition = Cast<UFortWeaponMeleeItemDefinition>(Pickaxe1);
}
}
if (!NewPickaxeItemDefinition)
{
SendMessageToConsole(PlayerController, L"Invalid pickaxe item definition!");
return;
}
auto PickaxeInstance = WorldInventory->GetPickaxeInstance();
if (PickaxeInstance)
{
WorldInventory->RemoveItem(PickaxeInstance->GetItemEntry()->GetItemGuid(), nullptr, PickaxeInstance->GetItemEntry()->GetCount(), true);
}
WorldInventory->AddItem(NewPickaxeItemDefinition, nullptr, 1);
WorldInventory->Update();
SendMessageToConsole(PlayerController, L"Successfully set pickaxe!");
}
else if (Command == "load")
{
if (!Globals::bCreative)
{
SendMessageToConsole(PlayerController, L"It is not creative!");
return;
}
auto Volume = ReceivingController->GetCreativePlotLinkedVolume();
if (!Volume)
{
SendMessageToConsole(PlayerController, L"They do not have an island!");
return;
}
if (Arguments.size() <= 1)
{
SendMessageToConsole(PlayerController, L"Please provide a filename!\n");
return;
}
std::string FileName = "islandSave";
try { FileName = Arguments[1]; }
catch (...) {}
Creative::LoadIsland(FileName, Volume);
SendMessageToConsole(PlayerController, L"Loaded!");
}
else if (Command == "spawnpickup") else if (Command == "spawnpickup")
{ {
if (NumArgs < 1) if (NumArgs < 1)

View File

@@ -0,0 +1,147 @@
#pragma once
#include <filesystem>
#include <fstream>
#include <json.hpp>
#include "FortVolume.h"
#include "FortGameStateAthena.h"
namespace fs = std::filesystem;
namespace Creative
{
static inline bool LoadIsland(const std::string& SaveFileName, AFortVolume* LoadIntoVolume, bool* bCouldBeOutdatedPtr = nullptr)
{
auto GameState = Cast<AFortGameStateAthena>(GetWorld()->GetGameState());
std::ifstream fileStream(fs::current_path().string() + "\\Islands\\" + SaveFileName + ".save");
if (!fileStream.is_open())
{
// SendMessageToConsole(PlayerController, L"Failed to open filestream (file may not exist)!\n");
return false;
}
/* auto AllBuildingActors = LoadIntoVolume->GetActorsWithinVolumeByClass(ABuildingActor::StaticClass());
for (int i = 0; i < AllBuildingActors.Num(); i++)
{
auto CurrentBuildingActor = (ABuildingActor*)AllBuildingActors[i];
CurrentBuildingActor->SilentDie();
} */
nlohmann::json j;
fileStream >> j;
auto VolumeLocation = LoadIntoVolume->GetActorLocation();
auto VolumeRotation = LoadIntoVolume->GetActorRotation();
for (const auto& obj : j) {
for (auto it = obj.begin(); it != obj.end(); ++it) {
auto& ClassName = it.key();
auto Class = FindObject<UClass>(ClassName);
if (!Class)
{
std::cout << "Invalid Class!\n";
continue;
}
std::vector<float> stuff;
auto& value = it.value();
std::vector<std::string> DevicePropertiesStr;
if (value.is_array()) {
for (const auto& elem : value) {
if (!elem.is_array())
{
stuff.push_back(elem);
}
else // Device Properties
{
for (const auto& elem2 : elem) {
for (auto it2 = elem2.begin(); it2 != elem2.end(); ++it2) {
auto& value2z = it2.value();
DevicePropertiesStr.push_back(value2z);
}
}
}
}
}
else
{
}
// std::cout << "stuff.size(): " << stuff.size() << '\n';
if (stuff.size() >= 8)
{
FRotator rot{};
rot.Pitch = stuff[3] + VolumeRotation.Pitch;
rot.Roll = stuff[4] + VolumeRotation.Roll;
rot.Yaw = stuff[5] + VolumeRotation.Yaw;
FVector Scale3D = { 1, 1, 1 };
if (stuff.size() >= 11)
{
Scale3D.X = stuff[8];
Scale3D.Y = stuff[9];
Scale3D.Z = stuff[10];
}
auto NewActor = GetWorld()->SpawnActor<ABuildingActor>(Class, FVector{ stuff[0] + VolumeLocation.X , stuff[1] + VolumeLocation.Y, stuff[2] + VolumeLocation.Z },
rot.Quaternion(), Scale3D);
if (!NewActor)
continue;
// NewActor->bCanBeDamaged = false;
NewActor->InitializeBuildingActor(NewActor, nullptr, false);
// NewActor->GetTeamIndex() = stuff[6];
// NewActor->SetHealth(stuff[7]);
static auto FortActorOptionsComponentClass = FindObject<UClass>("/Script/FortniteGame.FortActorOptionsComponent");
auto ActorOptionsComponent = NewActor->GetComponentByClass(FortActorOptionsComponentClass);
// continue;
/*
if (ActorOptionsComponent)
{
// UE::TMap<FString, FString> Map{};
TArray<FString> PropertyNameStrs;
for (int kl = 0; kl < DevicePropertiesStr.size(); kl += 2)
{
if (kl + 1 >= DevicePropertiesStr.size())
break;
auto PropertyName = DevicePropertiesStr[kl];
auto PropertyData = DevicePropertiesStr[kl + 1];
LOG_INFO(LogCreative, "PropertyName: {}", PropertyName);
LOG_INFO(LogCreative, "PropertyData: {}", PropertyData);
PropertyNameStrs.Add(std::wstring(PropertyName.begin(), PropertyName.end()).c_str());
}
for (int jk = 0; jk < PropertyNameStrs.size(); jk++)
{
LOG_INFO(LogCreative, "[{}] PropertyName: {}", jk, PropertyNameStrs.at(jk).ToString());
}
}
*/
}
}
}
return true;
}
}

View File

@@ -313,7 +313,8 @@ void ProcessEventHook(UObject* Object, UFunction* Function, void* Parameters)
!strstr(FunctionName.c_str(), "BlueprintGetAllHighlightableComponents") && !strstr(FunctionName.c_str(), "BlueprintGetAllHighlightableComponents") &&
!strstr(FunctionFullName.c_str(), "Primitive_Structure_AmbAudioComponent") && !strstr(FunctionFullName.c_str(), "Primitive_Structure_AmbAudioComponent") &&
!strstr(FunctionName.c_str(), "ServerTriggerCombatEvent") && !strstr(FunctionName.c_str(), "ServerTriggerCombatEvent") &&
!strstr(FunctionName.c_str(), "SpinCubeTimeline__UpdateFunc")) !strstr(FunctionName.c_str(), "SpinCubeTimeline__UpdateFunc") &&
!strstr(ObjectName.c_str(), "FortPhysicsObjectComponent"))
{ {
LOG_INFO(LogDev, "Function called: {} with {}", FunctionFullName, ObjectName); LOG_INFO(LogDev, "Function called: {} with {}", FunctionFullName, ObjectName);
} }

View File

@@ -171,6 +171,7 @@ DWORD WINAPI Main(LPVOID)
} }
bSwitchedInitialLevel = true; bSwitchedInitialLevel = true;
Globals::bAutoRestart = IsRestartingSupported();
static auto GameModeDefault = FindObject<AFortGameModeAthena>(L"/Script/FortniteGame.Default__FortGameModeAthena"); static auto GameModeDefault = FindObject<AFortGameModeAthena>(L"/Script/FortniteGame.Default__FortGameModeAthena");
static auto FortPlayerControllerZoneDefault = FindObject<AFortPlayerController>(L"/Script/FortniteGame.Default__FortPlayerControllerZone"); static auto FortPlayerControllerZoneDefault = FindObject<AFortPlayerController>(L"/Script/FortniteGame.Default__FortPlayerControllerZone");
@@ -496,8 +497,13 @@ DWORD WINAPI Main(LPVOID)
} }
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerGiveCreativeItem"), Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerGiveCreativeItem"),
AFortPlayerControllerAthena::ServerGiveCreativeItemHook, nullptr, true); AFortPlayerControllerAthena::ServerGiveCreativeItemHook, nullptr, true);
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerPlaySquadQuickChatMessage"),
AFortPlayerControllerAthena::ServerPlaySquadQuickChatMessageHook, nullptr, false); if (Fortnite_Version < 19) // its all screwed up idk
{
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerPlaySquadQuickChatMessage"),
AFortPlayerControllerAthena::ServerPlaySquadQuickChatMessageHook, nullptr, false);
}
Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerTeleportToPlaygroundLobbyIsland"), Hooking::MinHook::Hook(FortPlayerControllerAthenaDefault, FindObject<UFunction>(L"/Script/FortniteGame.FortPlayerControllerAthena.ServerTeleportToPlaygroundLobbyIsland"),
AFortPlayerControllerAthena::ServerTeleportToPlaygroundLobbyIslandHook, nullptr, false); AFortPlayerControllerAthena::ServerTeleportToPlaygroundLobbyIslandHook, nullptr, false);

View File

@@ -168,7 +168,8 @@ static inline uint64 FindKickPlayer()
if (std::floor(Fortnite_Version) == 18) if (std::floor(Fortnite_Version) == 18)
return 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 48 83 65 ? ? 4C 8B F2 83 65 E8 00 4C 8B E1 83 65 EC").Get(); return 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 48 83 65 ? ? 4C 8B F2 83 65 E8 00 4C 8B E1 83 65 EC").Get();
if (std::floor(Fortnite_Version) == 19)
return Memcury::Scanner::FindPattern("48 89 5C 24 ? 55 56 57 48 8B EC 48 83 EC 60 48 8B FA 48 8B F1 E8").Get();
if (Engine_Version >= 423 || Engine_Version <= 425) // && instead of || ?? if (Engine_Version >= 423 || Engine_Version <= 425) // && instead of || ??
return Memcury::Scanner::FindPattern("48 89 5C 24 08 48 89 74 24 10 57 48 83 EC ? 49 8B F0 48 8B DA 48 85 D2").Get(); return Memcury::Scanner::FindPattern("48 89 5C 24 08 48 89 74 24 10 57 48 83 EC ? 49 8B F0 48 8B DA 48 85 D2").Get();
@@ -178,7 +179,7 @@ static inline uint64 FindKickPlayer()
uint64 Ret = 0; uint64 Ret = 0;
auto Addr = Memcury::Scanner::FindStringRef(L"Validation Failure: %s. kicking %s", false); auto Addr = Memcury::Scanner::FindStringRef(L"Validation Failure: %s. kicking %s", false, 0, Fortnite_Version >= 19);
if (Addr.Get()) if (Addr.Get())
{ {
@@ -192,21 +193,30 @@ static inline uint64 FindKickPlayer()
return Ret; return Ret;
auto Addr2 = Memcury::Scanner::FindStringRef(L"Failed to kick player"); // L"KickPlayer %s Reason %s" auto Addr2 = Memcury::Scanner::FindStringRef(L"Failed to kick player"); // L"KickPlayer %s Reason %s"
Ret = Addr2.Get() ? FindBytes(Addr2, { 0x48, 0x89, 0x5C }, 2000, 0, true) : Ret; // s12?? auto Addrr = Addr2.Get();
// Ret = Addr2.Get() ? FindBytes(Addr2, { 0x48, 0x8B, 0xC4 }, 2000, 0, true) : Ret;
if (Ret) for (int i = 0; i < 3000; i++)
return Ret; {
/* if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x40 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x53)
{
return Addrr - i;
} */
/* auto Addr3 = Memcury::Scanner::FindStringRef(L"Game already ended."); if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(Addrr - i + 2) == 0x5C)
Ret = Addr3.Get() ? FindBytes(Addr3, { 0x48, 0x89, 0x5C }, 2000, 0, true) : Ret; {
return Addrr - i;
}
if (Ret) if (Fortnite_Version >= 17)
return Ret; */ {
if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x8B && *(uint8_t*)(uint8_t*)(Addrr - i + 2) == 0xC4)
{
return Addrr - i;
}
}
}
Ret = Memcury::Scanner::FindPattern("40 53 41 56 48 81 EC ? ? ? ? 48 8B 01 48 8B DA 4C 8B F1 FF 90").Get(); return Memcury::Scanner::FindPattern("40 53 41 56 48 81 EC ? ? ? ? 48 8B 01 48 8B DA 4C 8B F1 FF 90").Get();
return Ret;
} }
static inline uint64 FindInitHost() static inline uint64 FindInitHost()
@@ -729,10 +739,13 @@ static inline uint64 FindEnterAircraft()
return Addr - i; return Addr - i;
} }
/* if (*(uint8_t*)(uint8_t*)(Addr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(Addr - i + 2) == 0x5C && *(uint8_t*)(uint8_t*)(Addr - i + 3) == 0x24) if (Fortnite_Version >= 15)
{ {
return Addr - i; if (*(uint8_t*)(uint8_t*)(Addr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(Addr - i + 2) == 0x5C && *(uint8_t*)(uint8_t*)(Addr - i + 3) == 0x24)
} */ {
return Addr - i;
}
}
if (*(uint8_t*)(uint8_t*)(Addr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(Addr - i + 2) == 0x74) // 4.1 if (*(uint8_t*)(uint8_t*)(Addr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(Addr - i + 2) == 0x74) // 4.1
{ {
@@ -1136,7 +1149,7 @@ static inline uint64 FindDispatchRequest()
{ {
auto Addrr = Memcury::Scanner::FindStringRef(L"MCP-Profile: Dispatching request to %s", true, 0, Fortnite_Version >= 19).Get(); auto Addrr = Memcury::Scanner::FindStringRef(L"MCP-Profile: Dispatching request to %s", true, 0, Fortnite_Version >= 19).Get();
for (int i = 0; i < 400; i++) for (int i = 0; i < 1000; i++)
{ {
if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(Addrr - i + 2) == 0x5C) if (*(uint8_t*)(uint8_t*)(Addrr - i) == 0x48 && *(uint8_t*)(uint8_t*)(Addrr - i + 1) == 0x89 && *(uint8_t*)(uint8_t*)(Addrr - i + 2) == 0x5C)
{ {

View File

@@ -20,6 +20,7 @@ namespace Globals
extern inline bool bHitReadyToStartMatch = false; extern inline bool bHitReadyToStartMatch = false;
extern inline bool bInitializedPlaylist = false; extern inline bool bInitializedPlaylist = false;
extern inline bool bStartedListening = false; extern inline bool bStartedListening = false;
extern inline bool bAutoRestart = true;
extern inline int AmountOfListens = 0; // TODO: Switch to this for LastNum extern inline int AmountOfListens = 0; // TODO: Switch to this for LastNum
} }

View File

@@ -57,7 +57,8 @@
#define FUN_PLAYERTAB 5 #define FUN_PLAYERTAB 5
static inline int SecondsUntilTravel = 5; static inline int SecondsUntilTravel = 5;
static bool bSwitchedInitialLevel = false; static inline bool bSwitchedInitialLevel = false;
static inline bool bIsInAutoRestart = false;
// THE BASE CODE IS FROM IMGUI GITHUB // THE BASE CODE IS FROM IMGUI GITHUB
@@ -71,6 +72,58 @@ void CleanupDeviceD3D();
void ResetDevice(); void ResetDevice();
LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
static inline bool bStartedBus = false;
void Restart() // todo move?
{
FString LevelA = Engine_Version < 424
? L"open Athena_Terrain" : Engine_Version >= 500 ? Engine_Version >= 501
? L"open Asteria_Terrain"
: Globals::bCreative ? L"open Creative_NoApollo_Terrain"
: L"open Artemis_Terrain"
: Globals::bCreative ? L"open Creative_NoApollo_Terrain"
: L"open Apollo_Terrain";
static auto BeaconClass = FindObject<UClass>(L"/Script/FortniteGame.FortOnlineBeaconHost");
auto AllFortBeacons = UGameplayStatics::GetAllActorsOfClass(GetWorld(), BeaconClass);
for (int i = 0; i < AllFortBeacons.Num(); i++)
{
AllFortBeacons.at(i)->K2_DestroyActor();
}
AllFortBeacons.Free();
Globals::bInitializedPlaylist = false;
Globals::bStartedListening = false;
Globals::bHitReadyToStartMatch = false;
bStartedBus = false;
AmountOfRestarts++;
LOG_INFO(LogDev, "Switching!");
if (Fortnite_Version >= 3) // idk what ver
{
((AGameMode*)GetWorld()->GetGameMode())->RestartGame();
}
else
{
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), LevelA, nullptr);
}
/*
auto& LevelCollections = GetWorld()->Get<TArray<__int64>>("LevelCollections");
int LevelCollectionSize = FindObject<UStruct>("/Script/Engine.LevelCollection")->GetPropertiesSize();
*(UNetDriver**)(__int64(LevelCollections.AtPtr(0, LevelCollectionSize)) + 0x10) = nullptr;
*(UNetDriver**)(__int64(LevelCollections.AtPtr(1, LevelCollectionSize)) + 0x10) = nullptr;
*/
// UGameplayStatics::OpenLevel(GetWorld(), UKismetStringLibrary::Conv_StringToName(LevelA), true, FString());
}
std::string wstring_to_utf8(const std::wstring& str) std::string wstring_to_utf8(const std::wstring& str)
{ {
if (str.empty()) return {}; if (str.empty()) return {};
@@ -219,6 +272,8 @@ static int playerTabTab = MAIN_PLAYERTAB;
void StaticUI() void StaticUI()
{ {
ImGui::Checkbox("Auto Restart", &Globals::bAutoRestart);
#ifndef PROD #ifndef PROD
ImGui::Checkbox("Log ProcessEvent", &Globals::bLogProcessEvent); ImGui::Checkbox("Log ProcessEvent", &Globals::bLogProcessEvent);
#endif #endif
@@ -367,8 +422,6 @@ void PlayerTabs()
} }
} }
static bool bStartedBus = false;
void MainUI() void MainUI()
{ {
bool bLoaded = true; bool bLoaded = true;
@@ -440,56 +493,11 @@ void MainUI()
} }
*/ */
if (Engine_Version < 424 && ImGui::Button("Restart")) if (!bIsInAutoRestart && (Engine_Version < 424 && ImGui::Button("Restart")))
{ {
if (Engine_Version < 424) if (Engine_Version < 424)
{ {
FString LevelA = Engine_Version < 424 Restart();
? L"open Athena_Terrain" : Engine_Version >= 500 ? Engine_Version >= 501
? L"open Asteria_Terrain"
: Globals::bCreative ? L"open Creative_NoApollo_Terrain"
: L"open Artemis_Terrain"
: Globals::bCreative ? L"open Creative_NoApollo_Terrain"
: L"open Apollo_Terrain";
static auto BeaconClass = FindObject<UClass>(L"/Script/FortniteGame.FortOnlineBeaconHost");
auto AllFortBeacons = UGameplayStatics::GetAllActorsOfClass(GetWorld(), BeaconClass);
for (int i = 0; i < AllFortBeacons.Num(); i++)
{
AllFortBeacons.at(i)->K2_DestroyActor();
}
AllFortBeacons.Free();
Globals::bInitializedPlaylist = false;
Globals::bStartedListening = false;
Globals::bHitReadyToStartMatch = false;
bStartedBus = false;
AmountOfRestarts++;
LOG_INFO(LogDev, "Switching!");
if (Fortnite_Version >= 3) // idk what ver
{
((AGameMode*)GetWorld()->GetGameMode())->RestartGame();
}
else
{
UKismetSystemLibrary::ExecuteConsoleCommand(GetWorld(), LevelA, nullptr);
}
/*
auto& LevelCollections = GetWorld()->Get<TArray<__int64>>("LevelCollections");
int LevelCollectionSize = FindObject<UStruct>("/Script/Engine.LevelCollection")->GetPropertiesSize();
*(UNetDriver**)(__int64(LevelCollections.AtPtr(0, LevelCollectionSize)) + 0x10) = nullptr;
*(UNetDriver**)(__int64(LevelCollections.AtPtr(1, LevelCollectionSize)) + 0x10) = nullptr;
*/
// UGameplayStatics::OpenLevel(GetWorld(), UKismetStringLibrary::Conv_StringToName(LevelA), true, FString());
LOG_INFO(LogGame, "Restarting!"); LOG_INFO(LogGame, "Restarting!");
} }
else else

View File

@@ -317,7 +317,7 @@ namespace Hooking
if (Original) if (Original)
*Original = DefaultClass->VFTable[Idx]; *Original = DefaultClass->VFTable[Idx];
LOG_INFO(LogDev, "Hooking {} with Idx 0x{:x}", FunctionName, AddrOrIdx); LOG_INFO(LogDev, "Hooking {} with Idx 0x{:x} (0x{:x})", FunctionName, AddrOrIdx, __int64(DefaultClass->VFTable[Idx]) - __int64(GetModuleHandleW(0)));
VirtualSwap(DefaultClass->VFTable, Idx, Detour); VirtualSwap(DefaultClass->VFTable, Idx, Detour);

View File

@@ -50,4 +50,9 @@ struct PlaceholderBitfield
inline bool AreVehicleWeaponsEnabled() inline bool AreVehicleWeaponsEnabled()
{ {
return Fortnite_Version < 9; return Fortnite_Version < 9;
}
inline bool IsRestartingSupported()
{
return Engine_Version < 424;
} }

24639
vendor/json.hpp vendored Normal file

File diff suppressed because it is too large Load Diff