 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Csimbi I post too much
Reputation: 97
Joined: 14 Jul 2007 Posts: 3327
|
Posted: Fri Sep 12, 2008 4:13 pm Post subject: Need some ASM help for my Auto-Assemble script |
|
|
Hi,
I am trying to hack the resource in a game - but only for the player, not the AI.
To do that, I want to store the pointer to the player and write to that pointer every time before it is read.
I came up with a script that I think does this, however it always crashes. I commented out the second half (where the value is written before it it read), so all it should do now is save the pointer. But, it still crashes.
I am not very good in ASM, I assume I have a mistake somewhere; maybe I am too tired to spot the error. So, I am posting it here hoping that someone with a keen eye will spot the error in my ways and correct me.
Thank you.
Here is the current auto-assemble code (that crashes when the pointer should be stored):
Code: | [ENABLE]
// Definitions
define(FLOAT10000,461C4000)
define(MYCAVE,008BC4F6)
// Declarations
label(return1)
label(original1)
//label(return2)
//label(hackcode)
label(pEnergy)
label(pPointer)
registersymbol(pEnergy)
registersymbol(pPointer)
// Set up jump to my code to get the pointer
004019BB:
jmp MYCAVE
return1:
/*
// Set up jump to my code to do the hack
004019D2:
jmp hackcode
nop
return2:
*/
// Find the pointer to the resource
MYCAVE:
// See if it's the player (EAX+8=0 (?))
push ebx
mov ebx, [eax+8]
cmp ebx, 0
pop ebx
// If not the player, do nothing.
jnz original1
// Otherwise, save the pointer for later use
mov [pPointer], eax
// Then, execute the original code.
original1:
cmp esi,edx
mov ecx,[eax+0c]
// Finally, return
jmp return1
/*
// Hack the resource
hackcode:
push eax
push ebx
mov eax, pPointer
mov ebx, [pEnergy]
mov [eax+0000016c],ebx
pop eax
pop ebx
// Execute the original code after my code
fld dword ptr [eax+0000016c]
// Return when we are done
jmp return2
*/
//=========================================
// Variables
pEnergy:
dd FLOAT10000
pPointer:
dd 0
[DISABLE]
004019BB:
cmp esi,edx
mov ecx,[eax+0c]
004019D2:
fld dword ptr [eax+0000016c]
unregistersymbol(pEnergy)
unregistersymbol(pPointer)
|
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25806 Location: The netherlands
|
Posted: Fri Sep 12, 2008 5:02 pm Post subject: |
|
|
try adding fullaccess(008BC4F6,4096) at the start (or just use alloc for your cave)
It could be that the cave you've picked isn't executable, or read-only. fullaccess sets the memoryregion to executable and writable
Also, check that the cave has enough memory and isn't overwritten at runtime later on.
another problem could be that the code you've placed the code at is expecting some flags to be correct (e.g before a conditional jump)
you can solve that problem with a pushfd to store the flags and a popfd to restore the flags
_________________
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 |
|
 |
Csimbi I post too much
Reputation: 97
Joined: 14 Jul 2007 Posts: 3327
|
Posted: Sat Sep 13, 2008 5:42 am Post subject: |
|
|
I prefer the caves vs. alloc because it's easier to create a trainer in TMK that way.
Yes, seems that it's the full access.
Apparently, there are only R, RX or RW caves in this game - I forgot that this cave was RX when I was updating the code.
So, I guess I have to find another cave that is RW, and put the data there.
Thanks Dark Byte!
|
|
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
|
|