Skip to content

Commit

Permalink
3.1
Browse files Browse the repository at this point in the history
3.1
- Moved onStartCommand from Menu to Launcher, so the Service doesnt try to recreate itself when the App is closed
- Removed useless code
- Alert Dialog is now using default layout
- Fixed Alert Dialog so it does not crash
- Added CrashHandler. Logs will be saved on /storage/emulated/0/Documents for Android 10 and above and /storage/emulated/0/Android/data/(package name)/ for Android 9 and below. Currently it does not catch native crashes if lib crashed
- Added get_device_api_level_inlines.h because AIDE does not have it. Needed to get SDK version
- Collapse can be expanded by default

Android Studio may show some syntax errors, just ignore as long as it can compile
  • Loading branch information
LGLTeam committed Feb 4, 2022
1 parent e235d57 commit 580cd06
Show file tree
Hide file tree
Showing 10 changed files with 385 additions and 139 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ Floating mod menu for il2cpp and other native android games. KittyMemory, MSHook

Support Android 4.4.x up to Android S Preview. ARMv7, x86 and ARM64 architecture supported.

# Preview

![](https://i.imgur.com/zeumkBG.gif)

# Known bug
Expand All @@ -17,11 +15,23 @@ Download this repo as ZIP, or clone using any git tools

Or download Releases here https://github.com/LGLTeam/Android-Mod-Menu/releases

# Get started
# Getting started
**Go to this Wiki page to start reading:**

https://github.com/LGLTeam/Android-Mod-Menu/wiki

# Help, Support, FAQ

See: [Frequently Asked Questions (FAQ)](https://github.com/LGLTeam/Android-Mod-Menu/wiki/FAQ) where common questions are answered.

If you have installation or usage problems, try asking your questions on the forum sites, [Platinmods](https://platinmods.com/forums/modding-questions-discussions.11/), or [UnknownCheats](https://www.unknowncheats.me/forum/android/) or others.

For example, if you have an issue with Hooking and game crashes, you should go to the **support forums**. Here there are no teachers who can help you with such issues.

Issues are disabled permanently due to peoples who have no mind (mostly newbies) aren't even able to fill proper issue templates nor are they able to read the instructions. I get so many useless issues, even useless pull-requests.

As a result, the contact infomation has been removed as well. However you can find me in our Telegram channel. I will only talk to peoples who are very skilled, have proper brain and have patience! I will BLOCK if I feel like you are annoying, disrespectful and acting like a kid

# Credits
Thanks to the following individuals whose code helped me develop this mod menu

Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ android {
minSdkVersion 19
targetSdkVersion 32
versionCode 1
versionName "3.0"
versionName "3.1"
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86'
}
Expand Down
144 changes: 144 additions & 0 deletions app/src/main/java/com/android/support/CrashHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
//Credit: Raunak Mods - https://t.me/raunakmods786

package com.android.support;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Application;
import android.content.ActivityNotFoundException;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.text.Html;
import android.text.InputFilter;
import android.text.InputType;
import android.text.TextUtils;
import android.text.method.DigitsKeyListener;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.Thread.UncaughtExceptionHandler;
import java.text.SimpleDateFormat;
import java.util.Date;

public final class CrashHandler {

public static final UncaughtExceptionHandler DEFAULT_UNCAUGHT_EXCEPTION_HANDLER = Thread.getDefaultUncaughtExceptionHandler();

public static void init(final Context app, final boolean overlayRequired) {
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {

@Override
public void uncaughtException(Thread thread, Throwable throwable) {
Log.e("AppCrash", "Error just lunched ");
try {
tryUncaughtException(thread, throwable);
} catch (Throwable e) {
e.printStackTrace();
if (DEFAULT_UNCAUGHT_EXCEPTION_HANDLER != null)
DEFAULT_UNCAUGHT_EXCEPTION_HANDLER.uncaughtException(thread, throwable);
else
System.exit(2);
}
}

private void tryUncaughtException(Thread thread, Throwable throwable) {
Log.e("AppCrash", "Try saving log");

final String time = new SimpleDateFormat("yyyy_MM_dd-HH_mm_ss").format(new Date());
String fileName = "mod_menu_crash_" + time + ".txt";
String dirName;

if (Build.VERSION.SDK_INT >= 30) { //Android R. AIDE didn't support Build.VERSION_CODES.R
dirName = "/storage/emulated/0/Documents/";
} else {
dirName = String.valueOf(app.getExternalFilesDir(null));
}

File crashFile = new File(dirName, fileName);

String versionName = "unknown";
long versionCode = 0;
try {
PackageInfo packageInfo = app.getPackageManager().getPackageInfo(app.getPackageName(), 0);
versionName = packageInfo.versionName;
versionCode = Build.VERSION.SDK_INT >= 28 ? packageInfo.getLongVersionCode()
: packageInfo.versionCode;
} catch (PackageManager.NameNotFoundException ignored) {
}

String fullStackTrace;
{
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
throwable.printStackTrace(pw);
fullStackTrace = sw.toString();
pw.close();
}

StringBuilder devInfo = new StringBuilder();
devInfo.append("************* Crash Head ****************\n");
devInfo.append("Time Of Crash : ").append(time).append("\n");
devInfo.append("Device Manufacturer: ").append(Build.MANUFACTURER).append("\n");
devInfo.append("Device Model : ").append(Build.MODEL).append("\n");
devInfo.append("Android Version : ").append(Build.VERSION.RELEASE).append("\n");
devInfo.append("Android SDK : ").append(Build.VERSION.SDK_INT).append("\n");
devInfo.append("App VersionName : ").append(versionName).append("\n");
devInfo.append("App VersionCode : ").append(versionCode).append("\n");
devInfo.append("************* Crash Head ****************\n");
devInfo.append("\n").append(fullStackTrace);

String errorLog = devInfo.toString();

try {
writeFile(crashFile, errorLog);
} catch (IOException ignored) {
}

Toast.makeText(app, "Game has crashed unexpectedly", Toast.LENGTH_LONG).show();
Toast.makeText(app, "Log saved to: " + String.valueOf(crashFile).replace("/storage/emulated/0/", ""), Toast.LENGTH_LONG).show();

Log.e("AppCrash", "Done");

System.exit(2);
}

private void writeFile(File file, String content) throws IOException {
File parentFile = file.getParentFile();
if (parentFile != null && !parentFile.exists()) {
parentFile.mkdirs();
}
file.createNewFile();
FileOutputStream fos = new FileOutputStream(file);
fos.write(content.getBytes());
try {
fos.close();
} catch (IOException e) {
}
}
});
}
}

5 changes: 5 additions & 0 deletions app/src/main/java/com/android/support/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,9 @@ public void onTaskRemoved(Intent intent) {
}
stopSelf();
}

//Override our Start Command so the Service doesnt try to recreate itself when the App is closed
public int onStartCommand(Intent intent, int i, int i2) {
return Service.START_NOT_STICKY;
}
}
4 changes: 3 additions & 1 deletion app/src/main/java/com/android/support/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class Main {
private static native void CheckOverlayPermission(Context context);

public static void StartWithoutPermission(Context context) {

CrashHandler.init(context, true);
if (context instanceof Activity) {
//Check if context is an Activity.
Menu menu = new Menu(context);
Expand All @@ -34,6 +34,8 @@ public static void StartWithoutPermission(Context context) {
}

public static void Start(Context context) {
CrashHandler.init(context, false);

CheckOverlayPermission(context);
}
}
11 changes: 10 additions & 1 deletion app/src/main/java/com/android/support/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/*Thread.setDefaultUncaughtExceptionHandler(
new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread thread, Throwable e) {
Log.e("AppCrash", "Error just lunched ");
}
});*/


//To launch game activity
if (!hasLaunched) {
Expand All @@ -33,6 +41,7 @@ protected void onCreate(Bundle savedInstanceState) {
}

//Launch mod menu.
Main.StartWithoutPermission(this);
// Main.StartWithoutPermission(this);
Main.Start(this);
}
}
Loading

0 comments on commit 580cd06

Please sign in to comment.