mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-25 06:42:29 +01:00
SilentPatchSA: Fixup the MSVC inline assembly statements (part 3)
Also clean them up in general
This commit is contained in:
parent
5738eb5d75
commit
d191bdf3b4
@ -3885,30 +3885,30 @@ static bool bDarkVehicleThing;
|
|||||||
static RpLight** pDirect;
|
static RpLight** pDirect;
|
||||||
|
|
||||||
static void* DarkVehiclesFix1_JumpBack;
|
static void* DarkVehiclesFix1_JumpBack;
|
||||||
void __declspec(naked) DarkVehiclesFix1()
|
__declspec(naked) void DarkVehiclesFix1()
|
||||||
{
|
{
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
shr eax, 0Eh
|
shr eax, 0xE
|
||||||
test al, 1
|
test al, 1
|
||||||
jz DarkVehiclesFix1_DontAppply
|
jz DarkVehiclesFix1_DontApply
|
||||||
mov ecx, [pDirect]
|
mov ecx, pDirect
|
||||||
mov ecx, [ecx]
|
mov ecx, [ecx]
|
||||||
mov al, [ecx+2]
|
mov al, [ecx+2]
|
||||||
test al, 1
|
test al, 1
|
||||||
jnz DarkVehiclesFix1_DontAppply
|
jnz DarkVehiclesFix1_DontApply
|
||||||
mov bDarkVehicleThing, 1
|
mov bDarkVehicleThing, 1
|
||||||
jmp DarkVehiclesFix1_Return
|
jmp DarkVehiclesFix1_Return
|
||||||
|
|
||||||
DarkVehiclesFix1_DontAppply:
|
DarkVehiclesFix1_DontApply:
|
||||||
mov bDarkVehicleThing, 0
|
mov bDarkVehicleThing, 0
|
||||||
|
|
||||||
DarkVehiclesFix1_Return:
|
DarkVehiclesFix1_Return:
|
||||||
jmp DarkVehiclesFix1_JumpBack
|
jmp DarkVehiclesFix1_JumpBack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __declspec(naked) DarkVehiclesFix2()
|
__declspec(naked) void DarkVehiclesFix2()
|
||||||
{
|
{
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
@ -3916,16 +3916,16 @@ void __declspec(naked) DarkVehiclesFix2()
|
|||||||
mov al, bDarkVehicleThing
|
mov al, bDarkVehicleThing
|
||||||
test al, al
|
test al, al
|
||||||
jnz DarkVehiclesFix2_MakeItDark
|
jnz DarkVehiclesFix2_MakeItDark
|
||||||
mov eax, 5D9A7Ah
|
mov eax, 0x5D9A7A
|
||||||
jmp eax
|
jmp eax
|
||||||
|
|
||||||
DarkVehiclesFix2_MakeItDark:
|
DarkVehiclesFix2_MakeItDark:
|
||||||
mov eax, 5D9B09h
|
mov eax, 0x5D9B09
|
||||||
jmp eax
|
jmp eax
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __declspec(naked) DarkVehiclesFix3()
|
__declspec(naked) void DarkVehiclesFix3()
|
||||||
{
|
{
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
@ -3933,16 +3933,16 @@ void __declspec(naked) DarkVehiclesFix3()
|
|||||||
mov al, bDarkVehicleThing
|
mov al, bDarkVehicleThing
|
||||||
test al, al
|
test al, al
|
||||||
jnz DarkVehiclesFix3_MakeItDark
|
jnz DarkVehiclesFix3_MakeItDark
|
||||||
mov eax, 5D9B4Ah
|
mov eax, 0x5D9B4A
|
||||||
jmp eax
|
jmp eax
|
||||||
|
|
||||||
DarkVehiclesFix3_MakeItDark:
|
DarkVehiclesFix3_MakeItDark:
|
||||||
mov eax, 5D9CACh
|
mov eax, 0x5D9CAC
|
||||||
jmp eax
|
jmp eax
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __declspec(naked) DarkVehiclesFix4()
|
__declspec(naked) void DarkVehiclesFix4()
|
||||||
{
|
{
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
@ -3950,11 +3950,11 @@ void __declspec(naked) DarkVehiclesFix4()
|
|||||||
mov al, bDarkVehicleThing
|
mov al, bDarkVehicleThing
|
||||||
test al, al
|
test al, al
|
||||||
jnz DarkVehiclesFix4_MakeItDark
|
jnz DarkVehiclesFix4_MakeItDark
|
||||||
mov eax, 5D9CB8h
|
mov eax, 0x5D9CB8
|
||||||
jmp eax
|
jmp eax
|
||||||
|
|
||||||
DarkVehiclesFix4_MakeItDark:
|
DarkVehiclesFix4_MakeItDark:
|
||||||
mov eax, 5D9E0Dh
|
mov eax, 0x5D9E0D
|
||||||
jmp eax
|
jmp eax
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3991,108 +3991,108 @@ int __stdcall Timers_ftol_SCMdelta( double timer )
|
|||||||
return _Timers_ftol_internal( timer, TimersRemainder );
|
return _Timers_ftol_internal( timer, TimersRemainder );
|
||||||
}
|
}
|
||||||
|
|
||||||
void __declspec(naked) asmTimers_ftol_PauseMode()
|
__declspec(naked) void asmTimers_ftol_PauseMode()
|
||||||
{
|
{
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
sub esp, 8
|
sub esp, 8
|
||||||
fstp qword ptr [esp]
|
fstp qword ptr [esp]
|
||||||
call Timers_ftol_PauseMode
|
call Timers_ftol_PauseMode
|
||||||
retn
|
ret
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __declspec(naked) asmTimers_ftol_NonClipped()
|
__declspec(naked) void asmTimers_ftol_NonClipped()
|
||||||
{
|
{
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
sub esp, 8
|
sub esp, 8
|
||||||
fstp qword ptr [esp]
|
fstp qword ptr [esp]
|
||||||
call Timers_ftol_NonClipped
|
call Timers_ftol_NonClipped
|
||||||
retn
|
ret
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __declspec(naked) asmTimers_ftol()
|
__declspec(naked) void asmTimers_ftol()
|
||||||
{
|
{
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
sub esp, 8
|
sub esp, 8
|
||||||
fstp qword ptr [esp]
|
fstp qword ptr [esp]
|
||||||
call Timers_ftol
|
call Timers_ftol
|
||||||
retn
|
ret
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __declspec(naked) asmTimers_SCMdelta()
|
__declspec(naked) void asmTimers_SCMdelta()
|
||||||
{
|
{
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
sub esp, 8
|
sub esp, 8
|
||||||
fstp qword ptr [esp]
|
fstp qword ptr [esp]
|
||||||
call Timers_ftol_SCMdelta
|
call Timers_ftol_SCMdelta
|
||||||
retn
|
ret
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _declspec(naked) FixedCarDamage()
|
__declspec(naked) void FixedCarDamage()
|
||||||
{
|
{
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
fldz
|
fldz
|
||||||
fcomp [esp+20h+10h]
|
fcomp dword ptr [esp+0x20+0x10]
|
||||||
fnstsw ax
|
fnstsw ax
|
||||||
test ah, 5
|
test ah, 5
|
||||||
jp FixedCarDamage_Negative
|
jp FixedCarDamage_Negative
|
||||||
movzx eax, byte ptr [edi+21h]
|
movzx eax, byte ptr [edi+0x21]
|
||||||
retn
|
ret
|
||||||
|
|
||||||
FixedCarDamage_Negative:
|
FixedCarDamage_Negative:
|
||||||
movzx eax, byte ptr [edi+24h]
|
movzx eax, byte ptr [edi+0x24]
|
||||||
retn
|
ret
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _declspec(naked) FixedCarDamage_Steam()
|
__declspec(naked) void FixedCarDamage_Steam()
|
||||||
{
|
{
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
fldz
|
fldz
|
||||||
fcomp [esp+20h+10h]
|
fcomp dword ptr [esp+0x20+0x10]
|
||||||
fnstsw ax
|
fnstsw ax
|
||||||
test ah, 5
|
test ah, 5
|
||||||
jp FixedCarDamage_Negative
|
jp FixedCarDamage_Negative
|
||||||
movzx eax, byte ptr [edi+21h]
|
movzx eax, byte ptr [edi+0x21]
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
retn
|
ret
|
||||||
|
|
||||||
FixedCarDamage_Negative:
|
FixedCarDamage_Negative:
|
||||||
movzx eax, byte ptr [edi+24h]
|
movzx eax, byte ptr [edi+0x24]
|
||||||
test ecx, ecx
|
test ecx, ecx
|
||||||
retn
|
ret
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _declspec(naked) FixedCarDamage_Newsteam()
|
__declspec(naked) void FixedCarDamage_Newsteam()
|
||||||
{
|
{
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
mov edi, [ebp+10h]
|
mov edi, [ebp+0x10]
|
||||||
fldz
|
fldz
|
||||||
fcomp [ebp+14h]
|
fcomp [ebp+0x14]
|
||||||
fnstsw ax
|
fnstsw ax
|
||||||
test ah, 5
|
test ah, 5
|
||||||
jp FixedCarDamage_Negative
|
jp FixedCarDamage_Negative
|
||||||
movzx eax, byte ptr [edi+21h]
|
movzx eax, byte ptr [edi+0x21]
|
||||||
retn
|
ret
|
||||||
|
|
||||||
FixedCarDamage_Negative:
|
FixedCarDamage_Negative:
|
||||||
movzx eax, byte ptr [edi+24h]
|
movzx eax, byte ptr [edi+0x24]
|
||||||
retn
|
ret
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __declspec(naked) CdStreamThreadHighSize()
|
__declspec(naked) void CdStreamThreadHighSize()
|
||||||
{
|
{
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
@ -4103,11 +4103,11 @@ void __declspec(naked) CdStreamThreadHighSize()
|
|||||||
mov [esi]CdStream.overlapped.OffsetHigh, edx // OVERLAPPED.OffsetHigh
|
mov [esi]CdStream.overlapped.OffsetHigh, edx // OVERLAPPED.OffsetHigh
|
||||||
|
|
||||||
mov edx, [esi]CdStream.nSectorsToRead
|
mov edx, [esi]CdStream.nSectorsToRead
|
||||||
retn
|
ret
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __declspec(naked) WeaponRangeMult_VehicleCheck()
|
__declspec(naked) void WeaponRangeMult_VehicleCheck()
|
||||||
{
|
{
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
@ -4115,11 +4115,11 @@ void __declspec(naked) WeaponRangeMult_VehicleCheck()
|
|||||||
test ah, 1
|
test ah, 1
|
||||||
jz WeaponRangeMult_VehicleCheck_NotInCar
|
jz WeaponRangeMult_VehicleCheck_NotInCar
|
||||||
mov eax, [edx]CPed.pVehicle
|
mov eax, [edx]CPed.pVehicle
|
||||||
retn
|
ret
|
||||||
|
|
||||||
WeaponRangeMult_VehicleCheck_NotInCar:
|
WeaponRangeMult_VehicleCheck_NotInCar:
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
retn
|
ret
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user