From 602ac27b38f98d4da1baa0dd871ed183a33ecec9 Mon Sep 17 00:00:00 2001 From: Echo J Date: Mon, 4 Nov 2024 17:14:10 +0200 Subject: [PATCH 1/5] SilentPatchIII: Fixup the MSVC inline assembly statements Some of them use the deference operator incorrectly (also clean them up in general) --- SilentPatchIII/SilentPatchIII.cpp | 121 +++++++++++++++--------------- 1 file changed, 61 insertions(+), 60 deletions(-) diff --git a/SilentPatchIII/SilentPatchIII.cpp b/SilentPatchIII/SilentPatchIII.cpp index e0c04e7..fbb25ac 100644 --- a/SilentPatchIII/SilentPatchIII.cpp +++ b/SilentPatchIII/SilentPatchIII.cpp @@ -194,37 +194,37 @@ void ResetMousePos() orgConstructRenderList(); } -void __declspec(naked) M16StatsFix() +__declspec(naked) void M16StatsFix() { _asm { - add eax, 34h - add ebx, 34h - mov ecx, [InstantHitsFiredByPlayer] - inc [ecx] - retn + add eax, 0x34 + add ebx, 0x34 + mov ecx, InstantHitsFiredByPlayer + inc dword ptr [ecx] + ret } } -void __declspec(naked) HeadlightsFix() +static const float fMinusOne = -1.0f; +__declspec(naked) void HeadlightsFix() { - static const float fMinusOne = -1.0f; _asm { - fld [esp+708h-690h] + fld dword ptr [esp+0x708-0x690] fcomp fMinusOne fnstsw ax and ah, 5 cmp ah, 1 jnz HeadlightsFix_DontLimit fld fMinusOne - fstp [esp+708h-690h] + fstp dword ptr [esp+0x708-0x690] -HeadlightsFix_DontLimit: - fld [esp+708h-690h] + HeadlightsFix_DontLimit: + fld dword ptr [esp+0x708-0x690] fabs fld st - jmp [HeadlightsFix_JumpBack] + jmp HeadlightsFix_JumpBack } } @@ -312,68 +312,68 @@ float FixedRefValue() return 1.0f; } -void __declspec(naked) SubtitlesShadowFix() +__declspec(naked) void SubtitlesShadowFix() { _asm { push eax call Recalculate - fadd [esp+50h+8] - fadd [fShadowYSize] + fadd dword ptr [esp+0x50+8] + fadd fShadowYSize jmp SubtitlesShadowFix_JumpBack } } -void __declspec(naked) III_SensResetFix() +__declspec(naked) void III_SensResetFix() { _asm { - mov ecx, 3A76h + mov ecx, 0x3A76 mov edi, ebp - fld dword ptr [ebp+194h] - fld dword ptr [ebp+198h] + fld dword ptr [ebp+0x194] + fld dword ptr [ebp+0x198] rep stosd - fstp dword ptr [ebp+198h] - fstp dword ptr [ebp+194h] - retn + fstp dword ptr [ebp+0x198] + fstp dword ptr [ebp+0x194] + ret } } static void* RadarBoundsCheckCoordBlip_JumpBack = AddressByVersion(0x4A55B8, 0x4A56A8, 0x4A5638); static void* RadarBoundsCheckCoordBlip_Count = AddressByVersion(0x4A55AF, 0x4A569F, 0x4A562F); -void __declspec(naked) RadarBoundsCheckCoordBlip() +__declspec(naked) void RadarBoundsCheckCoordBlip() { _asm { - mov edx, dword ptr [RadarBoundsCheckCoordBlip_Count] + mov edx, RadarBoundsCheckCoordBlip_Count cmp cl, byte ptr [edx] jnb OutOfBounds mov edx, ecx mov eax, [esp+4] jmp RadarBoundsCheckCoordBlip_JumpBack -OutOfBounds: + OutOfBounds: or eax, -1 fcompp - retn + ret } } static void* RadarBoundsCheckEntityBlip_JumpBack = AddressByVersion(0x4A565E, 0x4A574E, 0x4A56DE); -void __declspec(naked) RadarBoundsCheckEntityBlip() +__declspec(naked) void RadarBoundsCheckEntityBlip() { _asm { - mov edx, dword ptr [RadarBoundsCheckCoordBlip_Count] + mov edx, RadarBoundsCheckCoordBlip_Count cmp cl, byte ptr [edx] jnb OutOfBounds mov edx, ecx mov eax, [esp+4] jmp RadarBoundsCheckEntityBlip_JumpBack - OutOfBounds: + OutOfBounds: or eax, -1 - retn + ret } } @@ -411,11 +411,12 @@ unsigned int __cdecl AutoPilotTimerCalculation_III(unsigned int nTimer, int nSca return nTimer - static_cast(nScaleFactor * fScaleCoef); } -void __declspec(naked) AutoPilotTimerFix_III() +__declspec(naked) void AutoPilotTimerFix_III() { - _asm { - push dword ptr[esp + 0x4] - push dword ptr[ebx + 0x10] + _asm + { + push dword ptr [esp + 0x4] + push dword ptr [ebx + 0x10] push eax call AutoPilotTimerCalculation_III add esp, 0xC @@ -424,7 +425,7 @@ void __declspec(naked) AutoPilotTimerFix_III() pop ebp pop esi pop ebx - retn 4 + ret 4 } } @@ -576,22 +577,22 @@ namespace SirenSwitchingFix // ============= Fixed vehicles exploding twice if the driver leaves the car while it's exploding ============= namespace RemoveDriverStatusFix { - __declspec(naked) void RemoveDriver_SetStatus() + __declspec(naked) static void RemoveDriver_SetStatus() { // if (m_nStatus != STATUS_WRECKED) // m_nStatus = STATUS_ABANDONED; _asm { - mov ah, [ecx+50h] + mov ah, [ecx+0x50] mov al, ah - and ah, 0F8h - cmp ah, 28h + and ah, 0xF8 + cmp ah, 0x28 je DontSetStatus and al, 7 - or al, 20h + or al, 0x20 DontSetStatus: - retn + ret } } } @@ -623,17 +624,17 @@ namespace EvasiveDiveFix return CGeneral::LimitRadianAngle(angle); } - __declspec(naked) void CalculateAngle_Hook() + __declspec(naked) static void CalculateAngle_Hook() { _asm { - push dword ptr [esi+7Ch] - push dword ptr [esi+78h] + push dword ptr [esi+0x7C] + push dword ptr [esi+0x78] call CalculateAngle add esp, 8 mov ecx, ebp - retn + ret } } } @@ -651,7 +652,7 @@ namespace NullTerminatedLines { mov eax, [esp+4] mov byte ptr [eax+ecx], 0 - jmp [orgSscanf_LoadPath] + jmp orgSscanf_LoadPath } } @@ -662,7 +663,7 @@ namespace NullTerminatedLines { mov eax, [esp+4] mov byte ptr [eax+ecx], 0 - jmp [orgSscanf1] + jmp orgSscanf1 } } @@ -670,12 +671,12 @@ namespace NullTerminatedLines { _asm { - mov ecx, [gString] + mov ecx, gString mov byte ptr [ecx+edx], 0 mov ecx, [esi] inc ebp - add ecx, [esp+0ACh-98h] - retn + add ecx, [esp+0xAC-0x98] + ret } } } @@ -705,14 +706,14 @@ namespace DodoKeyboardControls { _asm { - call [orgFindPlayerVehicle] - mov ecx, [bAllDodosCheat] + call orgFindPlayerVehicle + mov ecx, bAllDodosCheat cmp byte ptr [ecx], 0 je CheatDisabled - mov byte ptr [esp+1Ch-14h], 1 + mov byte ptr [esp+0x1C-0x14], 1 CheatDisabled: - retn + ret } } } @@ -768,11 +769,11 @@ namespace GenerateNewPickup_ReuseObjectFix static void* pPickupObject; static void (*orgGiveUsAPickUpObject)(int); - __declspec(naked) void GiveUsAPickUpObject_CleanUpObject() + __declspec(naked) static void GiveUsAPickUpObject_CleanUpObject() { _asm { - mov eax, [pPickupObject] + mov eax, pPickupObject add eax, ebp mov eax, [eax] test eax, eax @@ -781,7 +782,7 @@ namespace GenerateNewPickup_ReuseObjectFix mov edi, eax push edi - call [WorldRemove] + call WorldRemove add esp, 4 // Call dtor @@ -793,7 +794,7 @@ namespace GenerateNewPickup_ReuseObjectFix pop edi NoPickup: - jmp [orgGiveUsAPickUpObject] + jmp orgGiveUsAPickUpObject } } } @@ -2499,4 +2500,4 @@ extern "C" __declspec(dllexport) uint32_t GetBuildNumber() { return (SILENTPATCH_REVISION_ID << 8) | SILENTPATCH_BUILD_ID; -} \ No newline at end of file +} From d0c35bd8528cf4c30dd8a7390e0504b9bfbe2b15 Mon Sep 17 00:00:00 2001 From: Echo J Date: Thu, 7 Nov 2024 10:11:20 +0200 Subject: [PATCH 2/5] SilentPatchVC: Fixup the MSVC inline assembly statements Also clean them up in general --- SilentPatchVC/SilentPatchVC.cpp | 77 +++++++++++++++++---------------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/SilentPatchVC/SilentPatchVC.cpp b/SilentPatchVC/SilentPatchVC.cpp index 1da4a66..c7ba296 100644 --- a/SilentPatchVC/SilentPatchVC.cpp +++ b/SilentPatchVC/SilentPatchVC.cpp @@ -669,12 +669,12 @@ float FixedRefValue() return 1.0f; } -void __declspec(naked) SubtitlesShadowFix() +__declspec(naked) void SubtitlesShadowFix() { _asm { mov [esp], eax - fild [esp] + fild dword ptr [esp] push eax lea eax, [esp+20h-18h] push eax @@ -685,14 +685,14 @@ void __declspec(naked) SubtitlesShadowFix() } } -void __declspec(naked) CreateInstance_BikeFix() +__declspec(naked) void CreateInstance_BikeFix() { _asm { push eax mov ecx, ebp call CVehicleModelInfo::GetExtrasFrame - retn + ret } } @@ -731,11 +731,12 @@ unsigned int __cdecl AutoPilotTimerCalculation_VC(unsigned int nTimer, int nScal return nTimer - static_cast(nScaleFactor * fScaleCoef); } -void __declspec(naked) AutoPilotTimerFix_VC() +__declspec(naked) void AutoPilotTimerFix_VC() { - _asm { - push dword ptr[esp + 0xC] - push dword ptr[ebx + 0x10] + _asm + { + push dword ptr [esp + 0xC] + push dword ptr [ebx + 0x10] push eax call AutoPilotTimerCalculation_VC add esp, 0xC @@ -743,7 +744,7 @@ void __declspec(naked) AutoPilotTimerFix_VC() add esp, 0x30 pop ebp pop ebx - retn 4 + ret 4 } } @@ -863,23 +864,23 @@ namespace Localization // ============= Corrected FBI Washington sirens sound ============= namespace SirenSwitchingFix { - void __declspec(naked) IsFBIRanchOrFBICar() + __declspec(naked) static void IsFBIRanchOrFBICar() { _asm { - mov dword ptr [esi+1Ch], 1Ch + mov dword ptr [esi+0x1C], 0x1C // al = 0 - high pitched siren // al = 1 - normal siren - cmp dword ptr [ebp+14h], 90 // fbiranch + cmp dword ptr [ebp+0x14], 90 // fbiranch je IsFBIRanchOrFBICar_HighPitchSiren - cmp dword ptr [ebp+14h], 17 // fbicar + cmp dword ptr [ebp+0x14], 17 // fbicar setne al - retn + ret IsFBIRanchOrFBICar_HighPitchSiren: xor al, al - retn + ret } } } @@ -945,22 +946,22 @@ namespace FBISirenCoronaFix // ============= Fixed vehicles exploding twice if the driver leaves the car while it's exploding ============= namespace RemoveDriverStatusFix { - __declspec(naked) void RemoveDriver_SetStatus() + __declspec(naked) static void RemoveDriver_SetStatus() { // if (m_nStatus != STATUS_WRECKED) // m_nStatus = STATUS_ABANDONED; _asm { - mov cl, [ebx+50h] + mov cl, [ebx+0x50] mov al, cl - and cl, 0F8h - cmp cl, 28h + and cl, 0xF8 + cmp cl, 0x28 je DontSetStatus and al, 7 - or al, 20h + or al, 0x20 DontSetStatus: - retn + ret } } } @@ -1038,7 +1039,7 @@ namespace NullTerminatedLines { mov eax, [esp+4] mov byte ptr [eax+ecx], 0 - jmp [orgSscanf_LoadPath] + jmp orgSscanf_LoadPath } } } @@ -1066,9 +1067,9 @@ namespace PickupEffectsFixes { _asm { - mov byte ptr [esp+184h-170h], 0 - mov dword ptr [esp+184h-174h], 37 - retn + mov byte ptr [esp+0x184-0x170], 0 + mov dword ptr [esp+0x184-0x174], 37 + ret } } @@ -1078,7 +1079,7 @@ namespace PickupEffectsFixes { cmp ecx, 294 // minigun2 jnz NotMinigun2 - mov byte ptr [esp+184h-170h], 0 + mov byte ptr [esp+0x184-0x170], 0 xor eax, eax jmp Return @@ -1087,7 +1088,7 @@ namespace PickupEffectsFixes Return: mov ebx, ecx - retn + ret } } } @@ -1109,21 +1110,21 @@ namespace IsPlayerTargettingCharFix { test bl, bl jnz ReturnToUpdateCompareFlag - mov eax, [bUseMouse3rdPerson] + mov eax, bUseMouse3rdPerson cmp byte ptr [eax], 0 jne CmpAndReturn - mov ecx, [TheCamera] - call [Using1stPersonWeaponMode] + mov ecx, TheCamera + call Using1stPersonWeaponMode test al, al jz ReturnToUpdateCompareFlag CmpAndReturn: - cmp byte ptr [esp+11Ch-10Ch], 0 - retn + cmp byte ptr [esp+0x11C-0x10C], 0 + ret ReturnToUpdateCompareFlag: xor al, al - retn + ret } } } @@ -1214,8 +1215,8 @@ namespace SelectableBackfaceCulling { push ebx mov ebx, ecx - cmp dword ptr [ebx+4Ch], 0 - jmp [EntityRender_Prologue_JumpBack] + cmp dword ptr [ebx+0x4C], 0 + jmp EntityRender_Prologue_JumpBack } } @@ -1390,7 +1391,7 @@ namespace TommyFistShakeWithWeapons return !bWeaponAllowsFistShake; } - static __declspec(naked) void CheckWeaponGroupHook() + __declspec(naked) static void CheckWeaponGroupHook() { _asm { @@ -1398,7 +1399,7 @@ namespace TommyFistShakeWithWeapons call WeaponProhibitsFistShake add esp, 4 test al, al - retn + ret } } @@ -2982,4 +2983,4 @@ extern "C" __declspec(dllexport) uint32_t GetBuildNumber() { return (SILENTPATCH_REVISION_ID << 8) | SILENTPATCH_BUILD_ID; -} \ No newline at end of file +} From 65925ef8e8ab6ec34d6fc6ea1cde4b8c37a7fe1d Mon Sep 17 00:00:00 2001 From: Echo J Date: Fri, 8 Nov 2024 01:02:29 +0200 Subject: [PATCH 3/5] SilentPatchSA: Fixup the MSVC inline assembly statements (part 1) Also clean them up in general --- SilentPatchSA/SilentPatchSA.cpp | 186 ++++++++++++++++---------------- 1 file changed, 93 insertions(+), 93 deletions(-) diff --git a/SilentPatchSA/SilentPatchSA.cpp b/SilentPatchSA/SilentPatchSA.cpp index d9857f3..4482618 100644 --- a/SilentPatchSA/SilentPatchSA.cpp +++ b/SilentPatchSA/SilentPatchSA.cpp @@ -1602,9 +1602,9 @@ namespace FirelaHook static uintptr_t UpdateMovingCollisionJmp; static uintptr_t HydraulicControlJmpBack; - void __declspec(naked) TestFirelaAndFlags() + __declspec(naked) static void TestFirelaAndFlags() { - __asm + _asm { push ecx // Required in 0x6B1FE4: test cl, cl mov ecx, esi @@ -1613,29 +1613,29 @@ namespace FirelaHook test al, al jnz TestFirelaAndFlags_UpdateMovingCollision test [esi].hFlagsLocal, FLAG_HYDRAULICS_INSTALLED - jmp [HydraulicControlJmpBack] + jmp HydraulicControlJmpBack -TestFirelaAndFlags_UpdateMovingCollision: - jmp [UpdateMovingCollisionJmp] + TestFirelaAndFlags_UpdateMovingCollision: + jmp UpdateMovingCollisionJmp } } static uintptr_t FollowCarCamNoMovement; static uintptr_t FollowCarCamJmpBack; - void __declspec(naked) CamControlFirela() + __declspec(naked) static void CamControlFirela() { - __asm + _asm { mov ecx, edi call CVehicle::HasFirelaLadder test al, al jnz TestFirelaAndFlags_UpdateMovingCollision mov eax, [edi].m_dwVehicleClass - jmp [FollowCarCamJmpBack] + jmp FollowCarCamJmpBack - TestFirelaAndFlags_UpdateMovingCollision: - jmp [FollowCarCamNoMovement] + TestFirelaAndFlags_UpdateMovingCollision: + jmp FollowCarCamNoMovement } } } @@ -1857,25 +1857,25 @@ namespace TrueInvincibility static bool isEnabled = false; static uintptr_t WillKillJumpBack; - void __declspec(naked) ComputeWillKillPedHook() + __declspec(naked) static void ComputeWillKillPedHook() { _asm { - cmp dword ptr [ebp+0Ch], WEAPONTYPE_LAST_WEAPONTYPE + cmp dword ptr [ebp+0xC], WEAPONTYPE_LAST_WEAPONTYPE jl ComputeWillKillPedHook_DoNotKill - cmp [isEnabled], 0 + cmp isEnabled, 0 je ComputeWillKillPedHook_Kill - cmp dword ptr [ebp+0Ch], WEAPONTYPE_UZI_DRIVEBY + cmp dword ptr [ebp+0xC], WEAPONTYPE_UZI_DRIVEBY jne ComputeWillKillPedHook_Kill ComputeWillKillPedHook_DoNotKill: pop esi pop ebp pop ebx - retn 0Ch + ret 0xC ComputeWillKillPedHook_Kill: - jmp [WillKillJumpBack] + jmp WillKillJumpBack } } } @@ -2035,66 +2035,66 @@ namespace QuadbikeHandlebarAnims { static const float POW_CONSTANT = 0.86f; static const float SLOW_SPEED_THRESHOLD = 0.02f; - __declspec(naked) void ProcessRiderAnims_FixInterp() + __declspec(naked) static void ProcessRiderAnims_FixInterp() { _asm { xor edx, edx - cmp [esp+130h-100h], edx // Reverse animation + cmp [esp+0x130-0x100], edx // Reverse animation jne FuncSetToZero - cmp [esp+130h-0F8h], edx // Drive-by animation + cmp [esp+0x130-0xF8], edx // Drive-by animation jne FuncSetToZero - fld dword ptr [esp+130h-108h] + fld dword ptr [esp+0x130-0x108] fabs - fcomp [SLOW_SPEED_THRESHOLD] + fcomp SLOW_SPEED_THRESHOLD fnstsw ax test ah, 5 jp FuncReturn FuncSetToZero: - mov [esp+130h-118h], edx + mov [esp+0x130-0x118], edx FuncReturn: - fld [POW_CONSTANT] - retn + fld POW_CONSTANT + ret } } static uint32_t savedClumpAssociation; - __declspec(naked) void SaveDriveByAnim_Steam() + __declspec(naked) static void SaveDriveByAnim_Steam() { _asm { - mov eax, [ebp-14h] - mov [savedClumpAssociation], eax - fdiv dword ptr [ecx+18h] - fstp [ebp-14h] - retn + mov eax, [ebp-0x14] + mov savedClumpAssociation, eax + fdiv dword ptr [ecx+0x18] + fstp dword ptr [ebp-0x14] + ret } } - __declspec(naked) void ProcessRiderAnims_FixInterp_Steam() + __declspec(naked) static void ProcessRiderAnims_FixInterp_Steam() { _asm { xor edx, edx - cmp [ebp-28h], edx // Reverse animation + cmp [ebp-0x28], edx // Reverse animation jne FuncSetToZero - cmp [savedClumpAssociation], edx // Drive-by animation + cmp savedClumpAssociation, edx // Drive-by animation jne FuncSetToZero - fld dword ptr [ebp-24h] + fld dword ptr [ebp-0x24] fabs - fcomp [SLOW_SPEED_THRESHOLD] + fcomp SLOW_SPEED_THRESHOLD fnstsw ax test ah, 5 jp FuncReturn FuncSetToZero: - mov [ebp-14h], edx + mov [ebp-0x14], edx FuncReturn: fld [POW_CONSTANT] - retn + ret } } @@ -2119,31 +2119,31 @@ namespace UprightBoatRadioStationChange // ============= Fix a memory leak when taking photos ============= namespace CameraMemoryLeakFix { - __declspec(naked) void psGrabScreen_UnlockAndReleaseSurface() + __declspec(naked) static void psGrabScreen_UnlockAndReleaseSurface() { _asm { // Preserve the function result so we don't need two ASM hooks push eax - mov eax, [esp+34h-2Ch] + mov eax, [esp+0x34-0x2C] mov edx, [eax] push eax - call dword ptr [edx+38h] // IDirect3DSurface9.UnlockRect + call dword ptr [edx+0x38] // IDirect3DSurface9.UnlockRect - mov eax, [esp+34h-2Ch] + mov eax, [esp+0x34-0x2C] mov edx, [eax] push eax - call dword ptr [edx+8h] // IDirect3DSurface9.Release + call dword ptr [edx+0x8] // IDirect3DSurface9.Release pop eax pop ebp - add esp, 2Ch + add esp, 0x2C retn } } - __declspec(naked) void psGrabScreen_UnlockAndReleaseSurface_Steam() + __declspec(naked) static void psGrabScreen_UnlockAndReleaseSurface_Steam() { _asm { @@ -2153,18 +2153,18 @@ namespace CameraMemoryLeakFix mov eax, [ebp-4] mov edx, [eax] push eax - call dword ptr [edx+38h] // IDirect3DSurface9.UnlockRect + call dword ptr [edx+0x38] // IDirect3DSurface9.UnlockRect mov eax, [ebp-4] mov edx, [eax] push eax - call dword ptr [edx+8h] // IDirect3DSurface9.Release + call dword ptr [edx+0x8] // IDirect3DSurface9.Release pop eax pop esi mov esp, ebp pop ebp - retn + ret } } } @@ -2231,67 +2231,67 @@ namespace RacingCheckpointsRender // ============= Correct an improperly decrypted CPlayerPedData::operator= that broke gang recruiting after activating replays ============= namespace PlayerPedDataAssignment { - __declspec(naked) void AssignmentOp_Hoodlum() + __declspec(naked) static void AssignmentOp_Hoodlum() { _asm { - xor edx, [ecx+34h] + xor edx, [ecx+0x34] and edx, 1 - xor [eax+34h], edx - mov esi, [eax+34h] - mov edx, [ecx+34h] + xor [eax+0x34], edx + mov esi, [eax+0x34] + mov edx, [ecx+0x34] xor edx, esi and edx, 2 xor edx, esi - mov [eax+34h], edx - mov esi, [ecx+34h] + mov [eax+0x34], edx + mov esi, [ecx+0x34] xor esi, edx and esi, 4 xor esi, edx - mov [eax+34h], esi - mov edx, [ecx+34h] + mov [eax+0x34], esi + mov edx, [ecx+0x34] xor edx, esi and edx, 8 xor edx, esi - mov [eax+34h], edx - mov esi, [ecx+34h] + mov [eax+0x34], edx + mov esi, [ecx+0x34] xor esi, edx - and esi, 10h + and esi, 0x10 xor esi, edx - mov [eax+34h], esi - mov edx, [ecx+34h] + mov [eax+0x34], esi + mov edx, [ecx+0x34] xor edx, esi - and edx, 20h + and edx, 0x20 xor edx, esi - mov [eax+34h], edx - mov esi, [ecx+34h] + mov [eax+0x34], edx + mov esi, [ecx+0x34] xor esi, edx - and esi, 40h + and esi, 0x40 xor esi, edx - mov [eax+34h], esi - mov edx, [ecx+34h] + mov [eax+0x34], esi + mov edx, [ecx+0x34] xor edx, esi - and edx, 80h + and edx, 0x80 xor edx, esi - mov [eax+34h], edx - mov esi, [ecx+34h] + mov [eax+0x34], edx + mov esi, [ecx+0x34] xor esi, edx - and esi, 100h + and esi, 0x100 xor esi, edx - mov [eax+34h], esi - mov edx, [ecx+34h] - retn + mov [eax+0x34], esi + mov edx, [ecx+0x34] + ret } } - __declspec(naked) void AssignmentOp_Compact() + __declspec(naked) static void AssignmentOp_Compact() { _asm { call AssignmentOp_Hoodlum xor edx, esi - and edx, 200h - retn + and edx, 0x200 + ret } } } @@ -2300,7 +2300,7 @@ namespace PlayerPedDataAssignment // ============= Spawn lapdm1 (biker cop) correctly if the script requests one with PEDTYPE_COP ============= namespace GetCorrectPedModel_Lapdm1 { - __declspec(naked) void BikerCop_Retail() + __declspec(naked) static void BikerCop_Retail() { _asm { @@ -2309,11 +2309,11 @@ namespace GetCorrectPedModel_Lapdm1 mov dword ptr [eax], 1 BikerCop_Return: - retn 8 + ret 8 } } - __declspec(naked) void BikerCop_Steam() + __declspec(naked) static void BikerCop_Steam() { _asm { @@ -2323,7 +2323,7 @@ namespace GetCorrectPedModel_Lapdm1 BikerCop_Return: pop ebp - retn 8 + ret 8 } } } @@ -2444,7 +2444,7 @@ namespace JetpackKeyboardControlsHover static void* ProcessControlInput_DontHover; static void* ProcessControlInput_Hover; - __declspec(naked) void ProcessControlInput_HoverWithKeyboard() + __declspec(naked) static void ProcessControlInput_HoverWithKeyboard() { _asm { @@ -2453,7 +2453,7 @@ namespace JetpackKeyboardControlsHover test al, al jnz Hovering mov ecx, ebp - mov byte ptr [esi+0Dh], 0 + mov byte ptr [esi+0xD], 0 jmp ProcessControlInput_DontHover Hovering: @@ -2461,7 +2461,7 @@ namespace JetpackKeyboardControlsHover } } - __declspec(naked) void ProcessControlInput_HoverWithKeyboard_Steam() + __declspec(naked) static void ProcessControlInput_HoverWithKeyboard_Steam() { _asm { @@ -2470,10 +2470,10 @@ namespace JetpackKeyboardControlsHover test al, al jnz Hovering mov ecx, ebx - mov byte ptr [edi+0Dh], 0 + mov byte ptr [edi+0xD], 0 jmp ProcessControlInput_DontHover - Hovering: + Hovering: jmp ProcessControlInput_Hover } } @@ -2487,11 +2487,11 @@ namespace RiotDontTargetPlayerGroupDuringMissions static void* SkipTargetting; static void* DontSkipTargetting; - __declspec(naked) void CheckIfInPlayerGroupAndOnAMission() + __declspec(naked) static void CheckIfInPlayerGroupAndOnAMission() { _asm { - cmp byte ptr [ebp+2D0h], 1 + cmp byte ptr [ebp+0x2D0], 1 jne NotInGroup call IsPlayerOnAMission test al, al @@ -2499,18 +2499,18 @@ namespace RiotDontTargetPlayerGroupDuringMissions jmp SkipTargetting NotOnAMission: - cmp byte ptr [ebp+2D0h], 1 + cmp byte ptr [ebp+0x2D0], 1 NotInGroup: jmp DontSkipTargetting } } - __declspec(naked) void CheckIfInPlayerGroupAndOnAMission_Steam() + __declspec(naked) static void CheckIfInPlayerGroupAndOnAMission_Steam() { _asm { - cmp byte ptr [ebx+2D0h], 1 + cmp byte ptr [ebx+0x2D0], 1 jne NotInGroup call IsPlayerOnAMission test al, al @@ -2518,7 +2518,7 @@ namespace RiotDontTargetPlayerGroupDuringMissions jmp SkipTargetting NotOnAMission: - cmp byte ptr [ebx+2D0h], 1 + cmp byte ptr [ebx+0x2D0], 1 NotInGroup: jmp DontSkipTargetting @@ -8688,4 +8688,4 @@ extern "C" __declspec(dllexport) uint32_t GetBuildNumber() { return (SILENTPATCH_REVISION_ID << 8) | SILENTPATCH_BUILD_ID; -} \ No newline at end of file +} From 9b6e5096e7a492d5ca5394d8cb027da0135e8fd1 Mon Sep 17 00:00:00 2001 From: Echo J Date: Fri, 8 Nov 2024 01:08:28 +0200 Subject: [PATCH 4/5] SilentPatchSA: Fixup the MSVC inline assembly statements (part 2) Also clean them up in general --- SilentPatchSA/SilentPatchSA.cpp | 177 ++++++++++++++++---------------- 1 file changed, 88 insertions(+), 89 deletions(-) diff --git a/SilentPatchSA/SilentPatchSA.cpp b/SilentPatchSA/SilentPatchSA.cpp index 4482618..f218cc6 100644 --- a/SilentPatchSA/SilentPatchSA.cpp +++ b/SilentPatchSA/SilentPatchSA.cpp @@ -2530,22 +2530,22 @@ namespace RiotDontTargetPlayerGroupDuringMissions // ============= Fixed vehicles exploding twice if the driver leaves the car while it's exploding ============= namespace RemoveDriverStatusFix { - __declspec(naked) void RemoveDriver_SetStatus() + __declspec(naked) static void RemoveDriver_SetStatus() { // if (m_nStatus != STATUS_WRECKED) // m_nStatus = STATUS_ABANDONED; _asm { - mov bl, [edi+36h] + mov bl, [edi+0x36] mov al, bl - and bl, 0F8h - cmp bl, 28h + and bl, 0xF8 + cmp bl, 0x28 je DontSetStatus and al, 7 - or al, 20h + or al, 0x20 DontSetStatus: - retn + ret } } @@ -3028,35 +3028,35 @@ namespace CrosshairScalingFixes // Debugged by Wesser namespace MapScreenScalingFixes { - void __declspec(naked) ScaleX_NewBinaries() + __declspec(naked) void ScaleX_NewBinaries() { _asm { push ecx - push 3F800000h // 1.0f + push 0x3F800000 // 1.0f call [ScaleX] add esp, 4 fsub st(1), st fxch st(1) pop ecx - retn + ret } } - void __declspec(naked) ScaleY_NewBinaries() + __declspec(naked) void ScaleY_NewBinaries() { _asm { push ecx - push 3F800000h // 1.0f + push 0x3F800000 // 1.0f call [ScaleY] add esp, 4 fsub st(1), st fxch st(1) pop ecx - retn + ret } } @@ -3182,41 +3182,41 @@ namespace TextRectPaddingScalingFixes // By Wesser namespace NitrousReverseRechargeFix { - void __declspec(naked) NitrousControl_DontRechargeWhenReversing() + __declspec(naked) static void NitrousControl_DontRechargeWhenReversing() { // x = 1.0f; \ if m_fGasPedal >= 0.0f x -= m_fGasPedal; _asm { - fld [esi+49Ch] + fld dword ptr [esi+0x49C] fldz fcomp st(1) fnstsw ax - test ah, 41h + test ah, 0x41 jnz BiggerOrEqual fstp st - retn + ret BiggerOrEqual: fsubp st(1), st - retn + ret } } - void __declspec(naked) NitrousControl_DontRechargeWhenReversing_NewBinaries() + __declspec(naked) static void NitrousControl_DontRechargeWhenReversing_NewBinaries() { _asm { - fld [esi+49Ch] + fld dword ptr [esi+0x49C] fldz fcomp st(1) fnstsw ax - test ah, 41h + test ah, 0x41 jnz BiggerOrEqual fstp st fldz BiggerOrEqual: - retn + ret } } } @@ -3503,7 +3503,7 @@ void InstallMemValidator() // Hooks -void __declspec(naked) LightMaterialsFix() +__declspec(naked) void LightMaterialsFix() { _asm { @@ -3519,24 +3519,24 @@ void __declspec(naked) LightMaterialsFix() mov [ebx+16], edi add ebx, 20 mov [ecx], ebx - retn + ret } } -void __declspec(naked) UserTracksFix() +__declspec(naked) void UserTracksFix() { _asm { push [esp+4] call SetVolume mov ecx, [pUserTracksStuff] - mov byte ptr [ecx+0Dh], 1 + mov byte ptr [ecx+0xD], 1 call InitializeUtrax - retn 4 + ret 4 } } -void __declspec(naked) UserTracksFix_Steam() +__declspec(naked) void UserTracksFix_Steam() { _asm { @@ -3545,14 +3545,14 @@ void __declspec(naked) UserTracksFix_Steam() mov ecx, [pUserTracksStuff] mov byte ptr [ecx+5], 1 call InitializeUtrax - retn 4 + ret 4 } } static void* PlaneAtomicRendererSetup_JumpBack = AddressByVersion(0x4C7986, 0x4C7A06, 0x4D2275); static void* RenderVehicleHiDetailAlphaCB_BigVehicle = AddressByVersion(0x734370, 0x734BA0, 0x76E400); static void* RenderVehicleHiDetailCB_BigVehicle = AddressByVersion(0x733420, 0x733C50, 0x76D6C0); -void __declspec(naked) PlaneAtomicRendererSetup() +__declspec(naked) void PlaneAtomicRendererSetup() { static const char aStaticProp[] = "static_prop"; static const char aMovingProp[] = "moving_prop"; @@ -3561,31 +3561,30 @@ void __declspec(naked) PlaneAtomicRendererSetup() mov eax, [esi+4] push eax call GetFrameNodeName - //push eax mov [esp+8+8], eax push 11 push offset aStaticProp push eax call strncmp - add esp, 10h + add esp, 0x10 test eax, eax jz PlaneAtomicRendererSetup_Alpha push 11 push offset aMovingProp push [esp+12+8] call strncmp - add esp, 0Ch + add esp, 0xC test eax, eax jnz PlaneAtomicRendererSetup_NoAlpha -PlaneAtomicRendererSetup_Alpha: - push [RenderVehicleHiDetailAlphaCB_BigVehicle] + PlaneAtomicRendererSetup_Alpha: + push RenderVehicleHiDetailAlphaCB_BigVehicle jmp PlaneAtomicRendererSetup_Return -PlaneAtomicRendererSetup_NoAlpha: - push [RenderVehicleHiDetailCB_BigVehicle] + PlaneAtomicRendererSetup_NoAlpha: + push RenderVehicleHiDetailCB_BigVehicle -PlaneAtomicRendererSetup_Return: + PlaneAtomicRendererSetup_Return: jmp PlaneAtomicRendererSetup_JumpBack } } @@ -3604,7 +3603,7 @@ static int strcmp_wrap(const char *s1, const char *s2) return strcmp( s1, s2 ); } -void __declspec(naked) HunterTest() +__declspec(naked) void HunterTest() { static const char aDoorDummy[] = "door_lf_ok"; static const char aStaticRotor[] = "static_rotor"; @@ -3619,7 +3618,7 @@ void __declspec(naked) HunterTest() push offset aWindscreen push ebp call strncmp - add esp, 0Ch + add esp, 0xC test eax, eax jz HunterTest_RegularAlpha @@ -3640,10 +3639,10 @@ void __declspec(naked) HunterTest() test di, di jnz HunterTest_DoorTest - push [RenderVehicleHiDetailCB] + push RenderVehicleHiDetailCB jmp HunterTest_JumpBack -HunterTest_DoorTest: + HunterTest_DoorTest: cmp nCachedCRC, 0x45D0B41C jnz HunterTest_RegularAlpha push offset aDoorDummy @@ -3655,22 +3654,22 @@ HunterTest_DoorTest: push RenderVehicleHiDetailAlphaCB_HunterDoor jmp HunterTest_JumpBack -HunterTest_RegularAlpha: - push [RenderVehicleHiDetailAlphaCB] + HunterTest_RegularAlpha: + push RenderVehicleHiDetailAlphaCB jmp HunterTest_JumpBack -HunterTest_StaticRotorAlphaSet: - push [RenderHeliRotorAlphaCB] + HunterTest_StaticRotorAlphaSet: + push RenderHeliRotorAlphaCB jmp HunterTest_JumpBack -HunterTest_StaticRotor2AlphaSet: - push [RenderHeliTailRotorAlphaCB] + HunterTest_StaticRotor2AlphaSet: + push RenderHeliTailRotorAlphaCB jmp HunterTest_JumpBack } } static void* CacheCRC32_JumpBack = AddressByVersion(0x4C7B10, 0x4C7B90, 0x4D2400); -void __declspec(naked) CacheCRC32() +__declspec(naked) void CacheCRC32() { _asm { @@ -3682,7 +3681,7 @@ void __declspec(naked) CacheCRC32() static void* const TrailerDoubleRWheelsFix_ReturnFalse = AddressByVersion(0x4C9333, 0x4C9533, 0x4D3C59); static void* const TrailerDoubleRWheelsFix_ReturnTrue = AddressByVersion(0x4C9235, 0x4C9435, 0x4D3B59); -void __declspec(naked) TrailerDoubleRWheelsFix() +__declspec(naked) void TrailerDoubleRWheelsFix() { _asm { @@ -3693,26 +3692,26 @@ void __declspec(naked) TrailerDoubleRWheelsFix() cmp eax, 5 je TrailerDoubleRWheelsFix_False -TrailerDoubleRWheelsFix_DoWheels: + TrailerDoubleRWheelsFix_DoWheels: jmp TrailerDoubleRWheelsFix_ReturnTrue -TrailerDoubleRWheelsFix_False: + TrailerDoubleRWheelsFix_False: jmp TrailerDoubleRWheelsFix_ReturnFalse } } -void __declspec(naked) TrailerDoubleRWheelsFix2() +__declspec(naked) void TrailerDoubleRWheelsFix2() { _asm { - add esp, 18h + add esp, 0x18 mov eax, [ebx] mov eax, [esi+eax+4] jmp TrailerDoubleRWheelsFix } } -void __declspec(naked) TrailerDoubleRWheelsFix_Steam() +__declspec(naked) void TrailerDoubleRWheelsFix_Steam() { _asm { @@ -3731,11 +3730,11 @@ TrailerDoubleRWheelsFix_False: } } -void __declspec(naked) TrailerDoubleRWheelsFix2_Steam() +__declspec(naked) void TrailerDoubleRWheelsFix2_Steam() { _asm { - add esp, 18h + add esp, 0x18 mov eax, [ebp] mov eax, [ebx+eax+4] jmp TrailerDoubleRWheelsFix_Steam @@ -3743,7 +3742,7 @@ void __declspec(naked) TrailerDoubleRWheelsFix2_Steam() } static void* LoadFLAC_JumpBack = AddressByVersion(0x4F3743, Memory::GetVersion().version == 1 ? (*(BYTE*)0x4F3A50 == 0x6A ? 0x4F3BA3 : 0x5B6B81) : 0, 0x4FFC3F); -void __declspec(naked) LoadFLAC() +__declspec(naked) void LoadFLAC() { _asm { @@ -3754,36 +3753,36 @@ void __declspec(naked) LoadFLAC() call DecoderCtor jmp LoadFLAC_Success -LoadFLAC_WindowsMedia: + LoadFLAC_WindowsMedia: jmp LoadFLAC_JumpBack -LoadFLAC_Success: + LoadFLAC_Success: test eax, eax - mov [esp+20h+4], eax + mov [esp+0x20+4], eax jnz LoadFLAC_Return_NoDelete -LoadFLAC_Return: + LoadFLAC_Return: mov ecx, esi call CAEDataStreamOld::~CAEDataStreamOld push esi call GTAdelete add esp, 4 -LoadFLAC_Return_NoDelete: - mov eax, [esp+20h+4] - mov ecx, [esp+20h-0Ch] + LoadFLAC_Return_NoDelete: + mov eax, [esp+0x20+4] + mov ecx, [esp+0x20-0xC] pop esi pop ebp pop edi pop ebx mov fs:0, ecx - add esp, 10h - retn 4 + add esp, 0x10 + ret 4 } } // 1.01 securom butchered this func, might not be reliable -void __declspec(naked) LoadFLAC_11() +__declspec(naked) void LoadFLAC_11() { _asm { @@ -3794,36 +3793,36 @@ void __declspec(naked) LoadFLAC_11() call DecoderCtor jmp LoadFLAC_Success -LoadFLAC_WindowsMedia: + LoadFLAC_WindowsMedia: jmp LoadFLAC_JumpBack -LoadFLAC_Success: + LoadFLAC_Success: test eax, eax - mov [esp+20h+4], eax + mov [esp+0x20+4], eax jnz LoadFLAC_Return_NoDelete -LoadFLAC_Return: + LoadFLAC_Return: mov ecx, esi call CAEDataStreamNew::~CAEDataStreamNew push esi call GTAdelete add esp, 4 -LoadFLAC_Return_NoDelete: - mov eax, [esp+20h+4] - mov ecx, [esp+20h-0Ch] + LoadFLAC_Return_NoDelete: + mov eax, [esp+0x20+4] + mov ecx, [esp+0x20-0xC] pop esi pop ebp pop edi pop ebx mov fs:0, ecx - add esp, 10h - retn 4 + add esp, 0x10 + ret 4 } } -void __declspec(naked) LoadFLAC_Steam() +__declspec(naked) void LoadFLAC_Steam() { _asm { @@ -3834,44 +3833,44 @@ void __declspec(naked) LoadFLAC_Steam() call DecoderCtor jmp LoadFLAC_Success -LoadFLAC_WindowsMedia: + LoadFLAC_WindowsMedia: jmp LoadFLAC_JumpBack -LoadFLAC_Success: + LoadFLAC_Success: test eax, eax - mov [esp+20h+4], eax + mov [esp+0x20+4], eax jnz LoadFLAC_Return_NoDelete -LoadFLAC_Return: + LoadFLAC_Return: mov ecx, esi call CAEDataStreamOld::~CAEDataStreamOld push esi call GTAdelete add esp, 4 -LoadFLAC_Return_NoDelete: - mov eax, [esp+20h+4] - mov ecx, [esp+20h-0Ch] + LoadFLAC_Return_NoDelete: + mov eax, [esp+0x20+4] + mov ecx, [esp+0x20-0xC] pop ebx pop esi pop ebp pop edi mov fs:0, ecx - add esp, 10h - retn 4 + add esp, 0x10 + ret 4 } } -void __declspec(naked) FLACInit() +__declspec(naked) void FLACInit() { _asm { - mov byte ptr [ecx+0Dh], 1 + mov byte ptr [ecx+0xD], 1 jmp InitializeUtrax } } -void __declspec(naked) FLACInit_Steam() +__declspec(naked) void FLACInit_Steam() { _asm { From fdce60d22f186348f3f2cdd2d74879e723195929 Mon Sep 17 00:00:00 2001 From: Echo J Date: Fri, 8 Nov 2024 01:10:28 +0200 Subject: [PATCH 5/5] SilentPatchSA: Fixup the MSVC inline assembly statements (part 3) Also clean them up in general --- SilentPatchSA/SilentPatchSA.cpp | 110 ++++++++++++++++---------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/SilentPatchSA/SilentPatchSA.cpp b/SilentPatchSA/SilentPatchSA.cpp index f218cc6..96bc7dd 100644 --- a/SilentPatchSA/SilentPatchSA.cpp +++ b/SilentPatchSA/SilentPatchSA.cpp @@ -3885,30 +3885,30 @@ static bool bDarkVehicleThing; static RpLight** pDirect; static void* DarkVehiclesFix1_JumpBack; -void __declspec(naked) DarkVehiclesFix1() + __declspec(naked) void DarkVehiclesFix1() { _asm { - shr eax, 0Eh + shr eax, 0xE test al, 1 - jz DarkVehiclesFix1_DontAppply - mov ecx, [pDirect] + jz DarkVehiclesFix1_DontApply + mov ecx, pDirect mov ecx, [ecx] mov al, [ecx+2] test al, 1 - jnz DarkVehiclesFix1_DontAppply + jnz DarkVehiclesFix1_DontApply mov bDarkVehicleThing, 1 jmp DarkVehiclesFix1_Return -DarkVehiclesFix1_DontAppply: + DarkVehiclesFix1_DontApply: mov bDarkVehicleThing, 0 -DarkVehiclesFix1_Return: + DarkVehiclesFix1_Return: jmp DarkVehiclesFix1_JumpBack } } -void __declspec(naked) DarkVehiclesFix2() +__declspec(naked) void DarkVehiclesFix2() { _asm { @@ -3916,16 +3916,16 @@ void __declspec(naked) DarkVehiclesFix2() mov al, bDarkVehicleThing test al, al jnz DarkVehiclesFix2_MakeItDark - mov eax, 5D9A7Ah + mov eax, 0x5D9A7A jmp eax -DarkVehiclesFix2_MakeItDark: - mov eax, 5D9B09h + DarkVehiclesFix2_MakeItDark: + mov eax, 0x5D9B09 jmp eax } } -void __declspec(naked) DarkVehiclesFix3() +__declspec(naked) void DarkVehiclesFix3() { _asm { @@ -3933,16 +3933,16 @@ void __declspec(naked) DarkVehiclesFix3() mov al, bDarkVehicleThing test al, al jnz DarkVehiclesFix3_MakeItDark - mov eax, 5D9B4Ah + mov eax, 0x5D9B4A jmp eax -DarkVehiclesFix3_MakeItDark: - mov eax, 5D9CACh + DarkVehiclesFix3_MakeItDark: + mov eax, 0x5D9CAC jmp eax } } -void __declspec(naked) DarkVehiclesFix4() +__declspec(naked) void DarkVehiclesFix4() { _asm { @@ -3950,11 +3950,11 @@ void __declspec(naked) DarkVehiclesFix4() mov al, bDarkVehicleThing test al, al jnz DarkVehiclesFix4_MakeItDark - mov eax, 5D9CB8h + mov eax, 0x5D9CB8 jmp eax -DarkVehiclesFix4_MakeItDark: - mov eax, 5D9E0Dh + DarkVehiclesFix4_MakeItDark: + mov eax, 0x5D9E0D jmp eax } } @@ -3991,108 +3991,108 @@ int __stdcall Timers_ftol_SCMdelta( double timer ) return _Timers_ftol_internal( timer, TimersRemainder ); } -void __declspec(naked) asmTimers_ftol_PauseMode() +__declspec(naked) void asmTimers_ftol_PauseMode() { _asm { sub esp, 8 fstp qword ptr [esp] call Timers_ftol_PauseMode - retn + ret } } -void __declspec(naked) asmTimers_ftol_NonClipped() +__declspec(naked) void asmTimers_ftol_NonClipped() { _asm { sub esp, 8 fstp qword ptr [esp] call Timers_ftol_NonClipped - retn + ret } } -void __declspec(naked) asmTimers_ftol() +__declspec(naked) void asmTimers_ftol() { _asm { sub esp, 8 fstp qword ptr [esp] call Timers_ftol - retn + ret } } -void __declspec(naked) asmTimers_SCMdelta() +__declspec(naked) void asmTimers_SCMdelta() { _asm { sub esp, 8 fstp qword ptr [esp] call Timers_ftol_SCMdelta - retn + ret } } -void _declspec(naked) FixedCarDamage() +__declspec(naked) void FixedCarDamage() { _asm { fldz - fcomp [esp+20h+10h] + fcomp dword ptr [esp+0x20+0x10] fnstsw ax test ah, 5 jp FixedCarDamage_Negative - movzx eax, byte ptr [edi+21h] - retn + movzx eax, byte ptr [edi+0x21] + ret -FixedCarDamage_Negative: - movzx eax, byte ptr [edi+24h] - retn + FixedCarDamage_Negative: + movzx eax, byte ptr [edi+0x24] + ret } } -void _declspec(naked) FixedCarDamage_Steam() +__declspec(naked) void FixedCarDamage_Steam() { _asm { fldz - fcomp [esp+20h+10h] + fcomp dword ptr [esp+0x20+0x10] fnstsw ax test ah, 5 jp FixedCarDamage_Negative - movzx eax, byte ptr [edi+21h] + movzx eax, byte ptr [edi+0x21] test ecx, ecx - retn + ret -FixedCarDamage_Negative: - movzx eax, byte ptr [edi+24h] + FixedCarDamage_Negative: + movzx eax, byte ptr [edi+0x24] test ecx, ecx - retn + ret } } -void _declspec(naked) FixedCarDamage_Newsteam() +__declspec(naked) void FixedCarDamage_Newsteam() { _asm { - mov edi, [ebp+10h] + mov edi, [ebp+0x10] fldz - fcomp [ebp+14h] + fcomp [ebp+0x14] fnstsw ax test ah, 5 jp FixedCarDamage_Negative - movzx eax, byte ptr [edi+21h] - retn + movzx eax, byte ptr [edi+0x21] + ret -FixedCarDamage_Negative: - movzx eax, byte ptr [edi+24h] - retn + FixedCarDamage_Negative: + movzx eax, byte ptr [edi+0x24] + ret } } -void __declspec(naked) CdStreamThreadHighSize() +__declspec(naked) void CdStreamThreadHighSize() { _asm { @@ -4103,11 +4103,11 @@ void __declspec(naked) CdStreamThreadHighSize() mov [esi]CdStream.overlapped.OffsetHigh, edx // OVERLAPPED.OffsetHigh mov edx, [esi]CdStream.nSectorsToRead - retn + ret } } -void __declspec(naked) WeaponRangeMult_VehicleCheck() +__declspec(naked) void WeaponRangeMult_VehicleCheck() { _asm { @@ -4115,11 +4115,11 @@ void __declspec(naked) WeaponRangeMult_VehicleCheck() test ah, 1 jz WeaponRangeMult_VehicleCheck_NotInCar mov eax, [edx]CPed.pVehicle - retn + ret -WeaponRangeMult_VehicleCheck_NotInCar: + WeaponRangeMult_VehicleCheck_NotInCar: xor eax, eax - retn + ret } }