Added support for games using the Unity engine #36
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds support for memory scanning in Unity games.
Largely based on the original code taken from https://github.com/CryZe/lunistice-auto-splitter/blob/master/asr-dotnet/src/lib.rs, with some minor bug fix and support for both Mono and IL2CPP.
More specifically, this PR adds 2 new crate features, named
mono
andil2cpp
(as the name implies,mono
is to be used for non-il2cpp).Each of those features internally calls different offsets based on the structs used in the particular version the target game is built on. There is a
try_attach()
function that is capable of automatically identify the version of the unity engine used in the target process, but it's actually recommended to specify the version manually. It's up to the authors of the autosplitters, in any case, to know which version is used in their game and to be sure the automatic version reporting is accurate. If the autosplitter loads the wrong structs/offsets, it will fail to identify the subsequent Mono classes.Also, it is of note that, since there are few 32-bit IL2CPP games, and the struct of the Il2CppClass is not known to me, only 64-bit games are supported. However, for non-il2cpp, 32-bit and 64-bit games supported.
The main class is instantiated by calling
asr::dotnet::Il2cpp::attach(&process)
orasr::dotnet::mono::attach(&process)
(or their awaitable variants (wait_attach(&process)
).From there we can find our mono assembly of interest via
get_image(&str)
. Aget_default_image()
function is also provided in case you're just looking forAssembly-CSharp
.It is then possible to lookup for a specific
MonoClass
by giving its name.The code also allows, inside
MonoClass
:Custom functions can be coded by the authors of the autosplitters, if necessary.
The example below refers to Pacman World Re-Pac:
Additionally, the
SceneManager
class can be instantiated to get data relative to the current Unity scene.Example:
SceneManager is supported in both 32-bit and 64-bit games.