Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


ASM question: The correct way to multiply a register?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
aikoncwd
Grandmaster Cheater
Reputation: 23

Joined: 21 Dec 2012
Posts: 591
Location: Spain (Barcelona)

PostPosted: Tue Dec 02, 2014 5:11 pm    Post subject: ASM question: The correct way to multiply a register? Reply with quote

Hi

I have an ASM question, imagine I have this instruction:

Code:
mov [esi+9C],ecx


esi+9C holds my current score and ECX holds the amout score I earn. I want to make something like a "2x score hack script", so every point I earn count x2... I tried this:

Code:

imul ecx,2
mov [esi+9C],ecx


But don't work, then I tried this:

Code:

imul ecx,ecx
mov [esi+9C],ecx


With this script I got 2890753290875903485 score points (lol), what is the correct way to multiply x2 (or x3, x5) a value in ASM?

====================================

EDIT, ok I think I got it... IMUL instruction store the result on EAX? lol, then this should work?

Code:
  push eax
  imul ecx,2
  mov [esi+9C],eax
  pop eax


Is this the correct way?

_________________
Hey Hitler
Test here your skill with CheatEngine, I coded a challenge for you. Try to beat it!
HERE
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Tue Dec 02, 2014 5:40 pm    Post subject: Reply with quote

may be SAL (shift arithmetic left ) shorter?

sal ecx,1

binary: D1 E1
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

Joined: 09 May 2003
Posts: 25791
Location: The netherlands

PostPosted: Tue Dec 02, 2014 6:43 pm    Post subject: Reply with quote

first off, if esi+9c contains experience, then ECX contains the new amount of your score. It doesn't contain how much you earn

I recommend finding out where ecx get's it's value and do the change there.

and yes, imul stores the result in eax and edx

tip:
add registerx,registerx is the same as multiply by 2

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Tue Dec 02, 2014 7:31 pm    Post subject: Reply with quote

Dark Byte wrote:
first off, if esi+9c contains experience, then ECX contains the new amount of your score. It doesn't contain how much you earn

I recommend finding out where ecx get's it's value and do the change there.

and yes, imul stores the result in eax and edx

tip:
add registerx,registerx is the same as multiply by 2


It may not need to find out where ecx value set, try replace

mov [esi+9c],ecx

with

sub ecx,[esi+9c]
sal ecx,1
add [esi+9c],ecx
Back to top
View user's profile Send private message
aikoncwd
Grandmaster Cheater
Reputation: 23

Joined: 21 Dec 2012
Posts: 591
Location: Spain (Barcelona)

PostPosted: Tue Dec 02, 2014 7:48 pm    Post subject: Reply with quote

Dark Byte wrote:
first off, if esi+9c contains experience, then ECX contains the new amount of your score. It doesn't contain how much you earn

I recommend finding out where ecx get's it's value and do the change there.

and yes, imul stores the result in eax and edx

tip:
add registerx,registerx is the same as multiply by 2


Thanks for the tip, today I'm a bit blind and didn't noticed that haha, here is the full code:

Code:
"GW3.exe"+82801: 8B EC                          -  mov ebp,esp
"GW3.exe"+82803: 8B 45 08                       -  mov eax,[ebp+08]
"GW3.exe"+82806: 56                             -  push esi
"GW3.exe"+82807: 8B F1                          -  mov esi,ecx
"GW3.exe"+82809: 8B 8E 9C 00 00 00              -  mov ecx,[esi+0000009C]
"GW3.exe"+8280F: 01 46 7C                       -  add [esi+7C],eax
"GW3.exe"+82812: 03 C8                          -  add ecx,eax
"GW3.exe"+82814: 3B 8E 80 00 00 00              -  cmp ecx,[esi+00000080]
"GW3.exe"+8281A: 7E 06                          -  jle GW3.exe+82822
"GW3.exe"+8281C: 89 8E 80 00 00 00              -  mov [esi+00000080],ecx
// ---------- INJECTING HERE ----------
"GW3.exe"+82822: 89 8E 9C 00 00 00              -  mov [esi+0000009C],ecx
// ---------- DONE INJECTING  ----------


"GW3.exe"+82803 EAX get the value of [ebp+08]
"GW3.exe"+82809 ECX get the value of the current score
"GW3.exe"+82812 add ecx,eax

and finally my instruction: mov [esi+0000009C],ecx

I think I got it. Thanks again

_________________
Hey Hitler
Test here your skill with CheatEngine, I coded a challenge for you. Try to beat it!
HERE
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 62

Joined: 01 Oct 2008
Posts: 958

PostPosted: Tue Dec 02, 2014 9:09 pm    Post subject: Reply with quote

It may be more consistance to inject where xp gain Eax can be changed, since the result xp value may saved in multiple places.

Code:
"GW3.exe"+82801: 8B EC                          -  mov ebp,esp
"GW3.exe"+82803: 8B 45 08                       -  mov eax,[ebp+08]
"GW3.exe"+82806: 56                             -  push esi
"GW3.exe"+82807: 8B F1                          -  mov esi,ecx
// ---------- INJECTING HERE ----------
"GW3.exe"+82809: 8B 8E 9C 00 00 00              -  mov ecx,[esi+0000009C]
// ---------- DONE INJECTING  ----------
"GW3.exe"+8280F: 01 46 7C                       -  add [esi+7C],eax
"GW3.exe"+82812: 03 C8                          -  add ecx,eax
"GW3.exe"+82814: 3B 8E 80 00 00 00              -  cmp ecx,[esi+00000080]
"GW3.exe"+8281A: 7E 06                          -  jle GW3.exe+82822
"GW3.exe"+8281C: 89 8E 80 00 00 00              -  mov [esi+00000080],ecx
"GW3.exe"+82822: 89 8E 9C 00 00 00              -  mov [esi+0000009C],ecx


new code:
Code:
mov ecx,[esi+0000009C]
sal eax,4 // x16
Back to top
View user's profile Send private message
henrysimon
How do I cheat?
Reputation: 0

Joined: 29 May 2015
Posts: 8

PostPosted: Wed Jun 06, 2018 9:08 am    Post subject: Reply with quote

Dark Byte wrote:

try replace
mov [esi+9c],ecx

with

sub ecx,[esi+9c]
sal ecx,1
add [esi+9c],ecx


this works for me, although if it also being used to set money, only multiply if the money increase, if money decrease just use normal formula (otherwise, it will decrease multiply and set the value to minus or to maximum)

newmem: //this is allocated memory, you have read,write,execute access
cmp bx, [rax] //compare between the 2 value
jl normalvalue //if lest than / minus, use normal formula, else continue
sub bx,[rax] //find the difference between new value and old value
sal bx,1 //multiply the value
add [rax],bx //add the multiply value to old value
jmp originalcode

normalvalue:
mov [rax],bx
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites