Fix stupid s4

This commit is contained in:
Gray
2024-03-18 22:59:09 -04:00
parent ef97a84822
commit a8e3bd4fbf
3 changed files with 41 additions and 8 deletions

View File

@@ -1002,6 +1002,30 @@ DWORD WINAPI Main(LPVOID)
Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x41624C8), (PVOID)ActivatePhaseAtIndexHook, (PVOID*)&ActivatePhaseAtIndexOriginal); // 7FF79E3E24C8 Hooking::MinHook::Hook((PVOID)(__int64(GetModuleHandleW(0)) + 0x41624C8), (PVOID)ActivatePhaseAtIndexHook, (PVOID*)&ActivatePhaseAtIndexOriginal); // 7FF79E3E24C8
} }
if (std::floor(Fortnite_Version) == 4)
{
auto RetrieveCharacterPartsAddr = Memcury::Scanner::FindPattern("48 89 5C 24 ? 57 48 83 EC 20 48 8B 01 0F B6 FA 48 8B D9 FF 90 ? ? ? ? 48 8B C8 E8 ? ? ? ? 84 C0 74 0D 33 C0 48 8B 5C 24 ? 48 83 C4 20 5F").Get();
LOG_INFO(LogDev, "RetrieveCharacterPartsAddr: {}", RetrieveCharacterPartsAddr);
for (int i = 0; i < 400; i++)
{
if (*(uint8_t*)(RetrieveCharacterPartsAddr + i) == 0x74) // jz
{
DWORD dwProtection;
VirtualProtect((PVOID)(RetrieveCharacterPartsAddr + i), 1, PAGE_EXECUTE_READWRITE, &dwProtection);
*(uint8_t*)(RetrieveCharacterPartsAddr + i) = 0x75; // jnz
DWORD dwTemp;
VirtualProtect((PVOID)(RetrieveCharacterPartsAddr + i), 1, dwProtection, &dwTemp);
LOG_INFO(LogDev, "Applied RetrieveCharacterParts patch!");
break;
}
}
}
if (Globals::bGoingToPlayEvent) if (Globals::bGoingToPlayEvent)
{ {
if (Fortnite_Version >= 17.30) if (Fortnite_Version >= 17.30)

View File

@@ -54,12 +54,12 @@ uint64 FindGIsClient()
{0x88, 0x05}, // 20.40 21.00 {0x88, 0x05}, // 20.40 21.00
{0xC6, 0x05}, // mov cs X // Checked on 1.11, 12.41 {0xC6, 0x05}, // mov cs X // Checked on 1.11, 12.41
{0x88, 0x1D}, // mov cs bl // Checked on 17.50, 19.10 {0x88, 0x1D}, // mov cs bl // Checked on 17.50, 19.10
{0x44, 0x88} // IDK WHAT VERSION This for but it scuffs older builds {0x44, 0x88} // 4.5
}; };
int Skip = 2; // Skip GIsServer and some variable i forgot int Skip = 2;
uint64 Addy; uint64 Addy = 0;
for (int i = 0; i < 50; i++) // we should subtract from skip if go up for (int i = 0; i < 50; i++) // we should subtract from skip if go up
{ {
@@ -87,16 +87,25 @@ uint64 FindGIsClient()
} }
if (Found) if (Found)
{ {
int Relative = Bytes[0] == 0x44 ? 3 : 2; bool bIsScuffedByte = Bytes[0] == 0x44;
int Relative = bIsScuffedByte ? 3 : 2;
auto current = Memcury::Scanner(Addr.Get() - i); 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))); // 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 (bIsScuffedByte)
{
if (Bytes[2] == 0x74) // DIE 4.5 (todo check length of entire instruction)
continue;
}
if (Skip > 0) if (Skip > 0)
{ {
Skip--; Skip--;
continue; continue;
} }
LOG_INFO(LogDev, "Found GIsClient with byte 0x{:x}", Bytes[0]);
Addy = Bytes[0] == 0xC6 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, 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(); : current.RelativeOffset(Relative).Get();

View File

@@ -515,9 +515,9 @@ static inline uint64 FindFree()
{ {
uint64 addr = 0; uint64 addr = 0;
if (Fortnite_Version <= 3.3) // todo check 3.4 if (Engine_Version <= 420) // 3.3, 4.1, 4.5
addr = Memcury::Scanner::FindPattern("48 85 C9 74 1D 4C 8B 05 ? ? ? ? 4D 85 C0 0F 84").Get(); addr = Memcury::Scanner::FindPattern("48 85 C9 74 1D 4C 8B 05 ? ? ? ? 4D 85 C0 0F 84").Get();
else if (Engine_Version >= 420 && Engine_Version <= 426) else if (Engine_Version >= 421 && Engine_Version <= 426)
addr = Memcury::Scanner::FindPattern("48 85 C9 74 2E 53 48 83 EC 20 48 8B D9").Get(); addr = Memcury::Scanner::FindPattern("48 85 C9 74 2E 53 48 83 EC 20 48 8B D9").Get();
else if (Engine_Version >= 427) else if (Engine_Version >= 427)
addr = Memcury::Scanner::FindPattern("48 85 C9 0F 84 ? ? ? ? 53 48 83 EC 20 48 89 7C 24 ? 48 8B D9 48 8B 3D").Get(); addr = Memcury::Scanner::FindPattern("48 85 C9 0F 84 ? ? ? ? 53 48 83 EC 20 48 89 7C 24 ? 48 8B D9 48 8B 3D").Get();
@@ -1529,8 +1529,8 @@ static inline uint64 FindGetNetMode()
static inline uint64 FindApplyCharacterCustomization() static inline uint64 FindApplyCharacterCustomization()
{ {
if (std::floor(Fortnite_Version) == 4) // RetrieveCharacterParts return null if dedicated server????? // if (std::floor(Fortnite_Version) == 4) // RetrieveCharacterParts return null if dedicated server?????
return 0; // return 0;
auto Addrr = Memcury::Scanner::FindStringRef(L"AFortPlayerState::ApplyCharacterCustomization - Failed initialization, using default parts. Player Controller: %s PlayerState: %s, HeroId: %s", false, 0, Fortnite_Version >= 20, true).Get(); auto Addrr = Memcury::Scanner::FindStringRef(L"AFortPlayerState::ApplyCharacterCustomization - Failed initialization, using default parts. Player Controller: %s PlayerState: %s, HeroId: %s", false, 0, Fortnite_Version >= 20, true).Get();