-
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
I asked myself, I immediately found the answer myself :D const csharp = Il2Cpp.domain.assembly('Assembly-CSharp').image
csharp.class('Account').method('get_Instance').implementation = function () {
let acc = this.method('get_Instance').invoke()
// acc is Account instance
return acc
} it turns out that for such a construction with Instance, its own get_<field name> method is created. Apparently, these are features of C#, and I practically didn't write on it. |
Beta Was this translation helpful? Give feedback.
-
In general, if someone has an answer to the question is it possible to hook access to fields - I will be glad to feedback |
Beta Was this translation helpful? Give feedback.
-
As a hack you get the in memory address of the SafeInt(handle) of the account instance and override the implementation of GetValue and inside check if the addresses matches then do what you want
But yeah if there is other clean way of doing it, would be happy to hear other suggestions 😄 |
Beta Was this translation helpful? Give feedback.
-
It is a design pattern and it is called singleton and it is not c# specific, but in general to OOP |
Beta Was this translation helpful? Give feedback.
I asked myself, I immediately found the answer myself :D
it turns out that for such a construction with Instance, its own get_<field name> method is created. Apparently, these are features of C#, and I practically didn't write on it.
Actually, in my case, it also gives the opportunity to replace the values of the fields at the same time