Acer2k5
2/3 Approved Games
Hi new modder & old modder.
In this thread, I will show you how to hook in new LGL Modmenu
// RVA: 0x1113FC8 Offset: 0x1113FC8 VA: 0x1113FC8
public void set_ID(int value) { }
This is Offset we need to mod : 0x1113FC8
We need to know some function
Ahead of the Main.cpp file in LGLModmenu, we found :
We need to add some code to this, we must pay attention to VOID or INT or BOOL element
IF we need use mod function
Toggle : use BOOL
Slider : use INT
I don't know how to use VOID with anny mod function, but we still have to pay attention
I need to mod my team =< 3 so i use Slider and use INT , here is example:
To use slider, lets write code like this or copy and rewrite for your modmenu:
After you understool Hook functions, you can write code like this:
You need a Offucate, lets write it:
You need case too:
Congratulation, you had your hook. This code below will show summary of all thread code. Having fun coding =]]
In this thread, I will show you how to hook in new LGL Modmenu
First: Get hex code we need to use. Example:
// RVA: 0x1113FC8 Offset: 0x1113FC8 VA: 0x1113FC8
public void set_ID(int value) { }
This is Offset we need to mod : 0x1113FC8
We need to know some function
Python:
# Hook the function named "FunctionExample" with the address "0x123456" in the library "libFileB.so"
HOOK("str", FunctionExample, old_FunctionExample);
# Hook the function named "FunctionExample" with the address "0x123456" in the library "libFileC.so"
HOOK_LIB("libFileC.so", "0x123456", FunctionExample, old_FunctionExample);
# Hook the function named "__SymbolNameExample" with the address "0x123456" in the library "libFileB.so"
HOOKSYM("__SymbolNameExample", FunctionExample, old_FunctionExample);
# Hook the function named "__SymbolNameExample" with the address "0x123456" in the library "libFileB.so" and do not replace the original function
HOOKSYM_NO_ORIG("__SymbolNameExample", FunctionExample);
# Patch the offset "0x20D3A8" in the library "libFileB.so" with the bytes "00 00 A0 E3 1E FF 2F E1"
PATCH_LIB("libFileB.so", "0x20D3A8", "00 00 A0 E3 1E FF 2F E1");
# Restore the original value of the offset "0x20D3A8" in the library "libFileB.so"
RESTORE_LIB("libFileB.so", "0x20D3A8");
# Get the absolute address of the function named "Ally_ID" in the library "targetLibName"
Ally_ID = (void (*)(void *, int)) getAbsoluteAddress(targetLibName, 0x1113FC8);
# Log a message to indicate that the process is complete
LOGI(OBFUSCATE("Done"));
Ahead of the Main.cpp file in LGLModmenu, we found :
C++:
bool feature1, feature2, featureHookToggle, Health;
int sliderValue = 1, level = 0, Dmg = 1, Defend = 1;
void instanceBtn;
We need to add some code to this, we must pay attention to VOID or INT or BOOL element
IF we need use mod function
Toggle : use BOOL
Slider : use INT
I don't know how to use VOID with anny mod function, but we still have to pay attention
I need to mod my team =< 3 so i use Slider and use INT , here is example:
C++:
bool feature1, feature2, featureHookToggle, Health;
int sliderValue = 1, level = 0, Ally = 1;
void instanceBtn;
To use slider, lets write code like this or copy and rewrite for your modmenu:
C++:
void (*old_Ally_ID)(void *instance, int value);
void Ally_ID(void *instance, int value) {
if (instance != NULL && Ally > 1) {
return (void) Ally;
}
// Move the old_Ally_ID function call here
old_Ally_ID(instance, value);
}
After you understool Hook functions, you can write code like this:
C++:
HOOK("str", Ally_ID, old_Ally_ID);
HOOK_LIB("libFileB.so", "0x1113FC8", Ally_ID, old_Ally_ID);
HOOK_NO_ORIG("0x1113FC8", Ally_ID);
RESTORE("0x1113FC8");
RESTORE_LIB("libFileB.so", "0x1113FC8");
Ally_ID = (void (*)(void *, int)) getAbsoluteAddress(targetLibName, 0x1113FC8);
You need a Offucate, lets write it:
C++:
OBFUSCATE("SeekBar_Ally Ally_1_3"), // 0 case
You need case too:
C++:
switch (featNum) {
case 0:
Ally =! Ally
break;
}
Congratulation, you had your hook. This code below will show summary of all thread code. Having fun coding =]]
C++:
//Hook example:
int Ally = 1,
void (*old_Ally_ID)(void *instance, int value);
void Ally_ID(void *instance, int value) {
if (instance != NULL && Ally > 1) {
return (void) Ally;
}
// Move the old_Ally_ID function call here
old_Ally_ID(instance, value);
}
HOOK("str", Ally_ID, old_Ally_ID);
HOOK_LIB("libFileB.so", "0x1113FC8", Ally_ID, old_Ally_ID);
HOOK_NO_ORIG("0x1113FC8", Ally_ID);
RESTORE("0x1113FC8");
RESTORE_LIB("libFileB.so", "0x1113FC8");
Ally_ID = (void (*)(void *, int)) getAbsoluteAddress(targetLibName, 0x1113FC8);
jobjectArray GetFeatureList(JNIEnv *env, jobject context) {
jobjectArray ret;
const char *features[] = {
OBFUSCATE("Category_The Category"), //Not counted
OBFUSCATE("SeekBar_Ally Ally_1_3"), // 0 case
switch (featNum) {
case 0:
Ally =! Ally
break;
}