Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


translate ASM code to inline c++ ASM

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
0xCookies
How do I cheat?
Reputation: 0

Joined: 23 Mar 2015
Posts: 6

PostPosted: Mon Mar 23, 2015 1:13 pm    Post subject: translate ASM code to inline c++ ASM Reply with quote

In have to translate some ASM code from cheat engine to a c++ inline script.

Here is my standart AA script:


Code:

[ENABLE]
alloc(newmem,1000)
label(returnhere)
label(exit)
label(jump2)
label(multi)
registersymbol(jump2)

aobscan(aobi,8B 81 AC 00 00 00 89 E5)


multi:
dd (float)5


newmem:

fld dword [ecx+000000AC]      // fld, fadd and fstp doesn't seems like can
fadd dword [multi]//fmull         // be used in c++ inline asm.
fstp dword [ecx+000000AC]     //
mov eax,dword [ecx+000000AC] 

 //  [ecx+000000AC] -> AC gives a error in c++

mov [ecx+000000AC],eax


exit:
jmp returnhere

aobi:
jump2:
jmp newmem
nop
returnhere:

[DISABLE]
dealloc(newmem)
jump2:
db 8B 81 AC 00 00 00
unregistersymbol(jump2)


So here is what I'm trying to do, after I already nopped the address:
Code:


#define jmp(frm, to) (int)(((int)to - (int)frm) - 5);

void __declspec(naked) LeftPvacAsm() //inline ASM for Left Pvac
{
   
    __asm
    {

   label(multi) // doesn't work
                         //
   multi:         //
   dd (float)5  //

   fld dword [ecx+000000AC] //fld doesn't exists
fadd dword [multi]    //fadd doesn't exists and [multi] doesn't work         


        fstp dword [ecx+000000AC] //fstp doesn't exists
   mov eax,dword [ecx+000000AC] //same here

   mov [ecx+000000AC],eax //same here
    }
}



Does anyone know how to handle that?
Back to top
View user's profile Send private message
justa_dude
Grandmaster Cheater
Reputation: 23

Joined: 29 Jun 2010
Posts: 893

PostPosted: Mon Mar 23, 2015 7:43 pm    Post subject: Reply with quote

I think you should start by coding some very simple examples of inline ASM to get the hang of the conventions - which instructions are available vs those that are exclusive to CE, whether or not to end statements w/ semicolons, etc. That is, if inline ASM is even what you really need...

I can't think of too many valid reasons to declare a function to have naked calling convention. Especially when your function takes no arguments.

Are you compiling this into a DLL to be injected into the target process, or is it intended to be a conventional trainer? Either way, I don't think you're on the right path. Could you maybe explain what your algorithm is or the steps your program intends to take?

_________________
A nagy kapu mellett, mindig van egy kis kapu.
----------------------
Come on...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites