ByNameModding / BNM-Android

Modding il2cpp games by classes, methods, fields names on Android.
MIT License
203 stars 39 forks source link

How to use PLT series HOOK? #61

Closed 2079541547 closed 1 month ago

2079541547 commented 1 month ago

I want to use bytehook as the HOOK because plt hook has lower performance overhead than inline hook after setting up

BNM-Dev commented 1 month ago

PLT can't be used for BNM. libunity imports il2cpp API using dlsym, so you can't use PLT. (As I understand how bytehook works, it will not replace this methods).

If you don't need ClassesManagement, you can disable it. It will reduce hooks to one hook. (il2cpp_init, but in next BNM version it will be unhooked after use).

And you can't use PLT hooks for hooking il2cpp game methods, because them not exported and can be called from lib itself.

BNM-Dev commented 1 month ago

And how many inline hooked methods you will have?

2079541547 commented 1 month ago

Probably around a few hundred, but there could be more

BNM-Dev commented 1 month ago

If them wrote normally, without hundreds of loops and other time consuming things this will not affect performance really hard. Only maybe lower on 1 - 5 fps. Still need do some checks, but for now, don't think about performance if project not done. Optimize it, only if you already has performance problems.

2079541547 commented 1 month ago

image image My project will read the JSON file to obtain the configuration, and then load the SO file using functions such as loadAndInvoke IntFunctions and call the functions in it. It will be used in the HOOK function

BNM-Dev commented 1 month ago

You can use yyjson (cpp wrapper) to speed up json read. But I don't think that you will have jsons for megabytes.

Loading libs in game thread is bad idea. This is too time consuming. Try create other loading system.

2079541547 commented 1 month ago

This is the only way, because there is a problem with the sharing mode of shadowhook

BNM-Dev commented 1 month ago

In programming exist a lot of ways of doing something. Rational, irrational, doesn't matter just need try all, or figure out new one.