Solved Hooking Help

Status
Not open for further replies.

Kurumi0343

Platinian
I want to try Hooking can someone check if this is correct?


Code:
    // Token: 0x170003C7 RID: 967
    // (get) Token: 0x06001A1D RID: 6685 RVA: 0x00007F50 File Offset: 0x00006150
    // (set) Token: 0x06001A1E RID: 6686 RVA: 0x00002053 File Offset: 0x00000253
    [Token(Token = "0x170003C7")]
    public float KillCooldown
    {
        [Token(Token = "0x6001A1D")]
        [Address(RVA = "0x8B8DE0", Offset = "0x8B8DE0", VA = "0x8B8DE0")]
        get
        {
            return 0f;
        }
        [Token(Token = "0x6001A1E")]
        [Address(RVA = "0x8D47B8", Offset = "0x8D47B8", VA = "0x8D47B8")]
        set
        {
        }

public float killCooldown; // 0x10
    }

this is my Hook

Code:
float (*old_set_KillCooldown)(void *instance);
float set_KillCooldown(void *instance) {
    if(instance != NULL) {
        if(UnliKill){
            *(float *) ((uint64_t) instance + 0x10) = 0;
        }
    }
    return old_set_KillCooldown(instance);
}

HOOK_LIB("libil2cpp.so","0x8D47B8", set_KillCooldown,old_set_KillCooldown);

I am using LGLTeam Mod Menu and also I am getting 2 lib on decompile libMyLibName.so and libKurumi.so i dont know if libMyLibName is important or not
 
C++:
void (*old_set_KillCooldown)(void *instance, float killCooldown); // setters return nothing, also take the new value as a second parameter  
void set_KillCooldown(void *instance, float killCooldown) { // same here
    if(instance != NULL) {
        if(UnliKill){
            // No need to use offsets to modify the attribute, just use the old setter
            old_set_KillCooldown(instance, 0);
            return;
        }
    }
    old_set_KillCooldown(instance, killCooldown);
}

HOOK_LIB("libil2cpp.so","0x8D47B8", set_KillCooldown,old_set_KillCooldown);
 
Status
Not open for further replies.
Back
Top Bottom