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 


Help with opcodes, please.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Discussions
View previous topic :: View next topic  
Author Message
Thiago
Newbie cheater
Reputation: 0

Joined: 30 Jan 2017
Posts: 13

PostPosted: Wed Aug 09, 2017 8:41 pm    Post subject: Help with opcodes, please. Reply with quote

I'm currently hacking a unity game and all I want to do is to call a function which opens the bank, pretty useful when farming items.

I can call it through Cheat Engine, just jitting the code using mono and looking at the instructions to find the call.

The function I jit calls the actual "show" function, so I allocate some memory and copy the call (__cdecl) with its opcode/address (0xDEADBEEF).

I just create a new thread from that code and it works like a charm, BUT, I don't want to keep opening the Cheat Engine to do it, neither create a thread all the time I need to open the bank through this call.

So I created a C++ Project to automate this, there's the problem, I got the compiled function address just as Cheat Engine does, but I can't copy the "show" function using memcpy or even memset, because when I allocate some memory to put the call in it, instead of copying the exact same function opcode (The Address) it takes the new memory allocated and calls the address relative to it.

This is the original code location:

0xDEADBEEF: E8 05000000 call 0xDEADBEF0 -> Show Bank
0xDEADBEF0:


I copied the memory address of it (0xDEADBEEF) and allocated some space to put the address in it, but I didn't find any way to copy a memory address directly, then I copied its bytes (E8 05000000) to the new location, now the bytes got copied, but the new location doesn't point anymore to 0xDEADBEEF, but instead it points to the new memory location which is a bunch of INT 3.

I hope I could explain it in a easy way.

In case you didn't understand what I want, I just want to allocate some space just like I did with Cheat Engine and put the same call which is in the jit to the memory allocated, but copying the bytes didn't solve.

_________________
I'm newbie ...
Back to top
View user's profile Send private message
Thiago
Newbie cheater
Reputation: 0

Joined: 30 Jan 2017
Posts: 13

PostPosted: Sat Aug 12, 2017 8:55 pm    Post subject: Reply with quote

Solution I came up with:


Code:


DWORD addr = 0xDEADBEEF;
   
   BYTE bytes[5];

   bytes[0] = 0x8E;
   bytes[1] = (addr & 0xFF000000) >> 24;
   bytes[2] = (addr & 0x00FF0000) >> 16;
   bytes[3] = (addr & 0x0000FF00) >> 8;
   bytes[4] = (addr & 0x000000FF);



Thanks for all the support from u guys!

_________________
I'm newbie ...
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 Discussions 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