sneakyevil / IL2CPP_Resolver

A run-time API resolver for IL2CPP Unity.
https://sneakyevil.gitbook.io/il2cpp-resolver/
The Unlicense
323 stars 65 forks source link

How can I obtain a singleton from a parent class #31

Closed lushihao8 closed 1 year ago

lushihao8 commented 1 year ago

How can I obtain a singleton from a parent class

5AO@4)@45 DLQ@U~C2Z ~Y

GameManager inherits Singleton, how to call instance of parent class and return a singleton of GameManager

M`@%X`ST2YJB}~6W CI{TOG

This is the function signature generated by Il2CppDumper

N$RET )`J5Z(RN855H_KP9M

I want to get the GameManager in Singleton pattern, but this does not seem to work. m Get Instance is a null pointer

GP$CDP8SRD Z(`Z7C909OGE

This is the correct C sharp code

84}~Y2XYFDDMFHP2R09NNCG

This is a simple little game

extremeblackliu commented 1 year ago

get function: auto get_instance = IL2CPP::Class::Utils::GetMethodPointer("full class name", "function name"); call it: get_instance();

static classes/functions does not need thisptr. you look like new to il2cpp games, i wont spondfeed anything, you need understand basics of il2cpp before start using this lib.

lushihao8 commented 1 year ago

I have obtained get_ The address of the instance, but it seems that all classes point to this address. I called this function and the game crashed WD95_XVPJV`%_3NACU5P7UI

lushihao8 commented 1 year ago

It looks like this field YD9@3I7H75D %P1PRR4V)32

extremeblackliu commented 1 year ago

check GameAssembly.dll in ida , for static function, it will always fill itself ecx/rcx(thisptr), check function in ida youll see how it works, if you still keeping your point, i couldnt help you. read and learn basic reverse engineer skills could help you understanding what is happening to game. this issue is closed due to not related library issue. read histroy issues.

lushihao8 commented 1 year ago

All the questions here cannot be solved in any way. When you are not familiar with il2cpp, do not try to ask any questions here. You only need to add two APIs to solve the problem, "il2cpp_field_static_get_value", "il2cpp_class_get_parent", @sneakyevil Please try adding them to the framework,which can obtain static fields in the class and static fields in the parent class 企业微信截图_16879234431426 The obtained results are identical to CE 1$ 9`}K)I3IH9GIV82F4J$3 M2)19229I7N_5ZCMGO VU6 By the way, what is parentGameManagerClass YDZ2(GP5I3AD 9)43E0) PO

extremeblackliu commented 1 year ago

you literally just being offensive here, for what? begging for spoonfeed failed? you literally using inspector and trying to understand how does it works , meanwhile i already told you in previous comment go check the code in ida you will understand, you ignored it and still trying to go with your way, please, next time learn deeply before telling anyone that they are noob. owner will not help with offensive people. took 5 sec google for you: https://stackoverflow.com/questions/4124102/whats-a-static-method-in-c https://stackoverflow.com/a/10989601 if you still dont understand and keep offensive, stop following this issue and messaging anyone and stop using the library because "we are noob".

extremeblackliu commented 1 year ago

i can see how you mad, you are now offensive and cringe here, for anyone who ever trying to read this issue, let me reveal the truth, the dude who created this issue literally alt account(first cringe point), and i trying to help with him in a comment for firstly know his problem, the dude wanna me help him outside of this issue, he trying to write me on bilibili's private message begging me for help, i didnt give fuck, i told him if you wanna me help you 1 by 1 or spoodfeed its okay, pay me for my time, he didnt makes response there since he know that i accept paid only, and now he raging(crying) on here for not helping him. i closed this issue not for my personally that if he didnt paid me or something, its because its not related to library issue, this issue is same in perivous issues there is dude begging for help and owner didnt wanna help with such problem(again not related to library), beside me help with people, but this guy dont wanna hear anything besides actual code, i do have access of the repo, i closed this due to that, the guy didnt wanna hear what i told him to do and ignored all, also provided 0 information to let anyone help him. i can know how sadly truth how people failed and cant do shit just screaming around issue to begging anyone helping, important is that he doesnt even wanna spend the time to go learn those things instead than tryharding write me garbage message. also i didnt mention your improve is pointless, still my point static function fills itself the thisptr, you just wasting more code on it have fun.