MShook Android need help with "key"

Sbenny.com is trusted by 1,327,047 happy users since 2014.
Register

dinoid

Slava Ukraini
Member for 2 years
What is the "key", value right after offset within obfuscate_key. Where should I find it? I already have the offset and the size of the method.
Code:
MSHookFunction((void *) getAbsoluteAddress(targetLibName, string2Offset(OBFUSCATE_KEY("0x1234567",'a')))
What I need to put in obfuscate_key instead of 'a'...
 

Gourov

Dimitri Petrenko
✌️ Community Team
Member for 5 years
Its like a lock you creating , so you can decide which key you will specify. You can use any character.
 

dinoid

Slava Ukraini
Member for 2 years
I've successfully implemented LGL MOD Menu to a game, but when I use the Toggle nothing happens. Already took a look at the logcat, it says the boolean value changed from 0 to 1, but the function didn't do anything.
Hook:
C++:
MSHookFunction((void *) getAbsoluteAddress(targetLibName, string2Offset(OBFUSCATE_KEY("0x1231231",'-'))), (void *) GetGold, (void **) &org_GetGold); //targetLib was set, the key and offset are illustrative
Method:
Code:
int (*org_GetGold)(void *instance);
int GetGold(void *instance) {
    if (instance != NULL) {
        if(GoldToggle){
            return 999999999;
        }
    }
    return org_GetGold(instance);
}
Toggle used:
Code:
OBFUSCATE("0_Toggle_Infinite Gold"),
Switch (Where the bug may be):
Code:
switch (featNum) {
        case 0:
            GoldToggle = boolean;
            if (GoldToggle) {
                LOGI(OBFUSCATE("On"));
            } else {
                LOGI(OBFUSCATE("Off"));
            }
            break;
I'm not sure if the problem is within the switch, if I must call a function or something...
 

Gourov

Dimitri Petrenko
✌️ Community Team
Member for 5 years
You tried earning some gold or spending after turning on Toggle ?
 

dinoid

Slava Ukraini
Member for 2 years
You tried earning some gold or spending after turning on Toggle ?
I tried activating it before the game starting and before earning the currency. Either way nothing happens.
I already modded this game by hexpatching, so I'm sure it should be working...
 

Gourov

Dimitri Petrenko
✌️ Community Team
Member for 5 years
I tried activating it before the game starting and before earning the currency. Either way nothing happens.
I already modded this game by hexpatching, so I'm sure it should be working...
With hexpatching game is modded when game is open right ?
You can open LGL menu settings and turn on the Save Pref . Then turn on toggle and restart the game.
 

Gourov

Dimitri Petrenko
✌️ Community Team
Member for 5 years
Or try removing the switch and directly return.
C++:
int (*org_GetGold)(void *instance);
int GetGold(void *instance) {
    if (instance != NULL) {
        return 999999999;
    }
    return org_GetGold(instance);
}
 

dinoid

Slava Ukraini
Member for 2 years
With hexpatching game is modded when game is open right ?
You can open LGL menu settings and turn on the Save Pref . Then turn on toggle and restart the game.
I'll test this way. I was wondering if instead of modding the "getGold" I could mod the "setGold". That way the value would change as soon as I activate the option. Is it right?

Edit: Even with the option saved and activated from start, no change to the gold value at all...
 

Gourov

Dimitri Petrenko
✌️ Community Team
Member for 5 years
I'll test this way. I was wondering if instead of modding the "getGold" I could mod the "setGold". That way the value would change as soon as I activate the option. Is it right?
Setters are void and doesnt return anything. You need to learn hooking first before advancing to hook setters or others.
 

dinoid

Slava Ukraini
Member for 2 years
Or try removing the switch and directly return.
C++:
int (*org_GetGold)(void *instance);
int GetGold(void *instance) {
    if (instance != NULL) {
        return 999999999;
    }
    return org_GetGold(instance);
}
Like this?
Code:
int (*org_GetGold)(void *instance);
int GetGold(void *instance) {
    if (instance != NULL) {
        //if(GoldToggle){
            return 999999999;
        //}
    }
    return org_GetGold(instance);
}
 

dinoid

Slava Ukraini
Member for 2 years
Tsc, just tested it and no Changes again, with or without the toggle check.
Maybe I'm missing something.
 

dinoid

Slava Ukraini
Member for 2 years
I tried changing the toggle id, still no result. I'll try to mod by using kittymemory or something. I tried very hard to make it work with mshook lul
 

dinoid

Slava Ukraini
Member for 2 years
I tried changing the toggle id, still no result. I'll try to mod by using kittymemory or something. I tried very hard to make it work with mshook lul
So, I've put some logcat on my getGold method to see if there was an error there and turns out it showed "Instance Is Null"

C++:
int (*org_GetGold)(void *instance);
int GetGold(void *instance) {
    if (instance != NULL) {
        if(GoldToggle){
            LOGI(OBFUSCATE("Modded value"));
            return 999999999;
        }
    }
    LOGI(OBFUSCATE("Instance is null"));
    return org_GetGold(instance);
}
Is this related to my MSHook?
 

Gourov

Dimitri Petrenko
✌️ Community Team
Member for 5 years
So, I've put some logcat on my getGold method to see if there was an error there and turns out it showed "Instance Is Null"

C++:
int (*org_GetGold)(void *instance);
int GetGold(void *instance) {
    if (instance != NULL) {
        if(GoldToggle){
            LOGI(OBFUSCATE("Modded value"));
            return 999999999;
        }
    }
    LOGI(OBFUSCATE("Instance is null"));
    return org_GetGold(instance);
}
Is this related to my MSHook?
Can show me the function on DnSpy or Dump.cs ?
 

Gourov

Dimitri Petrenko
✌️ Community Team
Member for 5 years
Or as you not using instance you can use like ...
C++:
int (*org_GetGold)(void *instance);
int GetGold(void *instance) {
    if(GoldToggle){
       LOGI(OBFUSCATE("Modded value"));
       return 999999999;
       }
    return org_GetGold(instance);
}
 
Top