View previous topic :: View next topic |
Author |
Message |
Qvintus Cheater Reputation: 0
Joined: 07 Nov 2013 Posts: 32
|
Posted: Mon Jun 30, 2014 7:51 am Post subject: How do I check if the register is a certain hex value ? |
|
|
I'm quite lost on what I've done wrong here, trying to make this simple script for Castle Crashers, but my asm code just won't execute as I want it to.
Note: this is just a temp script to test with.
Code: |
[ENABLE]
//code from here to '[DISABLE]' will be used to enable the cheat
alloc(newmem,2048)
label(returnhere)
label(originalcode)
label(exit)
newmem:
cmp [esi],0642BCE0 //Does the ESI register contain the address/hex value "0642BCE0"
jne originalcode
mov [esi+08],15F90
mov al,01
jmp returnhere
originalcode:
mov [esi+08],eax
mov al,01
exit:
jmp returnhere
"castle.exe"+4D58F:
jmp newmem
returnhere:
[DISABLE]
//code from here till the end of the code will be used to disable the cheat
dealloc(newmem)
"castle.exe"+4D58F:
mov [esi+08],eax
mov al,01
//Alt: db 89 46 08 B0 01 |
Also I'm sure the esi register contains what I want but it completely ignores my own code.
Code: |
00F40006 - 0F85 07000000 - jne 00F40013
00F4000C - C7 46 08 905F0100 - mov [esi+08],00015F90
00F40013 - 89 46 08 - mov [esi+08],eax <<
00F40016 - B0 01 - mov al,01
00F40018 - E9 77D50700 - jmp castle.exe+4D594
EAX=00000028
EBX=05E1F220
ECX=00000001
EDX=00000020
ESI=0642BCE0 << YES it does contain it but clearly it doesn't use my code but rather the original code.
EDI=06299BF0
ESP=0016F4F8
EBP=0016F520
EIP=00F40016
|
So really all I wanna know is why doesn't it execute my own code when the esi clearly contain what I want. Meaning it should execute my code then return.
Code: |
mov [esi+08],15F90
mov al,01
jmp returnhere |
Last edited by Qvintus on Mon Jun 30, 2014 9:11 am; edited 1 time in total |
|
Back to top |
|
|
Rissorr Master Cheater Reputation: 3
Joined: 17 Sep 2013 Posts: 273 Location: Israel!
|
Posted: Mon Jun 30, 2014 8:36 am Post subject: |
|
|
Im not so understand your "target" of the script, but i will try to help...
in your code:
Code: | newmem:
cmp [esi],0642BCE0 <--- *
jne originalcode
mov [esi+08],15F90
mov al,01
jmp returnhere |
* you are comparing:
the value that stored in ESI to the value 0642bce0
if you want to compare [esi+4] (the value that stored in ESI address + 4 in hex)
so you need to do
Code: | cmp [esi+4],0642BCE0 |
|
|
Back to top |
|
|
Qvintus Cheater Reputation: 0
Joined: 07 Nov 2013 Posts: 32
|
Posted: Mon Jun 30, 2014 9:07 am Post subject: |
|
|
That is not what I asked, I asked how I can check whether ESI is containing the address/hex value "0642BCE0" or not.
If it's not equal it should jump to the originalcode, and otherwise if equal use my code.
I don't want to check what value the address is containing but rather what the ESI register is containing.
|
|
Back to top |
|
|
Geri Moderator Reputation: 111
Joined: 05 Feb 2010 Posts: 5636
|
Posted: Mon Jun 30, 2014 10:28 am Post subject: |
|
|
Remove the bracket from esi. It should be cmp esi, not cmp [esi].
_________________
|
|
Back to top |
|
|
Qvintus Cheater Reputation: 0
Joined: 07 Nov 2013 Posts: 32
|
Posted: Mon Jun 30, 2014 12:12 pm Post subject: |
|
|
Wao it's amazing how little needed fixing... I was sure I had tried that once, but I've probably made extra changes I was unaware had effects.
Thanks a lot!
Seems I should actually sit down and read some more about Assembly if it's the small things now that is pestering me.
Again Thank a lot for all the help, not only this thread, but in general this forum just have a overflow of helping hands
|
|
Back to top |
|
|
|