Skip to content

Commit

Permalink
Some minor fixes
Browse files Browse the repository at this point in the history
- Add int hook example. Thanks @Mahmoud-GMG
- Changed package name to uk.lgl to fix Unknown entity 'R' error on AIDE
  • Loading branch information
LGLTeam committed May 14, 2021
1 parent 087f2a5 commit 57f5f00
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 22 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 30
defaultConfig {
applicationId "uk.lgl.modmenu"
applicationId "uk.lgl"
minSdkVersion 19
targetSdkVersion 30
versionCode 1
versionName "2.6"
versionName "2.7"
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86'
}
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/uk/lgl/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import android.provider.Settings;
import android.widget.Toast;

import uk.lgl.modmenu.R;
import uk.lgl.modmenu.FloatingModMenuService;

public class MainActivity extends Activity {
Expand Down
24 changes: 6 additions & 18 deletions app/src/main/jni/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ struct My_Patches {
} hexPatches;

bool feature1 = false, feature2 = false, featureHookToggle = false;
int sliderValue = 1;
int level = 0;
int sliderValue = 1, level = 0;
void *instanceBtn;

// Function pointer splitted because we want to avoid crash when the il2cpp lib isn't loaded.
Expand All @@ -51,8 +50,7 @@ void (*AddMoneyExample)(void *instance, int amount);
//Use ARM Converter to convert ARM to HEX: https://armconverter.com/
//Note: We use OBFUSCATE_KEY for offsets which is the important part xD

// Hooking example

// Hooking example. Please refer to online tutorials how to hook
bool (*old_get_BoolExample)(void *instance);
bool get_BoolExample(void *instance) {
if (instance != NULL && featureHookToggle) {
Expand All @@ -69,16 +67,11 @@ float get_FloatExample(void *instance) {
return old_get_FloatExample(instance);
}

//By Mabmoud Gaming
//https://github.com/Mahmoud-GMG
int (*old_Level)(void *instance);
int Level(void *instance) {
//LOGD("Level 1");
if (instance != NULL && level) {
//LOGD("Level 2");
return (int) level;
return (int) level;
}
//LOGD("Level 3");
return old_Level(instance);
}

Expand Down Expand Up @@ -146,7 +139,7 @@ void *hack_thread(void *) {
//MSHookFunction((void *) getAbsoluteAddress(targetLibName,
// string2Offset(OBFUSCATE_KEY("0x123456", '?'))),
// (void *) get_BoolExample, (void **) &old_get_BoolExample);
// MSHookFunction((void *) getAbsoluteAddress(targetLibName,
// MSHookFunction((void *) getAbsoluteAddress(targetLibName,
// string2Offset(OBFUSCATE_KEY("0x123456", '?'))),
// (void *) Level, (void **) &old_Level);

Expand Down Expand Up @@ -194,7 +187,6 @@ Java_uk_lgl_modmenu_FloatingModMenuService_getFeatureList(JNIEnv *env, jobject c
OBFUSCATE("ButtonOnOff_The On/Off button"),
OBFUSCATE("CheckBox_The Check Box"),
OBFUSCATE("InputValue_Input number"),
OBFUSCATE("50_InputValue_Input Level"),
OBFUSCATE("InputText_Input text"),
OBFUSCATE("RadioButton_Radio buttons_OFF,Mod 1,Mod 2,Mod 3"),

Expand Down Expand Up @@ -339,16 +331,13 @@ Java_uk_lgl_modmenu_Preferences_Changes(JNIEnv *env, jclass clazz, jobject obj,
featureHookToggle = boolean;
break;
case 7:
level = value;
break;
case 8:
//MakeToast(env, obj, TextInput, Toast::LENGTH_SHORT);
break;
case 9:
break;
case 50:
//LOGD(OBFUSCATE("Feature 50 Called"));
level = value;
break;
}
}
}
Expand All @@ -367,7 +356,6 @@ JNIEXPORT jint JNICALL
JNI_OnLoad(JavaVM *vm, void *reserved) {
JNIEnv *globalEnv;
vm->GetEnv((void **) &globalEnv, JNI_VERSION_1_6);
return JNI_VERSION_1_6;
}
*/
*/
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {

}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
classpath 'com.android.tools.build:gradle:4.2.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down

0 comments on commit 57f5f00

Please sign in to comment.