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 


Clarifications needed

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions
View previous topic :: View next topic  
Author Message
LeglessQuasimodo
Newbie cheater
Reputation: 0

Joined: 01 Jun 2015
Posts: 18
Location: Amerika

PostPosted: Mon Aug 31, 2015 6:10 am    Post subject: Clarifications needed Reply with quote

hello there,slowly learning CE,atm I using MG:GZ as a learning base

1- Question
I have changed my max ammo using 4 bytes which was easy considering the value in game was the same in cheat engine,but this was not true for the ammo clip,a total of 8 ammo was being show 7 in cheat engine,and 7 in-game as being 6 in cheat engine,why is this?

2 - Question
Using someone else table to learn,I was able to learn how to make a no-reloaded script,the problem is only the first part I could understand,the second part was a total nonsense to me,and am additional xmm1 which I don't know where the hell that come from

this is what I gathered

Code:

newmem:
movss xmm1,[rcx+00000450] //mov xmm1 to max ammo clip
movss [rcx+0000044C],xmm1 //mov current ammo clip to max ammo clip (xmm1)

originalcode:
mov eax,[rcx+0000044C]


original code is mov [rcx+0000044C],eax instead of mov eax,[rcx+0000044C],why it was to be changed?

and why movss instead of mov,and xmm1 instead of eax

the table is working,but I don't to use it before I actually understand why the changes,thanks in advance.
Back to top
View user's profile Send private message
Stregum
Advanced Cheater
Reputation: 0

Joined: 17 Jun 2014
Posts: 56
Location: We make baguettes there !

PostPosted: Mon Aug 31, 2015 6:39 am    Post subject: Reply with quote

Hey

1.
It's the developer choice to make the ammo system, the value is shifted by one right ? so an empty magazine would have a value of -1 (probably) instead of zero, that's reasonable, it's the way the game is coded.

2.
I wanna get your attention here:

"mov x,y"
actually means
"x = y" and not "y = x"

x<<y if you prefer

mov and movss are the same kind of instruction, but movss is for floats (floating point value)
xmm1 is a register that can contain some floats or doubles.

So what it does;

Code:

newmem:
movss xmm1,[rcx+00000450] //Store the max ammo clip into a temporary register (remember, right to left, so xmm1 takes the value of  [rcx+450]
movss [rcx+0000044C],xmm1 //Set the current ammo clip to the value stored in xmm1, which is max ammo.

originalcode:
mov eax,[rcx+0000044C]


The idea is to do:
Code:

[PseudoCode]

currentAmmo = maxAmmo


But since you can't do memory to memory modification like
Code:

mov [rcx+00000450],[rcx+0000044C] //WONT WORK !!


A intermediate register must be used, and this is where xmm1 comes in, and does a bridge between 2 memory values.

And for your question:
eax is probably your decreased ammo value, it is your current ammo decreased by 1, and the new xmm1 is the max ammo for your brand new filled clip. Smile

_________________
Rhaa Stregum Vitae Smile


Last edited by Stregum on Mon Aug 31, 2015 8:32 am; edited 1 time in total
Back to top
View user's profile Send private message
LeglessQuasimodo
Newbie cheater
Reputation: 0

Joined: 01 Jun 2015
Posts: 18
Location: Amerika

PostPosted: Mon Aug 31, 2015 7:50 am    Post subject: Reply with quote

Stregum wrote:
Hey


so reading your answer I have this

Code:

newmem:
movss xmm0,[rcx+00000450] //store max ammo clip into a temporary register (temp register < max ammo)
movss [rcx+0000044C],xmm0 //set current ammo clip to temporary register (current ammo > temp register/max ammo)

originalcode:
mov eax,[rcx+0000044C] //decrease < current ammo/temporary register(xmm0)


is this about right or there is anything off that I need to know/understand?
Back to top
View user's profile Send private message
Stregum
Advanced Cheater
Reputation: 0

Joined: 17 Jun 2014
Posts: 56
Location: We make baguettes there !

PostPosted: Mon Aug 31, 2015 8:24 am    Post subject: Reply with quote

Wrong ! :p (I don't know if it's a typo you've made)
Code:

movss [rcx+0000044C],xmm0 //set current ammo clip to temporary register (current ammo > temp register/max ammo)


Right !
Code:

movss xmm0,[rcx+00000450] //store max ammo clip into a temporary register (temp register < max ammo)


So, what you need to understand is whatever there is on the right or left parameters (x and y in the above example) in mov instructions*, this is always the same way of handling these instructions, from right to left**.

(Do you know what "[rcx+###]" means btw ?)

Code:

mov x,y // x < y , WHATEVER THE x AND y ARE


So, as mentionned, this
Code:

movss [rcx+0000044C],xmm0 //set current ammo clip to temporary register (current ammo > temp register/max ammo)

should be this
Code:

movss [rcx+0000044C],xmm0 //set current ammo clip to temporary register (current ammo <<<<<<<<<<<< temp register/max ammo)

this doesn't changes anything in the code, but you're interpretation is wrong, it's still right to left.

As for this
Code:

originalcode:
mov eax,[rcx+0000044C]

I don't think it is needed, you could try to erase this part (don't forget to erase the label(originalcode) declaration if it works), if it crashes I guess it's probably necessary ^.^





__________________________________

*There are other instructions that does that, such as
Code:

add x,n     (x = x + n)     :     add eax,3
sub x,n     (x = x - n)     :     sub ecx,4C

The list is way longer than that, but it's so you can understand what i mean

**I don't want to confuse you, currently, you're writing in Intel syntax, but there is an other notation called "AT&T", that reverses the order
Code:

mov %eax,%ebx //eax > ebx
sub $C,%esp // esp = esp - 0xC

But you don't have to care neither about the notation nor the $ and % symbols, it's just so you don't blame me if you read that somewhere else ^^

_________________
Rhaa Stregum Vitae Smile
Back to top
View user's profile Send private message
LeglessQuasimodo
Newbie cheater
Reputation: 0

Joined: 01 Jun 2015
Posts: 18
Location: Amerika

PostPosted: Mon Aug 31, 2015 8:57 am    Post subject: Reply with quote

Stregum wrote:
Wrong !


fixed it,thank you.

Code:

movss xmm0,[rcx+00000450] //store max ammo clip into a temporary register (temp register < max ammo)
movss [rcx+0000044C],xmm0 //set current ammo clip to temporary register (current ammo < temp register/max ammo)


but I still need some info on this one,to make sure I get it right.

Code:

mov eax,[rcx+0000044C] //decrease < current ammo/temporary register(xmm0)


[rcx+0000044C] being xmm0,does this mean that eax will now be handled as xmm0 (decrease ammo < xmm0/current/max ammo) ??
Back to top
View user's profile Send private message
Stregum
Advanced Cheater
Reputation: 0

Joined: 17 Jun 2014
Posts: 56
Location: We make baguettes there !

PostPosted: Mon Aug 31, 2015 9:11 am    Post subject: Reply with quote

Quote:

[rcx+0000044C] being xmm0,does this mean that eax will now be handled as xmm0 (decrease ammo < xmm0/current/max ammo) ??

eax = xmm0, yes, if that's what you mean.
That's why I don't think this mov is necessary, but we never know..

_________________
Rhaa Stregum Vitae Smile
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Mon Aug 31, 2015 5:49 pm    Post subject: Reply with quote

Assuming the value is 4-byte and you're using XMM1 for no reason, it sounds like the code you want is.
Code:
mov eax,[rcx+00000450] // move max ammo into EAX
dec eax // decrease by 1, because you said that's how it's stored
mov [rcx+0000044C],eax // move max ammo minus 1 into current ammo
Back to top
View user's profile Send private message
Stregum
Advanced Cheater
Reputation: 0

Joined: 17 Jun 2014
Posts: 56
Location: We make baguettes there !

PostPosted: Thu Sep 03, 2015 3:39 pm    Post subject: Reply with quote

The xmm1 register didn't make sense to me either, but it was in his code, oddly
_________________
Rhaa Stregum Vitae Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions 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