Help! rrosetta seedhollow template crashing problem

ReCheat

Platinian
I am trying to use the template from here

this source has offsets and code for a previously modded game which is great for an example but I have removed or commented out everything I can see related to the game and it compiles fine but as soon as I add it to any game the game crashes when loading

I can use LGL mod menu with no issues but because it is no longer supported I wanted to switch to this updated template but I can't figure out what is causing the crash

does anyone have a bare bones version of this template I can use which does not crash or suggest what is wrong?
 
@rrosetta
Amazing template but I have a few questions if you can help?

1. I have got hooks working but for some reason I can't get hooks working for get methods

C#:
public int Coins
{
    [Token(Token = "0x6000FE3")]
    [Address(RVA = "0x20DF77A", Offset = "0x20DF77A", VA = "0x20DF77A")]
    get
    {
        return 0;
    }
}

This is what I am doing

C++:
UnityResolve::Hook(OBFUSCATE("Player"), OBFUSCATE("get_Coins"), {}, (void *)new_Coins, (void **)&old_Coins);

int (*old_Coins)(void *instance);
int new_Coins(void *instance) {
    if (instance != NULL) {
        if (Vars::PlayerData.CoinsVar)
            return 1000;
    }
    return old_Coins(instance);
}

Class name is Player. I have tried get_Coins and Coins as the method name but neither is working. Is there a different syntax for get & set methods?

2. Is there a way to read & write field values by name directly or a way of getting the FieldOffset by name?

3. Does this template have a settings option or a way for the users settings to be remembered like LGL template 'Save feature preferences'
 
Okay there, let me answer your question here

1.If you want to hijack a value, you’ll need to use a hooking method. Try logging the instance first to check if it’s null or not. To set the value, you can just use this code
C++:
// invoke the method and pass the value to the parameter if there any
UnityResolve::Get("somedll.dll")->Get("Player")->Get<UnityResolve::Method>("set_Coins")->Invoke<void>(instance, 9999);

2 to read or write the fiels you can use this method
C++:
auto pValue = UnityResolve::Get("somedll.dll")->Get("Player")->GetValue<int>(instance, "get_Coins"); // read field value
C++:
UnityResolve::Get("somedll.dll")->Get("Player")->SetValue<void>(instance, "setCoins", 9999); // set field value

3. Yesn't, we have the preferences setting file but for now i'm not using it, maybe in the future :>

Feel free to ask anything related
 
Thank you for your help and quick reply

In my example code above there is only a get and not a set
Is there no way to hook the get by name as LGL can hook by address so I could return a different value when the get is called?

If not then I could probably find an alternative class, method or field but would be good to know if hooking a get by name is possible or not?
:tumbsup:
 
Thank you for your help and quick reply

In my example code above there is only a get and not a set
Is there no way to hook the get by name as LGL can hook by address so I could return a different value when the get is called?

If not then I could probably find an alternative class, method or field but would be good to know if hooking a get by name is possible or not?
:tumbsup:
That code’s basically showing how to hook a function by name, since it’ll auto find the right address for you


C++:
// this is example how to hook by address
DobbyHook((void*) getAbsoluteAddress("libil2cpp.so",0xF00000), (void*)new_Coins, (void**)&old_Coins);
 
I'm getting an error when trying to compile on the set field example you posted above

C++:
UnityResolve::Get("somedll.dll")->Get("Player")->SetValue<void>(instance, "setCoins", 9999); // set field value
ah yeah i forgot, because the field is not the void, you need to change the type data


C++:
// SetValue<int>, change it the typedata, void is not supported for the field
UnityResolve::Get("somedll.dll")->Get("Player")->SetValue<int>(_this, "coins", 9999);
 
ah yeah i forgot, because the field is not the void, you need to change the type data


C++:
// SetValue<int>, change it the typedata, void is not supported for the field
UnityResolve::Get("somedll.dll")->Get("Player")->SetValue<int>(_this, "coins", 9999);
Thank you, I should have spotted that

It now compiles ok but the only problem is, it crashes with no log if I try to use any of the 3 UnityResolve listed above (Invoke method, read field, write field

Does it matter if the hook is in the Update method or does it use it too often?

This is the write field line which is causing a crash which is hooked in Player Update
C++:
UnityResolve::Get("UnityEngine.CoreModule.dll")->Get("Player")->SetValue<int>(instance, "Coins", 9999); // set field value

That code’s basically showing how to hook a function by name, since it’ll auto find the right address for you

Yes sorry, I didn't explain myself very well

I have no problem when hooking by address but am now trying to hook by name

All hooks are working ok apart from when I try to hook a get_ method
Hooking a get_ method works fine by address but not by name

I see quite a few games that only have get_ methods and not set_ because the set is sometimes wrapped up in obscured variables so hooking get_ and returning a new value is easier and my preferred method in these cases

Example code:
C#:
public int Coins
{
    [Token(Token = "0x6000FE3")]
    [Address(RVA = "0x20DF77A", Offset = "0x20DF77A", VA = "0x20DF77A")]
    get
    {
        return 0;
    }
}

if I hook by 0x20DF77A then I can intercept and return new value
In DnSpy the method name is shown as get_Coins but If I try and hook by name ( get_Coins ) then it doesn't work

Can a get_ method be hooked by name or do I have to find an alternative method?

Sorry for all the questions and thanks again for all your help :tumbsup:
 
Back
Top Bottom