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

[Unity] Various edits in the Unity code #71

Merged
merged 9 commits into from
Jan 28, 2024

Conversation

Jujstme
Copy link
Contributor

@Jujstme Jujstme commented Oct 21, 2023

This fixes automatic pointer path resolution for Unity games by adding 2 features:

  1. caching of resolved offsets
    If the code is dealing with Classes that didn't run their cctor, automatic pointer path resolution fails. However, caching the offsets already resolved allows the script to skip over them instead of looking for them again. This greatly improves performance, as some functions, especially the get_class() one, are very intensive and slow, requiring hundredths of memory reads in some games and potentially stalling the execution of the autosplitter

  2. looking for child classes through their vtable
    This also fixes automatic pointer path resolution when traversing arrays or standard C# structures the previous implementation of this function was failing on.

Together with its companion PR #69 , this should fix most if not all the outstanding bugs there were left and I could identify so far with this engine.

A couple of additional commits have also been added in roder to have Copy on the DeepPointer struct, as well as adding a read_pointer() function inside Process.

@Jujstme Jujstme marked this pull request as draft October 25, 2023 20:23
@Jujstme Jujstme marked this pull request as ready for review October 25, 2023 22:41
@Jujstme Jujstme changed the title [Unity] Pointer path resolution bugfixing [Unity] Various edits in the Unity code Oct 26, 2023
Jujstme and others added 9 commits January 28, 2024 14:26
By entering the class instance and looking at the data in its vtable we can avoid looping through all classes in the Il2Cpp assembly, increasing performance.
This fixes automatic pointer path resolution for Unity games by adding 2 features:

1. caching of resolved offsets
   If the code is dealing with Classes that didn't run their cctor, automatic pointer path resolution shall fail. However, caching the offsets already resolved allows the script to skip over the resolved offsets instead of looking for them again. This greatly improves performance, as some functions, especially the get_class() one, are very intensive and slow, requiring hundredths of memory reads in some games and potentially stalling the execution of the autosplitter

2. looking for child classes through their vtable
  This also fixes automatic pointer path resolution when traversing arrays or standard C# structures the previous implementation of this function was failing on.
@CryZe CryZe merged commit 41a371a into LiveSplit:master Jan 28, 2024
4 checks passed
@CryZe CryZe added the enhancement New feature or request label Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants