 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
mouser Advanced Cheater
Reputation: 0
Joined: 08 Mar 2015 Posts: 50
|
Posted: Sun Mar 08, 2015 5:35 pm Post subject: Basic Pointer Question Unity Camera Coordinates |
|
|
Hi, I'm trying to get camera XYZ coordinates in Oddworld New N Tasty.
I'm also a terrible noob at Cheat Engine but did a lot of research via Youtube/CE Tutorial etc.
Still I keep failing at simple things, e.g.
---- can't post URLs---pic in attachment
What you see here is the found camera X, what writes to it (2 adds). I don't understand how to make a pointer out of these addresses. Whats the value of the pointer here? It says it's the same address as the one I've already found, which I used to see what is writing to it. If I search for that address "18F85D48", nothing comes up.
When I open up the memory viewer though and search for that address, Cheat Engine finds it.
Now I know that the camera X address will change every time I restart the game. I can't aob scan this address as the bytes also change, I can aob scan some other addresses e.g. the address I in the screenshot I'm trying to point to "3448A3EB" I can always aob scan this function and it does what it's supposed to (some camera function) but I always have to manually search for the camera x address in order to set a hotkey to it and change the camera.
This is probably something a script would be good for but as I said, noob alarm, I wouldn't know how to even start.
AOB for the one function I can scan for and then use that somehow to tell CE where camer x is etc.?
Im out of ideas at the moment.
| Description: |
|
| Filesize: |
242.83 KB |
| Viewed: |
19895 Time(s) |

|
Last edited by mouser on Wed Mar 18, 2015 4:01 am; edited 2 times in total |
|
| Back to top |
|
 |
justa_dude Grandmaster Cheater
Reputation: 23
Joined: 29 Jun 2010 Posts: 893
|
Posted: Mon Mar 09, 2015 12:59 pm Post subject: |
|
|
Depending on... you might be able to simplify things w/ CE's Mono support. Click the mono menu on the main CE title-bar and enable Mono support. Then, when you "find what address blah blah", you will probably see nice symbols describing the code (eg PLayer::Move::1bf). You should be able to use this symbol instead of an aob.
_________________
A nagy kapu mellett, mindig van egy kis kapu.
----------------------
Come on... |
|
| Back to top |
|
 |
alanze Advanced Cheater
Reputation: 3
Joined: 03 Oct 2012 Posts: 50
|
Posted: Mon Mar 09, 2015 2:04 pm Post subject: |
|
|
You have to learn finding pointers, CE tutorial #6 and #8 would be a good start.
Your starting value is in EAX (18f85d48), start scanning just like in the tutorial.
Also you can use the "Pointer scan" option from Tools menu, here is a video how to use it: watch?v=8CJdV1Vfvv0
A third method would be to back-follow EAX to see how its value is constructed.
|
|
| Back to top |
|
 |
mouser Advanced Cheater
Reputation: 0
Joined: 08 Mar 2015 Posts: 50
|
Posted: Sat Mar 14, 2015 5:07 am Post subject: |
|
|
Thanks for the advice, I have the pointerscans down and a few addresses locked (I still have to check out the mono support, will do later)
I still have to try and AOB these pointers if possible, do I AOB scan what the pointer points to or the pointer itself (if there is even a difference?)
Another question, so I have a pointerscan for an address and it gets me everytime where I want it to be (e.g. X coordinate). I know that in the memory viewer there are a few other interesting addresses (or opcodes) in the vicinity of that pointer and they seem to be always at the same distance from it, let's say there is a function above 2 other functions that does something I find interesting, it's always 2 other functions away but I don't want to pointerscan for address.
How to I lock these addresses withouth pointerscanning them all?
I pointerscanned XYZ all one by one but I've read somewhere else that you only need to find one of them and since they are alway 4 bytes apart (there was a name for it, members I think). How do I tell cheatengine to look for these other addresses, using only the one pointer you have?
I assume it's telling ce in a script to take the pointer and add or substract 4 and then save that address and adding some operation to that. How would that look as code?
|
|
| Back to top |
|
 |
alanze Advanced Cheater
Reputation: 3
Joined: 03 Oct 2012 Posts: 50
|
Posted: Sat Mar 14, 2015 12:50 pm Post subject: |
|
|
You need to aob-scan the final result (the pointer points to) but first you need to find some static values (pattern) near it.
There is no reason to aob-scan the base address (because always remains the same, once you found it you have it).
No script is needed to tell CE that there is another address 4 bytes forward or backward, I give an example to show how you do that:
00665500 - ammo
00665504 - health
00665508 - x position player
0066550C - y position player
00665510 - z position player
00665514 - car id
00665518 - fuel
Let's say you found a 3 level pointer for "x position player" which looks like this:
Pointer for X:
third offset 40
second offset 8
first offset 120
base address 00CCDDFF
Now to use this pointer also for ammo, health, y.. you have to add or substract their address difference from the third offset.
Let's do it for y:
wee know y is forward by "4" bytes (0066550C-00665508=4)
so we add 4 to the third offset, 40+4=44, this is the new pointer for y (without searching and scripting):
Pointer for Y:
third offset 44
second offset 8
first offset 120
base address 00CCDDFF
Do the same for the rest, (third offset for ammo = 38; health = 3C; x = 40; y = 44; z = 48; car id = 4C; fuel = 50)
Remember, you substract or add alway to the last offset (all calculations has to be hex).
|
|
| Back to top |
|
 |
mouser Advanced Cheater
Reputation: 0
Joined: 08 Mar 2015 Posts: 50
|
Posted: Tue Mar 17, 2015 2:51 pm Post subject: |
|
|
Worked like a charm, thanks again.
Now I have a couple of instructions at other addresses I need to deactivate/reroute.
I don't really understand how you can tell cheat engine where those addresses are based on a base address of a totally different instruction.
I've seen a video where offsets are used to tell cheat engine "You start here, then +40bytes, there is the addres", it's not quite the same as these addresses are all in close proximity to another.
It was the video "Cheat Engine Tutorial 3: Advanced AA Scripts by jgoemat" on youtube.
I try to explain better:
I have an address where a value is stored, I increase/decrease the value to get the desired effect. But first I have to deactivate/reroute/nop a few addresses of a instrcution that writes to this value or it interferes with what I want it to do.
My first thought was to pointerscan or aob scan this instruction and disable them per script, but this way I get a whole lot of aob scans and everything starts to bug out when I tried it, so I'm not sure this is the way to go about it.
What do you think?
Edit:
Are there any good to follow rules on how you write a script, general rules like "Never use more than one aob scan in one script" ?
|
|
| Back to top |
|
 |
alanze Advanced Cheater
Reputation: 3
Joined: 03 Oct 2012 Posts: 50
|
Posted: Fri Mar 20, 2015 5:50 pm Post subject: |
|
|
First find the instructions which writes to your values, then put them one by one in aa script.
There will be places where replacing/nop-ing is enough but also some places where code injection is needed.
(we not use "base addresses" for this, we use the address where the instruction is located)
Here 2 examples with 2 aas:
0046E8AA - 74 0B - je 0046E8B1
If not jumping the money will be decreased.
I will change it to 'jmp' to avoid money decrease.
0046E8AA - EB 0B - jmp 0046E8B1
Byte ratio is equal or less, 2 to 2, no deed to inject code.
| Code: |
[ENABLE]
0046E8AA:
jmp 0046E8AC0
[DISABLE]
0046E8AA:
je 0046E8B1
|
00461CBB - FF 47 24 - inc [edi+24]
00461CBE - 8B 47 24 - mov eax,[edi+24]
'edi+24' is the car damage, I don't want to be increased so I set it to always 0.
00461CBB - C7 47 24 00000000 - mov [edi+24],00000000
Byte ratio is not equal or less, 3 to 7, code injection is needed.
| Code: |
[ENABLE]
alloc(newmem,128)
label(returnhere)
newmem:
mov [edi+24],00000000 // set that memory value to 0
mov eax,[edi+24] // original code (which got destroyed by jmp)
jmp returnhere
00461CBB:
jmp newmem
nop
returnhere:
[DISABLE]
00461CBB:
inc [edi+24]
mov eax,[edi+24]
dealloc(newmem)
|
As you see is not necesary to calculate base addresses or offsets between the 2 instructions because we already know their location,
the first 0046E8AA, the second 00461CBB, you just put it in auto assemble, that's how you tell CE what and where to change.
(there are rare cases when the game relocate or change it's executable code, only then you use aob patterns to find them)
|
|
| Back to top |
|
 |
mouser Advanced Cheater
Reputation: 0
Joined: 08 Mar 2015 Posts: 50
|
Posted: Sun Mar 22, 2015 12:04 pm Post subject: |
|
|
I have tried creating a script and when I restarted the game it didn't work anymore so I assume it's one of those games that changes this around.
This here is an aob scan injection for the Y axis of the camera (copy/pasted). It disables the part of the code that keeps the camera from going out of bounds set by the developers. So I can move it everywhere I want, this works everytime.
| Code: |
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
aobscan(INJECT,D9 58 04 8B 85 D0 F7 FF FF 89 85 68 FD FF FF) // should be unique
alloc(newmem,$1000)
label(code)
label(return)
newmem:
code:
//fstp dword ptr [eax+04]
mov eax,[ebp-00000830]
jmp return
INJECT:
jmp code
nop
nop
nop
nop
return:
registersymbol(INJECT)
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
INJECT:
db D9 58 04 8B 85 D0 F7 FF FF
unregistersymbol(INJECT)
dealloc(newmem) |
Now I want to put the other addresses where the code for X and Z is stored into this script so when I activate it all 3 get deactivated at once.
Do I have to allocate memory for every piece of code seperately?
alloc(x,$1000)
alloc(y,$1000)
alloc(z,&1000) etc.
Is there a rule in what order I have to place the code or is this all determined by the labels set at the start?
Can I use one aob scan (the one for Y) to point towards where CE can find X and Z? They should be always at the same distance from another (bytes) but I'm not really sure if that is the case.
Sorry for that manny questions at once, (I hope I'm not stretching any board rules with this)
|
|
| Back to top |
|
 |
justa_dude Grandmaster Cheater
Reputation: 23
Joined: 29 Jun 2010 Posts: 893
|
Posted: Sun Mar 22, 2015 4:43 pm Post subject: |
|
|
If you'd follow my advice to enable mono tools, you'd probably be able to refer to them by name and your script wouldn't require any aobs. Any reason you're opposed to it?
_________________
A nagy kapu mellett, mindig van egy kis kapu.
----------------------
Come on... |
|
| Back to top |
|
 |
mouser Advanced Cheater
Reputation: 0
Joined: 08 Mar 2015 Posts: 50
|
Posted: Sun Mar 22, 2015 6:01 pm Post subject: |
|
|
I'm sorry, I thought that didn't work for me as it wasn't showing anymore in the memory viewer for whatever reason.
But I checked again a couple of minutes ago and then clicked on the mono dissect option and then it showed up again (attachement).
This is the address that writes to the address where camera y axis is stored, I have to disable it to move the camera.
I clicked control+A to see what it puts into a code injection (address).
"DynamicCamera:GetCameraPosition:+4422"
I don't have time at the moment to double check if this address will stay the same when I restart the game (it did change when not using mono support though) will do this tomorrow. But if I understand you correctly this is what the monosupport does, right? No need for AOB because this description of this address will not change?
And to be a bit more clear about my intentions, I am still going for AOB because I expect updates to this game and don't want to do everything again if that happens. I actually only have a lose concept on how to do that but I'm reading a lot of threads on this forum recently and try to get the hang of it.
| Description: |
|
| Filesize: |
90.23 KB |
| Viewed: |
19743 Time(s) |

|
Last edited by mouser on Mon Mar 23, 2015 4:38 am; edited 1 time in total |
|
| Back to top |
|
 |
alanze Advanced Cheater
Reputation: 3
Joined: 03 Oct 2012 Posts: 50
|
Posted: Sun Mar 22, 2015 10:26 pm Post subject: |
|
|
Here is your auto assemble:
| Code: |
[ENABLE]
DynamicCamera:GetCameraPosition:+4422:
fstp st(0)
nop
[DISABLE]
DynamicCamera:GetCameraPosition:+4422:
fstp dword ptr [eax+04]
|
Here is with aob:
| Code: |
[ENABLE]
aobscan(yCord, D9 58 04 8B 85 D0 F7 FF FF 89 85 68 FD FF FF) // should be unique
registersymbol(yCord)
yCord:
fstp st(0)
nop
[DISABLE]
yCord:
fstp dword ptr [eax+04]
unregistersymbol(yCord)
|
You can extend with x and z if you now that for example x instruction is 30 bytes backward and z instruction is 40 bytes forward:
| Code: |
aobscan(Cord, .....
Cord-30:
// some code for x
Cord:
// some code for y
Cord+40:
// some code for z
|
|
|
| Back to top |
|
 |
justa_dude Grandmaster Cheater
Reputation: 23
Joined: 29 Jun 2010 Posts: 893
|
Posted: Sun Mar 22, 2015 11:46 pm Post subject: |
|
|
The difference is that aobscans into JIT code won't work until the code has been run for the first time. If you enable the mono stuff and use the decorated names, any necessary JIT code should be compiled on demand. The data dissector also becomes much more useful.
_________________
A nagy kapu mellett, mindig van egy kis kapu.
----------------------
Come on... |
|
| Back to top |
|
 |
mouser Advanced Cheater
Reputation: 0
Joined: 08 Mar 2015 Posts: 50
|
Posted: Mon Mar 30, 2015 4:27 pm Post subject: |
|
|
Finally got around trying stuff out, everythings seems to be working just fine the way you presented it. I was able to throw most instruction changes into one script except for a few I have a problem with and it is due to me still not completely having a basic understanding on what to do when dealing with instrctions. It probably doesn't help being forced to take long breaks from trying stuff out in CE due to work.
Example:
| Code: |
DynamicCamera:GetCameraPosition:+4422:
fstp st(0)
nop
[DISABLE]
DynamicCamera:GetCameraPosition:+4422:
fstp dword ptr [eax+04] |
This works great but I have another instruction at another address:
| Code: | | fstp dword ptr [edi+000000C4] |
Here the script fails to return everything to the state it was in before activating, when using the script from above. I think it's due to how many nop/s I have to set in the script but I'm not sure.
How can you tell how many are neccessary just by looking at an instruction?
Another problem:
I have a value stored at an address but nothing writes to that address (attachement) looking at that pointer for that address I search for the address at the top. In memory viewer I see an address that is not named/declared as the other addresses when using mono support of CE. Code injection puts these instructions into a script:
| Code: | originalcode:
add [eax],al
xor [ecx+00],al |
I also can't just nopt the first line as it results in a black screen (not a crash put I have to restart the game).
What this value at thta address does is it tells the game what distance the camera has to keep from the main character. The value is eleven, I'm not sure if it stays eleven throughout the entire game so I want to push the value onto a stack (is that the correct terminology?) and when disabling the script it should put it back. I don't really understand how this value can change if nothing writes to that address though so I wouldn't know how to tell CE to return everything to normal again.
Maybe this is a dead end and I wasn't really clear enough describing what I mean or providing enough information.
| Description: |
|
| Filesize: |
33.36 KB |
| Viewed: |
19497 Time(s) |

|
|
|
| Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Mon Mar 30, 2015 7:10 pm Post subject: |
|
|
Look in the Bytes column to identify how many NOP's you require.
| Code: | DDD8 - fstp st(0) // 2 bytes
D9 58 04 - fstp dword ptr [rax+04] // 3 bytes
D9 9F C4000000 - fstp dword ptr [rdi+000000C4] // 6 bytes
00 00 - add [rax],al // 2 bytes
30 01 - xor [rcx],al // 2 bytes |
Copy those bytes then simply go to the line and type the instruction you are going to replace it with.
If the number of bytes do not match, CE itself will tell you how many bytes your instruction is.
It will even ask if you want to NOP the incomplete instructions.
You can save the value of the pointer using LUA. Assuming I did that correctly...
| Code: | [ENABLE]
{$lua}
addr = readInteger("blahblah.exe+009E1EEC")
addr = readInteger(addr + 0x5A0)
addr = readInteger(addr + 0x14)
addr = readInteger(addr + 0x2C4)
addr = readInteger(addr + 0x67C)
SAVE_ADDR = readInteger(addr + 0x6C)
SAVE_VALUE = readInteger(SAVE_ADDR)
[DISABLE]
{$lua}
writeInteger(SAVE_ADDR, SAVE_VALUE) |
|
|
| Back to top |
|
 |
justa_dude Grandmaster Cheater
Reputation: 23
Joined: 29 Jun 2010 Posts: 893
|
Posted: Tue Mar 31, 2015 4:33 am Post subject: |
|
|
| mouser wrote: |
I have a value stored at an address but nothing writes to that address (attachement) looking at that pointer for that address I search for the address at the top. In memory viewer I see an address that is not named/declared as the other addresses when using mono support of CE. |
The value is probably a static data member of a class - it isn't stored with the instance's data, but is instead used globally for every instance of the [camera] class. I haven't spent a lot of time debugging mono games, but CE might not pick up static value/instance types.
| mouser wrote: | Code injection puts these instructions into a script:
| Code: | originalcode:
add [eax],al
xor [ecx+00],al |
I also can't just nopt the first line as it results in a black screen |
I think you're trying to disassemble some data as if it were code. Not everything in memory disassembles into intructions - some of it is just data, eg numbers. That being said, what does it mean to "nop" the number 11? I guess, just change it to 90h. It isn't clear how the value is getting changed from 11 in the first place - are you changing it? If so, why can't you just change it back the same way?
edit: btw, nice job on the other stuff. It looks like you're getting pretty good at this.
_________________
A nagy kapu mellett, mindig van egy kis kapu.
----------------------
Come on... |
|
| Back to top |
|
 |
|
|
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
|
|