How to do a MATH in ASM script in CE? (addition, subtraction, division, multiplication)
Posted: Thu Jul 11, 2019 11:56 pm
Hello Guys.
I have very big problem - I don't know how to properly do a MATH in CE script.
I want to DIVIDE by 2 the VALUE which I will write in the script.
I have a function: mulss xmm0,[ebp+104]
EBP+104 is having the value which I am interested in FLOAT type. If I will write script like that:
I will add 200 into EBP+104 but the result of my hacking is displayed in the game as: 400 - because the game multiplies itself by the value of two.
So doesn't matter what I will write, the result will be always the same = if I will write 100, I will get result of 200 ; if I will write a 150, I will get the result of 300 ; if I will write a 200, I will get the result of 400.... and so on & son.
How to properly write a script to do a Math without me?
I just want to write for example 300 value and then see this 300 value in my game (not 600).
I made a screenshot from BACK & TRACE:
I was trying to do something like these:
by after activating script - the game is crashing. What is wrong? I did this by reading this tutorial ---> [Link]
I don't know what is wrong and why it is crashing my game after activation.
I am waiting for your advices.
Best Regards.
Marta.
I have very big problem - I don't know how to properly do a MATH in CE script.
I want to DIVIDE by 2 the VALUE which I will write in the script.
I have a function: mulss xmm0,[ebp+104]
EBP+104 is having the value which I am interested in FLOAT type. If I will write script like that:
Code: Select all
mov [ebp+104],(float)200
mulss xmm0,[ebp+104]
So doesn't matter what I will write, the result will be always the same = if I will write 100, I will get result of 200 ; if I will write a 150, I will get the result of 300 ; if I will write a 200, I will get the result of 400.... and so on & son.
How to properly write a script to do a Math without me?
I just want to write for example 300 value and then see this 300 value in my game (not 600).
I made a screenshot from BACK & TRACE:
I was trying to do something like these:
Code: Select all
alloc(newmem,2048)
globalalloc(dupa,4)
label(returnhere)
label(originalcode)
label(exit)
newmem: //this is allocated memory, you have read,write,execute access
//place your code here
originalcode:
push eax
push edx
push ebx
mov ebx,[dupa]
mov [ebp-14],ebx
pop ebx
mov edx,[ebp-14]
mov eax,[edx]
push ebx
mov ebx,#2
div ebx
mov [ebp-14],eax
mulss xmm0,[ebp-14]
pop edx
pop ebx
pop eax
I don't know what is wrong and why it is crashing my game after activation.
I am waiting for your advices.
Best Regards.
Marta.