[Asm] 纯文本查看 复制代码[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
// 代码逻辑:先开辟一段可用空间,用来存放方向标志;然后根据(当前子弹x坐标地址 - 首颗子弹x坐标地址) / 0x94(0x94为子弹x坐标的间隔) 可以得到当前是第几颗子弹,从而取到方向标志;
最后根据方向标志来决定子弹x坐标是增加还是减少,并对越过边界的子弹修改其方向标志
newmem: //this is allocated memory, you have read,write,execute access
//place your code here
push ecx
push ebx
push eax
push edx
xor edx,edx
mov ecx,[6A9EC0]
mov ecx,[ecx+768]
mov ecx,[ecx+c8] // 子弹x坐标首地址
lea eax,[ebx+30] // 子弹x坐标现地址
sub eax,ecx
mov ecx,94 // 子弹x坐标间隔(第1颗子弹与第2颗子弹)
div ecx // eax:第几个, 从0开始
xor edx,edx // 清零
add eax,00699000 // 00699000+index, 用来存放子弹的方向标志
mov ecx,eax
mov dl,[ecx] // 只存在低字节
cmp edx,0
pop edx
pop eax
pop ebx // 暂时不弹ecx, 因为ecx还有用
je addx
subx: // 子弹x坐标减少
fld dword ptr [ebp+30]
fsub qword ptr [006796A0]
fsub qword ptr [006796A0]
fstp dword ptr [ebp+30]
coml: // 左边界检查
push eax
fild dword ptr [ebp+10]
fadd dword ptr [ebp+30]
fcomp qword ptr [00679298]
fnstsw ax
test ah,05 // 若子弹x坐标 < 0, 则跳
jnp leftb
pop eax
pop ecx
jmp 0046CEC8
leftb: // 越过左边界, 则置相反标志
mov byte ptr [ecx],00
pop eax
pop ecx
jmp 0046CEC8
addx: // 子弹x坐标增加
fld dword ptr [ebp+30]
fadd qword ptr [006796A0]
fadd qword ptr [006796A0]
fstp dword ptr [ebp+30]
comr: // 右边界检查
push eax
fldpi
fld dword ptr [ebp+30]
fadd st(0),st(1)
fcomp qword ptr [00679738]
fnstsw ax
test ah,41 // 若子弹x坐标 >= 800, 则跳
je rightb
pop eax
pop ecx
jmp 0046CEC8
rightb: // 超出右边界, 则置相反标志
mov byte ptr [ecx],01
pop eax
pop ecx
jmp 0046CEC8
originalcode:
//fld dword ptr [ebp+30]
//fcomp qword ptr [00679738]
jmp newmem
exit:
jmp returnhere
"PlantsVsZombies.exe"+6CE9D:
jmp newmem
nop 4
returnhere:
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"PlantsVsZombies.exe"+6CE9D:
fld dword ptr [ebp+30]
fcomp qword ptr [00679738]
fnstsw ax
test ah,41
je 0046D047
fild dword ptr [ebp+10]
fadd dword ptr [ebp+30]
fcomp qword ptr [00679298]
fnstsw ax
test ah,05
jnp 0046D047
//Alt: db D9 45 30 DC 1D 38 97 67 00