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 


Slightly advanced help with auto-assembler

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
xeratal
Advanced Cheater
Reputation: 1

Joined: 05 Nov 2005
Posts: 93

PostPosted: Sat Feb 12, 2011 8:59 am    Post subject: Slightly advanced help with auto-assembler Reply with quote

Hi, everyone!

Really great to see that the forums is still alive since I visited long ago... =]
Anyway, I've a question on how I should go about doing something... I've never used the auto-assembler before so don't be harsh on me!

Suppose I have an address, and I want to make the values of that address continually change the way I want it to.
such that: e.g.
-----------------------------
address X
if x=1, then do x=2
if x=2, then do x=3
if x=3, then do x=4 (note that this is not simply incrementing)
once these checks are over, jump back to where original code was.
-----------------------------
Now before you say anything (if I only had this I would have a long long way to go), I know roughly where I should go (in fact I did a test on "if x=1, then do x=2" and it worked fine).

Here is what I did so far: (I did not use auto-assembler yet, need to ask if it's the right tool etc)
1) Allocated sufficient memory in the memory viewer.
2) In the game I am trying to hack, I have found a code which is always run before I want my check to run, so I changed that code to JMP to my allocated memory.
3) In my allocated memory, I basically put a series of "cmp" "jne" "mov", and finally till I want my check to stop, I jmp back to the original code.

If you can see, basically I have a properly working "edit". What I want, however, is to change this "edit" into code - code such that I can simply put in the cheat table or code list. I think I have to use the auto-assembler, so I read a relatively useful tutorial on it.

What I have came up to this (surely won't compile because I just wrote on tons of things I assumed, and it's basically just to show you guys what I'm doing), and I hope people can tell me if I'm using the right method (the auto-assembler), and if I am, how I can make this code work!

Code:
[ENABLE]
alloc(myCode,1024)
registersymbol(dynamicVal)

00410000 //example address of where game code would JMP to my code
jmp myCode

myCode:
//---------------------memory address #1
cmp [address],1
jne [#2] //memory address #2
mov [address],2
//---------------------memory address #2
cmp [address],2
jne [#3] //memory address #3
mov [address],3
//---------------------memory address #3
...
...
//continue cmp/jne/mov-ing as long as I want (it's not incrementing by the way, the "1" "2" "3" etc are all other numbers) (I would probably have around 50 of these) (the code would only run before I do what I want to do, so the value is not always changing, it only changes to the next value when I do something)
...
...
jmp ORIGINAL CODE

[DISABLE]
dealloc(AutoAssembler)
unregistersymbol(dynamicVal)


Anyway, I know I wrote quite a bit, but I have a few basic questions to make it easier.
1) Am I using the right tool (auto assembler) (because I want to be able to use this code hundreds of times easily)?
2) Is there anything wrong with the structure of my auto-assembler code?
3) What is wrong with my code? (I know there definitely would be stuff).
4) If you look at my code and see the "jne [#2]" etc, how should I go about getting "#2"? Should I make use of labels?
5) Any other things... if you wanna help a noob like me write out working code it's fine too... I would be able to understand it without explanation...

Thanks! Cool
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Sat Feb 12, 2011 9:19 am    Post subject: Reply with quote

1: Yes, aa can be used
2: Instead of jne [#2] I'd use jne #2 (#2 of course a defined label)
3: perhaps you're not executing the code you overwrite the bytes of with the jmp ?
Use the code injection template (first use the table template followed by the code injection template for best results)

4: as said in 2, yes
example:
Code:

[ENABLE]
alloc(myCode,1024)
registersymbol(dynamicVal)
label(check2)
label(check3)
label(check.....)
label(jumpback)

00410000 //example address of where game code would JMP to my code
jmp myCode
fillup nops to make up for overwritten addresses
jumpback:


myCode:
//---------------------memory address #1
cmp [address],1
jne check2 //memory address #2
mov [address],2
//---------------------memory address #2
check2:
cmp [address],2
jne check3 //memory address #3
mov [address],3

check3:
//---------------------memory address #3
...
...
//continue cmp/jne/mov-ing as long as I want (it's not incrementing by the way, the "1" "2" "3" etc are all other numbers) (I would probably have around 50 of these) (the code would only run before I do what I want to do, so the value is not always changing, it only changes to the next value when I do something)
...
...

..execute the overwritten instructions...

jmp jumpback

[DISABLE]
dealloc(AutoAssembler)
unregistersymbol(dynamicVal)

(you can also use @@: and @f and @b but I myself dislike ugly code like that)

_________________
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
xeratal
Advanced Cheater
Reputation: 1

Joined: 05 Nov 2005
Posts: 93

PostPosted: Wed Feb 16, 2011 3:30 pm    Post subject: Reply with quote

Thanks a lot for your time and fast reply; I saw it immediately but didn't have time to test it.

I did what you said, to use the code injection template, and I realized you already made it extremely easy for noobs like me to understand it (thanks Very Happy)
Also, I finally fixed up all the small conceptual problems with my hack - only problem I think I still have a general assembler question: how do I mov values to a pointer?
E.g. mov [00400000], 1 (works fine, but I want to mov it to the ptr)
pointer address is 00600000 + A
E.g. mov...?
I tried "mov [00600000+A], 1" but as expected it wasn't that easy.
I'm assuming I need to do something with the registers?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

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

PostPosted: Wed Feb 16, 2011 6:18 pm    Post subject: Reply with quote

push eax
mov eax,[00600000]
mov [eax+a],1
pop eax

_________________
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
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