Comments (3)
You can already see that when you hover over the FindObjectsOfType function it shows you the return value.
So there are 2 pointers.
I changed some stuff since the wiki so the actual FindObjectsOfType just need type without pointer.
ex.
Unity::il2cppArray<Unity::CGameObject*>* m_pObjects = Unity::Object::FindObjectsOfType<Unity::CGameObject>(UNITY_GAMEOBJECT_CLASS);
Also the
Unity::il2cppArray
type has nom_pArray
, I'm thinking this has been replaced withm_pValues
?
Use defined function to get array value:
Unity::CGameObject* m_pObject = m_pObjects->operator[](/* index */);
Other than that, the lib seems to be working fine, I've successfully printed methods of my PlayerManager class, but I have no idea how to call them.
CClass
has theCallMethod
function, I got the method pointer throughIL2CPP::Class::Utils::GetMethodPointer
, but how do I get aCClass
in the first place? I couldn't find a constructor and got stuck.
There is no way to get easily initialized class in memory besides hooking some function and stealing the pointer, finding gameobject that has the class connected to it via component or calling constructor function.
Also this depends if the function even needs class pointer. If the function is defined "statically" you can just call the function directly with pointer as:
reinterpret_cast<void(__fastcall*)(/* args */)>(/* pointer to function */)(/* args values */);
You gonna need to debug some stuff to figure out multiple stuff for desired game or whatever you're doing to see how the method is handled.
I also still recommend dumping the game with il2cppDumper and checking dump.cs & script.json for easier work.
from il2cpp_resolver.
Thanks for clarifying the first part, I can now get the player GameObject just fine and it works like a charm!
I also still recommend dumping the game with il2cppDumper and checking dump.cs & script.json for easier work.
I did that and I'm trying to apply what I've learned modding with BepInEx to C++.
As for the second part, in my game's case, the PlayerManager
exposes a static Instance()
method as well as a static _instance
field so I guess that's easy for getting the initialized class in memory. If I call it then I should be able to get the pointer and afterwards the aforementioned fields, like the characterList
. But how do I adapt it to the lib, like getting a CClass
or something else from the instance pointer.
from il2cpp_resolver.
You might need to understand that when you're getting the class via Instance it can diff from the actual class you want to get which holds desired fields.
Thats when I mentioned the requirement of hooking or finding gameobject that holds the component (with the class)
The IL2CPP::CClass
is literally just class handler for any custom class the game offers so you can easily use some function such as, get/set fields & properties or call/get methods.
You gonna need to reinterpret_cast the class pointer to the IL2CPP::CClass
if you wanna use it.
from il2cpp_resolver.
Related Issues (17)
- How does that work ? And how to make it work in Code::Block ? HOT 2
- Unresolved external? HOT 1
- What software did you use ? How did you build the .dll ? HOT 2
- Trying to get value from field HOT 4
- (Question) About private fields. HOT 17
- this program not support x64 applications HOT 5
- CallMethod results in a crash HOT 1
- Better W2S Function name? (Not fully tested) HOT 1
- Is this still working ? HOT 4
- closed HOT 2
- Improving the documentation HOT 6
- How do I include this into my project? HOT 1
- 86 Crashes HOT 2
- IL2CPP::ResolveCall return zero HOT 4
- Dictionary class?) HOT 6
- Custom iL2CPP Thread il2pp_thread_attach HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from il2cpp_resolver.