Solved How to hook bool method

Status
Not open for further replies.
What do you mean? Like an update from a different class than the class AddItem is in?
You don't need to change any code just the update offset, you can technically use update from any class when hooking regular methods but sometimes they don't all work which is why it's best to use update from the same class as the method you're hooking
oh I see. I'm just curious about how to use updates in other classes. Have you ever used the PurulianCheaterz Offset Tester?
 
Ouh, I'm just curious how to do a hook using update in another class. like the one on the Purulian offset tester
Easy, here are some examples...

1)
C++:
void (*old_PlayerController_Update)(void *instance);
void PlayerController_Update(void *instance) {
    if(instance!=nullptr) {
        if(Example1) {
            SpeedBoost(instance, 9999);
        }
    }
    old_PlayerController_Update(instance);
}

2)
C++:
void (*old_PlayerCamera_FixedUpdate)(void *instance);
void PlayerCamera_FixedUpdate(void *instance) {
    if(instance!=nullptr) {
        if(Example2) {
            *(float *) ((uint64_t) instance + 0x4C) = 10.0;
        }
    }
    old_PlayerCamera_FixedUpdate(instance);
}

Then under hackthread...
C++:
HOOK("0x747C2D", PlayerController_Update, old_PlayerController_Update);

HOOK("0x7411CD", PlayerCamera_FixedUpdate, old_PlayerCamera_FixedUpdate);
 
void (*old_PlayerController_Update)(void *instance); void PlayerController_Update(void *instance) { if(instance!=nullptr) { if(Example1) { SpeedBoost(instance, 9999); } } old_PlayerController_Update(instance); }
2)
void (*old_PlayerCamera_FixedUpdate)(void *instance); void PlayerCamera_FixedUpdate(void *instance) { if(instance!=nullptr) { if(Example2) { *(float *) ((uint64_t) instance + 0x4C) = 10.0; } } old_PlayerCamera_FixedUpdate(instance); }
Isn't an instance pointer needed to access another class? In which games does this work, can you name at least one game, and the necessary offsets? I imagined a situation where in classCurrency there is an int field coins 0x10, but there is no update method in this class, but Update is in classMoney (these classes are obviously similar), but in classMoney there is already a field with an offset of 0x10 (for example, string TypeName 0x10), or there is no field with an offset of 0x10 at all, then how will the value of the int coins field in the classCurrency change if using update from classMoney? It's unclear.
Thank you in advance for the clarification
 
Isn't an instance pointer needed to access another class? In which games does this work, can you name at least one game, and the necessary offsets? I imagined a situation where in classCurrency there is an int field coins 0x10, but there is no update method in this class, but Update is in classMoney (these classes are obviously similar), but in classMoney there is already a field with an offset of 0x10 (for example, string TypeName 0x10), or there is no field with an offset of 0x10 at all, then how will the value of the int coins field in the classCurrency change if using update from classMoney? It's unclear.
Thank you in advance for the clarification
My examples are just showing how to use more than one update hook, not how to use an update from a different class when there's no update in the class you're hooking field offsets from. For that yes you do need an instance pointer
 
I made a typo in the monoString struct, replace it with this...

C++:
typedef struct _monoString
{
    void *klass;
    void *monitor;
    int length;
    char chars[1];

    int getLength()
    {
        return length;
    }

    char *getChars()
    {
        return chars;
    }
} monoString;

monoString *CreateString(const char *str)
{
    monoString *(*CreateString)(void *instance, const char *str, int start, int length) = (monoString * (*)(void *, const char *, int, int)) getAbsoluteAddress("libil2cpp.so", 0xOFFSET); //offset here
    int length = (int)strlen(str);
    return CreateString(NULL, str, 0, length);
}

Remember to replace 0xOFFSET with correct offset

I made a typo in the monoString struct, replace it with this...

C++:
typedef struct _monoString
{
    void *klass;
    void *monitor;
    int length;
    char chars[1];

    int getLength()
    {
        return length;
    }

    char *getChars()
    {
        return chars;
    }
} monoString;

monoString *CreateString(const char *str)
{
    monoString *(*CreateString)(void *instance, const char *str, int start, int length) = (monoString * (*)(void *, const char *, int, int)) getAbsoluteAddress("libil2cpp.so", 0xOFFSET); //offset here
    int length = (int)strlen(str);
    return CreateString(NULL, str, 0, length);
}

Remember to replace 0xOFFSET with correct offset
Brother, I'm also using this struct for a game name : Chicken Gun. I'm using it for [PunRPC] Methods. It was working fine in armeabi-v7a. But now I shifted my project to arm64-v8a. And now this struct [CreateString] offset and [PunRPC] offset just crashing my game when I try to use the [PunRPC] Methods.
Could you please help me out?
 
Brother, I'm also using this struct for a game name : Chicken Gun. I'm using it for [PunRPC] Methods. It was working fine in armeabi-v7a. But now I shifted my project to arm64-v8a. And now this struct [CreateString] offset and [PunRPC] offset just crashing my game when I try to use the [PunRPC] Methods.
Could you please help me out?
I have also checked the Offsets are correct IDK why tf it crashes when I turn on the cheat.
 
Brother, I'm also using this struct for a game name : Chicken Gun. I'm using it for [PunRPC] Methods. It was working fine in armeabi-v7a. But now I shifted my project to arm64-v8a. And now this struct [CreateString] offset and [PunRPC] offset just crashing my game when I try to use the [PunRPC] Methods.
Could you please help me out?
Hmm, hard to know what's causing the crash if you're offsets are correct after changing to arm64-v8a, so not sure how I can help
 
Status
Not open for further replies.
Back
Top Bottom