Il2CppInterop
Il2CppInterop copied to clipboard
Memory validation and runtime module dump
-
Memory region protection validation Current main stream implementation of FindMethodSignature fails when the memory region is protected. This leads to an access violation error. This pull request implemented memory validation and set them to
execute_read_write
before signature scanning. Protection right is restore after signature scanning. -
Runtime module dump to support obscure game assembly Current main stream implementation of interop generation uses raw
GameAssembly.dll
andglobal-metadata.dat
. This will fail if the game is packed and ifglobal-metadata.dat
is embedded inGameAssembly.dll
. This pull request implemented runtime module dump.global-metadata.dat
is extracted using pattern matching.
- Optional metadata magic fixing is also implemented for obfuscated
global-metadata.dat
, so the output product can be used inil2cppdumper
. -
ILogger
is a required parameter for the considerations that this method may be used before interop generation. That is beforeCreate
.
This implementation is Windows-only so that would have to change.
But this is not something that's needed for vanilla unity and is highly specific to particular games, so maybe we should expose hooks for preloader plugins in BepInEx to handle this instead?
If I am not mistaken, Preloader patches are applied after interop generation. The implementation I applied to BepInEx was before interop generation and after Cecil assembly definitions are generated. If we were to do something similar to a preloader, we will need to change the execution order.