int GetObscuredIntValue(uint64_t location){
int cryptoKey = *(int *)location;
int obfuscatedValue = *(int *)(location + 0x4);
return obfuscatedValue ^ cryptoKey;
}
/*
Set the real value of an ObscuredInt.
Parameters:
- location: the location of the ObscuredInt
- value: the value we're setting the ObscuredInt to
*/
void SetObscuredIntValue(uint64_t location, int value){
int cryptoKey = *(int *)location;
*(int *)(location + 0x4) = value ^ cryptoKey;
}
void(*old_UpdateHook)(void *instance);
void UpdateHook(void *instance) {
if(toggle) {
//0x177 is the field offset, and 999 is the value you return
SetObscuredIntValue((uint64_t)instance + 0x177, 999);
}
return old_UpdateHook(instance);
}
Heres the way I do it:
C++:int GetObscuredIntValue(uint64_t location){ int cryptoKey = *(int *)location; int obfuscatedValue = *(int *)(location + 0x4); return obfuscatedValue ^ cryptoKey; } /* Set the real value of an ObscuredInt. Parameters: - location: the location of the ObscuredInt - value: the value we're setting the ObscuredInt to */ void SetObscuredIntValue(uint64_t location, int value){ int cryptoKey = *(int *)location; *(int *)(location + 0x4) = value ^ cryptoKey; }
C++:void(*old_UpdateHook)(void *instance); void UpdateHook(void *instance) { if(toggle) { //0x177 is the field offset, and 999 is the value you return SetObscuredIntValue((uint64_t)instance + 0x177, 999); } return old_UpdateHook(instance); }
also im guessing ur modding armv7, just change uint64_t to uint32_t
Here is floatif it's float,long,double just change the name?
/*
location = the location of the ObscuredFloat
value = the value we're setting the ObscuredFloat to
*/
void SetObscuredFloatValue(uint64_t location, float value){
int cryptoKey = *(int *)location;
union intfloat {
int i;
float f;
};
/* use this intfloat to get the integer representation of our parameter value */
intfloat IF;
IF.f = value;
/* use this intfloat to generate our hacked ObscuredFloat */
intfloat IF2;
IF2.i = IF.i ^ cryptoKey;
*(float *)(location + 0x4) = IF2.f;
}
Heres the way I do it:
C++:int GetObscuredIntValue(uint64_t location){ int cryptoKey = *(int *)location; int obfuscatedValue = *(int *)(location + 0x4); return obfuscatedValue ^ cryptoKey; } /* Set the real value of an ObscuredInt. Parameters: - location: the location of the ObscuredInt - value: the value we're setting the ObscuredInt to */ void SetObscuredIntValue(uint64_t location, int value){ int cryptoKey = *(int *)location; *(int *)(location + 0x4) = value ^ cryptoKey; }
C++:void(*old_UpdateHook)(void *instance); void UpdateHook(void *instance) { if(toggle) { //0x177 is the field offset, and 999 is the value you return SetObscuredIntValue((uint64_t)instance + 0x177, 999); } return old_UpdateHook(instance); }
also im guessing ur modding armv7, just change uint64_t to uint32_t
Plz tell me how to find location??? that is Struct ObscuredInt .ctor offsetHere is float
C++:/* location = the location of the ObscuredFloat value = the value we're setting the ObscuredFloat to */ void SetObscuredFloatValue(uint64_t location, float value){ int cryptoKey = *(int *)location; union intfloat { int i; float f; }; /* use this intfloat to get the integer representation of our parameter value */ intfloat IF; IF.f = value; /* use this intfloat to generate our hacked ObscuredFloat */ intfloat IF2; IF2.i = IF.i ^ cryptoKey; *(float *)(location + 0x4) = IF2.f; }
while testing this, the float code works on double and int works on long
why do i have this error? I have already disabled all anti cheats
Plz tell me how to find location??? that is Struct ObscuredInt .ctor offset
{
// Token: 0x02000017 RID: 23
[Token(Token = "0x2000012")]
[Serializable]
// dumpcs
public struct ObscuredInt : IObscuredType, IFormattable, IEquatable<ObscuredInt>, IComparable<ObscuredInt>, IComparable<int>, IComparable
{
// Token: 0x0600016F RID: 367 RVA: 0x0000212A File Offset: 0x0000032A
[Token(Token = "0x6000159")]
[Address(RVA = "0x28F8AD4", Offset = "0x28F8AD4", VA = "0x28F8AD4")]
private ObscuredInt(int value)
{
}
// field offset
protected ObscuredInt _currentRoomID; // 0x18
// code
int GetObscuredIntValue(uint32_t location){
int cryptoKey = *(int *)0x28F8AD4;
int obfuscatedValue = *(int *)(0x28F8AD4 + 0x4);
return obfuscatedValue ^ cryptoKey;
}
void SetObscuredIntValue(uint32_t location, int value){
int cryptoKey = *(int *)0x28F8AD4;
*(int *)(0x28F8AD4 + 0x4) = value ^ cryptoKey;
}
bool istele;
int teleValue;
void(* old_UpdateRoom)(void * instance);
void UpdateRoom(void*instance) {
if(instance != NULL) {
if(istele) {
istele = false;
SetObscuredIntValue((uint32_t ) instance + 0x18, teleValue);
}
}
old_UpdateRoom(instance);
}
MSHookFunction((void *) getAbsoluteAddress("libil2cpp.so", 0x1113008), (void*)UpdateRoom, (void**)&old_UpdateRoom);
What you need to change in smali?Is it always necessary to change the apk (the smali code) to work?
Im guessing you want to tweak the apk without a menu. You could make your own android studio project that has no menu, and you could hook just by including the macros file and inline hook lgl has. Also you will need to load the library from smali, I dont know why you are trying to find a different method as it is very easy to do@ArmorTage my question is, do i need change the smali file from the APK of the game to hook a function in the il2cpp.so.
doesnt it exist any other method where you can just hook the il2cpp.so without modifying the apk at all?
cause im only interested in the hooking not in any ugly menu. but i cannot simply find anything working without changing the apk.
im talking about the UnityActivity.smali you decompile from the game I ADDED A TIMESTAMP TO IT !!!
Using hook u still need to touch the apk files, use direct patching lib if u that lazyno need for any menu nor wanna i touch
We use cookies to personalize content and ads, to provide social media features and to analyse our traffic. We also share necessary information with our advertising and analytics partners to optimize your experience on our site.
Learn more about cookies
We use cookies to personalize content and ads, to provide social media features and to analyse our traffic. We also share necessary information with our advertising and analytics partners to optimize your experience on our site.
Learn more about cookies