Tutorial How to create a Base64 customized Toast that bypasses smali Integrity Checker (no more crashes!)

NotAWeeb!

1/3 Games Approved
Original poster
Aug 31, 2023
202
33,162
1,193
japaneseland
So after a couple hours of investigating and getting help from ChatGPT's cuestionable smali coding skills, I was finally able to create a customizable and coloured toast that's hidden in Base64, and solved the unreasoned crash mystery that occurs when you add a customized toast at the main activity smali file.

You see, there's this simple ass il2cpp game that I modded in just a couple minutes, but wouldn't let me add a customized toast to UnityPlayerActivity.smali, but only a simple one. Every time I tried to add a coloured or custom toast smali code (like this one), made it crash since the start, with a depressive, pitch black screen that lasted up to 2 seconds. And y'know, I'm not one to settle with a simple ass toast that couldn't even be extended. So I challenged myself to make it work, whatever it would take.

Trying to find out the problem, I did a logcat of the app's crash and sent it to ChatGPT, to which it replied "Verifier rejected" was the cause, and further explaining to me that it had to do with some sort of Integrity Verification that this particular il2cpp game seems to have for the main activity smali file.

And then I came up with the idea of creating a separated .smali file, and starting it from the UnityPlayerActivity.smali.

So after intensive minutes of ChatGPT's coding and my immeasurable help of specific instructions, I finally got it to work.

I procceed to explain how to implement it to your games and have a customized, pretty cool way of getting your toasty credits. It's actually pretty easy.


[Requirements]

1. A functional brain.
2. Not being a leecher. Seriously.
3. Know how to follow instructions, and have some time to focus.
4. Basic smali knowledge / Good intuition
5. Your modded game*, decompiled.

*= Make sure you already modded the game properly and that it works fine before starting this tutorial, so if it somehow crashes, it has to do with the smali coding.


[Explanation]

– What are we exactly doing?

Creating a very customizable toast message to attribute you for your android mods, right when it is opened.
IMG_20231003_191149.jpg

Making a toast message with this method seems to be effective against the Integrity Checker for Smali that some games have. This Integrity Checker is responsible for the unexplainable crashes your modded game suffered when you added your toast code at MainActivity file. Yes, you're not alone in this

This one particular method is also effective at stopping leechers from changing your toast, as the Base64 encoding prevents them from searching the text of your message, and at the end, the separated smali file will be even more difficult for them. Though, it is not foolproof.

Yes, I know there's more effective methods to stop leechers. Please let me be xD


[Instructions]

1. Download the zip I'm providing you right below. It contains the smali file I created with a folder structure. Don't change it, just extract and don't touch.

Free download:
Hidden content
** You must be signed up and reply to the thread or click 'Like' under this post before you can see the hidden links contained here. **
If you still facing issues revealing the hidden links, please read this.
2. After that, find where your main activity smali file is, and take note of the path to it. Most of the time it is actually called "MainActivity.smali", or in Unity/il2cpp games, it is called "UnityPlayerActivity.smali". In my case, my main activity smali file was at "smali_classes6\com\unity3d\player\UnityPlayerActivity.smali".

If you don't know how to find it, check out this basic tutorial on smali toasts. When you learn, come back here.


3. After extracting the zip, copy the folder and paste it into the master folder your main activity is. In this case, mine is "smali_classes6", so I paste it there.

move files to main activity parent folder.gif

Make sure you do it from the "com" folder, so it keeps the folder structure and thus the smali code remains correct. If you've done it correctly, your smali "com" folder should now have a folder called "pm" in it, with the pm.smali inside, which is the toast message file.


4. Now it's time to change the message of your toast. For that, you first need to open this site. Then, open the toast file with notepad (pm.smali). Copy the default base64 message and decode it as shown in the GIF.

decode base64 message.gif


5. After decoding, you will see what the real message is and its format. Change it to whatever you want by copying the original text and changing it from there, with any customization you want. Encode it to base64 when you're finished. (Open Toast Customization Spoiler to understand the HTML code)

Default toast message:

Code:
<b><font color=#ffff00>Platinmods.com</font></b>
  • "<b></b>" is to bold the text.
  • "<font color=#ffff00></font>" is to change color of the message. Change the color by changing the hex code. Use this color picker

Make sure you put the message in between the HTML formatting brackets:

<font color=#ffff00>Just like this</font>
<b>Or like this</b>

There may be other HTML text formats that work for smali toasts, but I'll leave that experimenting up to you.


6. Now that you encoded your toast message to base64, paste it carefully, in the correct place, at pm.smali. Then save the file.


7. Almost there. Open your main activity smali file, and search for "onCreate". Then, paste the following line right after .locals:

Code:
invoke-static {p0}, Lcom/pm/pm;->showPM(Landroid/content/Context;)V
insert smali code at onCreate.gif

Btw, program used here is Notepad++. It's pretty good.


What this line does is basically call the pm.smali file, so your toast actually shows up.

If you want, you can add the line in between others (as long as it's in the same 'onCreate' method), so it isn't easily recognized, and leechers will have it even more difficult yet.


8. Done! Just recompile the APK and check the result by yourself.

If it doesn't compile and gives out an error, you probably messed up some part of the smali code or you didn't paste the file you downloaded properly. Decompile again (remember to backup the modded libs) and redo the steps carefully.

If it compiles, but the app crashes, it probably has to do with the main activity smali file. Put it after the onCreate .locals line or right before the end of the onCreate method (before return-void) and check if it works.

If you did everything correctly, the app should show your cool toast message right after opening it.


[Final notes]

I'm sharing this tutorial the same day I learned how to make it work, so I help some people out.

I will always be grateful to you, the Platinmods Community, for helping and inspiring me during these latest years of diving into the whole modding/game hacking world.

The modders from this site and its people are responsible of the most affection and passion I have for modding games.

This is not a farewell letter or anything like that, I didn't want to get sentimental either. I just want to mark a before and after, because I will now start modding games with the great purpose of sharing them with the people that was once like me, and follow the path of the modders that inspired me the most.

Anyways, hope this tutorial was helpful or interesting to see.

Take care. :pepe023:
 

JohnnyCappucino

Platinian
Aug 26, 2023
20
4
3
24
Sweden
Great tutorial, but you have mentioned in the thread about preventing leechers, well, a method to use base64 and implement it in your APK, is based on encrypting, you can easily encrypt base64 encoded texts with AES.
 
  • Like
Reactions: NotAWeeb!

NotAWeeb!

1/3 Games Approved
Original poster
Aug 31, 2023
202
33,162
1,193
japaneseland
Make sure you guys open the Spoilers! Most are representative GIFs on what to do. You'll save a lot of time and thinking :pepe020:

Why I chose to call the smali files 'pm'? It actually stands for PlatinMods, but no one other than us would know :pepe019:
 

NotAWeeb!

1/3 Games Approved
Original poster
Aug 31, 2023
202
33,162
1,193
japaneseland
Great tutorial, but you have mentioned in the thread about preventing leechers, well, a method to use base64 and implement it in your APK, is based on encrypting, you can easily encrypt base64 encoded texts with AES.
Taking notes :pepe019: I actually gotta learn more about encrypting modded stuff in general
 

AASIM_456

Support
Staff member
Support
Jan 18, 2023
738
33,198
1,193
a Sperm Cell
Also where can I learn smali ?? Coz I didn't found any like real course online or on yt ? And also upto what extent do I need to know java in order to understand and learn smali ??
 

NotAWeeb!

1/3 Games Approved
Original poster
Aug 31, 2023
202
33,162
1,193
japaneseland
Also where can I learn smali ?? Coz I didn't found any like real course online or on yt ? And also upto what extent do I need to know java in order to understand and learn smali ??
I actually don't know smali either, I know just basic stuff. I got the custom toast code from YouTube, then asked ChatGPT for some help to make it a separated smali file, and after troubleshooting and ChatGPT's coding, I got it to work, with almost none real coding by my part.

You just need to know how smali works, and ChatGPT is very good if you ask him to explain to you, and how to do this and that. Just make sure you don't ever reveal your real intentions (modding games) xD Just tell it you're developing an app or game, and that you need help with X thing of smali.

P.D: Read the Context of this thread on the Spoiler at the top of the thread. It won't dissapoint you XDD
 
  • Like
Reactions: AASIM_456

AASIM_456

Support
Staff member
Support
Jan 18, 2023
738
33,198
1,193
a Sperm Cell
I actually don't know smali either, I know just basic stuff. I got the custom toast code from YouTube, then asked ChatGPT for some help to make it a separated smali file, and after troubleshooting and ChatGPT's coding, I got it to work, with almost none real coding by my part.

You just need to know how smali works, and ChatGPT is very good if you ask him to explain to you, and how to do this and that. Just make sure you don't ever reveal your real intentions (modding games) xD Just tell it you're developing an app or game, and that you need help with X thing of smali.

P.D: Read the Context of this thread on the Spoiler at the top of the thread. It won't dissapoint you XDD
Yea I too use Chatgpt to check my code for errors lol 🤣🤣. Btw making spoilers in gif was awesome 😎😎👍