Skip to content

Commit

Permalink
Fixed GIsClient (BIG)
Browse files Browse the repository at this point in the history
  • Loading branch information
Milxnor committed Mar 9, 2024
1 parent be2fc81 commit ec515a1
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 86 deletions.
11 changes: 10 additions & 1 deletion Project Reboot 3.0/FortGameModeAthena.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,16 @@ bool AFortGameModeAthena::Athena_ReadyToStartMatchHook(AFortGameModeAthena* Game
ShowFoundation(FindObject<AActor>(L"/Game/Athena/Apollo/Maps/Apollo_POI_Foundations.Apollo_POI_Foundations.PersistentLevel.Lobby_Foundation3")); // Aircraft Carrier
}

auto TheBlock = FindObject<AActor>(L"/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.SLAB_2"); // SLAB_3 is blank
AActor* TheBlock = nullptr;

if (Fortnite_Version > 10) // todo only checked on 10.40
{
TheBlock = FindObject<AActor>(L"/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.SLAB_4");
}
else
{
TheBlock = FindObject<AActor>(L"/Game/Athena/Maps/Athena_POI_Foundations.Athena_POI_Foundations.PersistentLevel.SLAB_2"); // SLAB_3 is blank
}

if (TheBlock)
ShowFoundation(TheBlock);
Expand Down
6 changes: 3 additions & 3 deletions Project Reboot 3.0/FortPlayerController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,6 @@ void AFortPlayerController::ServerAttemptInteractHook(UObject* Context, FFrame*
static auto ReceivingActorOffset = FindOffsetStruct(StructName, "ReceivingActor");
auto ReceivingActor = *(AActor**)(__int64(Params) + ReceivingActorOffset);

static auto InteractionBeingAttemptedOffset = FindOffsetStruct(StructName, "InteractionBeingAttempted");
auto InteractionBeingAttempted = *(EInteractionBeingAttempted*)(__int64(Params) + InteractionBeingAttemptedOffset);

// LOG_INFO(LogInteraction, "ReceivingActor: {}", __int64(ReceivingActor));

if (!ReceivingActor)
Expand Down Expand Up @@ -530,6 +527,9 @@ void AFortPlayerController::ServerAttemptInteractHook(UObject* Context, FFrame*
{
if (Engine_Version >= 424 && Fortnite_Version < 15 && ReceivingActor->GetFullName().contains("Wumba"))
{
static auto InteractionBeingAttemptedOffset = FindOffsetStruct(StructName, "InteractionBeingAttempted");
auto InteractionBeingAttempted = *(EInteractionBeingAttempted*)(__int64(Params) + InteractionBeingAttemptedOffset);

bool bIsSidegrading = InteractionBeingAttempted == EInteractionBeingAttempted::SecondInteraction ? true : false;

LOG_INFO(LogDev, "bIsSidegrading: {}", (bool)bIsSidegrading);
Expand Down
4 changes: 3 additions & 1 deletion Project Reboot 3.0/Project Reboot 3.0.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@
</ItemGroup>
<ItemGroup>
<ClInclude Include="log.h" />
<ClInclude Include="finder.h" />
<ClInclude Include="Array.h">
<Filter>Engine\Source\Runtime\Core\Public\Containers</Filter>
</ClInclude>
Expand Down Expand Up @@ -960,6 +959,9 @@
<ClInclude Include="FortPlaylistAthena.h">
<Filter>FortniteGame\Source\FortniteGame\Public</Filter>
</ClInclude>
<ClInclude Include="finder.h">
<Filter>Reboot\Public</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="Engine">
Expand Down
84 changes: 84 additions & 0 deletions Project Reboot 3.0/finder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,90 @@ uint64 FindStartAircraftPhase()
return 0;
}

uint64 FindGIsClient()
{
/* if (Fortnite_Version >= 20)
return 0; */

auto Addr = Memcury::Scanner::FindStringRef(L"AllowCommandletRendering");

std::vector<std::vector<uint8_t>> BytesArray = {
// {0x88, 0x05}, // Idk what version this is
{0xC6, 0x05}, // mov cs X // Checked on 1.11, 12.41
{0x88, 0x1D}, // mov cs bl // Checked on 17.50, 19.10
// {0x44, 0x88} // IDK WHAT VERSION This for but it scuffs older builds
};

int Skip = Engine_Version <= 420 ? 1 : 2; // Skip GIsServer and some variable i forgot

uint64 Addy;

for (int i = 0; i < 50; i++) // we should subtract from skip if go up
{
auto CurrentByte = *(Memcury::ASM::MNEMONIC*)(Addr.Get() - i);

// if (bPrint)
// std::cout << "CurrentByte: " << std::hex << (int)CurrentByte << '\n';

bool ShouldBreak = false;

// LOG_INFO(LogDev, "[{}] Byte: 0x{:x}", i, (int)CurrentByte);

for (auto& Bytes : BytesArray)
{
if (CurrentByte == Bytes[0])
{
bool Found = true;
for (int j = 1; j < Bytes.size(); j++)
{
if (*(Memcury::ASM::MNEMONIC*)(Addr.Get() - i + j) != Bytes[j])
{
Found = false;
break;
}
}
if (Found)
{
int Relative = Bytes[0] == 0x44 ? 3 : 2;
auto current = Memcury::Scanner(Addr.Get() - i);
// LOG_INFO(LogDev, "[{}] No Rel 0x{:x} Rel: 0x{:x}", Skip, current.Get() - __int64(GetModuleHandleW(0)), Memcury::Scanner(Addr.Get() - i).RelativeOffset(Relative).Get() - __int64(GetModuleHandleW(0)));

if (Skip > 0)
{
Skip--;
continue;
}

Addy = Bytes[0] == 0xC6
? current.RelativeOffset(Relative, 1).Get() // If mov cs then we add 1 because the last byte is the value and makes whole instructions 1 byte longer
: current.RelativeOffset(Relative).Get();
ShouldBreak = true;
break;
}
}
}

if (ShouldBreak)
break;

// std::cout << std::format("CurrentByte: 0x{:x}\n", (uint8_t)CurrentByte);
}

// LOG_INFO(LogDev, "Addy: 0x{:x}", Addy - __int64(GetModuleHandleW(0)));

return Addy; // 0; // Memcury::Scanner(Addy3).RelativeOffset(2).Get();

/*
auto Addr = Memcury::Scanner::FindStringRef(L"AllowCommandletRendering");
int Skip = 1;
auto Addy = FindBytes(Addr, { 0xC6, 0x05 }, 50, 0, true, Skip);
Addy = Addy ? Addy : FindBytes(Addr, { 0x44, 0x88 }, 50, 0, true, Skip);
Addy = Addy ? Addy : FindBytes(Addr, { 0x88, 0x1D }, 50, 0, true, Skip);
return Memcury::Scanner(Addy).RelativeOffset(2).Get();
*/
}

uint64 FindGetSessionInterface()
{
auto strRef = Memcury::Scanner::FindStringRef(L"OnDestroyReservedSessionComplete %s bSuccess: %d", true, 0, Fortnite_Version >= 19).Get();
Expand Down
78 changes: 2 additions & 76 deletions Project Reboot 3.0/finder.h
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ static inline uint64 FindCollectGarbage()

static inline uint64 FindActorGetNetMode()
{
// return 0;
return 0; // We *shouldnt* need to hook this now because I fixed FindGIsClient

if (Engine_Version == 500) // hah well this and 427 does like nothing cuz inline mostly
{
Expand Down Expand Up @@ -1463,81 +1463,7 @@ static inline uint64 FindMcpIsDedicatedServerOffset()
return 0x60; // 1.7.2 & 1.11 & 4.1
}

static inline uint64 FindGIsClient()
{
/* if (Fortnite_Version >= 20)
return 0; */

auto Addr = Memcury::Scanner::FindStringRef(L"AllowCommandletRendering");

std::vector<std::vector<uint8_t>> BytesArray = { {0x88, 0x05}, {0xC6, 0x05}, {0x88, 0x1D}, {0x44, 0x88}};

int Skip = Engine_Version <= 420 ? 1 : 2;

uint64 Addy;

for (int i = 0; i < 50; i++) // we should subtract from skip if goup
{
auto CurrentByte = *(Memcury::ASM::MNEMONIC*)(Addr.Get() - i);

// if (bPrint)
// std::cout << "CurrentByte: " << std::hex << (int)CurrentByte << '\n';

bool ShouldBreak = false;

// LOG_INFO(LogDev, "[{}] Byte: 0x{:x}", i, (int)CurrentByte);

for (auto& Bytes : BytesArray)
{
if (CurrentByte == Bytes[0])
{
bool Found = true;
for (int j = 1; j < Bytes.size(); j++)
{
if (*(Memcury::ASM::MNEMONIC*)(Addr.Get() - i + j) != Bytes[j])
{
Found = false;
break;
}
}
if (Found)
{
int Relative = Bytes[0] == 0x44 ? 3 : 2;
// LOG_INFO(LogDev, "[{}] No Rel 0x{:x} Rel: 0x{:x}", Skip, Memcury::Scanner(Addr.Get() - i).Get() - __int64(GetModuleHandleW(0)), Memcury::Scanner(Addr.Get() - i).RelativeOffset(Relative).Get() - __int64(GetModuleHandleW(0)));

if (Skip > 0)
{
Skip--;
continue;
}

Addy = Memcury::Scanner(Addr.Get() - i).RelativeOffset(Relative).Get();
ShouldBreak = true;
break;
}
}
}

if (ShouldBreak)
break;

// std::cout << std::format("CurrentByte: 0x{:x}\n", (uint8_t)CurrentByte);
}

// LOG_INFO(LogDev, "Addy: 0x{:x}", Addy - __int64(GetModuleHandleW(0)));

return Addy; // 0; // Memcury::Scanner(Addy3).RelativeOffset(2).Get();

/*
auto Addr = Memcury::Scanner::FindStringRef(L"AllowCommandletRendering");
int Skip = 1;
auto Addy = FindBytes(Addr, { 0xC6, 0x05 }, 50, 0, true, Skip);
Addy = Addy ? Addy : FindBytes(Addr, { 0x44, 0x88 }, 50, 0, true, Skip);
Addy = Addy ? Addy : FindBytes(Addr, { 0x88, 0x1D }, 50, 0, true, Skip);
return Memcury::Scanner(Addy).RelativeOffset(2).Get();
*/
}
uint64 FindGIsClient(); // AHHH

static inline uint64 FindGetNetMode()
{
Expand Down
7 changes: 6 additions & 1 deletion Project Reboot 3.0/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ static inline void SetIsLategame(bool Value)
StartingShield = Value ? 100 : 0;
}

static inline bool HasAnyCalendarModification()
{
return Calendar::HasSnowModification() || Calendar::HasNYE() || std::floor(Fortnite_Version) == 13;
}

static inline void Restart() // todo move?
{
FString LevelA = Engine_Version < 424
Expand Down Expand Up @@ -378,7 +383,7 @@ static inline void MainTabs()
}
}

if (ImGui::BeginTabItem("Calendar Events"))
if (HasAnyCalendarModification() && ImGui::BeginTabItem("Calendar Events"))
{
Tab = CALENDAR_TAB;
PlayerTab = -1;
Expand Down
8 changes: 4 additions & 4 deletions vendor/memcury.h
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,9 @@
return _address != address._address;
}

auto RelativeOffset(uint32_t offset) -> Address
auto RelativeOffset(uint32_t offset, uint32_t off2 = 0) -> Address
{
_address = ((_address + offset + 4) + *(int32_t*)(_address + offset));
_address = ((_address + offset + 4 + off2) + *(int32_t*)(_address + offset));
return *this;
}

Expand Down Expand Up @@ -1010,15 +1010,15 @@
return *this;
}

auto RelativeOffset(uint32_t offset) -> Scanner
auto RelativeOffset(uint32_t offset, uint32_t off2 = 0) -> Scanner
{
if (!_address.Get())
{
LOG_WARN(LogMemory, "Trying to relative offset an invalid offset!");
return *this;
}

_address.RelativeOffset(offset);
_address.RelativeOffset(offset, off2);

return *this;
}
Expand Down

0 comments on commit ec515a1

Please sign in to comment.