Help! I need help. Hooking ObscuredInt types in LGL Mod Menu

JohnnyCappucino

Platinian
Aug 26, 2023
20
5
3
24
Sweden
Alright, I'll test it out and let you know. I'll also add the LOGD inside the hooks, that one is very useful as logcat clearly doesn't say shit
And yes, this bypass (if it can even be called like that, it's more like ignoring and not giving a fuck) even works with the latest pairip :pepe001::pepe001:
I want to ask, what instrument are you using to rewrite the "CRC32"?
 
  • Like
Reactions: Super Ikun

NotAWeeb!

1/3 Games Approved
Original poster
Aug 31, 2023
202
36,717
1,193
japaneseland
I want to ask, what instrument are you using to rewrite the "CRC32"?
I knew people would be asking me for this :pepe001: that's why I wanted to create a tutorial. I use a handy APK patching tool that facilitates the process of changing the CRC32 a lot.

Gonna create the tutorial thread as soon as possible, just let me have breakfast first :face07:

But for the time being, I should be the one getting help to mod this game, not teaching others LMAO
 

JohnnyCappucino

Platinian
Aug 26, 2023
20
5
3
24
Sweden
I knew people would be asking me for this :pepe001: that's why I wanted to create a tutorial. I use a handy APK patching tool that facilitates the process of changing the CRC32 a lot.

Gonna create the tutorial thread as soon as possible, just let me have breakfast first :face07:

But for the time being, I should be the one getting help to mod this game, not teaching others LMAO
Yeah, i didn't solicit you to teach me anything, i just needed an instrument, not a big deal.
 

nekrasov

Platinian
Dec 16, 2022
9
1
3
Behind You
First of all, never call MSHook inside another hook.

Second, why you're using the same featureHookToggle for each case? Meaning, even if your code would be in the right way (which I guess not), just by enabling one of your visual toggles in GUI you will call all of your 4 hooks together!!! 😯😒. For proper testing you better separate it.
Just make it featureHookToggle1, featureHookToggle2, featureHookToggle3, or any custom names.

Third, what is the logic of this? Even if it wasn't obscured, are you sure those methods will use this fields what you've put inside your SetObscured[type]Value method?
C++:
// RVA: 0x983F90 Offset: 0x983F90 VA: 0x983F90
public ObscuredInt get_Pickles() { }

// RVA: 0x85E1E4 Offset: 0x85E1E4 VA: 0x85E1E4
public ObscuredInt get_CurrentGold() { }

// RVA: 0x85E204 Offset: 0x85E204 VA: 0x85E204
public ObscuredInt get_CurrentGems() { }
I mean, I dont have any information about your reversing research, and parameters for Obscured always empty.

Mostly we search one method like Update() in one huge class where is located fields you want to modify, or class which is maybe call parameters from another shared classes, and just hooking fields Update() hook.

Example how I tried (remaked for your case):
C++:
MSHookFunction((void *) getAbsoluteAddress(targetLibName, 0x2A1234), (void *) UpdatePlayer, (void **) &old_UpdatePlayer);
void (*old_UpdatePlayer)(void *instance);
void UpdatePlayer(void *instance) {
    if (instance != NULL) {
        if (isMoneyCheatEnable) {
            SetObscuredByteValue((uint64_t)instance + 0x1C, 10000); //0x88 money field
        }
        if (isPickesCheatEnable) {
            SetObscuredIntValue((uint64_t)instance + 0x18, 8500); // it will keep Pickles amount 8500 Forever until you exit game or game crashes
        }
        if (isGemCheatEnable) {
            isGemCheatEnable = false;
            GemsAdd(instance, 908070); //GemsAdd in my case is a void method GemsAdd(float amount), but will add Gems only for 1 time when Update() method updates
        }
    }
    return old_UpdatePlayer(instance);
}

void (*GemsAdd)(void *, float);
    GemsAdd = (void (*)(void *, float)) getAbsoluteAddress(targetLibName, 0xA12345);
For sure you will need to additionally patch FALSE or NOP to the main CodeStage methods (around 10 or more), else game will freeze/crash or even ban 🤣. You can do it like you did with your Damage patch, or custom.

I'm also learning about ACTK bypass and hooks based on LGL. I just look at your thread because I'm interested how to hook Obscured methods, not just fields. But have found nothing yet 😭😭😭Any ideas?
 

NotAWeeb!

1/3 Games Approved
Original poster
Aug 31, 2023
202
36,717
1,193
japaneseland
@nekrasov I don't create separated featureToggle(s), it works just fine with every other hook I currently have.

I've (theoretically) determined that the cause of the unability to hook the ObscuredInt methods is basically that I'm not using the correct field location to deobfuscate the original methods' location (maybe I'm wrong, I'm still learning :face26:).

Third, what is the logic of this? Even if it wasn't obscured, are you sure those methods will use this fields what you've put inside your SetObscured[type]Value method?
I don't exactly know what you mean by this, but I have a feeling that's what could fix the hooks if I do it properly. Please, explain to me what you mean.

I already tried to hook other related methods to currencies in order to mod it, but I have to properly bypass CodeStage or my game will freeze every time the currency method hook gets called. I already tried doing NOP to all methods on classes except the main CodeStage class, and still freezes. The problem relays on the fact I don't know how to figure the offsets for the CodeStage's main class methods, and they won't show up in dnSpy.

I've heard I'm able to do so with IDA, but need to figure out exactly how. Do you have any reference or can teach me how?

As soon as I get to bypass CodeStage, I should be able to create all currency cheats with related methods to the original Obscured ones.

I'm still learning hooking, I started creating my first hooks with this same game I'm dealing with. Please keep this in mind.

And I don't know what you mean by learning how to hook Obscured methods and not just fields. Am I not hooking Obscured methods with the required field offsets (BackingFields)?
 

mIsmanXP

Approved Modder
Approved Modder
Feb 20, 2022
206
10,156
1,193
Republic of Indonesia
If you're still talking about Pickle Pete, would you tell me which class & field of Obscured types you're trying to modify?
i don't think the cause for your crash is codestage but I'd like to try it first
 
Last edited:

nekrasov

Platinian
Dec 16, 2022
9
1
3
Behind You
@nekrasov I don't create separated featureToggle(s), it works just fine with every other hook I currently have.

I've (theoretically) determined that the cause of the unability to hook the ObscuredInt methods is basically that I'm not using the correct field location to deobfuscate the original methods' location (maybe I'm wrong, I'm still learning :face26:).



I don't exactly know what you mean by this, but I have a feeling that's what could fix the hooks if I do it properly. Please, explain to me what you mean.

I already tried to hook other related methods to currencies in order to mod it, but I have to properly bypass CodeStage or my game will freeze every time the currency method hook gets called. I already tried doing NOP to all methods on classes except the main CodeStage class, and still freezes. The problem relays on the fact I don't know how to figure the offsets for the CodeStage's main class methods, and they won't show up in dnSpy.

I've heard I'm able to do so with IDA, but need to figure out exactly how. Do you have any reference or can teach me how?

As soon as I get to bypass CodeStage, I should be able to create all currency cheats with related methods to the original Obscured ones.

I'm still learning hooking, I started creating my first hooks with this same game I'm dealing with. Please keep this in mind.

And I don't know what you mean by learning how to hook Obscured methods and not just fields. Am I not hooking Obscured methods with the required field offsets (BackingFields)?
Sorry for late reply. Basically I can't find any tips to hook something like ObscuredInt 0x12345 (offset).
I only know you need to use some hook obscured fields with some Update() method like I said before.

For bypass CodeStage you just need to add more NOP to your patch. Thats all. I have added like 15 Nope to different codestage methods.