Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtualisation does not work on method calls #12

Open
Quit opened this issue Dec 17, 2018 · 0 comments
Open

Virtualisation does not work on method calls #12

Quit opened this issue Dec 17, 2018 · 0 comments

Comments

@Quit
Copy link
Contributor

Quit commented Dec 17, 2018

Simple scenario:

  1. The game defines a type (U), which has been thoroughly virtualised by IPA as expected.
  2. I inherit the class (as C), override some method (M), and pass an instance of my class to a method within the game.
  3. Said method is calling the (now virtualised) method M. I expect my method (C.M) be called; but it is calling the original one (U.M).

The reason is that the IL for virtual method calls and normal calls is different. For normal method calls, no lookup is performed, and it will always go straight for the original implementation. This kinda nullifies the virtualisation of methods, because overriding them doesn't really do anything.

The behaviour is similar as if the class wasn't virtual, and I were to override the method using new. A possible "fix" would be to change the IL to adjust all method calls to virtual calls; however doing so likely incurs a performance impact, if it is even possible at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant