Help! Help Hooking IL2CPP Methods

RedXen

Awesome Active Platinian
Original poster
Jul 8, 2021
106
1,849
193
Norway
Hi, everyone. I'm trying to hook an il2cpp method, i.e. Call it, but I'm unsure about how to do that.

For example, there is a method as shown:
demon1.png


What I would like to do is call the method 'AddRuby()' but I don't know how to call il2cpp methods. Can anyone help me out? Thanks!

The second example of a method, this time with parameters:
demon2.png
 
  • Like
Reactions: Cyber0860

Tiahh

Solid & Active Platinian
Jan 12, 2018
75
45
18
37
to call this function just set a function pointer:
C++:
void (*AddRuby)(void *instance) = (void (*)(void*))reBase(address);
Make sure to define the address only when the library is loaded.
So i suggest you to split the definition of the pointer.
 

RedXen

Awesome Active Platinian
Original poster
Jul 8, 2021
106
1,849
193
Norway
to call this function just set a function pointer:
C++:
void (*AddRuby)(void *instance) = (void (*)(void*))reBase(address);
Make sure to define the address only when the library is loaded.
So i suggest you to split the definition of the pointer.
Thanks for the reply! Appreciate it. Although, I haven’t really dabbled much in C++ yet, and I’m fairly new to hooking, so how would I go about loading this hook when a game is loaded? I’m more of a C# / Windows reverser myself.
 

Tiahh

Solid & Active Platinian
Jan 12, 2018
75
45
18
37
Thanks for the reply! Appreciate it. Although, I haven’t really dabbled much in C++ yet, and I’m fairly new to hooking, so how would I go about loading this hook when a game is loaded? I’m more of a C# / Windows reverser myself.
to check if a library is loaded just:
1) Create a new thread
2) inside the new thread just sleep until it doesn't find a new library. (Use the function provided from KittyMemory)
C++:
do {
    sleep(1);
} while(!isLibraryLoaded("libil2cpp.so"));
or use
C++:
while (!isLibraryLoaded("libil2cpp.so")) {
    sleep(1);
}
 

Raebydett

Awesome Active Platinian
Jan 20, 2020
171
60
28
G
I’m fairly new to hooking, so how would I go about loading this hook when a game is loaded?
Very sad so many tutorials in this website but ppl never actually read or explore them
 

RedXen

Awesome Active Platinian
Original poster
Jul 8, 2021
106
1,849
193
Norway
Very sad so many tutorials in this website but ppl never actually read or explore them
That’s very well and great until half of the steps of the tutorial are missing, and they reference libraries that aren’t even named. Yeah, thanks. Also, if you’re gonna be like that, don’t bother
 
  • Like
Reactions: Kaorin333

Raebydett

Awesome Active Platinian
Jan 20, 2020
171
60
28
G
steps of the tutorial are missing
What u mean missing? All there same like LGL template, its not just 1 link i send, alot more on tutorial sections. How abt u try use LGL template first and try error? You never know until u start using it
 

RedXen

Awesome Active Platinian
Original poster
Jul 8, 2021
106
1,849
193
Norway
What u mean missing? All there same like LGL template, its not just 1 link i send, alot more on tutorial sections. How abt u try use LGL template first and try error? You never know until u start using it
I’ve actually tried the LGL template before but for some reason the gradle build always fails? I’ve installed Android Studio and all required packages too
 

Raebydett

Awesome Active Platinian
Jan 20, 2020
171
60
28
G
I’ve actually tried the LGL template before but for some reason the gradle build always fails? I’ve installed Android Studio and all required packages too
Try template 2.9(my current one, didnt bother to use latest it just same anyway) or latest

AS sometime can be annoying, use cmd compile is much better
 

honykey

1/3 Games Approved
Jan 29, 2022
60
571
53
24
USA
Dont using this shit set player nickname by parameters, use CreateString.
 

Raebydett

Awesome Active Platinian
Jan 20, 2020
171
60
28
G
If you noob and dont know what to say, please dont say shit message
Noob ? So u assume i dont have "approve modder" tag means i dk shit ? Ive been releasing mod since 2018 and I dont have to post here bcs most of them share mod public here alrd shared it for me. Okay i admit im noob, knowledge is vast still learning until now

"Dont using this shit set player nickname by parameters, use CreateString."
Why dont u explain your statement here ? To do a mod with monoString ofcz u will need createstring for function pointers , it also can be done to any function type return or param
 

st4zk

Platinian
Jun 6, 2022
12
8
3
4837eK
to check if a library is loaded just:
1) Create a new thread
2) inside the new thread just sleep until it doesn't find a new library. (Use the function provided from KittyMemory)
C++:
do {
    sleep(1);
} while(!isLibraryLoaded("libil2cpp.so"));
or use
C++:
while (!isLibraryLoaded("libil2cpp.so")) {
    sleep(1);
}
How can i call multiple lib thread for kittymemory ?