- Gender
- Male
- Device
- Honor Magic5 Lite - Android 13
- Country
- Sbennytopia
Hello guys,
if you're wondering how to add a custom toast (see spoiler):
or custom splash screen (see spoiler):
for your hacked game, you came to the right place!
In this very simple tutorial I will show you how to do it!
Toast messages are not the simplest ones, especially if you're not used to decompile apk files and browse the smali folder, but I'll make it very simple and try to explain you in simple words.
We will modify a particular file inside the smali folder which is loaded at the moment we launch a game and we will tell this file to show a toast message.
First of all we need to see if it's a Unity3D-based game or not. How? Simple. If the .apk game has got the following path:
then YES, this game is a UNITY 3D-based game.
Steps are:
1) Grab the apk (of course)
2) Decompile the apk file (I personally use apktool, but there are many alternatives on the net, so find the most suitable for you).
If using APKTOOL:
a) Move the .apk file inside the root of the apktool (same path where the apktool.jar file is);
b) Right click+shift and select "Open Command Prompt here";
c) Type:
Quotes are needed almost always, I'll make it short so I suggest you guys to ALWAYS put quotes ( " " ) before and after the name of the apk file. Replace "name of the game" with the name of the apk file.
A new folder will be generated in the same directory of the .apk file and it will be called "name of the game". Open it.
3) Find the right path
Go to: "/name of the game/smali/com/unity3d/player/"
4) Dealing with the right file
Open the file "UnityPlayerActivity.smali" (I suggest Notepad++, a very good tool to read countless file extensions)
5) Search the right line
Press Ctrl+F (Search) and look for .method protected onCreate(Landroid/os/BundleV
Only a result should come.
Now watch the following two lines. It should look like:
the .locals 2 can be .locals 3 or .locals 4 etc, no matter the number.
If you don't see the .prologue, just add it before the .locals like in the above screenshot, or ignore it, it's not a requirement.
Now the cool part, adding the Toast!
6) Add the Toast
Copy the following:
This code will load and display the Toast message every time you launch the app. Of course, replace "YOUR_USERNAME_HERE" with your real username.
Now, paste it right after the .locals and another blank line.
Final code should look like the following:
TIP : Repeating the above code will increase the lenght of your Toast Message. I don't personally suggest using the code more than 2 times since it's quite annoying to see a toast message for over 10 seconds.
7) Saving Changes
Once done, save the file and recompile the apk file by typing (in the command prompt):
8) Sign the apk using your favourite tool (I use this one, called one_click_signer)
9) Launch the game
If you correctly followed the above steps, launch the game and you should finally see:
1) Grab the apk (of course)
2) Decompile the apk file (I personally use apktool, but there are many alternatives on the net, so find the most suitable for you).
If using APKTOOL:
a) Move the .apk file inside the root of the apktool (same path where the apktool.jar file is);
b) Right click+shift and select "Open Command Prompt here";
c) Type:
Quotes are needed almost always, I'll make it short so I suggest you guys to ALWAYS put quotes ( " " ) before and after the name of the apk file. Replace "name of the game" with the name of the apk file.
A new folder will be generated in the same directory of the .apk file and it will be called "name of the game". Open it.
3) Find the right path
• Open the file "AndroidManifest.xml" you'll find in the decompiled apk folder, and search for: "android:name="android.intent.action.MAIN"
• Scroll up a few lines until you find, in the previous "<activity>" group the last occurrence of "android:name=" . Inside the quotation marks, you will find a code like the following:
In this example it's "com.my.ifly.StartActivity" but it changes with every game.
• Convert the code into a readable path
This is easier than it sounds. If we follow the example above, we'll have to replace all the points with the slash symbol and append ".smali" at the end of it, so:
com.my.ifly.StartActivity
becomes
com/my/ifly/StartActivity.smali
This is the path we should search for in order to find the right file to put our toast message in, so we move into:
smali/com/ifly/StartActivity.smali in order to find the right file
Notes: sometimes, you might need to open the "smali_classesX" (where X is a number) if you can't find the full path in the "smali" folder (and if smali_classesX folders exist), so it'd be, for example: smali_classes2/com/ifly/StartActivity.smali
4) Dealing with the right file
Now that we found the right file to work with, let's open it! In our example, it's "StartActivity.smali" (I suggest to open it using Notepad++, a very good tool to read and work with countless file extensions).
5) Search the right line
Press Ctrl+F (Search) and look for .method protected onCreate(Landroid/os/BundleV (if you can't find the exact line, search for "onCreate", making sure you'll find a line which starts with ".method" and which has only "onCreate" as name, and not InvokeOnCreate or similar different names).
Only a result should come.
Now watch the following two lines. It should look like:
the .locals 2 can be .locals 3 or .locals 4 etc, no matter the number.
If you don't see the .prologue, just add it before the .locals like in the above screenshot.
Now the cool part, adding the Toast!
6) Add the Toast
Copy the following:
This code will load and display the Toast message every time you launch the app. Of course, replace "YOUR_USERNAME_HERE" with your real username.
Now, paste it right after the .locals and another blank line.
Final code should look like the following:
TIP : Repeating the above code will increase the lenght of your Toast Message. I don't personally suggest using the code more than 2 times since it's quite annoying to see a toast message for over 10 seconds.
7) Saving Changes
Once done, save the file and recompile the apk file by typing (in the command prompt):
8) Sign the apk using your favourite tool (I use this one, called one_click_signer)
9) Launch the game
If you correctly followed the above steps, launch the game and you should finally see the toast message added!
PRO TIPS:
• A Toast isn't the only thing you can add in that location. A good alternative is called "Dialog", which is composed by a Title, a Message and one (or more) buttons inside a system window. In order to add it, you just have to past this other code (instead of the toast), replacing the " ### PUT YOUR USERNAME HERE ### " with your username, of course.
• There's always a similar distance between the " android:name="android.intent.action.MAIN " line and the toast/dialog path in the AndroidManifest.xml file. Once you get used to it, you'll no longer need to use the Search to find them
• OnCreate could sometimes call other functions, you'll find out by reading what the OnCreate function actually does, if it invokes another "onCreate" inside it, and the toast/dialog isn't showing, it would be a good idea to look into the other file invoked
Splash Screens are called this way because of the file named "Splash.png" we will modify.
These kind of images can be only found inside Unity3D-based games (again) but this time it's an easier process.
Again, we need to ensure the game is a Unity3D-based game or not. So look for the following path:
otherwise, it means this is not a Unity 3D game.
Steps are:
1) Grab the apk (of course)
2) Rename the file extension from .apk to .zip (or Right click on the .apk file and select "Open With..." and choose "WinRar" and if not installed, search on Google or use this link for the x64 version or this link to download WinRar x32, if you're on Windows).
3) Find the right path
Go to: "/Assets/bin/Data/" if not present, you're not dealing with a Unity3D game.
4) Dealing with the right file
Take the file "Splash.png" out from the .zip file and move it to an easy-to-find path (I'm used to put all my hacks into the same folder).
TIP: It's usually one of the latest files in the "Data" folder, so you can directly scroll down till the end and you should find it.
TIP 2: on newer Unity Games, you might not found Splash.png in that location. If this is the case, you have 50% chance to find it in the following path: res/drawable/unity_static_splash.png. If you find it, just replace the unity_static_splash.png with your image (make sure it's called unity_static_splash.png). If you can't find it, I'm sorry but it means the game doesn't use Unity splashes and you shouldn't be able to add a splash screen for this game (you can still add a toast/dialog).
4.5) Backup (optional)
I suggest you guys making a copy of the original png image since sometimes this method doesn't work and could make the app crash (altough it's a very very rare occurrence).
5) Modify the image
I personally use Photoshop and never had any problems. I've heard about people having problems using Paint, so I suggest you guys to use Photoshop to make changes.
Edit the pic as your wish, add text, images or what you want. I don't personally suggest to change the image width/height.
6) Save the pic
With Photoshop go to File -> Save for Web and choose if PNG-8 (low quality but lower file size. Useful if you want to decrease the .apk file size) or PNG-24 (higher quality, better transparency but high file size. If you only mind about quality, go for it) and save it.
7) Moving it back
Once done, move it back to "Assets/bin/Data/" (or "res/drawable" if you're dealing with unity_static_splash.png) replacing the old one.
8) Renaming the file back to .apk
If you changed the extension to .zip, it's time to change it back to .apk
9) Sign the apk (optional) and Launch the game
The .apk file will be now UNSIGNED. This means you'd need root privileges and Lucky Patcher installed in order to install the app, otherwise you can simply sign it using your favourite tool (I use "One Click Signer"). Now, launch the game and, if everything goes fine, you should see a result like this:
For any feedbacks and questions, don't hesitate to reply below. Hope it helps
if you're wondering how to add a custom toast (see spoiler):
or custom splash screen (see spoiler):
for your hacked game, you came to the right place!
In this very simple tutorial I will show you how to do it!
TOAST MESSAGES - 90% OF UNITY 3D GAMES
Toast messages are not the simplest ones, especially if you're not used to decompile apk files and browse the smali folder, but I'll make it very simple and try to explain you in simple words.
We will modify a particular file inside the smali folder which is loaded at the moment we launch a game and we will tell this file to show a toast message.
First of all we need to see if it's a Unity3D-based game or not. How? Simple. If the .apk game has got the following path:
Code:
/Assets/bin/Data/Managed/
Steps are:
1) Grab the apk (of course)
2) Decompile the apk file (I personally use apktool, but there are many alternatives on the net, so find the most suitable for you).
If using APKTOOL:
a) Move the .apk file inside the root of the apktool (same path where the apktool.jar file is);
b) Right click+shift and select "Open Command Prompt here";
c) Type:
Code:
apktool d "name of the game.apk"
A new folder will be generated in the same directory of the .apk file and it will be called "name of the game". Open it.
3) Find the right path
Go to: "/name of the game/smali/com/unity3d/player/"
4) Dealing with the right file
Open the file "UnityPlayerActivity.smali" (I suggest Notepad++, a very good tool to read countless file extensions)
5) Search the right line
Press Ctrl+F (Search) and look for .method protected onCreate(Landroid/os/BundleV
Only a result should come.
Now watch the following two lines. It should look like:
the .locals 2 can be .locals 3 or .locals 4 etc, no matter the number.
If you don't see the .prologue, just add it before the .locals like in the above screenshot, or ignore it, it's not a requirement.
Now the cool part, adding the Toast!
6) Add the Toast
Copy the following:
Code:
const/4 v0, 0x1
const-string v1, "Hacked by YOUR_USERNAME_HERE \r\n Find us at forum.sbenny.com"
invoke-static {p0, v1, v0}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;
move-result-object v0
invoke-virtual {v0}, Landroid/widget/Toast;->show()V
Now, paste it right after the .locals and another blank line.
Final code should look like the following:
TIP : Repeating the above code will increase the lenght of your Toast Message. I don't personally suggest using the code more than 2 times since it's quite annoying to see a toast message for over 10 seconds.
7) Saving Changes
Once done, save the file and recompile the apk file by typing (in the command prompt):
Code:
apktool b "name of the folder"
9) Launch the game
If you correctly followed the above steps, launch the game and you should finally see:
TOAST MESSAGES - 10% OF UNITY GAMES AND EVERY NON-UNITY GAME
The process is similar:
1) Grab the apk (of course)
2) Decompile the apk file (I personally use apktool, but there are many alternatives on the net, so find the most suitable for you).
If using APKTOOL:
a) Move the .apk file inside the root of the apktool (same path where the apktool.jar file is);
b) Right click+shift and select "Open Command Prompt here";
c) Type:
Code:
apktool d "name of the game.apk"
A new folder will be generated in the same directory of the .apk file and it will be called "name of the game". Open it.
3) Find the right path
• Open the file "AndroidManifest.xml" you'll find in the decompiled apk folder, and search for: "android:name="android.intent.action.MAIN"
• Scroll up a few lines until you find, in the previous "<activity>" group the last occurrence of "android:name=" . Inside the quotation marks, you will find a code like the following:
In this example it's "com.my.ifly.StartActivity" but it changes with every game.
• Convert the code into a readable path
This is easier than it sounds. If we follow the example above, we'll have to replace all the points with the slash symbol and append ".smali" at the end of it, so:
com.my.ifly.StartActivity
becomes
com/my/ifly/StartActivity.smali
This is the path we should search for in order to find the right file to put our toast message in, so we move into:
smali/com/ifly/StartActivity.smali in order to find the right file
Notes: sometimes, you might need to open the "smali_classesX" (where X is a number) if you can't find the full path in the "smali" folder (and if smali_classesX folders exist), so it'd be, for example: smali_classes2/com/ifly/StartActivity.smali
4) Dealing with the right file
Now that we found the right file to work with, let's open it! In our example, it's "StartActivity.smali" (I suggest to open it using Notepad++, a very good tool to read and work with countless file extensions).
5) Search the right line
Press Ctrl+F (Search) and look for .method protected onCreate(Landroid/os/BundleV (if you can't find the exact line, search for "onCreate", making sure you'll find a line which starts with ".method" and which has only "onCreate" as name, and not InvokeOnCreate or similar different names).
Only a result should come.
Now watch the following two lines. It should look like:
the .locals 2 can be .locals 3 or .locals 4 etc, no matter the number.
If you don't see the .prologue, just add it before the .locals like in the above screenshot.
Now the cool part, adding the Toast!
6) Add the Toast
Copy the following:
Code:
const/4 v0, 0x1
const-string v1, "Hacked by YOUR_USERNAME_HERE \r\n Find us at forum.sbenny.com"
invoke-static {p0, v1, v0}, Landroid/widget/Toast;->makeText(Landroid/content/Context;Ljava/lang/CharSequence;I)Landroid/widget/Toast;
move-result-object v0
invoke-virtual {v0}, Landroid/widget/Toast;->show()V
Now, paste it right after the .locals and another blank line.
Final code should look like the following:
TIP : Repeating the above code will increase the lenght of your Toast Message. I don't personally suggest using the code more than 2 times since it's quite annoying to see a toast message for over 10 seconds.
7) Saving Changes
Once done, save the file and recompile the apk file by typing (in the command prompt):
Code:
apktool b "name of the folder"
9) Launch the game
If you correctly followed the above steps, launch the game and you should finally see the toast message added!
PRO TIPS:
• A Toast isn't the only thing you can add in that location. A good alternative is called "Dialog", which is composed by a Title, a Message and one (or more) buttons inside a system window. In order to add it, you just have to past this other code (instead of the toast), replacing the " ### PUT YOUR USERNAME HERE ### " with your username, of course.
Code:
new-instance v0, Landroid/app/AlertDialog$Builder;
invoke-direct {v0, p0}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V
const-string v1, "\uD83D\uDD14 Make sure this app is safe \uD83D\uDD14"
invoke-virtual {v0, v1}, Landroid/app/AlertDialog$Builder;->setTitle(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;
move-result-object v0
const-string v1, "This mod apk file is provided by ### PUT YOUR USERNAME HERE ###, only for Sbenny.com users! If you downloaded it from other sources, please uninstall it immediately because it will damage your device as other sites inject malicious code, and visit sbenny.com to download the genuine mod apk file!"
invoke-virtual {v0, v1}, Landroid/app/AlertDialog$Builder;->setMessage(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;
move-result-object v0
const-string v1, "I downloaded it at Sbenny.com \u263a"
const/4 v2, 0x0
invoke-virtual {v0, v1, v2}, Landroid/app/AlertDialog$Builder;->setPositiveButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;
const/4 v1, 0x0
invoke-virtual {v0, v1}, Landroid/app/AlertDialog$Builder;->setCancelable(Z)Landroid/app/AlertDialog$Builder;
move-result-object v0
invoke-virtual {v0}, Landroid/app/AlertDialog$Builder;->show()Landroid/app/AlertDialog;
• OnCreate could sometimes call other functions, you'll find out by reading what the OnCreate function actually does, if it invokes another "onCreate" inside it, and the toast/dialog isn't showing, it would be a good idea to look into the other file invoked
CUSTOM SPLASH SCREENS - UNITY 3D GAMES
Splash Screens are called this way because of the file named "Splash.png" we will modify.
These kind of images can be only found inside Unity3D-based games (again) but this time it's an easier process.
Again, we need to ensure the game is a Unity3D-based game or not. So look for the following path:
Code:
/Assets/bin/Data/Managed/
Steps are:
1) Grab the apk (of course)
2) Rename the file extension from .apk to .zip (or Right click on the .apk file and select "Open With..." and choose "WinRar" and if not installed, search on Google or use this link for the x64 version or this link to download WinRar x32, if you're on Windows).
3) Find the right path
Go to: "/Assets/bin/Data/" if not present, you're not dealing with a Unity3D game.
4) Dealing with the right file
Take the file "Splash.png" out from the .zip file and move it to an easy-to-find path (I'm used to put all my hacks into the same folder).
TIP: It's usually one of the latest files in the "Data" folder, so you can directly scroll down till the end and you should find it.
TIP 2: on newer Unity Games, you might not found Splash.png in that location. If this is the case, you have 50% chance to find it in the following path: res/drawable/unity_static_splash.png. If you find it, just replace the unity_static_splash.png with your image (make sure it's called unity_static_splash.png). If you can't find it, I'm sorry but it means the game doesn't use Unity splashes and you shouldn't be able to add a splash screen for this game (you can still add a toast/dialog).
4.5) Backup (optional)
I suggest you guys making a copy of the original png image since sometimes this method doesn't work and could make the app crash (altough it's a very very rare occurrence).
5) Modify the image
I personally use Photoshop and never had any problems. I've heard about people having problems using Paint, so I suggest you guys to use Photoshop to make changes.
Edit the pic as your wish, add text, images or what you want. I don't personally suggest to change the image width/height.
6) Save the pic
With Photoshop go to File -> Save for Web and choose if PNG-8 (low quality but lower file size. Useful if you want to decrease the .apk file size) or PNG-24 (higher quality, better transparency but high file size. If you only mind about quality, go for it) and save it.
7) Moving it back
Once done, move it back to "Assets/bin/Data/" (or "res/drawable" if you're dealing with unity_static_splash.png) replacing the old one.
8) Renaming the file back to .apk
If you changed the extension to .zip, it's time to change it back to .apk
9) Sign the apk (optional) and Launch the game
The .apk file will be now UNSIGNED. This means you'd need root privileges and Lucky Patcher installed in order to install the app, otherwise you can simply sign it using your favourite tool (I use "One Click Signer"). Now, launch the game and, if everything goes fine, you should see a result like this:
For any feedbacks and questions, don't hesitate to reply below. Hope it helps
Last edited: