Help! Some basic modding questions

roflmao1337

Platinian
Original poster
Dec 26, 2018
14
2
3
37
Germany
Hello there,

I found this place while attempting to mod a game myself for the first time and so far I digged through alot of threads / videos.
However, I have some basic questions and it would be great if you could help me with them:

I want to mod an online game that was built in Unity and is a il2cpp filesystem.
So far I decompiled the apk with APK Easy Tool and used a Il2Cpp dumper to get a dumpfile that I can inspect.
I also used Dex2Jar and Jadx to view the Java code.

First question: what is the difference between the java code and the code thats in the libil2cpp.so file?
Why are there two different places with methods and classes?
It looks like I cant find the classes and methods of one of those places in the other one, too.
While the java has code like the MainActivity and purchase information, the libil2cpp.so file is where the sweet stuff seems to be located (gold, diamonds, combat information etc.)
So is the libil2cpp.so maybe just a mirror for the functions that are executed server-sided or why does it exsist?
And do I have to apply modifications to both places to make something actually work or is the libil2cpp.so sufficient?

Also the libil2cpp.so lacks context. It mostly consists of variable declaration & getter and setter for it. But I cant find code in it how and at what point these are actually executed.
Is there a way to attach something like a debugger to methods? or something as basic as a print function or a popup in game that appears once a certain method is called?

My goal in the end is not only to modify the game but I would also like to build a bot for it which does not use the GUI.
Something that follows simple commands in game like claim resources, do some daily quest etc.
Is that possible by modifying the game files? (code injection?) How would I do this?
Can I maybe write my own program that somehow uses the game as an API and executes code there?

Lastely, Im new to the modding scene so I still have to do alot by trial and error. However, each time I changed the libil2cpp.so file, so far I re-compile the app and install it to my emulator. It then updates to newest version of the game and then after like 5 mins I can finally test if my modification worked. Is there a quicker way?

Thanks alot in advance!
 
  • Like
Reactions: kkimkim

kp7742

Platinian
Oct 3, 2017
11
9
3
India
First of All you need to understand whats difference between Java and C/C++ programming Language. C/C++ are Converted to Native Machine Instruction of Processor, It is actually so fast and can take advantage of GPU and Other Peripherals. On Other Every Operating System and Even Android is based on This languages. Java is Virtual machine based language in our android special vm ART(Dalvik) is There to run code of this language and on pc you can find JVM for that purpose. Comparatively Java is Slower then C/C++ and Also Can't Connect to GPU and Other things Directly So it connect to C/C++ Code through bridge called JNI.

Android uses Java as Its Native language for Apps. Components like Notification, Context, Activity is actually made by in this Language and Other functionalities like GPS, Calling(Network), GPU is Provided through JNI. Now libil2cpp.so is component of Unity game engine which itself made in another language C#. Original Unity games also uses VM to run .dll files which you can find in some game this date. Now Unity also option to use il2cpp which actully convert this C# code into C++ code and combine core functions and remove unused things. this makes game alot faster to run.

This codes can't run alone on Android so they are wrap into Android apps thats why you can see java code also with this game codes. Context is Part Android System every Android App uses it for core functionality. libil2cpp is native code it won't need context thing untill you need to call Android java function through your C++ code again JNI will help here.

So insort, This games uses Java code for other functionalities like Payment System, Google Services etc. and Unity il2cpp contains Main game logic like how game gonna work, How player will looks like, how they will spawn and move and images, textures, cutscene etc.

In some games items quantity could be sync with Server, the value you are getting from function also got from server side. So they are validating any changes also in quantity of items. By modifing that getter or setter function will not work. Because server already have real value it processed.

You can attach debuggers to this Games. You can use gdb, lldb, IDA etc.. for debugging. Problem arises only when any game adds anti debugging.

Code injection is also possible you will able to find some tutorials on google and So you will able to call functions to do your task. Still it fully depends on your choice of game and its functions.

You can check Tutorial and Tools Section of this Website for more knowledge.

My Answer is Explaining everything from start, i might have forgot some points or done mistakes so if you find then please let me know about it.
 
  • Like
Reactions: kkimkim

roflmao1337

Platinian
Original poster
Dec 26, 2018
14
2
3
37
Germany
Ok thank you for making this more clear.

So far I found the basic methods to start the game in the java files, and the getter / setter for the resources in the libil2cpp. What Im still missing are triggers and the actual methods.

I suspect the java code invokes some resource file (maybe xml?) that has buttons with an onclick listener? Can I find that somewhere in the decompiled apk?

And lastly what I havent found yet are any methods other than getter and setter. I mean check functions with if and else, etc.
Are those all stored and executed on the server?

I know that modding an online game is not easy at all. So far I sucessfully modified some functions to change resources or conditions in the game. Unfortunately everytime I want to use them, the server knows the "real" value. So I dig and try to find a value / resource that is maybe generated clientside (something like a reward that is then send to the server).
Is there a recommended way to find out what is actually handled server side?