mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-28 06:43:01 +05:00
Correct an improperly decrypted CPlayerPedData::operator= that broke gang recruiting after activating replays
Contributed by Wesser
This commit is contained in:
parent
141ee0f1a5
commit
b48f5da91d
1 changed files with 90 additions and 0 deletions
|
@ -2016,6 +2016,75 @@ namespace RacingCheckpointsRender
|
|||
}
|
||||
}
|
||||
|
||||
// ============= Correct an improperly decrypted CPlayerPedData::operator= that broke gang recruiting after activating replays =============
|
||||
namespace PlayerPedDataAssignment
|
||||
{
|
||||
__declspec(naked) void AssignmentOp_Hoodlum()
|
||||
{
|
||||
_asm
|
||||
{
|
||||
xor edx, [ecx+34h]
|
||||
and edx, 1
|
||||
xor [eax+34h], edx
|
||||
mov esi, [eax+34h]
|
||||
mov edx, [ecx+34h]
|
||||
xor edx, esi
|
||||
and edx, 2
|
||||
xor edx, esi
|
||||
mov [eax+34h], edx
|
||||
mov esi, [ecx+34h]
|
||||
xor esi, edx
|
||||
and esi, 4
|
||||
xor esi, edx
|
||||
mov [eax+34h], esi
|
||||
mov edx, [ecx+34h]
|
||||
xor edx, esi
|
||||
and edx, 8
|
||||
xor edx, esi
|
||||
mov [eax+34h], edx
|
||||
mov esi, [ecx+34h]
|
||||
xor esi, edx
|
||||
and esi, 10h
|
||||
xor esi, edx
|
||||
mov [eax+34h], esi
|
||||
mov edx, [ecx+34h]
|
||||
xor edx, esi
|
||||
and edx, 20h
|
||||
xor edx, esi
|
||||
mov [eax+34h], edx
|
||||
mov esi, [ecx+34h]
|
||||
xor esi, edx
|
||||
and esi, 40h
|
||||
xor esi, edx
|
||||
mov [eax+34h], esi
|
||||
mov edx, [ecx+34h]
|
||||
xor edx, esi
|
||||
and edx, 80h
|
||||
xor edx, esi
|
||||
mov [eax+34h], edx
|
||||
mov esi, [ecx+34h]
|
||||
xor esi, edx
|
||||
and esi, 100h
|
||||
xor esi, edx
|
||||
mov [eax+34h], esi
|
||||
mov edx, [ecx+34h]
|
||||
retn
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked) void AssignmentOp_Compact()
|
||||
{
|
||||
_asm
|
||||
{
|
||||
call AssignmentOp_Hoodlum
|
||||
xor edx, esi
|
||||
and edx, 200h
|
||||
retn
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ============= LS-RP Mode stuff =============
|
||||
namespace LSRPMode
|
||||
|
@ -4651,6 +4720,27 @@ void Patch_SA_10()
|
|||
}
|
||||
|
||||
|
||||
// Correct an improperly decrypted CPlayerPedData::operator= that broke gang recruiting after activating replays
|
||||
// Only broken in the HOODLUM EXE and the compact EXE that carried over the bug
|
||||
// By Wesser
|
||||
{
|
||||
using namespace PlayerPedDataAssignment;
|
||||
|
||||
uintptr_t placeToPatch = ModCompat::Utils::GetFunctionAddrIfRerouted(0x45C4B0) + 0x5D;
|
||||
|
||||
// If we're overwriting actual meaningful instructions and not NOPs, use a different wrapper
|
||||
if (MemEquals(placeToPatch, { 0x90, 0x90, 0x90, 0x90, 0x90 }))
|
||||
{
|
||||
InjectHook(placeToPatch, AssignmentOp_Hoodlum, HookType::Call);
|
||||
}
|
||||
else
|
||||
{
|
||||
InjectHook(placeToPatch, AssignmentOp_Compact, HookType::Call);
|
||||
Nop(placeToPatch + 5, 3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if FULL_PRECISION_D3D
|
||||
// Test - full precision D3D device
|
||||
Patch<uint8_t>( 0x7F672B+1, *(uint8_t*)(0x7F672B+1) | D3DCREATE_FPU_PRESERVE );
|
||||
|
|
Loading…
Reference in a new issue