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 


Is this kind of script possible?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
jim2point0
Master Cheater
Reputation: 4

Joined: 05 Oct 2012
Posts: 336

PostPosted: Wed Aug 13, 2014 11:05 pm    Post subject: Is this kind of script possible? Reply with quote

Hey,

I'm still very much a n00b when it comes to assembly. But I have a game where I want to disable code that writes to a address. The problem is, disabling that script causes the game to break.

So I was wondering if it was possible to not disable the code that writes to a certain address, but rather use my own values (controlled via hotkeys).

So instead of the game's code which does the following:

Code:
mov esi,[ebp-18]


Do something like this instead:

Code:
mov esi,[myValue]


I just have no idea how to set this up. Ideally I'd get the initial value the game was using, store that in "myvalue" then control that with hotkeys. I just have no idea how to set something like that up. Anyone have any ideas?
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Thu Aug 14, 2014 9:24 am    Post subject: Reply with quote

If NOP'ing the instruction causes the game to crash, the first thing that you want to do is check to see if that instruction is accessing other addresses (besides your targeted address). If it is, you'll have to filter them out so that they are not affected.

To answer your question...it is possible, you just have to set up a custom address. There are a couple of different ways that you can do it. One way:
Code:

//code above

label(myvalue)
registersymbol(myvalue)

newmem:
mov esi,[myvalue]
jmp returnhere

myvalue:
dd 0

//code below


Then, just add a custom address to your cheat table and instead of using a traditional address, just use the label myvalue in the address field. Once you activate the script, the value of myvalue will be 0, so you may need to write your script to ignore that operation in the event that the value is 0. You can set up a hotkey for myvalue just like you would any address, but the hotkey will have no effect until the script is activated.

To ignore the 0 value:
Code:

//code above

label(myvalue)
registersymbol(myvalue)

newmem:
cmp [myvalue],0
je originalcode
mov esi,[myvalue]
jmp returnhere

myvalue:
dd 0

//code below


The example you gave is unusual. Typically, you're not going to be replacing an address with another value, but a value with another value. For example, instead of:

Code:
mov esi,[myvalue]


you'd be working with:

Code:
mov [esi+08],[myvalue]


which won't work and will have to be written like:

Code:
push edi
mov edi,[myvalue]
mov [esi+08],edi
pop edi
Back to top
View user's profile Send private message
jim2point0
Master Cheater
Reputation: 4

Joined: 05 Oct 2012
Posts: 336

PostPosted: Thu Aug 14, 2014 1:10 pm    Post subject: Reply with quote

++METHOS wrote:
If NOP'ing the instruction causes the game to crash, the first thing that you want to do is check to see if that instruction is accessing other addresses (besides your targeted address).

It's not crashing, but causing other odd behaviors in the game.

++METHOS wrote:

which won't work and will have to be written like:
Code:
push edi


How do I know what register to push? Just trial and error? I figured certain registers are being used by the game at that moment and shouldnt be touched?

In any case, I'll give this a shot Smile
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Thu Aug 14, 2014 1:13 pm    Post subject: Reply with quote

As long as the register type is suitable and isn't being used in the current instruction, you should be fine.
Back to top
View user's profile Send private message
jim2point0
Master Cheater
Reputation: 4

Joined: 05 Oct 2012
Posts: 336

PostPosted: Thu Aug 14, 2014 2:18 pm    Post subject: Reply with quote

Well, the script is doing what it's supposed to do, nice Smile

I have another problem that maybe you could understand better than I do.

I'm using Cheat Engine to change the FOV (field of view) of a game. I found the opcode that writes to the FOV.
Code:
fstp dword ptr [esi-78]

So in my script, I disable that line of code and store esi in my own address (so i can use a pointer to modify the value myself). But doing this causes half of my player model to disappear until I disable the script.

What I'm trying to do with this is store the FOV so I can control it, but still have my damn player model intact. I don't know what that line of code is doing though. It's clearly doing more than just storing something in esi-78....

Any thoughts?
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Fri Aug 15, 2014 1:44 am    Post subject: Reply with quote

It's hard to say with that information. If it is accessing other addresses, it could be performing many tasks. Not sure how you're manipulating the FOV, but you may not have to disable that instruction to manipulate it, depending on what you're doing. For example, you can set up a hotkey to just increase/decrease the value by a certain amount, without disabling the instruction from doing what it needs to do. But, without knowing more, I am just guessing.

To alter the value but keep the code, you can simply set up a pointer address using a custom label:

Code:
newmem:
mov [custompointer],esi
fstp dword ptr [esi-78]
jmp returnhere


Then, in your cheat table, you can activate the script first, then add a custom pointer address with the base address being custompointer and the offset being -78. From here, you can alter the value any way you like, just as you would a pointer address.
Back to top
View user's profile Send private message
jim2point0
Master Cheater
Reputation: 4

Joined: 05 Oct 2012
Posts: 336

PostPosted: Sat Aug 16, 2014 10:17 am    Post subject: Reply with quote

The game immediately sets it back to the default, which is why I have to disable it in order to make any changes at all.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sat Aug 16, 2014 11:30 am    Post subject: Reply with quote

What happens when you do this?:

Code:
newmem:
mov [esi-78],#100  //change to whatever value you want
fstp dword ptr [esi-78]
//code below


If your value is still reverting with the above script, then you must look to see which instruction(s) is writing to your address and either take care of it, or inject there.
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