| View previous topic :: View next topic |
| Author |
Message |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Thu Dec 04, 2008 4:52 pm Post subject: [C++] Pointers in inline asm |
|
|
When i'm trying to put a script from CE to a inline asm in C++ it's working perfectly unless the script contains pointers. I take an example script I'm trying to use:
| Code: | _declspec(naked) void UnlimitedAttack()
{
__asm
{
push ebx
push eax
mov eax,[0x00804FD4]
mov ebx,[eax+0x5F4]
inc ebx
mov eax,[eax+0x14B4]
cmp eax, 0x50
pop eax
cmovge eax,ebx
pop ebx
mov [ebx],eax
mov edi,[ebp+0x10]
jmp dwUnlimitedAttackRet
}
} | When this work properly it will move my char when the attack counter is at 80 (50 in hex) and then back again. But all this does when I activate it is to move me instantly and its like that until I turn it off. It gets like CSEAX X for those who played Maple. This script is working perfectly in CE but not here and I dont understand why :S. This only happens when there are pointers involved. My question is how to use pointers in inline asm, Any help is appreciated.
|
|
| Back to top |
|
 |
Fronzel Grandmaster Cheater Supreme
Reputation: 0
Joined: 07 Feb 2008 Posts: 1099 Location: Nexons backyard
|
Posted: Thu Dec 04, 2008 5:11 pm Post subject: |
|
|
My assembler isnt that good, but I am quite sure you need to define dwUnlimitedAttackRet before you can use it.
Not sure about c++ inline, but i would try to define it like this
| Code: | _dwUnlimitedAttackRet:
push blah blah
mov your code here blah blah |
_________________
|
|
| Back to top |
|
 |
BirdsEye Advanced Cheater
Reputation: 0
Joined: 05 Apr 2008 Posts: 94
|
Posted: Thu Dec 04, 2008 5:17 pm Post subject: |
|
|
| Fronzel wrote: | My assembler isnt that good, but I am quite sure you need to define dwUnlimitedAttackRet before you can use it.
Not sure about c++ inline, but i would try to define it like this
| Code: | _dwUnlimitedAttackRet:
push blah blah
mov your code here blah blah |
|
Here already has the DWORD define (DWORD dwUnlimitedAttackRet = . . .) or else it would give an error.
|
|
| Back to top |
|
 |
Fronzel Grandmaster Cheater Supreme
Reputation: 0
Joined: 07 Feb 2008 Posts: 1099 Location: Nexons backyard
|
Posted: Thu Dec 04, 2008 5:23 pm Post subject: |
|
|
Then the jump should work as its unconditional as far as i can see... =/
_________________
|
|
| Back to top |
|
 |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Thu Dec 04, 2008 5:32 pm Post subject: Re: [C++] Pointers in inline asm |
|
|
| TraxMate wrote: | When i'm trying to put a script from CE to a inline asm in C++ it's working perfectly unless the script contains pointers. I take an example script I'm trying to use:
| Code: | _declspec(naked) void UnlimitedAttack()
{
__asm
{
push ebx
push eax
mov eax,[0x00804FD4]
mov ebx,[eax+0x5F4]
inc ebx
mov eax,[eax+0x14B4]
cmp eax, 0x50
pop eax
cmovge eax,ebx
pop ebx
mov [ebx],eax
mov edi,[ebp+0x10]
jmp dwUnlimitedAttackRet
}
} | When this work properly it will move my char when the attack counter is at 80 (50 in hex) and then back again. But all this does when I activate it is to move me instantly and its like that until I turn it off. It gets like CSEAX X for those who played Maple. This script is working perfectly in CE but not here and I dont understand why :S. This only happens when there are pointers involved. My question is how to use pointers in inline asm, Any help is appreciated. |
C++ is a bit different than asm.
| Code: |
mov eax,[0x00804FD4]
mov eax,[eax]
mov ebx,[eax+0x5F4] |
will wwork.
_________________
|
|
| Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Thu Dec 04, 2008 6:14 pm Post subject: Re: [C++] Pointers in inline asm |
|
|
| kitterz wrote: | | TraxMate wrote: | When i'm trying to put a script from CE to a inline asm in C++ it's working perfectly unless the script contains pointers. I take an example script I'm trying to use:
| Code: | _declspec(naked) void UnlimitedAttack()
{
__asm
{
push ebx
push eax
mov eax,[0x00804FD4]
mov ebx,[eax+0x5F4]
inc ebx
mov eax,[eax+0x14B4]
cmp eax, 0x50
pop eax
cmovge eax,ebx
pop ebx
mov [ebx],eax
mov edi,[ebp+0x10]
jmp dwUnlimitedAttackRet
}
} | When this work properly it will move my char when the attack counter is at 80 (50 in hex) and then back again. But all this does when I activate it is to move me instantly and its like that until I turn it off. It gets like CSEAX X for those who played Maple. This script is working perfectly in CE but not here and I dont understand why :S. This only happens when there are pointers involved. My question is how to use pointers in inline asm, Any help is appreciated. |
C++ is a bit different than asm.
| Code: |
mov eax,[0x00804FD4]
mov eax,[eax]
mov ebx,[eax+0x5F4] |
will wwork. |
Or just do
| Code: | mov eax,dword ptr ds:[0x00804FD4]
mov ebx,[eax+0x5F4] |
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Fri Dec 05, 2008 8:03 am Post subject: Re: [C++] Pointers in inline asm |
|
|
| kitterz wrote: | C++ is a bit different than asm.
| Code: |
mov eax,[0x00804FD4]
mov eax,[eax]
mov ebx,[eax+0x5F4] |
will wwork. |
C++ is diffrent than ASM.
The inline asm isn't.
When you don't specify the size, the compiler ignores the brackets, it treats the opcode "mov reg32,val32" instead of "mov reg32,size seg:[val32]".
CE simply treat the value as the size of the register you're using, eax is a 32-bit register so it treats the value as a DWORD, you can simply write: "mov eax,dword ptr ds:[Address]", like smartz said.
|
|
| Back to top |
|
 |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Fri Dec 05, 2008 8:07 am Post subject: |
|
|
Nvm was something else this time.. but fixed it.
Last edited by TraxMate on Fri Dec 05, 2008 8:22 am; edited 2 times in total |
|
| Back to top |
|
 |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Fri Dec 05, 2008 8:13 am Post subject: Re: [C++] Pointers in inline asm |
|
|
| Symbol wrote: | | kitterz wrote: | C++ is a bit different than asm.
| Code: |
mov eax,[0x00804FD4]
mov eax,[eax]
mov ebx,[eax+0x5F4] |
will wwork. |
C++ is diffrent than ASM.
The inline asm isn't.
When you don't specify the size, the compiler ignores the brackets, it treats the opcode "mov reg32,val32" instead of "mov reg32,size seg:[val32]".
CE simply treat the value as the size of the register you're using, eax is a 32-bit register so it treats the value as a DWORD, you can simply write: "mov eax,dword ptr ds:[Address]", like smartz said. |
i see
_________________
|
|
| Back to top |
|
 |
TraxMate Master Cheater
Reputation: 0
Joined: 01 Mar 2008 Posts: 363
|
Posted: Fri Dec 05, 2008 8:24 am Post subject: |
|
|
It's working now Thx kitterz and smartz. And Symbol for giving that usefull information .
|
|
| Back to top |
|
 |
|