new-instance v0, Landroid/app/AlertDialog$Builder;
invoke-direct {v0, p0}, Landroid/app/AlertDialog$Builder;-><init>(Landroid/content/Context;)V
const-string p0, "\u26a0 Make sure this mod apk file is safe \u26a0"
invoke-virtual {v0, p0}, Landroid/app/AlertDialog$Builder;->setTitle(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;
move-result-object v0
const-string p0, "This mod apk file is provided by GOUROV, only for sbenny.com users! If you downloaded it from other sources, please uninstall it immediately because it might damage your device as other sites inject malicious code to steal your personal information and data. Therefore visit sbenny.com to download the genuine mod apk file!"
invoke-virtual {v0, p0}, Landroid/app/AlertDialog$Builder;->setMessage(Ljava/lang/CharSequence;)Landroid/app/AlertDialog$Builder;
move-result-object v0
const-string p0, "Thanks \u263a"
const/4 p1, 0x0
invoke-virtual {v0, p0, p1}, Landroid/app/AlertDialog$Builder;->setPositiveButton(Ljava/lang/CharSequence;Landroid/content/DialogInterface$OnClickListener;)Landroid/app/AlertDialog$Builder;
const/4 p0, 0x0
invoke-virtual {v0, p0}, 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;
If it's Unity3d game then you will obviously find a UnityPlayerActivity.smali file. Open that file and try to find this line ...That's what I tried first, adding the dialog window, then I tried just a toast. Either modification led to the game shutting down as soon as it started. But LP patched it no prob. I was wondering if there is some check that it was failing, but now I am just trying to learn more forward engineering before I work on reverse engineering lol.
invoke-virtual {v0}, Lcom/unity3d/player/UnityPlayer;->requestFocus()Z
That did the trick! This should be added to the custom toast instructionsIf it's Unity3d game then you will obviously find a UnityPlayerActivity.smali file. Open that file and try to find this line ...
And try to add toast code or dialog code after this line.Java:invoke-virtual {v0}, Lcom/unity3d/player/UnityPlayer;->requestFocus()Z
It worked ? And What you mean by that " This should be added to the custom toast instructions" ?That did the trick! This should be added to the custom toast instructions
That thread is pretty outdated tbh .... Now we use improved method. We dont use either that one or this one.@Sbenny has a sticky post here to explain how to add a toast, dialog, or splash screen when modding a game, by putting the code at the start of the onCreate method. It appears that in this case that doesn't work, but putting the code after the requestFocus call did. I patched the game with LP, added a dialog and the game started up and played fine.