First of all, I'm sorry that it's a translation
Help me. This is my code
===================================================================
#include <list>
#include <vector>
#include <string.h>
#include <pthread.h>
#include <cstring>
#include <jni.h>
#include <unistd.h>
#include <fstream>
#include <iostream>
#include <dlfcn.h>
#include "Includes/Logger.h"
#include "Includes/obfuscate.h"
#include "Includes/Utils.h"
#include "KittyMemory/MemoryPatch.h"
#include "Menu.h"
#define targetLibName OBFUSCATE("libil2cpp.so")
#include "Includes/Macros.h"
struct My_Patches {
MemoryPatch xs;
} hexPatches;
int speed =0;
int hwhw=0;
void (*old_speed1)(void *instance);
void speed1(void *instance) {
if(instance != NULL) {
if (speed >=0) { //if Toggle
*(int *)((uint64_t)instance + 0x10) = speed; //false true 몹겹치기
}
}
old_speed1(instance);
}
int (*old_hwhw777)(void *instance);
int hwhw777(void *instance) {
if(instance != NULL&&hwhw> 0) {
return (int)hwhw;
}
return hwhw777(instance);
}
void *hack_thread(void *) {
LOGI(OBFUSCATE("pthread created"));
do {
sleep(1);
} while (!isLibraryLoaded(targetLibName));
LOGI(OBFUSCATE("%s has been loaded"), (const char *) targetLibName);
#if defined(aarch64)
#else
MSHookFunction((void *)getAbsoluteAddress("libil2cpp.so", 0x8A3714), (void *) speed1, (void **)&old_speed1);
MSHookFunction((void *)getAbsoluteAddress("libil2cpp.so", 0x748A88), (void *) hwhw777, (void **)&old_hwhw777);
LOGI(OBFUSCATE("Done"));
#endif
return NULL;
}
extern "C" {
JNIEXPORT jobjectArray
JNICALL
Java_uk_lgl_modmenu_FloatingModMenuService_getFeatureList(JNIEnv *env, jobject context) {
jobjectArray ret;
MakeToast(env, context, OBFUSCATE("개 초 코"), Toast::LENGTH_LONG);
const char *features[] = {
OBFUSCATE("Category_지금부터쇼타임"),
//OBFUSCATE("CheckBox_무적&원킬"),
OBFUSCATE("InputValue_9"),
//OBFUSCATE("SeekBar_speed_0_100"),
OBFUSCATE("InputValue_01"),
};
int Total_Feature = (sizeof features / sizeof features[0]);
ret = (jobjectArray)
env->NewObjectArray(Total_Feature, env->FindClass(OBFUSCATE("java/lang/String")),
env->NewStringUTF(""));
for (int i = 0; i < Total_Feature; i++)
env->SetObjectArrayElement(ret, i, env->NewStringUTF(features[i]));
pthread_t ptid;
pthread_create(&ptid, NULL, antiLeech, NULL);
return (ret);
}
JNIEXPORT void JNICALL
Java_uk_lgl_modmenu_Preferences_Changes(JNIEnv *env, jclass clazz, jobject obj,
jint featNum, jstring featName, jint value,
jboolean boolean, jstring str) {
LOGD(OBFUSCATE("Feature name: %d - %s | Value: = %d | Bool: = %d | Text: = %s"), featNum,
env->GetStringUTFChars(featName, 0), value,
boolean, str != NULL ? env->GetStringUTFChars(str, 0) : "");
switch (featNum) {
case 0:
speed = value;
break;
case 1:
hwhw = value;
break;
}
}
}
attribute((constructor))
void lib_main() {
pthread_t ptid;
pthread_create(&ptid, NULL, hack_thread, NULL);
}