An enum, short for enumeration, is a data type used in programming languages like C++, C#, Java, and others. It’s a way to define a set of named constants, making code more readable and maintainable by assigning a name to each constant value.
In game development, enums are often used to represent things like different player states (such as idle, walking, running), various game levels, types of enemies, or different actions a character can take. They allow developers to create a list of options that can be easily referenced and used throughout the code without having to remember or manually input the numeric values associated with each option.
For example, in C++:
enum class PlayerState {
Idle,
Walking,
Running,
Jumping
};
// Using the enum
PlayerState currentState = PlayerState::Walking;
if (currentState == PlayerState::Running) {
// Perform actions for running state
}
Using enums makes the code more understandable and reduces the chances of errors that might occur if numeric values were used directly.
Let’s Begin
Important! Before we begin please make sure you know the basics like dumping the il2cpp game, and modding il2cpp games. The tutorial links are given below
In today’s tutorial we will be modding a game called LOVE SICK by SWAG MASHA, i will show the enums and how they can be modified in the game in order to change the way the game works.
1) Download the APK File from https://apk.support/apk-downloader
2) Make sure the settings are as follows, since we need to download the armeabi-v7a version. Click on MERGE APK so it can merge the split apk to single APK for you.
3) Once downloaded, move the APK file to the il2cppDumper folder and DUMP it.
4) Load the files inside DNSPY and now we will search for method that uses an enum.
So after searching for a while, i found this method called GetRewardType which is inside a class called QuickTimeAdsEventProxy and returns a value of the RewardType enum. So now we will check the “enum constants” inside the RewardType enum.
5) So we found these “enum constants” inside it.
So from the screenshot above we can see that it has a bunch of enum constant like choice tickets, diamonds, keys, etc so what i am assuming is that the class QuickTimeAdsEventProxy must be some rewarded ads type event in the game where you get rewarded for watching ads or doing some activity. In general all games would have something like this, but it could be different. For example: we can have an enum called ENEMY with enum constant like IDLE, WALKING, ATTACKING, DEAD etc. If we return DEAD then you can have instant win that way since the method will return the value of the enum class that we have provided which is DEAD.
But for this tutorial we could change the reward type to Diamonds, so we get diamonds each time and nothing else. So in order to do that we have to see the number assigned to the enum constant.
From what we can see from the screenshot above the enum constant called diamonds is assigned the value of 1 to it.
6) So in order to always get diamond rewards what we can do is get the offset of the method GetRewardType which is 0x73566C and return 1 to it.
7) Load the libil2cpp.so file in HEX Editor and press CTRL + G enter 0x73566C and press enter to go the address.
Now highlight the HEX code and press CTRL + SHIFT +V to paste and replace it with the value 1 which is 01 00 A0 E3 1E FF 2F E1
8) Now Press CTRL + S to save it and replace the libil2cpp.so file back in its folder, then sign the APK file. Now when you play the game and you perform the task of watching ads or whatever the case it was, the reward will always be Diamonds.
All Enum Constant will have different values but numbers, 1,2,3,4,5 and you just have to replace it with the correct value of the enum constant, For example: If we wanted Keys only, and the value of the Enum Constant “Keys” was 3 then we would return 03 00 A0 E3 1E FF 2F E1 which is number 3.
Similarly other games will have different enums, you have to find the correct ones to MOD.
That’s it!
I hope you learned something new today, if you have any questions then feel free to comment below and i will try my best to answer it and help you out.