 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
oLaudix Expert Cheater
Reputation: 3
Joined: 25 Mar 2010 Posts: 138
|
Posted: Sun Mar 27, 2011 8:28 am Post subject: Injection code problem |
|
|
mov [esi+edi*4+00000268],eax <--- this is code responsible for changing ammo in Homefront
I wrote this code
| Code: | alloc(newmem,2048) //2kb should be enough
label(returnhere)
label(originalcode)
label(exit)
label(wieksze)
label(mniejsze)
newmem: //this is allocated memory, you have read,write,execute access
cmp [esi+edi*4+00000268],eax
jg wieksze
jmp mniejsze
wieksze:
mov eax,[esi+edi*4+00000268]
mov [esi+edi*4+00000268],eax
jmp exit
mniejsze:
mov [esi+edi*4+00000268],eax
originalcode:
//mov [esi+edi*4+00000268],eax
exit:
jmp returnhere
"HOMEFRONT.exe"+9B3135:
jmp newmem
nop
nop
returnhere: |
Is my understanding of this code correct?
| Code: | cmp [esi+edi*4+00000268],eax
jg wieksze
jmp mniejsze
wieksze:
mov eax,[esi+edi*4+00000268]
mov [esi+edi*4+00000268],eax
jmp exit
mniejsze:
mov [esi+edi*4+00000268],eax |
it should check if [esi+edi*4+00000268] is bigger than eax, if yes i jumpes to wieksze and use only this code
| Code: | mov eax,[esi+edi*4+00000268]
mov [esi+edi*4+00000268],eax
jmp exit |
if not it use jmp mniejsze and use original code right?
The problem is that it crashes the game and i have no idea why. Any suggestions? (Except shitty coding since im beginer in asembler)
|
|
| Back to top |
|
 |
Geri Moderator
Reputation: 111
Joined: 05 Feb 2010 Posts: 5627
|
Posted: Sun Mar 27, 2011 10:14 am Post subject: |
|
|
Maybe you should try a code like this for example:
To freeze the ammo to a specific value.
Or you can use
| Code: | | mov [esi+edi*4+00000268],#999 |
and not change eax register at all.
Also as you use a cmp instruction and you work with flags, you may need to save them at the start of the script with pushfd and load them at the end of the script with popfd.
| Code: | alloc(newmem,2048) //2kb should be enough
label(returnhere)
label(originalcode)
label(exit)
label(wieksze)
label(mniejsze)
newmem: //this is allocated memory, you have read,write,execute access
pushfd
cmp [esi+edi*4+00000268],eax
jg wieksze
jmp mniejsze
wieksze:
mov [esi+edi*4+00000268],#999
//or maybe mov [esi+edi*4+00000268],(int)999
jmp exit
mniejsze:
mov [esi+edi*4+00000268],eax
originalcode:
//mov [esi+edi*4+00000268],eax
exit:
popfd
jmp returnhere
"HOMEFRONT.exe"+9B3135:
jmp newmem
nop
nop
returnhere: |
_________________
|
|
| Back to top |
|
 |
oLaudix Expert Cheater
Reputation: 3
Joined: 25 Mar 2010 Posts: 138
|
Posted: Sun Mar 27, 2011 11:31 am Post subject: |
|
|
| Now shooting works, it doesnt decrease ammo while firing but it crashes after reload :/ Asembler is hard >.< Changing quantity of ammo to 999 or eve 5 crashes game immediately.
|
|
| Back to top |
|
 |
Geri Moderator
Reputation: 111
Joined: 05 Feb 2010 Posts: 5627
|
Posted: Mon Mar 28, 2011 12:08 am Post subject: |
|
|
Then probably it is not the script's fault, maybe some kind of protection to avoid changing the value. I don't know because I don't have the game.
_________________
|
|
| Back to top |
|
 |
kemicza Newbie cheater
Reputation: 0
Joined: 10 Jan 2011 Posts: 11 Location: Belgium
|
Posted: Mon Mar 28, 2011 4:28 am Post subject: |
|
|
| This game does have protection against code injection. It checks this during some certain events like reloading/throwing a bomb/loading etc.. I'm not sure if the cracked version has removed the protection, but the original exe does have protection
|
|
| Back to top |
|
 |
Geri Moderator
Reputation: 111
Joined: 05 Feb 2010 Posts: 5627
|
Posted: Mon Mar 28, 2011 4:43 am Post subject: |
|
|
| Quote: | | This game does have protection against code injection. It checks this during some certain events like reloading/throwing a bomb/loading etc.. I'm not sure if the cracked version has removed the protection, but the original exe does have protection. |
Thanks, good to know.
@oLaudix
You can try setting a data breakpoint on the code's address and see what is reading it. Like here (though this article is for xlive, probably it will work similarly in your game too):
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles/243-xlive
If you have found the function which is reading the memory, you can try to disable it (or change it to "everything is ok" when it is checking the results).
_________________
|
|
| 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
|
|