Help! Getting the pointer of a static class?

ThePerplexedOne

Approved Modder
Original poster
Approved Modder
Jun 9, 2019
43
2,187
183
29
United Kingdom
The unity game I'm modding has a class called MonoSingleton which contains a method get_Instance() which will return the instance of whatever type is passed through:

1655390773247.png


I have used Il2CPPInspector to generate the following code:

C++:
DO_APP_FUNC(0x00EE7014, PlayerDataManager *, MonoSingleton_1_PlayerDataManager__get_Instance, (MethodInfo * method));
DO_APP_FUNC_METHODINFO(0x0278F028, MonoSingleton_1_PlayerDataManager__get_Instance__MethodInfo);
There are a lot more of these, and each one containing get_Instance() points to 0x00EE7014

So I'm guessing I have to pass a pointer to MethodInfo to this generic function in order to retrieve what I want, but I'm unsure how I get the instance of MethodInfo that I need

This is what I've tried to far but with no success:

C++:
GetInstance = (void*(*)(void *))getAbsoluteAddress(targetLibName, 0x00EE7014);
C++:
void* pdm = GetInstance((void*)getAbsoluteAddress(targetLibName, 0x0278F028));

if(pdm) {

    AddGem(pdm, 1000, nullptr, nullptr);

}